Skip to content
Commits on Source (4)
ocrizer (1.0.1) jessie; urgency=medium
* ocrizer.py: create the class OcrizerException to report exceptions
to users
* ocrizer.py: report to the user when no device is found to avoid him
to wait indefinitely
* When no scanner is found a simpler error is now reported to the
user, we report now "Couldn't find an obvious scanner device"
-- Alex ARNAUD <alexarnaud@hypra.fr> Thu, 09 May 2019 16:19:33 +0200
ocrizer (1.0.0) jessie; urgency=medium
[ Colomban Wendling ]
......
......@@ -175,12 +175,12 @@ class OCRizer():
try:
chosen_dev = devices[0]
except IndexError as e:
e = Exception(_("Couldn't find any scanner device"))
e = OcrizerException(_("Couldn't find any scanner device"))
e.notification_message = _("Couldn't find any scanner device")
raise e
else:
e = Exception(_("Couldn't find an obvious scanner device"))
e.notification_message = _("Couldn't find an obvious scanner device")
e = OcrizerException(_("Couldn't find any scanner device"))
e.notification_message = _("Couldn't find any scanner device")
raise e
return chosen_dev
......@@ -369,6 +369,9 @@ class OCRizer():
self.move_files_to_destination()
self.remove_tmp_files()
self.launch_libreoffice()
except OcrizerException as e:
self.send_notification(e.notification_message)
sys.exit(1)
except Exception as e:
traceback.print_exc()
self.logger.critical(e)
......@@ -430,7 +433,8 @@ def parse_args(argv=None):
args.ocr_engine_class = OCREngines_available[args.ocr_engine] # pass the class inside the args
return args
class OcrizerException(Exception):
pass
def start(argv=None):
es = gettext.translation('ocrizer', fallback=True)
......