示例#1
0
 def _create_form(self):
     # Vytvoř rozdělené okno
     self._splitter = splitter = wx.SplitterWindow(self._parent, -1)
     wx_callback(wx.EVT_SPLITTER_DOUBLECLICKED, splitter,
                 splitter.GetId(), lambda e: True)
     wx_callback(wx.EVT_SPLITTER_SASH_POS_CHANGED, splitter,
                 splitter.GetId(), self._on_sash_changed)
     # Vytvoř formuláře
     self._main_form = self._create_main_form(splitter, **self._unprocessed_kwargs)
     self._side_form = self._create_side_form(splitter)
     orientation = self._initial_orientation()
     if orientation == Orientation.HORIZONTAL:
         splitter.SplitHorizontally(self._main_form, self._side_form)
     elif orientation == Orientation.VERTICAL:
         splitter.SplitVertically(self._main_form, self._side_form)
     else:
         raise ProgramError("Invalid dual form orientation: %r" % orientation)
     if isinstance(self._main_form, EditForm):
         gravity = 0
     elif isinstance(self._side_form, EditForm):
         gravity = 1
     elif orientation == Orientation.HORIZONTAL:
         gravity = 0.5
     else:
         gravity = 0
     splitter.SetSashGravity(gravity)
     splitter.SetMinimumPaneSize(80)
     # Setting a minimal size here is a hack to avoid wx/gtk hanging when
     # the splitter size becomes too small.  It is unknown what actually
     # causes the hang, but 180x180 seems to be the lowest minimal size
     # which avoids it.
     splitter.SetMinSize((180, 180))
     self._select_form(self._main_form)
     self._set_main_form_callbacks()
     self._set_side_form_callbacks()
示例#2
0
    def _full_init(self, *args, **kwargs):
        """Inicializuj duální formulář.

        Argumenty jsou stejné jako v předkovi, specifikují však hlavní formulář
        duálního formuláře.
        
        """
        super(DualForm, self)._full_init(*args, **kwargs)
        wx_callback(wx.EVT_SET_FOCUS, self, lambda e: self.focus())
        wx_callback(wx.EVT_SIZE, self, self._on_size)
示例#3
0
    def _full_init(self, *args, **kwargs):
        """Inicializuj duální formulář.

        Argumenty jsou stejné jako v předkovi, specifikují však hlavní formulář
        duálního formuláře.
        
        """
        super(DualForm, self)._full_init(*args, **kwargs)
        wx_callback(wx.EVT_SET_FOCUS, self, lambda e: self.focus())
        wx_callback(wx.EVT_SIZE, self, self._on_size)
示例#4
0
 def _create_form(self):
     # Vytvoř rozdělené okno
     self._splitter = splitter = wx.SplitterWindow(self._parent, -1)
     wx_callback(wx.EVT_SPLITTER_DOUBLECLICKED, splitter, splitter.GetId(),
                 lambda e: True)
     wx_callback(wx.EVT_SPLITTER_SASH_POS_CHANGED, splitter,
                 splitter.GetId(), self._on_sash_changed)
     # Vytvoř formuláře
     self._main_form = self._create_main_form(splitter,
                                              **self._unprocessed_kwargs)
     self._side_form = self._create_side_form(splitter)
     orientation = self._initial_orientation()
     if orientation == Orientation.HORIZONTAL:
         splitter.SplitHorizontally(self._main_form, self._side_form)
     elif orientation == Orientation.VERTICAL:
         splitter.SplitVertically(self._main_form, self._side_form)
     else:
         raise ProgramError("Invalid dual form orientation: %r" %
                            orientation)
     if isinstance(self._main_form, EditForm):
         gravity = 0
     elif isinstance(self._side_form, EditForm):
         gravity = 1
     elif orientation == Orientation.HORIZONTAL:
         gravity = 0.5
     else:
         gravity = 0
     splitter.SetSashGravity(gravity)
     splitter.SetMinimumPaneSize(80)
     # Setting a minimal size here is a hack to avoid wx/gtk hanging when
     # the splitter size becomes too small.  It is unknown what actually
     # causes the hang, but 180x180 seems to be the lowest minimal size
     # which avoids it.
     splitter.SetMinSize((180, 180))
     self._select_form(self._main_form)
     self._set_main_form_callbacks()
     self._set_side_form_callbacks()
示例#5
0
 def _create_form(self):
     import wx.aui
     self._notebook = nb = wx.aui.AuiNotebook(self, style=(wx.aui.AUI_NB_TOP |
                                                           wx.aui.AUI_NB_TAB_MOVE |
                                                           wx.aui.AUI_NB_SCROLL_BUTTONS |
                                                           wx.aui.AUI_NB_WINDOWLIST_BUTTON))
     self._forms = forms = []
     for title, form in self._create_forms(nb):
         forms.append(form)
         if form is None:
             form = wx.Panel(nb)
         nb.AddPage(form, title)
     # Select the first available form.
     self._last_selection = None
     for i, form in enumerate(forms):
         if form:
             self._set_notebook_selection(i)
             break
     # Keep a list of tab indexes corresponding to their visual order in the
     # notebook tab list.  This order is updated on each tab move.  This
     # gives us information about the order of tabs, because the indexes
     # used by wx.aui.AuiNotebook don't change when the tabs are moved
     # around by dragging.  The list includes notebook page indexes (which
     # are also self._forms indexes) in the order of visual appearance of
     # the corresponding notebook tabs.
     self._tab_order = range(len(forms))
     tabctrl = [child for child in nb.GetChildren() if isinstance(child, wx.aui.AuiTabCtrl)][0]
     wx_callback(wx.EVT_LEFT_DOWN, tabctrl, self._on_mouse_left)
     wx_callback(wx.aui.EVT_AUINOTEBOOK_PAGE_CHANGING, nb, nb.GetId(), self._on_page_change)
     wx_callback(wx.aui.EVT_AUINOTEBOOK_BEGIN_DRAG, tabctrl, tabctrl.GetId(),
                 self._on_tab_move_started)
     wx_callback(wx.aui.EVT_AUINOTEBOOK_DRAG_DONE, nb, nb.GetId(), self._on_tab_move_done)
     try:
         tab_right_down = wx.aui.EVT_AUINOTEBOOK_TAB_RIGHT_DOWN
     except:
         tab_right_down = wx.aui.EVT__AUINOTEBOOK_TAB_RIGHT_DOWN
     wx_callback(tab_right_down, nb, nb.GetId(), self._on_tab_mouse_right)
     wx_callback(wx.EVT_RIGHT_DOWN, nb, self._on_notebook_mouse_right)
     wx_callback(wx.EVT_SET_FOCUS, self, lambda e: self.focus())
     wx_callback(wx.EVT_SIZE, self, self._on_size)
示例#6
0
 def _create_form(self):
     import wx.aui
     self._notebook = nb = wx.aui.AuiNotebook(
         self,
         style=(wx.aui.AUI_NB_TOP | wx.aui.AUI_NB_TAB_MOVE
                | wx.aui.AUI_NB_SCROLL_BUTTONS
                | wx.aui.AUI_NB_WINDOWLIST_BUTTON))
     self._forms = forms = []
     for title, form in self._create_forms(nb):
         forms.append(form)
         if form is None:
             form = wx.Panel(nb)
         nb.AddPage(form, title)
     # Select the first available form.
     self._last_selection = None
     for i, form in enumerate(forms):
         if form:
             self._set_notebook_selection(i)
             break
     # Keep a list of tab indexes corresponding to their visual order in the
     # notebook tab list.  This order is updated on each tab move.  This
     # gives us information about the order of tabs, because the indexes
     # used by wx.aui.AuiNotebook don't change when the tabs are moved
     # around by dragging.  The list includes notebook page indexes (which
     # are also self._forms indexes) in the order of visual appearance of
     # the corresponding notebook tabs.
     self._tab_order = range(len(forms))
     tabctrl = [
         child for child in nb.GetChildren()
         if isinstance(child, wx.aui.AuiTabCtrl)
     ][0]
     wx_callback(wx.EVT_LEFT_DOWN, tabctrl, self._on_mouse_left)
     wx_callback(wx.aui.EVT_AUINOTEBOOK_PAGE_CHANGING, nb, nb.GetId(),
                 self._on_page_change)
     wx_callback(wx.aui.EVT_AUINOTEBOOK_BEGIN_DRAG, tabctrl,
                 tabctrl.GetId(), self._on_tab_move_started)
     wx_callback(wx.aui.EVT_AUINOTEBOOK_DRAG_DONE, nb, nb.GetId(),
                 self._on_tab_move_done)
     try:
         tab_right_down = wx.aui.EVT_AUINOTEBOOK_TAB_RIGHT_DOWN
     except:
         tab_right_down = wx.aui.EVT__AUINOTEBOOK_TAB_RIGHT_DOWN
     wx_callback(tab_right_down, nb, nb.GetId(), self._on_tab_mouse_right)
     wx_callback(wx.EVT_RIGHT_DOWN, nb, self._on_notebook_mouse_right)
     wx_callback(wx.EVT_SET_FOCUS, self, lambda e: self.focus())
     wx_callback(wx.EVT_SIZE, self, self._on_size)