Пример #1
0
    def _properties_changed(self, modified, actions):
        if not modified or "label" in modified:
            if self.widget: self.widget.SetLabel(self.label)
            if modified: actions.add("layout")

        if not modified or "url" in modified:
            if self.widget: self.widget.SetURL(self.url)
            if modified: actions.add("layout")

        EditStylesMixin._properties_changed(self, modified, actions)
        ManagedBase._properties_changed(self, modified, actions)
Пример #2
0
    def __init__(self, name, parent, label, pos):
        ManagedBase.__init__(self, name, 'wxStaticText', parent, pos)
        EditStylesMixin.__init__(self)

        # initialise instance properties
        self.label = np.TextProperty(label, multiline="grow")
        self.attribute = np.CheckBoxProperty(False, default_value=False)
        self.wrap = np.SpinPropertyD(100,
                                     val_range=(1, 100000),
                                     immediate=True,
                                     default_value=-1)
Пример #3
0
    def __init__(self,
                 name,
                 parent,
                 index,
                 style=wx.TR_HAS_BUTTONS | wx.BORDER_SUNKEN):
        ManagedBase.__init__(self, name, parent, index)
        EditStylesMixin.__init__(self)

        # initialise instance properties
        if style: self.properties["style"].set(style)
        self._item_with_name = None  # a Tree item for visualization
Пример #4
0
    def __init__(self, name, parent, id, sizer, pos):
        ManagedBase.__init__(self, name, 'wxSpinCtrl', parent, id, sizer, pos)
        EditStylesMixin.__init__(self)

        # initialise instance properties
        self.range = np.IntRangePropertyA("0, 100")
        self.value = np.SpinPropertyA(0, val_range=(0, 100), immediate=True)

        if config.preferences.default_border:
            self.border.set(config.preferences.default_border_size)
            self.flag.set(wx.ALL)
Пример #5
0
    def __init__(self, name, parent, id, choices, sizer, pos):
        ManagedBase.__init__(self, name, 'wxComboBox', parent, id, sizer, pos)
        EditStylesMixin.__init__(self)

        # initialise instance properties
        self.selection = np.SpinProperty(0, val_range=len(choices)-1, immediate=True )
        self.choices = ChoicesProperty( choices, [(_('Label'), np.GridProperty.STRING)] )

        if config.preferences.default_border:
            self.border.set( config.preferences.default_border_size )
            self.flag.set( wx.ALL )
Пример #6
0
    def __init__(self, name, parent, index):
        # initialize base classes
        ManagedBase.__init__(self, name, parent, index)
        EditStylesMixin.__init__(self)

        # initialize instance properties
        self.value = np.TextProperty("")
        self.descriptive_text = np.TextPropertyD("Search", default_value="")
        self.search_button = np.CheckBoxProperty(True, default_value=True)
        self.cancel_button = np.CheckBoxProperty(True, default_value=True)
        self.max_length = np.SpinPropertyD(80, val_range=(1,1000), default_value=-1)
Пример #7
0
    def __init__(self, name, parent, id, label, sizer, pos):
        ManagedBase.__init__(self, name, 'wxRadioButton', parent, id, sizer, pos)
        EditStylesMixin.__init__(self)

        # initialise instance properties
        self.label   = np.TextProperty("", multiline=True, fixed_height=True)
        self.clicked = np.CheckBoxProperty(False, default_value=False)

        if config.preferences.default_border:
            self.border.set( config.preferences.default_border_size )
            self.flag.set( wx.ALL )
Пример #8
0
    def __init__(self, name, parent, index, choices):
        ManagedBase.__init__(self, name, parent, index)
        EditStylesMixin.__init__(self)

        # initialise instance properties
        self.selection = np.SpinProperty(-1,
                                         val_range=len(choices) - 1,
                                         default_value=-1,
                                         immediate=True)
        self.choices = ChoicesProperty(choices,
                                       [(_('Label'), np.GridProperty.STRING)])
Пример #9
0
    def __init__(self, name, parent, id, sizer, pos):
        ManagedBase.__init__(self, name, 'wxSpinCtrlDouble', parent, id, sizer,
                             pos)
        EditStylesMixin.__init__(self)

        # initialise instance properties
        self.range = np.FloatRangePropertyA("0.0, 100.0")
        self.value = np.SpinDoublePropertyA(0,
                                            val_range=(0.0, 100.0),
                                            immediate=True,
                                            default_value="")
Пример #10
0
    def __init__(self, name, parent, index, style):
        ManagedBase.__init__(self, name, parent, index)
        EditStylesMixin.__init__(self)
        self.properties["style"].set(style)

        # initialise instance properties
        self.pages = None  # on loading from XML, this will be used
        tabs = []  # list of page labels of this notebook
        tab_cols = [('Tab label', np.GridProperty.STRING)]
        self.tabs = NotebookPagesProperty(tabs, tab_cols)
        self.no_custom_class = np.CheckBoxProperty(False, default_value=False)
Пример #11
0
 def __init__(self,
              name,
              parent,
              id,
              sizer,
              pos,
              style=wx.LC_REPORT | wx.BORDER_SUNKEN):
     ManagedBase.__init__(self, name, 'wxListCtrl', parent, id, sizer, pos)
     EditStylesMixin.__init__(self)
     if style: self.properties["style"].set(style)
     self.columns = GridColsProperty([])
     self.rows_number = np.SpinProperty(0, immediate=True, default_value=0)
Пример #12
0
    def __init__(self, name, parent, index, label=""):
        "Class to handle wxCheckBox objects"
        ManagedBase.__init__(self, name, parent, index)
        EditStylesMixin.__init__(self)

        # initialise instance properties
        self.label = np.TextProperty(label, multiline="grow")

        # value: Checkbox state (0 = unchecked, 1 = checked, 2 = undetermined)
        values = [0,1,2]
        labels = [_('Unchecked'), _('Checked'), _('Undetermined')]
        self.value = np.IntRadioProperty(0, values, labels, columns=3, default_value=0, name="checked") # rename to value?
Пример #13
0
    def __init__(self, name, parent, bmp_file, pos):
        ManagedBase.__init__(self, name, 'wxBitmapButton', parent, pos)
        EditStylesMixin.__init__(self)
        BitmapMixin.__init__(self)

        # initialise instance properties
        self.bitmap = np.BitmapProperty(bmp_file)
        self.disabled_bitmap = np.BitmapPropertyD("")
        self.pressed_bitmap = np.BitmapPropertyD(min_version=(3, 0))
        self.current_bitmap = np.BitmapPropertyD(min_version=(3, 0))
        self.focus_bitmap = np.BitmapPropertyD(min_version=(3, 0))
        self.default = np.CheckBoxProperty(False, default_value=False)
Пример #14
0
    def properties_changed(self, modified):
        resize = False

        if not modified or "label" in modified:
            self._set_label()
            common.app_tree.refresh(self, refresh_label=True, refresh_image=False)

        if not modified or "clicked" in modified and self.widget:
            self.widget.SetValue(self.clicked)

        EditStylesMixin.properties_changed(self, modified)
        ManagedBase.properties_changed(self, modified)
Пример #15
0
    def _properties_changed(self, modified, actions):
        if not modified or "value" in modified and self.widget:
            self.widget.SetValue(self.value)

        if not modified or "label" in modified:
            if self.widget:
                self.widget.SetLabel(self.label)
            if modified: actions.update(("layout", "label"))

        BitmapMixin._properties_changed(self, modified, actions)
        EditStylesMixin._properties_changed(self, modified, actions)
        ManagedBase._properties_changed(self, modified, actions)
Пример #16
0
    def properties_changed(self, modified):
        if not modified or "value" in modified and self.widget:
            self.widget.SetValue(self.value)

        if not modified or "label" in modified:
            if self.widget:
                self.widget.SetLabel(self.label)
                self._set_widget_best_size()
            common.app_tree.refresh(self.node, refresh_label=True)

        EditStylesMixin.properties_changed(self, modified)
        ManagedBase.properties_changed(self, modified)
Пример #17
0
    def __init__(self, name, parent, id, sizer, pos):
        # Initialise parent classes
        ManagedBase.__init__(self, name, 'wxGenericCalendarCtrl', parent, id,
                             sizer, pos)
        EditStylesMixin.__init__(self)

        # initialise instance properties
        self.default = np.CheckBoxProperty(False)

        if config.preferences.default_border:
            self.border.set(config.preferences.default_border_size)
            self.flag.set(wx.ALL)
Пример #18
0
    def __init__(self, name, parent, id, bmp_file, sizer, pos):
        ManagedBase.__init__(self, name, 'wxBitmapButton', parent, id, sizer,
                             pos)
        EditStylesMixin.__init__(self)
        BitmapMixin.__init__(self)

        # initialise instance properties
        filedialog_style = wx.FD_OPEN | wx.FD_FILE_MUST_EXIST  # for the following two properties
        self.bitmap = np.BitmapProperty(bmp_file, style=filedialog_style)
        self.disabled_bitmap = np.BitmapPropertyD("",
                                                  default_value="",
                                                  style=filedialog_style)
        self.default = np.CheckBoxProperty(False, default_value=False)
Пример #19
0
    def properties_changed(self, modified):
        if not modified or "label" in modified:
            if self.widget:
                self.widget.SetLabel(self.label)
                self._set_widget_best_size()
            common.app_tree.refresh(self, refresh_label=True, refresh_image=False)

        if not modified or "url" in modified:
            if self.widget:
                self.widget.SetURL(self.url)

        EditStylesMixin.properties_changed(self, modified)
        ManagedBase.properties_changed(self, modified)
Пример #20
0
    def __init__(self, name, parent, id, label, sizer, pos):
        ManagedBase.__init__(self, name, 'wxStaticText', parent, id, sizer,
                             pos)
        EditStylesMixin.__init__(self)

        # initialise instance properties
        self.label = np.TextProperty(label, multiline=True)
        self.attribute = np.CheckBoxProperty(False, default_value=False)

        if config.preferences.default_border:
            self.properties["border"].set(
                config.preferences.default_border_size)
            self.properties["flag"].set(wx.ALL)
Пример #21
0
    def __init__(self, name, parent, label, pos):
        ManagedBase.__init__(self, name, 'wxToggleButton', parent, pos)
        EditStylesMixin.__init__(self)

        # initialise instance variable
        self.label = np.TextProperty(label, multiline="grow")
        self.value = np.CheckBoxProperty(False, default_value=False)
        # bitmaps are only for >= 3.0
        self.bitmap          = np.BitmapPropertyD(min_version=(3,0))
        self.disabled_bitmap = np.BitmapPropertyD(min_version=(3,0))
        self.pressed_bitmap  = np.BitmapPropertyD(min_version=(3,0))
        self.current_bitmap  = np.BitmapPropertyD(min_version=(3,0))
        self.focus_bitmap    = np.BitmapPropertyD(min_version=(3,0))
Пример #22
0
    def __init__(self, name, parent, id, sizer, pos):
        # initialize base classes
        ManagedBase.__init__(self, name, 'wxTextCtrl', parent, id, sizer, pos)
        EditStylesMixin.__init__(self)

        # initialize instance properties
        self.value = np.TextProperty("", multiline=True)

        if config.preferences.default_border:
            # modify default values  XXX should this be moved somewhere else or dropped?
            self.properties["border"].set(
                config.preferences.default_border_size)
            self.properties["flag"].set(wx.ALL)
Пример #23
0
 def _properties_changed(self, modified, actions):
     if "value" in modified and self.widget:
         self.widget.SetValue(self.value)
     if "search_button" in modified and self.widget:
         self.widget.ShowSearchButton(self.search_button)
     if "cancel_button" in modified and self.widget:
         self.widget.ShowCancelButton(self.cancel_button)
     if "descriptive_text" in modified and self.widget:
         self.widget.SetDescriptiveText(self.descriptive_text)
     if "max_length" in modified and self.widget:
         self.widget.SetMaxLength(self.max_length)
     EditStylesMixin._properties_changed(self, modified, actions)
     ManagedBase._properties_changed(self, modified, actions)
Пример #24
0
    def __init__(self, name, klass, parent):
        EditBase.__init__(self,
                          name,
                          klass,
                          parent,
                          custom_class=False,
                          pos="_statusbar")
        EditStylesMixin.__init__(self)

        # for the statusbar fields
        fields = [[self.name, "-1"]]  # list of 2-lists label, size
        self.fields = FieldsProperty(fields)
        self.window_id = None  # just a dummy for code generation
Пример #25
0
    def __init__(self, name, parent, klass, title, style=wx.DEFAULT_FRAME_STYLE): #XXX style is not used
        TopLevelBase.__init__(self, name, parent, klass, title)
        EditStylesMixin.__init__(self)
        self.properties["style"].set(style)

        # initialise instance properties
        self.icon      = np.BitmapPropertyD("")
        self.centered  = np.CheckBoxProperty(False, default_value=False)
        self.sizehints = np.CheckBoxProperty(False, default_value=False)

        self.menubar   = BarProperty("MenuBar")
        self.toolbar   = BarProperty("ToolBar")
        if "statusbar" in self.PROPERTIES:  # not for MDIChildFrame
            self.statusbar = BarProperty("StatusBar")
Пример #26
0
    def __init__(self, name, parent, id, bmp_file, sizer, pos):
        ManagedBase.__init__(self, name, 'wxStaticBitmap', parent, id, sizer,
                             pos)
        EditStylesMixin.__init__(self)

        # initialise instance properties
        filedialog_style = wx.FD_OPEN | wx.FD_FILE_MUST_EXIST  # for the following two properties
        self.bitmap = np.FileNameProperty(bmp_file, style=filedialog_style)
        self.attribute = np.CheckBoxProperty(False, default_value=False)

        if config.preferences.default_border:
            self.properties["border"].set(
                config.preferences.default_border_size)
            self.properties["flag"].set(wx.ALL)
Пример #27
0
    def __init__(self, name, parent, index):
        ManagedBase.__init__(self, name, parent, index)
        EditStylesMixin.__init__(self)

        # initialise instance properties
        self.range = np.FloatRangePropertyA("0.0, 100.0")
        self.value = np.SpinDoublePropertyA(0,
                                            val_range=(0.0, 100.0),
                                            immediate=True,
                                            default_value="")
        self.increment = np.SpinDoublePropertyD(1.0,
                                                val_range=(0.0, 100.0),
                                                immediate=True,
                                                default_value=1.0)
Пример #28
0
 def __init__(self,
              name,
              parent,
              index,
              style=wx.LC_REPORT | wx.BORDER_SUNKEN):
     ManagedBase.__init__(self, name, parent, index)
     EditStylesMixin.__init__(self)
     if style: self.properties["style"].set(style)
     self.columns = GridColsProperty([])
     self.rows_number = np.SpinProperty(0, immediate=True, default_value=0)
     self.properties["style"]._ignore_names = {"wxLC_VIRTUAL"}
     self.properties["style"]._one_required = {
         "wxLC_ICON", "wxLC_SMALL_ICON", "wxLC_LIST", "wxLC_REPORT"
     }
Пример #29
0
    def __init__(self, style='wxTAB_TRAVERSAL'):
        "Class to handle wxPanel objects"
        # initialise instance logger
        self._logger = logging.getLogger(self.__class__.__name__)

        # initialise instance
        EditStylesMixin.__init__(self, 'wxPanel')

        # initialise properties
        self.no_custom_class = np.CheckBoxProperty(False, default_value=False)
        self.scrollable = np.CheckBoxProperty(False, default_value=False)
        self.scroll_rate = prop = np.IntPairPropertyD("10, 10")
        prop.set_blocked(True)

        if style: self.properties["style"].set(style)
Пример #30
0
    def __init__(self, style='wxTAB_TRAVERSAL'):
        "Class to handle wxPanel objects"
        # initialise instance logger
        self._logger = logging.getLogger(self.__class__.__name__)

        # initialise instance
        EditStylesMixin.__init__(self, 'wxPanel')
        self.top_sizer = None  # sizer to handle the layout of children

        # initialise properties
        self.no_custom_class = np.CheckBoxProperty(False, default_value=False)
        self.scrollable = np.CheckBoxProperty(False, default_value=False)
        self.scroll_rate = np.ScrollRatePropertyD("10, 10")

        if style: self.properties["style"].set(style)