コード例 #1
0
    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])
コード例 #2
0
 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
コード例 #3
0
    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)
コード例 #4
0
 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)
コード例 #5
0
ファイル: splitter_window.py プロジェクト: italomaia/spe
 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()
コード例 #6
0
ファイル: notebook.py プロジェクト: NonPlayerCtrl/FreePLC_IDE
 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)
コード例 #7
0
 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)
コード例 #8
0
 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
コード例 #9
0
    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
コード例 #10
0
ファイル: splitter_window.py プロジェクト: italomaia/spe
    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"))