def modify(self, event=None):
        """Modify the model selection.

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

        # First state that this should not be done.
        if self.warning and status.show_gui and not Question(self.warning, title="Warning - do not change!", size=(420, 210), default=False).ShowModal() == wx.ID_YES:
            return

        # Set the model selector window selections.
        self.model_win.set_selection(self.select)

        # Show the model selector window.
        if status.show_gui:
            self.model_win.ShowModal()
            self.model_win.Close()

        # Set the values.
        self.select = self.model_win.get_selection()

        # Update the button.
        self.update_button()

        # Update the GUI element.
        self.field.SetValue(list_to_gui(self.GetValue()))
Exemple #2
0
    def modify(self, event=None):
        """Modify the model selection.

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

        # First state that this should not be done.
        if self.warning and status.show_gui and not Question(
                self.warning,
                title="Warning - do not change!",
                size=(420, 210),
                default=False).ShowModal() == wx.ID_YES:
            return

        # Set the model selector window selections.
        self.model_win.set_selection(self.select)

        # Show the model selector window.
        if status.show_gui:
            self.model_win.ShowModal()
            self.model_win.Close()

        # Set the values.
        self.select = self.model_win.get_selection()

        # Update the button.
        self.update_button()

        # Update the GUI element.
        self.field.SetValue(list_to_gui(self.GetValue()))
Exemple #3
0
    def SetValue(self, value):
        """Special method for setting the value of the GUI element.

        @param value:   The value to set.
        @type value:    str
        """

        # Handle single values.
        if isinstance(value, list) and len(value) == 1:
            value = value[0]

        # Convert and set the value.
        self._field.SetValue(list_to_gui(value))
Exemple #4
0
    def SetValue(self, value):
        """Special method for setting the value of the GUI element.

        @param value:   The value to set.
        @type value:    str
        """

        # Handle single values.
        if isinstance(value, list) and len(value) == 1:
            value = value[0]

        # Convert and set the value.
        self._field.SetValue(list_to_gui(value))
    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)
Exemple #6
0
    def set_value(self, value):
        """Store the list of models.

        @param value:   The list of models.
        @type value:    list of str
        """

        # First set all models as being deselected.
        for i in range(len(self.select)):
            self.select[i] = False

        # Select all models in the list.
        for model in value:
            # The model index.
            index = self.models_stripped.index(model)

            # Set the selected flag.
            self.select[index] = True

        # Update the button.
        self.update_button()

        # Update the GUI element.
        self.field.SetValue(list_to_gui(self.GetValue()))
    def set_value(self, value):
        """Store the list of models.

        @param value:   The list of models.
        @type value:    list of str
        """

        # First set all models as being deselected.
        for i in range(len(self.select)):
            self.select[i] = False

        # Select all models in the list.
        for model in value:
            # The model index.
            index = self.models_stripped.index(model)

            # Set the selected flag.
            self.select[index] = True

        # Update the button.
        self.update_button()

        # Update the GUI element.
        self.field.SetValue(list_to_gui(self.GetValue()))
Exemple #8
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)