def initLayout(self): ModularStatusBar(self) if self.classprefs.show_popup_status: self.popup_status = PopupStatusBar(self) else: self.popup_status = None hsplit = wx.BoxSizer(wx.HORIZONTAL) self.SetAutoLayout(True) self.SetSizer(hsplit) self.spring = SpringTabs(self) # tell FrameManager to manage this frame self._mgr = aui.AuiManager() self._mgr.SetManagedWindow(self) self.tabs = FrameNotebook(self) self._mgr.AddPane(self.tabs, aui.AuiPaneInfo().Name("notebook").CenterPane()) self.sidebar_panes = [] # paneinfo can use the C++ style notation for setting flags because # each method of AuiPaneInfo returns itself paneinfo = aui.AuiPaneInfo().Name("SpringTabs").Caption( "SpringTabs").Left().Layer(10).CloseButton(False).CaptionVisible( False).LeftDockable(False).RightDockable(False) # Stock wxPython distributed with OS X 10.5 is version 2.8.4.0, which # apparently doesn't have the DockFixed method. So, I check for that # here before using it. if hasattr(paneinfo, 'DockFixed'): paneinfo.DockFixed() self._mgr.AddPane(self.spring, paneinfo)
def getDefaultPaneInfo(self, caption=None): """Convenience method to create an AuiPaneInfo object. AuiPaneInfo objects are used by the L{BufferFrame} to position the new subwindow within the managed area of the major mode. This hooks into the class settings (through the MinorMode's subclassing of ClassSettings) to allow the user to specify the initial size of the minor mode. @param caption: text string that will become the caption bar of the Aui-managed window. """ if caption is None: caption = self.keyword paneinfo = aui.AuiPaneInfo().Name(self.keyword).Caption(caption) try: # Turn the string 'top', 'right', 'bottom' or 'left' into the # function that will place the pane on that side of the main # window. The function name is just the string with the first # letter capitalized side = self.classprefs.side.title() func = getattr(paneinfo, side) func() except Exception, e: # default to place on the right side paneinfo.Right()
def updateToolbarActions(self, auimgr): needed = {} for title, items in self.class_list.menus.iteritems(): if title == 'root': # Ignore the root menu -- it only contains other menus continue # Change the toolbar title to only the first title -- # e.g. rather than splitting up File and File/Submenu into # two toolbars, all of the File toolbars are kept together title = title.split('/')[0] for weight, actioncls, separator in items: if isinstance(actioncls, str): # Ignore submenu definitions -- toolbars don't have subtoolbars pass elif actioncls.icon is not None and actioncls.default_toolbar: action = self.getAction(actioncls) # Delay construction of toolbars until now, when # we know that the toolbar is needed if title not in needed: needed[title] = True if title not in self.title_to_toolbar: tb = wx.ToolBar(self.frame, -1, wx.DefaultPosition, wx.DefaultSize, wx.TB_FLAT | wx.TB_NODIVIDER) tb.SetToolBitmapSize(wx.Size(16,16)) self.title_to_toolbar[title] = tb self.dprint(tb) toolbar = self.title_to_toolbar[title] if separator and toolbar.GetToolsCount() > 0: toolbar.AddSeparator() action.insertIntoToolbar(toolbar, self) action.showEnable() if hasattr(action, 'updateToolOnDemand'): self.toolbar_ondemand_actions.append(action) action.updateToolOnDemand() else: self.toolbar_actions.append(action) order = [] # Use order of the menubar to determine order of the toolbar for weight, title, separator in self.class_list.menus['root']: if title in needed: order.append(title) for title in order: tb = self.title_to_toolbar[title] tb.Realize() self.dprint("Realized %s: %s" % (title, tb)) auimgr.AddPane(tb, aui.AuiPaneInfo(). Name(title).Caption(title). ToolbarPane().Top(). LeftDockable(False).RightDockable(False))
def getDefaultPaneInfo(self): """Factory method to return pane info. Most sidebars won't need to override this, but it is available in the case that it is necessary. A aui.AuiPaneInfo object should be returned. """ paneinfo = aui.AuiPaneInfo().Name(self.keyword).Caption(self.caption) paneinfo.BestSize( wx.Size(self.classprefs.best_width, self.classprefs.best_height)) paneinfo.MinSize( wx.Size(self.classprefs.min_width, self.classprefs.min_height)) paneinfo.Show(self.classprefs.show) return paneinfo