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)
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()
def _properties_changed(self, modified, actions): if modified and "style" in modified: actions.add("recreate_parent") return if not modified or "name" in modified and self.widget is not self._tb: self.widget.SetTitle(misc.design_title(misc.wxstr(self.name))) if not modified or "margins" in modified and self._tb: self._set_margins() actions.add("refresh") if not modified or "bitmapsize" in modified and self._tb: self._set_bitmapsize() actions.add("refresh") if not modified or "packing" in modified and self._tb: self._set_packing() actions.add("refresh") if not modified or "separation" in modified and self._tb: self._set_separation() actions.add("refresh") if not modified or "tools" in modified and self._tb: self._set_tools() actions.add("refresh") EditStylesMixin._properties_changed(self, modified, actions) EditBase._properties_changed(self, modified, actions)
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)
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)
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)
def _properties_changed(self, modified, actions): if not modified or "scrollable" in modified: if self.scrollable: if self.klass == 'wxPanel': self.properties["class"].set('wxScrolledWindow') self.properties['scroll_rate'].toggle_active(True) self.properties['scroll_rate'].set_blocked(False) else: if self.klass == 'wxScrolledWindow': self.properties["class"].set('wxPanel') self.properties['scroll_rate'].toggle_active(False) self.properties['scroll_rate'].set_blocked(True) if self.widget and modified: if "scrollable" in modified and self.properties["scrollable"].previous_value!=self.scrollable: actions.add("recreate") elif "scroll_rate" in modified and self.scrollable and isinstance(self.widget, wx.ScrolledWindow): self.widget.SetScrollRate( *self.properties["scroll_rate"].get_tuple() ) EditStylesMixin._properties_changed(self, modified, actions) if self.widget and modified and "style" in modified: # unfortunately, there seems no way to trigger a refresh after style change other than resizing the window sz = self.widget.GetSize() self.skip_on_size = True # required for EditTopLevelPanel self.widget.SetSize( (sz[0]-1,sz[1]-1) ) self.skip_on_size = True self.widget.SetSize(sz)
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)
def _properties_changed(self, modified, actions): if not modified or "fields" in modified: self._set_fields() EditStylesMixin._properties_changed(self, modified, actions) EditBase._properties_changed(self, modified, actions) if "recreate2" in actions: # usually, this would be done in WindowBase, but StatusBar is derived from EditBase self.destroy_widget(level=0) self.create_widget()
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)
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)
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)
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)
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)
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)
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)
def _properties_changed(self, modified, actions): if not modified or "scrollable" in modified: if self.scrollable: if self.klass == 'wxPanel': self.properties["class"].set('wxScrolledWindow') self.properties['scroll_rate'].toggle_active(True) self.properties['scroll_rate'].set_blocked(False) else: if self.klass == 'wxScrolledWindow': self.properties["class"].set('wxPanel') self.properties['scroll_rate'].toggle_active(False) self.properties['scroll_rate'].set_blocked(True) if self.widget and modified: if "scrollable" in modified and self.properties[ "scrollable"].previous_value != self.scrollable: actions.add("recreate") elif "scroll_rate" in modified and self.scrollable and isinstance( self.widget, wx.ScrolledWindow): self.widget.SetScrollRate( *self.properties["scroll_rate"].get_tuple()) EditStylesMixin._properties_changed(self, modified, actions)
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])
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)
def _properties_changed(self, modified, actions): EditStylesMixin._properties_changed(self, modified, actions) ManagedBase._properties_changed(self, modified, actions)
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)
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()
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)
def _properties_changed(self, modified, actions): if not modified or "icon" in modified and self.widget: self._set_widget_icon() TopLevelBase._properties_changed(self, modified, actions) EditStylesMixin._properties_changed(self, modified, actions)
def _properties_changed(self, modified, actions): if not modified or "fields" in modified: self._set_fields() EditStylesMixin._properties_changed(self, modified, actions) EditBase._properties_changed(self, modified, actions)
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)