示例#1
0
    def Init(self, parent):
        """Mixes the shelf into the parent window
        @param parent: Reference to MainWindow

        """
        # First check if the parent has an instance already
        self._parent = parent
        mgr = parent.GetFrameManager()
        if mgr.GetPane(Shelf.SHELF_NAME).IsOk():
            return

        self._shelf = FNB.FlatNotebook(parent,
                                       style=FNB.FNB_FF2 |
                                             FNB.FNB_X_ON_TAB |
                                             FNB.FNB_BACKGROUND_GRADIENT |
                                             FNB.FNB_NODRAG |
                                             FNB.FNB_BOTTOM |
                                             FNB.FNB_NO_X_BUTTON)
        self._shelf.SetImageList(self._imglst)
        mgr.AddPane(self._shelf, wx.aui.AuiPaneInfo().Name(Shelf.SHELF_NAME).\
                            Caption("Shelf").Bottom().Layer(0).\
                            CloseButton(True).MaximizeButton(False).\
                            BestSize(wx.Size(500,250)))

        # Hide the pane and let the perspective manager take care of it
        mgr.GetPane(Shelf.SHELF_NAME).Hide()
        mgr.Update()

        # Install Shelf menu under View and bind event handlers
        view = parent.GetMenuBar().GetMenuByName("view")
        menu = self._GetMenu()
        pos = 0
        for pos in xrange(view.GetMenuItemCount()):
            mitem = view.FindItemByPosition(pos)
            if mitem.GetId() == ed_glob.ID_PERSPECTIVES:
                break

        view.InsertMenu(pos + 1, ed_glob.ID_SHELF, _("Shelf"), 
                        menu, _("Put an item on the Shelf"))

        for item in menu.GetMenuItems():
            if item.IsSeparator():
                continue
            parent.Bind(wx.EVT_MENU, self.OnGetShelfItem, item)

        if menu.GetMenuItemCount() < 3:
            view.Enable(ed_glob.ID_SHELF, False)

        # Check for any other plugin specific install needs
        for observer in self.observers:
            if not observer.IsInstalled() and \
               hasattr(observer, 'InstallComponents'):
                observer.InstallComponents(parent)

        self.StockShelf(Profile_Get('SHELF_ITEMS', 'list', []))
示例#2
0
    def Init(self, parent):
        """Mixes the shelf into the parent window
        @param parent: Reference to MainWindow

        """
        # First check if the parent has an instance already
        self._parent = parent
        mgr = parent.GetFrameManager()
        if mgr.GetPane(self.__name__).IsOk():
            return

        self._shelf = FNB.FlatNotebook(parent,
                                       style=FNB.FNB_FF2 | \
                                             FNB.FNB_X_ON_TAB | \
                                             FNB.FNB_BACKGROUND_GRADIENT | \
                                             FNB.FNB_NODRAG)
        mgr.AddPane(self._shelf, wx.aui.AuiPaneInfo().Name(self.__name__).\
                            Caption("Shelf").Bottom().Layer(0).\
                            CloseButton(True).MaximizeButton(False).\
                            BestSize(wx.Size(500,250)))

        # Hide the pane and let the perspective manager take care of it
        mgr.GetPane(self.__name__).Hide()
        mgr.Update()

        # Install Menu and bind event handler
        view = parent.GetMenuBar().GetMenuByName("view")
        menu = self._GetMenu()
        pos = 0
        for pos in xrange(view.GetMenuItemCount()):
            mitem = view.FindItemByPosition(pos)
            if mitem.GetId() == ed_glob.ID_PERSPECTIVES:
                break
        view.InsertMenu(pos + 1, ed_glob.ID_SHELF, self.__name__, menu,
                        _("Put an item on the Shelf"))
        for item in menu.GetMenuItems():
            if item.IsSeparator():
                continue
            parent.Bind(wx.EVT_MENU, self.OnGetShelfItem, item)

        if menu.GetMenuItemCount() < 3:
            view.Enable(ed_glob.ID_SHELF, False)

        self.StockShelf(Profile_Get('SHELF_ITEMS', 'list', []))