Example #1
0
    def properties_changed(self, modified):  # 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])
                if hasattr(self.parent, "set_item_best_size") and not self.properties['size'].is_active():
                    self.sizer.set_item_best_size(self, size=self.widget.GetBestSize())

        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)
        ManagedBase.properties_changed(self, modified)
Example #2
0
    def properties_changed(self, modified):
        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)
        ManagedBase.properties_changed(self, modified)

        if modified and "orientation" in modified and common.app_tree is not None:
            # update horizontal/vertical icons
            common.app_tree.refresh(self,
                                    refresh_label=False,
                                    refresh_image=True)
            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])
Example #3
0
    def properties_changed(self, modified):
        # 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])
                if not self.properties['size'].is_active():
                    self.sizer.set_item_best_size(
                        self, size=self.widget.GetBestSize())

        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)

        ManagedBase.properties_changed(self, modified)
Example #4
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()

        ManagedBase.properties_changed(self, modified)
Example #5
0
    def properties_changed(self, modified=None):
        "update label (and size if label/stockitem have changed)"

        label_modified = not modified or "label" in modified
        resize = False

        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
                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)
                    resize = True
            else:
                self.properties["label"].set_blocked(False)
                self.properties["id"].default_value = "wxID_ANY"
                label_modified = True

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

        if resize and self.widget: self._set_widget_best_size()

        ManagedBase.properties_changed(self, modified)
Example #6
0
    def properties_changed(self, modified=None):
        "update label (and size if label/stockitem have changed)"
        if self.widget:
            resize = False
            if not modified or "bitmap" in modified:
                bmp = self.get_preview_obj_bitmap(self.bitmap)
                self.widget.SetBitmapLabel(bmp)
                if compat.IS_CLASSIC:
                    self.widget.SetBitmapSelected(bmp)
                else:
                    self.widget.SetBitmapPressed(bmp)
                self.widget.SetBitmapFocus(bmp)
                resize = True
            if not modified or "disabled_bitmap" in modified:
                bmp = self.get_preview_obj_bitmap(self.disabled_bitmap)
                self.widget.SetBitmapDisabled(bmp)
                resize = True

            if resize: self._set_widget_best_size()
            #size_p = self.properties["size"]
            #if resize and size_p.get()=="-1, -1":
            #self.sizer.set_item(self.pos, size=self.widget.GetBestSize())
            #if not size_p.is_active():
            #size_p.set( self.widget.GetBestSize() )

        EditStylesMixin.properties_changed(self, modified)
        ManagedBase.properties_changed(self, modified)
Example #7
0
    def properties_changed(self, modified):
        if not modified or "sash_pos" in modified and self.widget:
            self.widget.SetSashPosition(self.sash_pos)
        if not modified or "min_pane_size" in modified and self.widget:
            self.widget.SetMinimumPaneSize(self.min_pane_size)

        ManagedBase.properties_changed(self, modified)
    def properties_changed(self, modified):
        if not modified or "sash_pos" in modified and self.widget:
            self.widget.SetSashPosition(self.sash_pos)
        if not modified or "sash_gravity" in modified and self.widget:
            self.widget.SetSashGravity(self.sash_gravity)
        if not modified or "min_pane_size" in modified and self.widget:
            self.widget.SetMinimumPaneSize(self.min_pane_size)

        EditStylesMixin.properties_changed(self, modified)
        ManagedBase.properties_changed(self, modified)

        if modified and "orientation" in modified:
            # update horizontal/vertical icons
            labels = (
                "SLOT Left",
                "SLOT Right") if self.orientation == "wxSPLIT_VERTICAL" else (
                    "SLOT Top", "SLOT Bottom")
            common.app_tree.refresh(self.node,
                                    refresh_label=False,
                                    refresh_image=True)
            if isinstance(self._window_1, SizerSlot):
                self._window_1.label = labels[0]
                common.app_tree.refresh(self._window_1.node)
            if isinstance(self._window_2, SizerSlot):
                self._window_2.label = labels[1]
                common.app_tree.refresh(self._window_2.node)
Example #9
0
 def properties_changed(self, modified):
     if not modified or "tabs" in modified:
         if not self.pages:
             # during XML parsing, the tab names are set before
             page_count = len(self.properties["tabs"].value)
             self.pages.extend([None] * page_count)
     ManagedBase.properties_changed(self, modified)
Example #10
0
    def properties_changed(self, modified):
        # 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 self.widget:
                # update widget
                self.widget.Clear()
                for c in choices:
                    self.widget.Append(c[0])
                if not self.properties['size'].is_active():
                    self.sizer.set_item(self.pos,
                                        size=self.widget.GetBestSize())

        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:
            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)
Example #11
0
    def properties_changed(self, modified):
        # 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])
                if hasattr(self.parent, "set_item_best_size"
                           ) and not self.properties['size'].is_active():
                    self.sizer.set_item_best_size(
                        self, size=self.widget.GetBestSize())

        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)
        ManagedBase.properties_changed(self, modified)
Example #12
0
    def properties_changed(self, modified):
        # 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:
            self._set_choices()  # does also update label
        elif not modified or "label" in modified:
            self._set_label()
            common.app_tree.refresh(self,
                                    refresh_label=True,
                                    refresh_image=False)

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

        ManagedBase.properties_changed(self, modified)
Example #13
0
    def properties_changed(self, modified):  # 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)
        ManagedBase.properties_changed(self, modified)
Example #14
0
    def properties_changed(self, modified):
        resize = False

        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:
                    checked_p.set(0)

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

        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 resize: self._set_widget_best_size()

        EditStylesMixin.properties_changed(self, modified)
        ManagedBase.properties_changed(self, modified)
Example #15
0
    def properties_changed(self, modified):  # XXX from CheckListBox
        # 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(-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])
                if not self.properties['size'].is_active():
                    self.sizer.set_item(self.pos,
                                        size=self.widget.GetBestSize())

        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

        ManagedBase.properties_changed(self, modified)
Example #16
0
    def properties_changed(self, modified):
        if modified and "tabs" in modified and self.widget:
            for i, (tab, ) in enumerate(self.tabs):
                self.widget.SetPageText(i, tab)

        EditStylesMixin.properties_changed(self, modified)
        ManagedBase.properties_changed(self, modified)
Example #17
0
    def properties_changed(self, modified=None):
        "update label (and size if label/stockitem have changed)"

        label_modified = not modified or "label" 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
                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)
                #self.properties["id"].default_value = "wxID_ANY"
                label_modified = True

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

        if (label_modified or "name" in modified) and common.app_tree:
            common.app_tree.refresh(self,
                                    refresh_label=True,
                                    refresh_image=False)

        BitmapMixin._properties_changed(self, modified)
        self._set_widget_best_size()
        EditStylesMixin.properties_changed(self, modified)
        ManagedBase.properties_changed(self, modified)
Example #18
0
 def properties_changed(self, modified):
     if not modified or "scrollable" in modified:
         if self.scrollable:
             self.WX_CLASS = "wxScrolledWindow"
         else:
             self.WX_CLASS = "wxPanel"
     PanelBase.properties_changed(self, modified)
     ManagedBase.properties_changed(self, modified)
    def properties_changed(self, modified=None):
        "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)

            self._set_widget_best_size()

        ManagedBase.properties_changed(self, modified)
Example #20
0
    def properties_changed(self, modified):
        resize = False

        if not modified or "label" in modified: self._set_label()

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

        ManagedBase.properties_changed(self, modified)
Example #21
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.node, refresh_label=True)

        EditStylesMixin.properties_changed(self, modified)
        ManagedBase.properties_changed(self, modified)
Example #22
0
 def properties_changed(self, modified):
     if not modified or "scrollable" in modified:
         if self.scrollable:
             # 2003-06-26 ALB: change the "class name", to allow code generation
             # for a wxScrolledWindow (see Node.write and common.class_names usage in xml_parse.py)
             self._classname = 'EditScrolledWindow'
         else:
             self._classname = self.__class__.__name__
     PanelBase.properties_changed(self, modified)
     ManagedBase.properties_changed(self, modified)
Example #23
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)
Example #24
0
 def properties_changed(self, modified):
     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)
     ManagedBase.properties_changed(self, modified)
Example #25
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, refresh_label=True, refresh_image=False)

        BitmapMixin._properties_changed(self, modified)
        self._set_widget_best_size()
        EditStylesMixin.properties_changed(self, modified)
        ManagedBase.properties_changed(self, modified)
Example #26
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()
            if common.app_tree:
                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)
Example #27
0
    def properties_changed(self, modified):
        if not modified or "label" in modified:
            common.app_tree.refresh(self.node, refresh_label=True)
            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
                    self.recreate_widget()
                    return
                self.widget.SetLabel(self.label)
                self._set_widget_best_size()

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

            return

        EditStylesMixin.properties_changed(self, modified)
        ManagedBase.properties_changed(self, modified)
Example #28
0
 def properties_changed(self, modified=None):
     "update label (and size if label/stockitem have changed)"
     BitmapMixin._properties_changed(self, modified)
     EditStylesMixin.properties_changed(self, modified)
     ManagedBase.properties_changed(self, modified)
Example #29
0
 def properties_changed(self, modified):
     ManagedBase.properties_changed(self, modified)
     if not modified or "name" in modified:
         self._set_name()
 def properties_changed(self, modified=None):
     EditStylesMixin.properties_changed(self, modified)
     ManagedBase.properties_changed(self, modified)