def on_btn_demag_gui(self, event): """ Open Demag GUI """ if not self.check_for_meas_file(): return if not self.check_for_uncombined_files(): return outstring = "demag_gui.py -WD %s" % self.WD print("-I- running python script:\n %s" % (outstring)) # disable and hide Pmag GUI mainframe self.Disable() self.Hide() # show busyinfo wait = wx.BusyInfo('Compiling required data, please wait...') wx.SafeYield() # create custom Demag GUI closing event and bind it DemagGuiExitEvent, EVT_DEMAG_GUI_EXIT = newevent.NewCommandEvent() self.Bind(EVT_DEMAG_GUI_EXIT, self.on_analysis_gui_exit) # make and show the Demag GUI frame demag_gui_frame = demag_gui.Demag_GUI(self.WD, self, write_to_log_file=False, data_model=3, evt_quit=DemagGuiExitEvent) demag_gui_frame.Centre() demag_gui_frame.Show() del wait
def on_run_demag_gui(self, event): outstring = "demag_gui.py -WD %s" % self.WD print("-I- running python script:\n %s" % (outstring)) if self.data_model_num == 2: demag_gui.start(self.WD, standalone_app=False, parent=self, DM=self.data_model_num) else: # disable and hide Pmag GUI mainframe self.Disable() self.Hide() # show busyinfo wait = wx.BusyInfo('Compiling required data, please wait...') wx.Yield() # create custom Demag GUI closing event and bind it DemagGuiExitEvent, EVT_DEMAG_GUI_EXIT = newevent.NewCommandEvent() self.Bind(EVT_DEMAG_GUI_EXIT, self.on_analysis_gui_exit) # make and show the Demag GUI frame demag_gui_frame = demag_gui.Demag_GUI( self.WD, self, write_to_log_file=False, data_model=self.data_model_num, evt_quit=DemagGuiExitEvent) demag_gui_frame.Centre() demag_gui_frame.Show() del wait
def test_read_write_pmag_tables(self): self.ie_add_n_fits_to_all(n_fits) file_menu = self.get_menu_from_frame(self.frame, "File") writepmag_menu_evt = wx.PyCommandEvent( wx.EVT_MENU.typeId, file_menu.FindItem("&Save MagIC pmag tables\tCtrl-Shift-S")) print("-------------------------------------------------------------") self.frame.ProcessEvent(writepmag_menu_evt) print("-------------------------------------------------------------") old_frame = str(self.frame) speci_with_fits = [] old_interpretations = {} for speci in self.frame.pmag_results_data['specimens'].keys(): if speci not in speci_with_fits and \ self.frame.pmag_results_data['specimens'][speci]!=[]: speci_with_fits.append(speci) old_interpretations[speci] = sorted( self.frame.pmag_results_data['specimens'][speci], cmp=fit_cmp) frame2 = demag_gui.Demag_GUI(project_WD, write_to_log_file=False, test_mode_on=True) frame2.update_selection() imported_frame = str(frame2) imported_interpretations = {} for speci in frame2.pmag_results_data['specimens'].keys(): if speci not in speci_with_fits and \ frame2.pmag_results_data['specimens'][speci]!=[]: speci_with_fits.append(speci) imported_interpretations[speci] = sorted( frame2.pmag_results_data['specimens'][speci], cmp=fit_cmp) for speci in speci_with_fits: if speci not in old_interpretations.keys( ) or speci not in imported_interpretations.keys(): import pdb pdb.set_trace() self.assertTrue(speci in old_interpretations.keys()) self.assertTrue(speci in imported_interpretations.keys()) for ofit, ifit in zip(old_interpretations[speci], imported_interpretations[speci]): self.assertTrue(ofit.equal(ifit))
def test_check_empty_dir(self): self.empty_frame = demag_gui.Demag_GUI(empty_WD,write_to_log_file=False,test_mode_on=True)
def setUp(self): self.app = wx.App() self.frame = demag_gui.Demag_GUI(project_WD,write_to_log_file=False,test_mode_on=True) self.frame.clear_interpretations()