[Pycodeocr-main] SF.net SVN: pycodeocr:[59] trunk
Status: Beta
Brought to you by:
drtrigon
From: <drt...@us...> - 2011-12-22 22:42:34
|
Revision: 59 http://pycodeocr.svn.sourceforge.net/pycodeocr/?rev=59&view=rev Author: drtrigon Date: 2011-12-22 22:42:28 +0000 (Thu, 22 Dec 2011) Log Message: ----------- bug fix; 'None' could not be converted into string in 'ocr.py' some additional minor changes for simpler debugging and others Modified Paths: -------------- trunk/PyCodeOCR.py trunk/utils/ocr.py Modified: trunk/PyCodeOCR.py =================================================================== --- trunk/PyCodeOCR.py 2011-09-17 18:41:11 UTC (rev 58) +++ trunk/PyCodeOCR.py 2011-12-22 22:42:28 UTC (rev 59) @@ -56,7 +56,9 @@ utils.requirements.check_all_pycodeocr_requirements() sys.exit() +debug = ("--debug" in sys.argv) + # GTK, PyGTK, GLADE (GNOME) modules import pygtk pygtk.require('2.0') @@ -156,7 +158,7 @@ MDE = { 'invoices': 0, 'barcode': 1, 'DataMatrix': 2, 'PDF417': 3 } ## Initialize - def __init__(self): + def __init__(self, BlacklistMgr): # # retrieve widgets # # main_window - main window # ## gladefile raw_path.glade @@ -260,12 +262,14 @@ # redirect print self.logging = utils.logging(self.textbuffer) - sys.stdout = self.logging - sys.stderr = self.logging + if not debug: + sys.stdout = self.logging + sys.stderr = self.logging # initialize treeviews in Blacklist Manager - BlacklistMgr.post_init(self.device_treeview, self.blacklist_treeview, local_path) + self.BlacklistMgr = BlacklistMgr + self.BlacklistMgr.post_init(self.device_treeview, self.blacklist_treeview, local_path) print "---------",strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime()),"----------" @@ -282,10 +286,11 @@ self.device_chooser_event = threading.Event() ## initialize sane - self.run_sane = utils.ocr.RunSANE(self.notebook, self.progress, self.device_chooser_button, BlacklistMgr,self.device_chooser_event,self.device_info_text) + self.run_sane = utils.ocr.RunSANE(self.notebook, self.progress, self.device_chooser_button, self.BlacklistMgr,self.device_chooser_event,self.device_info_text) self.run_sane.start() # redirect print again to old textbuffer - sys.stdout = self.logging + if not debug: + sys.stdout = self.logging gtk.main() @@ -374,11 +379,11 @@ ## add device to blacklist def blacklist_add(self, widget=None): - BlacklistMgr.blacklist_add() + self.BlacklistMgr.blacklist_add() ## remove device from blacklist def blacklist_remove(self, widget=None): - BlacklistMgr.blacklist_remove() + self.BlacklistMgr.blacklist_remove() ## one of the placement coordinates changed def on_placement_value_changed(self, source=None, event=None): @@ -808,11 +813,9 @@ self.refresh() if __name__ == '__main__': - global BlacklistMgr - global main ## initialize Blacklist Manager BlacklistMgr = utils.blacklist_manager() ## run main application - main = MainWindowGTK() + main = MainWindowGTK(BlacklistMgr) main.run() Modified: trunk/utils/ocr.py =================================================================== --- trunk/utils/ocr.py 2011-09-17 18:41:11 UTC (rev 58) +++ trunk/utils/ocr.py 2011-12-22 22:42:28 UTC (rev 59) @@ -259,7 +259,7 @@ print "\n" print 'Device options:' for opt in self.opts: - print opt[2]+ ": " + opt[3] + print "%s: %s" % (opt[2], opt[3]) def retry(self): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |