def menu_close_all(self, event): """Close all analyses. @param event: The wx event. @type event: wx event """ # Notebook not created yet, so skip. if not hasattr(self, 'notebook'): return # Execution lock. if status.exec_lock.locked(): return # Ask if this should be done. msg = "Are you sure you would like to close all analyses? All data will be erased and the relax data store reset." if status.show_gui and Question(msg, title="Close all analyses", size=(350, 150), default=False).ShowModal() == wx.ID_NO: return # Delete. self.delete_all() # Reset relax. reset()
def modify(self, event=None): """Modify the model selection. @keyword event: The wx event. @type event: wx event """ # First state that this should not be done. if self.warning and status.show_gui and not Question( self.warning, title="Warning - do not change!", size=(420, 210), default=False).ShowModal() == wx.ID_YES: return # Set the model selector window selections. self.model_win.set_selection(self.select) # Show the model selector window. if status.show_gui: self.model_win.ShowModal() self.model_win.Close() # Set the values. self.select = self.model_win.get_selection() # Update the button. self.update_button() # Update the GUI element. self.field.SetValue(list_to_gui(self.GetValue()))
def menu_close(self, event): """Close the currently opened analysis. @param event: The wx event. @type event: wx event """ # Notebook not created yet, so skip. if not hasattr(self, 'notebook'): return # Execution lock. if status.exec_lock.locked(): return # Get the current analysis index. index = self.notebook.GetSelection() # Ask if this should be done. msg = "Are you sure you would like to close the current %s analysis tab?" % ds.relax_gui.analyses[index].analysis_type if status.show_gui and Question(msg, title="Close current analysis", size=(350, 140), default=False).ShowModal() == wx.ID_NO: return # Delete. self.delete_analysis(index)
def pipe_delete(self, event): """Delete the date pipe. @param event: The wx event. @type event: wx event """ # Ask if this should be done. msg = "Are you sure you would like to delete the '%s' data pipe? This operation cannot be undone." % self.selected_pipe if status.show_gui and Question(msg, parent=self, size=(350, 200), default=False).ShowModal() == wx.ID_NO: return # Delete the data pipe. delete(self.selected_pipe)
def action_spin_spin_delete(self, event): """Wrapper method. @param event: The wx event. @type event: wx event """ # Ask if this should be done. msg = "Are you sure you would like to delete this spin? This only affects the spin data, all structural data will remain. This operation cannot be undone." if status.show_gui and Question(msg, parent=self.gui.spin_viewer, default=False, size=(400, 170)).ShowModal() == wx.ID_NO: return # Delete the spin. self.gui.interpreter.queue('spin.delete', gui_to_str(self.info['id']))
def action_residue_residue_select(self, event): """Wrapper method. @param event: The wx event. @type event: wx event """ # Ask if this should be done. msg = "Are you sure you would like to select all spins of this residue?" if status.show_gui and Question(msg, parent=self.gui.spin_viewer, default=False).ShowModal() == wx.ID_NO: return # Select the residue. self.gui.interpreter.queue('select.spin', spin_id=gui_to_str(self.info['id']), change_all=False)
def reset(self, event): """Reset the free file format widget contents to the original values. @param event: The wx event. @type event: wx event """ # Ask a question. if status.show_gui and Question('Would you really like to reset the free file format settings?', parent=self.parent).ShowModal() == wx.ID_NO: return # First reset. ds.relax_gui.free_file_format.reset() # Then update the values. self.set_vals()
def __init__(self, parent=None, size_x=1000, size_y=750, title="Peak intensity loading wizard", noe=False, relax_fit=False, relax_disp=False): """Set up the peak intensity loading wizard. @keyword parent: The parent window. @type parent: wx.Window instance @keyword size_x: The width of the wizard. @type size_x: int @keyword size_y: The height of the wizard. @type size_y: int @keyword title: The title of the wizard dialog. @type title: str @keyword noe: A flag which when True will enable the steady-state NOE portions of the wizard. @type noe: bool @keyword relax_fit: A flag which when True will enable the relaxation curve-fitting portions of the wizard. @type relax_fit: bool @keyword relax_disp: A flag which when True will enable the relaxation dispersion portions of the wizard. @type relax_disp: bool """ # Store the args. self.noe_flag = noe self.relax_fit_flag = relax_fit self.relax_disp_flag = relax_disp # Get the app and store the GUI instance. app = wx.GetApp() self.gui = app.gui # Execute the base class method. Wiz_window.__init__(self, parent=self.gui, size_x=size_x, size_y=size_y, title=title, style=wx.DEFAULT_DIALOG_STYLE) # Change the cursor to busy. wx.BeginBusyCursor() # Initialise the page_indices structure. self.page_indices = {} # First check that at least a single spin is named! if not are_spins_named(): # The message. msg = "No spins have been named. Please use the spin.name user function first, otherwise it is unlikely that any data will be loaded from the peak intensity file.\n\nThis message can be ignored if the generic file format is used and spin names have not been specified. Would you like to name the spins already loaded into the relax data store?" # Ask about naming spins, and add the spin.name user function page. if (status.show_gui and Question( msg, title="Incomplete setup", size=(450, 250), default=True).ShowModal() == wx.ID_YES) or not status.show_gui: page = uf_store['spin.name'].create_page(self, sync=True) self.page_indices['name'] = self.add_page( page, proceed_on_error=False) # The spectrum.read_intensities page. self.page_intensity = uf_store[ 'spectrum.read_intensities'].create_page(self, sync=True) self.page_indices['read'] = self.add_page(self.page_intensity, skip_button=True, proceed_on_error=False) # Error type selection page. self.page_error_type = Spectral_error_type_page(parent=self, height_desc=520) self.page_indices['err_type'] = self.add_page(self.page_error_type, apply_button=False) self.set_seq_next_fn(self.page_indices['err_type'], self.wizard_page_after_error_type) # The spectrum.replicated page. page = uf_store['spectrum.replicated'].create_page(self, sync=True) self.page_indices['repl'] = self.add_page(page, skip_button=True, proceed_on_error=False) self.set_seq_next_fn(self.page_indices['repl'], self.wizard_page_after_repl) page.on_init = self.wizard_update_repl # The spectrum.baseplane_rmsd page. page = uf_store['spectrum.baseplane_rmsd'].create_page(self, sync=True) self.page_indices['rmsd'] = self.add_page(page, skip_button=True, proceed_on_error=False) self.set_seq_next_fn(self.page_indices['rmsd'], self.wizard_page_after_rmsd) page.on_init = self.wizard_update_rmsd # The spectrum.integration_points page. page = uf_store['spectrum.integration_points'].create_page(self, sync=True) self.page_indices['pts'] = self.add_page(page, skip_button=True, proceed_on_error=False) page.on_init = self.wizard_update_pts # NOE pages. if self.noe_flag: # The noe.spectrum_type page. page = uf_store['noe.spectrum_type'].create_page(self, sync=True) self.page_indices['spectrum_type'] = self.add_page( page, skip_button=False, proceed_on_error=False) page.on_display_post = self.wizard_update_noe_spectrum_type # Relaxation curve-fitting pages. if self.relax_fit_flag: # The relax_fit.relax_time page. page = uf_store['relax_fit.relax_time'].create_page(self, sync=True) self.page_indices['relax_time'] = self.add_page( page, skip_button=False, proceed_on_error=False) page.on_init = self.wizard_update_relax_fit_relax_time # Relaxation dispersion pages. if self.relax_disp_flag: # The relax_disp.exp_type page. page = uf_store['relax_disp.exp_type'].create_page(self, sync=True) self.page_indices['exp_type'] = self.add_page( page, skip_button=True, proceed_on_error=False) page.on_init = self.wizard_update_relax_disp_exp_type # The spectrometer.frequency page. page = uf_store['spectrometer.frequency'].create_page(self, sync=True) self.page_indices['spectrometer_frequency'] = self.add_page( page, skip_button=True, proceed_on_error=False) page.on_init = self.wizard_update_spectrometer_frequency # The relax_disp.relax_time page. page = uf_store['relax_disp.relax_time'].create_page(self, sync=True) self.page_indices['relax_time'] = self.add_page( page, skip_button=True, proceed_on_error=False) page.on_init = self.wizard_update_relax_disp_relax_time self.set_seq_next_fn(self.page_indices['relax_time'], self.wizard_page_after_relax_time) # The relax_disp.cpmg_setup page. page = uf_store['relax_disp.cpmg_setup'].create_page(self, sync=True) self.page_indices['cpmg_setup'] = self.add_page( page, skip_button=True, proceed_on_error=False) page.on_init = self.wizard_update_relax_disp_cpmg_setup self.set_seq_next_fn(self.page_indices['cpmg_setup'], self.wizard_page_after_cpmg_setup) # The relax_disp.spin_lock_field page. page = uf_store['relax_disp.spin_lock_field'].create_page( self, sync=True) self.page_indices['spin_lock_field'] = self.add_page( page, skip_button=True, proceed_on_error=False) page.on_init = self.wizard_update_relax_disp_spin_lock_field # The relax_disp.spin_lock_offset page. page = uf_store['relax_disp.spin_lock_offset'].create_page( self, sync=True) self.page_indices['spin_lock_offset'] = self.add_page( page, skip_button=True, proceed_on_error=False) page.on_init = self.wizard_update_relax_disp_spin_lock_offset # Reset the cursor. if wx.IsBusy(): wx.EndBusyCursor() # Run the wizard. self.run()