Exemplo n.º 1
0
    def __init__(self,
                 name,
                 parent,
                 id,
                 label,
                 choices,
                 major_dim,
                 style,
                 sizer,
                 pos,
                 property_window,
                 show=True):
        """\
        Class to handle wxRadioBox objects
        """
        ManagedBase.__init__(self,
                             name,
                             'wxRadioBox',
                             parent,
                             id,
                             sizer,
                             pos,
                             property_window,
                             show=show)
        self.static_box = None
        self.selection = 0
        self.choices = choices
        self.buttons = None
        self.major_dim = major_dim

        if not style: self.style = wx.RA_SPECIFY_ROWS
        else: self.style = style
        self.label = label
        # properties
        self.access_functions['label'] = (self.get_label, self.set_label)
        self.access_functions['choices'] = (self.get_choices, self.set_choices)
        self.access_functions['style'] = (self.get_style, self.set_style)
        self.access_functions['dimension'] = (self.get_major_dimension,
                                              self.set_major_dimension)
        self.access_functions['selection'] = (self.get_selection,
                                              self.set_selection)
        self.properties['label'] = TextProperty(self,
                                                'label',
                                                None,
                                                label=_("label"))
        self.properties['selection'] = SpinProperty(self,
                                                    'selection',
                                                    None,
                                                    r=(0, len(choices) - 1),
                                                    label=_("selection"))
        self.properties['choices'] = ChoicesProperty(
            self,
            'choices',
            None, [('Label', GridProperty.STRING)],
            len(choices),
            label=_("choices"))
        self.style_pos = [wx.RA_SPECIFY_ROWS, wx.RA_SPECIFY_COLS]
        self.properties['style'] = RadioProperty(
            self,
            'style',
            None, ['wxRA_SPECIFY_ROWS', 'wxRA_SPECIFY_COLS'],
            label=_("style"))
        self.properties['dimension'] = SpinProperty(self,
                                                    'dimension',
                                                    None,
                                                    label=_("dimension"))
Exemplo n.º 2
0
 def __init__(self,
              name,
              parent,
              id,
              choices,
              sizer,
              pos,
              property_window,
              show=True):
     """\
     Class to handle wxComboBox objects
     """
     import config
     ManagedBase.__init__(self,
                          name,
                          'wxComboBox',
                          parent,
                          id,
                          sizer,
                          pos,
                          property_window,
                          show=show)
     self.choices = choices
     if len(choices): self.selection = 0
     else: self.selection = -1
     self.style = 0
     # properties
     self.access_functions['choices'] = (self.get_choices, self.set_choices)
     self.access_functions['style'] = (self.get_style, self.set_style)
     style_labels = ('#section#' + _('Style'), 'wxCB_SIMPLE',
                     'wxCB_DROPDOWN', 'wxCB_READONLY', 'wxCB_SORT')
     self.style_pos = [eval('wx.' + s[2:]) for s in style_labels[1:]]
     self.tooltips = (
         _("Creates a combobox with a permanently displayed list."
           " Windows only."),
         _("Creates a combobox with a drop-down list."),
         _("Same as wxCB_DROPDOWN but only the strings specified "
           "as the combobox choices can be selected, it is "
           "impossible to select (even from a program) a string "
           "which is not in the choices list."),
         _("Sorts the entries in the list alphabetically."))
     self.properties['style'] = CheckListProperty(self,
                                                  'style',
                                                  None,
                                                  style_labels,
                                                  tooltips=self.tooltips)
     self.properties['choices'] = ChoicesProperty(
         self,
         'choices',
         None, [('Label', GridProperty.STRING)],
         len(choices),
         label=_("choices"))
     self.access_functions['selection'] = (self.get_selection,
                                           self.set_selection)
     self.choices = list(choices)
     self.properties['selection'] = SpinProperty(self,
                                                 'selection',
                                                 None,
                                                 r=(0, len(choices) - 1),
                                                 label=_("selection"))
     # 2003-09-04 added default_border
     if config.preferences.default_border:
         self.border = config.preferences.default_border_size
         self.flag = wx.ALL