def OnApply(self, evt): """ Apply changes """ ### Reload DomainBehavior and DomainStructure if __builtin__.__dict__['DEFAULT_DEVS_DIRNAME'] != self.default_devs_dir: ### change builtin before recompile the modules __builtin__.__dict__['DEFAULT_DEVS_DIRNAME'] = self.default_devs_dir ### recompile the modules. ### recompile DomainInterface.DomainBehavior with all loaded module depending on this one for m in sys.modules: clsmembers = inspect.getmembers(sys.modules[m], inspect.isclass) if clsmembers != [] and clsmembers[0][0] == 'DomainBehavior': module_path = os.path.dirname(sys.modules[m].__file__) ### if m come from amd or cmd, pass path to recompile method to differentiate if zipfile.is_zipfile(module_path): ReloadModule.recompile(module_path) else: ReloadModule.recompile(m) ReloadModule.recompile("DomainInterface.DomainStructure") ReloadModule.recompile("DomainInterface.MasterModel") __builtin__.__dict__['SIMULATION_SUCCESS_SOUND_PATH'] = self.sim_success_sound_path __builtin__.__dict__['SIMULATION_ERROR_SOUND_PATH'] = self.sim_error_sound_path __builtin__.__dict__['DEFAULT_SIM_STRATEGY'] = self.sim_defaut_strategy __builtin__.__dict__['DEFAULT_PLOT_DYN_FREQ'] = self.sim_defaut_plot_dyn_freq __builtin__.__dict__['NTL'] = self.cb2.GetValue()
def OnApply(self, evt): """ Apply changes """ ### Reload DomainBehavior and DomainStructure if __builtin__.__dict__[ 'DEFAULT_DEVS_DIRNAME'] != self.default_devs_dir: ### change builtin before recompile the modules __builtin__.__dict__[ 'DEFAULT_DEVS_DIRNAME'] = self.default_devs_dir ### recompile the modules. ### recompile DomainInterface.DomainBehavior with all loaded module depending on this one d = copy.copy(sys.modules) for m in d: if d[m]: try: clsmembers = inspect.getmembers(d[m], inspect.isclass) if clsmembers != [] and clsmembers[0][ 0] == 'DomainBehavior': module_path = os.path.dirname(d[m].__file__) ### if m come from amd or cmd, pass path to recompile method to differentiate if zipfile.is_zipfile(module_path): ReloadModule.recompile(module_path) else: ReloadModule.recompile(m) except Exception, info: sys.stdout.write("Exception in PreferenceGui") sys.stdout.write(str(info)) ReloadModule.recompile("DomainInterface.DomainStructure") ReloadModule.recompile("DomainInterface.MasterModel")
def OnApply(self, evt): """ Apply changes """ ### Reload DomainBehavior and DomainStructure if __builtin__.__dict__[ 'DEFAULT_DEVS_DIRNAME'] != self.default_devs_dir: ### change builtin before recompile the modules __builtin__.__dict__[ 'DEFAULT_DEVS_DIRNAME'] = self.default_devs_dir ### recompile the modules. ### recompile DomainInterface.DomainBehavior with all loaded module depending on this one d = copy.copy(sys.modules) for m in d: clsmembers = inspect.getmembers(d[m], inspect.isclass) if clsmembers != [] and clsmembers[0][0] == 'DomainBehavior': module_path = os.path.dirname(d[m].__file__) ### if m come from amd or cmd, pass path to recompile method to differentiate if zipfile.is_zipfile(module_path): ReloadModule.recompile(module_path) else: ReloadModule.recompile(m) ReloadModule.recompile("DomainInterface.DomainStructure") ReloadModule.recompile("DomainInterface.MasterModel") __builtin__.__dict__[ 'SIMULATION_SUCCESS_SOUND_PATH'] = self.sim_success_sound_path __builtin__.__dict__[ 'SIMULATION_ERROR_SOUND_PATH'] = self.sim_error_sound_path __builtin__.__dict__['DEFAULT_SIM_STRATEGY'] = self.sim_defaut_strategy __builtin__.__dict__[ 'DEFAULT_PLOT_DYN_FREQ'] = self.sim_defaut_plot_dyn_freq __builtin__.__dict__['NTL'] = self.cb2.GetValue()
def OnApply(self, evt): """ Apply changes """ ### Reload DomainBehavior and DomainStructure if __builtin__.__dict__[ 'DEFAULT_DEVS_DIRNAME'] != self.default_devs_dir: ### change builtin before recompile the modules __builtin__.__dict__[ 'DEFAULT_DEVS_DIRNAME'] = self.default_devs_dir ### recompile the modules. ### recompile DomainInterface.DomainBehavior with all loaded module depending on this one d = copy.copy(sys.modules) for m in d: if d[m]: try: clsmembers = inspect.getmembers(d[m], inspect.isclass) if clsmembers != [] and clsmembers[0][ 0] == 'DomainBehavior': module_path = os.path.dirname(d[m].__file__) ### if m come from amd or cmd, pass path to recompile method to differentiate if zipfile.is_zipfile(module_path): ReloadModule.recompile(module_path) else: ReloadModule.recompile(m) except Exception as e: sys.stdout.write("Exception in PreferenceGui") sys.stdout.write(e) ReloadModule.recompile("DomainInterface.DomainStructure") ReloadModule.recompile("DomainInterface.MasterModel") ### enable the priority (DEVS select function) icon depending on the selected DEVS kernel mainW = wx.GetApp().GetTopWindow() mainW.tb.EnableTool( Menu.ID_PRIORITY_DIAGRAM, not 'PyPDEVS' in __builtin__.__dict__['DEFAULT_DEVS_DIRNAME']) __builtin__.__dict__[ 'SIMULATION_SUCCESS_SOUND_PATH'] = self.sim_success_sound_path __builtin__.__dict__[ 'SIMULATION_ERROR_SOUND_PATH'] = self.sim_error_sound_path __builtin__.__dict__['DEFAULT_SIM_STRATEGY'] = self.sim_defaut_strategy __builtin__.__dict__[ 'DEFAULT_PLOT_DYN_FREQ'] = self.sim_defaut_plot_dyn_freq __builtin__.__dict__['NTL'] = self.cb2.GetValue()
def OnApply(self, evt): """ Apply changes """ ### Reload DomainBehavior and DomainStructure if __builtin__.__dict__['DEFAULT_DEVS_DIRNAME'] != self.default_devs_dir: ### change builtin before recompile the modules __builtin__.__dict__['DEFAULT_DEVS_DIRNAME'] = self.default_devs_dir ### recompile the modules. ### recompile DomainInterface.DomainBehavior with all loaded module depending on this one d = copy.copy(sys.modules) for m in d: if d[m]: try: clsmembers = inspect.getmembers(d[m], inspect.isclass) if clsmembers != [] and clsmembers[0][0] == 'DomainBehavior': module_path = os.path.dirname(d[m].__file__) ### if m come from amd or cmd, pass path to recompile method to differentiate if zipfile.is_zipfile(module_path): ReloadModule.recompile(module_path) else: ReloadModule.recompile(m) except Exception as e: print e ReloadModule.recompile("DomainInterface.DomainStructure") ReloadModule.recompile("DomainInterface.MasterModel") ### enable the priority (DEVS select function) icon depending on the selected DEVS kernel mainW = wx.GetApp().GetTopWindow() mainW.tb.EnableTool(Menu.ID_PRIORITY_DIAGRAM, not 'PyPDEVS' in __builtin__.__dict__['DEFAULT_DEVS_DIRNAME']) __builtin__.__dict__['SIMULATION_SUCCESS_SOUND_PATH'] = self.sim_success_sound_path __builtin__.__dict__['SIMULATION_ERROR_SOUND_PATH'] = self.sim_error_sound_path __builtin__.__dict__['DEFAULT_SIM_STRATEGY'] = self.sim_defaut_strategy __builtin__.__dict__['DEFAULT_PLOT_DYN_FREQ'] = self.sim_defaut_plot_dyn_freq __builtin__.__dict__['NTL'] = self.cb2.GetValue()
def OnApply(self, evt): """ Apply changes """ ### Reload DomainBehavior and DomainStructure if __builtin__.__dict__['DEFAULT_DEVS_DIRNAME'] != self.default_devs_dir: ### change builtin before recompile the modules __builtin__.__dict__['DEFAULT_DEVS_DIRNAME'] = self.default_devs_dir ### recompile the modules. ReloadModule.recompile("DomainInterface.DomainBehavior") ReloadModule.recompile("DomainInterface.DomainStructure") ReloadModule.recompile("DomainInterface.MasterModel") __builtin__.__dict__['SIMULATION_SUCCESS_SOUND_PATH'] = self.sim_success_sound_path __builtin__.__dict__['SIMULATION_ERROR_SOUND_PATH'] = self.sim_error_sound_path __builtin__.__dict__['DEFAULT_SIM_STRATEGY'] = self.sim_defaut_strategy __builtin__.__dict__['DEFAULT_PLOT_DYN_FREQ'] = self.sim_defaut_plot_dyn_freq __builtin__.__dict__['NTL'] = self.cb2.GetValue()
def OnApply(self, evt): """ Apply changes """ ### Reload DomainBehavior and DomainStructure if __builtin__.__dict__[ 'DEFAULT_DEVS_DIRNAME'] != self.default_devs_dir: ### change builtin before recompile the modules __builtin__.__dict__[ 'DEFAULT_DEVS_DIRNAME'] = self.default_devs_dir ### recompile the modules. ReloadModule.recompile("DomainInterface.DomainBehavior") ReloadModule.recompile("DomainInterface.DomainStructure") ReloadModule.recompile("DomainInterface.MasterModel") __builtin__.__dict__[ 'SIMULATION_SUCCESS_SOUND_PATH'] = self.sim_success_sound_path __builtin__.__dict__[ 'SIMULATION_ERROR_SOUND_PATH'] = self.sim_error_sound_path __builtin__.__dict__['DEFAULT_SIM_STRATEGY'] = self.sim_defaut_strategy __builtin__.__dict__[ 'DEFAULT_PLOT_DYN_FREQ'] = self.sim_defaut_plot_dyn_freq __builtin__.__dict__['NTL'] = self.cb2.GetValue()
def OnApply(self, evt): """ Apply changes. """ ### Reload DomainBehavior and DomainStructure if builtins.__dict__['DEFAULT_DEVS_DIRNAME'] != self.default_devs_dir: ### change builtin before recompile the modules builtins.__dict__['DEFAULT_DEVS_DIRNAME'] = self.default_devs_dir ### recompile the modules. ### recompile DomainInterface.DomainBehavior , DomainInterfaceStructure and MasterModel ### recompile all librairies that depend on DomainBehavior (all loaded lib) ReloadModule.recompile("DomainInterface.DomainBehavior") ReloadModule.recompile("DomainInterface.DomainStructure") ReloadModule.recompile("DomainInterface.MasterModel") mainW = wx.GetApp().GetTopWindow() nb1 = mainW.GetControlNotebook() tree = nb1.GetTree() tree.UpdateAll() ### enable the priority (DEVS select function) icon depending on the selected DEVS kernel mainW = wx.GetApp().GetTopWindow() tb = mainW.GetToolBar() tb.EnableTool( Menu.ID_PRIORITY_DIAGRAM, not 'PyPDEVS' in builtins.__dict__['DEFAULT_DEVS_DIRNAME']) builtins.__dict__[ 'SIMULATION_SUCCESS_SOUND_PATH'] = self.sim_success_sound_path builtins.__dict__[ 'SIMULATION_ERROR_SOUND_PATH'] = self.sim_error_sound_path builtins.__dict__['DEFAULT_SIM_STRATEGY'] = self.sim_defaut_strategy builtins.__dict__[ 'DEFAULT_PLOT_DYN_FREQ'] = self.sim_defaut_plot_dyn_freq builtins.__dict__['NTL'] = self.cb2.GetValue()