-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathcalibrate.py
31 lines (25 loc) · 888 Bytes
/
calibrate.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from nestris_ocr.calibration.calibrator import Calibrator
from nestris_ocr.calibration.simple_calibrator import SimpleCalibrator
from nestris_ocr.config import config
from nestris_ocr.capturing import uncached_capture
def get_calibrator_type(config):
if config["calibrator.ui"] == "SIMPLE":
return SimpleCalibrator
elif config["calibrator.ui"] == "ADVANCED":
return Calibrator
else:
return Calibrator
def mainLoop():
exit_program = False
while not exit_program:
Constructor = get_calibrator_type(config)
c = Constructor(config)
while not c.destroying:
c.update()
# needs to be called outside of c.update()
if c.exit_calibrator:
exit_program = c.exit_program
c.on_exit()
uncached_capture().stop()
if __name__ == "__main__":
mainLoop()