Пример #1
0
    def _properties_changed(self, modified, actions):
        if not modified or "style" in modified:
            checked_p = self.properties['checked']
            if 'wxCHK_3STATE' in self.properties["style"].value_set:
                checked_p.enable_item(2, True)
            else:
                checked_p.enable_item(2, False)
                if checked_p.value == 2:
                    if common.history: common.history.monitor_property( checked_p )
                    checked_p.set(0)

        if not modified or "checked" in modified:
            if self.widget:
                if self.widget.Is3State():
                    self.widget.Set3StateValue(self.index2state[self.value])
                else:
                    self.widget.SetValue(self.value)

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

        EditStylesMixin._properties_changed(self, modified, actions)
        ManagedBase._properties_changed(self, modified, actions)
Пример #2
0
    def _properties_changed(
            self, modified,
            actions):  # the same code as for EditChoice and EditCheckListBox
        # self.selection needs to be in range (-1,len(self.choices)-1)
        choices = self.choices
        max_selection = len(choices) - 1
        set_selection = False
        if not modified or "choices" in modified:
            # adjust range of selection
            self.properties['selection'].set_range(min(-1, max_selection),
                                                   max_selection)
            set_selection = True
            if self.widget:
                # update widget
                self.widget.Clear()
                for c in choices:
                    self.widget.Append(c[0])
                actions.add("layout")

        if not modified or "selection" in modified or set_selection:
            set_selection = True
            if self.selection > max_selection:
                self.properties['selection'].set(max_selection)
        if self.widget and set_selection and self.widget.GetSelection(
        ) != self.selection:
            self.widget.SetSelection(self.selection)

        EditStylesMixin._properties_changed(self, modified, actions)
        ManagedBase._properties_changed(self, modified, actions)
Пример #3
0
    def _properties_changed(self, modified, actions):
        if not modified or "label" in modified:
            if self.widget:
                p = self.properties["label"]
                if self.wrap != -1 or (p.previous_value and len(
                        p.previous_value) > len(self.label)):
                    # re-create as otherwise the size would not be reduced
                    actions.add("recreate2")
                    return
                self.widget.SetLabel(self.label)
                actions.add("layout")

        if (not modified or "wrap" in modified) and self.widget:
            actions.add(
                "recreate2"
            )  # calling .Wrap(self.wrap) would only work once and not set the size correctly
            return

        if modified and wx.Platform != "__WXMSW__":
            if "style" in modified or "font" in modified or "foreground" in modified:
                actions.add("recreate2")
                return

        EditStylesMixin._properties_changed(self, modified, actions)
        ManagedBase._properties_changed(self, modified, actions)
Пример #4
0
    def _properties_changed(self, modified, actions):  # from EditSlider
        if not modified or "range" in modified and self.widget:
            mi, ma = self.properties["range"].get_tuple()
            self.widget.SetRange(mi, ma)
            self.properties["value"].set_range(mi, ma)
            self.properties["increment"].set_range(mi, ma)

        if not modified or "increment" in modified and self.widget:
            self.widget.SetIncrement(self.increment)

        if not modified or "value" in modified or "range" in modified:
            # check that value is inside range
            value_p = self.properties["value"]
            if value_p.is_active():
                mi, ma = self.properties["range"].get_tuple()
                value = value_p.get()
                if value < mi:
                    value_p.set(mi)
                    value = mi
                elif value > ma:
                    value_p.set(ma)
                    value = ma
                if self.widget:
                    self.widget.SetValue(value)

        EditStylesMixin._properties_changed(self, modified, actions)
        ManagedBase._properties_changed(self, modified, actions)
Пример #5
0
    def _properties_changed(self, modified, actions):
        # self.selection needs to be in range (-1,len(self.choices)-1)
        choices = self.choices
        max_selection = len(choices) - 1
        set_selection = False
        if not modified or "choices" in modified:
            # adjust range of selection
            self.properties['selection'].set_range(min(-1, max_selection),
                                                   max_selection)
            set_selection = True
            if self.widget:
                # update widget
                self.widget.Clear()
                for c in choices:
                    self.widget.Append(c[0])
                actions.add("layout")

        if not modified or "selection" in modified or set_selection:
            set_selection = True
            if self.selection > max_selection:
                if common.history:
                    common.history.monitor_property(
                        self.properties['selection'])
                self.properties['selection'].set(max_selection)
        if self.widget and set_selection and self.widget.GetSelection(
        ) != self.selection:
            self.widget.SetSelection(self.selection)

        ManagedBase._properties_changed(self, modified, actions)
Пример #6
0
    def _properties_changed(self, modified, actions):
        # self.selection needs to be in range (0,len(self.choices)-1)
        choices = self.choices
        max_selection = len(choices) - 1 if choices else 0
        set_selection = False
        if not modified or "choices" in modified:
            # adjust range of selection
            self.properties['selection'].set_range(0, max_selection)
            if self.selection > max_selection:
                set_selection = True

        if not modified or "selection" in modified or set_selection:
            if self.selection > max_selection:
                self.properties['selection'].set(max_selection)
            set_selection = True

        if not modified or "choices" in modified or "dimension" in modified or "style" in modified:
            self._set_choices()  # does also update label
        elif not modified or "label" in modified:
            self._set_label()

        if self.widget and set_selection:
            self._set_selection()

        ManagedBase._properties_changed(self, modified, actions)
Пример #7
0
    def _properties_changed(self, modified, actions):
        # self.selection needs to be in range (-1,len(self.choices))
        choices = self.choices
        max_selection = len(choices) - 1
        set_selection = False
        if not modified or "choices" in modified:
            # adjust range of selection
            self.properties['selection'].set_range(-1, max_selection)
            if self.selection > max_selection:
                set_selection = True
            if self.widget:
                # update widget
                self.widget.Clear()
                for c in choices:
                    self.widget.Append(c[0])
                actions.add("layout")

        if not modified or "selection" in modified or set_selection:
            if self.selection > max_selection:
                self.properties['selection'].set(max_selection)
            set_selection = True

        if self.widget and set_selection:
            self.widget.SetSelection(
                self.selection)  # -1 is identical to wx.NOT_FOUND

        EditStylesMixin._properties_changed(self, modified, actions)
        ManagedBase._properties_changed(self, modified, actions)
Пример #8
0
 def _properties_changed(self, modified, actions):
     if not modified or "width" in modified or "height" in modified:
         size = (self.width, self.height)
         if self.widget: self.widget.SetSize(size)
         self.parent.set_item_best_size(self, size=size)
         actions.add("layout")
     ManagedBase._properties_changed(self, modified, actions)
Пример #9
0
 def _properties_changed(self, modified, actions):
     EditStylesMixin._properties_changed(self, modified, actions)
     self._update_widget_properties(modified)
     if modified: actions.add("refresh")
     ManagedBase._properties_changed(self, modified, actions)
     if not modified or "name" in modified:
         self._set_name()
Пример #10
0
 def _properties_changed(self, modified, actions):
     if not modified or "scrollable" in modified:
         if self.scrollable:
             self.WX_CLASS = "wxScrolledWindow"
         else:
             self.WX_CLASS = "wxPanel"
     PanelBase._properties_changed(self, modified, actions)
     ManagedBase._properties_changed(self, modified, actions)
Пример #11
0
    def _properties_changed(self, modified, actions):
        "update label (and size if label/stockitem have changed)"
        if not modified or "bitmap" in modified and self.widget:
            bmp = self.get_preview_obj_bitmap(self.bitmap)
            self.widget.SetBitmap(bmp)
            if modified: actions.add("layout")

        EditStylesMixin._properties_changed(self, modified, actions)
        ManagedBase._properties_changed(self, modified, actions)
Пример #12
0
    def _properties_changed(self, modified, actions):
        if not modified or "label" in modified:
            self._set_label()
            actions.add("layout")

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

        EditStylesMixin._properties_changed(self, modified, actions)
        ManagedBase._properties_changed(self, modified, actions)
Пример #13
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)
Пример #14
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)
Пример #15
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)
Пример #16
0
    def _properties_changed(self, modified, actions):
        "update label (and size if label/stockitem have changed)"

        if "bitmap" in modified:
            self.properties["bitmap_dir"].set_blocked(
                not self.check_prop_truth("bitmap"))

        label_modified = not modified or ("label" in modified
                                          or "font" in modified)

        if not modified or "stockitem" in modified:
            # if stockitem is set, label needs to be deactivated and window id is wxID_...
            if self.properties["stockitem"].is_active():
                self.properties["label"].set_blocked(True)
                new_id = "wxID_" + self.stockitem
                if common.history:
                    common.history.monitor_property(self.properties["id"])
                self.properties["id"].set(new_id, deactivate=True)
                #self.properties["id"].default_value = new_id  # avoid this value to be written to XML

                l = ButtonStockItems.stock_ids[self.stockitem]
                if self.widget: self.widget.SetLabel(l)
            else:
                self.properties["label"].set_blocked(False)
                label_modified = True

        if modified and "font" in modified and wx.Platform == '__WXGTK__':
            # on GTK setting a smaller font would fail
            actions.update(("recreate2", "label", "sizeevent"))
            return

        if label_modified and self.properties["label"].is_active(
        ) and self.widget:
            self.widget.SetLabel(self.label)
            label_modified = True

        if label_modified or (modified and "stockitem" in modified):
            actions.update(("layout", "label", "sizeevent"))

        if modified and ("label" in modified or "stockitem" in modified):
            actions.add("label")

        if "bitmap_dir" in modified and self.widget:
            self.widget.SetBitmapPosition(self.bitmap_dir)

        BitmapMixin._properties_changed(self, modified, actions)
        EditStylesMixin._properties_changed(self, modified, actions)
        ManagedBase._properties_changed(self, modified, actions)
Пример #17
0
    def _properties_changed(self, modified, actions):
        if modified and "tabs" in modified and self.widget:
            for i,(tab,) in enumerate(self.tabs):
                self.widget.SetPageText(i,tab)
        
        if modified and "style" in modified:
            # wxNB_TOP to wxNB_BOTTOM can be changed on the fly; any other change requires re-creation
            p = self.properties["style"]
            new = self._get_direction(p.value_set)
            old = self._get_direction(p.previous_value)
            if wx.Platform=="__WXMSW__" and ((old=="T" and new=="B") or (old=="B" and new=="T")):
                actions.add("layout")
            elif old!=new:
                actions.add("recreate2")

        EditStylesMixin._properties_changed(self, modified, actions)
        ManagedBase._properties_changed(self, modified, actions)
Пример #18
0
    def _properties_changed(self, modified, actions):
        if (not modified or "sash_pos"
                in modified) and self.widget and self.check_prop("sash_pos"):
            self.widget.SetSashPosition(self.sash_pos)
        if (not modified or "sash_gravity" in modified
            ) and self.widget and self.check_prop("sash_gravity"):
            self.widget.SetSashGravity(self.sash_gravity)
        if (not modified or "min_pane_size" in modified
            ) and self.widget and self.check_prop("min_pane_size"):
            self.widget.SetMinimumPaneSize(self.min_pane_size)

        EditStylesMixin._properties_changed(self, modified, actions)
        ManagedBase._properties_changed(self, modified, actions)

        if modified and "orientation" in modified and common.app_tree is not None:
            # update horizontal/vertical icons
            actions.add("image")
            if self.children[0] and self.children[0].IS_SLOT:
                self.children[0].label = self._get_slot_label(0)
                common.app_tree.refresh(self.children[0])
            if self.children[1] and self.children[1].IS_SLOT:
                self.children[1].label = self._get_slot_label(1)
                common.app_tree.refresh(self.children[1])
Пример #19
0
    def _properties_changed(self, modified, actions):
        if not modified or "range" in modified:
            mi, ma = self.properties["range"].get_tuple()
            if self.widget:
                self.widget.SetRange(mi, ma)
            self.properties["value"].set_range(mi, ma)

        if not modified or "value" in modified or "range" in modified:
            # check that value is inside range
            value_p = self.properties["value"]
            if common.history: common.history.monitor_property(value_p)
            if value_p.is_active():
                mi, ma = self.properties["range"].get_tuple()
                value = value_p.get()
                if value < mi:
                    value_p.set(mi)
                    value = mi
                elif value > ma:
                    value_p.set(ma)
                    value = ma
                if self.widget: self.widget.SetValue(value)

        EditStylesMixin._properties_changed(self, modified, actions)
        ManagedBase._properties_changed(self, modified, actions)
Пример #20
0
 def _properties_changed(self, modified, actions):
     EditStylesMixin._properties_changed(self, modified, actions)
     ManagedBase._properties_changed(self, modified, actions)
     if not modified or "name" in modified:
         self._set_name()
Пример #21
0
 def _properties_changed(self, modified, actions):
     if modified and "instance_class" in modified:
         actions.update(("refresh", "label"))
     if modified and "show_design" in modified or self.show_design:
         actions.add("recreate2")
     ManagedBase._properties_changed(self, modified, actions)
Пример #22
0
 def _properties_changed(self, modified, actions):
     self._update_widget_properties(modified)
     if modified: actions.add("refresh")
     ManagedBase._properties_changed(self, modified, actions)
Пример #23
0
 def _properties_changed(self, modified, actions):
     if modified and "instance_class" in modified:
         actions.update(("refresh", "label"))
     ManagedBase._properties_changed(self, modified, actions)
Пример #24
0
 def _properties_changed(self, modified, actions):
     EditStylesMixin._properties_changed(self, modified, actions)
     ManagedBase._properties_changed(self, modified, actions)
Пример #25
0
 def _properties_changed(self, modified, actions):
     "update label (and size if label/stockitem have changed)"
     BitmapMixin._properties_changed(self, modified, actions)
     EditStylesMixin._properties_changed(self, modified, actions)
     ManagedBase._properties_changed(self, modified, actions)
Пример #26
0
 def _properties_changed(self, modified, actions):
     if not modified or "range" in modified and self.widget:
         self.widget.SetRange(self.range)
     EditStylesMixin._properties_changed(self, modified, actions)
     ManagedBase._properties_changed(self, modified, actions)
Пример #27
0
 def _properties_changed(self, modified, actions):
     if "value" in modified and self.widget:
         self.widget.SetValue(self.value)
     EditStylesMixin._properties_changed(self, modified, actions)
     ManagedBase._properties_changed(self, modified, actions)