def on_drop_widget(self, event, reset=None): """replaces self with a widget in self.sizer. This method is called to add every non-toplevel widget or sizer, and in turn calls the appropriate builder function (found in the ``common.widgets'' dict)""" if not common.adding_widget: # widget focused/selecte misc.set_focused_widget(self) if self.widget: self.widget.Refresh() self.widget.SetFocus() return if common.adding_sizer and self.parent.CHILDREN is not 1 and not self.IS_SLOT: return if self.widget: self.widget.SetCursor(wx.NullCursor) common.adding_window = event and event.GetEventObject( ).GetTopLevelParent() or None # call the appropriate builder new_widget = common.widgets[common.widget_to_add](self.parent, self.pos) if new_widget is None: return misc.rebuild_tree(new_widget) if reset is False: return if event is None or not misc.event_modifier_copy(event): common.adding_widget = common.adding_sizer = False common.widget_to_add = None
def on_drop_widget(self, event, reset=None): """replaces self with a widget. This method is called to add every non-toplevel widget or sizer, and in turn calls the appropriate builder function (found in the 'common.widgets' dict).""" if not common.adding_widget: # widget focused/selected misc.set_focused_widget(self) if self.widget: self.widget.Refresh() self.widget.SetFocus() return if not self.check_drop_compatibility()[0]: return if self.widget: self.widget.SetCursor(wx.NullCursor) common.adding_window = event and event.GetEventObject( ).GetTopLevelParent() or None # call the appropriate builder new_widget = common.widgets[common.widget_to_add](self.parent, self.index) if new_widget is None: return misc.rebuild_tree(new_widget) if reset is False: return if event is None or not misc.event_modifier_copy(event): common.adding_widget = common.adding_sizer = False common.widget_to_add = None if event is not None and new_widget.widget: # set focus; required mainly on macOS to receive keys widget = None if new_widget.IS_WINDOW: widget = new_widget.widget elif new_widget.IS_SIZER: widget = new_widget.toplevel_parent_window.widget if hasattr(widget, "SetFocus"): widget.SetFocus() common.history.widget_added(new_widget)
def drop_sizer(self, event=None): if self.top_sizer or not common.adding_sizer: self.on_set_focus(event) # default behaviour: call show_properties return if self.widget: self.widget.SetCursor(wx.NullCursor) common.widgets[common.widget_to_add](self, None, None) if event is None or not misc.event_modifier_copy(event): common.adding_widget = common.adding_sizer = False common.widget_to_add = None common.app_tree.app.saved = False
def drop_sizer(self, event=None, reset=None): if self.children or not common.adding_sizer: self.on_set_focus(event) # default behaviour: call show_properties return if self.widget: self.widget.SetCursor(wx.NullCursor) new_widget = common.widgets[common.widget_to_add](self, None) if new_widget is None: return misc.rebuild_tree(new_widget) if reset is False: return if event is None or not misc.event_modifier_copy(event): common.adding_widget = common.adding_sizer = False common.widget_to_add = None