Пример #1
0
    def loadExternalLaunchers(self):
        self.launcherMenu.clear()
        self.listWidget.clear()
        if len(self.externalLaunchList) > 0:
            self.actionGroup = QtWidgets.QActionGroup(self)
            self.actionGroup.triggered.connect(
                self.launcherActivated)
            for path, param in self.externalLaunchList.items():
                action = QtWidgets.QAction(Global.iconFromPath(path), path, self)
                self.actionGroup.addAction(action)
                self.launcherMenu.addAction(action)

                item = QtWidgets.QListWidgetItem(Global.iconFromPath(path), path)
                item.setToolTip(path)
                self.listWidget.addItem(item)

            self.launcherMenu.addSeparator()
            self.launcherMenu.addAction(self.manageLauncherAct)
        else:
            self.launcherMenu.addAction(self.manageLauncherAct)

        if len(self.externalLaunchList) == 0:
            self.removeButton.setDisabled(True)
        else:
            self.removeButton.setDisabled(False)
Пример #2
0
 def defaultFont(self, style):
     if style == self.Default:
         return Global.getDefaultFont()
     elif style == self.NewText:
         return Global.getDefaultFont()
     elif style == self.DeletedText:
         return Global.getDefaultFont()
     elif style == self.ReplacedText:
         return Global.getDefaultFont()
     elif style == self.LineNumber:
         return Global.getDefaultFont()
     return QsciLexerCustom.defaultFont(self, style)
Пример #3
0
 def defaultFont(self, style):
     if style == self.Default:
         return Global.getDefaultFont()
     elif style == self.ErrorInfo:
         return Global.getDefaultFont()
     elif style == self.OutputInfo:
         return Global.getDefaultFont()
     elif style == self.ExitInfo:
         return Global.getDefaultFont()
     elif style == self.Start:
         return Global.getDefaultFont()
     return QsciLexerCustom.defaultFont(self, style)
Пример #4
0
    def updateSearchTree(self, resultsDict):
        self.progressBar.hide()
        self.searchResultsTree.clear()
        self.viewStack.setCurrentIndex(1)
        if len(resultsDict) > 0:
            for folder, fileList in resultsDict.items():
                folderItem = QtWidgets.QTreeWidgetItem(self.searchResultsTree)
                pathRelativeToProject = folder.partition(
                    self.root + os.path.sep)[-1]
                folderItem.setText(0, pathRelativeToProject)
                folderItem.setForeground(0, QtGui.QBrush(
                    QtGui.QColor("#003366")))
                for i in fileList:
                    fileItem = QtWidgets.QTreeWidgetItem(folderItem)
                    icon = Global.iconFromPath(os.path.join(folder, i))
                    fileItem.setText(0, i)
                    fileItem.setIcon(0, QtGui.QIcon(icon))
                folderItem.setExpanded(True)

            item = self.searchResultsTree.topLevelItem(0)
            self.searchResultsTree.setCurrentItem(item.child(0))
        else:
            folderItem = QtWidgets.QTreeWidgetItem()
            item = QtWidgets.QTreeWidgetItem()
            item.setText(0, "<No results found>")
            item.setFlags(QtCore.Qt.NoItemFlags)
            folderItem.addChild(item)
            self.searchResultsTree.addTopLevelItem(folderItem)
            folderItem.setExpanded(True)
Пример #5
0
    def __init__(self, useData, colorScheme, fileType, parent=None):
        BaseScintilla.__init__(self, parent)

        self.setFont(Global.getDefaultFont())
        self.setMarginLineNumbers(0, True)
        self.createContextMenu()

        self.DATA = {"fileType": fileType}
        self.setObjectName("editor")
        self.enableMarkOccurrence(useData)

        self.colorScheme = colorScheme
        self.colorScheme.styleEditor(self)
Пример #6
0
    def __init__(self,
                 useData,
                 DATA,
                 colorScheme,
                 editorTabWidget,
                 encoding=None,
                 parent=None):
        BaseScintilla.__init__(self, parent)

        self.useData = useData
        self.encoding = encoding
        self.DATA = DATA
        self.colorScheme = colorScheme
        self.editorTabWidget = editorTabWidget

        self.setObjectName("editor")
        self.enableMarkOccurrence(useData)

        self.setFont(Global.getDefaultFont())
        self.setWrapMode(QsciScintilla.WrapWord)

        mainLayout = QtWidgets.QVBoxLayout()
        mainLayout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(mainLayout)

        mainLayout.addStretch(1)

        #

        hbox = QtWidgets.QHBoxLayout()
        hbox.addStretch(1)
        hbox.setContentsMargins(0, 0, 20, 0)
        mainLayout.addLayout(hbox)

        self.zoomWidget = ZoomWidget(self.useData, self)
        hbox.addWidget(self.zoomWidget)

        #

        hbox = QtWidgets.QHBoxLayout()
        hbox.addStretch(1)
        hbox.setContentsMargins(5, 0, 20, 20)
        mainLayout.addLayout(hbox)

        self.notification = Notification()
        hbox.addWidget(self.notification)
        self.notification.hide()

        #

        self.createContextMenu()

        # setup
        # define the font to use
        self.font = Global.getDefaultFont()
        self.font.setFixedPitch(True)
        self.font.setPointSize(10)
        # the font metrics here will help
        # building the margin width later
        self.fontMetrics = QtGui.QFontMetrics(self.font)

        # Line numbers
        # conventionnaly, margin 0 is for line numbers
        self.setMarginWidth(0, self.fontMetrics.width("0000") + 5)

        self.setUtf8(True)
        self.setAutoIndent(True)
        self.setIndentationsUseTabs(False)
        self.setBackspaceUnindents(True)
        self.setIndentationWidth(4)
        self.setTabWidth(4)
        # Clickable margin 1 for showing markers
        self.setMarginSensitivity(1, True)

        # Braces matching
        if self.useData.SETTINGS["MatchBraces"] == "True":
            self.setBraceMatching(QsciScintilla.SloppyBraceMatch)

        if self.DATA["fileType"] in self.useData.supportedFileTypes:
            if self.useData.SETTINGS["ShowCaretLine"] == 'True':
                self.setCaretLineVisible(True)

        self.setAutoCompletionReplaceWord(True)
        # minimum number of letters to be typed before list is displayed
        self.setAutoCompletionThreshold(2)

        self.setEdgeMode(QsciScintilla.EdgeNone)
        self.showWhiteSpaces()

        # Margins colors
        # line numbers margin
        self.setMarginsBackgroundColor(QtGui.QColor("#FFFFFF"))
        self.setMarginsForegroundColor(QtGui.QColor("#666666"))

        # define markers

        self.markerDefine(
            QtGui.QPixmap(
                os.path.join("Resources", "images", "ui-button-navigation")),
            8)
        self.setMarkerBackgroundColor(QtGui.QColor("#ee1111"), 8)

        self.markerDefine(
            QtGui.QPixmap(os.path.join("Resources", "images", "err_mark")), 9)
        self.setMarkerBackgroundColor(QtGui.QColor("#ee1111"), 9)

        self.markerDefine(
            QtGui.QPixmap(os.path.join("Resources", "images", "brk_point")),
            10)
        self.setMarkerBackgroundColor(QtGui.QColor("#ee1111"), 10)

        self.showLineNumbers()
        self.setAutoCompletionSource(QsciScintilla.AcsDocument)

        self.setEolMode(QsciScintilla.EolUnix)

        self.searchIndicator = self.indicatorDefine(
            QsciScintilla.INDIC_ROUNDBOX, 10)
        self.setIndicatorForegroundColor(QtGui.QColor("#FFDB4A"),
                                         self.searchIndicator)
        self.setIndicatorDrawUnder(True, self.searchIndicator)

        self.setAutoCompletion()

        self.copyAvailableTimer = QtCore.QTimer()
        self.copyAvailableTimer.setSingleShot(True)
        self.copyAvailableTimer.setInterval(0)
        self.copyAvailableTimer.timeout.connect(self.copyActModifier)

        self.copyAvailable.connect(self.copyAvailableTimer.start)

        self.textChangedTimer = QtCore.QTimer()
        self.textChangedTimer.setSingleShot(True)
        self.textChangedTimer.setInterval(0)
        self.textChangedTimer.timeout.connect(self.undoActModifier)
        self.textChangedTimer.timeout.connect(self.redoActModifier)

        self.textChanged.connect(self.textChangedTimer.start)
        self.linesChanged.connect(self.updateLineCount)
        self.marginClicked.connect(self.toggleBookmark)

        self.lexer = self.colorScheme.styleEditor(self)
        self.setStyleSheet(StyleSheet.editorStyle)

        self.setKeymap()
Пример #7
0
    def __init__(self,
                 bottomStackSwitcher,
                 projectData,
                 useData,
                 editorTabWidget,
                 vSplitter,
                 runProjectAct,
                 stopRunAct,
                 runFileAct,
                 parent=None):
        BaseScintilla.__init__(self, parent)

        self.projectData = projectData
        self.runProjectAct = runProjectAct
        self.stopRunAct = stopRunAct
        self.runFileAct = runFileAct
        self.editorTabWidget = editorTabWidget
        self.parent = parent
        self.vSplitter = vSplitter
        self.bottomStackSwitcher = bottomStackSwitcher
        self.useData = useData

        self.profileMode = False
        self.tracebackRe = re.compile(r'(\s)*File "(.*?)", line \d.+')

        self.setMarginWidth(1, 0)
        self.toggleInsertOrOvertype()

        self.linkIndicator = self.indicatorDefine(QsciScintilla.INDIC_PLAIN, 8)
        self.setIndicatorForegroundColor(QtGui.QColor("#474747"),
                                         self.linkIndicator)
        self.setIndicatorDrawUnder(True, self.linkIndicator)

        self.lexer = OutputLexer(self)
        self.setLexer(self.lexer)
        self.setFont(Global.getDefaultFont())
        self.openMode = QtCore.QIODevice.ReadWrite
        self.currentProcess = None

        self.setCaretForegroundColor(QtGui.QColor("#ffffff"))
        self.setWrapMode(QsciScintilla.WrapWord)
        self.setSelectionBackgroundColor(QtGui.QColor("#391EE8"))
        self.setSelectionForegroundColor(QtGui.QColor("#FFFFFF"))

        self.runProcess = QtCore.QProcess(self)
        self.runProcess.error.connect(self.writeProcessError)
        self.runProcess.stateChanged.connect(self.stateChanged)
        self.runProcess.readyReadStandardOutput.connect(self.writeOutput)
        self.runProcess.readyReadStandardError.connect(self.writeError)
        self.runProcess.started.connect(self.processStarted)
        self.runProcess.finished.connect(self.writeExitStatus)
        self.runProcess.finished.connect(self.processEnded)

        self.copyAct = QtWidgets.QAction("Copy",
                                         self,
                                         statusTip="Copy",
                                         triggered=self.copyText)
        self.contextMenu = QtWidgets.QMenu()
        self.contextMenu.addAction(self.copyAct)

        self.setReadOnly(True)
        self.blocking_cursor_pos = (0, 0)

        self.setStyleSheet("QsciScintilla {border: none;}")