Sun, 13 Oct 2013 12:21:37 +0200
Continued to shorten the code lines to max. 79 characters.
--- a/QScintilla/APIsManager.py Sat Oct 12 18:25:29 2013 +0200 +++ b/QScintilla/APIsManager.py Sun Oct 13 12:21:37 2013 +0200 @@ -21,9 +21,12 @@ """ Class implementing an API storage entity. - @signal apiPreparationFinished() emitted after the API preparation has finished - @signal apiPreparationCancelled() emitted after the API preparation has been cancelled - @signal apiPreparationStarted() emitted after the API preparation has started + @signal apiPreparationFinished() emitted after the API preparation has + finished + @signal apiPreparationCancelled() emitted after the API preparation has + been cancelled + @signal apiPreparationStarted() emitted after the API preparation has + started """ apiPreparationFinished = pyqtSignal() apiPreparationCancelled = pyqtSignal() @@ -51,9 +54,12 @@ self.__apis = None else: self.__apis = QsciAPIs(self.__lexer) - self.__apis.apiPreparationFinished.connect(self.__apiPreparationFinished) - self.__apis.apiPreparationCancelled.connect(self.__apiPreparationCancelled) - self.__apis.apiPreparationStarted.connect(self.__apiPreparationStarted) + self.__apis.apiPreparationFinished.connect( + self.__apiPreparationFinished) + self.__apis.apiPreparationCancelled.connect( + self.__apiPreparationCancelled) + self.__apis.apiPreparationStarted.connect( + self.__apiPreparationStarted) self.__loadAPIs() def __loadAPIs(self): @@ -62,19 +68,22 @@ """ if self.__apis.isPrepared(): # load a prepared API file - if not self.__forPreparation and Preferences.getEditor("AutoPrepareAPIs"): + if not self.__forPreparation and \ + Preferences.getEditor("AutoPrepareAPIs"): self.prepareAPIs() self.__apis.loadPrepared() else: # load the raw files and prepare the API file - if not self.__forPreparation and Preferences.getEditor("AutoPrepareAPIs"): + if not self.__forPreparation and \ + Preferences.getEditor("AutoPrepareAPIs"): self.prepareAPIs(ondemand=True) def reloadAPIs(self): """ Public method to reload the API information. """ - if not self.__forPreparation and Preferences.getEditor("AutoPrepareAPIs"): + if not self.__forPreparation and \ + Preferences.getEditor("AutoPrepareAPIs"): self.prepareAPIs() self.__loadAPIs() @@ -84,7 +93,8 @@ @return reference to the QsciAPIs object (QsciAPIs) """ - if not self.__forPreparation and Preferences.getEditor("AutoPrepareAPIs"): + if not self.__forPreparation and \ + Preferences.getEditor("AutoPrepareAPIs"): self.prepareAPIs() return self.__apis @@ -98,7 +108,8 @@ def __apiPreparationCancelled(self): """ - Private method called, after the API preparation process has been cancelled. + Private method called, after the API preparation process has been + cancelled. """ self.__inPreparation = False self.apiPreparationCancelled.emit() @@ -132,11 +143,13 @@ needsPreparation = True else: preparedAPIsTime = preparedAPIsInfo.lastModified() - apifiles = sorted(Preferences.getEditorAPI(self.__language)) + apifiles = sorted( + Preferences.getEditorAPI(self.__language)) if self.__apifiles != apifiles: needsPreparation = True for apifile in apifiles: - if QFileInfo(apifile).lastModified() > preparedAPIsTime: + if QFileInfo(apifile).lastModified() > \ + preparedAPIsTime: needsPreparation = True break @@ -166,10 +179,12 @@ """ if self.__apis is not None: if Globals.isWindowsPlatform(): - qsciPath = os.path.join(Globals.getPyQt4ModulesDirectory(), "qsci") + qsciPath = os.path.join( + Globals.getPyQt4ModulesDirectory(), "qsci") if os.path.exists(qsciPath): # it's the installer - apidir = os.path.join(qsciPath, "api", self.__lexer.lexer()) + apidir = os.path.join(qsciPath, "api", + self.__lexer.lexer()) fnames = [] filist = QDir(apidir).entryInfoList(["*.api"], QDir.Files, QDir.IgnoreCase) @@ -221,11 +236,12 @@ Public method to get an apis object for autocompletion/calltips. This method creates and loads an APIs object dynamically upon request. - This saves memory for languages, that might not be needed at the moment. + This saves memory for languages, that might not be needed at the + moment. @param language the language of the requested api object (string) - @param forPreparation flag indicating the requested api object is just needed - for a preparation process (boolean) + @param forPreparation flag indicating the requested api object is just + needed for a preparation process (boolean) @return the apis object (APIs) """ if forPreparation:
--- a/QScintilla/Editor.py Sat Oct 12 18:25:29 2013 +0200 +++ b/QScintilla/Editor.py Sun Oct 13 12:21:37 2013 +0200 @@ -12,9 +12,9 @@ from PyQt4.QtCore import QDir, QTimer, QModelIndex, QFileInfo, pyqtSignal, \ pyqtSlot, QCryptographicHash, QEvent, QDateTime, QRegExp, Qt -from PyQt4.QtGui import QCursor, QPrinter, QPrintDialog, QLineEdit, QActionGroup, \ - QDialog, QAbstractPrintDialog, QInputDialog, QApplication, QMenu, QPalette, QFont, \ - QPixmap, QPainter +from PyQt4.QtGui import QCursor, QPrinter, QPrintDialog, QLineEdit, \ + QActionGroup, QDialog, QAbstractPrintDialog, QInputDialog, QApplication, \ + QMenu, QPalette, QFont, QPixmap, QPainter from PyQt4.Qsci import QsciScintilla, QsciMacro, QsciStyledText from E5Gui.E5Application import e5App @@ -35,41 +35,44 @@ """ Class implementing the editor component of the eric5 IDE. - @signal modificationStatusChanged(bool, QsciScintillaCompat) emitted when the - modification status has changed + @signal modificationStatusChanged(bool, QsciScintillaCompat) emitted when + the modification status has changed @signal undoAvailable(bool) emitted to signal the undo availability @signal redoAvailable(bool) emitted to signal the redo availability @signal cursorChanged(str, int, int) emitted when the cursor position - was changed + was changed @signal cursorLineChanged(int) emitted when the cursor line was changed @signal editorAboutToBeSaved(str) emitted before the editor is saved @signal editorSaved(str) emitted after the editor has been saved @signal editorRenamed(str) emitted after the editor got a new name - (i.e. after a 'Save As') - @signal captionChanged(str, QsciScintillaCompat) emitted when the caption is - updated. Typically due to a readOnly attribute change. - @signal breakpointToggled(QsciScintillaCompat) emitted when a breakpoint is toggled - @signal bookmarkToggled(QsciScintillaCompat) emitted when a bookmark is toggled + (i.e. after a 'Save As') + @signal captionChanged(str, QsciScintillaCompat) emitted when the caption + is updated. Typically due to a readOnly attribute change. + @signal breakpointToggled(QsciScintillaCompat) emitted when a breakpoint + is toggled + @signal bookmarkToggled(QsciScintillaCompat) emitted when a bookmark is + toggled @signal syntaxerrorToggled(QsciScintillaCompat) emitted when a syntax error - was discovered + was discovered @signal autoCompletionAPIsAvailable(bool) emitted after the autocompletion - function has been configured - @signal coverageMarkersShown(bool) emitted after the coverage markers have been - shown or cleared - @signal taskMarkersUpdated(QsciScintillaCompat) emitted when the task markers - were updated - @signal changeMarkersUpdated(QsciScintillaCompat) emitted when the change markers - were updated - @signal showMenu(str, QMenu, QsciScintillaCompat) emitted when a menu is about - to be shown. The name of the menu, a reference to the menu and a reference - to the editor are given. + function has been configured + @signal coverageMarkersShown(bool) emitted after the coverage markers have + been shown or cleared + @signal taskMarkersUpdated(QsciScintillaCompat) emitted when the task + markers were updated + @signal changeMarkersUpdated(QsciScintillaCompat) emitted when the change + markers were updated + @signal showMenu(str, QMenu, QsciScintillaCompat) emitted when a menu is + about to be shown. The name of the menu, a reference to the menu and + a reference to the editor are given. @signal languageChanged(str) emitted when the editors language was set. The - language is passed as a parameter. - @signal eolChanged(str) emitted when the editors eol type was set. The eol string - is passed as a parameter. + language is passed as a parameter. + @signal eolChanged(str) emitted when the editors eol type was set. The eol + string is passed as a parameter. @signal encodingChanged(str) emitted when the editors encoding was set. The encoding name is passed as a parameter. - @signal lastEditPositionAvailable() emitted when a last edit position is available + @signal lastEditPositionAvailable() emitted when a last edit position is + available @signal refreshed() emitted to signal a refresh of the editor contents """ modificationStatusChanged = pyqtSignal(bool, QsciScintillaCompat) @@ -248,9 +251,11 @@ self.__unifiedMargins = True # define the margins markers - self.__changeMarkerSaved = self.markerDefine(self.__createChangeMarkerPixmap( + self.__changeMarkerSaved = self.markerDefine( + self.__createChangeMarkerPixmap( "OnlineChangeTraceMarkerSaved")) - self.__changeMarkerUnsaved = self.markerDefine(self.__createChangeMarkerPixmap( + self.__changeMarkerUnsaved = self.markerDefine( + self.__createChangeMarkerPixmap( "OnlineChangeTraceMarkerUnsaved")) self.breakpoint = \ self.markerDefine(UI.PixmapCache.getPixmap("break.png")) @@ -312,8 +317,10 @@ self.trUtf8("""<p>The size of the file <b>{0}</b>""" """ is <b>{1} KB</b>.""" """ Do you really want to load it?</p>""")\ - .format(self.fileName, - QFileInfo(self.fileName).size() // 1024), + .format( + self.fileName, + QFileInfo(self.fileName).size() // + 1024), icon=E5MessageBox.Warning) if not res: raise IOError() @@ -363,13 +370,13 @@ self.setWhatsThis(self.trUtf8( """<b>A Source Editor Window</b>""" """<p>This window is used to display and edit a source file.""" - """ You can open as many of these as you like. The name of the file""" - """ is displayed in the window's titlebar.</p>""" - """<p>In order to set breakpoints just click in the space between""" - """ the line numbers and the fold markers. Via the context menu""" - """ of the margins they may be edited.</p>""" - """<p>In order to set bookmarks just Shift click in the space between""" - """ the line numbers and the fold markers.</p>""" + """ You can open as many of these as you like. The name of the""" + """ file is displayed in the window's titlebar.</p>""" + """<p>In order to set breakpoints just click in the space""" + """ between the line numbers and the fold markers. Via the""" + """ context menu of the margins they may be edited.</p>""" + """<p>In order to set bookmarks just Shift click in the space""" + """ between the line numbers and the fold markers.</p>""" """<p>These actions can be reversed via the context menu.</p>""" """<p>Ctrl clicking on a syntax error marker shows some info""" """ about this error.</p>""" @@ -432,7 +439,8 @@ if self.fileName and \ self.project.isOpen() and \ self.project.isProjectSource(self.fileName): - self.project.projectPropertiesChanged.connect(self.__projectPropertiesChanged) + self.project.projectPropertiesChanged.connect( + self.__projectPropertiesChanged) self.grabGesture(Qt.PinchGesture) @@ -637,7 +645,8 @@ self.menu.addAction(UI.PixmapCache.getIcon("editComment.png"), self.trUtf8('Comment'), self.commentLineOrSelection) self.menuActs["Uncomment"] = \ - self.menu.addAction(UI.PixmapCache.getIcon("editUncomment.png"), + self.menu.addAction( + UI.PixmapCache.getIcon("editUncomment.png"), self.trUtf8('Uncomment'), self.uncommentLineOrSelection) self.menuActs["StreamComment"] = \ self.menu.addAction(self.trUtf8('Stream Comment'), @@ -649,7 +658,8 @@ self.menu.addAction(self.trUtf8('Select to brace'), self.selectToMatchingBrace) self.menu.addAction(self.trUtf8('Select all'), self.__selectAll) - self.menu.addAction(self.trUtf8('Deselect all'), self.__deselectAll) + self.menu.addAction( + self.trUtf8('Deselect all'), self.__deselectAll) self.menu.addSeparator() self.menuActs["SpellCheck"] = \ self.menu.addAction(UI.PixmapCache.getIcon("spellchecking.png"), @@ -683,7 +693,8 @@ self.menu.addAction(self.trUtf8("Typing aids enabled"), self.__toggleTypingAids) self.menuActs["TypingAidsEnabled"].setCheckable(True) - self.menuActs["TypingAidsEnabled"].setEnabled(self.completer is not None) + self.menuActs["TypingAidsEnabled"].setEnabled( + self.completer is not None) self.menuActs["TypingAidsEnabled"].setChecked( self.completer is not None and self.completer.isEnabled()) self.menuActs["AutoCompletionEnable"] = \ @@ -737,7 +748,8 @@ self.__menus["Spelling"] = self.spellingMenu self.spellingMenu.aboutToShow.connect(self.__showContextMenuSpelling) - self.spellingMenu.triggered.connect(self.__contextMenuSpellingTriggered) + self.spellingMenu.triggered.connect( + self.__contextMenuSpellingTriggered) def __initContextMenuAutocompletion(self): """ @@ -786,16 +798,16 @@ menu = QMenu(self.trUtf8('Show')) menu.addAction(self.trUtf8('Code metrics...'), self.__showCodeMetrics) - self.coverageMenuAct = \ - menu.addAction(self.trUtf8('Code coverage...'), self.__showCodeCoverage) - self.coverageShowAnnotationMenuAct = \ - menu.addAction(self.trUtf8('Show code coverage annotations'), - self.codeCoverageShowAnnotations) - self.coverageHideAnnotationMenuAct = \ - menu.addAction(self.trUtf8('Hide code coverage annotations'), - self.__codeCoverageHideAnnotations) - self.profileMenuAct = \ - menu.addAction(self.trUtf8('Profile data...'), self.__showProfileData) + self.coverageMenuAct = menu.addAction( + self.trUtf8('Code coverage...'), self.__showCodeCoverage) + self.coverageShowAnnotationMenuAct = menu.addAction( + self.trUtf8('Show code coverage annotations'), + self.codeCoverageShowAnnotations) + self.coverageHideAnnotationMenuAct = menu.addAction( + self.trUtf8('Hide code coverage annotations'), + self.__codeCoverageHideAnnotations) + self.profileMenuAct = menu.addAction( + self.trUtf8('Profile data...'), self.__showProfileData) menu.aboutToShow.connect(self.__showContextMenuShow) @@ -847,7 +859,8 @@ languages = sorted(list(supportedLanguages.keys())) for language in languages: if language != "Guessed": - self.supportedLanguages[language] = supportedLanguages[language][:2] + self.supportedLanguages[language] = \ + supportedLanguages[language][:2] act = menu.addAction( UI.PixmapCache.getIcon(supportedLanguages[language][2]), self.supportedLanguages[language][0]) @@ -963,7 +976,8 @@ def __initContextMenuSeparateMargins(self): """ - Private method used to setup the context menu for the separated margins. + Private method used to setup the context menu for the separated + margins. """ # bookmark margin self.bmMarginMenu = QMenu() @@ -989,7 +1003,8 @@ self.bpMarginMenu.addAction(self.trUtf8('Toggle breakpoint'), self.menuToggleBreakpoint) self.marginMenuActs["TempBreakpoint"] = \ - self.bpMarginMenu.addAction(self.trUtf8('Toggle temporary breakpoint'), + self.bpMarginMenu.addAction( + self.trUtf8('Toggle temporary breakpoint'), self.__menuToggleTemporaryBreakpoint) self.marginMenuActs["EditBreakpoint"] = \ self.bpMarginMenu.addAction(self.trUtf8('Edit breakpoint...'), @@ -1016,7 +1031,8 @@ self.indicMarginMenu.addAction(self.trUtf8('Goto syntax error'), self.gotoSyntaxError) self.marginMenuActs["ShowSyntaxError"] = \ - self.indicMarginMenu.addAction(self.trUtf8('Show syntax error message'), + self.indicMarginMenu.addAction( + self.trUtf8('Show syntax error message'), self.__showSyntaxError) self.marginMenuActs["ClearSyntaxError"] = \ self.indicMarginMenu.addAction(self.trUtf8('Clear syntax error'), @@ -1039,7 +1055,8 @@ self.indicMarginMenu.addAction(self.trUtf8('Next uncovered line'), self.nextUncovered) self.marginMenuActs["PreviousCoverageMarker"] = \ - self.indicMarginMenu.addAction(self.trUtf8('Previous uncovered line'), + self.indicMarginMenu.addAction( + self.trUtf8('Previous uncovered line'), self.previousUncovered) self.indicMarginMenu.addSeparator() self.marginMenuActs["NextTaskMarker"] = \ @@ -1103,7 +1120,8 @@ self.marginMenu.addAction(self.trUtf8('Toggle breakpoint'), self.menuToggleBreakpoint) self.marginMenuActs["TempBreakpoint"] = \ - self.marginMenu.addAction(self.trUtf8('Toggle temporary breakpoint'), + self.marginMenu.addAction( + self.trUtf8('Toggle temporary breakpoint'), self.__menuToggleTemporaryBreakpoint) self.marginMenuActs["EditBreakpoint"] = \ self.marginMenu.addAction(self.trUtf8('Edit breakpoint...'), @@ -1178,8 +1196,9 @@ else: E5MessageBox.critical(self, self.trUtf8("Export source"), - self.trUtf8("""<p>No exporter available for the """ - """export format <b>{0}</b>. Aborting...</p>""")\ + self.trUtf8( + """<p>No exporter available for the """ + """export format <b>{0}</b>. Aborting...</p>""")\ .format(exporterFormat)) else: E5MessageBox.critical(self, @@ -1188,7 +1207,8 @@ def __showContextMenuLanguages(self): """ - Private slot handling the aboutToShow signal of the languages context menu. + Private slot handling the aboutToShow signal of the languages context + menu. """ if self.apiLanguage.startswith("Pygments|"): self.pygmentsSelAct.setText( @@ -1260,7 +1280,8 @@ self.setLanguage("dummy.pygments", pyname=pyname) else: self.filetype = language - self.setLanguage(self.supportedLanguages[language][1], propagate=propagate) + self.setLanguage(self.supportedLanguages[language][1], + propagate=propagate) self.__autoSyntaxCheck() def __resetLanguage(self, propagate=True): @@ -1293,9 +1314,10 @@ """ Public method to set a lexer language. - @param filename filename used to determine the associated lexer language (string) - @param initTextDisplay flag indicating an initialization of the text display - is required as well (boolean) + @param filename filename used to determine the associated lexer + language (string) + @param initTextDisplay flag indicating an initialization of the text + display is required as well (boolean) @keyparam propagate flag indicating to propagate the change (boolean) @keyparam pyname name of the pygments lexer to use (string) """ @@ -1341,7 +1363,8 @@ def __showContextMenuEncodings(self): """ - Private slot handling the aboutToShow signal of the encodings context menu. + Private slot handling the aboutToShow signal of the encodings context + menu. """ self.showMenu.emit("Encodings", self.encodingsMenu, self) @@ -1359,7 +1382,8 @@ Private method to check the selected encoding of the encodings submenu. """ try: - self.supportedEncodings[self.__normalizedEncoding()].setChecked(True) + self.supportedEncodings[self.__normalizedEncoding()]\ + .setChecked(True) except (AttributeError, KeyError): pass @@ -1429,7 +1453,8 @@ """ Private slot to set the correct lexer depending on language. - @param filename filename used to determine the associated lexer language (string) + @param filename filename used to determine the associated lexer + language (string) @keyparam pyname name of the pygments lexer to use (string) """ if self.lexer_ is not None and \ @@ -1438,7 +1463,8 @@ language = "" if self.project.isOpen() and self.project.isProjectFile(filename): - language = self.project.getEditorLexerAssoc(os.path.basename(filename)) + language = self.project.getEditorLexerAssoc( + os.path.basename(filename)) if not language: ext = os.path.splitext(filename)[1] if ext in [".py", ".pyw"]: @@ -1532,7 +1558,8 @@ names for Pygments (boolean) @return language of the editor (string) """ - if self.apiLanguage == "Guessed" or self.apiLanguage.startswith("Pygments|"): + if self.apiLanguage == "Guessed" or \ + self.apiLanguage.startswith("Pygments|"): lang = self.lexer_.name() if normalized: # adjust some Pygments lexer names @@ -1622,7 +1649,8 @@ # do spell checking doSpelling = True if self.lastLine == line: - start, end = self.getWordBoundaries(line, index, useWordChars=False) + start, end = self.getWordBoundaries( + line, index, useWordChars=False) if start <= self.lastIndex and self.lastIndex <= end: doSpelling = False if doSpelling: @@ -1675,10 +1703,11 @@ def getFileTypeByFlag(self): """ - Public method to return the type of the file, if it was set by an eflag: marker. - - @return type of the displayed file, if set by an eflag: marker or an empty - string (string) + Public method to return the type of the file, if it was set by an + eflag: marker. + + @return type of the displayed file, if set by an eflag: marker or an + empty string (string) """ if self.filetypeByFlag: return self.filetype @@ -1740,7 +1769,8 @@ self.project.isOpen() and \ self.project.isProjectFile(self.fileName): isProjectPy2 = \ - self.project.getProjectLanguage() in ["Python", "Python2"] + self.project.getProjectLanguage() in ["Python", + "Python2"] if isProjectPy2: self.filetype = "Python2" return isProjectPy2 @@ -1782,13 +1812,15 @@ if Preferences.getProject("DeterminePyFromProject") and \ self.project.isOpen() and \ self.project.isProjectFile(self.fileName): - isProjectPy3 = self.project.getProjectLanguage() in ["Python3"] + isProjectPy3 = \ + self.project.getProjectLanguage() in ["Python3"] if isProjectPy3: self.filetype = "Python3" return isProjectPy3 else: # 3) determine by compiling the sources - syntaxError = Utilities.compile(self.fileName, self.text()) + syntaxError = Utilities.compile( + self.fileName, self.text()) if not syntaxError: self.filetype = "Python3" return True @@ -1816,7 +1848,8 @@ return True if self.fileName is not None and \ - os.path.splitext(self.fileName)[1] in self.dbs.getExtensions('Ruby'): + os.path.splitext(self.fileName)[1] in \ + self.dbs.getExtensions('Ruby'): self.filetype = "Ruby" return True @@ -1856,7 +1889,8 @@ else: if self.lastCurrMarker is not None: self.markerDeleteHandle(self.lastCurrMarker) - self.lastCurrMarker = self.markerAdd(line - 1, self.currentline) + self.lastCurrMarker = self.markerAdd(line - 1, + self.currentline) self.lastHighlight = self.lastCurrMarker self.setCursorPosition(line - 1, 0) @@ -1871,12 +1905,12 @@ else: return 1 - ############################################################################ + ########################################################################### ## Breakpoint handling methods below - ############################################################################ + ########################################################################### - def __modified(self, pos, mtype, text, length, linesAdded, line, foldNow, foldPrev, - token, annotationLinesAdded): + def __modified(self, pos, mtype, text, length, linesAdded, line, foldNow, + foldPrev, token, annotationLinesAdded): """ Private method to handle changes of the number of lines. @@ -1889,20 +1923,24 @@ @param foldNow new fold level (integer) @param foldPrev previous fold level (integer) @param token ??? - @param annotationLinesAdded number of added/deleted annotation lines (integer) + @param annotationLinesAdded number of added/deleted annotation lines + (integer) """ if mtype & (self.SC_MOD_INSERTTEXT | self.SC_MOD_DELETETEXT) and \ linesAdded != 0: if self.breaks: bps = [] # list of breakpoints - for handle, (ln, cond, temp, enabled, ignorecount) in self.breaks.items(): + for handle, (ln, cond, temp, enabled, ignorecount) in \ + self.breaks.items(): line = self.markerLine(handle) + 1 if ln != line: bps.append((ln, line)) - self.breaks[handle] = (line, cond, temp, enabled, ignorecount) + self.breaks[handle] = (line, cond, temp, enabled, + ignorecount) self.inLinesChanged = True for ln, line in sorted(bps, reverse=linesAdded > 0): - index1 = self.breakpointModel.getBreakPointIndex(self.fileName, ln) + index1 = self.breakpointModel.getBreakPointIndex( + self.fileName, ln) index2 = self.breakpointModel.index(index1.row(), 1) self.breakpointModel.setData(index2, line) self.inLinesChanged = False @@ -1913,7 +1951,8 @@ """ for handle in list(self.breaks.keys()): self.markerDeleteHandle(handle) - self.__addBreakPoints(QModelIndex(), 0, self.breakpointModel.rowCount() - 1) + self.__addBreakPoints( + QModelIndex(), 0, self.breakpointModel.rowCount() - 1) def __deleteBreakPoints(self, parentIndex, start, end): """ @@ -1939,7 +1978,8 @@ (QModelIndex) """ if not self.inLinesChanged: - self.__addBreakPoints(QModelIndex(), startIndex.row(), endIndex.row()) + self.__addBreakPoints(QModelIndex(), startIndex.row(), + endIndex.row()) def __breakPointDataAboutToBeChanged(self, startIndex, endIndex): """ @@ -1949,7 +1989,8 @@ @param startIndex start index of the rows to be changed (QModelIndex) @param endIndex end index of the rows to be changed (QModelIndex) """ - self.__deleteBreakPoints(QModelIndex(), startIndex.row(), endIndex.row()) + self.__deleteBreakPoints(QModelIndex(), startIndex.row(), + endIndex.row()) def __addBreakPoints(self, parentIndex, start, end): """ @@ -1964,7 +2005,8 @@ fn, line, cond, temp, enabled, ignorecount = \ self.breakpointModel.getBreakPointByIndex(index)[:6] if fn == self.fileName: - self.newBreakpointWithProperties(line, (cond, temp, enabled, ignorecount)) + self.newBreakpointWithProperties( + line, (cond, temp, enabled, ignorecount)) def clearBreakpoint(self, line): """ @@ -2018,9 +2060,11 @@ for handle, (ln, _, _, _, _) in list(self.breaks.items()): if self.markerLine(handle) == line - 1: # delete breakpoint or toggle it to the next state - index = self.breakpointModel.getBreakPointIndex(self.fileName, line) + index = self.breakpointModel.getBreakPointIndex( + self.fileName, line) if Preferences.getDebugger("ThreeStateBreakPoints") and \ - not self.breakpointModel.isBreakPointTemporaryByIndex(index): + not self.breakpointModel.isBreakPointTemporaryByIndex( + index): self.breakpointModel.deleteBreakPointByIndex(index) self.__addBreakPoint(line, True) else: @@ -2049,7 +2093,8 @@ @param line line number of the breakpoint (integer) """ - for handle, (ln, cond, temp, enabled, ignorecount) in list(self.breaks.items()): + for handle, (ln, cond, temp, enabled, ignorecount) in \ + self.breaks.items(): if self.markerLine(handle) == line - 1: break else: @@ -2061,7 +2106,8 @@ def curLineHasBreakpoint(self): """ - Public method to check for the presence of a breakpoint at the current line. + Public method to check for the presence of a breakpoint at the current + line. @return flag indicating the presence of a breakpoint (boolean) """ @@ -2078,7 +2124,8 @@ def __menuToggleTemporaryBreakpoint(self): """ - Private slot to handle the 'Toggle temporary breakpoint' context menu action. + Private slot to handle the 'Toggle temporary breakpoint' context menu + action. """ if self.line < 0: self.line, index = self.getCursorPosition() @@ -2098,7 +2145,8 @@ def __menuToggleBreakpointEnabled(self): """ - Private slot to handle the 'Enable/Disable breakpoint' context menu action. + Private slot to handle the 'Enable/Disable breakpoint' context menu + action. """ if self.line < 0: self.line, index = self.getCursorPosition() @@ -2117,7 +2165,8 @@ if self.line < 0: self.line, index = self.getCursorPosition() found = False - for handle, (ln, cond, temp, enabled, ignorecount) in list(self.breaks.items()): + for handle, (ln, cond, temp, enabled, ignorecount) in \ + self.breaks.items(): if self.markerLine(handle) == self.line: found = True break @@ -2167,7 +2216,8 @@ bpline = self.markerFindPrevious(line, self.breakpointMask) if bpline < 0: # wrap around - bpline = self.markerFindPrevious(self.lines() - 1, self.breakpointMask) + bpline = self.markerFindPrevious( + self.lines() - 1, self.breakpointMask) if bpline >= 0: self.setCursorPosition(bpline, 0) self.ensureLineVisible(bpline) @@ -2192,9 +2242,9 @@ if idxList: self.breakpointModel.deleteBreakPoints(idxList) - ############################################################################ + ########################################################################### ## Bookmark handling methods below - ############################################################################ + ########################################################################### def toggleBookmark(self, line): """ @@ -2277,7 +2327,8 @@ bmline = self.markerFindPrevious(line, 1 << self.bookmark) if bmline < 0: # wrap around - bmline = self.markerFindPrevious(self.lines() - 1, 1 << self.bookmark) + bmline = self.markerFindPrevious( + self.lines() - 1, 1 << self.bookmark) if bmline >= 0: self.setCursorPosition(bmline, 0) self.ensureLineVisible(bmline) @@ -2291,9 +2342,9 @@ self.bookmarks = [] self.bookmarkToggled.emit(self) - ############################################################################ + ########################################################################### ## Printing methods below - ############################################################################ + ########################################################################### def printFile(self): """ @@ -2352,13 +2403,14 @@ """ Private slot to generate a print preview. - @param printer reference to the printer object (QScintilla.Printer.Printer) + @param printer reference to the printer object + (QScintilla.Printer.Printer) """ printer.printRange(self) - ############################################################################ + ########################################################################### ## Task handling methods below - ############################################################################ + ########################################################################### def hasTaskMarkers(self): """ @@ -2397,7 +2449,8 @@ taskline = self.markerFindPrevious(line, 1 << self.taskmarker) if taskline < 0: # wrap around - taskline = self.markerFindPrevious(self.lines() - 1, 1 << self.taskmarker) + taskline = self.markerFindPrevious( + self.lines() - 1, 1 << self.taskmarker) if taskline >= 0: self.setCursorPosition(taskline, 0) self.ensureLineVisible(taskline) @@ -2408,10 +2461,14 @@ """ from Tasks.Task import Task markers = { - Task.TypeWarning: Preferences.getTasks("TasksWarningMarkers").split(), - Task.TypeNote: Preferences.getTasks("TasksNoteMarkers").split(), - Task.TypeTodo: Preferences.getTasks("TasksTodoMarkers").split(), - Task.TypeFixme: Preferences.getTasks("TasksFixmeMarkers").split(), + Task.TypeWarning: + Preferences.getTasks("TasksWarningMarkers").split(), + Task.TypeNote: + Preferences.getTasks("TasksNoteMarkers").split(), + Task.TypeTodo: + Preferences.getTasks("TasksTodoMarkers").split(), + Task.TypeFixme: + Preferences.getTasks("TasksFixmeMarkers").split(), } txtList = self.text().split(self.getLineSeparator()) @@ -2432,8 +2489,8 @@ if index > -1: task = line[index:] self.markerAdd(lineIndex, self.taskmarker) - self.taskViewer.addFileTask(task, self.fileName, lineIndex + 1, - taskType) + self.taskViewer.addFileTask( + task, self.fileName, lineIndex + 1, taskType) self.__hasTaskMarkers = True shouldBreak = True break @@ -2441,9 +2498,9 @@ break self.taskMarkersUpdated.emit(self) - ############################################################################ + ########################################################################### ## Change tracing methods below - ############################################################################ + ########################################################################### def __createChangeMarkerPixmap(self, key, size=16, width=4): """ @@ -2457,7 +2514,8 @@ pixmap = QPixmap(size, size) pixmap.fill(Qt.transparent) painter = QPainter(pixmap) - painter.fillRect(size - 4, 0, 4, size, Preferences.getEditorColour(key)) + painter.fillRect(size - 4, 0, 4, size, + Preferences.getEditorColour(key)) painter.end() return pixmap @@ -2590,14 +2648,15 @@ changeline = self.markerFindPrevious(line, self.changeMarkersMask) if changeline < 0: # wrap around - changeline = self.markerFindPrevious(self.lines() - 1, self.changeMarkersMask) + changeline = self.markerFindPrevious( + self.lines() - 1, self.changeMarkersMask) if changeline >= 0: self.setCursorPosition(changeline, 0) self.ensureLineVisible(changeline) - ############################################################################ + ########################################################################### ## Flags handling methods below - ############################################################################ + ########################################################################### def __processFlags(self): """ @@ -2627,9 +2686,9 @@ return changedFlags - ############################################################################ + ########################################################################### ## File handling methods below - ############################################################################ + ########################################################################### def checkDirty(self): """ @@ -2677,8 +2736,8 @@ Public slot to read the text from a file. @param fn filename to read from (string) - @param createIt flag indicating the creation of a new file, if the given - one doesn't exist (boolean) + @param createIt flag indicating the creation of a new file, if the + given one doesn't exist (boolean) """ QApplication.setOverrideCursor(QCursor(Qt.WaitCursor)) @@ -2822,11 +2881,13 @@ if not path and self.fileName is not None: path = os.path.dirname(self.fileName) if not path: - path = Preferences.getMultiProject("Workspace") or Utilities.getHomeDir() + path = Preferences.getMultiProject("Workspace") or \ + Utilities.getHomeDir() from . import Lexers if self.fileName: - filterPattern = "(*{0})".format(os.path.splitext(self.fileName)[1]) + filterPattern = "(*{0})".format( + os.path.splitext(self.fileName)[1]) for filter in Lexers.getSaveFileFiltersList(True): if filterPattern in filter: defaultFilter = filter @@ -2866,7 +2927,8 @@ return False # save to project, if a project is loaded - if self.project.isOpen() and self.project.startswithProjectPath(fn): + if self.project.isOpen() and \ + self.project.startswithProjectPath(fn): self.setEolModeByEolString(self.project.getEolString()) self.convertEols(self.eolMode()) else: @@ -2891,7 +2953,8 @@ self.editorRenamed.emit(self.fileName) # save to project, if a project is loaded - if self.project.isOpen() and self.project.startswithProjectPath(fn): + if self.project.isOpen() and \ + self.project.startswithProjectPath(fn): self.project.appendFile(self.fileName) self.addedToProject() self.setLanguage(self.fileName) @@ -2913,9 +2976,10 @@ Public slot to save a file with a new name. @param path directory to save the file in (string) - @keyparam toProject flag indicating a save to project operation (boolean) - @return tuple of two values (boolean, string) giving a success indicator and - the name of the saved file + @keyparam toProject flag indicating a save to project operation + (boolean) + @return tuple of two values (boolean, string) giving a success + indicator and the name of the saved file """ return self.saveFile(True, path) @@ -2949,9 +3013,9 @@ self.editorRenamed.emit(self.fileName) self.inFileRenamed = False - ############################################################################ + ########################################################################### ## Utility methods below - ############################################################################ + ########################################################################### def ensureVisible(self, line): """ @@ -3014,7 +3078,8 @@ self.setMonospaced(True) else: if self.lexer_: - self.lexer_.readSettings(Preferences.Prefs.settings, "Scintilla") + self.lexer_.readSettings( + Preferences.Prefs.settings, "Scintilla") self.lexer_.initProperties() self.setMonospaced(False) self.__setMarginsDisplay() @@ -3059,7 +3124,8 @@ @param line number of line to look at (int) @param index position to look at (int) - @param direction direction to look in (0 = whole word, 1 = left, 2 = right) + @param direction direction to look in (0 = whole word, 1 = left, + 2 = right) @keyparam useWordChars flag indicating to use the wordCharacters method (boolean) @return the word at that position (string) @@ -3155,8 +3221,8 @@ def getSearchText(self, selectionOnly=False): """ - Public method to determine the selection or the current word for the next - search operation. + Public method to determine the selection or the current word for the + next search operation. @param selectionOnly flag indicating that only selected text should be returned (boolean) @@ -3206,21 +3272,22 @@ return self.clearSearchIndicators() - ok = self.findFirstTarget(word, False, self.caseSensitive(), True, 0, 0) + ok = self.findFirstTarget(word, False, self.caseSensitive(), True, + 0, 0) while ok: tgtPos, tgtLen = self.getFoundTarget() self.setSearchIndicator(tgtPos, tgtLen) ok = self.findNextTarget() self.__markedText = word - ############################################################################ + ########################################################################### ## Comment handling methods below - ############################################################################ + ########################################################################### def __isCommentedLine(self, line, commentStr): """ - Private method to check, if the given line is a comment line as produced - by the configured comment rules. + Private method to check, if the given line is a comment line as + produced by the configured comment rules. @param line text of the line to check (string) @param commentStr comment string to check against (string) @@ -3248,7 +3315,8 @@ # check if line starts with our comment string (i.e. was commented # by our comment...() slots if self.hasSelectedText() and \ - self.__isCommentedLine(self.text(self.getSelection()[0]), commentStr): + self.__isCommentedLine(self.text(self.getSelection()[0]), + commentStr): self.uncommentLineOrSelection() elif not self.__isCommentedLine(self.text(line), commentStr): # it doesn't, so comment the line or selection @@ -3284,7 +3352,8 @@ if Preferences.getEditor("CommentColumn0"): self.insertAt(self.lexer_.commentStr(), line, 0) else: - self.insertAt(self.lexer_.commentStr(), line, self.indentation(line)) + self.insertAt(self.lexer_.commentStr(), line, + self.indentation(line)) self.endUndoAction() def uncommentLine(self): @@ -3373,8 +3442,10 @@ if Preferences.getEditor("CommentColumn0"): self.setSelection(line, 0, line, len(commentStr)) else: - self.setSelection(line, self.indentation(line), - line, self.indentation(line) + len(commentStr)) + self.setSelection(line, + self.indentation(line), + line, + self.indentation(line) + len(commentStr)) self.removeSelectedText() # adjust selection start @@ -3531,9 +3602,9 @@ else: self.boxCommentLine() - ############################################################################ + ########################################################################### ## Indentation handling methods below - ############################################################################ + ########################################################################### def __indentLine(self, indent=True): """ @@ -3584,11 +3655,13 @@ self.endUndoAction() if indent: if indexTo == 0: - self.setSelection(lineFrom, indexFrom + self.indentationWidth(), - lineTo, 0) + self.setSelection( + lineFrom, indexFrom + self.indentationWidth(), + lineTo, 0) else: - self.setSelection(lineFrom, indexFrom + self.indentationWidth(), - lineTo, indexTo + self.indentationWidth()) + self.setSelection( + lineFrom, indexFrom + self.indentationWidth(), + lineTo, indexTo + self.indentationWidth()) else: indexStart = indexFrom - self.indentationWidth() if indexStart < 0: @@ -3729,9 +3802,9 @@ else: lineNo += 1 - ############################################################################ + ########################################################################### ## Setup methods below - ############################################################################ + ########################################################################### def readSettings(self): """ @@ -3815,14 +3888,14 @@ """ Private method to set the line marker colours. """ - self.setMarkerForegroundColor(Preferences.getEditorColour("CurrentMarker"), - self.currentline) - self.setMarkerBackgroundColor(Preferences.getEditorColour("CurrentMarker"), - self.currentline) - self.setMarkerForegroundColor(Preferences.getEditorColour("ErrorMarker"), - self.errorline) - self.setMarkerBackgroundColor(Preferences.getEditorColour("ErrorMarker"), - self.errorline) + self.setMarkerForegroundColor( + Preferences.getEditorColour("CurrentMarker"), self.currentline) + self.setMarkerBackgroundColor( + Preferences.getEditorColour("CurrentMarker"), self.currentline) + self.setMarkerForegroundColor( + Preferences.getEditorColour("ErrorMarker"), self.errorline) + self.setMarkerBackgroundColor( + Preferences.getEditorColour("ErrorMarker"), self.errorline) def __setMarginsDisplay(self): """ @@ -3830,8 +3903,10 @@ """ # set the settings for all margins self.setMarginsFont(Preferences.getEditorOtherFonts("MarginsFont")) - self.setMarginsForegroundColor(Preferences.getEditorColour("MarginsForeground")) - self.setMarginsBackgroundColor(Preferences.getEditorColour("MarginsBackground")) + self.setMarginsForegroundColor( + Preferences.getEditorColour("MarginsForeground")) + self.setMarginsBackgroundColor( + Preferences.getEditorColour("MarginsBackground")) # reset standard margins settings for margin in range(5): @@ -3929,7 +4004,8 @@ """ linenoMargin = Preferences.getEditor("LinenoMargin") if linenoMargin: - self.setMarginWidth(self.__linenoMargin, '8' * (len(str(self.lines())) + 1)) + self.setMarginWidth( + self.__linenoMargin, '8' * (len(str(self.lines())) + 1)) def __setTextDisplay(self): """ @@ -3940,7 +4016,8 @@ if self.lexer_ and self.lexer_.alwaysKeepTabs(): self.setIndentationsUseTabs(True) else: - self.setIndentationsUseTabs(Preferences.getEditor("TabForIndentation")) + self.setIndentationsUseTabs( + Preferences.getEditor("TabForIndentation")) self.setTabIndents(Preferences.getEditor("TabIndents")) self.setBackspaceUnindents(Preferences.getEditor("TabIndents")) self.setIndentationGuides(Preferences.getEditor("IndentationGuides")) @@ -4018,7 +4095,8 @@ self.clearAllIndicators(self.searchIndicator) self.spellingIndicator = QsciScintilla.INDIC_CONTAINER + 1 - self.indicatorDefine(self.spellingIndicator, QsciScintilla.INDIC_SQUIGGLE, + self.indicatorDefine( + self.spellingIndicator, QsciScintilla.INDIC_SQUIGGLE, Preferences.getEditorColour("SpellingMarkers")) self.__setSpelling() @@ -4037,7 +4115,8 @@ self.setColor(Preferences.getEditorColour("EditAreaForeground")) self.setPaper(Preferences.getEditorColour("EditAreaBackground")) - self.setVirtualSpaceOptions(Preferences.getEditor("VirtualSpaceOptions")) + self.setVirtualSpaceOptions( + Preferences.getEditor("VirtualSpaceOptions")) def __setEolMode(self): """ @@ -4098,20 +4177,23 @@ calltipsStyle = Preferences.getEditor("CallTipsStyle") if calltipsStyle == QsciScintilla.CallTipsNoContext: self.setCallTipsStyle(QsciScintilla.CallTipsNoContext) - elif calltipsStyle == QsciScintilla.CallTipsNoAutoCompletionContext: - self.setCallTipsStyle(QsciScintilla.CallTipsNoAutoCompletionContext) + elif calltipsStyle == \ + QsciScintilla.CallTipsNoAutoCompletionContext: + self.setCallTipsStyle( + QsciScintilla.CallTipsNoAutoCompletionContext) else: self.setCallTipsStyle(QsciScintilla.CallTipsContext) try: - self.setCallTipsPosition(Preferences.getEditor("CallTipsPosition")) + self.setCallTipsPosition( + Preferences.getEditor("CallTipsPosition")) except AttributeError: pass else: self.setCallTipsStyle(QsciScintilla.CallTipsNone) - ############################################################################ + ########################################################################### ## Autocompletion handling methods below - ############################################################################ + ########################################################################### def canAutoCompleteFromAPIs(self): """ @@ -4142,12 +4224,14 @@ """ Public method to enable/disable autocompletion. - @param enable flag indicating the desired autocompletion status (boolean) + @param enable flag indicating the desired autocompletion status + (boolean) """ if enable: self.setAutoCompletionThreshold( Preferences.getEditor("AutoCompletionThreshold")) - autoCompletionSource = Preferences.getEditor("AutoCompletionSource") + autoCompletionSource = \ + Preferences.getEditor("AutoCompletionSource") if autoCompletionSource == QsciScintilla.AcsDocument: self.setAutoCompletionSource(QsciScintilla.AcsDocument) elif autoCompletionSource == QsciScintilla.AcsAPIs: @@ -4204,7 +4288,8 @@ def __isStartChar(self, ch): """ - Private method to check, if a character is an autocompletion start character. + Private method to check, if a character is an autocompletion start + character. @param ch character to be checked (one character string) @return flag indicating the result (boolean) @@ -4263,7 +4348,8 @@ """ Public method to start autocompletion. - @keyparam auto flag indicating a call from the __charAdded method (boolean) + @keyparam auto flag indicating a call from the __charAdded method + (boolean) @keyparam context flag indicating to complete a context (boolean) """ if auto and self.autoCompletionThreshold() == -1: @@ -4292,8 +4378,8 @@ """ pos = self.currentPosition() - # move backward to the start of the current calltip working out which argument - # to highlight + # move backward to the start of the current calltip working out + # which argument to highlight commas = 0 found = False ch, pos = self.__getCharacter(pos) @@ -4303,7 +4389,8 @@ elif ch == ')': depth = 1 - # ignore everything back to the start of the corresponding parenthesis + # ignore everything back to the start of the corresponding + # parenthesis ch, pos = self.__getCharacter(pos) while ch: if ch == ')': @@ -4382,7 +4469,8 @@ depth -= 1 if astart != aend: - self.SendScintilla(QsciScintilla.SCI_CALLTIPSETHLT, astart + 1, aend) + self.SendScintilla(QsciScintilla.SCI_CALLTIPSETHLT, + astart + 1, aend) def __adjustedCallTipPosition(self, ctshift, pos): """ @@ -4475,7 +4563,8 @@ if self.__unifiedMargins: self.marginMenu.popup(evt.globalPos()) else: - if self.__marginNumber(evt.x()) in [self.__bmMargin, self.__linenoMargin]: + if self.__marginNumber(evt.x()) in [self.__bmMargin, + self.__linenoMargin]: self.bmMarginMenu.popup(evt.globalPos()) elif self.__marginNumber(evt.x()) == self.__bpMargin: self.bpMarginMenu.popup(evt.globalPos()) @@ -4506,17 +4595,22 @@ self.menuActs["Diagrams"].setEnabled(False) if not self.miniMenu: if self.lexer_ is not None: - self.menuActs["Comment"].setEnabled(self.lexer_.canBlockComment()) - self.menuActs["Uncomment"].setEnabled(self.lexer_.canBlockComment()) - self.menuActs["StreamComment"].setEnabled(self.lexer_.canStreamComment()) - self.menuActs["BoxComment"].setEnabled(self.lexer_.canBoxComment()) + self.menuActs["Comment"].setEnabled( + self.lexer_.canBlockComment()) + self.menuActs["Uncomment"].setEnabled( + self.lexer_.canBlockComment()) + self.menuActs["StreamComment"].setEnabled( + self.lexer_.canStreamComment()) + self.menuActs["BoxComment"].setEnabled( + self.lexer_.canBoxComment()) else: self.menuActs["Comment"].setEnabled(False) self.menuActs["Uncomment"].setEnabled(False) self.menuActs["StreamComment"].setEnabled(False) self.menuActs["BoxComment"].setEnabled(False) - self.menuActs["TypingAidsEnabled"].setEnabled(self.completer is not None) + self.menuActs["TypingAidsEnabled"].setEnabled( + self.completer is not None) self.menuActs["TypingAidsEnabled"].setChecked( self.completer is not None and self.completer.isEnabled()) @@ -4557,7 +4651,8 @@ coEnable = False # first check if the file belongs to a project - if self.project.isOpen() and self.project.isProjectSource(self.fileName): + if self.project.isOpen() and \ + self.project.isProjectSource(self.fileName): fn = self.project.getMainScript(True) if fn is not None: tfn = Utilities.getTestFileName(fn) @@ -4600,9 +4695,11 @@ def __showContextMenuGraphics(self): """ - Private slot handling the aboutToShow signal of the diagrams context menu. - """ - if self.project.isOpen() and self.project.isProjectSource(self.fileName): + Private slot handling the aboutToShow signal of the diagrams context + menu. + """ + if self.project.isOpen() and \ + self.project.isProjectSource(self.fileName): self.applicationDiagramMenuAct.setEnabled(True) else: self.applicationDiagramMenuAct.setEnabled(False) @@ -4611,7 +4708,8 @@ def __showContextMenuMargin(self): """ - Private slot handling the aboutToShow signal of the margins context menu. + Private slot handling the aboutToShow signal of the margins context + menu. """ if self.fileName and \ (self.isPy3File() or self.isPy2File() or self.isRubyFile()): @@ -4706,7 +4804,8 @@ def __showContextMenuChecks(self): """ - Private slot handling the aboutToShow signal of the checks context menu. + Private slot handling the aboutToShow signal of the checks context + menu. """ self.showMenu.emit("Checks", self.checksMenu, self) @@ -4808,7 +4907,8 @@ def shortenEmptyLines(self): """ - Public slot to compress lines consisting solely of whitespace characters. + Public slot to compress lines consisting solely of whitespace + characters. """ searchRE = r"^[ \t]+$" @@ -4849,7 +4949,8 @@ self.clearFlakesWarnings() if self.isPy3File(): syntaxError, _fn, errorline, errorindex, _code, _error = \ - Utilities.compile(self.fileName or "(Unnamed)", self.text()) + Utilities.compile(self.fileName or "(Unnamed)", + self.text()) if syntaxError: self.toggleSyntaxError( int(errorline), int(errorindex), True, _error) @@ -4864,7 +4965,8 @@ txt = self.text()\ .replace("\r\n", "\n")\ .replace("\r", "\n") - warnings = Checker(txt, self.fileName or "(Unnamed)") + warnings = Checker( + txt, self.fileName or "(Unnamed)") warnings.messages.sort(key=lambda a: a.lineno) for warning in warnings.messages: if ignoreStarImportWarnings and \ @@ -4872,8 +4974,9 @@ continue _fn, lineno, message = warning.getMessageData() - if "__IGNORE_WARNING__" not in Utilities.extractLineFlags( - self.text(lineno - 1).strip()): + if "__IGNORE_WARNING__" not in \ + Utilities.extractLineFlags( + self.text(lineno - 1).strip()): self.toggleFlakesWarning( lineno, True, message) except SyntaxError as err: @@ -4928,7 +5031,8 @@ def __getCodeCoverageFile(self): """ - Private method to get the filename of the file containing coverage info. + Private method to get the filename of the file containing coverage + info. @return filename of the coverage file (string) """ @@ -4936,7 +5040,8 @@ # first check if the file belongs to a project and there is # a project coverage file - if self.project.isOpen() and self.project.isProjectSource(self.fileName): + if self.project.isOpen() and \ + self.project.isProjectSource(self.fileName): fn = self.project.getMainScript(True) if fn is not None: tfn = Utilities.getTestFileName(fn) @@ -5001,7 +5106,8 @@ def codeCoverageShowAnnotations(self, silent=False): """ - Public method to handle the show code coverage annotations context menu action. + Public method to handle the show code coverage annotations context + menu action. @param silent flag indicating to not show any dialog (boolean) """ @@ -5033,7 +5139,8 @@ def __codeCoverageHideAnnotations(self): """ - Private method to handle the hide code coverage annotations context menu action. + Private method to handle the hide code coverage annotations context + menu action. """ for handle in self.notcoveredMarkers: self.markerDeleteHandle(handle) @@ -5078,7 +5185,8 @@ ucline = self.markerFindPrevious(line, 1 << self.notcovered) if ucline < 0: # wrap around - ucline = self.markerFindPrevious(self.lines() - 1, 1 << self.notcovered) + ucline = self.markerFindPrevious( + self.lines() - 1, 1 << self.notcovered) if ucline >= 0: self.setCursorPosition(ucline, 0) self.ensureLineVisible(ucline) @@ -5091,7 +5199,8 @@ # first check if the file belongs to a project and there is # a project profile file - if self.project.isOpen() and self.project.isProjectSource(self.fileName): + if self.project.isOpen() and \ + self.project.isProjectSource(self.fileName): fn = self.project.getMainScript(True) if fn is not None: tfn = Utilities.getTestFileName(fn) @@ -5141,21 +5250,23 @@ def __lmBbookmarks(self): """ - Private method to handle the 'LMB toggles bookmark' context menu action. + Private method to handle the 'LMB toggles bookmark' context menu + action. """ self.marginMenuActs["LMBbookmarks"].setChecked(True) self.marginMenuActs["LMBbreakpoints"].setChecked(False) def __lmBbreakpoints(self): """ - Private method to handle the 'LMB toggles breakpoint' context menu action. + Private method to handle the 'LMB toggles breakpoint' context menu + action. """ self.marginMenuActs["LMBbookmarks"].setChecked(True) self.marginMenuActs["LMBbreakpoints"].setChecked(False) - ############################################################################ + ########################################################################### ## Syntax error handling methods below - ############################################################################ + ########################################################################### def toggleSyntaxError(self, line, index, error, msg="", show=False): """ @@ -5262,9 +5373,9 @@ self.trUtf8("Syntax Error"), self.trUtf8("No syntax error message available.")) - ############################################################################ + ########################################################################### ## Flakes warning handling methods below - ############################################################################ + ########################################################################### def toggleFlakesWarning(self, line, warning, msg="", warningType=WarningCode): @@ -5355,7 +5466,8 @@ fwline = self.markerFindPrevious(line, 1 << self.warning) if fwline < 0: # wrap around - fwline = self.markerFindPrevious(self.lines() - 1, 1 << self.warning) + fwline = self.markerFindPrevious( + self.lines() - 1, 1 << self.warning) if fwline >= 0: self.setCursorPosition(fwline, 0) self.ensureLineVisible(fwline) @@ -5391,36 +5503,43 @@ self.trUtf8("Warning"), self.trUtf8("No warning messages available.")) - ############################################################################ + ########################################################################### ## Annotation handling methods below - ############################################################################ + ########################################################################### def __setAnnotationStyles(self): """ Private slot to define the style used by inline annotations. """ if hasattr(QsciScintilla, "annotate"): - self.annotationWarningStyle = QsciScintilla.STYLE_LASTPREDEFINED + 1 - self.SendScintilla(QsciScintilla.SCI_STYLESETFORE, + self.annotationWarningStyle = \ + QsciScintilla.STYLE_LASTPREDEFINED + 1 + self.SendScintilla( + QsciScintilla.SCI_STYLESETFORE, self.annotationWarningStyle, Preferences.getEditorColour("AnnotationsWarningForeground")) - self.SendScintilla(QsciScintilla.SCI_STYLESETBACK, + self.SendScintilla( + QsciScintilla.SCI_STYLESETBACK, self.annotationWarningStyle, Preferences.getEditorColour("AnnotationsWarningBackground")) self.annotationErrorStyle = self.annotationWarningStyle + 1 - self.SendScintilla(QsciScintilla.SCI_STYLESETFORE, + self.SendScintilla( + QsciScintilla.SCI_STYLESETFORE, self.annotationErrorStyle, Preferences.getEditorColour("AnnotationsErrorForeground")) - self.SendScintilla(QsciScintilla.SCI_STYLESETBACK, + self.SendScintilla( + QsciScintilla.SCI_STYLESETBACK, self.annotationErrorStyle, Preferences.getEditorColour("AnnotationsErrorBackground")) self.annotationStyleStyle = self.annotationErrorStyle + 1 - self.SendScintilla(QsciScintilla.SCI_STYLESETFORE, + self.SendScintilla( + QsciScintilla.SCI_STYLESETFORE, self.annotationStyleStyle, Preferences.getEditorColour("AnnotationsStyleForeground")) - self.SendScintilla(QsciScintilla.SCI_STYLESETBACK, + self.SendScintilla( + QsciScintilla.SCI_STYLESETBACK, self.annotationStyleStyle, Preferences.getEditorColour("AnnotationsStyleBackground")) @@ -5484,7 +5603,8 @@ """ if hasattr(QsciScintilla, "annotate"): self.clearAnnotations() - for handle in list(self.warnings.keys()) + list(self.syntaxerrors.keys()): + for handle in list(self.warnings.keys()) + \ + list(self.syntaxerrors.keys()): line = self.markerLine(handle) self.__setAnnotation(line) @@ -5496,8 +5616,8 @@ """ Private method to select a macro name from the list of macros. - @return Tuple of macro name and a flag, indicating, if the user pressed ok or - canceled the operation. (string, boolean) + @return Tuple of macro name and a flag, indicating, if the user + pressed ok or canceled the operation. (string, boolean) """ qs = [] for s in list(self.macros.keys()): @@ -5547,7 +5667,8 @@ except IOError: E5MessageBox.critical(self, self.trUtf8("Error loading macro"), - self.trUtf8("<p>The macro file <b>{0}</b> could not be read.</p>") + self.trUtf8( + "<p>The macro file <b>{0}</b> could not be read.</p>") .format(fname)) return @@ -5605,7 +5726,8 @@ except IOError: E5MessageBox.critical(self, self.trUtf8("Error saving macro"), - self.trUtf8("<p>The macro file <b>{0}</b> could not be written.</p>") + self.trUtf8( + "<p>The macro file <b>{0}</b> could not be written.</p>") .format(fname)) return @@ -5737,7 +5859,8 @@ This method checks for modifications of the current file and rereads it upon request. The cursor is placed at the current position - assuming, that it is in the vicinity of the old position after the reread. + assuming, that it is in the vicinity of the old position after the + reread. @param event the event object (QFocusEvent) """ @@ -5761,8 +5884,9 @@ self.refresh() else: msg = self.trUtf8( - """<p>The file <b>{0}</b> has been changed while it was opened in""" - """ eric5. Reread it?</p>""").format(self.fileName) + """<p>The file <b>{0}</b> has been changed while it""" + """ was opened in eric5. Reread it?</p>""")\ + .format(self.fileName) yesDefault = True if self.isModified(): msg += self.trUtf8( @@ -5901,7 +6025,8 @@ """ if self.fileName is None: return - readOnly = not QFileInfo(self.fileName).isWritable() or self.isReadOnly() + readOnly = not QFileInfo(self.fileName).isWritable() or \ + self.isReadOnly() if not bForce and (readOnly == self.isReadOnly()): return cap = self.fileName @@ -6068,7 +6193,8 @@ def __showContextMenuResources(self): """ - Private slot handling the aboutToShow signal of the resources context menu. + Private slot handling the aboutToShow signal of the resources context + menu. """ self.showMenu.emit("Resources", self.resourcesMenu, self) @@ -6134,7 +6260,8 @@ def __addLocalizedResource(self): """ - Private method to handle the Add localized resource context menu action. + Private method to handle the Add localized resource context menu + action. """ from Project.AddLanguageDialog import AddLanguageDialog dlg = AddLanguageDialog(self) @@ -6168,7 +6295,8 @@ if not self.checkDirty(): return - self.classDiagram = UMLDialog(UMLDialog.ClassDiagram, self.project, self.fileName, + self.classDiagram = UMLDialog( + UMLDialog.ClassDiagram, self.project, self.fileName, self, noAttrs=False) self.classDiagram.show() @@ -6180,14 +6308,15 @@ if not self.checkDirty(): return - package = os.path.isdir(self.fileName) and self.fileName \ - or os.path.dirname(self.fileName) + package = os.path.isdir(self.fileName) and \ + self.fileName or os.path.dirname(self.fileName) res = E5MessageBox.yesNo(self, self.trUtf8("Package Diagram"), self.trUtf8("""Include class attributes?"""), yesDefault=True) - self.packageDiagram = UMLDialog(UMLDialog.PackageDiagram, self.project, package, - self, noAttrs=not res) + self.packageDiagram = UMLDialog( + UMLDialog.PackageDiagram, self.project, package, + self, noAttrs=not res) self.packageDiagram.show() def __showImportsDiagram(self): @@ -6199,12 +6328,13 @@ return package = os.path.isdir(self.fileName) and self.fileName \ - or os.path.dirname(self.fileName) + or os.path.dirname(self.fileName) res = E5MessageBox.yesNo(self, self.trUtf8("Imports Diagram"), self.trUtf8("""Include imports from external modules?""")) - self.importsDiagram = UMLDialog(UMLDialog.ImportsDiagram, self.project, package, - self, showExternalImports=res) + self.importsDiagram = UMLDialog( + UMLDialog.ImportsDiagram, self.project, package, + self, showExternalImports=res) self.importsDiagram.show() def __showApplicationDiagram(self): @@ -6216,8 +6346,9 @@ self.trUtf8("Application Diagram"), self.trUtf8("""Include module names?"""), yesDefault=True) - self.applicationDiagram = UMLDialog(UMLDialog.ApplicationDiagram, self.project, - self, noModules=not res) + self.applicationDiagram = UMLDialog( + UMLDialog.ApplicationDiagram, self.project, + self, noModules=not res) self.applicationDiagram.show() def __loadDiagram(self): @@ -6225,7 +6356,8 @@ Private slot to load a diagram from file. """ from Graphics.UMLDialog import UMLDialog - self.loadedDiagram = UMLDialog(UMLDialog.NoDiagram, self.project, parent=self) + self.loadedDiagram = UMLDialog( + UMLDialog.NoDiagram, self.project, parent=self) if self.loadedDiagram.load(): self.loadedDiagram.show(fromFile=True) else: @@ -6267,7 +6399,8 @@ e5App().getObject("TemplateViewer").getTemplateNames( tmplName, self.getLanguage()) if len(templateNames) == 1: - self.__applyTemplate(templateNames[0], self.getLanguage()) + self.__applyTemplate(templateNames[0], + self.getLanguage()) return elif len(templateNames) > 1: self.showUserList(TemplateCompletionListID, @@ -6326,7 +6459,8 @@ self.__setSpellingLanguage(self.project.getProjectSpellLanguage(), pwl=pwl, pel=pel) - self.project.projectPropertiesChanged.connect(self.__projectPropertiesChanged) + self.project.projectPropertiesChanged.connect( + self.__projectPropertiesChanged) def projectOpened(self): """ @@ -6334,7 +6468,8 @@ """ if self.fileName and \ self.project.isProjectSource(self.fileName): - self.project.projectPropertiesChanged.connect(self.__projectPropertiesChanged) + self.project.projectPropertiesChanged.connect( + self.__projectPropertiesChanged) self.setSpellingForProject() def projectClosed(self): @@ -6368,7 +6503,8 @@ Private method to initialize the spell checking functionality. """ if Preferences.getEditor("SpellCheckingEnabled"): - self.__spellCheckStringsOnly = Preferences.getEditor("SpellCheckStringsOnly") + self.__spellCheckStringsOnly = Preferences.getEditor( + "SpellCheckStringsOnly") if self.spell is None: from .SpellChecker import SpellChecker self.spell = SpellChecker(self, self.spellingIndicator, @@ -6400,7 +6536,8 @@ """ if Preferences.getEditor("AutoSpellCheckingEnabled"): try: - self.SCN_CHARADDED.connect(self.__spellCharAdded, Qt.UniqueConnection) + self.SCN_CHARADDED.connect( + self.__spellCharAdded, Qt.UniqueConnection) except TypeError: pass self.spell.checkDocumentIncrementally() @@ -6413,8 +6550,8 @@ def isSpellCheckRegion(self, pos): """ - Public method to check, if the given position is within a region, that should - be spell checked. + Public method to check, if the given position is within a region, that + should be spell checked. @param pos position to be checked (integer) @return flag indicating pos is in a spell check region (boolean) @@ -6435,8 +6572,10 @@ """ if self.spell: if not chr(charNumber).isalnum(): - self.spell.checkWord(self.positionBefore(self.currentPosition()), True) - elif self.hasIndicator(self.spellingIndicator, self.currentPosition()): + self.spell.checkWord( + self.positionBefore(self.currentPosition()), True) + elif self.hasIndicator( + self.spellingIndicator, self.currentPosition()): self.spell.checkWord(self.currentPosition()) def checkSpelling(self): @@ -6485,10 +6624,12 @@ word = self.getWord(line, index) suggestions = self.spell.getSuggestions(word) for suggestion in suggestions[:5]: - self.spellingSuggActs.append(self.spellingMenu.addAction(suggestion)) + self.spellingSuggActs.append( + self.spellingMenu.addAction(suggestion)) if suggestions: self.spellingMenu.addSeparator() - self.spellingMenu.addAction(UI.PixmapCache.getIcon("spellchecking.png"), + self.spellingMenu.addAction( + UI.PixmapCache.getIcon("spellchecking.png"), self.trUtf8("Check spelling..."), self.__checkSpellingWord) self.spellingMenu.addAction(self.trUtf8("Add to dictionary"), self.__addToSpellingDictionary) @@ -6499,7 +6640,8 @@ def __contextMenuSpellingTriggered(self, action): """ - Private slot to handle the selection of a suggestion of the spelling context menu. + Private slot to handle the selection of a suggestion of the spelling + context menu. @param action reference to the action that was selected (QAction) """ @@ -6515,20 +6657,23 @@ def __addToSpellingDictionary(self): """ - Private slot to add the word below the spelling context menu to the dictionary. + Private slot to add the word below the spelling context menu to the + dictionary. """ line, index = self.lineIndexFromPosition(self.spellingMenuPos) word = self.getWord(line, index) self.spell.add(word) wordStart, wordEnd = self.getWordBoundaries(line, index) - self.clearIndicator(self.spellingIndicator, line, wordStart, line, wordEnd) + self.clearIndicator(self.spellingIndicator, line, wordStart, + line, wordEnd) if Preferences.getEditor("AutoSpellCheckingEnabled"): self.spell.checkDocumentIncrementally() def __removeFromSpellingDictionary(self): """ - Private slot to remove the word below the context menu to the dictionary. + Private slot to remove the word below the context menu to the + dictionary. """ line, index = self.lineIndexFromPosition(self.spellingMenuPos) word = self.getWord(line, index) @@ -6555,9 +6700,9 @@ """ Public method to get some share status info. - @return tuple indicating, if the editor is sharable, the sharing status, - if it is inside a locally initiated shared edit session and - if it is inside a remotely initiated shared edit session + @return tuple indicating, if the editor is sharable, the sharing + status, if it is inside a locally initiated shared edit session + and if it is inside a remotely initiated shared edit session (boolean, boolean, boolean, boolean) """ return self.fileName is not None and \ @@ -6882,7 +7027,8 @@ endLine = max(origStartLine, origEndLine) endIndex = max(origStartIndex, origEndIndex) - # step 1: extract the text of the rectangular selection and the lines + # step 1: extract the text of the rectangular selection and + # the lines selText = {} txtLines = {} for line in range(startLine, endLine + 1): @@ -6894,8 +7040,9 @@ except ValueError: E5MessageBox.critical(self, self.trUtf8("Sort Lines"), - self.trUtf8("""The selection contains illegal data for a""" - """ numerical sort.""")) + self.trUtf8( + """The selection contains illegal data for a""" + """ numerical sort.""")) return if txt in selText:
--- a/QScintilla/EditorAssembly.py Sat Oct 12 18:25:29 2013 +0200 +++ b/QScintilla/EditorAssembly.py Sun Oct 13 12:21:37 2013 +0200 @@ -4,8 +4,8 @@ # """ -Module implementing the editor assembly widget containing the navigation combos and -the editor widget. +Module implementing the editor assembly widget containing the navigation +combos and the editor widget. """ from PyQt4.QtCore import QTimer @@ -16,17 +16,19 @@ class EditorAssembly(QWidget): """ - Class implementing the editor assembly widget containing the navigation combos and - the editor widget. + Class implementing the editor assembly widget containing the navigation + combos and the editor widget. """ - def __init__(self, dbs, fn=None, vm=None, filetype="", editor=None, tv=None): + def __init__(self, dbs, fn=None, vm=None, filetype="", editor=None, + tv=None): """ Constructor @param dbs reference to the debug server object @param fn name of the file to be opened (string). If it is None, - a new (empty) editor is opened - @param vm reference to the view manager object (ViewManager.ViewManager) + a new (empty) editor is opened + @param vm reference to the view manager object + (ViewManager.ViewManager) @param filetype type of the source file (string) @param editor reference to an Editor object, if this is a cloned view @param tv reference to the task viewer object @@ -85,11 +87,12 @@ def __globalsActivated(self, index, moveCursor=True): """ - Private method to jump to the line of the selected global entry and to populate - the members combo box. + Private method to jump to the line of the selected global entry and to + populate the members combo box. @param index index of the selected entry (integer) - @keyparam moveCursor flag indicating to move the editor cursor (boolean) + @keyparam moveCursor flag indicating to move the editor cursor + (boolean) """ # step 1: go to the line of the selected entry lineno = self.__globalsCombo.itemData(index) @@ -97,7 +100,8 @@ if moveCursor: txt = self.__editor.text(lineno - 1).rstrip() pos = len(txt.replace(txt.strip(), "")) - self.__editor.gotoLine(lineno, pos if pos == 0 else pos + 1, True) + self.__editor.gotoLine( + lineno, pos if pos == 0 else pos + 1, True) self.__editor.setFocus() # step 2: populate the members combo, if the entry is a class @@ -117,7 +121,8 @@ if cl.isPrivate(): icon = UI.PixmapCache.getIcon("class_private.png") elif cl.isProtected(): - icon = UI.PixmapCache.getIcon("class_protected.png") + icon = UI.PixmapCache.getIcon( + "class_protected.png") else: icon = UI.PixmapCache.getIcon("class.png") items[cl.name] = (icon, cl.lineno, cl.endlineno) @@ -125,7 +130,8 @@ itm = items[key] self.__membersCombo.addItem(itm[0], key, itm[1]) memberIndex += 1 - self.__membersBoundaries[(itm[1], itm[2])] = memberIndex + self.__membersBoundaries[(itm[1], itm[2])] = \ + memberIndex else: return @@ -156,7 +162,8 @@ if attr.isPrivate(): icon = UI.PixmapCache.getIcon("attribute_private.png") elif attr.isProtected(): - icon = UI.PixmapCache.getIcon("attribute_protected.png") + icon = UI.PixmapCache.getIcon( + "attribute_protected.png") else: icon = UI.PixmapCache.getIcon("attribute.png") items[attr.name] = (icon, attr.lineno) @@ -178,7 +185,8 @@ Private method to jump to the line of the selected members entry. @param index index of the selected entry (integer) - @keyparam moveCursor flag indicating to move the editor cursor (boolean) + @keyparam moveCursor flag indicating to move the editor cursor + (boolean) """ lineno = self.__membersCombo.itemData(index) if lineno is not None and moveCursor: @@ -196,7 +204,8 @@ def __parseEditor(self): """ - Private method to parse the editor source and repopulate the globals combo. + Private method to parse the editor source and repopulate the globals + combo. """ from Utilities.ModuleParser import Module, getTypeFromTypeName @@ -272,7 +281,8 @@ if glob.isPrivate(): icon = UI.PixmapCache.getIcon("attribute_private.png") elif glob.isProtected(): - icon = UI.PixmapCache.getIcon("attribute_protected.png") + icon = UI.PixmapCache.getIcon( + "attribute_protected.png") else: icon = UI.PixmapCache.getIcon("attribute.png") items[glob.name] = (icon, glob.lineno) @@ -280,7 +290,8 @@ itm = items[key] self.__globalsCombo.addItem(itm[0], key, itm[1]) - # reset the currently selected entries without moving the text cursor + # reset the currently selected entries without moving the + # text cursor index = self.__globalsCombo.findText(self.__selectedGlobal) if index != -1: self.__globalsCombo.setCurrentIndex(index)
--- a/QScintilla/Exporters/ExporterHTML.py Sat Oct 12 18:25:29 2013 +0200 +++ b/QScintilla/Exporters/ExporterHTML.py Sun Oct 13 12:21:37 2013 +0200 @@ -45,8 +45,8 @@ @keyparam useTabs flag indicating the use of tab characters (boolean) @keyparam wysiwyg flag indicating colorization (boolean) @keyparam folding flag indicating usage of fold markers - @keyparam onlyStylesUsed flag indicating to include only style definitions - for styles used in the source (boolean) + @keyparam onlyStylesUsed flag indicating to include only style + definitions for styles used in the source (boolean) @keyparam titleFullPath flag indicating to include the full file path in the title tag (boolean) @return generated HTML text (string) @@ -68,13 +68,16 @@ styleIsUsed[index] = True styleIsUsed[QsciScintilla.STYLE_DEFAULT] = True - html = '''<!DOCTYPE html PUBLIC "-//W3C//DTD''' \ + html = \ + '''<!DOCTYPE html PUBLIC "-//W3C//DTD''' \ ''' XHTML 1.0 Transitional//EN"\n''' \ - ''' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n''' \ + ''' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">''' \ + '''\n''' \ '''<html xmlns="http://www.w3.org/1999/xhtml">\n''' \ '''<head>\n''' if titleFullPath: - html += '''<title>{0}</title>\n'''.format(self.editor.getFileName()) + html += '''<title>{0}</title>\n'''.format( + self.editor.getFileName()) else: html += '''<title>{0}</title>\n'''.format( os.path.basename(self.editor.getFileName())) @@ -82,32 +85,33 @@ '''<meta http-equiv="Content-Type" ''' \ '''content="text/html; charset=utf-8" />\n''' if folding: - html += '''<script language="JavaScript" type="text/javascript">\n''' \ - '''<!--\n''' \ - '''function symbol(id, sym) {\n''' \ - ''' if (id.textContent == undefined) {\n''' \ - ''' id.innerText = sym;\n''' \ - ''' } else {\n''' \ - ''' id.textContent = sym;\n''' \ - ''' }\n''' \ - '''}\n''' \ - '''function toggle(id) {\n''' \ - ''' var thislayer = document.getElementById('ln' + id);\n''' \ - ''' id -= 1;\n''' \ - ''' var togline = document.getElementById('hd' + id);\n''' \ - ''' var togsym = document.getElementById('bt' + id);\n''' \ - ''' if (thislayer.style.display == 'none') {\n''' \ - ''' thislayer.style.display = 'block';\n''' \ - ''' togline.style.textDecoration = 'none';\n''' \ - ''' symbol(togsym, '- ');\n''' \ - ''' } else {\n''' \ - ''' thislayer.style.display = 'none';\n''' \ - ''' togline.style.textDecoration = 'underline';\n''' \ - ''' symbol(togsym, '+ ');\n''' \ - ''' }\n''' \ - '''}\n''' \ - '''//-->\n''' \ - '''</script>\n''' + html += \ + '''<script language="JavaScript" type="text/javascript">\n''' \ + '''<!--\n''' \ + '''function symbol(id, sym) {\n''' \ + ''' if (id.textContent == undefined) {\n''' \ + ''' id.innerText = sym;\n''' \ + ''' } else {\n''' \ + ''' id.textContent = sym;\n''' \ + ''' }\n''' \ + '''}\n''' \ + '''function toggle(id) {\n''' \ + ''' var thislayer = document.getElementById('ln' + id);\n''' \ + ''' id -= 1;\n''' \ + ''' var togline = document.getElementById('hd' + id);\n''' \ + ''' var togsym = document.getElementById('bt' + id);\n''' \ + ''' if (thislayer.style.display == 'none') {\n''' \ + ''' thislayer.style.display = 'block';\n''' \ + ''' togline.style.textDecoration = 'none';\n''' \ + ''' symbol(togsym, '- ');\n''' \ + ''' } else {\n''' \ + ''' thislayer.style.display = 'none';\n''' \ + ''' togline.style.textDecoration = 'underline';\n''' \ + ''' symbol(togsym, '+ ');\n''' \ + ''' }\n''' \ + '''}\n''' \ + '''//-->\n''' \ + '''</script>\n''' lex = self.editor.getLexer() if lex: @@ -280,7 +284,8 @@ if self.editor.foldFlagsAt(line) & \ QsciScintilla.SC_FOLDLEVELHEADERFLAG: html += \ - '''<span id="hd{0:d}" onclick="toggle('{1:d}')">'''\ + '''<span id="hd{0:d}"''' \ + ''' onclick="toggle('{1:d}')">''' \ .format(line, line + 1) html += '''<span id="bt{0:d}">- </span>'''.format(line) inFoldSpan = True @@ -375,8 +380,10 @@ tabSize = 4 wysiwyg = Preferences.getEditorExporter("HTML/WYSIWYG") folding = Preferences.getEditorExporter("HTML/Folding") - onlyStylesUsed = Preferences.getEditorExporter("HTML/OnlyStylesUsed") - titleFullPath = Preferences.getEditorExporter("HTML/FullPathAsTitle") + onlyStylesUsed = Preferences.getEditorExporter( + "HTML/OnlyStylesUsed") + titleFullPath = Preferences.getEditorExporter( + "HTML/FullPathAsTitle") tabs = Preferences.getEditorExporter("HTML/UseTabs") generator = HTMLGenerator(self.editor) @@ -395,11 +402,12 @@ f.close() except IOError as err: QApplication.restoreOverrideCursor() - E5MessageBox.critical(self.editor, + E5MessageBox.critical( + self.editor, self.trUtf8("Export source"), self.trUtf8( - """<p>The source could not be exported to <b>{0}</b>.</p>""" - """<p>Reason: {1}</p>""")\ + """<p>The source could not be exported to""" + """ <b>{0}</b>.</p><p>Reason: {1}</p>""")\ .format(filename, str(err))) finally: QApplication.restoreOverrideCursor()
--- a/QScintilla/Exporters/ExporterODT.py Sat Oct 12 18:25:29 2013 +0200 +++ b/QScintilla/Exporters/ExporterODT.py Sun Oct 13 12:21:37 2013 +0200 @@ -8,7 +8,8 @@ """ from PyQt4.QtCore import Qt -from PyQt4.QtGui import QApplication, QCursor, QTextDocument, QTextDocumentWriter +from PyQt4.QtGui import QApplication, QCursor, QTextDocument, \ + QTextDocumentWriter from E5Gui import E5MessageBox @@ -67,8 +68,9 @@ ok = writer.write(doc) QApplication.restoreOverrideCursor() if not ok: - E5MessageBox.critical(self.editor, + E5MessageBox.critical( + self.editor, self.trUtf8("Export source"), self.trUtf8( - """<p>The source could not be exported to <b>{0}</b>.</p>""")\ - .format(filename)) + """<p>The source could not be exported to""" + """ <b>{0}</b>.</p>""").format(filename))
--- a/QScintilla/Exporters/ExporterPDF.py Sat Oct 12 18:25:29 2013 +0200 +++ b/QScintilla/Exporters/ExporterPDF.py Sun Oct 13 12:21:37 2013 +0200 @@ -28,8 +28,9 @@ PDFfontNames = [ "Courier", "Courier-Bold", "Courier-Oblique", "Courier-BoldOblique", - "Helvetica", "Helvetica-Bold", "Helvetica-Oblique", "Helvetica-BoldOblique", - "Times-Roman", "Times-Bold", "Times-Italic", "Times-BoldItalic" + "Helvetica", "Helvetica-Bold", "Helvetica-Oblique", + "Helvetica-BoldOblique", "Times-Roman", "Times-Bold", "Times-Italic", + "Times-BoldItalic" ] PDFfontAscenders = [629, 718, 699] PDFfontDescenders = [157, 207, 217] @@ -174,12 +175,12 @@ buf = "" if styleNext != self.styleCurrent or style_ == -1: - if self.style[self.styleCurrent].font != self.style[styleNext].font or \ - style_ == -1: - buf += "/F{0:d} {1:d} Tf ".format(self.style[styleNext].font + 1, - self.fontSize) - if self.style[self.styleCurrent].fore != self.style[styleNext].fore or \ - style_ == -1: + if self.style[self.styleCurrent].font != \ + self.style[styleNext].font or style_ == -1: + buf += "/F{0:d} {1:d} Tf ".format( + self.style[styleNext].font + 1, self.fontSize) + if self.style[self.styleCurrent].fore != \ + self.style[styleNext].fore or style_ == -1: buf += "{0}rg ".format(self.style[styleNext].fore) return buf @@ -213,8 +214,9 @@ # to be inserted (PDF1.4Ref(p317)) for i in range(4): buffer = \ - "<</Type/Font/Subtype/Type1/Name/F{0:d}/BaseFont/{1}/Encoding/{2}>>\n"\ - .format(i + 1, PDFfontNames[self.fontSet * 4 + i], PDF_ENCODING) + "<</Type/Font/Subtype/Type1/Name/F{0:d}/BaseFont/{1}/" \ + "Encoding/{2}>>\n".format( + i + 1, PDFfontNames[self.fontSet * 4 + i], PDF_ENCODING) self.oT.add(buffer) self.pageContentStart = self.oT.index @@ -229,7 +231,8 @@ # refer to all used or unused fonts for simplicity resourceRef = self.oT.add( - "<</ProcSet[/PDF/Text]\n/Font<</F1 1 0 R/F2 2 0 R/F3 3 0 R/F4 4 0 R>> >>\n") + "<</ProcSet[/PDF/Text]\n/Font<</F1 1 0 R/F2 2 0 R/F3 3 0 R/" + "F4 4 0 R>> >>\n") # create all the page objects (PDF1.4Ref(p88)) # forward reference pages object; calculate its object number @@ -259,8 +262,9 @@ xref = self.oT.xref() # end the file with the trailer (PDF1.4Ref(p67)) - buffer = "trailer\n<< /Size {0:d} /Root {1:d} 0 R\n>>\nstartxref\n{2:d}\n%%EOF\n"\ - .format(self.oT.index, catalogRef, xref) + buffer = \ + "trailer\n<< /Size {0:d} /Root {1:d} 0 R\n>>\nstartxref\n{2:d}\n" \ + "%%EOF\n".format(self.oT.index, catalogRef, xref) self.oT.write(buffer) def add(self, ch, style_): @@ -425,7 +429,8 @@ tabSize = 4 # get magnification value to add to default screen font size - self.pr.fontSize = Preferences.getEditorExporter("PDF/Magnification") + self.pr.fontSize = Preferences.getEditorExporter( + "PDF/Magnification") # set font family according to face name fontName = Preferences.getEditorExporter("PDF/Font") @@ -521,7 +526,8 @@ try: # save file in win ansi using cp1250 - f = open(filename, "w", encoding="cp1250", errors="backslashreplace") + f = open(filename, "w", encoding="cp1250", + errors="backslashreplace") # initialise PDF rendering ot = PDFObjectTracker(f) @@ -550,7 +556,8 @@ column += ts self.pr.add(' ' * ts, style) elif ch == b'\r' or ch == b'\n': - if ch == b'\r' and self.editor.byteAt(pos + 1) == b'\n': + if ch == b'\r' and \ + self.editor.byteAt(pos + 1) == b'\n': pos += 1 # close and begin a newline... self.pr.nextLine() @@ -566,14 +573,16 @@ utf8Len = 3 elif (utf8Ch[0] & 0xC0) == 0xC0: utf8Len = 2 - column -= 1 # will be incremented again later + column -= 1 # will be incremented + # again later elif len(utf8Ch) == utf8Len: ch = utf8Ch.decode('utf8') self.pr.add(ch, style) utf8Ch = b"" utf8Len = 0 else: - column -= 1 # will be incremented again later + column -= 1 # will be incremented + # again later else: self.pr.add(ch.decode(), style) column += 1 @@ -585,11 +594,12 @@ f.close() except IOError as err: QApplication.restoreOverrideCursor() - E5MessageBox.critical(self.editor, + E5MessageBox.critical( + self.editor, self.trUtf8("Export source"), self.trUtf8( - """<p>The source could not be exported to <b>{0}</b>.</p>""" - """<p>Reason: {1}</p>""")\ + """<p>The source could not be exported to""" + """ <b>{0}</b>.</p><p>Reason: {1}</p>""")\ .format(filename, str(err))) finally: QApplication.restoreOverrideCursor()
--- a/QScintilla/Exporters/ExporterRTF.py Sat Oct 12 18:25:29 2013 +0200 +++ b/QScintilla/Exporters/ExporterRTF.py Sun Oct 13 12:21:37 2013 +0200 @@ -38,7 +38,8 @@ RTF_INFOOPEN = "{\\info " RTF_INFOCLOSE = "}" RTF_COMMENT = "{\\comment Generated by eric5's RTF export filter.}" - RTF_CREATED = "{\creatim\yr%Y\mo%m\dy%d\hr%H\min%M\sec%S}" # to be used by strftime + # to be used by strftime + RTF_CREATED = "{\creatim\yr%Y\mo%m\dy%d\hr%H\min%M\sec%S}" RTF_BODYOPEN = "" RTF_BODYCLOSE = "}" @@ -86,7 +87,8 @@ def __GetRTFStyleChange(self, last, current): """ - Private method to extract control words that are different between two styles. + Private method to extract control words that are different between two + styles. @param last least recently used style (string) @param current current style (string) @@ -99,7 +101,8 @@ i = 0 while i < 6: lastPos, lastControl = self.__GetRTFNextControl(lastPos, last) - currentPos, currentControl = self.__GetRTFNextControl(currentPos, current) + currentPos, currentControl = self.__GetRTFNextControl(currentPos, + current) if lastControl != currentControl: delta += currentControl i += 1 @@ -130,7 +133,8 @@ if lex: defaultFont = lex.font(QsciScintilla.STYLE_DEFAULT) else: - defaultFont = Preferences.getEditorOtherFonts("DefaultFont") + defaultFont = Preferences.getEditorOtherFonts( + "DefaultFont") else: defaultFont = Preferences.getEditorExporter("RTF/Font") fontface = defaultFont.family() @@ -173,24 +177,26 @@ if wysiwyg: fontKey = None for key, value in list(fonts.items()): - if value.lower() == font.family().lower(): + if value.lower() == \ + font.family().lower(): fontKey = key break if fontKey is None: fonts[fontCount] = font.family() f.write(self.RTF_FONTDEF.format( - fontCount, characterset, font.family())) + fontCount, characterset, + font.family())) fontKey = fontCount fontCount += 1 - lastStyle = self.RTF_SETFONTFACE + "{0:d}".format( - fontKey) + lastStyle = self.RTF_SETFONTFACE + \ + "{0:d}".format(fontKey) else: lastStyle = self.RTF_SETFONTFACE + "0" if wysiwyg and QFontInfo(font).pointSize(): lastStyle += self.RTF_SETFONTSIZE + \ - "{0:d}".format( - QFontInfo(font).pointSize() << 1) + "{0:d}".format( + QFontInfo(font).pointSize() << 1) else: lastStyle += self.RTF_SETFONTSIZE + \ "{0:d}".format(fontsize) @@ -231,17 +237,19 @@ lastStyle += self.RTF_ITALIC_OFF styles[istyle] = lastStyle else: - styles[istyle] = self.RTF_SETFONTFACE + "0" + \ - self.RTF_SETFONTSIZE + \ - "{0:d}".format(fontsize) + \ - self.RTF_SETCOLOR + "0" + \ - self.RTF_SETBACKGROUND + "1" + \ - self.RTF_BOLD_OFF + self.RTF_ITALIC_OFF + styles[istyle] = \ + self.RTF_SETFONTFACE + "0" + \ + self.RTF_SETFONTSIZE + \ + "{0:d}".format(fontsize) + \ + self.RTF_SETCOLOR + "0" + \ + self.RTF_SETBACKGROUND + "1" + \ + self.RTF_BOLD_OFF + self.RTF_ITALIC_OFF istyle += 1 else: styles[0] = self.RTF_SETFONTFACE + "0" + \ - self.RTF_SETFONTSIZE + "{0:d}".format(fontsize) + \ + self.RTF_SETFONTSIZE + \ + "{0:d}".format(fontsize) + \ self.RTF_SETCOLOR + "0" + \ self.RTF_SETBACKGROUND + "1" + \ self.RTF_BOLD_OFF + self.RTF_ITALIC_OFF @@ -278,7 +286,8 @@ ch = self.editor.byteAt(pos) style = self.editor.styleAt(pos) if style != styleCurrent: - deltaStyle = self.__GetRTFStyleChange(lastStyle, styles[style]) + deltaStyle = self.__GetRTFStyleChange( + lastStyle, styles[style]) if deltaStyle: f.write(deltaStyle) styleCurrent = style @@ -337,11 +346,12 @@ f.close() except IOError as err: QApplication.restoreOverrideCursor() - E5MessageBox.critical(self.editor, + E5MessageBox.critical( + self.editor, self.trUtf8("Export source"), self.trUtf8( - """<p>The source could not be exported to <b>{0}</b>.</p>""" - """<p>Reason: {1}</p>""")\ + """<p>The source could not be exported to""" + """ <b>{0}</b>.</p><p>Reason: {1}</p>""")\ .format(filename, str(err))) finally: QApplication.restoreOverrideCursor()
--- a/QScintilla/Exporters/ExporterTEX.py Sat Oct 12 18:25:29 2013 +0200 +++ b/QScintilla/Exporters/ExporterTEX.py Sun Oct 13 12:21:37 2013 +0200 @@ -60,7 +60,8 @@ def __texStyle(self, style): """ - Private method to calculate a style name string for a given style number. + Private method to calculate a style name string for a given style + number. @param style style number (integer) @return style name string (string) @@ -85,8 +86,9 @@ @param istyle style number (integer) """ closing_brackets = 3 - file.write("\\newcommand{{\\eric{0}}}[1]{{\\noindent{{\\ttfamily{{".format( - self.__texStyle(istyle))) + file.write( + "\\newcommand{{\\eric{0}}}[1]{{\\noindent{{\\ttfamily{{".format( + self.__texStyle(istyle))) if font.italic(): file.write("\\textit{") closing_brackets += 1 @@ -94,10 +96,12 @@ file.write("\\textbf{") closing_brackets += 1 if color != self.defaultColor: - file.write("\\textcolor[rgb]{{{0}}}{{".format(self.__getTexRGB(color))) + file.write( + "\\textcolor[rgb]{{{0}}}{{".format(self.__getTexRGB(color))) closing_brackets += 1 if paper != self.defaultPaper: - file.write("\\colorbox[rgb]{{{0}}}{{".format(self.__getTexRGB(paper))) + file.write( + "\\colorbox[rgb]{{{0}}}{{".format(self.__getTexRGB(paper))) closing_brackets += 1 file.write("#1{0}\n".format('}' * closing_brackets)) @@ -119,8 +123,10 @@ if tabSize == 0: tabSize = 4 - onlyStylesUsed = Preferences.getEditorExporter("TeX/OnlyStylesUsed") - titleFullPath = Preferences.getEditorExporter("TeX/FullPathAsTitle") + onlyStylesUsed = Preferences.getEditorExporter( + "TeX/OnlyStylesUsed") + titleFullPath = Preferences.getEditorExporter( + "TeX/FullPathAsTitle") lex = self.editor.getLexer() self.defaultPaper = lex and \ @@ -174,7 +180,8 @@ colour = lex.color(istyle) paper = lex.paper(istyle) - self.__defineTexStyle(font, colour, paper, f, istyle) + self.__defineTexStyle(font, colour, paper, f, + istyle) istyle += 1 else: colour = self.editor.color() @@ -190,7 +197,8 @@ title = self.editor.getFileName() else: title = os.path.basename(self.editor.getFileName()) - f.write("Source File: {0}\n\n\\noindent\n\\tiny{{\n".format(title)) + f.write( + "Source File: {0}\n\n\\noindent\n\\tiny{{\n".format(title)) styleCurrent = self.editor.styleAt(0) f.write("\\eric{0}{{".format(self.__texStyle(styleCurrent))) @@ -206,7 +214,8 @@ style = self.editor.styleAt(pos) if style != styleCurrent: # new style - f.write("}}\n\\eric{0}{{".format(self.__texStyle(style))) + f.write( + "}}\n\\eric{0}{{".format(self.__texStyle(style))) styleCurrent = style if ch == b'\t': @@ -217,11 +226,13 @@ f.write("{\\textbackslash}") elif ch in [b'>', b'<', b'@']: f.write("${0}$".format(ch[0])) - elif ch in [b'{', b'}', b'^', b'_', b'&', b'$', b'#', b'%', b'~']: + elif ch in [b'{', b'}', b'^', b'_', b'&', b'$', b'#', + b'%', b'~']: f.write("\\{0}".format(ch[0])) elif ch in [b'\r', b'\n']: lineIdx = -1 # because incremented below - if ch == b'\r' and self.editor.byteAt(pos + 1) == b'\n': + if ch == b'\r' and \ + self.editor.byteAt(pos + 1) == b'\n': pos += 1 # skip the LF styleCurrent = self.editor.styleAt(pos + 1) f.write("}} \\\\\n\\eric{0}{{".format( @@ -259,8 +270,8 @@ E5MessageBox.critical(self.editor, self.trUtf8("Export source"), self.trUtf8( - """<p>The source could not be exported to <b>{0}</b>.</p>""" - """<p>Reason: {1}</p>""")\ + """<p>The source could not be exported to""" + """ <b>{0}</b>.</p><p>Reason: {1}</p>""")\ .format(filename, str(err))) finally: QApplication.restoreOverrideCursor()
--- a/QScintilla/Exporters/__init__.py Sat Oct 12 18:25:29 2013 +0200 +++ b/QScintilla/Exporters/__init__.py Sun Oct 13 12:21:37 2013 +0200 @@ -35,7 +35,8 @@ @param format format of the exporter (string) @param editor reference to the editor object (QScintilla.Editor.Editor) - @return reference to the instanciated exporter object (QScintilla.Exporter.Exporter) + @return reference to the instanciated exporter object + (QScintilla.Exporter.Exporter) """ try: if format == "HTML":
--- a/QScintilla/Lexers/Lexer.py Sat Oct 12 18:25:29 2013 +0200 +++ b/QScintilla/Lexers/Lexer.py Sun Oct 13 12:21:37 2013 +0200 @@ -53,7 +53,8 @@ def canBlockComment(self): """ - Public method to determine, whether the lexer language supports a block comment. + Public method to determine, whether the lexer language supports a + block comment. @return flag (boolean) """ @@ -69,7 +70,8 @@ def canStreamComment(self): """ - Public method to determine, whether the lexer language supports a stream comment. + Public method to determine, whether the lexer language supports a + stream comment. @return flag (boolean) """ @@ -87,7 +89,8 @@ def canBoxComment(self): """ - Public method to determine, whether the lexer language supports a box comment. + Public method to determine, whether the lexer language supports a + box comment. @return flag (boolean) """
--- a/QScintilla/Lexers/LexerCPP.py Sat Oct 12 18:25:29 2013 +0200 +++ b/QScintilla/Lexers/LexerCPP.py Sun Oct 13 12:21:37 2013 +0200 @@ -58,7 +58,8 @@ except AttributeError: pass try: - self.setStylePreprocessor(Preferences.getEditor("CppStylePreprocessor")) + self.setStylePreprocessor( + Preferences.getEditor("CppStylePreprocessor")) except AttributeError: pass try:
--- a/QScintilla/Lexers/LexerHTML.py Sat Oct 12 18:25:29 2013 +0200 +++ b/QScintilla/Lexers/LexerHTML.py Sun Oct 13 12:21:37 2013 +0200 @@ -40,12 +40,15 @@ Preferences.getEditor("HtmlCaseSensitiveTags")) self.setFoldCompact(Preferences.getEditor("AllFoldCompact")) try: - self.setFoldScriptComments(Preferences.getEditor("HtmlFoldScriptComments")) - self.setFoldScriptHeredocs(Preferences.getEditor("HtmlFoldScriptHeredocs")) + self.setFoldScriptComments( + Preferences.getEditor("HtmlFoldScriptComments")) + self.setFoldScriptHeredocs( + Preferences.getEditor("HtmlFoldScriptHeredocs")) except AttributeError: pass try: - self.setDjangoTemplates(Preferences.getEditor("HtmlDjangoTemplates")) + self.setDjangoTemplates( + Preferences.getEditor("HtmlDjangoTemplates")) self.setMakoTemplates(Preferences.getEditor("HtmlMakoTemplates")) except AttributeError: pass
--- a/QScintilla/Lexers/LexerPascal.py Sat Oct 12 18:25:29 2013 +0200 +++ b/QScintilla/Lexers/LexerPascal.py Sun Oct 13 12:21:37 2013 +0200 @@ -37,10 +37,12 @@ Public slot to initialize the properties. """ self.setFoldComments(Preferences.getEditor("PascalFoldComment")) - self.setFoldPreprocessor(Preferences.getEditor("PascalFoldPreprocessor")) + self.setFoldPreprocessor( + Preferences.getEditor("PascalFoldPreprocessor")) self.setFoldCompact(Preferences.getEditor("AllFoldCompact")) try: - self.setSmartHighlighting(Preferences.getEditor("PascalSmartHighlighting")) + self.setSmartHighlighting( + Preferences.getEditor("PascalSmartHighlighting")) except AttributeError: pass
--- a/QScintilla/Lexers/LexerProperties.py Sat Oct 12 18:25:29 2013 +0200 +++ b/QScintilla/Lexers/LexerProperties.py Sun Oct 13 12:21:37 2013 +0200 @@ -34,7 +34,8 @@ """ self.setFoldCompact(Preferences.getEditor("AllFoldCompact")) try: - self.setInitialSpaces(Preferences.getEditor("PropertiesInitialSpaces")) + self.setInitialSpaces( + Preferences.getEditor("PropertiesInitialSpaces")) except AttributeError: pass
--- a/QScintilla/Lexers/LexerPygments.py Sat Oct 12 18:25:29 2013 +0200 +++ b/QScintilla/Lexers/LexerPygments.py Sun Oct 13 12:21:37 2013 +0200 @@ -8,7 +8,8 @@ """ from pygments.token import Token -from pygments.lexers import guess_lexer_for_filename, guess_lexer, find_lexer_class +from pygments.lexers import guess_lexer_for_filename, guess_lexer, \ + find_lexer_class from pygments.util import ClassNotFound from PyQt4.QtGui import QColor, QFont @@ -305,7 +306,8 @@ @param style style number (integer) @return font (QFont) """ - if style in [PYGMENTS_COMMENT, PYGMENTS_PREPROCESSOR, PYGMENTS_MULTILINECOMMENT]: + if style in [PYGMENTS_COMMENT, PYGMENTS_PREPROCESSOR, + PYGMENTS_MULTILINECOMMENT]: if Utilities.isWindowsPlatform(): f = QFont("Comic Sans MS", 9) else: @@ -320,11 +322,12 @@ else: return QFont("Bitstream Vera Serif", 10) - if style in [PYGMENTS_KEYWORD, PYGMENTS_OPERATOR, PYGMENTS_WORD, PYGMENTS_BUILTIN, - PYGMENTS_ATTRIBUTE, PYGMENTS_FUNCTION, PYGMENTS_CLASS, - PYGMENTS_NAMESPACE, PYGMENTS_EXCEPTION, PYGMENTS_ENTITY, - PYGMENTS_TAG, PYGMENTS_SCALAR, PYGMENTS_ESCAPE, PYGMENTS_HEADING, - PYGMENTS_SUBHEADING, PYGMENTS_STRONG, PYGMENTS_PROMPT]: + if style in [PYGMENTS_KEYWORD, PYGMENTS_OPERATOR, PYGMENTS_WORD, + PYGMENTS_BUILTIN, PYGMENTS_ATTRIBUTE, PYGMENTS_FUNCTION, + PYGMENTS_CLASS, PYGMENTS_NAMESPACE, PYGMENTS_EXCEPTION, + PYGMENTS_ENTITY, PYGMENTS_TAG, PYGMENTS_SCALAR, + PYGMENTS_ESCAPE, PYGMENTS_HEADING, PYGMENTS_SUBHEADING, + PYGMENTS_STRONG, PYGMENTS_PROMPT]: f = LexerContainer.defaultFont(self, style) f.setBold(True) return f @@ -426,7 +429,8 @@ self.__lexer = self.__guessLexer(text) cpos = 0 - # adjust start position because pygments ignores empty line at start of text + # adjust start position because pygments ignores empty line at + # start of text for c in text: if c == "\n": cpos += 1 @@ -468,8 +472,8 @@ @return flag indicating a string style (boolean) """ return style in [PYGMENTS_STRING, PYGMENTS_DOCSTRING, PYGMENTS_OTHER, - PYGMENTS_HEADING, PYGMENTS_SUBHEADING, PYGMENTS_EMPHASIZE, - PYGMENTS_STRONG] + PYGMENTS_HEADING, PYGMENTS_SUBHEADING, + PYGMENTS_EMPHASIZE, PYGMENTS_STRONG] def defaultKeywords(self, kwSet): """
--- a/QScintilla/Lexers/LexerPython.py Sat Oct 12 18:25:29 2013 +0200 +++ b/QScintilla/Lexers/LexerPython.py Sun Oct 13 12:21:37 2013 +0200 @@ -56,8 +56,10 @@ if not Preferences.getEditor("PythonAutoIndent"): self.setAutoIndentStyle(QsciScintilla.AiMaintain) try: - self.setV2UnicodeAllowed(Preferences.getEditor("PythonAllowV2Unicode")) - self.setV3BinaryOctalAllowed(Preferences.getEditor("PythonAllowV3Binary")) + self.setV2UnicodeAllowed( + Preferences.getEditor("PythonAllowV2Unicode")) + self.setV3BinaryOctalAllowed( + Preferences.getEditor("PythonAllowV3Binary")) self.setV3BytesAllowed(Preferences.getEditor("PythonAllowV3Bytes")) except AttributeError: pass
--- a/QScintilla/Lexers/LexerSQL.py Sat Oct 12 18:25:29 2013 +0200 +++ b/QScintilla/Lexers/LexerSQL.py Sun Oct 13 12:21:37 2013 +0200 @@ -40,7 +40,8 @@ self.setFoldAtElse(Preferences.getEditor("SqlFoldAtElse")) self.setFoldOnlyBegin(Preferences.getEditor("SqlFoldOnlyBegin")) self.setHashComments(Preferences.getEditor("SqlHashComments")) - self.setQuotedIdentifiers(Preferences.getEditor("SqlQuotedIdentifiers")) + self.setQuotedIdentifiers( + Preferences.getEditor("SqlQuotedIdentifiers")) except AttributeError: pass
--- a/QScintilla/Lexers/LexerTeX.py Sat Oct 12 18:25:29 2013 +0200 +++ b/QScintilla/Lexers/LexerTeX.py Sun Oct 13 12:21:37 2013 +0200 @@ -35,7 +35,8 @@ try: self.setFoldCompact(Preferences.getEditor("AllFoldCompact")) self.setFoldComments(Preferences.getEditor("TexFoldComment")) - self.setProcessComments(Preferences.getEditor("TexProcessComments")) + self.setProcessComments( + Preferences.getEditor("TexProcessComments")) self.setProcessIf(Preferences.getEditor("TexProcessIf")) except AttributeError: pass
--- a/QScintilla/Lexers/LexerXML.py Sat Oct 12 18:25:29 2013 +0200 +++ b/QScintilla/Lexers/LexerXML.py Sun Oct 13 12:21:37 2013 +0200 @@ -40,8 +40,10 @@ Preferences.getEditor("HtmlCaseSensitiveTags")) self.setFoldCompact(Preferences.getEditor("AllFoldCompact")) try: - self.setFoldScriptComments(Preferences.getEditor("HtmlFoldScriptComments")) - self.setFoldScriptHeredocs(Preferences.getEditor("HtmlFoldScriptHeredocs")) + self.setFoldScriptComments( + Preferences.getEditor("HtmlFoldScriptComments")) + self.setFoldScriptHeredocs( + Preferences.getEditor("HtmlFoldScriptHeredocs")) self.setScriptsStyled(Preferences.getEditor("XMLStyleScripts")) except AttributeError: pass
--- a/QScintilla/Lexers/__init__.py Sat Oct 12 18:25:29 2013 +0200 +++ b/QScintilla/Lexers/__init__.py Sun Oct 13 12:21:37 2013 +0200 @@ -22,8 +22,8 @@ # This function must take a reference to the parent as argument. # 3. list of open file filters (list of strings) # 4. list of save file filters (list of strings) -# 5. default lexer associations (list of strings of filename wildcard patterns -# to be associated with the lexer) +# 5. default lexer associations (list of strings of filename wildcard +# patterns to be associated with the lexer) # 6. name of an icon file (string) LexerRegistry = {} @@ -37,12 +37,13 @@ @param name lexer language name (string) @param displayString display string (string) @param filenameSample dummy filename to derive lexer name (string) - @param getLexerFunc reference to a function instantiating the specific lexer. - This function must take a reference to the parent as its only argument. + @param getLexerFunc reference to a function instantiating the specific + lexer. This function must take a reference to the parent as its only + argument. @keyparam openFilters list of open file filters (list of strings) @keyparam saveFilters list of save file filters (list of strings) - @keyparam defaultAssocs default lexer associations (list of strings of filename - wildcard patterns to be associated with the lexer) + @keyparam defaultAssocs default lexer associations (list of strings of + filename wildcard patterns to be associated with the lexer) @keyparam iconFileName name of an icon file (string) @exception KeyError raised when the given name is already in use """ @@ -78,77 +79,78 @@ """ supportedLanguages = { "Bash": [QApplication.translate('Lexers', "Bash"), 'dummy.sh', - "lexerBash.png"], + "lexerBash.png"], "Batch": [QApplication.translate('Lexers', "Batch"), 'dummy.bat', - "lexerBatch.png"], + "lexerBatch.png"], "C++": [QApplication.translate('Lexers', "C/C++"), 'dummy.cpp', - "lexerCPP.png"], + "lexerCPP.png"], "C#": [QApplication.translate('Lexers', "C#"), 'dummy.cs', - "lexerCsharp.png"], + "lexerCsharp.png"], "CMake": [QApplication.translate('Lexers', "CMake"), 'dummy.cmake', - "lexerCMake.png"], + "lexerCMake.png"], "CSS": [QApplication.translate('Lexers', "CSS"), 'dummy.css', - "lexerCSS.png"], + "lexerCSS.png"], "D": [QApplication.translate('Lexers', "D"), 'dummy.d', - "lexerD.png"], + "lexerD.png"], "Diff": [QApplication.translate('Lexers', "Diff"), 'dummy.diff', - "lexerDiff.png"], + "lexerDiff.png"], "Fortran": [QApplication.translate('Lexers', "Fortran"), 'dummy.f95', - "lexerFortran.png"], + "lexerFortran.png"], "Fortran77": [QApplication.translate('Lexers', "Fortran77"), 'dummy.f', - "lexerFortran.png"], - "HTML": [QApplication.translate('Lexers', "HTML/PHP/XML"), 'dummy.html', - "lexerHTML.png"], + "lexerFortran.png"], + "HTML": [QApplication.translate('Lexers', "HTML/PHP/XML"), + 'dummy.html', "lexerHTML.png"], "IDL": [QApplication.translate('Lexers', "IDL"), 'dummy.idl', - "lexerIDL.png"], + "lexerIDL.png"], "Java": [QApplication.translate('Lexers', "Java"), 'dummy.java', - "lexerJava.png"], - "JavaScript": [QApplication.translate('Lexers', "JavaScript"), 'dummy.js', - "lexerJavaScript.png"], + "lexerJava.png"], + "JavaScript": [QApplication.translate('Lexers', "JavaScript"), + 'dummy.js', "lexerJavaScript.png"], "Lua": [QApplication.translate('Lexers', "Lua"), 'dummy.lua', - "lexerLua.png"], + "lexerLua.png"], "Makefile": [QApplication.translate('Lexers', "Makefile"), 'dummy.mak', - "lexerMakefile.png"], + "lexerMakefile.png"], "Pascal": [QApplication.translate('Lexers', "Pascal"), 'dummy.pas', - "lexerPascal.png"], + "lexerPascal.png"], "Perl": [QApplication.translate('Lexers', "Perl"), 'dummy.pl', - "lexerPerl.png"], - "PostScript": [QApplication.translate('Lexers', "PostScript"), 'dummy.ps', - "lexerPostscript.png"], + "lexerPerl.png"], + "PostScript": [QApplication.translate('Lexers', "PostScript"), + 'dummy.ps', "lexerPostscript.png"], "Povray": [QApplication.translate('Lexers', "Povray"), 'dummy.pov', - "lexerPOV.png"], - "Properties": [QApplication.translate('Lexers', "Properties"), 'dummy.ini', - "lexerProperties.png"], + "lexerPOV.png"], + "Properties": [QApplication.translate('Lexers', "Properties"), + 'dummy.ini', "lexerProperties.png"], "Python2": [QApplication.translate('Lexers', "Python2"), 'dummy.py', - "lexerPython.png"], + "lexerPython.png"], "Python3": [QApplication.translate('Lexers', "Python3"), 'dummy.py', - "lexerPython3.png"], + "lexerPython3.png"], "Ruby": [QApplication.translate('Lexers', "Ruby"), 'dummy.rb', - "lexerRuby.png"], + "lexerRuby.png"], "SQL": [QApplication.translate('Lexers', "SQL"), 'dummy.sql', - "lexerSQL.png"], + "lexerSQL.png"], "TCL": [QApplication.translate('Lexers', "TCL"), 'dummy.tcl', - "lexerTCL.png"], + "lexerTCL.png"], "TeX": [QApplication.translate('Lexers', "TeX"), 'dummy.tex', - "lexerTeX.png"], + "lexerTeX.png"], "VHDL": [QApplication.translate('Lexers', "VHDL"), 'dummy.vhd', - "lexerVHDL.png"], + "lexerVHDL.png"], "XML": [QApplication.translate('Lexers', "XML"), 'dummy.xml', - "lexerXML.png"], + "lexerXML.png"], "YAML": [QApplication.translate('Lexers', "YAML"), 'dummy.yml', - "lexerYAML.png"], + "lexerYAML.png"], } if QSCINTILLA_VERSION() >= 0x020501: supportedLanguages.update({ - "Matlab": [QApplication.translate('Lexers', "Matlab"), 'dummy.m.matlab', - "lexerMatlab.png"], - "Octave": [QApplication.translate('Lexers', "Octave"), 'dummy.m.octave', - "lexerOctave.png"], + "Matlab": [QApplication.translate('Lexers', "Matlab"), + 'dummy.m.matlab', "lexerMatlab.png"], + "Octave": [QApplication.translate('Lexers', "Octave"), + 'dummy.m.octave', "lexerOctave.png"], }) for name in LexerRegistry: - supportedLanguages[name] = LexerRegistry[name][:2] + [LexerRegistry[name][6]] + supportedLanguages[name] = \ + LexerRegistry[name][:2] + [LexerRegistry[name][6]] supportedLanguages["Guessed"] = \ [QApplication.translate('Lexers', "Pygments"), 'dummy.pygments', ""] @@ -308,7 +310,8 @@ return None -def getOpenFileFiltersList(includeAll=False, asString=False, withAdditional=True): +def getOpenFileFiltersList(includeAll=False, asString=False, + withAdditional=True): """ Module function to get the file filter list for an open file operation. @@ -321,87 +324,127 @@ @return file filter list (list of strings or string) """ openFileFiltersList = [ - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', 'Python Files (*.py *.py2 *.py3)'), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', 'Python GUI Files (*.pyw *.pyw2 *.pyw3)'), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', 'Pyrex Files (*.pyx)'), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', 'Quixote Template Files (*.ptl)'), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', 'Ruby Files (*.rb)'), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', 'IDL Files (*.idl)'), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', 'C Files (*.h *.c)'), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', 'C++ Files (*.h *.hpp *.hh *.cxx *.cpp *.cc)'), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', 'C# Files (*.cs)'), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', 'HTML Files (*.html *.htm *.asp *.shtml)'), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', 'CSS Files (*.css)'), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', 'QSS Files (*.qss)'), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', 'PHP Files (*.php *.php3 *.php4 *.php5 *.phtml)'), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', 'XML Files (*.xml *.xsl *.xslt *.dtd *.svg *.xul *.xsd)'), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', 'Qt Resource Files (*.qrc)'), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', 'D Files (*.d *.di)'), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', 'Java Files (*.java)'), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', 'JavaScript Files (*.js)'), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', 'SQL Files (*.sql)'), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', 'Docbook Files (*.docbook)'), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', 'Perl Files (*.pl *.pm *.ph)'), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', 'Lua Files (*.lua)'), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', 'Tex Files (*.tex *.sty *.aux *.toc *.idx)'), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', 'Shell Files (*.sh)'), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', 'Batch Files (*.bat *.cmd)'), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', 'Diff Files (*.diff *.patch)'), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', 'Makefiles (*.mak)'), - QApplication.translate('Lexers', - 'Properties Files (*.properties *.ini *.inf *.reg *.cfg *.cnf *.rc)'), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', + 'Properties Files (*.properties *.ini *.inf *.reg *.cfg' + ' *.cnf *.rc)'), + QApplication.translate( + 'Lexers', 'Povray Files (*.pov)'), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', 'CMake Files (CMakeLists.txt *.cmake *.ctest)'), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', 'VHDL Files (*.vhd *.vhdl)'), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', 'TCL/Tk Files (*.tcl *.tk)'), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', 'Fortran Files (*.f90 *.f95 *.f2k)'), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', 'Fortran77 Files (*.f *.for)'), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', 'Pascal Files (*.dpr *.dpk *.pas *.dfm *.inc *.pp)'), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', 'PostScript Files (*.ps)'), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', 'YAML Files (*.yaml *.yml)'), ] if QSCINTILLA_VERSION() >= 0x020501: openFileFiltersList.extend([ - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', 'Matlab Files (*.m *.m.matlab)'), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', 'Octave Files (*.m *.m.octave)'), ]) @@ -409,11 +452,13 @@ openFileFiltersList.extend(LexerRegistry[name][3]) if withAdditional: - openFileFiltersList.extend(Preferences.getEditor("AdditionalOpenFilters")) + openFileFiltersList.extend( + Preferences.getEditor("AdditionalOpenFilters")) openFileFiltersList.sort() if includeAll: - openFileFiltersList.append(QApplication.translate('Lexers', 'All Files (*)')) + openFileFiltersList.append( + QApplication.translate('Lexers', 'All Files (*)')) if asString: return ';;'.join(openFileFiltersList) @@ -421,7 +466,8 @@ return openFileFiltersList -def getSaveFileFiltersList(includeAll=False, asString=False, withAdditional=True): +def getSaveFileFiltersList(includeAll=False, asString=False, + withAdditional=True): """ Module function to get the file filter list for a save file operation. @@ -434,111 +480,162 @@ @return file filter list (list of strings or string) """ saveFileFiltersList = [ - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', "Python2 Files (*.py2)"), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', "Python3 Files (*.py)"), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', "Python2 GUI Files (*.pyw2)"), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', "Python3 GUI Files (*.pyw)"), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', "Pyrex Files (*.pyx)"), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', "Quixote Template Files (*.ptl)"), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', "Ruby Files (*.rb)"), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', "IDL Files (*.idl)"), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', "C Files (*.c)"), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', "C++ Files (*.cpp)"), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', "C++/C Header Files (*.h)"), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', "C# Files (*.cs)"), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', "HTML Files (*.html)"), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', "PHP Files (*.php)"), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', "ASP Files (*.asp)"), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', "CSS Files (*.css)"), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', "QSS Files (*.qss)"), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', "XML Files (*.xml)"), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', "XSL Files (*.xsl)"), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', "DTD Files (*.dtd)"), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', "Qt Resource Files (*.qrc)"), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', "D Files (*.d)"), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', "D Interface Files (*.di)"), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', "Java Files (*.java)"), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', "JavaScript Files (*.js)"), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', "SQL Files (*.sql)"), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', "Docbook Files (*.docbook)"), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', "Perl Files (*.pl)"), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', "Perl Module Files (*.pm)"), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', "Lua Files (*.lua)"), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', "Shell Files (*.sh)"), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', "Batch Files (*.bat)"), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', "TeX Files (*.tex)"), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', "TeX Template Files (*.sty)"), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', "Diff Files (*.diff)"), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', "Make Files (*.mak)"), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', "Properties Files (*.ini)"), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', "Configuration Files (*.cfg)"), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', 'Povray Files (*.pov)'), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', 'CMake Files (CMakeLists.txt)'), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', 'CMake Macro Files (*.cmake)'), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', 'VHDL Files (*.vhd)'), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', 'TCL Files (*.tcl)'), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', 'Tk Files (*.tk)'), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', 'Fortran Files (*.f95)'), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', 'Fortran77 Files (*.f)'), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', 'Pascal Files (*.pas)'), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', 'PostScript Files (*.ps)'), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', 'YAML Files (*.yml)'), ] if QSCINTILLA_VERSION() >= 0x020501: saveFileFiltersList.extend([ - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', 'Matlab Files (*.m)'), - QApplication.translate('Lexers', + QApplication.translate( + 'Lexers', 'Octave Files (*.m.octave)'), ]) @@ -546,12 +643,14 @@ saveFileFiltersList.extend(LexerRegistry[name][4]) if withAdditional: - saveFileFiltersList.extend(Preferences.getEditor("AdditionalSaveFilters")) + saveFileFiltersList.extend( + Preferences.getEditor("AdditionalSaveFilters")) saveFileFiltersList.sort() if includeAll: - saveFileFiltersList.append(QApplication.translate('Lexers', 'All Files (*)')) + saveFileFiltersList.append( + QApplication.translate('Lexers', 'All Files (*)')) if asString: return ';;'.join(saveFileFiltersList)
--- a/QScintilla/MiniEditor.py Sat Oct 12 18:25:29 2013 +0200 +++ b/QScintilla/MiniEditor.py Sun Oct 13 12:21:37 2013 +0200 @@ -10,11 +10,11 @@ import os import re -from PyQt4.QtCore import QSignalMapper, QPoint, QTimer, QFileInfo, pyqtSignal, QSize, \ - QRegExp, Qt -from PyQt4.QtGui import QWidget, QCursor, QPrinter, QKeySequence, QPrintDialog, \ - QWhatsThis, QActionGroup, QDialog, QAbstractPrintDialog, QInputDialog, \ - QApplication, QMenu, QPalette, QFont, QVBoxLayout, QLabel +from PyQt4.QtCore import QSignalMapper, QPoint, QTimer, QFileInfo, \ + pyqtSignal, QSize, QRegExp, Qt +from PyQt4.QtGui import QWidget, QCursor, QPrinter, QKeySequence, \ + QPrintDialog, QWhatsThis, QActionGroup, QDialog, QAbstractPrintDialog, \ + QInputDialog, QApplication, QMenu, QPalette, QFont, QVBoxLayout, QLabel from PyQt4.Qsci import QsciScintilla from E5Gui.E5Action import E5Action, createActionGroup @@ -34,7 +34,8 @@ class MiniScintilla(QsciScintillaCompat): """ - Class implementing a QsciScintillaCompat subclass for handling focus events. + Class implementing a QsciScintillaCompat subclass for handling focus + events. """ def __init__(self, parent=None): """ @@ -60,7 +61,8 @@ This method checks for modifications of the current file and rereads it upon request. The cursor is placed at the current position - assuming, that it is in the vicinity of the old position after the reread. + assuming, that it is in the vicinity of the old position after the + reread. @param event the event object (QFocusEvent) """ @@ -109,7 +111,8 @@ self.setAttribute(Qt.WA_DeleteOnClose) self.setWindowIcon(UI.PixmapCache.getIcon("editor.png")) - self.setStyle(Preferences.getUI("Style"), Preferences.getUI("StyleSheet")) + self.setStyle(Preferences.getUI("Style"), + Preferences.getUI("StyleSheet")) self.__textEdit = MiniScintilla(self) self.__textEdit.clearSearchIndicators = self.clearSearchIndicators @@ -166,14 +169,18 @@ self.__textEdit.textChanged.connect(self.__documentWasModified) self.__textEdit.modificationChanged.connect(self.__modificationChanged) - self.__textEdit.cursorPositionChanged.connect(self.__cursorPositionChanged) + self.__textEdit.cursorPositionChanged.connect( + self.__cursorPositionChanged) self.__textEdit.linesChanged.connect(self.__resizeLinenoMargin) self.__textEdit.setContextMenuPolicy(Qt.CustomContextMenu) - self.__textEdit.customContextMenuRequested.connect(self.__contextMenuRequested) + self.__textEdit.customContextMenuRequested.connect( + self.__contextMenuRequested) - self.__textEdit.selectionChanged.connect(self.searchDlg.selectionChanged) - self.__textEdit.selectionChanged.connect(self.replaceDlg.selectionChanged) + self.__textEdit.selectionChanged.connect( + self.searchDlg.selectionChanged) + self.__textEdit.selectionChanged.connect( + self.replaceDlg.selectionChanged) self.__setCurrentFile("") if filename: @@ -269,7 +276,8 @@ Private slot to check some actions for their enable/disable status and set the statusbar info. - @param setSb flag indicating an update of the status bar is wanted (boolean) + @param setSb flag indicating an update of the status bar is wanted + (boolean) """ self.saveAct.setEnabled(self.__textEdit.isModified()) @@ -318,7 +326,8 @@ if accel is not None: act.setShortcut(QKeySequence(accel)) accel = Preferences.Prefs.settings.value( - "Shortcuts/{0}/{1}/AltAccel".format(category, act.objectName())) + "Shortcuts/{0}/{1}/AltAccel".format( + category, act.objectName())) if accel is not None: act.setAlternateShortcut(QKeySequence(accel)) @@ -395,7 +404,8 @@ self.trUtf8('Save &as...'), QKeySequence(self.trUtf8("Shift+Ctrl+S", "File|Save As")), 0, self, 'vm_file_save_as') - self.saveAsAct.setStatusTip(self.trUtf8('Save the current file to a new one')) + self.saveAsAct.setStatusTip(self.trUtf8( + 'Save the current file to a new one')) self.saveAsAct.setWhatsThis(self.trUtf8( """<b>Save File as</b>""" """<p>Save the contents of current editor window to a new file.""" @@ -484,7 +494,8 @@ self.cutAct.setStatusTip(self.trUtf8('Cut the selection')) self.cutAct.setWhatsThis(self.trUtf8( """<b>Cut</b>""" - """<p>Cut the selected text of the current editor to the clipboard.</p>""" + """<p>Cut the selected text of the current editor to the""" + """ clipboard.</p>""" )) self.cutAct.triggered[()].connect(self.__textEdit.cut) self.editActions.append(self.cutAct) @@ -498,7 +509,8 @@ self.copyAct.setStatusTip(self.trUtf8('Copy the selection')) self.copyAct.setWhatsThis(self.trUtf8( """<b>Copy</b>""" - """<p>Copy the selected text of the current editor to the clipboard.</p>""" + """<p>Copy the selected text of the current editor to the""" + """ clipboard.</p>""" )) self.copyAct.triggered[()].connect(self.__textEdit.copy) self.editActions.append(self.copyAct) @@ -509,7 +521,8 @@ QKeySequence(self.trUtf8("Ctrl+V", "Edit|Paste")), QKeySequence(self.trUtf8("Shift+Ins", "Edit|Paste")), self, 'vm_edit_paste') - self.pasteAct.setStatusTip(self.trUtf8('Paste the last cut/copied text')) + self.pasteAct.setStatusTip(self.trUtf8( + 'Paste the last cut/copied text')) self.pasteAct.setWhatsThis(self.trUtf8( """<b>Paste</b>""" """<p>Paste the last cut/copied text from the clipboard to""" @@ -546,10 +559,11 @@ self.editorActGrp = createActionGroup(self) - act = E5Action(QApplication.translate('ViewManager', 'Move left one character'), - QApplication.translate('ViewManager', 'Move left one character'), - QKeySequence(QApplication.translate('ViewManager', 'Left')), 0, - self.editorActGrp, 'vm_edit_move_left_char') + act = E5Action( + QApplication.translate('ViewManager', 'Move left one character'), + QApplication.translate('ViewManager', 'Move left one character'), + QKeySequence(QApplication.translate('ViewManager', 'Left')), 0, + self.editorActGrp, 'vm_edit_move_left_char') self.esm.setMapping(act, QsciScintilla.SCI_CHARLEFT) if isMacPlatform(): act.setAlternateShortcut(QKeySequence( @@ -557,10 +571,11 @@ act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', 'Move right one character'), - QApplication.translate('ViewManager', 'Move right one character'), - QKeySequence(QApplication.translate('ViewManager', 'Right')), 0, - self.editorActGrp, 'vm_edit_move_right_char') + act = E5Action( + QApplication.translate('ViewManager', 'Move right one character'), + QApplication.translate('ViewManager', 'Move right one character'), + QKeySequence(QApplication.translate('ViewManager', 'Right')), 0, + self.editorActGrp, 'vm_edit_move_right_char') if isMacPlatform(): act.setAlternateShortcut(QKeySequence( QApplication.translate('ViewManager', 'Meta+F'))) @@ -568,10 +583,11 @@ act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', 'Move up one line'), - QApplication.translate('ViewManager', 'Move up one line'), - QKeySequence(QApplication.translate('ViewManager', 'Up')), 0, - self.editorActGrp, 'vm_edit_move_up_line') + act = E5Action( + QApplication.translate('ViewManager', 'Move up one line'), + QApplication.translate('ViewManager', 'Move up one line'), + QKeySequence(QApplication.translate('ViewManager', 'Up')), 0, + self.editorActGrp, 'vm_edit_move_up_line') if isMacPlatform(): act.setAlternateShortcut(QKeySequence( QApplication.translate('ViewManager', 'Meta+P'))) @@ -579,10 +595,11 @@ act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', 'Move down one line'), - QApplication.translate('ViewManager', 'Move down one line'), - QKeySequence(QApplication.translate('ViewManager', 'Down')), 0, - self.editorActGrp, 'vm_edit_move_down_line') + act = E5Action( + QApplication.translate('ViewManager', 'Move down one line'), + QApplication.translate('ViewManager', 'Move down one line'), + QKeySequence(QApplication.translate('ViewManager', 'Down')), 0, + self.editorActGrp, 'vm_edit_move_down_line') if isMacPlatform(): act.setAlternateShortcut(QKeySequence( QApplication.translate('ViewManager', 'Meta+N'))) @@ -590,10 +607,11 @@ act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', 'Move left one word part'), - QApplication.translate('ViewManager', 'Move left one word part'), - 0, 0, - self.editorActGrp, 'vm_edit_move_left_word_part') + act = E5Action( + QApplication.translate('ViewManager', 'Move left one word part'), + QApplication.translate('ViewManager', 'Move left one word part'), + 0, 0, + self.editorActGrp, 'vm_edit_move_left_word_part') if not isMacPlatform(): act.setShortcut(QKeySequence( QApplication.translate('ViewManager', 'Alt+Left'))) @@ -601,10 +619,11 @@ act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', 'Move right one word part'), - QApplication.translate('ViewManager', 'Move right one word part'), - 0, 0, - self.editorActGrp, 'vm_edit_move_right_word_part') + act = E5Action( + QApplication.translate('ViewManager', 'Move right one word part'), + QApplication.translate('ViewManager', 'Move right one word part'), + 0, 0, + self.editorActGrp, 'vm_edit_move_right_word_part') if not isMacPlatform(): act.setShortcut(QKeySequence( QApplication.translate('ViewManager', 'Alt+Right'))) @@ -612,10 +631,11 @@ act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', 'Move left one word'), - QApplication.translate('ViewManager', 'Move left one word'), - 0, 0, - self.editorActGrp, 'vm_edit_move_left_word') + act = E5Action( + QApplication.translate('ViewManager', 'Move left one word'), + QApplication.translate('ViewManager', 'Move left one word'), + 0, 0, + self.editorActGrp, 'vm_edit_move_left_word') if isMacPlatform(): act.setShortcut(QKeySequence( QApplication.translate('ViewManager', 'Alt+Left'))) @@ -626,10 +646,11 @@ act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', 'Move right one word'), - QApplication.translate('ViewManager', 'Move right one word'), - 0, 0, - self.editorActGrp, 'vm_edit_move_right_word') + act = E5Action( + QApplication.translate('ViewManager', 'Move right one word'), + QApplication.translate('ViewManager', 'Move right one word'), + 0, 0, + self.editorActGrp, 'vm_edit_move_right_word') if isMacPlatform(): act.setShortcut(QKeySequence( QApplication.translate('ViewManager', 'Alt+Right'))) @@ -685,50 +706,56 @@ act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', 'Scroll view down one line'), - QApplication.translate('ViewManager', 'Scroll view down one line'), - QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Down')), 0, - self.editorActGrp, 'vm_edit_scroll_down_line') + act = E5Action( + QApplication.translate('ViewManager', 'Scroll view down one line'), + QApplication.translate('ViewManager', 'Scroll view down one line'), + QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Down')), + 0, self.editorActGrp, 'vm_edit_scroll_down_line') self.esm.setMapping(act, QsciScintilla.SCI_LINESCROLLDOWN) act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', 'Scroll view up one line'), - QApplication.translate('ViewManager', 'Scroll view up one line'), - QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Up')), 0, - self.editorActGrp, 'vm_edit_scroll_up_line') + act = E5Action( + QApplication.translate('ViewManager', 'Scroll view up one line'), + QApplication.translate('ViewManager', 'Scroll view up one line'), + QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Up')), 0, + self.editorActGrp, 'vm_edit_scroll_up_line') self.esm.setMapping(act, QsciScintilla.SCI_LINESCROLLUP) act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', 'Move up one paragraph'), - QApplication.translate('ViewManager', 'Move up one paragraph'), - QKeySequence(QApplication.translate('ViewManager', 'Alt+Up')), 0, - self.editorActGrp, 'vm_edit_move_up_para') + act = E5Action( + QApplication.translate('ViewManager', 'Move up one paragraph'), + QApplication.translate('ViewManager', 'Move up one paragraph'), + QKeySequence(QApplication.translate('ViewManager', 'Alt+Up')), 0, + self.editorActGrp, 'vm_edit_move_up_para') self.esm.setMapping(act, QsciScintilla.SCI_PARAUP) act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', 'Move down one paragraph'), - QApplication.translate('ViewManager', 'Move down one paragraph'), - QKeySequence(QApplication.translate('ViewManager', 'Alt+Down')), 0, - self.editorActGrp, 'vm_edit_move_down_para') + act = E5Action( + QApplication.translate('ViewManager', 'Move down one paragraph'), + QApplication.translate('ViewManager', 'Move down one paragraph'), + QKeySequence(QApplication.translate('ViewManager', 'Alt+Down')), 0, + self.editorActGrp, 'vm_edit_move_down_para') self.esm.setMapping(act, QsciScintilla.SCI_PARADOWN) act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', 'Move up one page'), - QApplication.translate('ViewManager', 'Move up one page'), - QKeySequence(QApplication.translate('ViewManager', 'PgUp')), 0, - self.editorActGrp, 'vm_edit_move_up_page') + act = E5Action( + QApplication.translate('ViewManager', 'Move up one page'), + QApplication.translate('ViewManager', 'Move up one page'), + QKeySequence(QApplication.translate('ViewManager', 'PgUp')), 0, + self.editorActGrp, 'vm_edit_move_up_page') self.esm.setMapping(act, QsciScintilla.SCI_PAGEUP) act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', 'Move down one page'), - QApplication.translate('ViewManager', 'Move down one page'), - QKeySequence(QApplication.translate('ViewManager', 'PgDown')), 0, - self.editorActGrp, 'vm_edit_move_down_page') + act = E5Action( + QApplication.translate('ViewManager', 'Move down one page'), + QApplication.translate('ViewManager', 'Move down one page'), + QKeySequence(QApplication.translate('ViewManager', 'PgDown')), 0, + self.editorActGrp, 'vm_edit_move_down_page') if isMacPlatform(): act.setAlternateShortcut(QKeySequence( QApplication.translate('ViewManager', 'Meta+V'))) @@ -736,10 +763,11 @@ act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', 'Move to start of document'), - QApplication.translate('ViewManager', 'Move to start of document'), - 0, 0, - self.editorActGrp, 'vm_edit_move_start_text') + act = E5Action( + QApplication.translate('ViewManager', 'Move to start of document'), + QApplication.translate('ViewManager', 'Move to start of document'), + 0, 0, + self.editorActGrp, 'vm_edit_move_start_text') if isMacPlatform(): act.setShortcut(QKeySequence( QApplication.translate('ViewManager', 'Ctrl+Up'))) @@ -750,10 +778,11 @@ act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', 'Move to end of document'), - QApplication.translate('ViewManager', 'Move to end of document'), - 0, 0, - self.editorActGrp, 'vm_edit_move_end_text') + act = E5Action( + QApplication.translate('ViewManager', 'Move to end of document'), + QApplication.translate('ViewManager', 'Move to end of document'), + 0, 0, + self.editorActGrp, 'vm_edit_move_end_text') if isMacPlatform(): act.setShortcut(QKeySequence( QApplication.translate('ViewManager', 'Ctrl+Down'))) @@ -764,29 +793,32 @@ act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', 'Indent one level'), - QApplication.translate('ViewManager', 'Indent one level'), - QKeySequence(QApplication.translate('ViewManager', 'Tab')), 0, - self.editorActGrp, 'vm_edit_indent_one_level') + act = E5Action( + QApplication.translate('ViewManager', 'Indent one level'), + QApplication.translate('ViewManager', 'Indent one level'), + QKeySequence(QApplication.translate('ViewManager', 'Tab')), 0, + self.editorActGrp, 'vm_edit_indent_one_level') self.esm.setMapping(act, QsciScintilla.SCI_TAB) act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', 'Unindent one level'), - QApplication.translate('ViewManager', 'Unindent one level'), - QKeySequence(QApplication.translate('ViewManager', 'Shift+Tab')), 0, - self.editorActGrp, 'vm_edit_unindent_one_level') + act = E5Action( + QApplication.translate('ViewManager', 'Unindent one level'), + QApplication.translate('ViewManager', 'Unindent one level'), + QKeySequence(QApplication.translate('ViewManager', 'Shift+Tab')), + 0, self.editorActGrp, 'vm_edit_unindent_one_level') self.esm.setMapping(act, QsciScintilla.SCI_BACKTAB) act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', - 'Extend selection left one character'), - QApplication.translate('ViewManager', - 'Extend selection left one character'), - QKeySequence(QApplication.translate('ViewManager', 'Shift+Left')), - 0, - self.editorActGrp, 'vm_edit_extend_selection_left_char') + act = E5Action( + QApplication.translate( + 'ViewManager', 'Extend selection left one character'), + QApplication.translate( + 'ViewManager', + 'Extend selection left one character'), + QKeySequence(QApplication.translate('ViewManager', 'Shift+Left')), + 0, self.editorActGrp, 'vm_edit_extend_selection_left_char') if isMacPlatform(): act.setAlternateShortcut(QKeySequence( QApplication.translate('ViewManager', 'Meta+Shift+B'))) @@ -794,13 +826,15 @@ act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', - 'Extend selection right one character'), - QApplication.translate('ViewManager', - 'Extend selection right one character'), - QKeySequence(QApplication.translate('ViewManager', 'Shift+Right')), - 0, - self.editorActGrp, 'vm_edit_extend_selection_right_char') + act = E5Action( + QApplication.translate( + 'ViewManager', + 'Extend selection right one character'), + QApplication.translate( + 'ViewManager', + 'Extend selection right one character'), + QKeySequence(QApplication.translate('ViewManager', 'Shift+Right')), + 0, self.editorActGrp, 'vm_edit_extend_selection_right_char') if isMacPlatform(): act.setAlternateShortcut(QKeySequence( QApplication.translate('ViewManager', 'Meta+Shift+F'))) @@ -808,12 +842,15 @@ act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', - 'Extend selection up one line'), - QApplication.translate('ViewManager', - 'Extend selection up one line'), - QKeySequence(QApplication.translate('ViewManager', 'Shift+Up')), 0, - self.editorActGrp, 'vm_edit_extend_selection_up_line') + act = E5Action( + QApplication.translate( + 'ViewManager', + 'Extend selection up one line'), + QApplication.translate( + 'ViewManager', + 'Extend selection up one line'), + QKeySequence(QApplication.translate('ViewManager', 'Shift+Up')), 0, + self.editorActGrp, 'vm_edit_extend_selection_up_line') if isMacPlatform(): act.setAlternateShortcut(QKeySequence( QApplication.translate('ViewManager', 'Meta+Shift+P'))) @@ -821,13 +858,15 @@ act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', - 'Extend selection down one line'), - QApplication.translate('ViewManager', - 'Extend selection down one line'), - QKeySequence(QApplication.translate('ViewManager', 'Shift+Down')), - 0, - self.editorActGrp, 'vm_edit_extend_selection_down_line') + act = E5Action( + QApplication.translate( + 'ViewManager', + 'Extend selection down one line'), + QApplication.translate( + 'ViewManager', + 'Extend selection down one line'), + QKeySequence(QApplication.translate('ViewManager', 'Shift+Down')), + 0, self.editorActGrp, 'vm_edit_extend_selection_down_line') if isMacPlatform(): act.setAlternateShortcut(QKeySequence( QApplication.translate('ViewManager', 'Meta+Shift+N'))) @@ -835,12 +874,15 @@ act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', - 'Extend selection left one word part'), - QApplication.translate('ViewManager', - 'Extend selection left one word part'), - 0, 0, - self.editorActGrp, 'vm_edit_extend_selection_left_word_part') + act = E5Action( + QApplication.translate( + 'ViewManager', + 'Extend selection left one word part'), + QApplication.translate( + 'ViewManager', + 'Extend selection left one word part'), + 0, 0, + self.editorActGrp, 'vm_edit_extend_selection_left_word_part') if not isMacPlatform(): act.setShortcut(QKeySequence( QApplication.translate('ViewManager', 'Alt+Shift+Left'))) @@ -848,12 +890,15 @@ act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', - 'Extend selection right one word part'), - QApplication.translate('ViewManager', - 'Extend selection right one word part'), - 0, 0, - self.editorActGrp, 'vm_edit_extend_selection_right_word_part') + act = E5Action( + QApplication.translate( + 'ViewManager', + 'Extend selection right one word part'), + QApplication.translate( + 'ViewManager', + 'Extend selection right one word part'), + 0, 0, + self.editorActGrp, 'vm_edit_extend_selection_right_word_part') if not isMacPlatform(): act.setShortcut(QKeySequence( QApplication.translate('ViewManager', 'Alt+Shift+Right'))) @@ -893,12 +938,17 @@ act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', - 'Extend selection to first visible character in document line'), - QApplication.translate('ViewManager', - 'Extend selection to first visible character in document line'), - 0, 0, - self.editorActGrp, 'vm_edit_extend_selection_first_visible_char') + act = E5Action( + QApplication.translate( + 'ViewManager', + 'Extend selection to first visible character in document' + ' line'), + QApplication.translate( + 'ViewManager', + 'Extend selection to first visible character in document' + ' line'), + 0, 0, + self.editorActGrp, 'vm_edit_extend_selection_first_visible_char') if not isMacPlatform(): act.setShortcut(QKeySequence( QApplication.translate('ViewManager', 'Shift+Home'))) @@ -922,13 +972,16 @@ act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', - 'Extend selection up one paragraph'), - QApplication.translate('ViewManager', - 'Extend selection up one paragraph'), - QKeySequence(QApplication.translate('ViewManager', 'Alt+Shift+Up')), - 0, - self.editorActGrp, 'vm_edit_extend_selection_up_para') + act = E5Action( + QApplication.translate( + 'ViewManager', + 'Extend selection up one paragraph'), + QApplication.translate( + 'ViewManager', + 'Extend selection up one paragraph'), + QKeySequence(QApplication.translate('ViewManager', + 'Alt+Shift+Up')), + 0, self.editorActGrp, 'vm_edit_extend_selection_up_para') self.esm.setMapping(act, QsciScintilla.SCI_PARAUPEXTEND) act.triggered[()].connect(self.esm.map) self.editActions.append(act) @@ -945,24 +998,29 @@ act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', - 'Extend selection up one page'), - QApplication.translate('ViewManager', - 'Extend selection up one page'), - QKeySequence(QApplication.translate('ViewManager', 'Shift+PgUp')), - 0, - self.editorActGrp, 'vm_edit_extend_selection_up_page') + act = E5Action( + QApplication.translate( + 'ViewManager', + 'Extend selection up one page'), + QApplication.translate( + 'ViewManager', + 'Extend selection up one page'), + QKeySequence(QApplication.translate('ViewManager', 'Shift+PgUp')), + 0, self.editorActGrp, 'vm_edit_extend_selection_up_page') self.esm.setMapping(act, QsciScintilla.SCI_PAGEUPEXTEND) act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', - 'Extend selection down one page'), - QApplication.translate('ViewManager', - 'Extend selection down one page'), - QKeySequence(QApplication.translate('ViewManager', 'Shift+PgDown')), - 0, - self.editorActGrp, 'vm_edit_extend_selection_down_page') + act = E5Action( + QApplication.translate( + 'ViewManager', + 'Extend selection down one page'), + QApplication.translate( + 'ViewManager', + 'Extend selection down one page'), + QKeySequence(QApplication.translate('ViewManager', + 'Shift+PgDown')), + 0, self.editorActGrp, 'vm_edit_extend_selection_down_page') if isMacPlatform(): act.setAlternateShortcut(QKeySequence( QApplication.translate('ViewManager', 'Meta+Shift+V'))) @@ -1002,12 +1060,13 @@ act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', - 'Delete previous character'), - QApplication.translate('ViewManager', 'Delete previous character'), - QKeySequence(QApplication.translate('ViewManager', 'Backspace')), - 0, - self.editorActGrp, 'vm_edit_delete_previous_char') + act = E5Action( + QApplication.translate( + 'ViewManager', + 'Delete previous character'), + QApplication.translate('ViewManager', 'Delete previous character'), + QKeySequence(QApplication.translate('ViewManager', 'Backspace')), + 0, self.editorActGrp, 'vm_edit_delete_previous_char') if isMacPlatform(): act.setAlternateShortcut(QKeySequence( QApplication.translate('ViewManager', 'Meta+H'))) @@ -1018,20 +1077,24 @@ act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', - 'Delete previous character if not at start of line'), - QApplication.translate('ViewManager', - 'Delete previous character if not at start of line'), - 0, 0, - self.editorActGrp, 'vm_edit_delet_previous_char_not_line_start') + act = E5Action( + QApplication.translate( + 'ViewManager', + 'Delete previous character if not at start of line'), + QApplication.translate( + 'ViewManager', + 'Delete previous character if not at start of line'), + 0, 0, + self.editorActGrp, 'vm_edit_delet_previous_char_not_line_start') self.esm.setMapping(act, QsciScintilla.SCI_DELETEBACKNOTLINE) act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', 'Delete current character'), - QApplication.translate('ViewManager', 'Delete current character'), - QKeySequence(QApplication.translate('ViewManager', 'Del')), 0, - self.editorActGrp, 'vm_edit_delete_current_char') + act = E5Action( + QApplication.translate('ViewManager', 'Delete current character'), + QApplication.translate('ViewManager', 'Delete current character'), + QKeySequence(QApplication.translate('ViewManager', 'Del')), 0, + self.editorActGrp, 'vm_edit_delete_current_char') if isMacPlatform(): act.setAlternateShortcut(QKeySequence( QApplication.translate('ViewManager', 'Meta+D'))) @@ -1039,38 +1102,40 @@ act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', 'Delete word to left'), - QApplication.translate('ViewManager', 'Delete word to left'), - QKeySequence(QApplication.translate('ViewManager', - 'Ctrl+Backspace')), - 0, - self.editorActGrp, 'vm_edit_delete_word_left') + act = E5Action( + QApplication.translate('ViewManager', 'Delete word to left'), + QApplication.translate('ViewManager', 'Delete word to left'), + QKeySequence(QApplication.translate('ViewManager', + 'Ctrl+Backspace')), + 0, self.editorActGrp, 'vm_edit_delete_word_left') self.esm.setMapping(act, QsciScintilla.SCI_DELWORDLEFT) act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', 'Delete word to right'), - QApplication.translate('ViewManager', 'Delete word to right'), - QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Del')), 0, - self.editorActGrp, 'vm_edit_delete_word_right') + act = E5Action( + QApplication.translate('ViewManager', 'Delete word to right'), + QApplication.translate('ViewManager', 'Delete word to right'), + QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Del')), 0, + self.editorActGrp, 'vm_edit_delete_word_right') self.esm.setMapping(act, QsciScintilla.SCI_DELWORDRIGHT) act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', 'Delete line to left'), - QApplication.translate('ViewManager', 'Delete line to left'), - QKeySequence(QApplication.translate('ViewManager', - 'Ctrl+Shift+Backspace')), - 0, - self.editorActGrp, 'vm_edit_delete_line_left') + act = E5Action( + QApplication.translate('ViewManager', 'Delete line to left'), + QApplication.translate('ViewManager', 'Delete line to left'), + QKeySequence(QApplication.translate('ViewManager', + 'Ctrl+Shift+Backspace')), + 0, self.editorActGrp, 'vm_edit_delete_line_left') self.esm.setMapping(act, QsciScintilla.SCI_DELLINELEFT) act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', 'Delete line to right'), - QApplication.translate('ViewManager', 'Delete line to right'), - 0, 0, - self.editorActGrp, 'vm_edit_delete_line_right') + act = E5Action( + QApplication.translate('ViewManager', 'Delete line to right'), + QApplication.translate('ViewManager', 'Delete line to right'), + 0, 0, + self.editorActGrp, 'vm_edit_delete_line_right') if isMacPlatform(): act.setShortcut(QKeySequence( QApplication.translate('ViewManager', 'Meta+K'))) @@ -1081,86 +1146,99 @@ act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', 'Insert new line'), - QApplication.translate('ViewManager', 'Insert new line'), - QKeySequence(QApplication.translate('ViewManager', 'Return')), - QKeySequence(QApplication.translate('ViewManager', 'Enter')), - self.editorActGrp, 'vm_edit_insert_line') + act = E5Action( + QApplication.translate('ViewManager', 'Insert new line'), + QApplication.translate('ViewManager', 'Insert new line'), + QKeySequence(QApplication.translate('ViewManager', 'Return')), + QKeySequence(QApplication.translate('ViewManager', 'Enter')), + self.editorActGrp, 'vm_edit_insert_line') self.esm.setMapping(act, QsciScintilla.SCI_NEWLINE) act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', 'Delete current line'), - QApplication.translate('ViewManager', 'Delete current line'), - QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Shift+L')), - 0, - self.editorActGrp, 'vm_edit_delete_current_line') + act = E5Action( + QApplication.translate('ViewManager', 'Delete current line'), + QApplication.translate('ViewManager', 'Delete current line'), + QKeySequence(QApplication.translate('ViewManager', + 'Ctrl+Shift+L')), + 0, self.editorActGrp, 'vm_edit_delete_current_line') self.esm.setMapping(act, QsciScintilla.SCI_LINEDELETE) act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', 'Duplicate current line'), - QApplication.translate('ViewManager', 'Duplicate current line'), - QKeySequence(QApplication.translate('ViewManager', 'Ctrl+D')), 0, - self.editorActGrp, 'vm_edit_duplicate_current_line') + act = E5Action( + QApplication.translate('ViewManager', 'Duplicate current line'), + QApplication.translate('ViewManager', 'Duplicate current line'), + QKeySequence(QApplication.translate('ViewManager', 'Ctrl+D')), 0, + self.editorActGrp, 'vm_edit_duplicate_current_line') self.esm.setMapping(act, QsciScintilla.SCI_LINEDUPLICATE) act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', - 'Swap current and previous lines'), - QApplication.translate('ViewManager', - 'Swap current and previous lines'), - QKeySequence(QApplication.translate('ViewManager', 'Ctrl+T')), 0, - self.editorActGrp, 'vm_edit_swap_current_previous_line') + act = E5Action( + QApplication.translate( + 'ViewManager', + 'Swap current and previous lines'), + QApplication.translate( + 'ViewManager', + 'Swap current and previous lines'), + QKeySequence(QApplication.translate('ViewManager', 'Ctrl+T')), 0, + self.editorActGrp, 'vm_edit_swap_current_previous_line') self.esm.setMapping(act, QsciScintilla.SCI_LINETRANSPOSE) act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', 'Cut current line'), - QApplication.translate('ViewManager', 'Cut current line'), - QKeySequence(QApplication.translate('ViewManager', 'Alt+Shift+L')), - 0, - self.editorActGrp, 'vm_edit_cut_current_line') + act = E5Action( + QApplication.translate('ViewManager', 'Cut current line'), + QApplication.translate('ViewManager', 'Cut current line'), + QKeySequence(QApplication.translate('ViewManager', 'Alt+Shift+L')), + 0, self.editorActGrp, 'vm_edit_cut_current_line') self.esm.setMapping(act, QsciScintilla.SCI_LINECUT) act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', 'Copy current line'), - QApplication.translate('ViewManager', 'Copy current line'), - QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Shift+T')), - 0, - self.editorActGrp, 'vm_edit_copy_current_line') + act = E5Action( + QApplication.translate('ViewManager', 'Copy current line'), + QApplication.translate('ViewManager', 'Copy current line'), + QKeySequence(QApplication.translate('ViewManager', + 'Ctrl+Shift+T')), + 0, self.editorActGrp, 'vm_edit_copy_current_line') self.esm.setMapping(act, QsciScintilla.SCI_LINECOPY) act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', 'Toggle insert/overtype'), - QApplication.translate('ViewManager', 'Toggle insert/overtype'), - QKeySequence(QApplication.translate('ViewManager', 'Ins')), 0, - self.editorActGrp, 'vm_edit_toggle_insert_overtype') + act = E5Action( + QApplication.translate('ViewManager', 'Toggle insert/overtype'), + QApplication.translate('ViewManager', 'Toggle insert/overtype'), + QKeySequence(QApplication.translate('ViewManager', 'Ins')), 0, + self.editorActGrp, 'vm_edit_toggle_insert_overtype') self.esm.setMapping(act, QsciScintilla.SCI_EDITTOGGLEOVERTYPE) act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', - 'Convert selection to lower case'), - QApplication.translate('ViewManager', - 'Convert selection to lower case'), - QKeySequence(QApplication.translate('ViewManager', 'Alt+Shift+U')), - 0, - self.editorActGrp, 'vm_edit_convert_selection_lower') + act = E5Action( + QApplication.translate( + 'ViewManager', + 'Convert selection to lower case'), + QApplication.translate( + 'ViewManager', + 'Convert selection to lower case'), + QKeySequence(QApplication.translate('ViewManager', 'Alt+Shift+U')), + 0, self.editorActGrp, 'vm_edit_convert_selection_lower') self.esm.setMapping(act, QsciScintilla.SCI_LOWERCASE) act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', - 'Convert selection to upper case'), - QApplication.translate('ViewManager', - 'Convert selection to upper case'), - QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Shift+U')), - 0, - self.editorActGrp, 'vm_edit_convert_selection_upper') + act = E5Action( + QApplication.translate( + 'ViewManager', + 'Convert selection to upper case'), + QApplication.translate( + 'ViewManager', + 'Convert selection to upper case'), + QKeySequence(QApplication.translate('ViewManager', + 'Ctrl+Shift+U')), + 0, self.editorActGrp, 'vm_edit_convert_selection_upper') self.esm.setMapping(act, QsciScintilla.SCI_UPPERCASE) act.triggered[()].connect(self.esm.map) self.editActions.append(act) @@ -1181,12 +1259,15 @@ act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', - 'Extend selection to end of display line'), - QApplication.translate('ViewManager', - 'Extend selection to end of display line'), - 0, 0, - self.editorActGrp, 'vm_edit_extend_selection_end_displayed_line') + act = E5Action( + QApplication.translate( + 'ViewManager', + 'Extend selection to end of display line'), + QApplication.translate( + 'ViewManager', + 'Extend selection to end of display line'), + 0, 0, + self.editorActGrp, 'vm_edit_extend_selection_end_displayed_line') if isMacPlatform(): act.setShortcut(QKeySequence( QApplication.translate('ViewManager', 'Ctrl+Shift+Right'))) @@ -1202,22 +1283,25 @@ act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', 'Escape'), - QApplication.translate('ViewManager', 'Escape'), - QKeySequence(QApplication.translate('ViewManager', 'Esc')), 0, - self.editorActGrp, 'vm_edit_escape') + act = E5Action( + QApplication.translate('ViewManager', 'Escape'), + QApplication.translate('ViewManager', 'Escape'), + QKeySequence(QApplication.translate('ViewManager', 'Esc')), 0, + self.editorActGrp, 'vm_edit_escape') self.esm.setMapping(act, QsciScintilla.SCI_CANCEL) act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', - 'Extend rectangular selection down one line'), - QApplication.translate('ViewManager', - 'Extend rectangular selection down one line'), - QKeySequence(QApplication.translate('ViewManager', - 'Alt+Ctrl+Down')), - 0, - self.editorActGrp, 'vm_edit_extend_rect_selection_down_line') + act = E5Action( + QApplication.translate( + 'ViewManager', + 'Extend rectangular selection down one line'), + QApplication.translate( + 'ViewManager', + 'Extend rectangular selection down one line'), + QKeySequence(QApplication.translate('ViewManager', + 'Alt+Ctrl+Down')), + 0, self.editorActGrp, 'vm_edit_extend_rect_selection_down_line') if isMacPlatform(): act.setAlternateShortcut(QKeySequence( QApplication.translate('ViewManager', 'Meta+Alt+Shift+N'))) @@ -1225,13 +1309,15 @@ act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', - 'Extend rectangular selection up one line'), - QApplication.translate('ViewManager', - 'Extend rectangular selection up one line'), - QKeySequence(QApplication.translate('ViewManager', 'Alt+Ctrl+Up')), - 0, - self.editorActGrp, 'vm_edit_extend_rect_selection_up_line') + act = E5Action( + QApplication.translate( + 'ViewManager', + 'Extend rectangular selection up one line'), + QApplication.translate( + 'ViewManager', + 'Extend rectangular selection up one line'), + QKeySequence(QApplication.translate('ViewManager', 'Alt+Ctrl+Up')), + 0, self.editorActGrp, 'vm_edit_extend_rect_selection_up_line') if isMacPlatform(): act.setAlternateShortcut(QKeySequence( QApplication.translate('ViewManager', 'Meta+Alt+Shift+P'))) @@ -1239,14 +1325,16 @@ act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', - 'Extend rectangular selection left one character'), - QApplication.translate('ViewManager', - 'Extend rectangular selection left one character'), - QKeySequence(QApplication.translate('ViewManager', - 'Alt+Ctrl+Left')), - 0, - self.editorActGrp, 'vm_edit_extend_rect_selection_left_char') + act = E5Action( + QApplication.translate( + 'ViewManager', + 'Extend rectangular selection left one character'), + QApplication.translate( + 'ViewManager', + 'Extend rectangular selection left one character'), + QKeySequence(QApplication.translate('ViewManager', + 'Alt+Ctrl+Left')), + 0, self.editorActGrp, 'vm_edit_extend_rect_selection_left_char') if isMacPlatform(): act.setAlternateShortcut(QKeySequence( QApplication.translate('ViewManager', 'Meta+Alt+Shift+B'))) @@ -1254,14 +1342,16 @@ act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', - 'Extend rectangular selection right one character'), - QApplication.translate('ViewManager', - 'Extend rectangular selection right one character'), - QKeySequence(QApplication.translate('ViewManager', - 'Alt+Ctrl+Right')), - 0, - self.editorActGrp, 'vm_edit_extend_rect_selection_right_char') + act = E5Action( + QApplication.translate( + 'ViewManager', + 'Extend rectangular selection right one character'), + QApplication.translate( + 'ViewManager', + 'Extend rectangular selection right one character'), + QKeySequence(QApplication.translate('ViewManager', + 'Alt+Ctrl+Right')), + 0, self.editorActGrp, 'vm_edit_extend_rect_selection_right_char') if isMacPlatform(): act.setAlternateShortcut(QKeySequence( QApplication.translate('ViewManager', 'Meta+Alt+Shift+F'))) @@ -1285,12 +1375,15 @@ act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', - 'Extend rectangular selection to end of document line'), - QApplication.translate('ViewManager', - 'Extend rectangular selection to end of document line'), - 0, 0, - self.editorActGrp, 'vm_edit_extend_rect_selection_end_line') + act = E5Action( + QApplication.translate( + 'ViewManager', + 'Extend rectangular selection to end of document line'), + QApplication.translate( + 'ViewManager', + 'Extend rectangular selection to end of document line'), + 0, 0, + self.editorActGrp, 'vm_edit_extend_rect_selection_end_line') if isMacPlatform(): act.setShortcut(QKeySequence( QApplication.translate('ViewManager', 'Meta+Alt+Shift+E'))) @@ -1301,26 +1394,30 @@ act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', - 'Extend rectangular selection up one page'), - QApplication.translate('ViewManager', - 'Extend rectangular selection up one page'), - QKeySequence(QApplication.translate('ViewManager', - 'Alt+Shift+PgUp')), - 0, - self.editorActGrp, 'vm_edit_extend_rect_selection_up_page') + act = E5Action( + QApplication.translate( + 'ViewManager', + 'Extend rectangular selection up one page'), + QApplication.translate( + 'ViewManager', + 'Extend rectangular selection up one page'), + QKeySequence(QApplication.translate('ViewManager', + 'Alt+Shift+PgUp')), + 0, self.editorActGrp, 'vm_edit_extend_rect_selection_up_page') self.esm.setMapping(act, QsciScintilla.SCI_PAGEUPRECTEXTEND) act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', - 'Extend rectangular selection down one page'), - QApplication.translate('ViewManager', - 'Extend rectangular selection down one page'), - QKeySequence(QApplication.translate('ViewManager', - 'Alt+Shift+PgDown')), - 0, - self.editorActGrp, 'vm_edit_extend_rect_selection_down_page') + act = E5Action( + QApplication.translate( + 'ViewManager', + 'Extend rectangular selection down one page'), + QApplication.translate( + 'ViewManager', + 'Extend rectangular selection down one page'), + QKeySequence(QApplication.translate('ViewManager', + 'Alt+Shift+PgDown')), + 0, self.editorActGrp, 'vm_edit_extend_rect_selection_down_page') if isMacPlatform(): act.setAlternateShortcut(QKeySequence( QApplication.translate('ViewManager', 'Meta+Alt+Shift+V'))) @@ -1328,13 +1425,16 @@ act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', - 'Duplicate current selection'), - QApplication.translate('ViewManager', - 'Duplicate current selection'), - QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Shift+D')), - 0, - self.editorActGrp, 'vm_edit_duplicate_current_selection') + act = E5Action( + QApplication.translate( + 'ViewManager', + 'Duplicate current selection'), + QApplication.translate( + 'ViewManager', + 'Duplicate current selection'), + QKeySequence(QApplication.translate('ViewManager', + 'Ctrl+Shift+D')), + 0, self.editorActGrp, 'vm_edit_duplicate_current_selection') self.esm.setMapping(act, QsciScintilla.SCI_SELECTIONDUPLICATE) act.triggered[()].connect(self.esm.map) self.editActions.append(act) @@ -1446,12 +1546,16 @@ self.editActions.append(act) if hasattr(QsciScintilla, "SCI_HOMEEXTEND"): - act = E5Action(QApplication.translate('ViewManager', - 'Extend selection to start of document line'), - QApplication.translate('ViewManager', - 'Extend selection to start of document line'), - 0, 0, - self.editorActGrp, 'vm_edit_extend_selection_start_document_line') + act = E5Action( + QApplication.translate( + 'ViewManager', + 'Extend selection to start of document line'), + QApplication.translate( + 'ViewManager', + 'Extend selection to start of document line'), + 0, 0, + self.editorActGrp, + 'vm_edit_extend_selection_start_document_line') if isMacPlatform(): act.setShortcut(QKeySequence( QApplication.translate('ViewManager', 'Meta+Shift+A'))) @@ -1460,12 +1564,15 @@ self.editActions.append(act) if hasattr(QsciScintilla, "SCI_HOMERECTEXTEND"): - act = E5Action(QApplication.translate('ViewManager', - 'Extend rectangular selection to start of document line'), - QApplication.translate('ViewManager', - 'Extend rectangular selection to start of document line'), - 0, 0, - self.editorActGrp, 'vm_edit_select_rect_start_line') + act = E5Action( + QApplication.translate( + 'ViewManager', + 'Extend rectangular selection to start of document line'), + QApplication.translate( + 'ViewManager', + 'Extend rectangular selection to start of document line'), + 0, 0, + self.editorActGrp, 'vm_edit_select_rect_start_line') if isMacPlatform(): act.setShortcut(QKeySequence( QApplication.translate('ViewManager', 'Meta+Alt+Shift+A'))) @@ -1474,12 +1581,16 @@ self.editActions.append(act) if hasattr(QsciScintilla, "SCI_HOMEDISPLAYEXTEND"): - act = E5Action(QApplication.translate('ViewManager', - 'Extend selection to start of display line'), - QApplication.translate('ViewManager', - 'Extend selection to start of display line'), - 0, 0, - self.editorActGrp, 'vm_edit_extend_selection_start_display_line') + act = E5Action( + QApplication.translate( + 'ViewManager', + 'Extend selection to start of display line'), + QApplication.translate( + 'ViewManager', + 'Extend selection to start of display line'), + 0, 0, + self.editorActGrp, + 'vm_edit_extend_selection_start_display_line') if isMacPlatform(): act.setShortcut(QKeySequence( QApplication.translate('ViewManager', 'Ctrl+Shift+Left'))) @@ -1488,24 +1599,30 @@ self.editActions.append(act) if hasattr(QsciScintilla, "SCI_HOMEWRAP"): - act = E5Action(QApplication.translate('ViewManager', - 'Move to start of display or document line'), - QApplication.translate('ViewManager', - 'Move to start of display or document line'), - 0, 0, - self.editorActGrp, 'vm_edit_move_start_display_document_line') + act = E5Action( + QApplication.translate( + 'ViewManager', + 'Move to start of display or document line'), + QApplication.translate( + 'ViewManager', + 'Move to start of display or document line'), + 0, 0, + self.editorActGrp, 'vm_edit_move_start_display_document_line') self.esm.setMapping(act, QsciScintilla.SCI_HOMEWRAP) act.triggered[()].connect(self.esm.map) self.editActions.append(act) if hasattr(QsciScintilla, "SCI_HOMEWRAPEXTEND"): - act = E5Action(QApplication.translate('ViewManager', - 'Extend selection to start of display or document line'), - QApplication.translate('ViewManager', - 'Extend selection to start of display or document line'), - 0, 0, - self.editorActGrp, - 'vm_edit_extend_selection_start_display_document_line') + act = E5Action( + QApplication.translate( + 'ViewManager', + 'Extend selection to start of display or document line'), + QApplication.translate( + 'ViewManager', + 'Extend selection to start of display or document line'), + 0, 0, + self.editorActGrp, + 'vm_edit_extend_selection_start_display_document_line') self.esm.setMapping(act, QsciScintilla.SCI_HOMEWRAPEXTEND) act.triggered[()].connect(self.esm.map) self.editActions.append(act) @@ -1525,38 +1642,47 @@ self.editActions.append(act) if hasattr(QsciScintilla, "SCI_VCHOMEWRAPEXTEND"): - act = E5Action(QApplication.translate('ViewManager', - 'Extend selection to first visible character in' - ' display or document line'), - QApplication.translate('ViewManager', - 'Extend selection to first visible character in' - ' display or document line'), - 0, 0, - self.editorActGrp, - 'vm_edit_extend_selection_first_visible_char_document_line') + act = E5Action( + QApplication.translate( + 'ViewManager', + 'Extend selection to first visible character in' + ' display or document line'), + QApplication.translate( + 'ViewManager', + 'Extend selection to first visible character in' + ' display or document line'), + 0, 0, + self.editorActGrp, + 'vm_edit_extend_selection_first_visible_char_document_line') self.esm.setMapping(act, QsciScintilla.SCI_VCHOMEWRAPEXTEND) act.triggered[()].connect(self.esm.map) self.editActions.append(act) if hasattr(QsciScintilla, "SCI_LINEENDWRAP"): - act = E5Action(QApplication.translate('ViewManager', - 'Move to end of display or document line'), - QApplication.translate('ViewManager', - 'Move to end of display or document line'), - 0, 0, - self.editorActGrp, 'vm_edit_end_start_display_document_line') + act = E5Action( + QApplication.translate( + 'ViewManager', + 'Move to end of display or document line'), + QApplication.translate( + 'ViewManager', + 'Move to end of display or document line'), + 0, 0, + self.editorActGrp, 'vm_edit_end_start_display_document_line') self.esm.setMapping(act, QsciScintilla.SCI_LINEENDWRAP) act.triggered[()].connect(self.esm.map) self.editActions.append(act) if hasattr(QsciScintilla, "SCI_LINEENDWRAPEXTEND"): - act = E5Action(QApplication.translate('ViewManager', - 'Extend selection to end of display or document line'), - QApplication.translate('ViewManager', - 'Extend selection to end of display or document line'), - 0, 0, - self.editorActGrp, - 'vm_edit_extend_selection_end_display_document_line') + act = E5Action( + QApplication.translate( + 'ViewManager', + 'Extend selection to end of display or document line'), + QApplication.translate( + 'ViewManager', + 'Extend selection to end of display or document line'), + 0, 0, + self.editorActGrp, + 'vm_edit_extend_selection_end_display_document_line') self.esm.setMapping(act, QsciScintilla.SCI_LINEENDWRAPEXTEND) act.triggered[()].connect(self.esm.map) self.editActions.append(act) @@ -1573,12 +1699,16 @@ self.editActions.append(act) if hasattr(QsciScintilla, "SCI_STUTTEREDPAGEUPEXTEND"): - act = E5Action(QApplication.translate('ViewManager', - 'Stuttered extend selection up one page'), - QApplication.translate('ViewManager', - 'Stuttered extend selection up one page'), - 0, 0, - self.editorActGrp, 'vm_edit_stuttered_extend_selection_up_page') + act = E5Action( + QApplication.translate( + 'ViewManager', + 'Stuttered extend selection up one page'), + QApplication.translate( + 'ViewManager', + 'Stuttered extend selection up one page'), + 0, 0, + self.editorActGrp, + 'vm_edit_stuttered_extend_selection_up_page') self.esm.setMapping(act, QsciScintilla.SCI_STUTTEREDPAGEUPEXTEND) act.triggered[()].connect(self.esm.map) self.editActions.append(act) @@ -1595,23 +1725,30 @@ self.editActions.append(act) if hasattr(QsciScintilla, "SCI_STUTTEREDPAGEDOWNEXTEND"): - act = E5Action(QApplication.translate('ViewManager', - 'Stuttered extend selection down one page'), - QApplication.translate('ViewManager', - 'Stuttered extend selection down one page'), - 0, 0, - self.editorActGrp, 'vm_edit_stuttered_extend_selection_down_page') + act = E5Action( + QApplication.translate( + 'ViewManager', + 'Stuttered extend selection down one page'), + QApplication.translate( + 'ViewManager', + 'Stuttered extend selection down one page'), + 0, 0, + self.editorActGrp, + 'vm_edit_stuttered_extend_selection_down_page') self.esm.setMapping(act, QsciScintilla.SCI_STUTTEREDPAGEDOWNEXTEND) act.triggered[()].connect(self.esm.map) self.editActions.append(act) if hasattr(QsciScintilla, "SCI_DELWORDRIGHTEND"): - act = E5Action(QApplication.translate('ViewManager', - 'Delete right to end of next word'), - QApplication.translate('ViewManager', - 'Delete right to end of next word'), - 0, 0, - self.editorActGrp, 'vm_edit_delete_right_end_next_word') + act = E5Action( + QApplication.translate( + 'ViewManager', + 'Delete right to end of next word'), + QApplication.translate( + 'ViewManager', + 'Delete right to end of next word'), + 0, 0, + self.editorActGrp, 'vm_edit_delete_right_end_next_word') if isMacPlatform(): act.setShortcut(QKeySequence( QApplication.translate('ViewManager', 'Alt+Del'))) @@ -1620,34 +1757,43 @@ self.editActions.append(act) if hasattr(QsciScintilla, "SCI_MOVESELECTEDLINESUP"): - act = E5Action(QApplication.translate('ViewManager', - 'Move selected lines up one line'), - QApplication.translate('ViewManager', - 'Move selected lines up one line'), - 0, 0, - self.editorActGrp, 'vm_edit_move_selection_up_one_line') + act = E5Action( + QApplication.translate( + 'ViewManager', + 'Move selected lines up one line'), + QApplication.translate( + 'ViewManager', + 'Move selected lines up one line'), + 0, 0, + self.editorActGrp, 'vm_edit_move_selection_up_one_line') self.esm.setMapping(act, QsciScintilla.SCI_MOVESELECTEDLINESUP) act.triggered[()].connect(self.esm.map) self.editActions.append(act) if hasattr(QsciScintilla, "SCI_MOVESELECTEDLINESDOWN"): - act = E5Action(QApplication.translate('ViewManager', - 'Move selected lines down one line'), - QApplication.translate('ViewManager', - 'Move selected lines down one line'), - 0, 0, - self.editorActGrp, 'vm_edit_move_selection_down_one_line') + act = E5Action( + QApplication.translate( + 'ViewManager', + 'Move selected lines down one line'), + QApplication.translate( + 'ViewManager', + 'Move selected lines down one line'), + 0, 0, + self.editorActGrp, 'vm_edit_move_selection_down_one_line') self.esm.setMapping(act, QsciScintilla.SCI_MOVESELECTEDLINESDOWN) act.triggered[()].connect(self.esm.map) self.editActions.append(act) - act = E5Action(QApplication.translate('ViewManager', - 'Duplicate current selection'), - QApplication.translate('ViewManager', - 'Duplicate current selection'), - QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Shift+D')), - 0, - self.editorActGrp, 'vm_edit_duplicate_current_selection') + act = E5Action( + QApplication.translate( + 'ViewManager', + 'Duplicate current selection'), + QApplication.translate( + 'ViewManager', + 'Duplicate current selection'), + QKeySequence(QApplication.translate('ViewManager', + 'Ctrl+Shift+D')), + 0, self.editorActGrp, 'vm_edit_duplicate_current_selection') self.esm.setMapping(act, QsciScintilla.SCI_SELECTIONDUPLICATE) act.triggered[()].connect(self.esm.map) self.editActions.append(act) @@ -1656,15 +1802,17 @@ def __createSearchActions(self): """ - Private method defining the user interface actions for the search commands. + Private method defining the user interface actions for the search + commands. """ - self.searchAct = E5Action(QApplication.translate('ViewManager', 'Search'), - UI.PixmapCache.getIcon("find.png"), - QApplication.translate('ViewManager', '&Search...'), - QKeySequence(QApplication.translate('ViewManager', - "Ctrl+F", "Search|Search")), - 0, - self, 'vm_search') + self.searchAct = E5Action( + QApplication.translate('ViewManager', 'Search'), + UI.PixmapCache.getIcon("find.png"), + QApplication.translate('ViewManager', '&Search...'), + QKeySequence(QApplication.translate( + 'ViewManager', "Ctrl+F", "Search|Search")), + 0, + self, 'vm_search') self.searchAct.setStatusTip(QApplication.translate('ViewManager', 'Search for a text')) self.searchAct.setWhatsThis(QApplication.translate('ViewManager', @@ -1688,8 +1836,9 @@ 'Search next occurrence of text')) self.searchNextAct.setWhatsThis(QApplication.translate('ViewManager', """<b>Search next</b>""" - """<p>Search the next occurrence of some text in the current editor.""" - """ The previously entered searchtext and options are reused.</p>""" + """<p>Search the next occurrence of some text in the current""" + """ editor. The previously entered searchtext and options are""" + """ reused.</p>""" )) self.searchNextAct.triggered[()].connect(self.searchDlg.findNext) self.searchActions.append(self.searchNextAct) @@ -1706,42 +1855,47 @@ 'Search previous occurrence of text')) self.searchPrevAct.setWhatsThis(QApplication.translate('ViewManager', """<b>Search previous</b>""" - """<p>Search the previous occurrence of some text in the current editor.""" - """ The previously entered searchtext and options are reused.</p>""" + """<p>Search the previous occurrence of some text in the""" + """ current editor. The previously entered searchtext and""" + """ options are reused.</p>""" )) self.searchPrevAct.triggered[()].connect(self.searchDlg.findPrev) self.searchActions.append(self.searchPrevAct) - self.searchClearMarkersAct = E5Action(QApplication.translate('ViewManager', - 'Clear search markers'), - UI.PixmapCache.getIcon("findClear.png"), - QApplication.translate('ViewManager', 'Clear search markers'), - QKeySequence(QApplication.translate('ViewManager', - "Ctrl+3", "Search|Clear search markers")), - 0, - self, 'vm_clear_search_markers') - self.searchClearMarkersAct.setStatusTip(QApplication.translate('ViewManager', - 'Clear all displayed search markers')) - self.searchClearMarkersAct.setWhatsThis(QApplication.translate('ViewManager', + self.searchClearMarkersAct = E5Action( + QApplication.translate('ViewManager', + 'Clear search markers'), + UI.PixmapCache.getIcon("findClear.png"), + QApplication.translate('ViewManager', 'Clear search markers'), + QKeySequence(QApplication.translate( + 'ViewManager', "Ctrl+3", "Search|Clear search markers")), + 0, + self, 'vm_clear_search_markers') + self.searchClearMarkersAct.setStatusTip(QApplication.translate( + 'ViewManager', 'Clear all displayed search markers')) + self.searchClearMarkersAct.setWhatsThis(QApplication.translate( + 'ViewManager', """<b>Clear search markers</b>""" """<p>Clear all displayed search markers.</p>""" )) - self.searchClearMarkersAct.triggered[()].connect(self.__searchClearMarkers) + self.searchClearMarkersAct.triggered[()].connect( + self.__searchClearMarkers) self.searchActions.append(self.searchClearMarkersAct) - self.replaceAct = E5Action(QApplication.translate('ViewManager', 'Replace'), - QApplication.translate('ViewManager', '&Replace...'), - QKeySequence(QApplication.translate('ViewManager', - "Ctrl+R", "Search|Replace")), - 0, - self, 'vm_search_replace') + self.replaceAct = E5Action( + QApplication.translate('ViewManager', 'Replace'), + QApplication.translate('ViewManager', '&Replace...'), + QKeySequence(QApplication.translate( + 'ViewManager', "Ctrl+R", "Search|Replace")), + 0, + self, 'vm_search_replace') self.replaceAct.setStatusTip(QApplication.translate('ViewManager', 'Replace some text')) self.replaceAct.setWhatsThis(QApplication.translate('ViewManager', """<b>Replace</b>""" - """<p>Search for some text in the current editor and replace it. A""" - """ dialog is shown to enter the searchtext, the replacement text""" - """ and options for the search and replace.</p>""" + """<p>Search for some text in the current editor and replace""" + """ it. A dialog is shown to enter the searchtext, the""" + """ replacement text and options for the search and replace.</p>""" )) self.replaceAct.triggered[()].connect(self.__replace) self.searchActions.append(self.replaceAct) @@ -1753,7 +1907,8 @@ self.aboutAct = E5Action(self.trUtf8('About'), self.trUtf8('&About'), 0, 0, self, 'about_eric') - self.aboutAct.setStatusTip(self.trUtf8('Display information about this software')) + self.aboutAct.setStatusTip(self.trUtf8( + 'Display information about this software')) self.aboutAct.setWhatsThis(self.trUtf8( """<b>About</b>""" """<p>Display some information about this software.</p>""")) @@ -1779,11 +1934,12 @@ self.whatsThisAct.setStatusTip(self.trUtf8('Context sensitive help')) self.whatsThisAct.setWhatsThis(self.trUtf8( """<b>Display context sensitive help</b>""" - """<p>In What's This? mode, the mouse cursor shows an arrow with a""" - """ question mark, and you can click on the interface elements to get""" - """ a short description of what they do and how to use them. In""" - """ dialogs, this feature can be accessed using the context help button""" - """ in the titlebar.</p>""" + """<p>In What's This? mode, the mouse cursor shows an arrow""" + """ with a question mark, and you can click on the interface""" + """ elements to get a short description of what they do and""" + """ how to use them. In dialogs, this feature can be""" + """ accessed using the context help button in the titlebar.""" + """</p>""" )) self.whatsThisAct.triggered[()].connect(self.__whatsThis) self.helpActions.append(self.whatsThisAct) @@ -1882,15 +2038,15 @@ self.sbLine = QLabel(self.__statusBar) self.__statusBar.addPermanentWidget(self.sbLine) self.sbLine.setWhatsThis(self.trUtf8( - """<p>This part of the status bar displays the line number of the""" - """ editor.</p>""" + """<p>This part of the status bar displays the line number of""" + """ the editor.</p>""" )) self.sbPos = QLabel(self.__statusBar) self.__statusBar.addPermanentWidget(self.sbPos) self.sbPos.setWhatsThis(self.trUtf8( - """<p>This part of the status bar displays the cursor position of""" - """ the editor.</p>""" + """<p>This part of the status bar displays the cursor position""" + """ of the editor.</p>""" )) self.__statusBar.showMessage(self.trUtf8("Ready")) @@ -1971,7 +2127,8 @@ QApplication.setOverrideCursor(Qt.WaitCursor) txt = self.__textEdit.text() try: - self.encoding = Utilities.writeEncodedFile(fileName, txt, self.encoding) + self.encoding = Utilities.writeEncodedFile( + fileName, txt, self.encoding) except (IOError, Utilities.CodingError, UnicodeError) as why: E5MessageBox.critical(self, self.trUtf8('Save File'), self.trUtf8('<p>The file <b>{0}</b> could not be saved.<br/>' @@ -2084,7 +2241,8 @@ Private method to configure the margins. """ # set the settings for all margins - self.__textEdit.setMarginsFont(Preferences.getEditorOtherFonts("MarginsFont")) + self.__textEdit.setMarginsFont( + Preferences.getEditorOtherFonts("MarginsFont")) self.__textEdit.setMarginsForegroundColor( Preferences.getEditorColour("MarginsForeground")) self.__textEdit.setMarginsBackgroundColor( @@ -2133,15 +2291,18 @@ Private method to configure the text display. """ self.__textEdit.setTabWidth(Preferences.getEditor("TabWidth")) - self.__textEdit.setIndentationWidth(Preferences.getEditor("IndentWidth")) + self.__textEdit.setIndentationWidth( + Preferences.getEditor("IndentWidth")) if self.lexer_ and self.lexer_.alwaysKeepTabs(): self.__textEdit.setIndentationsUseTabs(True) else: self.__textEdit.setIndentationsUseTabs( Preferences.getEditor("TabForIndentation")) self.__textEdit.setTabIndents(Preferences.getEditor("TabIndents")) - self.__textEdit.setBackspaceUnindents(Preferences.getEditor("TabIndents")) - self.__textEdit.setIndentationGuides(Preferences.getEditor("IndentationGuides")) + self.__textEdit.setBackspaceUnindents( + Preferences.getEditor("TabIndents")) + self.__textEdit.setIndentationGuides( + Preferences.getEditor("IndentationGuides")) if Preferences.getEditor("ShowWhitespace"): self.__textEdit.setWhitespaceVisibility(QsciScintilla.WsVisible) try: @@ -2184,12 +2345,14 @@ else: self.__textEdit.setSelectionForegroundColor( QApplication.palette().color(QPalette.HighlightedText)) - self.__textEdit.setSelectionToEol(Preferences.getEditor("ExtendSelectionToEol")) + self.__textEdit.setSelectionToEol( + Preferences.getEditor("ExtendSelectionToEol")) self.__textEdit.setCaretForegroundColor( Preferences.getEditorColour("CaretForeground")) self.__textEdit.setCaretLineBackgroundColor( Preferences.getEditorColour("CaretLineBackground")) - self.__textEdit.setCaretLineVisible(Preferences.getEditor("CaretLineVisible")) + self.__textEdit.setCaretLineVisible( + Preferences.getEditor("CaretLineVisible")) self.caretWidth = Preferences.getEditor("CaretWidth") self.__textEdit.setCaretWidth(self.caretWidth) self.useMonospaced = Preferences.getEditor("UseMonospacedFont") @@ -2206,14 +2369,17 @@ self.__textEdit.setWrapVisualFlags(wrapVisualFlag, wrapVisualFlag) self.searchIndicator = QsciScintilla.INDIC_CONTAINER - self.__textEdit.indicatorDefine(self.searchIndicator, QsciScintilla.INDIC_BOX, + self.__textEdit.indicatorDefine( + self.searchIndicator, QsciScintilla.INDIC_BOX, Preferences.getEditorColour("SearchMarkers")) self.__textEdit.setCursorFlashTime(QApplication.cursorFlashTime()) if Preferences.getEditor("OverrideEditAreaColours"): - self.__textEdit.setColor(Preferences.getEditorColour("EditAreaForeground")) - self.__textEdit.setPaper(Preferences.getEditorColour("EditAreaBackground")) + self.__textEdit.setColor( + Preferences.getEditorColour("EditAreaForeground")) + self.__textEdit.setPaper( + Preferences.getEditorColour("EditAreaBackground")) self.__textEdit.setVirtualSpaceOptions( Preferences.getEditor("VirtualSpaceOptions")) @@ -2239,7 +2405,8 @@ if not self.lexer_: self.__textEdit.clearStyles() self.__setMargins() - self.__textEdit.setFont(Preferences.getEditorOtherFonts("DefaultFont")) + self.__textEdit.setFont( + Preferences.getEditorOtherFonts("DefaultFont")) self.useMonospaced = on @@ -2262,7 +2429,8 @@ printer.setDocName(self.trUtf8("Untitled")) if printDialog.printRange() == QAbstractPrintDialog.Selection: # get the selection - fromLine, fromIndex, toLine, toIndex = self.__textEdit.getSelection() + fromLine, fromIndex, toLine, toIndex = \ + self.__textEdit.getSelection() if toIndex == 0: toLine -= 1 # Qscintilla seems to print one line more than told @@ -2298,7 +2466,8 @@ """ Private slot to generate a print preview. - @param printer reference to the printer object (QScintilla.Printer.Printer) + @param printer reference to the printer object + (QScintilla.Printer.Printer) """ printer.printRange(self.__textEdit) @@ -2330,7 +2499,8 @@ self.contextMenu.addAction(self.pasteAct) self.contextMenu.addSeparator() self.contextMenu.addAction(self.trUtf8('Select all'), self.__selectAll) - self.contextMenu.addAction(self.trUtf8('Deselect all'), self.__deselectAll) + self.contextMenu.addAction( + self.trUtf8('Deselect all'), self.__deselectAll) self.contextMenu.addSeparator() self.languagesMenuAct = self.contextMenu.addMenu(self.languagesMenu) self.contextMenu.addSeparator() @@ -2358,7 +2528,8 @@ languages = sorted(list(supportedLanguages.keys())) for language in languages: if language != "Guessed": - self.supportedLanguages[language] = supportedLanguages[language][:2] + self.supportedLanguages[language] = \ + supportedLanguages[language][:2] act = menu.addAction( UI.PixmapCache.getIcon(supportedLanguages[language][2]), self.supportedLanguages[language][0]) @@ -2382,7 +2553,8 @@ def __showContextMenuLanguages(self): """ - Private slot handling the aboutToShow signal of the languages context menu. + Private slot handling the aboutToShow signal of the languages context + menu. """ if self.apiLanguage.startswith("Pygments|"): self.pygmentsSelAct.setText( @@ -2447,16 +2619,19 @@ self.__setMonospaced(self.useMonospaced) if Preferences.getEditor("OverrideEditAreaColours"): - self.__textEdit.setColor(Preferences.getEditorColour("EditAreaForeground")) - self.__textEdit.setPaper(Preferences.getEditorColour("EditAreaBackground")) + self.__textEdit.setColor( + Preferences.getEditorColour("EditAreaForeground")) + self.__textEdit.setPaper( + Preferences.getEditorColour("EditAreaBackground")) def setLanguage(self, filename, initTextDisplay=True, pyname=""): """ Public method to set a lexer language. - @param filename filename used to determine the associated lexer language (string) - @param initTextDisplay flag indicating an initialization of the text display - is required as well (boolean) + @param filename filename used to determine the associated lexer + language (string) + @param initTextDisplay flag indicating an initialization of the text + display is required as well (boolean) @keyparam pyname name of the pygments lexer to use (string) """ self.__bindLexer(filename, pyname=pyname) @@ -2474,7 +2649,8 @@ @return language of the editor (string) """ - if self.apiLanguage == "Guessed" or self.apiLanguage.startswith("Pygments|"): + if self.apiLanguage == "Guessed" or \ + self.apiLanguage.startswith("Pygments|"): return self.lexer_.name() else: return self.apiLanguage @@ -2498,7 +2674,8 @@ """ Private slot to set the correct lexer depending on language. - @param filename filename used to determine the associated lexer language (string) + @param filename filename used to determine the associated lexer + language (string) @keyparam pyname name of the pygments lexer to use (string) """ if self.lexer_ is not None and \ @@ -2655,8 +2832,8 @@ def textForFind(self): """ - Public method to determine the selection or the current word for the next - find operation. + Public method to determine the selection or the current word for the + next find operation. @return selection or current word (string) """ @@ -2750,7 +2927,8 @@ @param startPos start position of the indicator (integer) @param indicLength length of the indicator (integer) """ - self.__textEdit.setIndicatorRange(self.searchIndicator, startPos, indicLength) + self.__textEdit.setIndicatorRange( + self.searchIndicator, startPos, indicLength) def clearSearchIndicators(self): """
--- a/QScintilla/Printer.py Sat Oct 12 18:25:29 2013 +0200 +++ b/QScintilla/Printer.py Sun Oct 13 12:21:37 2013 +0200 @@ -58,15 +58,16 @@ """ fn = self.docName() - header = QApplication.translate('Printer', - '{0} - Printed on {1}, {2} - Page {3}')\ + header = QApplication.translate( + 'Printer', '{0} - Printed on {1}, {2} - Page {3}')\ .format(fn, self.date, self.time, pagenr) painter.save() painter.setFont(self.headerFont) # set our header font painter.setPen(QColor(Qt.black)) # set color if drawing: - painter.drawText(area.right() - painter.fontMetrics().width(header), + painter.drawText( + area.right() - painter.fontMetrics().width(header), area.top() + painter.fontMetrics().ascent(), header) area.setTop(area.top() + painter.fontMetrics().height() + 5) painter.restore()
--- a/QScintilla/QsciScintillaCompat.py Sat Oct 12 18:25:29 2013 +0200 +++ b/QScintilla/QsciScintillaCompat.py Sun Oct 13 12:21:37 2013 +0200 @@ -114,11 +114,13 @@ self.SendScintilla(QsciScintilla.SCI_STYLESETFONT, style, f) self.SendScintilla(QsciScintilla.SCI_STYLESETSIZE, style, ps) try: - self.SendScintilla(QsciScintilla.SCI_STYLESETWEIGHT, style, weight) + self.SendScintilla( + QsciScintilla.SCI_STYLESETWEIGHT, style, weight) except AttributeError: self.SendScintilla(QsciScintilla.SCI_STYLESETBOLD, style, bold) self.SendScintilla(QsciScintilla.SCI_STYLESETITALIC, style, italic) - self.SendScintilla(QsciScintilla.SCI_STYLESETUNDERLINE, style, underline) + self.SendScintilla( + QsciScintilla.SCI_STYLESETUNDERLINE, style, underline) def linesOnScreen(self): """ @@ -503,14 +505,17 @@ if not self.selectionIsRectangle(): return (-1, -1, -1, -1) - startPos = self.SendScintilla(QsciScintilla.SCI_GETRECTANGULARSELECTIONANCHOR) - endPos = self.SendScintilla(QsciScintilla.SCI_GETRECTANGULARSELECTIONCARET) + startPos = self.SendScintilla( + QsciScintilla.SCI_GETRECTANGULARSELECTIONANCHOR) + endPos = self.SendScintilla( + QsciScintilla.SCI_GETRECTANGULARSELECTIONCARET) startLine, startIndex = self.lineIndexFromPosition(startPos) endLine, endIndex = self.lineIndexFromPosition(endPos) return (startLine, startIndex, endLine, endIndex) - def setRectangularSelection(self, startLine, startIndex, endLine, endIndex): + def setRectangularSelection(self, startLine, startIndex, endLine, + endIndex): """ Public method to set a rectangular selection. @@ -522,8 +527,10 @@ startPos = self.positionFromLineIndex(startLine, startIndex) endPos = self.positionFromLineIndex(endLine, endIndex) - self.SendScintilla(QsciScintilla.SCI_SETRECTANGULARSELECTIONANCHOR, startPos) - self.SendScintilla(QsciScintilla.SCI_SETRECTANGULARSELECTIONCARET, endPos) + self.SendScintilla( + QsciScintilla.SCI_SETRECTANGULARSELECTIONANCHOR, startPos) + self.SendScintilla( + QsciScintilla.SCI_SETRECTANGULARSELECTIONCARET, endPos) def getSelectionCount(self): """ @@ -542,7 +549,8 @@ @return tuple with start line and index and end line and index (tuple of four int) for the given selection """ - startPos = self.SendScintilla(QsciScintilla.SCI_GETSELECTIONNSTART, index) + startPos = self.SendScintilla( + QsciScintilla.SCI_GETSELECTIONNSTART, index) endPos = self.SendScintilla(QsciScintilla.SCI_GETSELECTIONNEND, index) startLine, startIndex = self.lineIndexFromPosition(startPos) endLine, endIndex = self.lineIndexFromPosition(endPos) @@ -551,7 +559,8 @@ def getSelections(self): """ - Public method to get the start and end coordinates of all active selections. + Public method to get the start and end coordinates of all active + selections. @return list of tuples with start line and index and end line and index of each active selection (list of tuples of four int)
--- a/QScintilla/SearchReplaceWidget.py Sat Oct 12 18:25:29 2013 +0200 +++ b/QScintilla/SearchReplaceWidget.py Sun Oct 13 12:21:37 2013 +0200 @@ -8,8 +8,8 @@ """ from PyQt4.QtCore import pyqtSignal, Qt, pyqtSlot -from PyQt4.QtGui import QWidget, QHBoxLayout, QToolButton, QScrollArea, QSizePolicy, \ - QFrame +from PyQt4.QtGui import QWidget, QHBoxLayout, QToolButton, QScrollArea, \ + QSizePolicy, QFrame from .Editor import Editor @@ -55,9 +55,9 @@ whatsThis = self.trUtf8(r""" <b>Find and Replace</b> <p>This dialog is used to find some text and replace it with another text. -By checking the various checkboxes, the search can be made more specific. The search -string might be a regular expression. In a regular expression, special characters -interpreted are:</p> +By checking the various checkboxes, the search can be made more specific. +The search string might be a regular expression. In a regular expression, +special characters interpreted are:</p> """ ) else: @@ -65,9 +65,9 @@ self.ui = Ui_SearchWidget() whatsThis = self.trUtf8(r""" <b>Find</b> -<p>This dialog is used to find some text. By checking the various checkboxes, the search -can be made more specific. The search string might be a regular expression. In a regular -expression, special characters interpreted are:</p> +<p>This dialog is used to find some text. By checking the various checkboxes, +the search can be made more specific. The search string might be a regular +expression. In a regular expression, special characters interpreted are:</p> """ ) self.ui.setupUi(self) @@ -77,32 +77,41 @@ whatsThis += self.trUtf8(r""" <table border="0"> <tr><td><code>.</code></td><td>Matches any character</td></tr> -<tr><td><code>\(</code></td><td>This marks the start of a region for tagging a match.</td></tr> -<tr><td><code>\)</code></td><td>This marks the end of a tagged region.</td></tr> +<tr><td><code>\(</code></td><td>This marks the start of a region for tagging a +match.</td></tr> +<tr><td><code>\)</code></td><td>This marks the end of a tagged region. +</td></tr> <tr><td><code>\\n</code></td> -<td>Where <code>n</code> is 1 through 9 refers to the first through ninth tagged region -when replacing. For example, if the search string was <code>Fred\([1-9]\)XXX</code> and -the replace string was <code>Sam\1YYY</code>, when applied to <code>Fred2XXX</code> this -would generate <code>Sam2YYY</code>.</td></tr> +<td>Where <code>n</code> is 1 through 9 refers to the first through ninth +tagged region when replacing. For example, if the search string was +<code>Fred\([1-9]\)XXX</code> and the replace string was <code>Sam\1YYY</code>, +when applied to <code>Fred2XXX</code> this would generate <code>Sam2YYY</code>. +</td></tr> <tr><td><code>\<</code></td> -<td>This matches the start of a word using Scintilla's definitions of words.</td></tr> +<td>This matches the start of a word using Scintilla's definitions of words. +</td></tr> <tr><td><code>\></code></td> -<td>This matches the end of a word using Scintilla's definition of words.</td></tr> +<td>This matches the end of a word using Scintilla's definition of words. +</td></tr> <tr><td><code>\\x</code></td> -<td>This allows you to use a character x that would otherwise have a special meaning. For -example, \\[ would be interpreted as [ and not as the start of a character set.</td></tr> +<td>This allows you to use a character x that would otherwise have a special +meaning. For example, \\[ would be interpreted as [ and not as the start of a +character set.</td></tr> <tr><td><code>[...]</code></td> -<td>This indicates a set of characters, for example, [abc] means any of the characters a, -b or c. You can also use ranges, for example [a-z] for any lower case character.</td></tr> +<td>This indicates a set of characters, for example, [abc] means any of the +characters a, b or c. You can also use ranges, for example [a-z] for any lower +case character.</td></tr> <tr><td><code>[^...]</code></td> -<td>The complement of the characters in the set. For example, [^A-Za-z] means any -character except an alphabetic character.</td></tr> +<td>The complement of the characters in the set. For example, [^A-Za-z] means +any character except an alphabetic character.</td></tr> <tr><td><code>^</code></td> -<td>This matches the start of a line (unless used inside a set, see above).</td></tr> +<td>This matches the start of a line (unless used inside a set, see above). +</td></tr> <tr><td><code>$</code></td> <td>This matches the end of a line.</td></tr> <tr><td><code>*</code></td> -<td>This matches 0 or more times. For example, <code>Sa*m</code> matches <code>Sm</code>, -<code>Sam</code>, <code>Saam</code>, <code>Saaam</code> and so on.</td></tr> +<td>This matches 0 or more times. For example, <code>Sa*m</code> matches +<code>Sm</code>, <code>Sam</code>, <code>Saam</code>, <code>Saaam</code> +and so on.</td></tr> <tr><td><code>+</code></td> <td>This matches 1 or more times. For example, <code>Sa+m</code> matches <code>Sam</code>, <code>Saam</code>, <code>Saaam</code> and so on.</td></tr> @@ -111,8 +120,10 @@ self.setWhatsThis(whatsThis) self.ui.closeButton.setIcon(UI.PixmapCache.getIcon("close.png")) - self.ui.findPrevButton.setIcon(UI.PixmapCache.getIcon("1leftarrow.png")) - self.ui.findNextButton.setIcon(UI.PixmapCache.getIcon("1rightarrow.png")) + self.ui.findPrevButton.setIcon( + UI.PixmapCache.getIcon("1leftarrow.png")) + self.ui.findNextButton.setIcon( + UI.PixmapCache.getIcon("1rightarrow.png")) if replace: self.ui.replaceButton.setIcon( @@ -122,7 +133,8 @@ self.ui.replaceAllButton.setIcon( UI.PixmapCache.getIcon("editReplaceAll.png")) - self.ui.findtextCombo.lineEdit().returnPressed.connect(self.__findByReturnPressed) + self.ui.findtextCombo.lineEdit().returnPressed.connect( + self.__findByReturnPressed) if replace: self.ui.replacetextCombo.lineEdit().returnPressed.connect( self.on_replaceButton_clicked) @@ -270,7 +282,8 @@ def __findByReturnPressed(self): """ - Private slot to handle the returnPressed signal of the findtext combobox. + Private slot to handle the returnPressed signal of the findtext + combobox. """ if self.__findBackwards: self.findPrev() @@ -423,11 +436,13 @@ line, index = self.__selections[ind][2:] else: if ind > 0: - line, index = self.__selections[ind - 1][2:] + line, index = \ + self.__selections[ind - 1][2:] else: if after: if ind < len(self.__selections) - 1: - line, index = self.__selections[ind + 1][:2] + line, index = \ + self.__selections[ind + 1][:2] else: line, index = self.__selections[ind][:2] break @@ -441,10 +456,14 @@ not backwards, line, index) if ok: - lineFrom, indexFrom, lineTo, indexTo = aw.getSelection() - if lineFrom < boundary[0] or lineFrom > boundary[2] or \ - indexFrom < boundary[1] or indexFrom > boundary[3] or \ - indexTo < boundary[1] or indexTo > boundary[3]: + lineFrom, indexFrom, lineTo, indexTo = \ + aw.getSelection() + if lineFrom < boundary[0] or \ + lineFrom > boundary[2] or \ + indexFrom < boundary[1] or \ + indexFrom > boundary[3] or \ + indexTo < boundary[1] or \ + indexTo > boundary[3]: ok = False break if not ok: @@ -462,7 +481,8 @@ not backwards, line, index) if ok: - lineFrom, indexFrom, lineTo, indexTo = aw.getSelection() + lineFrom, indexFrom, lineTo, indexTo = \ + aw.getSelection() if len(self.__selections) > 1: for sel in self.__selections: if lineFrom == sel[0] and \ @@ -545,7 +565,8 @@ if not self.__finding and isinstance(editor, Editor): if editor.hasSelectedText(): selections = editor.getSelections() - line1, index1, line2, index2 = self.__selectionBoundary(selections) + line1, index1, line2, index2 = \ + self.__selectionBoundary(selections) if line1 != line2: self.ui.selectionCheckBox.setEnabled(True) self.ui.selectionCheckBox.setChecked(True) @@ -566,7 +587,8 @@ @pyqtSlot() def on_replaceSearchButton_clicked(self): """ - Private slot to replace one occurrence of text and search for the next one. + Private slot to replace one occurrence of text and search for the next + one. """ self.__doReplace(True) @@ -574,7 +596,8 @@ """ Private method to replace one occurrence of text. - @param searchNext flag indicating to search for the next occurrence (boolean). + @param searchNext flag indicating to search for the next occurrence + (boolean). """ self.__finding = True @@ -675,7 +698,8 @@ after = indexTo > self.__selections[ind][3] if after: if ind < len(self.__selections) - 1: - line, index = self.__selections[ind + 1][:2] + line, index = \ + self.__selections[ind + 1][:2] else: line, index = self.__selections[ind][:2] break @@ -687,10 +711,14 @@ self.ui.wordCheckBox.isChecked(), False, True, line, index) if ok: - lineFrom, indexFrom, lineTo, indexTo = aw.getSelection() - if lineFrom < boundary[0] or lineFrom > boundary[2] or \ - indexFrom < boundary[1] or indexFrom > boundary[3] or \ - indexTo < boundary[1] or indexTo > boundary[3]: + lineFrom, indexFrom, lineTo, indexTo = \ + aw.getSelection() + if lineFrom < boundary[0] or \ + lineFrom > boundary[2] or \ + indexFrom < boundary[1] or \ + indexFrom > boundary[3] or \ + indexTo < boundary[1] or \ + indexTo > boundary[3]: ok = False break @@ -829,7 +857,8 @@ """ super().__init__(parent) - self.__searchReplaceWidget = SearchReplaceWidget(replace, vm, self, True) + self.__searchReplaceWidget = \ + SearchReplaceWidget(replace, vm, self, True) srHeight = self.__searchReplaceWidget.height() self.__layout = QHBoxLayout(self) @@ -865,7 +894,8 @@ self.setMaximumHeight(srHeight) - self.__searchReplaceWidget.searchListChanged.connect(self.searchListChanged) + self.__searchReplaceWidget.searchListChanged.connect( + self.searchListChanged) self.__leftButton.clicked[()].connect(self.__slideLeft) self.__rightButton.clicked[()].connect(self.__slideRight) @@ -909,13 +939,15 @@ def __slideLeft(self): """ - Private slot to move the widget to the left, i.e. show contents to the right. + Private slot to move the widget to the left, i.e. show contents to the + right. """ self.__slide(True) def __slideRight(self): """ - Private slot to move the widget to the right, i.e. show contents to the left. + Private slot to move the widget to the right, i.e. show contents to + the left. """ self.__slide(False)
--- a/QScintilla/ShellHistoryDialog.py Sat Oct 12 18:25:29 2013 +0200 +++ b/QScintilla/ShellHistoryDialog.py Sun Oct 13 12:21:37 2013 +0200 @@ -54,7 +54,8 @@ """ Private slot to handle a double click of an item. - @param item reference to the item that was double clicked (QListWidgetItem) + @param item reference to the item that was double clicked + (QListWidgetItem) """ self.on_executeButton_clicked()
--- a/QScintilla/SortOptionsDialog.py Sat Oct 12 18:25:29 2013 +0200 +++ b/QScintilla/SortOptionsDialog.py Sun Oct 13 12:21:37 2013 +0200 @@ -29,8 +29,8 @@ """ Public method to get the selected options. - @return tuple of three flags indicating ascending order, alphanumeric sort - and case sensitivity (tuple of three boolean) + @return tuple of three flags indicating ascending order, alphanumeric + sort and case sensitivity (tuple of three boolean) """ return ( self.ascendingButton.isChecked(),
--- a/QScintilla/SpellChecker.py Sat Oct 12 18:25:29 2013 +0200 +++ b/QScintilla/SpellChecker.py Sun Oct 13 12:21:37 2013 +0200 @@ -30,15 +30,18 @@ _spelling_lang = None _spelling_dict = None - def __init__(self, editor, indicator, defaultLanguage=None, checkRegion=None): + def __init__(self, editor, indicator, defaultLanguage=None, + checkRegion=None): """ Constructor @param editor reference to the editor object (QScintilla.Editor) @param indicator spell checking indicator - @keyparam defaultLanguage the language to be used as the default (string). - The string should be in language locale format (e.g. en_US, de). - @keyparam checkRegion reference to a function to check for a valid region + @keyparam defaultLanguage the language to be used as the default + (string). The string should be in language locale format + (e.g. en_US, de). + @keyparam checkRegion reference to a function to check for a valid + region """ super().__init__(editor) @@ -94,9 +97,11 @@ exception dictionary (string) """ if isException: - return os.path.join(Utilities.getConfigDir(), "spelling", "pel.dic") + return os.path.join( + Utilities.getConfigDir(), "spelling", "pel.dic") else: - return os.path.join(Utilities.getConfigDir(), "spelling", "pwl.dic") + return os.path.join( + Utilities.getConfigDir(), "spelling", "pwl.dic") @classmethod def getUserDictionaryPath(cls, isException=False): @@ -191,7 +196,8 @@ def __getNextWord(self, pos, endPosition): """ - Private method to get the next word in the text after the given position. + Private method to get the next word in the text after the given + position. @param pos position to start word extraction (integer) @param endPosition position to stop word extraction (integer) @@ -240,7 +246,8 @@ Public method to get information about the last error found. @return tuple of last faulty word (string), starting position of the - faulty word (integer) and ending position of the faulty word (integer) + faulty word (integer) and ending position of the faulty word + (integer) """ return (self.word, self.wordStart, self.wordEnd) @@ -259,7 +266,8 @@ if spell is None: return False - self.editor.clearIndicatorRange(self.indicator, startPos, endPos - startPos) + self.editor.clearIndicatorRange( + self.indicator, startPos, endPos - startPos) self.pos = startPos self.endPos = endPos @@ -294,7 +302,8 @@ return linesChunk = Preferences.getEditor("AutoSpellCheckChunkSize") - self.checkLines(self.lastCheckedLine, self.lastCheckedLine + linesChunk) + self.checkLines(self.lastCheckedLine, + self.lastCheckedLine + linesChunk) self.lastCheckedLine = self.lastCheckedLine + linesChunk + 1 if self.lastCheckedLine >= self.editor.lines(): self.lastCheckedLine = -1 @@ -321,7 +330,8 @@ pos1 = -1 if not self.editor.charAt(pos).isalnum(): line, index = self.editor.lineIndexFromPosition(pos) - self.editor.clearIndicator(self.indicator, line, index, line, index + 1) + self.editor.clearIndicator( + self.indicator, line, index, line, index + 1) pos1 = self.editor.positionAfter(pos) pos0 = self.editor.positionBefore(pos) @@ -333,13 +343,15 @@ ok = spell.check(word) else: ok = True - start, end = \ - self.editor.getWordBoundaries(line, index, useWordChars=False) + start, end = self.editor.getWordBoundaries( + line, index, useWordChars=False) if ok: - self.editor.clearIndicator(self.indicator, line, start, line, end) + self.editor.clearIndicator( + self.indicator, line, start, line, end) else: # spell check indicated an error - self.editor.setIndicator(self.indicator, line, start, line, end) + self.editor.setIndicator( + self.indicator, line, start, line, end) def checkLines(self, firstLine, lastLine): """ @@ -403,7 +415,8 @@ """ Public method to clear all spelling markers. """ - self.editor.clearIndicatorRange(self.indicator, 0, self.editor.length()) + self.editor.clearIndicatorRange( + self.indicator, 0, self.editor.length()) def getSuggestions(self, word): """ @@ -504,7 +517,8 @@ spell = self._spelling_dict if spell: while self.pos < self.endPos and self.pos >= 0: - word, wordStart, wordEnd = self.__getNextWord(self.pos, self.endPos) + word, wordStart, wordEnd = \ + self.__getNextWord(self.pos, self.endPos) self.pos = wordEnd if (wordEnd - wordStart) >= self.minimumWordSize and \ self.__checkRegion(wordStart):
--- a/QScintilla/SpellCheckingDialog.py Sat Oct 12 18:25:29 2013 +0200 +++ b/QScintilla/SpellCheckingDialog.py Sun Oct 13 12:21:37 2013 +0200 @@ -32,7 +32,8 @@ self.setupUi(self) self.__spell = spellChecker - self.languageLabel.setText("<b>{0}</b>".format(self.__spell.getLanguage())) + self.languageLabel.setText( + "<b>{0}</b>".format(self.__spell.getLanguage())) if not self.__spell.initCheck(startPos, endPos): self.__enableButtons(False) else: @@ -65,12 +66,14 @@ self.__enableButtons(True) self.word, self.wordStart, self.wordEnd = self.__spell.getError() - lcontext, rcontext = self.__spell.getContext(self.wordStart, self.wordEnd) + lcontext, rcontext = self.__spell.getContext( + self.wordStart, self.wordEnd) self.changeEdit.setText(self.word) - self.contextLabel.setText('{0}<font color="#FF0000">{1}</font>{2}'.format( - Utilities.html_encode(lcontext), - self.word, - Utilities.html_encode(rcontext))) + self.contextLabel.setText( + '{0}<font color="#FF0000">{1}</font>{2}'.format( + Utilities.html_encode(lcontext), + self.word, + Utilities.html_encode(rcontext))) suggestions = self.__spell.getSuggestions(self.word) self.suggestionsList.clear() self.suggestionsList.addItems(suggestions)
--- a/QScintilla/SpellingDictionaryEditDialog.py Sat Oct 12 18:25:29 2013 +0200 +++ b/QScintilla/SpellingDictionaryEditDialog.py Sun Oct 13 12:21:37 2013 +0200 @@ -17,7 +17,8 @@ class SpellingDictionaryEditDialog(QDialog, Ui_SpellingDictionaryEditDialog): """ - Class implementing a dialog to edit the various spell checking dictionaries. + Class implementing a dialog to edit the various spell checking + dictionaries. """ def __init__(self, data, info, parent=None): """ @@ -40,7 +41,8 @@ self.__proxyModel.setSourceModel(self.__model) self.wordList.setModel(self.__proxyModel) - self.searchEdit.textChanged.connect(self.__proxyModel.setFilterFixedString) + self.searchEdit.textChanged.connect( + self.__proxyModel.setFilterFixedString) self.removeButton.clicked[()].connect(self.wordList.removeSelected) self.removeAllButton.clicked[()].connect(self.wordList.removeAll) @@ -51,7 +53,8 @@ Private slot to handle adding an entry. """ self.__model.insertRow(self.__model.rowCount()) - self.wordList.edit(self.__proxyModel.index(self.__model.rowCount() - 1, 0)) + self.wordList.edit( + self.__proxyModel.index(self.__model.rowCount() - 1, 0)) def getData(self): """ @@ -59,4 +62,5 @@ @return data of the dialog (string) """ - return os.linesep.join([line for line in self.__model.stringList() if line]) + return os.linesep.join( + [line for line in self.__model.stringList() if line])
--- a/QScintilla/TypingCompleters/CompleterPython.py Sat Oct 12 18:25:29 2013 +0200 +++ b/QScintilla/TypingCompleters/CompleterPython.py Sun Oct 13 12:21:37 2013 +0200 @@ -58,7 +58,8 @@ """ Public slot called to reread the configuration parameters. """ - self.setEnabled(Preferences.getEditorTyping("Python/EnabledTypingAids")) + self.setEnabled( + Preferences.getEditorTyping("Python/EnabledTypingAids")) self.__insertClosingBrace = \ Preferences.getEditorTyping("Python/InsertClosingBrace") self.__indentBrace = \ @@ -91,7 +92,8 @@ @param charNumber value of the character entered (integer) """ char = chr(charNumber) - if char not in ['(', ')', '{', '}', '[', ']', ' ', ',', "'", '"', '\n', ':']: + if char not in ['(', ')', '{', '}', '[', ']', ' ', ',', "'", '"', + '\n', ':']: return # take the short route line, col = self.editor.getCursorPosition() @@ -135,7 +137,8 @@ self.editor.removeSelectedText() # space - # insert import, dedent to if for elif, dedent to try for except, dedent def + # insert import, dedent to if for elif, dedent to try for except, + # dedent def elif char == ' ': txt = self.editor.text(line)[:col] if self.__insertImport and self.__importRX.exactMatch(txt): @@ -217,7 +220,8 @@ index -= 1 if openCount > closeCount and lastOpenIndex > col: self.editor.insert(' ' * (lastOpenIndex - col + 1)) - self.editor.setCursorPosition(line, lastOpenIndex + 1) + self.editor.setCursorPosition( + line, lastOpenIndex + 1) def __dedentToIf(self): """ @@ -305,7 +309,8 @@ if self.__py24StyleTry: if (self.__exceptcRX.indexIn(txt) == 0 or \ self.__exceptRX.indexIn(txt) == 0 or \ - self.__finallyRX.indexIn(txt) == 0) and edInd <= indentation: + self.__finallyRX.indexIn(txt) == 0) and \ + edInd <= indentation: indentation = edInd - 1 elif self.__tryRX.indexIn(txt) == 0 and edInd <= indentation: self.editor.cancelList() @@ -316,7 +321,8 @@ indentation = edInd - 1 elif (self.__tryRX.indexIn(txt) == 0 or \ self.__exceptcRX.indexIn(txt) == 0 or \ - self.__exceptRX.indexIn(txt) == 0) and edInd <= indentation: + self.__exceptRX.indexIn(txt) == 0) and \ + edInd <= indentation: self.editor.cancelList() self.editor.setIndentation(line, edInd) break @@ -324,8 +330,8 @@ def __dedentDefStatement(self): """ - Private method to dedent the line of the def statement to a previous def - statement or class statement. + Private method to dedent the line of the def statement to a previous + def statement or class statement. """ line, col = self.editor.getCursorPosition() indentation = self.editor.indentation(line) @@ -418,7 +424,8 @@ def __inDoubleQuotedString(self): """ - Private method to check, if the cursor is within a double quoted string. + Private method to check, if the cursor is within a double quoted + string. @return flag indicating, if the cursor is inside a double quoted string (boolean) @@ -427,16 +434,19 @@ def __inTripleDoubleQuotedString(self): """ - Private method to check, if the cursor is within a triple double quoted string. + Private method to check, if the cursor is within a triple double + quoted string. @return flag indicating, if the cursor is inside a triple double quoted string (boolean) """ - return self.editor.currentStyle() == QsciLexerPython.TripleDoubleQuotedString + return self.editor.currentStyle() == \ + QsciLexerPython.TripleDoubleQuotedString def __inSingleQuotedString(self): """ - Private method to check, if the cursor is within a single quoted string. + Private method to check, if the cursor is within a single quoted + string. @return flag indicating, if the cursor is inside a single quoted string (boolean) @@ -445,9 +455,11 @@ def __inTripleSingleQuotedString(self): """ - Private method to check, if the cursor is within a triple single quoted string. + Private method to check, if the cursor is within a triple single + quoted string. @return flag indicating, if the cursor is inside a triple single quoted string (boolean) """ - return self.editor.currentStyle() == QsciLexerPython.TripleSingleQuotedString + return self.editor.currentStyle() == \ + QsciLexerPython.TripleSingleQuotedString
--- a/QScintilla/TypingCompleters/CompleterRuby.py Sat Oct 12 18:25:29 2013 +0200 +++ b/QScintilla/TypingCompleters/CompleterRuby.py Sun Oct 13 12:21:37 2013 +0200 @@ -63,7 +63,8 @@ @param charNumber value of the character entered (integer) """ char = chr(charNumber) - if char not in ['(', ')', '{', '}', '[', ']', ',', "'", '"', '\n', ' ']: + if char not in ['(', ')', '{', '}', '[', ']', ',', "'", '"', + '\n', ' ']: return # take the short route line, col = self.editor.getCursorPosition() @@ -174,7 +175,8 @@ def __inDoubleQuotedString(self): """ - Private method to check, if the cursor is within a double quoted string. + Private method to check, if the cursor is within a double quoted + string. @return flag indicating, if the cursor is inside a double quoted string (boolean) @@ -183,7 +185,8 @@ def __inSingleQuotedString(self): """ - Private method to check, if the cursor is within a single quoted string. + Private method to check, if the cursor is within a single quoted + string. @return flag indicating, if the cursor is inside a single quoted string (boolean) @@ -194,7 +197,8 @@ """ Private method to check, if the cursor is within a here document. - @return flag indicating, if the cursor is inside a here document (boolean) + @return flag indicating, if the cursor is inside a here document + (boolean) """ return self.editor.currentStyle() == QsciLexerRuby.HereDocument @@ -202,6 +206,7 @@ """ Private method to check, if the cursor is within an inline document. - @return flag indicating, if the cursor is inside an inline document (boolean) + @return flag indicating, if the cursor is inside an inline document + (boolean) """ return self.editor.currentStyle() == QsciLexerRuby.POD