def __init__(self): global app app = self import __builtin__ __builtin__.__dict__['app'] = app self.initmixin() self.appname = __appname__ self.author = __author__ Globals.app = self self.wxApp = wxApp(0) self.frame = self.init() self.frame.Show() self.wxApp.SetTopWindow(self.frame) common.print_time('end...', DEBUG) self.wxApp.MainLoop()
Globals.confpath = confpath ini = common.get_config_file_obj() debugflag = ini.default.get('debug', False) #add pythonpath settings if ini.default.has_key('pythonpath'): pythonpath = ini.default.pythonpath if isinstance(pythonpath, list): sys.path = pythonpath + sys.path elif isinstance(pythonpath, (str, unicode)): sys.path.insert(0, pythonpath) else: print 'The pythonpath should be a string list or a string.' common.print_time('begin...', DEBUG) Debug.debug = Debug.Debug(os.path.join(workpath, 'debug.txt'), debugflag) Debug.error = Debug.Debug(os.path.join(workpath, 'error.txt'), True) #hook global exception def myexcepthook(type, value, tb): Debug.error.traceback((type, value, tb)) sys.excepthook = myexcepthook #install i18n package i18n = i18n.I18n('./lang', keyfunc='tr') #ini = dict4ini.DictIni(os.path.join(workpath, 'config.ini'))
Globals.confpath = confpath ini = common.get_config_file_obj() debugflag = ini.default.get('debug', False) #add pythonpath settings if ini.default.has_key('pythonpath'): pythonpath = ini.default.pythonpath if isinstance(pythonpath, list): sys.path = pythonpath + sys.path elif isinstance(pythonpath, (str, unicode)): sys.path.insert(0, pythonpath) else: print 'The pythonpath should be a string list or a string.' common.print_time('begin...', DEBUG) Debug.debug = Debug.Debug(os.path.join(workpath, 'debug.txt'), debugflag) Debug.error = Debug.Debug(os.path.join(workpath, 'error.txt'), True) #hook global exception def myexcepthook(type, value, tb): Debug.error.traceback((type, value, tb)) sys.excepthook = myexcepthook #install i18n package i18n = i18n.I18n('./lang', keyfunc='tr') #ini = dict4ini.DictIni(os.path.join(workpath, 'config.ini')) if ini.language.get('default', None) is not None: i18n.install(ini.language.default)