예제 #1
0
    def __populateFiles(self):
        """Populates the recent files"""
        self.recentFilesView.clear()
        for path in getRecentFiles():
            self.recentFilesView.addTopLevelItem(RecentFileViewItem(path))

        self.__sortFiles()
        self.__resizeFileColumns()
        self.__updateFileToolbarButtons()
예제 #2
0
    def __tabAboutToShow(self):
        """Triggered when tab menu is about to show"""
        plainTextBuffer = self.__isPlainTextBuffer()
        isPythonBuffer = self._isPythonBuffer()
        isGeneratedDiagram = self.__isGeneratedDiagram()
        isProfileViewer = self.__isProfileViewer()

        self.__cloneTabAct.setEnabled(plainTextBuffer)
        self.__closeOtherTabsAct.setEnabled(self.em.closeOtherAvailable())
        self.__saveFileAct.setEnabled(
            plainTextBuffer or isGeneratedDiagram or isProfileViewer)
        self.__saveFileAsAct.setEnabled(
            plainTextBuffer or isGeneratedDiagram or isProfileViewer)
        self.__closeTabAct.setEnabled(self.em.isTabClosable())
        self.__tabJumpToDefAct.setEnabled(isPythonBuffer)
        self.__calltipAct.setEnabled(isPythonBuffer)
        self.__tabJumpToScopeBeginAct.setEnabled(isPythonBuffer)
        self.__tabOpenImportAct.setEnabled(isPythonBuffer)
        if plainTextBuffer:
            editor = self.em.currentWidget().getEditor()
            self.__openAsFileAct.setEnabled(editor.openAsFileAvailable())
            self.__downloadAndShowAct.setEnabled(
                editor.downloadAndShowAvailable())
            self.__openInBrowserAct.setEnabled(
                editor.downloadAndShowAvailable())
        else:
            self.__openAsFileAct.setEnabled(False)
            self.__downloadAndShowAct.setEnabled(False)
            self.__openInBrowserAct.setEnabled(False)

        self.__highlightInPrjAct.setEnabled(
            self.em.isHighlightInPrjAvailable())
        self.__highlightInFSAct.setEnabled(
            self.em.isHighlightInFSAvailable())
        self.__highlightInOutlineAct.setEnabled(isPythonBuffer)

        self.__closeTabAct.setShortcut("Ctrl+F4")
        self.__tabJumpToDefAct.setShortcut("Ctrl+\\")
        self.__calltipAct.setShortcut("Ctrl+/")
        self.__tabJumpToScopeBeginAct.setShortcut("Alt+U")
        self.__tabOpenImportAct.setShortcut("Ctrl+I")
        self.__highlightInOutlineAct.setShortcut("Ctrl+B")

        self.__recentFilesMenu.clear()
        addedCount = 0

        for item in getRecentFiles():
            addedCount += 1
            act = self.__recentFilesMenu.addAction(
                getAccelerator(addedCount) + item)
            act.setData(item)
            act.setEnabled(os.path.exists(item))

        self.__recentFilesMenu.setEnabled(addedCount > 0)