def __init__(self, settings): """ Init for Application :param settings: (string) settings xml filename """ self.appModel = AppModel({ 'settings': functions.find_data_file(settings, 'data'), 'strings': None }) tk.CallWrapper = tec.TkErrorCatcher self.appView = AppView() self.appView.root.protocol('WM_DELETE_WINDOW', self.quit) self.appView.root.geometry(self.appModel.settings['geometryAppView']) self.visibleView = self.appModel.strings['defaultStartView'] self.lastView = None # ADD OTHER MVC FRAMES HERE self.app_mvc = { 'Default': { 'model': DefaultModel, 'view': DefaultView, 'controller': DefaultController, 'geometry': self.appModel.settings['geometryDefaultView'] } } self.model = None self.controller = None self.views = {} self.load_views() self.load_menu()
def run(self): """ called by main. This is the main loop for tkinter :return: void """ self.appView.root.title(self.appModel.strings['applicationTitle']) self.appView.root.iconbitmap(functions.find_data_file( 'app.ico', 'src')) self.appView.root.deiconify() self.appView.root.mainloop()
def __init__(self, filenames): """ :param filenames: (dictionary) contains XML file names """ super(AppModel, self).__init__(filenames) # SETTINGS FROM FILE & LOAD VALUES self.load_xml_settings() self.filenames['strings'] = functions.find_data_file( self.settings['filenameLanguage'], 'data') # LOAD PLACE HOLDERS self.load_xml_strings('APP')
def __init__(self, filenames, debug=False): """ :param filenames: (dictionary) contains XML file names :param debug: """ super(AppModel, self).__init__(filenames, debug) # SETTINGS FROM FILE & LOAD VALUES self.load_xml_settings() if self.settings['debug'] == "True": debug = True print(self.debug) print('AppModel: __init__ (after settings loaded)') print('AppModel: filename : ' + self.filenameSettings) print('AppModel: load_xml_settings() (after xml_settings were loaded)') print('AppModel: invoking Super __init__') else: debug = False self.filenameContacts = functions.find_data_file(self.settings['filenameContacts'], 'data') self.filenameLanguage = functions.find_data_file(self.settings['filenameLanguage'], 'data') # LOAD PLACE HOLDERS self.load_xml_strings('APP')
def __init__(self, settings): """ Init for Application :param settings: (string) settings xml filename """ self.appModel = AppModel({ 'settings': functions.find_data_file(settings, 'data'), 'contacts': None, 'language': None }) self.debug = self.appModel.debug if self.debug: print('Application: __init__') tk.CallWrapper = tec.TkErrorCatcher self.appView = AppView(self.debug) self.appView.root.protocol('WM_DELETE_WINDOW', self.quit) self.appView.root.geometry(self.appModel.settings['geometryAppView']) self.visibleView = self.appModel.strings['defaultStartView'] self.lastView = None self.app_mvc = { 'Send': { 'model': SendModel, 'view': SendView, 'controller': SendController, 'geometry': self.appModel.settings['geometrySendView'] }, 'Edit': { 'model': EditModel, 'view': EditView, 'controller': EditController, 'geometry': self.appModel.settings['geometryEditView'] }, 'List': { 'model': ListModel, 'view': ListView, 'controller': ListController, 'geometry': self.appModel.settings['geometryListView'] } } self.model = None self.controller = None self.views = {} self.load_views() self.load_menu()