From 33b9f44354039f664a9a8cac0329b7b2860b2bfb Mon Sep 17 00:00:00 2001 From: hploetz Date: Wed, 14 Nov 2007 14:04:32 +0000 Subject: Enhance GUI, can now enter MRZ information and read new passport from GUI git-svn-id: svn+ssh://localhost/home/henryk/svn/cyberflex-shell/trunk@251 f711b948-2313-0410-aaa9-d29f33439f0b --- readpass.py | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'readpass.py') diff --git a/readpass.py b/readpass.py index ad38508..be188f1 100755 --- a/readpass.py +++ b/readpass.py @@ -3,12 +3,13 @@ import utils, cards, TLV_utils, sys, binascii, time, traceback -OPTIONS = "GW:R:" -LONG_OPTIONS = ["no-gui", "write-files-basename", "read-files-basename"] +OPTIONS = "iGW:R:" +LONG_OPTIONS = ["interactive","no-gui", "write-files-basename", "read-files-basename"] use_gui = True write_files = None read_files = None +start_interactive = False if __name__ == "__main__": c = utils.CommandLineArgumentHelper() @@ -18,12 +19,16 @@ if __name__ == "__main__": for option, value in options: if option in ("-G","--no-gui"): use_gui = False + start_interactive = False elif option in ("-W","--write-files-basename"): write_files = value elif option in ("-R","--read-files-basename"): read_files = value + elif option in ("-i", "--interactive"): + start_interactive = True + use_gui = True - if read_files is None: + if read_files is None and not start_interactive: card_object = c.connect() card = cards.new_card_object(card_object) cards.generic_card.DEBUG = False @@ -36,15 +41,21 @@ if __name__ == "__main__": p = cards.passport_application.Passport.from_card(card, ["",arguments[0]]) else: p = cards.passport_application.Passport.from_card(card) - else: + elif read_files is not None: p = cards.passport_application.Passport.from_files(basename=read_files) + elif start_interactive: + p = None - if write_files is not None: + if write_files is not None and not start_interactive: p.to_files(basename=write_files) if use_gui: import gui g = gui.PassportGUI() - g.set_passport(p) + if p is not None: + g.set_passport(p) + else: + g.clear_display() + g.set_card_factory(c) g.run() -- cgit v1.2.3