Beispiel #1
0
    def setup(self):
        """Override the base variables."""

        # GUI variables.
        self.title = "Software"
        self.observer_base_name = "software"
        self.button_placement = 'bottom'

        # The column titles.
        self.columns = [
            "Program name"
        ]

        # Button set up.
        self.button_info = [
            {
                'object': 'button_add',
                'label': ' Add',
                'icon': fetch_icon('oxygen.actions.list-add-relax-blue', "22x22"),
                'method': self.action_bmrb_software,
                'tooltip': "Specify the software used in the analysis."
            }, {
                'object': 'button_select',
                'label': ' Select',
                'icon': fetch_icon('oxygen.actions.edit-select', "22x22"),
                'method': self.action_bmrb_software_select,
                'tooltip': "Select the software used in the analysis."
            }
        ]
Beispiel #2
0
    def setup(self):
        """Override the base variables."""

        # GUI variables.
        self.title = "Software"
        self.observer_base_name = "software"
        self.button_placement = 'bottom'

        # The column titles.
        self.columns = ["Program name"]

        # Button set up.
        self.button_info = [{
            'object':
            'button_add',
            'label':
            ' Add',
            'icon':
            fetch_icon('oxygen.actions.list-add-relax-blue', "22x22"),
            'method':
            self.action_bmrb_software,
            'tooltip':
            "Specify the software used in the analysis."
        }, {
            'object':
            'button_select',
            'label':
            ' Select',
            'icon':
            fetch_icon('oxygen.actions.edit-select', "22x22"),
            'method':
            self.action_bmrb_software_select,
            'tooltip':
            "Select the software used in the analysis."
        }]
Beispiel #3
0
    def setup(self):
        """Override the base variables."""

        # GUI variables.
        self.title = "Spectra list"
        self.observer_base_name = "spectra list"

        # The column titles.
        self.columns = []

        # Button set up.
        self.button_placement = 'top'
        self.button_size = (170, 40)
        self.button_info = [
            {
                'object': 'button_add',
                'label': ' Add',
                'icon': fetch_icon('oxygen.actions.list-add-relax-blue', "22x22"),
                'method': self.fn_add,
                'tooltip': "Read a spectral data file."
            }, {
                'object': 'button_delete',
                'label': ' Delete',
                'icon': fetch_icon('oxygen.actions.list-remove', "22x22"),
                'method': self.action_spectrum_delete,
                'tooltip': "Delete loaded relaxation data from the relax data store."
            }, {
                'object': 'button_error_analysis',
                'label': ' Error analysis',
                'icon': fetch_icon('oxygen.categories.applications-education', "22x22"),
                'method': self.action_spectrum_error_analysis,
                'tooltip': "Perform a peak intensity error analysis on the currently loaded data or data subsets.  Select a subset of the spectra below to perform the error analysis only on this subset."
            }
        ]
Beispiel #4
0
    def toolbar(self):
        """Create the toolbar."""

        # Init.
        self.bar = self.CreateToolBar(wx.TB_HORIZONTAL|wx.TB_FLAT|wx.TB_TEXT)

        # The spin loading button.
        tooltip = "Load spins from either a sequence file or from a 3D structure file."
        self.bar.AddLabelTool(TB_SPIN_LOADER_ID, "Load spins", wx.Bitmap(fetch_icon('relax.spin', '32x32'), wx.BITMAP_TYPE_ANY), bmpDisabled=wx.Bitmap(fetch_icon('relax.spin_grey', '32x32'), wx.BITMAP_TYPE_ANY), shortHelp=tooltip, longHelp=tooltip)
        self.Bind(wx.EVT_TOOL, self.load_spins_wizard, id=TB_SPIN_LOADER_ID)

        # A separator.
        self.bar.AddSeparator()

        # The refresh button.
        tooltip = "Refresh the spin view."
        self.bar.AddLabelTool(TB_REFRESH, "Refresh", wx.Bitmap(fetch_icon('oxygen.actions.view-refresh', '32x32'), wx.BITMAP_TYPE_ANY), shortHelp=tooltip, longHelp=tooltip)
        self.Bind(wx.EVT_TOOL, self.refresh, id=TB_REFRESH)

        # A separator.
        self.bar.AddSeparator()

        # The pipe text.
        text = wx.StaticText(self.bar, -1, ' Current data pipe:  ', style=wx.ALIGN_LEFT)
        self.bar.AddControl(text)

        # The pipe selection.
        self.pipe_name = wx.ComboBox(self.bar, -1, "", style=wx.CB_DROPDOWN|wx.CB_READONLY, choices=[])
        self.bar.AddControl(self.pipe_name)
        self.Bind(wx.EVT_COMBOBOX, self.update_pipes, self.pipe_name)

        # Build the toolbar.
        self.bar.Realize()
Beispiel #5
0
    def toolbar(self):
        """Create the toolbar."""

        # Init.
        self.bar = self.CreateToolBar(wx.TB_HORIZONTAL|wx.TB_FLAT|wx.TB_TEXT)

        # The spin loading button.
        self.spin_loader_id = wx.NewId()
        tooltip = "Load spins from either a sequence file or from a 3D structure file."
        self.bar.AddLabelTool(self.spin_loader_id, "Load spins", wx.Bitmap(fetch_icon('relax.spin', '32x32'), wx.BITMAP_TYPE_ANY), bmpDisabled=wx.Bitmap(fetch_icon('relax.spin_grey', '32x32'), wx.BITMAP_TYPE_ANY), shortHelp=tooltip, longHelp=tooltip)
        self.Bind(wx.EVT_TOOL, self.load_spins_wizard, id=self.spin_loader_id)

        # A separator.
        self.bar.AddSeparator()

        # The refresh button.
        id = wx.NewId()
        tooltip = "Refresh the spin view."
        self.bar.AddLabelTool(id, "Refresh", wx.Bitmap(fetch_icon('oxygen.actions.view-refresh', '32x32'), wx.BITMAP_TYPE_ANY), shortHelp=tooltip, longHelp=tooltip)
        self.Bind(wx.EVT_TOOL, self.refresh, id=id)

        # A separator.
        self.bar.AddSeparator()

        # The pipe text.
        text = wx.StaticText(self.bar, -1, ' Current data pipe:  ', style=wx.ALIGN_LEFT)
        self.bar.AddControl(text)

        # The pipe selection.
        self.pipe_name = wx.ComboBox(self.bar, -1, "", style=wx.CB_DROPDOWN|wx.CB_READONLY, choices=[])
        self.bar.AddControl(self.pipe_name)
        self.Bind(wx.EVT_COMBOBOX, self.update_pipes, self.pipe_name)

        # Build the toolbar.
        self.bar.Realize()
Beispiel #6
0
    def setup(self):
        """Override the base variables."""

        # GUI variables.
        self.title = "Molecule information"
        self.observer_base_name = "molecule"
        self.button_placement = None

        # The column titles.
        self.columns = [
            "ID string",
            "Name",
            "Type",
            "Thiol state"
        ]

        # The right click popup menu.
        self.popup_menus = [
            {
                'id': wx.NewId(),
                'text': "&Name the molecule",
                'icon': fetch_icon(uf_info.get_uf('molecule.name').gui_icon),
                'method': self.action_molecule_name
            }, {
                'id': wx.NewId(),
                'text': "Set the molecule &type",
                'icon': fetch_icon(uf_info.get_uf('molecule.type').gui_icon),
                'method': self.action_molecule_type
            }, {
                'id': wx.NewId(),
                'text': "Set the thiol &state",
                'icon': fetch_icon(uf_info.get_uf('bmrb.thiol_state').gui_icon),
                'method': self.action_bmrb_thiol_state
            }
        ]
Beispiel #7
0
    def setup(self):
        """Override the base variables."""

        # GUI variables.
        self.title = "Spectra list"
        self.observer_base_name = "spectra list"

        # The column titles.
        self.columns = []

        # Button set up.
        self.button_placement = 'top'
        self.button_info = [
            {
                'object': 'button_add',
                'label': ' Add',
                'icon': fetch_icon('oxygen.actions.list-add-relax-blue', "22x22"),
                'method': self.fn_add,
                'tooltip': "Read a spectral data file."
            }, {
                'object': 'button_delete',
                'label': ' Delete',
                'icon': fetch_icon('oxygen.actions.list-remove', "22x22"),
                'method': self.action_spectrum_delete,
                'tooltip': "Delete loaded relaxation data from the relax data store."
            }
        ]
Beispiel #8
0
    def add_buttons(self, box):
        """Add all of the buttons.

        @param box:     The box element to pack the GUI element into.
        @type box:      wx.BoxSizer instance
        """

        # Sizer.
        sizer = wx.BoxSizer(wx.HORIZONTAL)

        # Isotope type button.
        self.button_isotope = wx.lib.buttons.ThemedGenBitmapTextButton(self, -1, None, " Spin isotope")
        self.button_isotope.SetBitmapLabel(wx.Bitmap(fetch_icon("relax.nuclear_symbol", "22x22"), wx.BITMAP_TYPE_ANY))
        self.button_isotope.SetFont(font.normal)
        self.button_isotope.SetSize((-1, 25))
        self.button_isotope.SetToolTip(wx.ToolTip("Set the nuclear isotope types via the spin.isotope user function."))
        self.gui.Bind(wx.EVT_BUTTON, self.spin_isotope, self.button_isotope)
        sizer.Add(self.button_isotope, 1, wx.ALL|wx.EXPAND, 0)

        # R1 button.
        self.button_r1 = wx.lib.buttons.ThemedGenBitmapTextButton(self, -1, None, " %s relaxation data"%r1)
        self.button_r1.SetBitmapLabel(wx.Bitmap(fetch_icon("relax.fid", "22x22"), wx.BITMAP_TYPE_ANY))
        self.button_r1.SetFont(font.normal)
        self.button_r1.SetSize((-1, 25))
        self.button_r1.SetToolTip(wx.ToolTip("Load the %s relaxation data for the off-resonance %s-type experiments.  For all other experiment types this is unused.  One %s data set per magnetic field strength must be loaded."%(r1, r1rho, r1)))
        self.gui.Bind(wx.EVT_BUTTON, self.load_r1_data, self.button_r1)
        sizer.Add(self.button_r1, 1, wx.ALL|wx.EXPAND, 0)

        # Chemical shift button.
        self.button_chemical_shift = wx.lib.buttons.ThemedGenBitmapTextButton(self, -1, None, " Chemical shift")
        self.button_chemical_shift.SetBitmapLabel(wx.Bitmap(fetch_icon("relax.chemical_shift", "22x22"), wx.BITMAP_TYPE_ANY))
        self.button_chemical_shift.SetFont(font.normal)
        self.button_chemical_shift.SetSize((-1, 25))
        self.button_chemical_shift.SetToolTip(wx.ToolTip("Read chemical shifts from a peak list for the off-resonance %s-type experiments.  For all other experiment types this is unused."%r1rho))
        self.gui.Bind(wx.EVT_BUTTON, self.load_cs_data, self.button_chemical_shift)
        sizer.Add(self.button_chemical_shift, 1, wx.ALL|wx.EXPAND, 0)

        # Interatomic interaction button.
        self.button_interatom_define = wx.lib.buttons.ThemedGenBitmapTextButton(self, -1, None, " Interatomic interaction")
        self.button_interatom_define.SetBitmapLabel(wx.Bitmap(fetch_icon("relax.dipole_pair", "22x22"), wx.BITMAP_TYPE_ANY))
        self.button_interatom_define.SetFont(font.normal)
        self.button_interatom_define.SetSize((-1, 25))
        self.button_interatom_define.SetToolTip(wx.ToolTip("Define the interatomic interations via the interatom.define user function for the MQ dispersion models."))
        self.gui.Bind(wx.EVT_BUTTON, self.interatom_define, self.button_interatom_define)
        sizer.Add(self.button_interatom_define, 1, wx.ALL|wx.EXPAND, 0)

        # value.set button.
        self.button_value_set = wx.lib.buttons.ThemedGenBitmapTextButton(self, -1, None, " Value setting")
        self.button_value_set.SetBitmapLabel(wx.Bitmap(fetch_icon("relax.value", "22x22"), wx.BITMAP_TYPE_ANY))
        self.button_value_set.SetFont(font.normal)
        self.button_value_set.SetSize((-1, 25))
        tooltip = "Set certain parameters to experimentally determined values.\n\nThis is simply used to speed up optimisation by skipping this parameter in the initial grid search.  The result is that the number of dimensions in the grid search is decreased, resulting in roughly one order of magnitude decrease in time for each parameter in this part of the analysis.  Important to note is that the parameter will be optimised after the initial grid search."
        self.button_value_set.SetToolTip(wx.ToolTip(tooltip))
        self.gui.Bind(wx.EVT_BUTTON, self.value_set, self.button_value_set)
        sizer.Add(self.button_value_set, 1, wx.ALL|wx.EXPAND, 0)

        # Add the element to the box.
        box.Add(sizer, 0, wx.ALL|wx.EXPAND, 0)
Beispiel #9
0
    def add_buttons(self, box):
        """Add all of the buttons.

        @param box:     The box element to pack the GUI element into.
        @type box:      wx.BoxSizer instance
        """

        # Sizer.
        sizer = wx.BoxSizer(wx.HORIZONTAL)

        # Isotope type button.
        self.button_isotope = wx.lib.buttons.ThemedGenBitmapTextButton(self, -1, None, " Spin isotope")
        self.button_isotope.SetBitmapLabel(wx.Bitmap(fetch_icon("relax.nuclear_symbol", "22x22"), wx.BITMAP_TYPE_ANY))
        self.button_isotope.SetFont(font.normal)
        self.button_isotope.SetSize((-1, 25))
        self.button_isotope.SetToolTipString("Set the nuclear isotope types via the spin.isotope user function.")
        self.gui.Bind(wx.EVT_BUTTON, self.spin_isotope, self.button_isotope)
        sizer.Add(self.button_isotope, 1, wx.ALL|wx.EXPAND, 0)

        # R1 button.
        self.button_r1 = wx.lib.buttons.ThemedGenBitmapTextButton(self, -1, None, " %s relaxation data"%r1)
        self.button_r1.SetBitmapLabel(wx.Bitmap(fetch_icon("relax.fid", "22x22"), wx.BITMAP_TYPE_ANY))
        self.button_r1.SetFont(font.normal)
        self.button_r1.SetSize((-1, 25))
        self.button_r1.SetToolTipString("Load the %s relaxation data for the off-resonance %s-type experiments.  For all other experiment types this is unused.  One %s data set per magnetic field strength must be loaded."%(r1, r1rho, r1))
        self.gui.Bind(wx.EVT_BUTTON, self.load_r1_data, self.button_r1)
        sizer.Add(self.button_r1, 1, wx.ALL|wx.EXPAND, 0)

        # Chemical shift button.
        self.button_chemical_shift = wx.lib.buttons.ThemedGenBitmapTextButton(self, -1, None, " Chemical shift")
        self.button_chemical_shift.SetBitmapLabel(wx.Bitmap(fetch_icon("relax.chemical_shift", "22x22"), wx.BITMAP_TYPE_ANY))
        self.button_chemical_shift.SetFont(font.normal)
        self.button_chemical_shift.SetSize((-1, 25))
        self.button_chemical_shift.SetToolTipString("Read chemical shifts from a peak list for the off-resonance %s-type experiments.  For all other experiment types this is unused."%r1rho)
        self.gui.Bind(wx.EVT_BUTTON, self.load_cs_data, self.button_chemical_shift)
        sizer.Add(self.button_chemical_shift, 1, wx.ALL|wx.EXPAND, 0)

        # Interatomic interaction button.
        self.button_interatom_define = wx.lib.buttons.ThemedGenBitmapTextButton(self, -1, None, " Interatomic interaction")
        self.button_interatom_define.SetBitmapLabel(wx.Bitmap(fetch_icon("relax.dipole_pair", "22x22"), wx.BITMAP_TYPE_ANY))
        self.button_interatom_define.SetFont(font.normal)
        self.button_interatom_define.SetSize((-1, 25))
        self.button_interatom_define.SetToolTipString("Define the interatomic interations via the interatom.define user function for the MQ dispersion models.")
        self.gui.Bind(wx.EVT_BUTTON, self.interatom_define, self.button_interatom_define)
        sizer.Add(self.button_interatom_define, 1, wx.ALL|wx.EXPAND, 0)

        # value.set button.
        self.button_value_set = wx.lib.buttons.ThemedGenBitmapTextButton(self, -1, None, " Value setting")
        self.button_value_set.SetBitmapLabel(wx.Bitmap(fetch_icon("relax.value", "22x22"), wx.BITMAP_TYPE_ANY))
        self.button_value_set.SetFont(font.normal)
        self.button_value_set.SetSize((-1, 25))
        tooltip = "Set certain parameters to experimentally determined values.\n\nThis is simply used to speed up optimisation by skipping this parameter in the initial grid search.  The result is that the number of dimensions in the grid search is decreased, resulting in roughly one order of magnitude decrease in time for each parameter in this part of the analysis.  Important to note is that the parameter will be optimised after the initial grid search."
        self.button_value_set.SetToolTipString(tooltip)
        self.gui.Bind(wx.EVT_BUTTON, self.value_set, self.button_value_set)
        sizer.Add(self.button_value_set, 1, wx.ALL|wx.EXPAND, 0)

        # Add the element to the box.
        box.Add(sizer, 0, wx.ALL|wx.EXPAND, 0)
Beispiel #10
0
    def add_buttons(self, sizer):
        """Add the buttons to the sizer.

        @param sizer:   A sizer object.
        @type sizer:    wx.Sizer instance
        """

        # Create a horizontal layout for the buttons.
        button_sizer = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(button_sizer, 0, wx.ALIGN_CENTER|wx.ALL, 0)

        # The non-fixed sequence buttons.
        if self.variable_length:
            # The add button.
            button = wx.lib.buttons.ThemedGenBitmapTextButton(self, -1, None, "  Add")
            button.SetBitmapLabel(wx.Bitmap(fetch_icon('oxygen.actions.list-add-relax-blue', "22x22"), wx.BITMAP_TYPE_ANY))
            button.SetFont(font.normal)
            button.SetToolTipString("Add an item to the list.")
            button.SetMinSize(self.SIZE_BUTTON)
            button_sizer.Add(button, 0, wx.ADJUST_MINSIZE, 0)
            self.Bind(wx.EVT_BUTTON, self.add_element, button)

            # Spacer.
            button_sizer.AddSpacer(20)

            # The delete button.
            button = wx.lib.buttons.ThemedGenBitmapTextButton(self, -1, None, "  Delete")
            button.SetBitmapLabel(wx.Bitmap(fetch_icon('oxygen.actions.list-remove', "22x22"), wx.BITMAP_TYPE_ANY))
            button.SetFont(font.normal)
            button.SetToolTipString("Delete the last item.")
            button.SetMinSize(self.SIZE_BUTTON)
            button_sizer.Add(button, 0, wx.ADJUST_MINSIZE, 0)
            self.Bind(wx.EVT_BUTTON, self.delete, button)

            # Spacer.
            button_sizer.AddSpacer(20)

            # The delete all button.
            button = wx.lib.buttons.ThemedGenBitmapTextButton(self, -1, None, "  Delete all")
            button.SetBitmapLabel(wx.Bitmap(fetch_icon('oxygen.actions.edit-delete', "22x22"), wx.BITMAP_TYPE_ANY))
            button.SetFont(font.normal)
            button.SetToolTipString("Delete all items.")
            button.SetMinSize(self.SIZE_BUTTON)
            button_sizer.Add(button, 0, wx.ADJUST_MINSIZE, 0)
            self.Bind(wx.EVT_BUTTON, self.delete_all, button)

            # Spacer.
            button_sizer.AddSpacer(20)

        # The Ok button.
        button = wx.lib.buttons.ThemedGenBitmapTextButton(self, -1, None, "  Ok")
        button.SetBitmapLabel(wx.Bitmap(fetch_icon('oxygen.actions.dialog-ok', "22x22"), wx.BITMAP_TYPE_ANY))
        button.SetFont(font.normal)
        button.SetMinSize(self.SIZE_BUTTON)
        button_sizer.Add(button, 0, wx.ADJUST_MINSIZE, 0)
        self.Bind(wx.EVT_BUTTON, self.close, button)
Beispiel #11
0
    def add_buttons(self, sizer):
        """Add the buttons to the sizer.

        @param sizer:   A sizer object.
        @type sizer:    wx.Sizer instance
        """

        # Create a horizontal layout for the buttons.
        button_sizer = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(button_sizer, 0, wx.ALIGN_CENTER|wx.ALL, 0)

        # The non-fixed sequence buttons.
        if self.variable_length:
            # The add button.
            button = wx.lib.buttons.ThemedGenBitmapTextButton(self, -1, None, "  Add")
            button.SetBitmapLabel(wx.Bitmap(fetch_icon('oxygen.actions.list-add-relax-blue', "22x22"), wx.BITMAP_TYPE_ANY))
            button.SetFont(font.normal)
            button.SetToolTipString("Add an item to the list.")
            button.SetMinSize(self.SIZE_BUTTON)
            button_sizer.Add(button, 0, wx.ADJUST_MINSIZE, 0)
            self.Bind(wx.EVT_BUTTON, self.add_element, button)

            # Spacer.
            button_sizer.AddSpacer(20)

            # The delete button.
            button = wx.lib.buttons.ThemedGenBitmapTextButton(self, -1, None, "  Delete")
            button.SetBitmapLabel(wx.Bitmap(fetch_icon('oxygen.actions.list-remove', "22x22"), wx.BITMAP_TYPE_ANY))
            button.SetFont(font.normal)
            button.SetToolTipString("Delete the last item.")
            button.SetMinSize(self.SIZE_BUTTON)
            button_sizer.Add(button, 0, wx.ADJUST_MINSIZE, 0)
            self.Bind(wx.EVT_BUTTON, self.delete, button)

            # Spacer.
            button_sizer.AddSpacer(20)

            # The delete all button.
            button = wx.lib.buttons.ThemedGenBitmapTextButton(self, -1, None, "  Delete all")
            button.SetBitmapLabel(wx.Bitmap(fetch_icon('oxygen.actions.edit-delete', "22x22"), wx.BITMAP_TYPE_ANY))
            button.SetFont(font.normal)
            button.SetToolTipString("Delete all items.")
            button.SetMinSize(self.SIZE_BUTTON)
            button_sizer.Add(button, 0, wx.ADJUST_MINSIZE, 0)
            self.Bind(wx.EVT_BUTTON, self.delete_all, button)

            # Spacer.
            button_sizer.AddSpacer(20)

        # The Ok button.
        button = wx.lib.buttons.ThemedGenBitmapTextButton(self, -1, None, "  Ok")
        button.SetBitmapLabel(wx.Bitmap(fetch_icon('oxygen.actions.dialog-ok', "22x22"), wx.BITMAP_TYPE_ANY))
        button.SetFont(font.normal)
        button.SetMinSize(self.SIZE_BUTTON)
        button_sizer.Add(button, 0, wx.ADJUST_MINSIZE, 0)
        self.Bind(wx.EVT_BUTTON, self.close, button)
Beispiel #12
0
    def add_buttons(self, sizer):
        """Add the buttons to the sizer.

        @param sizer:   A sizer object.
        @type sizer:    wx.Sizer instance
        """

        # Create a horizontal layout for the buttons.
        button_sizer = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(button_sizer, 0, wx.ALIGN_CENTER | wx.ALL, 0)

        # The save button.
        button = wx.lib.buttons.ThemedGenBitmapTextButton(
            self, -1, None, "  Save")
        button.SetBitmapLabel(
            wx.Bitmap(fetch_icon('oxygen.actions.document-save', "22x22"),
                      wx.BITMAP_TYPE_ANY))
        button.SetFont(font.normal)
        button.SetToolTip(
            wx.ToolTip(
                "Save the free file format settings within the relax data store."
            ))
        button.SetMinSize(self.SIZE_BUTTON)
        button_sizer.Add(button, 0, wx.ADJUST_MINSIZE, 0)
        self.Bind(wx.EVT_BUTTON, self.save, button)

        # Spacer.
        button_sizer.AddSpacer(20)

        # The reset button.
        button = wx.lib.buttons.ThemedGenBitmapTextButton(
            self, -1, None, "  Reset")
        button.SetBitmapLabel(
            wx.Bitmap(fetch_icon('oxygen.actions.edit-delete', "22x22"),
                      wx.BITMAP_TYPE_ANY))
        button.SetFont(font.normal)
        button.SetToolTip(
            wx.ToolTip(
                "Reset the free file format settings to the original values."))
        button.SetMinSize(self.SIZE_BUTTON)
        button_sizer.Add(button, 0, wx.ADJUST_MINSIZE, 0)
        self.Bind(wx.EVT_BUTTON, self.reset, button)

        # Spacer.
        button_sizer.AddSpacer(20)

        # The cancel button.
        button = wx.lib.buttons.ThemedGenBitmapTextButton(
            self, -1, None, "  Cancel")
        button.SetBitmapLabel(
            wx.Bitmap(fetch_icon('oxygen.actions.dialog-cancel', "22x22"),
                      wx.BITMAP_TYPE_ANY))
        button.SetFont(font.normal)
        button.SetMinSize(self.SIZE_BUTTON)
        button_sizer.Add(button, 0, wx.ADJUST_MINSIZE, 0)
        self.Bind(wx.EVT_BUTTON, self.cancel, button)
Beispiel #13
0
    def setup(self):
        """Override the base variables."""

        # GUI variables.
        self.title = "Relaxation data metadata"
        self.observer_base_name = "relaxation metadata list"
        self.button_placement = None

        # The column titles.
        self.columns = [
            "Relaxation data ID", "Peak intensity type",
            "Temperature calibration", "Temperature control"
        ]

        # The right click popup menu.
        self.popup_menus = [{
            'id':
            MENU_RELAX_DATA_DISPLAY,
            'text':
            "Dis&play the relaxation data",
            'icon':
            fetch_icon(uf_info.get_uf('relax_data.display').gui_icon),
            'method':
            self.action_relax_data_display
        }, {
            'id':
            MENU_RELAX_DATA_PEAK_INTENSITY_TYPE,
            'text':
            "Set the peak &intensity type",
            'icon':
            fetch_icon(
                uf_info.get_uf('relax_data.peak_intensity_type').gui_icon),
            'method':
            self.action_relax_data_peak_intensity_type
        }, {
            'id':
            MENU_RELAX_DATA_TEMP_CALIBRATION,
            'text':
            "Set the temperature &calibration",
            'icon':
            fetch_icon(uf_info.get_uf('relax_data.temp_calibration').gui_icon),
            'method':
            self.action_relax_data_temp_calibration
        }, {
            'id':
            MENU_RELAX_DATA_TEMP_CONTROL,
            'text':
            "Set the temperature c&ontrol",
            'icon':
            fetch_icon(uf_info.get_uf('relax_data.temp_control').gui_icon),
            'method':
            self.action_relax_data_temp_control
        }]
Beispiel #14
0
    def add_buttons(self, sizer):
        """Build and add the bottom buttons.

        @param sizer:   The sizer element to pack the buttons into.
        @type sizer:    wx.Sizer instance
        """

        # Button sizer.
        button_sizer = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(button_sizer, 0, wx.ALIGN_RIGHT, 0)

        # Preview button.
        button = wx.lib.buttons.ThemedGenBitmapTextButton(
            self.main_panel, -1, None, " Preview")
        button.SetBitmapLabel(
            wx.Bitmap(fetch_icon('oxygen.actions.document-preview', "32x32"),
                      wx.BITMAP_TYPE_ANY))
        button.SetFont(font.normal)
        button.SetMinSize(self.button_size)
        button_sizer.Add(button, 0, 0, 0)
        self.Bind(wx.EVT_BUTTON, self.action_preview, button)
        button.SetToolTip(wx.ToolTip("Preview the NMR-STAR formatted data."))

        # Spacing.
        button_sizer.AddSpacer(self.button_spacing)

        # Export button.
        button = wx.lib.buttons.ThemedGenBitmapTextButton(
            self.main_panel, -1, None, " Export")
        button.SetBitmapLabel(
            wx.Bitmap(fetch_icon('relax.bmrb', "32x32"), wx.BITMAP_TYPE_ANY))
        button.SetFont(font.normal)
        button.SetMinSize(self.button_size)
        button_sizer.Add(button, 0, 0, 0)
        self.Bind(wx.EVT_BUTTON, self.action_export, button)
        button.SetToolTip(
            wx.ToolTip(
                "Create the NMR-STAR formatted file for BMRB deposition."))

        # Spacing.
        button_sizer.AddSpacer(self.button_spacing)

        # Cancel button.
        button = wx.lib.buttons.ThemedGenBitmapTextButton(
            self.main_panel, -1, None, " Cancel")
        button.SetBitmapLabel(
            wx.Bitmap(fetch_icon('oxygen.actions.dialog-cancel', "32x32"),
                      wx.BITMAP_TYPE_ANY))
        button.SetFont(font.normal)
        button.SetMinSize(self.button_size)
        button_sizer.Add(button, 0, 0, 0)
        self.Bind(wx.EVT_BUTTON, self.action_cancel, button)
        button.SetToolTip(wx.ToolTip("Cancel the BMRB export."))
Beispiel #15
0
    def build_uf(self):
        """Create the user function sectioning."""

        # Some whitespace.
        self.file.write("\n\n")

        # Start a new column for each user function and add a rule to the top.
        self.file.write("\\pagebreak[4]\n")
        self.file.write("\\rule{\columnwidth}{1pt}\n")

        # The title (with less spacing).
        self.file.write("\\vspace{-20pt}\n")
        self.uf_name_latex = self.uf_name

        # LaTeX formatting.
        self.uf_name_latex = self.latex_special_chars(self.uf_name_latex)
        self.uf_name_latex = self.word_formatting(self.uf_name_latex,
                                                  bold=True)

        # Allow for hyphenation.
        self.uf_name_latex = self.uf_name_latex.replace('.', '\-.')
        self.uf_name_latex = self.uf_name_latex.replace('\_', '\-\_')

        # Write out the title (with label).
        self.file.write("\subsection{%s} \label{uf: %s}\n" %
                        (self.uf_name_latex, self.uf_name))

        # Add the user function class icon.
        if self.uf_class:
            icon = fetch_icon(self.uf_class.gui_icon,
                              size='128x128',
                              format=None,
                              sep='/',
                              full_path=False)
            if icon:
                self.file.write("\includegraphics[bb=0 0 18 18]{%s} \hfill " %
                                icon)
            else:
                self.file.write("\hfill ")

        # Add the user function icon.
        icon = fetch_icon(self.uf.gui_icon,
                          size='128x128',
                          format=None,
                          sep='/',
                          full_path=False)
        if icon:
            self.file.write("\includegraphics[bb=0 0 18 18]{%s}\n" % icon)
        else:
            self.file.write("\n")

        # End.
        self.file.write("\n")
Beispiel #16
0
    def update_button(self):
        """Update the button bitmap as needed."""

        # Nothing to do.
        if not self.red_flag:
            return

        # Change the flag to red to indicate to the user that changing the models is a bad thing!
        if False in self.select:
            self.button.SetBitmapLabel(wx.Bitmap(fetch_icon("oxygen.actions.flag-red", "16x16"), wx.BITMAP_TYPE_ANY))

        # Otherwise set it to blue (in case all models are selected again).
        else:
            self.button.SetBitmapLabel(wx.Bitmap(fetch_icon("oxygen.actions.flag-blue", "16x16"), wx.BITMAP_TYPE_ANY))
Beispiel #17
0
    def toggle(self, event=None):
        """Switch the state."""

        # From False to True.
        if self.state == False:
            self.field.SetValue('True')
            self.button.SetBitmapLabel(wx.Bitmap(fetch_icon('oxygen.actions.media-record-relax-green'), wx.BITMAP_TYPE_ANY))
            self.state = True

        # From True to False.
        else:
            self.field.SetValue('False')
            self.button.SetBitmapLabel(wx.Bitmap(fetch_icon('oxygen.actions.media-record'), wx.BITMAP_TYPE_ANY))
            self.state = False
Beispiel #18
0
    def add_values(self, box):
        """Create and add the value.set buttons for the model-free analysis.

        @param box:     The box element to pack the GUI element into.
        @type box:      wx.BoxSizer instance
        """

        # Sizer.
        sizer = wx.BoxSizer(wx.HORIZONTAL)

        # Dipole-dipole relaxation setup button.
        self.button_dipole_pair = wx.lib.buttons.ThemedGenBitmapTextButton(self, -1, None, " Dipolar relaxation")
        self.button_dipole_pair.SetBitmapLabel(wx.Bitmap(fetch_icon("relax.dipole_pair", "22x22"), wx.BITMAP_TYPE_ANY))
        self.button_dipole_pair.SetFont(font.normal)
        self.button_dipole_pair.SetSize((-1, 25))
        self.button_dipole_pair.SetToolTipString("Define the magnetic dipole-dipole relaxation mechanism.")
        self.gui.Bind(wx.EVT_BUTTON, self.setup_dipole_pair, self.button_dipole_pair)
        sizer.Add(self.button_dipole_pair, 1, wx.ALL|wx.EXPAND, 0)

        # CSA button.
        self.button_csa = wx.lib.buttons.ThemedGenBitmapTextButton(self, -1, None, " CSA relaxation")
        self.button_csa.SetBitmapLabel(wx.Bitmap(fetch_icon("relax.align_tensor", "22x22"), wx.BITMAP_TYPE_ANY))
        self.button_csa.SetFont(font.normal)
        self.button_csa.SetSize((-1, 25))
        self.button_csa.SetToolTipString("Define the Chemical Shift Anisotropy (CSA) relaxation mechanism via the value.set user function.")
        self.gui.Bind(wx.EVT_BUTTON, self.value_set_csa, self.button_csa)
        sizer.Add(self.button_csa, 1, wx.ALL|wx.EXPAND, 0)

        # Isotope type button (heteronucleus).
        self.button_isotope_heteronuc = wx.lib.buttons.ThemedGenBitmapTextButton(self, -1, None, " X isotope")
        self.button_isotope_heteronuc.SetBitmapLabel(wx.Bitmap(fetch_icon("relax.nuclear_symbol", "22x22"), wx.BITMAP_TYPE_ANY))
        self.button_isotope_heteronuc.SetFont(font.normal)
        self.button_isotope_heteronuc.SetSize((-1, 25))
        self.button_isotope_heteronuc.SetToolTipString("Set the nuclear isotope types of the heteronuclear spins via the spin.isotope user function.")
        self.gui.Bind(wx.EVT_BUTTON, self.spin_isotope_heteronuc, self.button_isotope_heteronuc)
        sizer.Add(self.button_isotope_heteronuc, 1, wx.ALL|wx.EXPAND, 0)

        # Isotope type button (proton).
        self.button_isotope_proton = wx.lib.buttons.ThemedGenBitmapTextButton(self, -1, None, " H isotope")
        self.button_isotope_proton.SetBitmapLabel(wx.Bitmap(fetch_icon("relax.nuclear_symbol", "22x22"), wx.BITMAP_TYPE_ANY))
        self.button_isotope_proton.SetFont(font.normal)
        self.button_isotope_proton.SetSize((-1, 25))
        self.button_isotope_proton.SetToolTipString("Set the nuclear isotope types of the proton spins via the spin.isotope user function.")
        self.gui.Bind(wx.EVT_BUTTON, self.spin_isotope_proton, self.button_isotope_proton)
        sizer.Add(self.button_isotope_proton, 1, wx.ALL|wx.EXPAND, 0)

        # Add the element to the box.
        box.Add(sizer, 0, wx.ALL|wx.EXPAND, 0)
    def add_values(self, box):
        """Create and add the value.set buttons for the model-free analysis.

        @param box:     The box element to pack the GUI element into.
        @type box:      wx.BoxSizer instance
        """

        # Sizer.
        sizer = wx.BoxSizer(wx.HORIZONTAL)

        # Dipole-dipole relaxation setup button.
        self.button_dipole_pair = wx.lib.buttons.ThemedGenBitmapTextButton(self, -1, None, " Dipolar relaxation")
        self.button_dipole_pair.SetBitmapLabel(wx.Bitmap(fetch_icon("relax.dipole_pair", "22x22"), wx.BITMAP_TYPE_ANY))
        self.button_dipole_pair.SetFont(font.normal)
        self.button_dipole_pair.SetSize((-1, 25))
        self.button_dipole_pair.SetToolTipString("Define the magnetic dipole-dipole relaxation mechanism.")
        self.gui.Bind(wx.EVT_BUTTON, self.setup_dipole_pair, self.button_dipole_pair)
        sizer.Add(self.button_dipole_pair, 1, wx.ALL|wx.EXPAND, 0)

        # CSA button.
        self.button_csa = wx.lib.buttons.ThemedGenBitmapTextButton(self, -1, None, " CSA relaxation")
        self.button_csa.SetBitmapLabel(wx.Bitmap(fetch_icon("relax.align_tensor", "22x22"), wx.BITMAP_TYPE_ANY))
        self.button_csa.SetFont(font.normal)
        self.button_csa.SetSize((-1, 25))
        self.button_csa.SetToolTipString("Define the Chemical Shift Anisotropy (CSA) relaxation mechanism via the value.set user function.")
        self.gui.Bind(wx.EVT_BUTTON, self.value_set_csa, self.button_csa)
        sizer.Add(self.button_csa, 1, wx.ALL|wx.EXPAND, 0)

        # Isotope type button (heteronucleus).
        self.button_isotope_heteronuc = wx.lib.buttons.ThemedGenBitmapTextButton(self, -1, None, " X isotope")
        self.button_isotope_heteronuc.SetBitmapLabel(wx.Bitmap(fetch_icon("relax.nuclear_symbol", "22x22"), wx.BITMAP_TYPE_ANY))
        self.button_isotope_heteronuc.SetFont(font.normal)
        self.button_isotope_heteronuc.SetSize((-1, 25))
        self.button_isotope_heteronuc.SetToolTipString("Set the nuclear isotope types of the heteronuclear spins via the spin.isotope user function.")
        self.gui.Bind(wx.EVT_BUTTON, self.spin_isotope_heteronuc, self.button_isotope_heteronuc)
        sizer.Add(self.button_isotope_heteronuc, 1, wx.ALL|wx.EXPAND, 0)

        # Isotope type button (proton).
        self.button_isotope_proton = wx.lib.buttons.ThemedGenBitmapTextButton(self, -1, None, " H isotope")
        self.button_isotope_proton.SetBitmapLabel(wx.Bitmap(fetch_icon("relax.nuclear_symbol", "22x22"), wx.BITMAP_TYPE_ANY))
        self.button_isotope_proton.SetFont(font.normal)
        self.button_isotope_proton.SetSize((-1, 25))
        self.button_isotope_proton.SetToolTipString("Set the nuclear isotope types of the proton spins via the spin.isotope user function.")
        self.gui.Bind(wx.EVT_BUTTON, self.spin_isotope_proton, self.button_isotope_proton)
        sizer.Add(self.button_isotope_proton, 1, wx.ALL|wx.EXPAND, 0)

        # Add the element to the box.
        box.Add(sizer, 0, wx.ALL|wx.EXPAND, 0)
Beispiel #20
0
    def _build_mini(self):
        """Build the mini GUI element."""

        # Init.
        sub_sizer = wx.BoxSizer(wx.HORIZONTAL)

        # Left padding.
        sub_sizer.AddSpacer(self.padding)

        # The description.
        text = wx.StaticText(self.parent, -1, "Free format file settings", style=wx.ALIGN_LEFT)
        text.SetFont(font.normal)
        sub_sizer.Add(text, 0, wx.LEFT|wx.ALIGN_CENTER_VERTICAL, 0)

        # The divider.
        if not self.divider:
            raise RelaxError("The divider position has not been supplied.")

        # Spacing.
        x, y = text.GetSize()
        sub_sizer.AddSpacer((self.divider - x, 0))

        # Initialise the text input field.
        self.field = wx.TextCtrl(self.parent, -1, '')
        self.field.SetEditable(False)
        colour = self.parent.GetBackgroundColour()
        self.field.SetOwnBackgroundColour(colour)
        self.field.SetMinSize((50, self.height_element))
        self.field.SetFont(font.normal)
        sub_sizer.Add(self.field, 1, wx.ADJUST_MINSIZE|wx.ALIGN_CENTER_VERTICAL, 0)

        # A little spacing.
        sub_sizer.AddSpacer(5)

        # The edit button.
        button = wx.BitmapButton(self.parent, -1, wx.Bitmap(fetch_icon("oxygen.actions.document-properties"), wx.BITMAP_TYPE_ANY))
        button.SetMinSize((self.height_element, self.height_element))
        button.SetToolTipString("Open the free file format editing window.")
        sub_sizer.Add(button, 0, wx.ADJUST_MINSIZE|wx.ALIGN_CENTER_VERTICAL, 0)
        self.parent.Bind(wx.EVT_BUTTON, self.open_window, button)

        # Right padding.
        sub_sizer.AddSpacer(self.padding)

        # Add to the main sizer.
        self.sizer.Add(sub_sizer, 1, wx.EXPAND|wx.ALL, 0)

        # Spacing below the widget.
        if self.spacer == None:
            self.sizer.AddStretchSpacer()
        else:
            self.sizer.AddSpacer(self.spacer)

        # Tooltip.
        tooltip = "The free file format settings."
        text.SetToolTipString(tooltip)
        self.field.SetToolTipString(tooltip)

        # Set the values.
        self.set_vals()
    def _build_mini(self):
        """Build the mini GUI element."""

        # Init.
        sub_sizer = wx.BoxSizer(wx.HORIZONTAL)

        # Left padding.
        sub_sizer.AddSpacer(self.padding)

        # The description.
        text = wx.StaticText(self.parent, -1, "Free format file settings", style=wx.ALIGN_LEFT)
        text.SetFont(font.normal)
        sub_sizer.Add(text, 0, wx.LEFT|wx.ALIGN_CENTER_VERTICAL, 0)

        # The divider.
        if not self.divider:
            raise RelaxError("The divider position has not been supplied.")

        # Spacing.
        x, y = text.GetSize()
        sub_sizer.AddSpacer((self.divider - x, 0))

        # Initialise the text input field.
        self.field = wx.TextCtrl(self.parent, -1, '')
        self.field.SetEditable(False)
        colour = self.parent.GetBackgroundColour()
        self.field.SetOwnBackgroundColour(colour)
        self.field.SetMinSize((50, self.height_element))
        self.field.SetFont(font.normal)
        sub_sizer.Add(self.field, 1, wx.ADJUST_MINSIZE|wx.ALIGN_CENTER_VERTICAL, 0)

        # A little spacing.
        sub_sizer.AddSpacer(5)

        # The edit button.
        button = wx.BitmapButton(self.parent, -1, wx.Bitmap(fetch_icon("oxygen.actions.document-properties"), wx.BITMAP_TYPE_ANY))
        button.SetMinSize((self.height_element, self.height_element))
        button.SetToolTipString("Open the free file format editing window.")
        sub_sizer.Add(button, 0, wx.ADJUST_MINSIZE|wx.ALIGN_CENTER_VERTICAL, 0)
        self.parent.Bind(wx.EVT_BUTTON, self.open_window, button)

        # Right padding.
        sub_sizer.AddSpacer(self.padding)

        # Add to the main sizer.
        self.sizer.Add(sub_sizer, 1, wx.EXPAND|wx.ALL, 0)

        # Spacing below the widget.
        if self.spacer == None:
            self.sizer.AddStretchSpacer()
        else:
            self.sizer.AddSpacer(self.spacer)

        # Tooltip.
        tooltip = "The free file format settings."
        text.SetToolTipString(tooltip)
        self.field.SetToolTipString(tooltip)

        # Set the values.
        self.set_vals()
    def build_auto(self, sizer):
        """Build the fully automated part of the window.

        @param sizer:   The sizer to pack the elements into.
        @type sizer:    wx.BoxSizer instance
        """

        # Create a vertical sizer for the elements.
        sub_sizer = wx.BoxSizer(wx.VERTICAL)

        # The title.
        title = wx.StaticText(self, -1, "Fully automated")
        title.SetFont(font.subtitle)
        sub_sizer.Add(title, 0, wx.ALIGN_CENTRE_HORIZONTAL, 0)

        # Spacing.
        sub_sizer.AddStretchSpacer()

        # The button.
        button = wx.BitmapButton(self, -1, wx.Bitmap(fetch_icon('oxygen.actions.go-bottom', "48x48"), wx.BITMAP_TYPE_ANY))
        button.SetMinSize((80, 80))
        button.SetToolTipString("Perform a fully automated analysis, looping over global models I to V and terminating with the final run.  Please click on the 'About' button for more information.")
        sub_sizer.Add(button, 3, wx.EXPAND, 0)
        self.Bind(wx.EVT_BUTTON, self.select_full_analysis, button)

        # Spacing.
        sub_sizer.AddStretchSpacer()

        # Add the sub-sizer.
        sizer.Add(sub_sizer, 1, wx.ALL|wx.EXPAND, 0)
Beispiel #23
0
    def add_spin_systems(self, box, parent):
        """Add a special control for spin systems.

        Only one of these per analysis are allowed.

        @param box:         The box element to pack the control into.
        @type box:          wx.BoxSizer instance
        @param parent:      The parent GUI element.
        @type parent:       wx object
        """

        # Add the element.
        self.spin_systems = Text_ctrl(
            box,
            self,
            text="Spin systems:",
            button_text=" Spin editor",
            default=self.spin_count(),
            tooltip="The currently loaded molecule, residue and spin sequence.",
            tooltip_button=
            "Launch the spin editor window for modifying the molecule, residue and spin sequence.",
            icon=fetch_icon('relax.spin', "16x16"),
            fn=self.launch_spin_editor,
            editable=False,
            button=True,
            width_text=self.width_text,
            width_button=self.width_button,
            spacer=self.spacer_horizontal)
Beispiel #24
0
    def add_buttons(self, box):
        """Add all of the buttons.

        @param box:     The box element to pack the GUI element into.
        @type box:      wx.BoxSizer instance
        """

        # Sizer.
        sizer = wx.BoxSizer(wx.HORIZONTAL)

        # Isotope type button.
        self.button_select_model = wx.lib.buttons.ThemedGenBitmapTextButton(self, -1, None, " Exponential curve model")
        self.button_select_model.SetBitmapLabel(wx.Bitmap(fetch_icon("oxygen.actions.list-add", "22x22"), wx.BITMAP_TYPE_ANY))
        self.button_select_model.SetFont(font.normal)
        self.button_select_model.SetSize((-1, 25))
        self.button_select_model.SetToolTipString("Select the model for the exponential curve via the relax_fit.select_model user function.")
        self.gui.Bind(wx.EVT_BUTTON, self.select_model, self.button_select_model)
        sizer.Add(self.button_select_model, 1, wx.ALL|wx.EXPAND, 0)

        # 3 invisible 'buttons' for better button layout.
        sizer.AddStretchSpacer()
        sizer.AddStretchSpacer()
        sizer.AddStretchSpacer()

        # Add the element to the box.
        box.Add(sizer, 0, wx.ALL|wx.EXPAND, 0)
Beispiel #25
0
    def add_spin_systems(self, box, parent):
        """Add a special control for spin systems.

        Only one of these per analysis are allowed.

        @param box:         The box element to pack the control into.
        @type box:          wx.BoxSizer instance
        @param parent:      The parent GUI element.
        @type parent:       wx object
        """

        # Add the element.
        self.spin_systems = Text_ctrl(
            box,
            self,
            text="Spin systems:",
            button_text=" Spin editor",
            default=self.spin_count(),
            tooltip="The currently loaded molecule, residue and spin sequence.",
            tooltip_button="Launch the spin editor window for modifying the molecule, residue and spin sequence.",
            icon=fetch_icon("relax.spin", "16x16"),
            fn=self.launch_spin_editor,
            editable=False,
            button=True,
            width_text=self.width_text,
            width_button=self.width_button,
            spacer=self.spacer_horizontal,
        )
Beispiel #26
0
    def menu_default(self):
        """The right click root menu."""

        # The menu.
        menu = wx.Menu()

        # The load spins entry.
        item = build_menu_item(menu,
                               id=MENU_ROOT_LOAD_SPINS,
                               text="Load spins",
                               icon=fetch_icon("relax.spin", "16x16"))
        if status.exec_lock.locked():
            item.Enable(False)

        # The menu actions.
        self.Bind(wx.EVT_MENU,
                  self.gui.spin_viewer.load_spins_wizard,
                  id=MENU_ROOT_LOAD_SPINS)

        # Show the menu.
        if status.show_gui:
            self.PopupMenu(menu)

        # Cleanup.
        menu.Destroy()
Beispiel #27
0
    def add_buttons(self, box):
        """Add all of the buttons.

        @param box:     The box element to pack the GUI element into.
        @type box:      wx.BoxSizer instance
        """

        # Sizer.
        sizer = wx.BoxSizer(wx.HORIZONTAL)

        # Isotope type button.
        self.button_select_model = wx.lib.buttons.ThemedGenBitmapTextButton(
            self, -1, None, " Exponential curve model")
        self.button_select_model.SetBitmapLabel(
            wx.Bitmap(fetch_icon("oxygen.actions.list-add", "22x22"),
                      wx.BITMAP_TYPE_ANY))
        self.button_select_model.SetFont(font.normal)
        self.button_select_model.SetSize((-1, 25))
        self.button_select_model.SetToolTip(
            wx.ToolTip(
                "Select the model for the exponential curve via the relax_fit.select_model user function."
            ))
        self.gui.Bind(wx.EVT_BUTTON, self.select_model,
                      self.button_select_model)
        sizer.Add(self.button_select_model, 1, wx.ALL | wx.EXPAND, 0)

        # 3 invisible 'buttons' for better button layout.
        sizer.AddStretchSpacer()
        sizer.AddStretchSpacer()
        sizer.AddStretchSpacer()

        # Add the element to the box.
        box.Add(sizer, 0, wx.ALL | wx.EXPAND, 0)
Beispiel #28
0
    def build_auto(self, sizer):
        """Build the fully automated part of the window.

        @param sizer:   The sizer to pack the elements into.
        @type sizer:    wx.BoxSizer instance
        """

        # Create a vertical sizer for the elements.
        sub_sizer = wx.BoxSizer(wx.VERTICAL)

        # The title.
        title = wx.StaticText(self, -1, "Fully automated")
        title.SetFont(font.subtitle)
        sub_sizer.Add(title, 0, wx.ALIGN_CENTRE_HORIZONTAL, 0)

        # Spacing.
        sub_sizer.AddStretchSpacer()

        # The button.
        button = wx.BitmapButton(self, -1, wx.Bitmap(fetch_icon('oxygen.actions.go-bottom', "48x48"), wx.BITMAP_TYPE_ANY))
        button.SetMinSize((80, 80))
        button.SetToolTipString("Perform a fully automated analysis, looping over global models I to V and terminating with the final run.  Please click on the 'About' button for more information.")
        sub_sizer.Add(button, 3, wx.EXPAND, 0)
        self.Bind(wx.EVT_BUTTON, self.select_full_analysis, button)

        # Spacing.
        sub_sizer.AddStretchSpacer()

        # Add the sub-sizer.
        sizer.Add(sub_sizer, 1, wx.ALL|wx.EXPAND, 0)
Beispiel #29
0
    def setup(self):
        """Override the base variables."""

        # GUI variables.
        self.title = "Spectra list"
        self.observer_base_name = "spectra list"

        # The column titles.
        self.columns = []

        # Button set up.
        self.button_placement = 'top'
        self.button_size = (170, 40)
        self.button_info = [{
            'object':
            'button_add',
            'label':
            ' Add',
            'icon':
            fetch_icon('oxygen.actions.list-add-relax-blue', "22x22"),
            'method':
            self.fn_add,
            'tooltip':
            "Read a spectral data file."
        }, {
            'object':
            'button_delete',
            'label':
            ' Delete',
            'icon':
            fetch_icon('oxygen.actions.list-remove', "22x22"),
            'method':
            self.action_spectrum_delete,
            'tooltip':
            "Delete loaded relaxation data from the relax data store."
        }, {
            'object':
            'button_error_analysis',
            'label':
            ' Error analysis',
            'icon':
            fetch_icon('oxygen.categories.applications-education', "22x22"),
            'method':
            self.action_spectrum_error_analysis,
            'tooltip':
            "Perform a peak intensity error analysis on the currently loaded data or data subsets.  Select a subset of the spectra below to perform the error analysis only on this subset."
        }]
Beispiel #30
0
    def pop_up_menu(self, event):
        """Override the StyledTextCtrl pop up menu.

        @param event:   The wx event.
        @type event:    wx event
        """

        # Create the menu.
        menu = wx.Menu()

        # Add the entries.
        build_menu_item(menu,
                        id=MENU_ID_FIND,
                        text="&Find",
                        icon=fetch_icon('oxygen.actions.edit-find', "16x16"))
        menu.AppendSeparator()
        build_menu_item(menu,
                        id=MENU_ID_COPY,
                        text="&Copy",
                        icon=fetch_icon('oxygen.actions.edit-copy', "16x16"))
        build_menu_item(menu,
                        id=MENU_ID_SELECT_ALL,
                        text="&Select all",
                        icon=fetch_icon('oxygen.actions.edit-select-all',
                                        "16x16"))
        menu.AppendSeparator()
        build_menu_item(menu,
                        id=MENU_ID_ZOOM_IN,
                        text="Zoom &in",
                        icon=fetch_icon('oxygen.actions.zoom-in', "16x16"))
        build_menu_item(menu,
                        id=MENU_ID_ZOOM_OUT,
                        text="Zoom &out",
                        icon=fetch_icon('oxygen.actions.zoom-out', "16x16"))
        build_menu_item(menu,
                        id=MENU_ID_ZOOM_ORIG,
                        text="Original &zoom",
                        icon=fetch_icon('oxygen.actions.zoom-original',
                                        "16x16"))
        menu.AppendSeparator()
        build_menu_item(menu,
                        id=MENU_ID_GOTO_START,
                        text="&Go to start",
                        icon=fetch_icon('oxygen.actions.go-top', "16x16"))
        build_menu_item(menu,
                        id=MENU_ID_GOTO_END,
                        text="&Go to end",
                        icon=fetch_icon('oxygen.actions.go-bottom', "16x16"))

        # Pop up the menu.
        if status.show_gui:
            self.PopupMenu(menu)

        # Cleanup.
        menu.Destroy()
Beispiel #31
0
    def SetValue(self, value):
        """Set the value of the control.

        @param value:   The value to set the boolean control to.
        @type value:    bool
        """

        # True.
        if value == True:
            self.field.SetValue('True')
            self.button.SetBitmapLabel(wx.Bitmap(fetch_icon('oxygen.actions.media-record-relax-green'), wx.BITMAP_TYPE_ANY))
            self.state = True

        # False:
        else:
            self.field.SetValue('False')
            self.button.SetBitmapLabel(wx.Bitmap(fetch_icon('oxygen.actions.media-record'), wx.BITMAP_TYPE_ANY))
            self.state = False
Beispiel #32
0
    def update_button(self):
        """Update the button bitmap as needed."""

        # Nothing to do.
        if not self.red_flag:
            return

        # Change the flag to red to indicate to the user that changing the models is a bad thing!
        if False in self.select:
            self.button.SetBitmapLabel(
                wx.Bitmap(fetch_icon("oxygen.actions.flag-red", "16x16"),
                          wx.BITMAP_TYPE_ANY))

        # Otherwise set it to blue (in case all models are selected again).
        else:
            self.button.SetBitmapLabel(
                wx.Bitmap(fetch_icon("oxygen.actions.flag-blue", "16x16"),
                          wx.BITMAP_TYPE_ANY))
    def __init__(self, parent):
        """Build the results frame.

        @param parent:  The parent wx object.
        @type parent:   wx object
        """

        # Initialise the base frame.
        wx.Frame.__init__(self, parent=parent, style=wx.DEFAULT_FRAME_STYLE)

        # Set up the window icon.
        self.SetIcons(relax_icons)

        # Set the window title, size, etc.
        self.SetTitle("Results viewer")
        self.SetSize(self.size)

       # Place all elements within a panel (to remove the dark grey in MS Windows).
        self.main_panel = wx.Panel(self, -1)

        # Pack a sizer into the panel.
        box_main = wx.BoxSizer(wx.HORIZONTAL)
        self.main_panel.SetSizer(box_main)

        # Build the central sizer, with borders.
        box_centre = add_border(box_main, border=self.border, packing=wx.VERTICAL)

        # Build the data pipe selector.
        self.build_pipe_sel(box_centre)

        # Spacer.
        box_centre.AddSpacer(self.border)

        # Add the list of results files.
        self.add_files(box_centre)

        # Spacer.
        box_centre.AddSpacer(self.border)

        # Add the open button.
        self.button_open = buttons.ThemedGenBitmapTextButton(self.main_panel, -1, None, " Open")
        self.button_open.SetBitmapLabel(wx.Bitmap(fetch_icon('oxygen.actions.document-open', "22x22"), wx.BITMAP_TYPE_ANY))
        self.button_open.SetFont(font.normal)
        self.button_open.SetMinSize((103, 33))
        self.Bind(wx.EVT_BUTTON, self.open_result_file, self.button_open)
        box_centre.Add(self.button_open, 0, wx.ALIGN_RIGHT|wx.ADJUST_MINSIZE, 5)

        # Relayout the main panel.
        self.main_panel.Layout()
        self.main_panel.Refresh()

        # Bind some events.
        self.Bind(wx.EVT_COMBOBOX, self.switch_pipes, self.pipe_name)
        self.Bind(wx.EVT_CLOSE, self.handler_close)

        # Initialise observer name.
        self.name = 'results viewer'
Beispiel #34
0
    def __init__(self, parent):
        """Build the results frame.

        @param parent:  The parent wx object.
        @type parent:   wx object
        """

        # Initialise the base frame.
        wx.Frame.__init__(self, parent=parent, style=wx.DEFAULT_FRAME_STYLE)

        # Set up the window icon.
        self.SetIcons(relax_icons)

        # Set the window title, size, etc.
        self.SetTitle("Results viewer")
        self.SetSize(self.size)

       # Place all elements within a panel (to remove the dark grey in MS Windows).
        self.main_panel = wx.Panel(self, -1)

        # Pack a sizer into the panel.
        box_main = wx.BoxSizer(wx.HORIZONTAL)
        self.main_panel.SetSizer(box_main)

        # Build the central sizer, with borders.
        box_centre = add_border(box_main, border=self.border, packing=wx.VERTICAL)

        # Build the data pipe selector.
        self.build_pipe_sel(box_centre)

        # Spacer.
        box_centre.AddSpacer(self.border)

        # Add the list of results files.
        self.add_files(box_centre)

        # Spacer.
        box_centre.AddSpacer(self.border)

        # Add the open button.
        self.button_open = buttons.ThemedGenBitmapTextButton(self.main_panel, -1, None, " Open")
        self.button_open.SetBitmapLabel(wx.Bitmap(fetch_icon('oxygen.actions.document-open', "22x22"), wx.BITMAP_TYPE_ANY))
        self.button_open.SetFont(font.normal)
        self.button_open.SetMinSize((103, 33))
        self.Bind(wx.EVT_BUTTON, self.open_result_file, self.button_open)
        box_centre.Add(self.button_open, 0, wx.ALIGN_RIGHT|wx.ADJUST_MINSIZE, 5)

        # Relayout the main panel.
        self.main_panel.Layout()
        self.main_panel.Refresh()

        # Bind some events.
        self.Bind(wx.EVT_COMBOBOX, self.switch_pipes, self.pipe_name)
        self.Bind(wx.EVT_CLOSE, self.handler_close)

        # Initialise observer name.
        self.name = 'results viewer'
Beispiel #35
0
    def build_left_box(self):
        """Construct the left hand box to pack into the main model-free box.

        @return:    The left hand box element containing the bitmap and about button to pack into the main model-free box.
        @rtype:     wx.BoxSizer instance
        """

        # Build the left hand box.
        left_box = wx.BoxSizer(wx.VERTICAL)

        # The images.
        bitmaps = [
            ANALYSIS_IMAGE_PATH + "model_free" + sep +
            "model_free_200x200.png", IMAGE_PATH + 'modelfree.png'
        ]

        # Add the model-free bitmap picture.
        for i in range(len(bitmaps)):
            # The bitmap.
            bitmap = wx.StaticBitmap(self, -1, bitmap_setup(bitmaps[i]))

            # Add it.
            left_box.Add(bitmap, 0, wx.ALL, 0)

        # A spacer.
        left_box.AddStretchSpacer()

        # A button sizer, with some initial spacing.
        button_sizer = wx.BoxSizer(wx.HORIZONTAL)

        # An about button.
        button = wx.lib.buttons.ThemedGenBitmapTextButton(
            self, -1, None, "About")
        button.SetBitmapLabel(
            wx.Bitmap(fetch_icon('oxygen.actions.help-about', "22x22"),
                      wx.BITMAP_TYPE_ANY))
        button.SetFont(font.normal)
        button.SetToolTip(
            wx.ToolTip("Information about this automatic analysis"))

        # Bind the click.
        self.Bind(wx.EVT_BUTTON, self._about, button)

        # A cursor for the button.
        if dep_check.wx_classic:
            cursor = wx.StockCursor(wx.CURSOR_QUESTION_ARROW)
        else:
            cursor = wx.Cursor(wx.CURSOR_QUESTION_ARROW)
        button.SetCursor(cursor)

        # Pack the button.
        button_sizer.Add(button, 0, 0, 0)
        left_box.Add(button_sizer, 0, wx.ALL, 0)

        # Return the packed box.
        return left_box
Beispiel #36
0
    def add_buttons(self, sizer):
        """Build and add the bottom buttons.

        @param sizer:   The sizer element to pack the buttons into.
        @type sizer:    wx.Sizer instance
        """

        # Button sizer.
        button_sizer = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(button_sizer, 0, wx.ALIGN_RIGHT, 0)

        # Preview button.
        button = wx.lib.buttons.ThemedGenBitmapTextButton(self.main_panel, -1, None, " Preview")
        button.SetBitmapLabel(wx.Bitmap(fetch_icon('oxygen.actions.document-preview', "32x32"), wx.BITMAP_TYPE_ANY))
        button.SetFont(font.normal)
        button.SetMinSize(self.button_size)
        button_sizer.Add(button, 0, 0, 0)
        self.Bind(wx.EVT_BUTTON, self.action_preview, button)
        button.SetToolTipString("Preview the NMR-STAR formatted data.")

        # Spacing.
        button_sizer.AddSpacer(self.button_spacing)

        # Export button.
        button = wx.lib.buttons.ThemedGenBitmapTextButton(self.main_panel, -1, None, " Export")
        button.SetBitmapLabel(wx.Bitmap(fetch_icon('relax.bmrb', "32x32"), wx.BITMAP_TYPE_ANY))
        button.SetFont(font.normal)
        button.SetMinSize(self.button_size)
        button_sizer.Add(button, 0, 0, 0)
        self.Bind(wx.EVT_BUTTON, self.action_export, button)
        button.SetToolTipString("Create the NMR-STAR formatted file for BMRB deposition.")

        # Spacing.
        button_sizer.AddSpacer(self.button_spacing)

        # Cancel button.
        button = wx.lib.buttons.ThemedGenBitmapTextButton(self.main_panel, -1, None, " Cancel")
        button.SetBitmapLabel(wx.Bitmap(fetch_icon('oxygen.actions.dialog-cancel', "32x32"), wx.BITMAP_TYPE_ANY))
        button.SetFont(font.normal)
        button.SetMinSize(self.button_size)
        button_sizer.Add(button, 0, 0, 0)
        self.Bind(wx.EVT_BUTTON, self.action_cancel, button)
        button.SetToolTipString("Cancel the BMRB export.")
Beispiel #37
0
    def toggle(self, event=None):
        """Switch the state."""

        # From False to True.
        if self.state == False:
            self.field.SetValue('True')
            self.button.SetBitmapLabel(
                wx.Bitmap(
                    fetch_icon('oxygen.actions.media-record-relax-green'),
                    wx.BITMAP_TYPE_ANY))
            self.state = True

        # From True to False.
        else:
            self.field.SetValue('False')
            self.button.SetBitmapLabel(
                wx.Bitmap(fetch_icon('oxygen.actions.media-record'),
                          wx.BITMAP_TYPE_ANY))
            self.state = False
Beispiel #38
0
    def add_buttons(self, sizer):
        """Add the buttons for peak list manipulation.

        @param sizer:   The sizer element to pack the buttons into.
        @type sizer:    wx.BoxSizer instance
        """

        # Button Sizer
        button_sizer = wx.BoxSizer(wx.VERTICAL)

        # Add peaklist button
        add_pkl = wx.BitmapButton(self.parent,
                                  -1,
                                  bitmap=wx.Bitmap(
                                      fetch_icon(
                                          'oxygen.actions.list-add-relax-blue',
                                          "16x16"), wx.BITMAP_TYPE_ANY))
        add_pkl.SetMinSize((50, 50))
        self.gui.Bind(wx.EVT_BUTTON, self.load_peaklist, add_pkl)
        button_sizer.Add(add_pkl, 0, wx.ADJUST_MINSIZE, 0)

        # Add VD list import
        if self.label == 'R1':
            add_vd = wx.Button(self.parent, -1, "+VD")
            add_vd.SetToolTipString(
                "Add VD (variable delay) list to automatically fill in R1 relaxation times."
            )
            add_vd.SetMinSize((50, 50))
            self.gui.Bind(wx.EVT_BUTTON, self.load_delay, add_vd)
            button_sizer.Add(add_vd, 0, wx.ADJUST_MINSIZE, 0)

        # Add Vc list import
        if self.label == 'R2':
            add_vc = wx.Button(self.parent, -1, "+VC")
            add_vc.SetToolTipString(
                "Add VC (variable counter) list to automatically fill in R2 relaxation times."
            )
            add_vc.SetMinSize((50, 50))
            button_sizer.Add(add_vc, 0, wx.ADJUST_MINSIZE, 0)

            # Time of counter
            self.vc_time = wx.TextCtrl(self.parent, -1, "0")
            self.vc_time.SetToolTipString("Time of counter loop in seconds.")
            self.vc_time.SetMinSize((50, 20))
            self.vc_time.SetFont(
                wx.Font(7, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
            button_sizer.Add(self.vc_time, 0, 0, 0)

            # Action of Button
            self.gui.Bind(wx.EVT_BUTTON,
                          lambda event, vc=True: self.load_delay(event, vc),
                          add_vc)

        # Pack buttons
        sizer.Add(button_sizer, 0, 0, 0)
    def add_buttons(self, sizer):
        """Add the buttons to the sizer.

        @param sizer:   A sizer object.
        @type sizer:    wx.Sizer instance
        """

        # Create a horizontal layout for the buttons.
        button_sizer = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(button_sizer, 0, wx.ALIGN_CENTER|wx.ALL, 0)

        # The save button.
        button = wx.lib.buttons.ThemedGenBitmapTextButton(self, -1, None, "  Save")
        button.SetBitmapLabel(wx.Bitmap(fetch_icon('oxygen.actions.document-save', "22x22"), wx.BITMAP_TYPE_ANY))
        button.SetFont(font.normal)
        button.SetToolTipString("Save the free file format settings within the relax data store.")
        button.SetMinSize(self.SIZE_BUTTON)
        button_sizer.Add(button, 0, wx.ADJUST_MINSIZE, 0)
        self.Bind(wx.EVT_BUTTON, self.save, button)

        # Spacer.
        button_sizer.AddSpacer(20)

        # The reset button.
        button = wx.lib.buttons.ThemedGenBitmapTextButton(self, -1, None, "  Reset")
        button.SetBitmapLabel(wx.Bitmap(fetch_icon('oxygen.actions.edit-delete', "22x22"), wx.BITMAP_TYPE_ANY))
        button.SetFont(font.normal)
        button.SetToolTipString("Reset the free file format settings to the original values.")
        button.SetMinSize(self.SIZE_BUTTON)
        button_sizer.Add(button, 0, wx.ADJUST_MINSIZE, 0)
        self.Bind(wx.EVT_BUTTON, self.reset, button)

        # Spacer.
        button_sizer.AddSpacer(20)

        # The cancel button.
        button = wx.lib.buttons.ThemedGenBitmapTextButton(self, -1, None, "  Cancel")
        button.SetBitmapLabel(wx.Bitmap(fetch_icon('oxygen.actions.dialog-cancel', "22x22"), wx.BITMAP_TYPE_ANY))
        button.SetFont(font.normal)
        button.SetMinSize(self.SIZE_BUTTON)
        button_sizer.Add(button, 0, wx.ADJUST_MINSIZE, 0)
        self.Bind(wx.EVT_BUTTON, self.cancel, button)
Beispiel #40
0
    def build_uf(self):
        """Create the user function sectioning."""

        # Some whitespace.
        self.file.write("\n\n")

        # Start a new column for each user function and add a rule to the top.
        self.file.write("\\pagebreak[4]\n")
        self.file.write("\\rule{\columnwidth}{1pt}\n")

        # The title (with less spacing).
        self.file.write("\\vspace{-20pt}\n")
        self.uf_name_latex = self.uf_name

        # LaTeX formatting.
        self.uf_name_latex = self.latex_special_chars(self.uf_name_latex)
        self.uf_name_latex = self.word_formatting(self.uf_name_latex, bold=True)

        # Allow for hyphenation.
        self.uf_name_latex = self.uf_name_latex.replace('.', '\-.')
        self.uf_name_latex = self.uf_name_latex.replace('\_', '\-\_')

        # Write out the title (with label).
        self.file.write("\subsection{%s} \label{uf: %s}\n" % (self.uf_name_latex, self.uf_name))

        # Add the user function class icon.
        if self.uf_class:
            icon = fetch_icon(self.uf_class.gui_icon, size='128x128', format=None, sep='/', full_path=False)
            if icon:
                self.file.write("\includegraphics[bb=0 0 18 18]{%s} \hfill " % icon)
            else:
                self.file.write("\hfill ")

        # Add the user function icon.
        icon = fetch_icon(self.uf.gui_icon, size='128x128', format=None, sep='/', full_path=False)
        if icon:
            self.file.write("\includegraphics[bb=0 0 18 18]{%s}\n" % icon)
        else:
            self.file.write("\n")

        # End.
        self.file.write("\n")
Beispiel #41
0
    def menu_root(self):
        """The right click root menu."""

        # Init the item list.
        items = []

        # The menu.
        menu = wx.Menu()

        # Add some menu items for the spin user functions.
        items.append(
            build_menu_item(
                menu,
                id=MENU_ROOT_MOLECULE_CREATE,
                text="&Add a molecule",
                icon=fetch_icon("oxygen.actions.list-add-relax-blue")))
        items.append(
            build_menu_item(menu,
                            id=MENU_ROOT_LOAD_SPINS,
                            text="&Load spins",
                            icon=fetch_icon("relax.spin", "16x16")))

        # Add the items and activate them.
        for item in items:
            if status.exec_lock.locked():
                item.Enable(False)

        # The menu actions.
        self.Bind(wx.EVT_MENU,
                  self.action_root_molecule_create,
                  id=MENU_ROOT_MOLECULE_CREATE)
        self.Bind(wx.EVT_MENU,
                  self.gui.spin_viewer.load_spins_wizard,
                  id=MENU_ROOT_LOAD_SPINS)

        # Show the menu.
        if status.show_gui:
            self.PopupMenu(menu)

        # Cleanup.
        menu.Destroy()
Beispiel #42
0
    def setup(self):
        """Override the base variables."""

        # GUI variables.
        self.title = "Molecule information"
        self.observer_base_name = "molecule"
        self.button_placement = None

        # The column titles.
        self.columns = ["ID string", "Name", "Type", "Thiol state"]

        # The right click popup menu.
        self.popup_menus = [{
            'id':
            MENU_MOLECULE_NAME,
            'text':
            "&Name the molecule",
            'icon':
            fetch_icon(uf_info.get_uf('molecule.name').gui_icon),
            'method':
            self.action_molecule_name
        }, {
            'id':
            MENU_MOLECULE_TYPE,
            'text':
            "Set the molecule &type",
            'icon':
            fetch_icon(uf_info.get_uf('molecule.type').gui_icon),
            'method':
            self.action_molecule_type
        }, {
            'id':
            MENU_BMRB_THIOL_STATE,
            'text':
            "Set the thiol &state",
            'icon':
            fetch_icon(uf_info.get_uf('bmrb.thiol_state').gui_icon),
            'method':
            self.action_bmrb_thiol_state
        }]
Beispiel #43
0
    def setup(self):
        """Override the base variables."""

        # GUI variables.
        self.title = "Relaxation data metadata"
        self.observer_base_name = "relaxation metadata list"
        self.button_placement = None

        # The column titles.
        self.columns = [
            "Relaxation data ID",
            "Peak intensity type",
            "Temperature calibration",
            "Temperature control"
        ]

        # The right click popup menu.
        self.popup_menus = [
            {
                'id': MENU_RELAX_DATA_DISPLAY,
                'text': "Dis&play the relaxation data",
                'icon': fetch_icon(uf_info.get_uf('relax_data.display').gui_icon),
                'method': self.action_relax_data_display
            }, {
                'id': MENU_RELAX_DATA_PEAK_INTENSITY_TYPE,
                'text': "Set the peak &intensity type",
                'icon': fetch_icon(uf_info.get_uf('relax_data.peak_intensity_type').gui_icon),
                'method': self.action_relax_data_peak_intensity_type
            }, {
                'id': MENU_RELAX_DATA_TEMP_CALIBRATION,
                'text': "Set the temperature &calibration",
                'icon': fetch_icon(uf_info.get_uf('relax_data.temp_calibration').gui_icon),
                'method': self.action_relax_data_temp_calibration
            }, {
                'id': MENU_RELAX_DATA_TEMP_CONTROL,
                'text': "Set the temperature c&ontrol",
                'icon': fetch_icon(uf_info.get_uf('relax_data.temp_control').gui_icon),
                'method': self.action_relax_data_temp_control
            }
        ]
Beispiel #44
0
    def add_buttons(self, sizer):
        """Add the buttons to the sizer.

        @param sizer:   The sizer element to pack the buttons into.
        @type sizer:    wx.Sizer instance
        """

        # Create a horizontal layout for the buttons.
        button_sizer = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(button_sizer, 0, wx.ALL|wx.EXPAND, 0)

        # The bundle button.
        self.button_bundle = wx.lib.buttons.ThemedGenBitmapTextButton(self.main_panel, -1, None, " Bundle")
        self.button_bundle.SetBitmapLabel(wx.Bitmap(fetch_icon("relax.pipe_bundle", size="22x22"), wx.BITMAP_TYPE_ANY))
        self.button_bundle.SetFont(font.normal)
        self.button_bundle.SetToolTipString("Add a data pipe to a data pipe bundle.")
        button_sizer.Add(self.button_bundle, 1, wx.ALL|wx.EXPAND, 0)
        self.Bind(wx.EVT_BUTTON, self.uf_launch, self.button_bundle)

        # The create button.
        self.button_create = wx.lib.buttons.ThemedGenBitmapTextButton(self.main_panel, -1, None, " Create")
        self.button_create.SetBitmapLabel(wx.Bitmap(fetch_icon('oxygen.actions.list-add-relax-blue', "22x22"), wx.BITMAP_TYPE_ANY))
        self.button_create.SetFont(font.normal)
        self.button_create.SetToolTipString("Create a new data pipe.")
        button_sizer.Add(self.button_create, 1, wx.ALL|wx.EXPAND, 0)
        self.Bind(wx.EVT_BUTTON, self.uf_launch, self.button_create)

        # The copy button.
        self.button_copy = wx.lib.buttons.ThemedGenBitmapTextButton(self.main_panel, -1, None, " Copy")
        self.button_copy.SetBitmapLabel(wx.Bitmap(fetch_icon('oxygen.actions.list-add', "22x22"), wx.BITMAP_TYPE_ANY))
        self.button_copy.SetFont(font.normal)
        self.button_copy.SetToolTipString("Copy a data pipe.")
        button_sizer.Add(self.button_copy, 1, wx.ALL|wx.EXPAND, 0)
        self.Bind(wx.EVT_BUTTON, self.uf_launch, self.button_copy)

        # The delete button.
        self.button_delete = wx.lib.buttons.ThemedGenBitmapTextButton(self.main_panel, -1, None, " Delete")
        self.button_delete.SetBitmapLabel(wx.Bitmap(fetch_icon('oxygen.actions.list-remove', "22x22"), wx.BITMAP_TYPE_ANY))
        self.button_delete.SetFont(font.normal)
        self.button_delete.SetToolTipString("Delete a data pipe.")
        button_sizer.Add(self.button_delete, 1, wx.ALL|wx.EXPAND, 0)
        self.Bind(wx.EVT_BUTTON, self.uf_launch, self.button_delete)

        # The hybridise button.
        self.button_hybrid = wx.lib.buttons.ThemedGenBitmapTextButton(self.main_panel, -1, None, " Hybridise")
        self.button_hybrid.SetBitmapLabel(wx.Bitmap(fetch_icon('relax.pipe_hybrid', "22x22"), wx.BITMAP_TYPE_ANY))
        self.button_hybrid.SetFont(font.normal)
        self.button_hybrid.SetToolTipString("Hybridise data pipes.")
        button_sizer.Add(self.button_hybrid, 1, wx.ALL|wx.EXPAND, 0)
        self.Bind(wx.EVT_BUTTON, self.uf_launch, self.button_hybrid)

        # The switch button.
        self.button_switch = wx.lib.buttons.ThemedGenBitmapTextButton(self.main_panel, -1, None, " Switch")
        self.button_switch.SetBitmapLabel(wx.Bitmap(fetch_icon('oxygen.actions.system-switch-user', "22x22"), wx.BITMAP_TYPE_ANY))
        self.button_switch.SetFont(font.normal)
        self.button_switch.SetToolTipString("Switch data pipes.")
        button_sizer.Add(self.button_switch, 1, wx.ALL|wx.EXPAND, 0)
        self.Bind(wx.EVT_BUTTON, self.uf_launch, self.button_switch)
Beispiel #45
0
    def add_buttons(self, sizer):
        """Add the buttons to the sizer.

        @param sizer:   The sizer element to pack the buttons into.
        @type sizer:    wx.Sizer instance
        """

        # Create a horizontal layout for the buttons.
        button_sizer = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(button_sizer, 0, wx.ALL|wx.EXPAND, 0)

        # The bundle button.
        self.button_bundle = wx.lib.buttons.ThemedGenBitmapTextButton(self.main_panel, -1, None, " Bundle")
        self.button_bundle.SetBitmapLabel(wx.Bitmap(fetch_icon("relax.pipe_bundle", size="22x22"), wx.BITMAP_TYPE_ANY))
        self.button_bundle.SetFont(font.normal)
        self.button_bundle.SetToolTipString("Add a data pipe to a data pipe bundle.")
        button_sizer.Add(self.button_bundle, 1, wx.ALL|wx.EXPAND, 0)
        self.Bind(wx.EVT_BUTTON, self.uf_launch, self.button_bundle)

        # The create button.
        self.button_create = wx.lib.buttons.ThemedGenBitmapTextButton(self.main_panel, -1, None, " Create")
        self.button_create.SetBitmapLabel(wx.Bitmap(fetch_icon('oxygen.actions.list-add-relax-blue', "22x22"), wx.BITMAP_TYPE_ANY))
        self.button_create.SetFont(font.normal)
        self.button_create.SetToolTipString("Create a new data pipe.")
        button_sizer.Add(self.button_create, 1, wx.ALL|wx.EXPAND, 0)
        self.Bind(wx.EVT_BUTTON, self.uf_launch, self.button_create)

        # The copy button.
        self.button_copy = wx.lib.buttons.ThemedGenBitmapTextButton(self.main_panel, -1, None, " Copy")
        self.button_copy.SetBitmapLabel(wx.Bitmap(fetch_icon('oxygen.actions.list-add', "22x22"), wx.BITMAP_TYPE_ANY))
        self.button_copy.SetFont(font.normal)
        self.button_copy.SetToolTipString("Copy a data pipe.")
        button_sizer.Add(self.button_copy, 1, wx.ALL|wx.EXPAND, 0)
        self.Bind(wx.EVT_BUTTON, self.uf_launch, self.button_copy)

        # The delete button.
        self.button_delete = wx.lib.buttons.ThemedGenBitmapTextButton(self.main_panel, -1, None, " Delete")
        self.button_delete.SetBitmapLabel(wx.Bitmap(fetch_icon('oxygen.actions.list-remove', "22x22"), wx.BITMAP_TYPE_ANY))
        self.button_delete.SetFont(font.normal)
        self.button_delete.SetToolTipString("Delete a data pipe.")
        button_sizer.Add(self.button_delete, 1, wx.ALL|wx.EXPAND, 0)
        self.Bind(wx.EVT_BUTTON, self.uf_launch, self.button_delete)

        # The hybridise button.
        self.button_hybrid = wx.lib.buttons.ThemedGenBitmapTextButton(self.main_panel, -1, None, " Hybridise")
        self.button_hybrid.SetBitmapLabel(wx.Bitmap(fetch_icon('relax.pipe_hybrid', "22x22"), wx.BITMAP_TYPE_ANY))
        self.button_hybrid.SetFont(font.normal)
        self.button_hybrid.SetToolTipString("Hybridise data pipes.")
        button_sizer.Add(self.button_hybrid, 1, wx.ALL|wx.EXPAND, 0)
        self.Bind(wx.EVT_BUTTON, self.uf_launch, self.button_hybrid)

        # The switch button.
        self.button_switch = wx.lib.buttons.ThemedGenBitmapTextButton(self.main_panel, -1, None, " Switch")
        self.button_switch.SetBitmapLabel(wx.Bitmap(fetch_icon('oxygen.actions.system-switch-user', "22x22"), wx.BITMAP_TYPE_ANY))
        self.button_switch.SetFont(font.normal)
        self.button_switch.SetToolTipString("Switch data pipes.")
        button_sizer.Add(self.button_switch, 1, wx.ALL|wx.EXPAND, 0)
        self.Bind(wx.EVT_BUTTON, self.uf_launch, self.button_switch)
Beispiel #46
0
    def __init__(self, parent, box):
        """Build the combo box list widget for a list of list selections.

        @param parent:      The parent GUI element.
        @type parent:       wx object instance
        @param box:         The sizer to put the combo box widget into.
        @type box:          wx.Sizer instance
        """

        # Store some args.
        self.parent = parent

        # Initialise all models as being selected, and create a list with the separators removed.
        self.select = []
        self.models_stripped = []
        for model in self.models:
            if model != None:
                self.select.append(True)
                self.models_stripped.append(model)

        # Initialise the model selection window.
        self.model_win = Model_sel_window(self.models, self.params, self.model_desc, size=self.size, border=self.border)

        # Horizontal packing for this element.
        sizer = wx.BoxSizer(wx.HORIZONTAL)

        # Add a label.
        label = self.parent.add_static_text(sizer, self.parent, text=self.desc, width=self.parent.width_text)

        # Spacer.
        sizer.AddSpacer((self.parent.spacer_horizontal, -1))

        # The text input field.
        self.field = self.parent.add_text_control(sizer, self.parent, text=list_to_gui(self.GetValue()), editable=False)

        # Spacer.
        sizer.AddSpacer((self.parent.spacer_horizontal, -1))

        # Add the button.
        self.button = self.parent.add_button_open(sizer, self.parent, icon=fetch_icon("oxygen.actions.flag-blue", "16x16"), text="Modify", fn=self.modify, width=self.parent.width_button, height=label.GetSize()[1]+8)

        # Tooltip.
        if self.tooltip:
            label.SetToolTipString(self.tooltip)
            self.field.SetToolTipString(self.tooltip)
        if self.tooltip_button:
            self.button.SetToolTipString(self.tooltip_button)

        # Add the contents to the main box.
        box.Add(sizer, 0, wx.ALL|wx.EXPAND, 0)
Beispiel #47
0
    def SetValue(self, value):
        """Set the value of the control.

        @param value:   The value to set the boolean control to.
        @type value:    bool
        """

        # True.
        if value == True:
            self.field.SetValue('True')
            self.button.SetBitmapLabel(
                wx.Bitmap(
                    fetch_icon('oxygen.actions.media-record-relax-green'),
                    wx.BITMAP_TYPE_ANY))
            self.state = True

        # False:
        else:
            self.field.SetValue('False')
            self.button.SetBitmapLabel(
                wx.Bitmap(fetch_icon('oxygen.actions.media-record'),
                          wx.BITMAP_TYPE_ANY))
            self.state = False
    def build_left_box(self):
        """Construct the left hand box to pack into the main model-free box.

        @return:    The left hand box element containing the bitmap and about button to pack into the main model-free box.
        @rtype:     wx.BoxSizer instance
        """

        # Build the left hand box.
        left_box = wx.BoxSizer(wx.VERTICAL)

        # The images.
        bitmaps = [ANALYSIS_IMAGE_PATH+"model_free"+sep+"model_free_200x200.png",
                   IMAGE_PATH+'modelfree.png']

        # Add the model-free bitmap picture.
        for i in range(len(bitmaps)):
            # The bitmap.
            bitmap = wx.StaticBitmap(self, -1, bitmap_setup(bitmaps[i]))

            # Add it.
            left_box.Add(bitmap, 0, wx.ALL, 0)

        # A spacer.
        left_box.AddStretchSpacer()

        # A button sizer, with some initial spacing.
        button_sizer = wx.BoxSizer(wx.HORIZONTAL)

        # An about button.
        button = wx.lib.buttons.ThemedGenBitmapTextButton(self, -1, None, "About")
        button.SetBitmapLabel(wx.Bitmap(fetch_icon('oxygen.actions.help-about', "22x22"), wx.BITMAP_TYPE_ANY))
        button.SetFont(font.normal)
        button.SetToolTipString("Information about this automatic analysis")

        # Bind the click.
        self.Bind(wx.EVT_BUTTON, self._about, button)

        # A cursor for the button.
        cursor = wx.StockCursor(wx.CURSOR_QUESTION_ARROW)
        button.SetCursor(cursor)

        # Pack the button.
        button_sizer.Add(button, 0, 0, 0)
        left_box.Add(button_sizer, 0, wx.ALL, 0)

        # Return the packed box.
        return left_box
Beispiel #49
0
    def add_button_open(
        self,
        box,
        parent,
        icon=fetch_icon("oxygen.actions.document-open", "16x16"),
        text=" Change",
        fn=None,
        width=-1,
        height=-1,
    ):
        """Add a button for opening and changing files and directories.

        @param box:         The box element to pack the control into.
        @type box:          wx.BoxSizer instance
        @param parent:      The parent GUI element.
        @type parent:       wx object
        @keyword icon:      The path of the icon to use for the button.
        @type icon:         str
        @keyword text:      The text to display on the button.
        @type text:         str
        @keyword fn:        The function or method to execute when clicking on the button.
        @type fn:           func
        @keyword width:     The minimum width of the control.
        @type width:        int
        @keyword height:    The minimum height of the control.
        @type height:       int
        @return:            The button.
        @rtype:             wx.lib.buttons.ThemedGenBitmapTextButton instance
        """

        # The button.
        button = buttons.ThemedGenBitmapTextButton(parent, -1, None, str_to_gui(text))
        button.SetBitmapLabel(wx.Bitmap(icon, wx.BITMAP_TYPE_ANY))

        # The font and button properties.
        button.SetMinSize((width, height))
        button.SetFont(font.normal)

        # Bind the click.
        self.gui.Bind(wx.EVT_BUTTON, fn, button)

        # Add the button to the box.
        box.Add(button, 0, wx.ALIGN_CENTER_VERTICAL | wx.ADJUST_MINSIZE, 0)

        # Return the button.
        return button
Beispiel #50
0
    def add_button_open(self,
                        box,
                        parent,
                        icon=fetch_icon('oxygen.actions.document-open',
                                        "16x16"),
                        text=" Change",
                        fn=None,
                        width=-1,
                        height=-1):
        """Add a button for opening and changing files and directories.

        @param box:         The box element to pack the control into.
        @type box:          wx.BoxSizer instance
        @param parent:      The parent GUI element.
        @type parent:       wx object
        @keyword icon:      The path of the icon to use for the button.
        @type icon:         str
        @keyword text:      The text to display on the button.
        @type text:         str
        @keyword fn:        The function or method to execute when clicking on the button.
        @type fn:           func
        @keyword width:     The minimum width of the control.
        @type width:        int
        @keyword height:    The minimum height of the control.
        @type height:       int
        @return:            The button.
        @rtype:             wx.lib.buttons.ThemedGenBitmapTextButton instance
        """

        # The button.
        button = buttons.ThemedGenBitmapTextButton(parent, -1, None,
                                                   str_to_gui(text))
        button.SetBitmapLabel(wx.Bitmap(icon, wx.BITMAP_TYPE_ANY))

        # The font and button properties.
        button.SetMinSize((width, height))
        button.SetFont(font.normal)

        # Bind the click.
        self.gui.Bind(wx.EVT_BUTTON, fn, button)

        # Add the button to the box.
        box.Add(button, 0, wx.ALIGN_CENTER_VERTICAL | wx.ADJUST_MINSIZE, 0)

        # Return the button.
        return button
Beispiel #51
0
    def add_buttons(self, sizer):
        """Add the buttons for peak list manipulation.

        @param sizer:   The sizer element to pack the buttons into.
        @type sizer:    wx.BoxSizer instance
        """

        # Button Sizer
        button_sizer = wx.BoxSizer(wx.VERTICAL)

        # Add peaklist button
        add_pkl = wx.BitmapButton(self.parent, -1, bitmap=wx.Bitmap(fetch_icon('oxygen.actions.list-add-relax-blue', "16x16"), wx.BITMAP_TYPE_ANY))
        add_pkl.SetMinSize((50, 50))
        self.gui.Bind(wx.EVT_BUTTON, self.load_peaklist, add_pkl)
        button_sizer.Add(add_pkl, 0, wx.ADJUST_MINSIZE, 0)

        # Add VD list import
        if self.label =='R1':
            add_vd = wx.Button(self.parent, -1, "+VD")
            add_vd.SetToolTipString("Add VD (variable delay) list to automatically fill in R1 relaxation times.")
            add_vd.SetMinSize((50, 50))
            self.gui.Bind(wx.EVT_BUTTON, self.load_delay, add_vd)
            button_sizer.Add(add_vd, 0, wx.ADJUST_MINSIZE, 0)

        # Add Vc list import
        if self.label =='R2':
            add_vc = wx.Button(self.parent, -1, "+VC")
            add_vc.SetToolTipString("Add VC (variable counter) list to automatically fill in R2 relaxation times.")
            add_vc.SetMinSize((50, 50))
            button_sizer.Add(add_vc, 0, wx.ADJUST_MINSIZE, 0)

            # Time of counter
            self.vc_time = wx.TextCtrl(self.parent, -1, "0")
            self.vc_time.SetToolTipString("Time of counter loop in seconds.")
            self.vc_time.SetMinSize((50, 20))
            self.vc_time.SetFont(wx.Font(7, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
            button_sizer.Add(self.vc_time, 0, 0, 0)

            # Action of Button
            self.gui.Bind(wx.EVT_BUTTON, lambda event, vc=True: self.load_delay(event, vc), add_vc)

        # Pack buttons
        sizer.Add(button_sizer, 0, 0, 0)
Beispiel #52
0
    def setup(self):
        """Override the base variables."""

        # GUI variables.
        self.title = "Citations"
        self.observer_base_name = "citations"
        self.button_placement = "bottom"

        # The column titles.
        self.columns = ["Citation ID"]

        # Button set up.
        self.button_info = [
            {
                "object": "button_add",
                "label": " Add",
                "icon": fetch_icon("oxygen.actions.list-add-relax-blue", "22x22"),
                "method": self.action_bmrb_citation,
                "tooltip": "Specify a citation to be added the BMRB data file.",
            }
        ]
Beispiel #53
0
    def setup(self):
        """Override the base variables."""

        # GUI variables.
        self.title = "Scripts"
        self.observer_base_name = "scripts"
        self.button_placement = 'bottom'

        # The column titles.
        self.columns = [
            "Script name"
        ]

        # Button set up.
        self.button_info = [
            {
                'object': 'button_add',
                'label': ' Add',
                'icon': fetch_icon('oxygen.actions.list-add-relax-blue', "22x22"),
                'method': self.action_bmrb_script,
                'tooltip': "Specify any scripts used for the analysis."
            }
        ]
Beispiel #54
0
    def setup(self):
        """Override the base variables."""

        # GUI variables.
        self.title = "Scripts"
        self.observer_base_name = "scripts"
        self.button_placement = 'bottom'

        # The column titles.
        self.columns = [
            "Script name"
        ]

        # Button set up.
        self.button_info = [
            {
                'object': 'button_add',
                'label': ' Add',
                'icon': fetch_icon('oxygen.actions.list-add-relax-blue', "22x22"),
                'method': self.action_bmrb_script,
                'tooltip': "Specify any scripts used for the analysis."
            }
        ]
Beispiel #55
0
    def setup(self):
        """Override the base variables."""

        # GUI variables.
        self.title = "Citations"
        self.observer_base_name = "citations"
        self.button_placement = 'bottom'

        # The column titles.
        self.columns = [
            "Citation ID"
        ]

        # Button set up.
        self.button_info = [
            {
                'object': 'button_add',
                'label': ' Add',
                'icon': fetch_icon('oxygen.actions.list-add-relax-blue', "22x22"),
                'method': self.action_bmrb_citation,
                'tooltip': "Specify a citation to be added the BMRB data file."
            }
        ]
Beispiel #56
0
    def build_toolbar(self):
        """Create the toolbar."""

        # Init.
        self.toolbar = self.CreateToolBar(wx.TB_HORIZONTAL|wx.TB_FLAT)

        # The new analysis button.
        self.TB_FILE_NEW = wx.NewId()
        self.toolbar.AddLabelTool(self.TB_FILE_NEW, "New analysis", wx.Bitmap(fetch_icon('oxygen.actions.document-new', "22x22"), wx.BITMAP_TYPE_ANY), shortHelp="New analysis")
        self.Bind(wx.EVT_TOOL, self.analysis.menu_new, id=self.TB_FILE_NEW)

        # The close analysis button.
        self.TB_FILE_CLOSE = wx.NewId()
        self.toolbar.AddLabelTool(self.TB_FILE_CLOSE, "Close analysis", wx.Bitmap(fetch_icon('oxygen.actions.document-close', "22x22"), wx.BITMAP_TYPE_ANY), shortHelp="Close analysis")
        self.Bind(wx.EVT_TOOL, self.analysis.menu_close, id=self.TB_FILE_CLOSE)

        # The close all analyses button.
        self.TB_FILE_CLOSE_ALL = wx.NewId()
        self.toolbar.AddLabelTool(self.TB_FILE_CLOSE_ALL, "Close all analyses", wx.Bitmap(fetch_icon('oxygen.actions.dialog-close', "22x22"), wx.BITMAP_TYPE_ANY), shortHelp="Close all analyses")
        self.Bind(wx.EVT_TOOL, self.analysis.menu_close_all, id=self.TB_FILE_CLOSE_ALL)

        # A separator.
        self.toolbar.AddSeparator()

        # The open state button.
        self.TB_FILE_OPEN = wx.NewId()
        self.toolbar.AddLabelTool(self.TB_FILE_OPEN, "Open relax state", wx.Bitmap(fetch_icon('oxygen.actions.document-open', "22x22"), wx.BITMAP_TYPE_ANY), shortHelp="Open relax state")
        self.Bind(wx.EVT_TOOL, self.state_load, id=self.TB_FILE_OPEN)

        # The save state button.
        self.TB_FILE_SAVE = wx.NewId()
        self.toolbar.AddLabelTool(self.TB_FILE_SAVE, "Save relax state", wx.Bitmap(fetch_icon('oxygen.actions.document-save', "22x22"), wx.BITMAP_TYPE_ANY), shortHelp="Save relax state")
        self.Bind(wx.EVT_TOOL, self.action_state_save, id=self.TB_FILE_SAVE)

        # The save as button.
        self.TB_FILE_SAVE_AS = wx.NewId()
        self.toolbar.AddLabelTool(self.TB_FILE_SAVE_AS, "Save as", wx.Bitmap(fetch_icon('oxygen.actions.document-save-as', "22x22"), wx.BITMAP_TYPE_ANY), shortHelp="Save as")
        self.Bind(wx.EVT_TOOL, self.action_state_save_as, id=self.TB_FILE_SAVE_AS)

        # A separator.
        self.toolbar.AddSeparator()

        # The relax controller button.
        self.TB_VIEW_CONTROLLER = wx.NewId()
        self.toolbar.AddLabelTool(self.TB_VIEW_CONTROLLER, "Controller", wx.Bitmap(fetch_icon('oxygen.apps.preferences-system-performance', "22x22"), wx.BITMAP_TYPE_ANY), shortHelp="relax controller")
        self.Bind(wx.EVT_TOOL, self.show_controller, id=self.TB_VIEW_CONTROLLER)

        # The spin viewer button.
        self.TB_VIEW_SPIN_VIEW = wx.NewId()
        self.toolbar.AddLabelTool(self.TB_VIEW_SPIN_VIEW, "Spin viewer", wx.Bitmap(fetch_icon('relax.spin', "22x22"), wx.BITMAP_TYPE_ANY), shortHelp="Spin viewer window")
        self.Bind(wx.EVT_TOOL, self.show_tree, id=self.TB_VIEW_SPIN_VIEW)

        # The results viewer button.
        self.TB_VIEW_RESULTS = wx.NewId()
        self.toolbar.AddLabelTool(self.TB_VIEW_RESULTS, "Results viewer", wx.Bitmap(fetch_icon('oxygen.actions.view-statistics', "22x22"), wx.BITMAP_TYPE_ANY), shortHelp="Results viewer window")
        self.Bind(wx.EVT_TOOL, self.show_results_viewer, id=self.TB_VIEW_RESULTS)

        # The data pipe editor button.
        self.TB_VIEW_PIPE_EDIT = wx.NewId()
        self.toolbar.AddLabelTool(self.TB_VIEW_PIPE_EDIT, "Data pipe editor", wx.Bitmap(fetch_icon('relax.pipe', "22x22"), wx.BITMAP_TYPE_ANY), shortHelp="Data pipe editor")
        self.Bind(wx.EVT_TOOL, self.show_pipe_editor, id=self.TB_VIEW_PIPE_EDIT)

        # The relax prompt button.
        self.TB_VIEW_PROMPT = wx.NewId()
        self.toolbar.AddLabelTool(self.TB_VIEW_PROMPT, "relax prompt", wx.Bitmap(fetch_icon('oxygen.mimetypes.application-x-executable-script', "22x22"), wx.BITMAP_TYPE_ANY), shortHelp="The relax prompt GUI window")
        self.Bind(wx.EVT_TOOL, self.show_prompt, id=self.TB_VIEW_PROMPT)

        # Build the toolbar.
        self.toolbar.Realize()
Beispiel #57
0
    def __init__(self, gui):
        """Build the menu bar."""

        # Store the args.
        self.gui = gui

        # Create the menu bar GUI item.
        self.menubar = wx.MenuBar()

        # The 'File' menu entries.
        menu = wx.Menu()
        menu.AppendItem(build_menu_item(menu, id=MENU_FILE_NEW, text="&New analysis\tCtrl+N", icon=fetch_icon('oxygen.actions.document-new', "16x16")))
        menu.AppendItem(build_menu_item(menu, id=MENU_FILE_CLOSE, text="&Close analysis", icon=fetch_icon('oxygen.actions.document-close', "16x16")))
        menu.AppendItem(build_menu_item(menu, id=MENU_FILE_CLOSE_ALL, text="&Close all analyses", icon=fetch_icon('oxygen.actions.dialog-close', "16x16")))
        menu.AppendSeparator()
        menu.AppendItem(build_menu_item(menu, id=MENU_FILE_OPEN, text="&Open relax state\tCtrl+O", icon=fetch_icon('oxygen.actions.document-open', "16x16")))
        menu.AppendItem(build_menu_item(menu, id=MENU_FILE_SAVE, text="S&ave relax state\tCtrl+S", icon=fetch_icon('oxygen.actions.document-save', "16x16")))
        menu.AppendItem(build_menu_item(menu, id=MENU_FILE_SAVE_AS, text="Save as...\tCtrl+Shift+S", icon=fetch_icon('oxygen.actions.document-save-as', "16x16")))
        menu.AppendSeparator()
        menu.AppendItem(build_menu_item(menu, id=MENU_FILE_EXPORT_BMRB, text="Export for BMRB deposition", icon=fetch_icon('relax.bmrb')))
        menu.AppendSeparator()
        menu.AppendItem(build_menu_item(menu, id=MENU_FILE_EXIT, text="E&xit\tCtrl+Q", icon=fetch_icon('oxygen.actions.system-shutdown', "16x16")))
        self.menubar.Append(menu, "&File")

        # The 'File' menu actions.
        self.gui.Bind(wx.EVT_MENU, self.gui.analysis.menu_new, id=MENU_FILE_NEW)
        self.gui.Bind(wx.EVT_MENU, self.gui.analysis.menu_close, id=MENU_FILE_CLOSE)
        self.gui.Bind(wx.EVT_MENU, self.gui.analysis.menu_close_all, id=MENU_FILE_CLOSE_ALL)
        self.gui.Bind(wx.EVT_MENU, self.gui.state_load, id=MENU_FILE_OPEN)
        self.gui.Bind(wx.EVT_MENU, self.gui.action_state_save, id=MENU_FILE_SAVE)
        self.gui.Bind(wx.EVT_MENU, self.gui.action_state_save_as, id=MENU_FILE_SAVE_AS)
        self.gui.Bind(wx.EVT_MENU, self.gui.action_export_bmrb, id=MENU_FILE_EXPORT_BMRB)
        self.gui.Bind(wx.EVT_MENU, self.gui.exit_gui, id=MENU_FILE_EXIT)

        # The 'View' menu entries.
        menu = wx.Menu()
        menu.AppendItem(build_menu_item(menu, id=MENU_VIEW_CONTROLLER, text="&Controller\tCtrl+Z", icon=fetch_icon('oxygen.apps.preferences-system-performance', "16x16")))
        menu.AppendItem(build_menu_item(menu, id=MENU_VIEW_SPIN_VIEW, text="&Spin viewer\tCtrl+T", icon=fetch_icon('relax.spin', "16x16")))
        menu.AppendItem(build_menu_item(menu, id=MENU_VIEW_RESULTS, text="&Results viewer\tCtrl+R", icon=fetch_icon('oxygen.actions.view-statistics', "16x16")))
        menu.AppendItem(build_menu_item(menu, id=MENU_VIEW_PIPE_EDIT, text="&Data pipe editor\tCtrl+D", icon=fetch_icon('relax.pipe', "16x16")))
        menu.AppendItem(build_menu_item(menu, id=MENU_VIEW_PROMPT, text="relax &prompt\tCtrl+P", icon=fetch_icon('oxygen.mimetypes.application-x-executable-script', "16x16")))
        self.menubar.Append(menu, "&View")

        # The 'View' actions.
        self.gui.Bind(wx.EVT_MENU, self.gui.show_controller, id=MENU_VIEW_CONTROLLER)
        self.gui.Bind(wx.EVT_MENU, self.gui.show_prompt, id=MENU_VIEW_PROMPT)
        self.gui.Bind(wx.EVT_MENU, self.gui.show_tree, id=MENU_VIEW_SPIN_VIEW)
        self.gui.Bind(wx.EVT_MENU, self.gui.show_results_viewer, id=MENU_VIEW_RESULTS)
        self.gui.Bind(wx.EVT_MENU, self.gui.show_pipe_editor, id=MENU_VIEW_PIPE_EDIT)

        # The auto generated 'User functions' menu entries.
        self.menu_uf_ids = build_uf_menus(parent=self.gui, menubar=self.menubar)

        # The 'Tools' menu entries.
        menu = wx.Menu()
        menu.AppendItem(build_menu_item(menu, id=MENU_TOOLS_FORMAT, text="&Free file format settings", icon=fetch_icon('oxygen.actions.document-properties', "16x16")))
        menu.AppendItem(build_menu_item(menu, id=MENU_TOOLS_SYS_INFO, text="System &information", icon=fetch_icon('oxygen.actions.help-about', "16x16")))

        # The 'Tools->Test suite" sub-menu.
        test_suite_item = build_menu_item(menu, id=MENU_TOOLS_TEST_SUITE, text="&Test suite", icon=fetch_icon('oxygen.mimetypes.application-x-desktop', "16x16"))
        sub_menu = wx.Menu()
        test_suite_item.SetSubMenu(sub_menu)
        sub_menu.AppendItem(build_menu_item(sub_menu, id=MENU_TOOLS_TEST_SUITE_ALL, text="&Full test suite", icon=fetch_icon('oxygen.mimetypes.application-x-desktop', "16x16")))
        sub_menu.AppendSeparator()
        sub_menu.AppendItem(build_menu_item(sub_menu, id=MENU_TOOLS_TEST_SUITE_SYS, text="&System tests", icon=fetch_icon('oxygen.mimetypes.application-x-desktop', "16x16")))
        sub_menu.AppendItem(build_menu_item(sub_menu, id=MENU_TOOLS_TEST_SUITE_UNIT, text="&Unit tests", icon=fetch_icon('oxygen.mimetypes.application-x-desktop', "16x16")))
        sub_menu.AppendItem(build_menu_item(sub_menu, id=MENU_TOOLS_TEST_SUITE_GUI, text="&GUI tests", icon=fetch_icon('oxygen.mimetypes.application-x-desktop', "16x16")))
        sub_menu.AppendItem(build_menu_item(sub_menu, id=MENU_TOOLS_TEST_SUITE_VERIFICATION, text="&Verification tests", icon=fetch_icon('oxygen.mimetypes.application-x-desktop', "16x16")))
        menu.AppendItem(test_suite_item)
        self.menubar.Append(menu, "&Tools")

        # The 'Tools' menu actions.
        self.gui.Bind(wx.EVT_MENU, self.gui.free_file_format_settings, id=MENU_TOOLS_FORMAT)
        self.gui.Bind(wx.EVT_MENU, self._sys_info, id=MENU_TOOLS_SYS_INFO)
        self.gui.Bind(wx.EVT_MENU, self.gui.run_test_suite, id=MENU_TOOLS_TEST_SUITE_ALL)
        self.gui.Bind(wx.EVT_MENU, self.gui.run_test_suite_sys, id=MENU_TOOLS_TEST_SUITE_SYS)
        self.gui.Bind(wx.EVT_MENU, self.gui.run_test_suite_unit, id=MENU_TOOLS_TEST_SUITE_UNIT)
        self.gui.Bind(wx.EVT_MENU, self.gui.run_test_suite_gui, id=MENU_TOOLS_TEST_SUITE_GUI)
        self.gui.Bind(wx.EVT_MENU, self.gui.run_test_suite_verification, id=MENU_TOOLS_TEST_SUITE_VERIFICATION)

        # The 'Help' menu entries.
        menu = wx.Menu()
        menu.AppendItem(build_menu_item(menu, id=MENU_HELP_MANUAL, text="relax user &manual\tF1", icon=fetch_icon('oxygen.mimetypes.application-pdf', "16x16")))
        menu.AppendSeparator()
        menu.AppendItem(build_menu_item(menu, id=MENU_HELP_MAIL, text="Mailing list &contact ([email protected])", icon=fetch_icon('oxygen.actions.mail-mark-unread-new', "16x16")))
        menu.AppendItem(build_menu_item(menu, id=MENU_HELP_REFS, text="&References", icon=fetch_icon('oxygen.actions.flag-blue', "16x16")))
        menu.AppendSeparator()
        menu.AppendItem(build_menu_item(menu, id=MENU_HELP_GPL, text="&Licence", icon=fetch_icon('relax.gnu-head-mini', "16x16")))
        menu.AppendSeparator()
        menu.AppendItem(build_menu_item(menu, id=MENU_HELP_ABOUT, text="About rela&x", icon=fetch_icon("relax.relax")))
        self.menubar.Append(menu, "&Help")

        # The 'Help' menu actions.
        self.gui.Bind(wx.EVT_MENU, self.gui.relax_manual, id=MENU_HELP_MANUAL)
        self.gui.Bind(wx.EVT_MENU, self.gui.contact_relax, id=MENU_HELP_MAIL)
        self.gui.Bind(wx.EVT_MENU, self.gui.references, id=MENU_HELP_REFS)
        self.gui.Bind(wx.EVT_MENU, self._licence, id=MENU_HELP_GPL)
        self.gui.Bind(wx.EVT_MENU, self.gui.about_relax, id=MENU_HELP_ABOUT)

        # Add the menu bar GUI item to the main frame.
        if status.show_gui:
            self.gui.SetMenuBar(self.menubar)

        # Menu update.
        self.gui.Bind(wx.EVT_MENU_OPEN, self.update_menus)
Beispiel #58
0
    def menu(self, event):
        """The pop up menu.

        @param event:   The wx event.
        @type event:    wx event
        """

        # Get the row.
        row = event.GetRow()

        # Get the name of the data pipe.
        self.selected_pipe = gui_to_str(self.grid.GetCellValue(row, 0))

        # No data pipe.
        if not self.selected_pipe:
            return

        # The pipe type and bundle.
        pipe_type = get_type(self.selected_pipe)
        pipe_bundle = get_bundle(self.selected_pipe)

        # Initialise the menu.
        popup_menus = []

        # Menu entry:  add the data pipe to a bundle.
        if not pipe_bundle:
            popup_menus.append({
                'id': MENU_BUNDLE,
                'text': "&Add the pipe to a bundle",
                'icon': fetch_icon("relax.pipe_bundle"),
                'method': self.pipe_bundle
            })

        # Menu entry:  delete the data pipe.
        popup_menus.append({
            'id': MENU_DELETE,
            'text': "&Delete the pipe",
            'icon': fetch_icon('oxygen.actions.list-remove', "16x16"),
            'method': self.pipe_delete
        })

        # Menu entry:  switch to this data pipe.
        popup_menus.append({
            'id': MENU_SWITCH,
            'text': "&Switch to this pipe",
            'icon': fetch_icon('oxygen.actions.system-switch-user', "16x16"),
            'method': self.pipe_switch
        })

        # Menu entry:  new auto-analysis tab.
        if pipe_bundle and self.gui.analysis.page_index_from_bundle(pipe_bundle) == None and pipe_type in ['noe', 'r1', 'r2', 'mf', 'relax_disp']:
            popup_menus.append({
                'id': MENU_NEW_AUTO_ANALYSIS,
                'text': "&Associate with a new auto-analysis",
                'icon': fetch_icon('oxygen.actions.document-new', "16x16"),
                'method': self.associate_auto
            })

        # Execution lock, so do nothing.
        if status.exec_lock.locked():
            return

        # Initialise the menu.
        menu = wx.Menu()

        # Loop over the menu items.
        for i in range(len(popup_menus)):
            # Alias.
            info = popup_menus[i]

            # Add the menu item.
            menu.AppendItem(build_menu_item(menu, id=info['id'], text=info['text'], icon=info['icon']))

            # Bind clicks.
            self.Bind(wx.EVT_MENU, info['method'], id=info['id'])

        # Pop up the menu.
        if status.show_gui:
            self.PopupMenu(menu)

        # Cleanup.
        menu.Destroy()
Beispiel #59
0
    def menu(self, event):
        """The pop up menu.

        @param event:   The wx event.
        @type event:    wx event
        """

        # Get the row.
        row = event.GetRow()

        # Get the name of the data pipe.
        self.selected_pipe = gui_to_str(self.grid.GetCellValue(row, 0))

        # No data pipe.
        if not self.selected_pipe:
            return

        # The pipe type and bundle.
        pipe_type = get_type(self.selected_pipe)
        pipe_bundle = get_bundle(self.selected_pipe)

        # Initialise the menu.
        menu = wx.Menu()
        items = []

        # Menu entry:  add the data pipe to a bundle.
        if not pipe_bundle:
            items.append(build_menu_item(menu, parent=self, text="&Add the pipe to a bundle", icon=fetch_icon("relax.pipe_bundle"), fn=self.pipe_bundle))

        # Menu entry:  delete the data pipe.
        items.append(build_menu_item(menu, parent=self, text="&Delete the pipe", icon=fetch_icon('oxygen.actions.list-remove', "16x16"), fn=self.pipe_delete))
 
        # Menu entry:  switch to this data pipe.
        items.append(build_menu_item(menu, parent=self, text="&Switch to this pipe", icon=fetch_icon('oxygen.actions.system-switch-user', "16x16"), fn=self.pipe_switch))
 
        # Menu entry:  new auto-analysis tab.
        if pipe_bundle and self.gui.analysis.page_index_from_bundle(pipe_bundle) == None and pipe_type in ['noe', 'r1', 'r2', 'mf', 'relax_disp']:
            items.append(build_menu_item(menu, parent=self, text="&Associate with a new auto-analysis", icon=fetch_icon('oxygen.actions.document-new', "16x16"), fn=self.associate_auto))
 
        # Set up the entries.
        for item in items:
            menu.AppendItem(item)
            if status.exec_lock.locked():
                item.Enable(False)

        # Show the menu.
        if status.show_gui:
            self.PopupMenu(menu)

        # Kill the menu once done.
        menu.Destroy()
Beispiel #60
0
class Wiz_window(wx.Dialog):
    """The wizard."""

    # Some class variables.
    _size_button = (100, 33)
    ICON_APPLY = fetch_icon('oxygen.actions.dialog-ok-apply', "22x22")
    ICON_BACK = fetch_icon('oxygen.actions.go-previous-view', "22x22")
    ICON_CANCEL = fetch_icon('oxygen.actions.dialog-cancel', "22x22")
    ICON_FINISH = fetch_icon('oxygen.actions.dialog-ok', "22x22")
    ICON_NEXT = fetch_icon('oxygen.actions.go-next-view', "22x22")
    ICON_OK = fetch_icon('oxygen.actions.dialog-ok', "22x22")
    ICON_SKIP = fetch_icon('oxygen.actions.arrow-right-double-relax-blue',
                           "22x22")
    TEXT_APPLY = " Apply"
    TEXT_BACK = " Back"
    TEXT_CANCEL = " Cancel"
    TEXT_FINISH = " Finish"
    TEXT_NEXT = " Next"
    TEXT_OK = " OK"
    TEXT_SKIP = " Skip"

    def __init__(self,
                 parent=None,
                 size_x=400,
                 size_y=400,
                 title='',
                 border=10,
                 style=wx.DEFAULT_DIALOG_STYLE):
        """Set up the window.

        @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 border:    The size of the border inside the wizard.
        @type border:       int
        @keyword style:     The dialog style.
        @type style:        wx style
        """

        # Store the args.
        self._size_x = size_x
        self._size_y = size_y
        self._border = border
        self.title = title

        # Execute the base class method.
        wx.Dialog.__init__(self, parent, id=-1, title=title, style=style)

        # Set up the window icon.
        self.SetIcons(Relax_icons())

        # The sizer for the dialog.
        sizer = wx.BoxSizer(wx.VERTICAL)
        self.SetSizer(sizer)

        # Build the central sizer, with borders.
        self._main_sizer = add_border(sizer,
                                      border=border,
                                      packing=wx.VERTICAL)

        # Set the default size of the dialog.
        self.SetSize((size_x, size_y))

        # Centre the dialog.
        self.Centre()

        # Initialise the page storage.
        self._current_page = 0
        self._num_pages = 0
        self._pages = []
        self._page_sizers = []
        self._button_sizers = []
        self._top_sizers = []
        self._button_apply_flag = []
        self._button_skip_flag = []
        self._buttons = []
        self._button_ids = []
        self._exec_on_next = []
        self._exec_count = []
        self._proceed_on_error = []
        self._uf_flush = []
        self._seq_fn_list = []
        self._seq_next = []
        self._seq_prev = []
        self._skip_flag = []

        # Flag to suppress later button addition.
        self._buttons_built = False

        # Bind some events.
        self.Bind(wx.EVT_CLOSE, self._handler_close)

        # ESC to exit, via an accelerator table which creates menu events.
        self.acc_list = [(wx.ACCEL_NORMAL, wx.WXK_ESCAPE, ESC_ID)]
        self.acc_table = wx.AcceleratorTable(self.acc_list)
        self.SetAcceleratorTable(self.acc_table)
        self.Bind(wx.EVT_MENU, self._handler_escape, id=ESC_ID)

    def _apply(self, event=None):
        """Execute the current page's 'Apply' method.

        @keyword event: The wx event.
        @type event:    wx event
        """

        # Execute the current page's apply() method.
        self._pages[self._current_page]._apply()

    def _build_buttons(self):
        """Construct the buttons for all pages of the wizard."""

        # Single page or a wizard?
        single_page = True
        if self._num_pages > 1:
            single_page = False

        # Loop over each page.
        for i in range(self._num_pages):
            # The back button (only for multi-pages, after the first).
            if not single_page and i > 0:
                # Create the button.
                button = buttons.ThemedGenBitmapTextButton(
                    self, -1, None, self.TEXT_BACK)
                button.SetBitmapLabel(
                    wx.Bitmap(self.ICON_BACK, wx.BITMAP_TYPE_ANY))
                button.SetFont(font.normal)
                button.SetToolTip(wx.ToolTip("Return to the previous page."))
                button.SetMinSize(self._size_button)
                self._button_sizers[i].Add(button, 0, wx.ADJUST_MINSIZE, 0)
                self.Bind(wx.EVT_BUTTON, self._go_back, button)
                self._buttons[i]['back'] = button

                # Spacer.
                self._button_sizers[i].AddSpacer(5)

            # The apply button.
            if self._button_apply_flag[i]:
                # Create the button.
                button = buttons.ThemedGenBitmapTextButton(
                    self, -1, None, self.TEXT_APPLY)
                button.SetBitmapLabel(
                    wx.Bitmap(self.ICON_APPLY, wx.BITMAP_TYPE_ANY))
                button.SetFont(font.normal)
                if single_page:
                    button.SetToolTip(
                        wx.ToolTip(
                            "Apply the operation and leave the window open."))
                else:
                    button.SetToolTip(
                        wx.ToolTip(
                            "Apply the operation and stay on the current page."
                        ))
                button.SetMinSize(self._size_button)
                self._button_sizers[i].Add(button, 0, wx.ADJUST_MINSIZE, 0)
                self.Bind(wx.EVT_BUTTON, self._pages[i]._apply, button)
                self._buttons[i]['apply'] = button

                # Spacer.
                self._button_sizers[i].AddSpacer(5)

            # The skip button.
            if self._button_skip_flag[i]:
                # Create the button.
                button = buttons.ThemedGenBitmapTextButton(
                    self, -1, None, self.TEXT_SKIP)
                button.SetBitmapLabel(
                    wx.Bitmap(self.ICON_SKIP, wx.BITMAP_TYPE_ANY))
                button.SetFont(font.normal)
                button.SetToolTip(
                    wx.ToolTip(
                        "Skip the operation and move to the next page."))
                button.SetMinSize(self._size_button)
                self._button_sizers[i].Add(button, 0, wx.ADJUST_MINSIZE, 0)
                self.Bind(wx.EVT_BUTTON, self._skip, button)
                self._buttons[i]['skip'] = button

                # Spacer.
                self._button_sizers[i].AddSpacer(5)

            # The next button (only for multi-pages, excluding the last).
            if not single_page and i < self._num_pages - 1:
                # Create the button.
                button = buttons.ThemedGenBitmapTextButton(
                    self, -1, None, self.TEXT_NEXT)
                button.SetBitmapLabel(
                    wx.Bitmap(self.ICON_NEXT, wx.BITMAP_TYPE_ANY))
                button.SetFont(font.normal)
                button.SetToolTip(
                    wx.ToolTip(
                        "Apply the operation and move to the next page."))
                button.SetMinSize(self._size_button)
                self._button_sizers[i].Add(button, 0, wx.ADJUST_MINSIZE, 0)
                self.Bind(wx.EVT_BUTTON, self._go_next, button)
                self._buttons[i]['next'] = button

            # The OK button (only for single pages).
            if single_page:
                button = buttons.ThemedGenBitmapTextButton(
                    self, -1, None, self.TEXT_OK)
                button.SetBitmapLabel(
                    wx.Bitmap(self.ICON_OK, wx.BITMAP_TYPE_ANY))
                button.SetFont(font.normal)
                button.SetToolTip(
                    wx.ToolTip("Apply the operation and close the window."))
                button.SetMinSize(self._size_button)
                self._button_sizers[i].Add(button, 0, wx.ADJUST_MINSIZE, 0)
                self.Bind(wx.EVT_BUTTON, self._ok, button)
                self._buttons[i]['ok'] = button

            # The finish button (only for the last page with multi-pages).
            if not single_page and i == self._num_pages - 1:
                button = buttons.ThemedGenBitmapTextButton(
                    self, -1, None, self.TEXT_FINISH)
                button.SetBitmapLabel(
                    wx.Bitmap(self.ICON_FINISH, wx.BITMAP_TYPE_ANY))
                button.SetFont(font.normal)
                button.SetToolTip(
                    wx.ToolTip("Apply the operation and close the wizard."))
                button.SetMinSize(self._size_button)
                self._button_sizers[i].Add(button, 0, wx.ADJUST_MINSIZE, 0)
                self.Bind(wx.EVT_BUTTON, self._ok, button)
                self._buttons[i]['finish'] = button

            # Spacer.
            self._button_sizers[i].AddSpacer(15)

            # The cancel button.
            button = buttons.ThemedGenBitmapTextButton(self, -1, None,
                                                       self.TEXT_CANCEL)
            button.SetBitmapLabel(
                wx.Bitmap(self.ICON_CANCEL, wx.BITMAP_TYPE_ANY))
            button.SetFont(font.normal)
            if single_page:
                button.SetToolTip(
                    wx.ToolTip("Abort the operation and close the window."))
            else:
                button.SetToolTip(
                    wx.ToolTip("Abort the operation and close the wizard."))
            button.SetMinSize(self._size_button)
            self._button_sizers[i].Add(button, 0, wx.ADJUST_MINSIZE, 0)
            self.Bind(wx.EVT_BUTTON, self._cancel, button)
            self._buttons[i]['cancel'] = button

        # Flag to suppress later button addition.
        self._buttons_built = True

    def _cancel(self, event=None):
        """Cancel the operation.

        @keyword event: The wx event.
        @type event:    wx event
        """

        # Execute the page's on_next() method to allow the page to clean itself up.
        self._pages[self._current_page].on_next()

        # Close the window.
        self.Close()

    def _display_page(self, i):
        """Display the given page.

        @param i:   The index of the page to display.
        @type i:    int
        """

        # Hide all of the original contents.
        for j in range(self._num_pages):
            if self._main_sizer.IsShown(self._page_sizers[j]):
                self._main_sizer.Hide(self._page_sizers[j])

        # Show the desired page.
        if status.show_gui:
            self._main_sizer.Show(self._page_sizers[i])

        # Execute the page's on_display() method.
        self._pages[i].on_display()
        self._pages[i].on_display_post()

        # Re-perform the window layout.
        self.Layout()
        self.Refresh()

        # Execute the page's on_init() method.
        self._pages[i].on_init()

        # Set the focus to this page to allow the keyboard to be functional without a mouse click.
        self._pages[i].SetFocus()

    def _go_back(self, event=None):
        """Return to the previous page.

        @keyword event: The wx event.
        @type event:    wx event
        """

        # Execute the page's on_next() method.
        self._pages[self._current_page].on_back()

        # Work back in the sequence.
        self._current_page = self._seq_prev[self._current_page]

        # Display the previous page.
        self._display_page(self._current_page)

    def _go_next(self, event=None):
        """Move to the next page.

        @keyword event: The wx event.
        @type event:    wx event
        """

        # Execute the page's on_next() method.
        self._pages[self._current_page].on_next()

        # Operations for non-skipped pages.
        if not self._skip_flag[self._current_page]:
            # Execute the page's on_execute() method (via the _apply() method).
            if self._exec_on_next[self._current_page]:
                self._pages[self._current_page]._apply(event)

                # UF flush.
                if self._uf_flush[self._current_page]:
                    interpreter.flush()

                # Check for execution errors.
                if not self._pages[self._current_page].exec_status:
                    # Do not proceed.
                    if not self._proceed_on_error[self._current_page]:
                        return

                # Increment the execution counter.
                self._exec_count[self._current_page] += 1

        # Determine the next page.
        next_page = self._seq_fn_list[self._current_page]()

        # No next page, so terminate.
        if next_page >= len(self._pages):
            self._ok(None)
            return

        # Update the sequence lists.
        self._seq_next[self._current_page] = next_page
        self._seq_prev[next_page] = self._current_page

        # Change the current page.
        self._current_page = next_page

        # Display the next page.
        self._display_page(self._current_page)

    def _handler_close(self, event=None):
        """Event handler for the close window action.

        @keyword event: The wx event.
        @type event:    wx event
        """

        # Execute the page's on_next() method to allow the page to clean itself up.
        self._pages[self._current_page].on_next()

        # Continue with the window closing.
        event.Skip()

    def _handler_escape(self, event=None):
        """Event handler for key strokes.

        @keyword event: The wx event.
        @type event:    wx event
        """

        # Close the window.
        self.Close()

    def _next_fn(self):
        """Standard function for setting the next page to the one directly next in the sequence.

        @return:    The index of the next page, which is the current page index plus one.
        @rtype:     int
        """

        # Return the next page.
        return self._current_page + 1

    def _ok(self, event=None):
        """Accept the operation.

        @keyword event: The wx event.
        @type event:    wx event
        """

        # Loop over the pages in the sequence and execute their _apply() methods, if not already done and not skipped.
        for i in self._seq_loop():
            if not self._exec_count[i] and not self._skip_flag[i]:
                # Execute the _apply method.
                self._pages[i]._apply(event)

                # UF flush.
                if self._uf_flush[i]:
                    interpreter.flush()

                # Check for execution errors.
                if not self._pages[self._current_page].exec_status:
                    # Do not proceed.
                    if not self._proceed_on_error[self._current_page]:
                        return

                # Increment the execution counter.
                self._exec_count[i] += 1

        # Execute the current page's on_next() method to allow the page to clean itself up.
        self._pages[self._current_page].on_next()

        # Then close the dialog.
        if self.IsModal():
            self.EndModal(wx.ID_OK)
        else:
            self.Close()

    def _seq_loop(self):
        """Loop over the sequence in the forwards direction."""

        # Initialise.
        current = 0

        # First yield the initial element (always zero!).
        yield current

        # Loop over the sequence.
        while True:
            # Update.
            next = self._seq_next[current]
            current = next

            # End of the sequence.
            if next == None:
                break

            # Yield the next index.
            yield next

    def _skip(self, event=None):
        """Skip the page.

        @keyword event: The wx event.
        @type event:    wx event
        """

        # Set the skip flag.
        self._skip_flag[self._current_page] = True

        # Go to the next page.
        self._go_next(None)

    def Destroy(self):
        """Override the default wx.Dialog.Destroy() method."""

        # Call the parent method to close the dialog.
        self.Close()

        # Loop over each page, destroying it and all its elements to avoid memory leaks.
        for i in range(len(self._buttons)):
            # Destroy the buttons.
            for name in self._buttons[i]:
                if hasattr(self._buttons[i][name], 'Destroy'):
                    self._buttons[i][name].Destroy()
                    self._buttons[i][name] = None

            # Destroy each page.
            if hasattr(self._pages[i], 'Destroy'):
                self._pages[i].Destroy()
                self._pages[i] = None

        # Call the parent method to destroy the dialog.
        super(Wiz_window, self).DestroyChildren()
        super(Wiz_window, self).Destroy()

    def add_page(self,
                 panel,
                 apply_button=True,
                 skip_button=False,
                 exec_on_next=True,
                 proceed_on_error=True,
                 uf_flush=False):
        """Add a new page to the wizard.

        @param panel:               The page to add to the wizard.
        @type panel:                wx.Panel instance
        @keyword apply_button:      A flag which if true will show the apply button for that page.
        @type apply_button:         bool
        @keyword skip_button:       A flag which if true will show the skip button for that page.
        @type skip_button:          bool
        @keyword exec_on_next:      A flag which if true will run the on_execute() method when clicking on the next button.
        @type exec_on_next:         bool
        @keyword proceed_on_error:  A flag which if True will proceed to the next page (or quit if there are no more pages) despite the occurrence of an error in execution.  If False, the page will remain open (the GUI interpreter thread will be flushed first to synchronise).
        @type proceed_on_error:     bool
        @keyword uf_flush:          A flag which if True will cause the GUI interpreter thread to be flushed to clear out all user function call prior to proceeding.
        @type uf_flush:             bool
        @return:                    The index of the page in the wizard.
        @rtype:                     int
        """

        # Store the page.
        index = self._num_pages
        self._num_pages += 1
        self._pages.append(panel)

        # Initialise all box sizers for the wizard page, and store them.
        self._page_sizers.append(wx.BoxSizer(wx.VERTICAL))
        self._main_sizer.Add(self._page_sizers[index], 1, wx.ALL | wx.EXPAND,
                             0)

        # Add the sizer for the top half.
        self._top_sizers.append(wx.BoxSizer(wx.VERTICAL))
        self._page_sizers[index].Add(self._top_sizers[index], 1,
                                     wx.ALL | wx.EXPAND, 0)

        # Add the page to the top sizer.
        self._top_sizers[index].Add(panel, 1, wx.ALL | wx.EXPAND, 0)

        # Initialise all box sizers for the buttons, and store them.
        self._button_sizers.append(wx.BoxSizer(wx.HORIZONTAL))

        # Add the sizer for the wizard buttons.
        self._page_sizers[index].Add(self._button_sizers[index], 0,
                                     wx.ALIGN_RIGHT | wx.ALL, 0)

        # Store all button flags.
        self._button_apply_flag.append(apply_button)
        self._button_skip_flag.append(skip_button)

        # Initialise the button storage.
        self._buttons.append({
            'back': None,
            'apply': None,
            'next': None,
            'ok': None,
            'finish': None,
            'cancel': None
        })

        # Initialise a set of unique button IDs.
        self._button_ids.append({
            'back': -1,
            'apply': -1,
            'next': -1,
            'ok': -1,
            'finish': -1,
            'cancel': -1
        })

        # Execute on next by default.
        self._exec_on_next.append(exec_on_next)

        # Execution count.
        self._exec_count.append(0)

        # Proceed to next page on errors by default.
        self._proceed_on_error.append(proceed_on_error)

        # User function flushing of the GUI interpreter thread prior to proceeding.
        if not proceed_on_error or uf_flush:
            self._uf_flush.append(True)
        else:
            self._uf_flush.append(False)

        # Page sequence initialisation.
        self._seq_fn_list.append(self._next_fn)
        self._seq_next.append(None)
        self._seq_prev.append(None)

        # Page skipping.
        self._skip_flag.append(False)

        # Store the index of the page.
        panel.page_index = index

        # Return the index of the page.
        return index

    def block_next(self, block=True):
        """Prevent moving forwards (or unblock).

        @keyword block: A flag which if True will block forwards movement and if False will unblock.
        @type block:    bool
        """

        # The buttons to disable.
        buttons = ['next', 'ok', 'finish']

        # Disable or enable the buttons.
        for i in range(len(buttons)):
            # The button.
            button = self._buttons[self._current_page][buttons[i]]
            if button == None:
                continue

            # Block.
            if block:
                button.Disable()

            # Unblock.
            else:
                button.Enable()

    def get_page(self, index):
        """Get a page from the wizard.

        @param index:   The index of the page.
        @type index:    int
        @return:        The page object.
        @rtype:         Wiz_page instance.
        """

        # Return the page.
        return self._pages[index]

    def reset(self):
        """Reset the wizard."""

        # Clear the execution counts.
        for i in range(len(self._exec_count)):
            self._exec_count[i] = 0

    def run(self, modal=False):
        """Execute the wizard.

        @keyword modal: A flag which if True will cause the wizard to be run as a modal dialog.
        @type modal:    bool
        @return:        The status from the modal operation, i.e. True if the wizard is run, False if cancelled or other error occur.  For modeless operation, this returns nothing.
        @rtype:         bool or None
        """

        # Check that all pages have been set up correctly, returning without doing anything if not.
        for i in range(self._num_pages):
            if self._pages[i].setup_fail:
                return

        # Build the buttons for the entire wizard.
        if not self._buttons_built:
            self._build_buttons()

        # Display the first page.
        self._display_page(0)

        # Display failure.
        if self._pages[0].setup_fail:
            return

        # No GUI.
        if not status.show_gui:
            return

        # Modal operation.
        if modal:
            # Show the wizard (it should be closed by the _cancel() or _ok() methods).
            wiz_status = self.ShowModal()

            # Return the status.
            return wiz_status

        # Modeless operation.
        else:
            # Show the wizard.
            self.Show()

    def set_seq_next_fn(self, index, fn):
        """A user specified function for non-linear page changing.

        @param index:   The index of the page the function should be associated with.
        @type index:    int
        @param fn:      The function for determining the page after the current.  This function should return the index of the next page.
        @type fn:       func or method.
        """

        # Store the function.
        self._seq_fn_list[index] = fn

    def setup_page(self, page=None, **kargs):
        """Allow a specified user function page to be remotely set up.

        @keyword page:  The page to setup.  This is the page index key.
        @type page:     str
        """

        # Get the page.
        page = self.get_page(self.page_indices[page])

        # Loop over the keyword arguments and set them.
        for arg in kargs:
            # The value.
            value = kargs[arg]
            if isinstance(value, str):
                value = str_to_gui(value)
            elif is_float(value):
                value = float_to_gui(value)

            # Set the argument.
            page.SetValue(arg, value)