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 = QtGui.QAction("Copy", self, statusTip="Copy", triggered=self.copyText) self.contextMenu = QtGui.QMenu() self.contextMenu.addAction(self.copyAct) self.setReadOnly(True) self.blocking_cursor_pos = (0, 0) self.setStyleSheet("QsciScintilla {border: none;}")
def __init__(self, colorScheme, parent=None): BaseScintilla.__init__(self, parent) self.colorScheme = colorScheme self.DATA = {"fileType": "python"} self.createContextMenu() self.setStyleSheet(StyleSheet.editorStyle) self.colorScheme.styleEditor(self) self.setMarginLineNumbers(0, True)
def __init__(self, useData, colorScheme, parent=None): BaseScintilla.__init__(self, parent) self.colorScheme = colorScheme self.DATA = {"fileType": "python"} self.setObjectName("editor") self.enableMarkOccurrence(useData) self.createContextMenu() self.colorScheme.styleEditor(self) self.setMarginLineNumbers(0, True)
def __init__(self, colorScheme, fileType, parent=None): BaseScintilla.__init__(self, parent) self.setFont(Global.getDefaultFont()) self.setMarginLineNumbers(0, True) self.createContextMenu() self.DATA = {"fileType": fileType} self.colorScheme = colorScheme self.colorScheme.styleEditor(self) self.setStyleSheet(StyleSheet.editorStyle)
def __init__(self, parent=None): BaseScintilla.__init__(self, parent) self.setReadOnly(True) self.setMarginLineNumbers(0, True) self.setCaretLineVisible(True) self.DATA = {"fileType": "python"} self.setStyleSheet(""" QsciScintilla { border: none; border-top: 1px solid grey; } """)
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.setFont(Global.getDefaultFont()) self.setWrapMode(QsciScintilla.WrapWord) mainLayout = QtGui.QVBoxLayout() mainLayout.setMargin(0) self.setLayout(mainLayout) mainLayout.addStretch(1) # hbox = QtGui.QHBoxLayout() hbox.addStretch(1) hbox.setContentsMargins(0, 0, 20, 0) mainLayout.addLayout(hbox) self.zoomWidget = ZoomWidget(self.useData, self) hbox.addWidget(self.zoomWidget) # hbox = QtGui.QHBoxLayout() hbox.addStretch(1) hbox.setContentsMargins(5, 0, 20, 20) mainLayout.addLayout(hbox) self.notify = Notification() hbox.addWidget(self.notify) self.notify.hide() # self.createContextMenu() self.setStyleSheet(StyleSheet.editorStyle) self.setAttribute(QtCore.Qt.WA_DeleteOnClose) # 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) if self.encoding is None: 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.matchIndicator = self.indicatorDefine(QsciScintilla.INDIC_BOX, 9) self.setIndicatorForegroundColor(QtGui.QColor("#FFCC00"), self.matchIndicator) self.setIndicatorDrawUnder(True, self.matchIndicator) 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.install_shortcuts()
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.setFont(Global.getDefaultFont()) self.setWrapMode(QsciScintilla.WrapWord) mainLayout = QtGui.QVBoxLayout() mainLayout.setMargin(0) self.setLayout(mainLayout) mainLayout.addStretch(1) # hbox = QtGui.QHBoxLayout() hbox.addStretch(1) hbox.setContentsMargins(0, 0, 20, 0) mainLayout.addLayout(hbox) self.zoomWidget = ZoomWidget(self.useData, self) hbox.addWidget(self.zoomWidget) # hbox = QtGui.QHBoxLayout() hbox.addStretch(1) hbox.setContentsMargins(5, 0, 20, 20) mainLayout.addLayout(hbox) self.notify = Notification() hbox.addWidget(self.notify) self.notify.hide() # self.createContextMenu() self.setStyleSheet(StyleSheet.editorStyle) self.setAttribute(QtCore.Qt.WA_DeleteOnClose) # 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) if self.encoding is None: 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.matchIndicator = self.indicatorDefine(QsciScintilla.INDIC_BOX, 9) self.setIndicatorForegroundColor( QtGui.QColor("#FFCC00"), self.matchIndicator) self.setIndicatorDrawUnder(True, self.matchIndicator) 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.install_shortcuts()
def __init__(self, useData, refactor, colorScheme, DATA, editorTabWidget, parent=None): BaseScintilla.__init__(self, parent) self.useData = useData self.refactor = refactor self.DATA = DATA self.colorScheme = colorScheme self.editorTabWidget = editorTabWidget self.setObjectName("editor") self.enableMarkOccurrence(useData) self.setMouseTracking(True) self.middleMousePressed = False self.mousePosition = QtCore.QPointF() self.autoCompletionThread = AutoCompletionThread() self.autoCompletionThread.completionsAvailable.connect(self.showCompletions) self.docThread = DocThread() self.docThread.docAvailable.connect( self.showDoc) self.docThreadTimer = QtCore.QTimer() self.docThreadTimer.setSingleShot(True) self.docThreadTimer.timeout.connect(self.getDoc) self.tokenizeThread = TokenizeThread() self.tokenizeThread.finished.connect( self.displayTokenLines) self.tokenizeTimer = QtCore.QTimer() self.tokenizeTimer.setSingleShot(True) self.tokenizeTimer.timeout.connect(self.getOperationTokens) self.completionThreadTimer = QtCore.QTimer() self.completionThreadTimer.setSingleShot(True) self.completionThreadTimer.timeout.connect(self.startCompletion) mainLayout = QtGui.QVBoxLayout() mainLayout.setMargin(0) self.setLayout(mainLayout) mainLayout.addStretch(1) # hbox = QtGui.QHBoxLayout() hbox.addStretch(1) hbox.setContentsMargins(0, 0, 20, 0) mainLayout.addLayout(hbox) self.zoomWidget = ZoomWidget(self.useData, self) hbox.addWidget(self.zoomWidget) # hbox = QtGui.QHBoxLayout() hbox.addStretch(1) hbox.setContentsMargins(5, 0, 10, 20) mainLayout.addLayout(hbox) self.notification = Notification() hbox.addWidget(self.notification) self.notification.hide() # self.createActions() self.setAutoCompletion() " Initialises indicators " self.syntaxErrorIndicator = self.indicatorDefine( QsciScintilla.INDIC_SQUIGGLE, 8) self.setIndicatorForegroundColor(QtGui.QColor( "#FF0000"), self.syntaxErrorIndicator) self.setIndicatorDrawUnder(True, self.syntaxErrorIndicator) self.searchIndicator = self.indicatorDefine( QsciScintilla.INDIC_ROUNDBOX, 10) self.setIndicatorForegroundColor( QtGui.QColor("#FFDB4A"), self.searchIndicator) self.setIndicatorDrawUnder(True, self.searchIndicator) self.userListActivated.connect(self.insertText) 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.textChanged.connect(self.startTokenizeTimer) self.textChanged.connect(self.startCompletionTimer) self.linesChanged.connect(self.updateLineCount) self.marginClicked.connect(self.toggleBookmark) # define the font to use font = QtGui.QFont("Courier New") font.setFixedPitch(True) font.setPointSize(10) # the font metrics here will help # building the margin width later self.fontMetrics = QtGui.QFontMetrics(font) self.setUtf8(True) self.setAutoIndent(True) self.setIndentationsUseTabs(False) self.setBackspaceUnindents(True) self.setIndentationWidth(4) self.setTabWidth(4) # self.setAnnotationDisplay(QsciScintilla.AnnotationStandard) # Line numbers # conventionnaly, margin 0 is for line numbers self.setMarginWidth(0, self.fontMetrics.width("0000") + 5) self.setAutoCompletionReplaceWord(True) # minimum number of letters to be typed before list is displayed self.setAutoCompletionThreshold(2) if self.useData.SETTINGS["EnableFolding"] == "True": self.setFolding(QsciScintilla.BoxedTreeFoldStyle, 2) # Braces matching # TODO: Causes flicker when selecting text. I suspect it has # the layout and widgets placed on top of it if self.useData.SETTINGS["MatchBraces"] == "True": self.setBraceMatching(QsciScintilla.SloppyBraceMatch) if self.useData.SETTINGS["ShowEdgeLine"] == 'True': if self.useData.SETTINGS["EdgeMode"] == 'Line': self.setEdgeMode(QsciScintilla.EdgeLine) elif self.useData.SETTINGS["EdgeMode"] == 'Background': self.setEdgeMode(QsciScintilla.EdgeBackground) if self.useData.SETTINGS["LineWrap"] == 'True': if self.useData.SETTINGS["WrapMode"] == 'Word': self.setWrapMode(QsciScintilla.WrapWord) elif self.useData.SETTINGS["WrapMode"] == 'Character': self.setWrapMode(QsciScintilla.WrapCharacter) elif self.useData.SETTINGS["WrapMode"] == 'Whitespace': self.setWrapMode(QsciScintilla.WrapWhitespace) if self.useData.SETTINGS["ShowCaretLine"] == 'True': self.setCaretLineVisible(True) self.showWhiteSpaces() # set annotation display # the annotation font can be changed by changing the default lexer font self.setAnnotationDisplay(QsciScintilla.AnnotationBoxed) # Edge Mode shows a vetical bar at specific number of chars if self.useData.SETTINGS["ShowEdgeLine"] == 'True': if self.useData.SETTINGS['EdgeMode'] == "Line": self.setEdgeMode(QsciScintilla.EdgeLine) else: self.setEdgeMode(QsciScintilla.EdgeBackground) self.setEdgeColumn(int(self.useData.SETTINGS["EdgeColumn"])) # define markers # the background markers will not show until the editor has focus self.breakpointMarker = self.markerDefine(QsciScintilla.Background) self.setMarkerForegroundColor(QtGui.QColor("#000000"), self.breakpointMarker) self.setMarkerBackgroundColor(QtGui.QColor("#ffe1e1"), self.breakpointMarker) 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.markerDefine(QsciScintilla.VerticalLine, 11) self.setMarkerBackgroundColor(QtGui.QColor("#EEEE11"), 11) self.setMarkerForegroundColor(QtGui.QColor("#EEEE11"), 11) self.setMarginWidth(3, self.fontMetrics.width("0")) mask = (1 << 8) | (1 << 9) self.setMarginMarkerMask(1, mask) self.setMarginSensitivity(1, True) mask = (1 << 11) self.setMarginMarkerMask(3, mask) self.showLineNumbers() self.setMarkOperationalLines() if self.useData.SETTINGS["ShowCaretLine"] == 'True': self.setCaretLineVisible(True) self.lexer = self.colorScheme.styleEditor(self) self.setStyleSheet(StyleSheet.editorStyle) self.setKeymap()
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 = QtGui.QAction("Copy", self, statusTip="Copy", triggered=self.copyText) self.contextMenu = QtGui.QMenu() self.contextMenu.addAction(self.copyAct) self.setReadOnly(True) self.blocking_cursor_pos = (0, 0) self.setStyleSheet("QsciScintilla {border: none;}")