def __init__(self, name, parent, id, win_1, win_2, orientation, sizer, pos): ManagedBase.__init__(self, name, 'wxSplitterWindow', parent, id, sizer, pos) EditStylesMixin.__init__(self) # initialise instance properties self.no_custom_class = np.CheckBoxProperty(False, default_value=False) self.sash_pos = np.SpinPropertyD(0, default_value="") if hasattr(wx, "SpinCtrlDouble"): self.sash_gravity = np.SpinDoublePropertyD(0.5, (0.0, 1.0), default_value=0.0, immediate=True) else: self.sash_gravity = np.FloatPropertyD(0.5, (0.0, 1.0), default_value=0.0) self.min_pane_size = np.SpinProperty(20) # hidden properties: orientation string, window_1, window_2 self.orientation = np.Property(orientation) self.window_1 = ChildWidgetNameProperty("_window_1") self.window_2 = ChildWidgetNameProperty("_window_2") self.virtual_sizer = SplitterWindowSizer(self) labels = ("SLOT Left", "SLOT Right") if orientation == "wxSPLIT_VERTICAL" else ( "SLOT Top", "SLOT Bottom") self._window_1 = win_1 or SizerSlot( self, self.virtual_sizer, 1, label=labels[0]) self._window_2 = win_2 or SizerSlot( self, self.virtual_sizer, 2, label=labels[1])
def free_slot(self, pos, force_layout=True): "Replaces the element at pos with an empty slot" if self.window.orientation == "wxSPLIT_VERTICAL": labels = ("SLOT Left", "SLOT Right") else: labels = ("SLOT Top", "SLOT Bottom") if pos == 1: if self.window.widget and self.window._window_1 and self.window._window_1.widget: self.window.widget.Unsplit(self.window._window_1.widget) old_node = self.window._window_1.node slot = SizerSlot(self.window, self, pos, labels[0]) # XXX no node, no tree visualization? self.window._window_1 = slot w = self.window._window_1 else: if self.window.widget and self.window._window_2 and self.window._window_2.widget: self.window.widget.Unsplit(self.window._window_1.widget) old_node = self.window._window_2.node slot = SizerSlot(self.window, self, pos, labels[1]) # XXX no node, no tree visualization? self.window._window_2 = slot w = self.window._window_2 w.node = node = SlotNode(w) common.app_tree.change_node(old_node, w, node) self.window.split() return slot
def __init__(self, name, parent, id, style, win_1, win_2, orientation, sizer, pos): ManagedBase.__init__(self, name, 'wxSplitterWindow', parent, id, sizer, pos) EditStylesMixin.__init__(self) # initialise instance properties self.no_custom_class = np.CheckBoxProperty(False, default_value=False) self.sash_pos = np.SpinPropertyD(0, default_value=0) self.min_pane_size = np.SpinProperty(20) # hidden properties: orientation string, window_1, window_2 self.orientation = np.Property(orientation) self.window_1 = ChildWidgetNameProperty("_window_1") self.window_2 = ChildWidgetNameProperty("_window_2") self.virtual_sizer = SplitterWindowSizer(self) labels = ("SLOT Left", "SLOT Right") if orientation == "wxSPLIT_VERTICAL" else ( "SLOT Top", "SLOT Bottom") self._window_1 = win_1 or SizerSlot(self, self.virtual_sizer, 1, labels[0]) self._window_2 = win_2 or SizerSlot(self, self.virtual_sizer, 2, labels[1]) if style: self.properties["style"].set(style)
def __init__(self, name, parent, id, style, win_1, win_2, orientation, sizer, pos, property_window, show=True): """\ Class to handle wxSplitterWindow objects """ ManagedBase.__init__(self, name, 'wxSplitterWindow', parent, id, sizer, pos, property_window, show=show) self.virtual_sizer = SplitterWindowSizer(self) if style is None: style = wx.SP_3D self.style = style self.window_1 = win_1 self.window_2 = win_2 self.orientation = orientation self.sash_pos = 0 self.access_functions['style'] = (self.get_style, self.set_style) self.access_functions['sash_pos'] = (self.get_sash_pos, self.set_sash_pos) self.style_pos = (wx.SP_3D, wx.SP_3DSASH, wx.SP_3DBORDER, #wx.SP_FULLSASH, wx.SP_BORDER, wx.SP_NOBORDER, wx.SP_PERMIT_UNSPLIT, wx.SP_LIVE_UPDATE, wx.CLIP_CHILDREN) style_labels = ('#section#' + _('Style'), 'wxSP_3D', 'wxSP_3DSASH', 'wxSP_3DBORDER', #'wxSP_FULLSASH', 'wxSP_BORDER', 'wxSP_NOBORDER', 'wxSP_PERMIT_UNSPLIT', 'wxSP_LIVE_UPDATE', 'wxCLIP_CHILDREN') self.properties['style'] = CheckListProperty(self, 'style', None, style_labels) if self.orientation == wx.SPLIT_HORIZONTAL: od = 'wxSPLIT_HORIZONTAL' else: od = 'wxSPLIT_VERTICAL' self.access_functions['orientation'] = (self.get_orientation, self.set_orientation) self.properties['orientation'] = HiddenProperty(self, 'orientation', label=_("orientation")) self.access_functions['window_1'] = (self.get_win_1, lambda v: None) self.access_functions['window_2'] = (self.get_win_2, lambda v: None) self.properties['window_1'] = HiddenProperty(self, 'window_1') self.properties['window_2'] = HiddenProperty(self, 'window_2') self.window_1 = SizerSlot(self, self.virtual_sizer, 1) self.window_2 = SizerSlot(self, self.virtual_sizer, 2) self.properties['sash_pos'] = SpinProperty(self, 'sash_pos', None, r=(0, 20), can_disable=True, label=_("sash_pos")) self.no_custom_class = False self.access_functions['no_custom_class'] = (self.get_no_custom_class, self.set_no_custom_class) self.properties['no_custom_class'] = CheckBoxProperty( self, 'no_custom_class', label=_("Don't generate code for this custom class"))
def free_slot(self, pos, force_layout=True): "Replaces the element at pos with an empty slot" if self.window._is_removing_pages or not self.window.widget: return slot = SizerSlot(self.window, self, pos) # XXX node handling? #self._logger.debug('free: %s, %s, %s', slot, slot.pos, pos) slot.create() pos -= 1 label = self.window.tabs[pos][0] self.window.widget.RemovePage(pos) self.window.widget.InsertPage(pos, slot.widget, label) self.window.widget.SetSelection(pos)
def free_slot(self, pos, force_layout=True): """\ Replaces the element at pos with an empty slot """ if self.window._is_removing_pages or not self.window.widget: return slot = SizerSlot(self.window, self, pos) #print 'free:', slot, slot.pos, pos slot.show_widget(True) pos = pos - 1 label, item = self.window.tabs[pos] self.window.widget.RemovePage(pos) self.window.widget.InsertPage(pos, slot.widget, label) self.window.widget.SetSelection(pos)
def on_load(self): # create slot nodes for empty slots for p, page in enumerate(self.pages): if page is not None: continue self.pages[p] = slot = SizerSlot(self, self.virtual_sizer, p + 1) node = slot.node = SlotNode(slot) common.app_tree.insert(node, self.node, p)
def _add_tab(self, window, pos): if window is None: window = SizerSlot(self, self.virtual_sizer, pos) self.tabs[pos - 1][1] = window else: window._dont_destroy = True node = Tree.Node(window) window.node = node common.app_tree.add(node, self.node) if self.widget: window.show_widget(True) self.virtual_sizer.set_item(pos) try: wx.CallAfter(window.sel_marker.update) except AttributeError, e: #print e pass
def free_slot(self, pos, force_layout=True): """\ Replaces the element at pos with an empty slot """ if pos == 1: if self.window.widget and \ self.window.window_1 and self.window.window_1.widget: self.window.widget.Unsplit(self.window.window_1.widget) self.window.window_1 = SizerSlot(self.window, self, pos) w = self.window.window_1 else: if self.window.widget and \ self.window.window_2 and self.window.window_2.widget: self.window.widget.Unsplit() self.window.window_2 = SizerSlot(self.window, self, pos) w = self.window.window_2 self.window.split() w.widget.SetFocus()
def free_slot(self, pos, force_layout=True): "Replaces the element at pos with an empty slot" if self.window._is_removing_pages or not self.window.widget: return slot = SizerSlot(self.window, self, pos) # XXX node handling? #self._logger.debug('free: %s, %s, %s', slot, slot.pos, pos) slot.create() label = self.window.tabs[pos - 1][0] self.window.widget.RemovePage(pos - 1) w = self.window.pages[pos - 1] old_node = w.node self.window.pages[pos - 1] = slot slot.node = node = SlotNode(slot) common.app_tree.change_node(old_node, slot, node) self.window.widget.InsertPage(pos - 1, slot.widget, label) self.window.widget.SetSelection(pos - 1) return slot
def _add_tab(self, window, pos): if window is None: window = SizerSlot(self, self.virtual_sizer, pos) self.tabs[pos - 1][1] = window else: window._dont_destroy = True node = Tree.Node(window) window.node = node common.app_tree.add(node, self.node) if self.widget: window.show_widget(True) self.virtual_sizer.set_item(pos) try: misc.wxCallAfter(window.sel_marker.update) except AttributeError, e: #print e pass
class EditSplitterWindow(ManagedBase): _custom_base_classes = True events = [ 'EVT_SPLITTER_SASH_POS_CHANGING', 'EVT_SPLITTER_SASH_POS_CHANGED', 'EVT_SPLITTER_UNSPLIT', 'EVT_SPLITTER_DCLICK', ] def __init__(self, name, parent, id, style, win_1, win_2, orientation, sizer, pos, property_window, show=True): """\ Class to handle wxSplitterWindow objects """ ManagedBase.__init__(self, name, 'wxSplitterWindow', parent, id, sizer, pos, property_window, show=show) self.virtual_sizer = SplitterWindowSizer(self) if style is None: style = wx.SP_3D self.style = style self.window_1 = win_1 self.window_2 = win_2 self.orientation = orientation self.sash_pos = 0 self.access_functions['style'] = (self.get_style, self.set_style) self.access_functions['sash_pos'] = (self.get_sash_pos, self.set_sash_pos) self.style_pos = ( wx.SP_3D, wx.SP_3DSASH, wx.SP_3DBORDER, #wx.SP_FULLSASH, wx.SP_BORDER, wx.SP_NOBORDER, wx.SP_PERMIT_UNSPLIT, wx.SP_LIVE_UPDATE, wx.CLIP_CHILDREN) style_labels = ( '#section#' + _('Style'), 'wxSP_3D', 'wxSP_3DSASH', 'wxSP_3DBORDER', #'wxSP_FULLSASH', 'wxSP_BORDER', 'wxSP_NOBORDER', 'wxSP_PERMIT_UNSPLIT', 'wxSP_LIVE_UPDATE', 'wxCLIP_CHILDREN') self.properties['style'] = CheckListProperty(self, 'style', None, style_labels) if self.orientation == wx.SPLIT_HORIZONTAL: od = 'wxSPLIT_HORIZONTAL' else: od = 'wxSPLIT_VERTICAL' self.access_functions['orientation'] = (self.get_orientation, self.set_orientation) self.properties['orientation'] = HiddenProperty(self, 'orientation', label=_("orientation")) self.access_functions['window_1'] = (self.get_win_1, lambda v: None) self.access_functions['window_2'] = (self.get_win_2, lambda v: None) self.properties['window_1'] = HiddenProperty(self, 'window_1') self.properties['window_2'] = HiddenProperty(self, 'window_2') self.window_1 = SizerSlot(self, self.virtual_sizer, 1) self.window_2 = SizerSlot(self, self.virtual_sizer, 2) self.properties['sash_pos'] = SpinProperty(self, 'sash_pos', None, r=(0, 20), can_disable=True, label=_("sash_pos")) self.no_custom_class = False self.access_functions['no_custom_class'] = (self.get_no_custom_class, self.set_no_custom_class) self.properties['no_custom_class'] = CheckBoxProperty( self, 'no_custom_class', label=_("Don't generate code for this custom class")) def create_widget(self): self.widget = wx.SplitterWindow(self.parent.widget, self.id, style=self.style) self.split() def finish_widget_creation(self): ManagedBase.finish_widget_creation(self, sel_marker_parent=self.widget) sp = self.properties['sash_pos'] if sp.is_active(): sp.set_value(self.sash_pos) self.widget.SetSashPosition(self.sash_pos) else: sp.set_value(self.widget.GetSashPosition()) wx.EVT_SPLITTER_SASH_POS_CHANGED(self.widget, self.widget.GetId(), self.on_sash_pos_changed) def on_set_focus(self, event): self.show_properties() # here we must call event.Skip() also on Win32 as this we should be # able to move the sash event.Skip() def create_properties(self): ManagedBase.create_properties(self) panel = wx.ScrolledWindow(self.notebook, -1, style=wx.TAB_TRAVERSAL) sizer = wx.BoxSizer(wx.VERTICAL) self.properties['no_custom_class'].display(panel) self.properties['style'].display(panel) self.properties['sash_pos'].display(panel) sizer.Add(self.properties['no_custom_class'].panel, 0, wx.ALL | wx.EXPAND, 3) sizer.Add(self.properties['style'].panel, 0, wx.EXPAND) sizer.Add(self.properties['sash_pos'].panel, 0, wx.EXPAND) panel.SetAutoLayout(True) panel.SetSizer(sizer) sizer.Fit(panel) self.notebook.AddPage(panel, 'Widget') def split(self): if not self.widget: return if self.window_1 and self.window_2: self.window_1.show_widget(True) self.window_2.show_widget(True) sp = self.properties['sash_pos'].get_value() if not self.properties['sash_pos'].is_active(): if self.orientation == wx.SPLIT_VERTICAL: max_pos = self.widget.GetClientSize()[0] else: max_pos = self.widget.GetClientSize()[1] sp = max_pos / 2 if self.orientation == wx.SPLIT_VERTICAL: self.widget.SplitVertically(self.window_1.widget, self.window_2.widget, sp) else: self.widget.SplitHorizontally(self.window_1.widget, self.window_2.widget, sp) for w in self.window_1, self.window_2: if hasattr(w, 'sel_marker'): w.sel_marker.update() def get_style(self): retval = [0] * len(self.style_pos) if not self.style: # style is wxSP_NOBORDER #retval[5] = 1 retval[4] = 1 try: for i in range(len(self.style_pos)): if self.style & self.style_pos[i]: retval[i] = 1 except AttributeError: pass if retval[1] and retval[2]: # wx.SP_3D == wx.SP_3DSASH | wx.SP_3DBORDER retval[0] = 1 retval[1] = retval[2] = 0 elif retval[1] or retval[2]: retval[0] = 0 return retval def set_style(self, value): value = self.properties['style'].prepare_value(value) self.style = 0 for v in range(len(value)): if value[v]: self.style |= self.style_pos[v] if self.widget: self.widget.SetWindowStyleFlag(self.style) def get_sash_pos(self): return self.sash_pos def set_sash_pos(self, value): try: value = int(value) except ValueError: return self.sash_pos = value if self.widget: self.widget.SetSashPosition(value) def on_size(self, event): if not self.widget: return try: if self.orientation == wx.SPLIT_VERTICAL: max_pos = self.widget.GetClientSize()[0] else: max_pos = self.widget.GetClientSize()[1] self.properties['sash_pos'].set_range(-max_pos, max_pos) if not self.properties['sash_pos'].is_active(): self.widget.SetSashPosition(max_pos / 2) self.sash_pos = self.widget.GetSashPosition() self.properties['sash_pos'].set_value(self.sash_pos) except (AttributeError, KeyError): pass ManagedBase.on_size(self, event) def on_sash_pos_changed(self, event): self.sash_pos = self.widget.GetSashPosition() self.properties['sash_pos'].set_value(self.sash_pos) event.Skip() def get_orientation(self): od = { wx.SPLIT_HORIZONTAL: 'wxSPLIT_HORIZONTAL', wx.SPLIT_VERTICAL: 'wxSPLIT_VERTICAL' } return od.get(self.orientation, 'wxSPLIT_VERTICAL') def set_orientation(self, value): od = { 'wxSPLIT_HORIZONTAL': wx.SPLIT_HORIZONTAL, 'wxSPLIT_VERTICAL': wx.SPLIT_VERTICAL } self.orientation = od.get(value, wx.SPLIT_VERTICAL) def get_win_1(self): if not isinstance(self.window_1, SizerSlot): return self.window_1.name return '' def get_win_2(self): if not isinstance(self.window_2, SizerSlot): return self.window_2.name return '' def get_no_custom_class(self): return self.no_custom_class def set_no_custom_class(self, value): self.no_custom_class = bool(int(value))
def __init__(self, name, parent, id, style, win_1, win_2, orientation, sizer, pos, property_window, show=True): """\ Class to handle wxSplitterWindow objects """ ManagedBase.__init__(self, name, 'wxSplitterWindow', parent, id, sizer, pos, property_window, show=show) self.virtual_sizer = SplitterWindowSizer(self) if style is None: style = wx.SP_3D self.style = style self.window_1 = win_1 self.window_2 = win_2 self.orientation = orientation self.sash_pos = 0 self.access_functions['style'] = (self.get_style, self.set_style) self.access_functions['sash_pos'] = (self.get_sash_pos, self.set_sash_pos) self.style_pos = ( wx.SP_3D, wx.SP_3DSASH, wx.SP_3DBORDER, #wx.SP_FULLSASH, wx.SP_BORDER, wx.SP_NOBORDER, wx.SP_PERMIT_UNSPLIT, wx.SP_LIVE_UPDATE, wx.CLIP_CHILDREN) style_labels = ( '#section#' + _('Style'), 'wxSP_3D', 'wxSP_3DSASH', 'wxSP_3DBORDER', #'wxSP_FULLSASH', 'wxSP_BORDER', 'wxSP_NOBORDER', 'wxSP_PERMIT_UNSPLIT', 'wxSP_LIVE_UPDATE', 'wxCLIP_CHILDREN') self.properties['style'] = CheckListProperty(self, 'style', None, style_labels) if self.orientation == wx.SPLIT_HORIZONTAL: od = 'wxSPLIT_HORIZONTAL' else: od = 'wxSPLIT_VERTICAL' self.access_functions['orientation'] = (self.get_orientation, self.set_orientation) self.properties['orientation'] = HiddenProperty(self, 'orientation', label=_("orientation")) self.access_functions['window_1'] = (self.get_win_1, lambda v: None) self.access_functions['window_2'] = (self.get_win_2, lambda v: None) self.properties['window_1'] = HiddenProperty(self, 'window_1') self.properties['window_2'] = HiddenProperty(self, 'window_2') self.window_1 = SizerSlot(self, self.virtual_sizer, 1) self.window_2 = SizerSlot(self, self.virtual_sizer, 2) self.properties['sash_pos'] = SpinProperty(self, 'sash_pos', None, r=(0, 20), can_disable=True, label=_("sash_pos")) self.no_custom_class = False self.access_functions['no_custom_class'] = (self.get_no_custom_class, self.set_no_custom_class) self.properties['no_custom_class'] = CheckBoxProperty( self, 'no_custom_class', label=_("Don't generate code for this custom class"))
class EditSplitterWindow(ManagedBase): _custom_base_classes = True events = [ 'EVT_SPLITTER_SASH_POS_CHANGING', 'EVT_SPLITTER_SASH_POS_CHANGED', 'EVT_SPLITTER_UNSPLIT', 'EVT_SPLITTER_DCLICK', ] def __init__(self, name, parent, id, style, win_1, win_2, orientation, sizer, pos, property_window, show=True): """\ Class to handle wxSplitterWindow objects """ ManagedBase.__init__(self, name, 'wxSplitterWindow', parent, id, sizer, pos, property_window, show=show) self.virtual_sizer = SplitterWindowSizer(self) if style is None: style = wx.SP_3D self.style = style self.window_1 = win_1 self.window_2 = win_2 self.orientation = orientation self.sash_pos = 0 self.access_functions['style'] = (self.get_style, self.set_style) self.access_functions['sash_pos'] = (self.get_sash_pos, self.set_sash_pos) self.style_pos = (wx.SP_3D, wx.SP_3DSASH, wx.SP_3DBORDER, #wx.SP_FULLSASH, wx.SP_BORDER, wx.SP_NOBORDER, wx.SP_PERMIT_UNSPLIT, wx.SP_LIVE_UPDATE, wx.CLIP_CHILDREN) style_labels = ('#section#' + _('Style'), 'wxSP_3D', 'wxSP_3DSASH', 'wxSP_3DBORDER', #'wxSP_FULLSASH', 'wxSP_BORDER', 'wxSP_NOBORDER', 'wxSP_PERMIT_UNSPLIT', 'wxSP_LIVE_UPDATE', 'wxCLIP_CHILDREN') self.properties['style'] = CheckListProperty(self, 'style', None, style_labels) if self.orientation == wx.SPLIT_HORIZONTAL: od = 'wxSPLIT_HORIZONTAL' else: od = 'wxSPLIT_VERTICAL' self.access_functions['orientation'] = (self.get_orientation, self.set_orientation) self.properties['orientation'] = HiddenProperty(self, 'orientation', label=_("orientation")) self.access_functions['window_1'] = (self.get_win_1, lambda v: None) self.access_functions['window_2'] = (self.get_win_2, lambda v: None) self.properties['window_1'] = HiddenProperty(self, 'window_1') self.properties['window_2'] = HiddenProperty(self, 'window_2') self.window_1 = SizerSlot(self, self.virtual_sizer, 1) self.window_2 = SizerSlot(self, self.virtual_sizer, 2) self.properties['sash_pos'] = SpinProperty(self, 'sash_pos', None, r=(0, 20), can_disable=True, label=_("sash_pos")) self.no_custom_class = False self.access_functions['no_custom_class'] = (self.get_no_custom_class, self.set_no_custom_class) self.properties['no_custom_class'] = CheckBoxProperty( self, 'no_custom_class', label=_("Don't generate code for this custom class")) def create_widget(self): self.widget = wx.SplitterWindow(self.parent.widget, self.id, style=self.style) self.split() def finish_widget_creation(self): ManagedBase.finish_widget_creation(self, sel_marker_parent=self.widget) sp = self.properties['sash_pos'] if sp.is_active(): sp.set_value(self.sash_pos) self.widget.SetSashPosition(self.sash_pos) else: sp.set_value(self.widget.GetSashPosition()) wx.EVT_SPLITTER_SASH_POS_CHANGED(self.widget, self.widget.GetId(), self.on_sash_pos_changed) def on_set_focus(self, event): self.show_properties() # here we must call event.Skip() also on Win32 as this we should be # able to move the sash event.Skip() def create_properties(self): ManagedBase.create_properties(self) panel = wx.ScrolledWindow(self.notebook, -1, style=wx.TAB_TRAVERSAL) sizer = wx.BoxSizer(wx.VERTICAL) self.properties['no_custom_class'].display(panel) self.properties['style'].display(panel) self.properties['sash_pos'].display(panel) sizer.Add(self.properties['no_custom_class'].panel, 0, wx.ALL|wx.EXPAND, 3) sizer.Add(self.properties['style'].panel, 0, wx.EXPAND) sizer.Add(self.properties['sash_pos'].panel, 0, wx.EXPAND) panel.SetAutoLayout(True) panel.SetSizer(sizer) sizer.Fit(panel) self.notebook.AddPage(panel, 'Widget') def split(self): if not self.widget: return if self.window_1 and self.window_2: self.window_1.show_widget(True) self.window_2.show_widget(True) sp = self.properties['sash_pos'].get_value() if not self.properties['sash_pos'].is_active(): if self.orientation == wx.SPLIT_VERTICAL: max_pos = self.widget.GetClientSize()[0] else: max_pos = self.widget.GetClientSize()[1] sp = max_pos/2 if self.orientation == wx.SPLIT_VERTICAL: self.widget.SplitVertically(self.window_1.widget, self.window_2.widget, sp) else: self.widget.SplitHorizontally(self.window_1.widget, self.window_2.widget, sp) for w in self.window_1, self.window_2: if hasattr(w, 'sel_marker'): w.sel_marker.update() def get_style(self): retval = [0] * len(self.style_pos) if not self.style: # style is wxSP_NOBORDER #retval[5] = 1 retval[4] = 1 try: for i in range(len(self.style_pos)): if self.style & self.style_pos[i]: retval[i] = 1 except AttributeError: pass if retval[1] and retval[2]: # wx.SP_3D == wx.SP_3DSASH | wx.SP_3DBORDER retval[0] = 1 retval[1] = retval[2] = 0 elif retval[1] or retval[2]: retval[0] = 0 return retval def set_style(self, value): value = self.properties['style'].prepare_value(value) self.style = 0 for v in range(len(value)): if value[v]: self.style |= self.style_pos[v] if self.widget: self.widget.SetWindowStyleFlag(self.style) def get_sash_pos(self): return self.sash_pos def set_sash_pos(self, value): try: value = int(value) except ValueError: return self.sash_pos = value if self.widget: self.widget.SetSashPosition(value) def on_size(self, event): if not self.widget: return try: if self.orientation == wx.SPLIT_VERTICAL: max_pos = self.widget.GetClientSize()[0] else: max_pos = self.widget.GetClientSize()[1] self.properties['sash_pos'].set_range(-max_pos, max_pos) if not self.properties['sash_pos'].is_active(): self.widget.SetSashPosition(max_pos/2) self.sash_pos = self.widget.GetSashPosition() self.properties['sash_pos'].set_value(self.sash_pos) except (AttributeError, KeyError): pass ManagedBase.on_size(self, event) def on_sash_pos_changed(self, event): self.sash_pos = self.widget.GetSashPosition() self.properties['sash_pos'].set_value(self.sash_pos) event.Skip() def get_orientation(self): od = { wx.SPLIT_HORIZONTAL: 'wxSPLIT_HORIZONTAL', wx.SPLIT_VERTICAL: 'wxSPLIT_VERTICAL' } return od.get(self.orientation, 'wxSPLIT_VERTICAL') def set_orientation(self, value): od = { 'wxSPLIT_HORIZONTAL': wx.SPLIT_HORIZONTAL, 'wxSPLIT_VERTICAL': wx.SPLIT_VERTICAL } self.orientation = od.get(value, wx.SPLIT_VERTICAL) def get_win_1(self): if not isinstance(self.window_1, SizerSlot): return self.window_1.name return '' def get_win_2(self): if not isinstance(self.window_2, SizerSlot): return self.window_2.name return '' def get_no_custom_class(self): return self.no_custom_class def set_no_custom_class(self, value): self.no_custom_class = bool(int(value))