Wed, 25 Sep 2019 18:37:35 +0200
Continued to resolve code style issue M841.
--- a/eric6/QScintilla/APIsManager.py Wed Sep 25 18:25:43 2019 +0200 +++ b/eric6/QScintilla/APIsManager.py Wed Sep 25 18:37:35 2019 +0200 @@ -80,22 +80,28 @@ """ 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(self.__preparedName()) 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() @@ -105,8 +111,10 @@ @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 @@ -168,8 +176,10 @@ if self.__apifiles != apifiles: needsPreparation = True for apifile in apifiles: - if QFileInfo(apifile).lastModified() > \ - preparedAPIsTime: + if ( + QFileInfo(apifile).lastModified() > + preparedAPIsTime + ): needsPreparation = True break @@ -288,8 +298,8 @@ except KeyError: if language in Lexers.getSupportedApiLanguages(): # create the api object - self.__apis[(language, projectType)] = \ - APIs(language, projectType=projectType) + self.__apis[(language, projectType)] = APIs( + language, projectType=projectType) return self.__apis[(language, projectType)] else: return None
--- a/eric6/QScintilla/Editor.py Wed Sep 25 18:25:43 2019 +0200 +++ b/eric6/QScintilla/Editor.py Wed Sep 25 18:37:35 2019 +0200 @@ -12,11 +12,14 @@ import re import difflib -from PyQt5.QtCore import QDir, QTimer, QModelIndex, QFileInfo, pyqtSignal, \ - pyqtSlot, QCryptographicHash, QEvent, QDateTime, QRegExp, Qt, QPoint +from PyQt5.QtCore import ( + QDir, QTimer, QModelIndex, QFileInfo, pyqtSignal, pyqtSlot, + QCryptographicHash, QEvent, QDateTime, QRegExp, Qt, QPoint +) from PyQt5.QtGui import QCursor, QPalette, QFont, QPixmap, QPainter -from PyQt5.QtWidgets import QLineEdit, QActionGroup, QDialog, QInputDialog, \ - QApplication, QMenu +from PyQt5.QtWidgets import ( + QLineEdit, QActionGroup, QDialog, QInputDialog, QApplication, QMenu +) from PyQt5.QtPrintSupport import QPrinter, QPrintDialog, QAbstractPrintDialog from PyQt5.Qsci import QsciScintilla, QsciMacro, QsciStyledText @@ -309,14 +312,18 @@ self.errorline = self.markerDefine( UI.PixmapCache.getPixmap("errorLineMarker.png")) - self.breakpointMask = (1 << self.breakpoint) | \ - (1 << self.cbreakpoint) | \ - (1 << self.tbreakpoint) | \ - (1 << self.tcbreakpoint) | \ - (1 << self.dbreakpoint) - - self.changeMarkersMask = (1 << self.__changeMarkerSaved) | \ - (1 << self.__changeMarkerUnsaved) + self.breakpointMask = ( + (1 << self.breakpoint) | + (1 << self.cbreakpoint) | + (1 << self.tbreakpoint) | + (1 << self.tcbreakpoint) | + (1 << self.dbreakpoint) + ) + + self.changeMarkersMask = ( + (1 << self.__changeMarkerSaved) | + (1 << self.__changeMarkerUnsaved) + ) self.__markerMap = EditorMarkerMap(self) @@ -346,8 +353,10 @@ self.isResourcesFile = False if editor is None: if self.fileName: - if (QFileInfo(self.fileName).size() // 1024) > \ - Preferences.getEditor("WarnFilesize"): + if ( + (QFileInfo(self.fileName).size() // 1024) > + Preferences.getEditor("WarnFilesize") + ): res = E5MessageBox.yesNo( self, self.tr("Open File"), @@ -504,9 +513,11 @@ # initialize the online change trace timer self.__initOnlineChangeTrace() - if self.fileName and \ - self.project.isOpen() and \ - self.project.isProjectSource(self.fileName): + if ( + self.fileName and + self.project.isOpen() and + self.project.isProjectSource(self.fileName) + ): self.project.projectPropertiesChanged.connect( self.__projectPropertiesChanged) @@ -1011,8 +1022,9 @@ languages = sorted(list(supportedLanguages.keys())) for language in languages: if language != "Guessed": - self.supportedLanguages[language] = \ + self.supportedLanguages[language] = ( supportedLanguages[language][:2] + ) act = menu.addAction( UI.PixmapCache.getIcon(supportedLanguages[language][2]), self.supportedLanguages[language][0]) @@ -1168,10 +1180,11 @@ self.__menuToggleBreakpointEnabled) self.marginMenuActs["NextBreakpoint"] = self.bpMarginMenu.addAction( self.tr('Next breakpoint'), self.menuNextBreakpoint) - self.marginMenuActs["PreviousBreakpoint"] = \ + self.marginMenuActs["PreviousBreakpoint"] = ( self.bpMarginMenu.addAction( self.tr('Previous breakpoint'), self.menuPreviousBreakpoint) + ) self.marginMenuActs["ClearBreakpoint"] = self.bpMarginMenu.addAction( self.tr('Clear all breakpoints'), self.__menuClearBreakpoints) @@ -1181,32 +1194,38 @@ # fold margin self.foldMarginMenu = QMenu() - self.marginMenuActs["ToggleAllFolds"] = \ + self.marginMenuActs["ToggleAllFolds"] = ( self.foldMarginMenu.addAction( self.tr("Toggle all folds"), self.foldAll) - self.marginMenuActs["ToggleAllFoldsAndChildren"] = \ + ) + self.marginMenuActs["ToggleAllFoldsAndChildren"] = ( self.foldMarginMenu.addAction( self.tr("Toggle all folds (including children)"), lambda: self.foldAll(True)) - self.marginMenuActs["ToggleCurrentFold"] = \ + ) + self.marginMenuActs["ToggleCurrentFold"] = ( self.foldMarginMenu.addAction( self.tr("Toggle current fold"), self.toggleCurrentFold) + ) self.foldMarginMenu.addSeparator() - self.marginMenuActs["ExpandChildren"] = \ + self.marginMenuActs["ExpandChildren"] = ( self.foldMarginMenu.addAction( self.tr("Expand (including children)"), self.__contextMenuExpandFoldWithChildren) - self.marginMenuActs["CollapseChildren"] = \ + ) + self.marginMenuActs["CollapseChildren"] = ( self.foldMarginMenu.addAction( self.tr("Collapse (including children)"), self.__contextMenuCollapseFoldWithChildren) + ) self.foldMarginMenu.addSeparator() - self.marginMenuActs["ClearAllFolds"] = \ + self.marginMenuActs["ClearAllFolds"] = ( self.foldMarginMenu.addAction( self.tr("Clear all folds"), self.clearFolds) + ) self.foldMarginMenu.aboutToShow.connect( lambda: self.__showContextMenuMargin(self.foldMarginMenu)) @@ -1214,53 +1233,67 @@ # indicator margin self.indicMarginMenu = QMenu() - self.marginMenuActs["GotoSyntaxError"] = \ + self.marginMenuActs["GotoSyntaxError"] = ( self.indicMarginMenu.addAction( self.tr('Goto syntax error'), self.gotoSyntaxError) - self.marginMenuActs["ShowSyntaxError"] = \ + ) + self.marginMenuActs["ShowSyntaxError"] = ( self.indicMarginMenu.addAction( self.tr('Show syntax error message'), self.__showSyntaxError) - self.marginMenuActs["ClearSyntaxError"] = \ + ) + self.marginMenuActs["ClearSyntaxError"] = ( self.indicMarginMenu.addAction( self.tr('Clear syntax error'), self.clearSyntaxError) + ) self.indicMarginMenu.addSeparator() - self.marginMenuActs["NextWarningMarker"] = \ + self.marginMenuActs["NextWarningMarker"] = ( self.indicMarginMenu.addAction( self.tr("Next warning"), self.nextWarning) - self.marginMenuActs["PreviousWarningMarker"] = \ + ) + self.marginMenuActs["PreviousWarningMarker"] = ( self.indicMarginMenu.addAction( self.tr("Previous warning"), self.previousWarning) - self.marginMenuActs["ShowWarning"] = \ + ) + self.marginMenuActs["ShowWarning"] = ( self.indicMarginMenu.addAction( self.tr('Show warning message'), self.__showWarning) - self.marginMenuActs["ClearWarnings"] = \ + ) + self.marginMenuActs["ClearWarnings"] = ( self.indicMarginMenu.addAction( self.tr('Clear warnings'), self.clearWarnings) + ) self.indicMarginMenu.addSeparator() - self.marginMenuActs["NextCoverageMarker"] = \ + self.marginMenuActs["NextCoverageMarker"] = ( self.indicMarginMenu.addAction( self.tr('Next uncovered line'), self.nextUncovered) - self.marginMenuActs["PreviousCoverageMarker"] = \ + ) + self.marginMenuActs["PreviousCoverageMarker"] = ( self.indicMarginMenu.addAction( self.tr('Previous uncovered line'), self.previousUncovered) + ) self.indicMarginMenu.addSeparator() - self.marginMenuActs["NextTaskMarker"] = \ + self.marginMenuActs["NextTaskMarker"] = ( self.indicMarginMenu.addAction( self.tr('Next task'), self.nextTask) - self.marginMenuActs["PreviousTaskMarker"] = \ + ) + self.marginMenuActs["PreviousTaskMarker"] = ( self.indicMarginMenu.addAction( self.tr('Previous task'), self.previousTask) + ) self.indicMarginMenu.addSeparator() - self.marginMenuActs["NextChangeMarker"] = \ + self.marginMenuActs["NextChangeMarker"] = ( self.indicMarginMenu.addAction( self.tr('Next change'), self.nextChange) - self.marginMenuActs["PreviousChangeMarker"] = \ + ) + self.marginMenuActs["PreviousChangeMarker"] = ( self.indicMarginMenu.addAction( self.tr('Previous change'), self.previousChange) - self.marginMenuActs["ClearChangeMarkers"] = \ + ) + self.marginMenuActs["ClearChangeMarkers"] = ( self.indicMarginMenu.addAction( self.tr('Clear changes'), self.__reinitOnlineChangeTrace) + ) self.indicMarginMenu.aboutToShow.connect( lambda: self.__showContextMenuMargin(self.indicMarginMenu)) @@ -1386,8 +1419,11 @@ @keyparam propagate flag indicating to propagate the change (boolean) """ - if self.lexer_ is not None and \ - (self.lexer_.lexer() == "container" or self.lexer_.lexer() is None): + if ( + self.lexer_ is not None and + (self.lexer_.lexer() == "container" or + self.lexer_.lexer() is None) + ): self.SCN_STYLENEEDED.disconnect(self.__styleNeeded) self.apiLanguage = "" @@ -1487,8 +1523,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 @@ -1516,9 +1552,12 @@ """ if not encoding: encoding = self.encoding - return encoding.replace("-default", "")\ - .replace("-guessed", "")\ - .replace("-selected", "") + return ( + encoding + .replace("-default", "") + .replace("-guessed", "") + .replace("-selected", "") + ) def __showContextMenuEol(self): """ @@ -1565,16 +1604,21 @@ language (string) @keyparam pyname name of the pygments lexer to use (string) """ - if self.lexer_ is not None and \ - (self.lexer_.lexer() == "container" or self.lexer_.lexer() is None): + if ( + self.lexer_ is not None and + (self.lexer_.lexer() == "container" or + self.lexer_.lexer() is None) + ): self.SCN_STYLENEEDED.disconnect(self.__styleNeeded) language = "" if not self.filetype: if filename: basename = os.path.basename(filename) - if self.project.isOpen() and \ - self.project.isProjectFile(filename): + if ( + self.project.isOpen() and + self.project.isProjectFile(filename) + ): language = self.project.getEditorLexerAssoc(basename) if not language: language = Preferences.getEditorLexerAssoc(basename) @@ -1682,8 +1726,10 @@ 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 @@ -1931,14 +1977,18 @@ if self.filetype == "": line0 = self.text(0) - if line0.startswith("#!") and \ - "ruby" in line0: + if ( + line0.startswith("#!") and + "ruby" in line0 + ): self.filetype = "Ruby" return True - if bool(self.fileName) and \ - os.path.splitext(self.fileName)[1] in \ - self.dbs.getExtensions('Ruby'): + if ( + bool(self.fileName) and + os.path.splitext(self.fileName)[1] in + self.dbs.getExtensions('Ruby') + ): self.filetype = "Ruby" return True @@ -1954,8 +2004,10 @@ return True if self.filetype == "": - if self.fileName and \ - os.path.splitext(self.fileName)[1] == ".js": + if ( + self.fileName and + os.path.splitext(self.fileName)[1] == ".js" + ): self.filetype = "JavaScript" return True @@ -2032,12 +2084,15 @@ @param annotationLinesAdded number of added/deleted annotation lines (integer) """ - if mtype & (self.SC_MOD_INSERTTEXT | self.SC_MOD_DELETETEXT) and \ - linesAdded != 0: + 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)) @@ -2109,8 +2164,9 @@ """ for row in range(start, end + 1): index = self.breakpointModel.index(row, 0, parentIndex) - fn, line, cond, temp, enabled, ignorecount = \ + fn, line, cond, temp, enabled, ignorecount = ( self.breakpointModel.getBreakPointByIndex(index)[:6] + ) if fn == self.fileName: self.newBreakpointWithProperties( line, (cond, temp, enabled, ignorecount)) @@ -2171,9 +2227,11 @@ # delete breakpoint or toggle it to the next state index = self.breakpointModel.getBreakPointIndex( self.fileName, line) - if Preferences.getDebugger("ThreeStateBreakPoints") and \ - not self.breakpointModel.isBreakPointTemporaryByIndex( - index): + if ( + Preferences.getDebugger("ThreeStateBreakPoints") and + not self.breakpointModel.isBreakPointTemporaryByIndex( + index) + ): self.breakpointModel.deleteBreakPointByIndex(index) self.__addBreakPoint(line, True) else: @@ -2947,10 +3005,12 @@ modified = False - if (not self.__getEditorConfig("TabForIndentation")) and \ - Preferences.getEditor("ConvertTabsOnLoad") and \ - not (self.lexer_ and - self.lexer_.alwaysKeepTabs()): + if ( + (not self.__getEditorConfig("TabForIndentation")) and + Preferences.getEditor("ConvertTabsOnLoad") and + not (self.lexer_ and + self.lexer_.alwaysKeepTabs()) + ): txtExpanded = txt.expandtabs(self.__getEditorConfig("TabWidth")) if txtExpanded != txt: modified = True @@ -2962,8 +3022,10 @@ self.__processFlags() # perform automatic EOL conversion - if self.__getEditorConfig("EOLMode", nodefault=True) or \ - Preferences.getEditor("AutomaticEOLConversion"): + if ( + self.__getEditorConfig("EOLMode", nodefault=True) or + Preferences.getEditor("AutomaticEOLConversion") + ): self.convertEols(self.eolMode()) else: fileEol = self.detectEolString(txt) @@ -3067,8 +3129,10 @@ """ # save to project, if a project is loaded if self.project.isOpen(): - if self.fileName and \ - self.project.startswithProjectPath(self.fileName): + if ( + self.fileName and + self.project.startswithProjectPath(self.fileName) + ): path = os.path.dirname(self.fileName) else: path = self.project.getProjectPath() @@ -3076,8 +3140,10 @@ if not path and self.fileName: path = os.path.dirname(self.fileName) if not path: - path = Preferences.getMultiProject("Workspace") or \ + path = ( + Preferences.getMultiProject("Workspace") or Utilities.getHomeDir() + ) from . import Lexers if self.fileName: @@ -3135,8 +3201,10 @@ res = self.writeFile(fn) if res: # 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(fn) return res @@ -3163,8 +3231,10 @@ newName = fn # 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) + ): editorConfigEol = self.__getEditorConfig( "EOLMode", nodefault=True, config=self.__loadEditorConfigObject(fn)) @@ -3196,8 +3266,10 @@ 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(fn) self.addedToProject() @@ -3622,9 +3694,11 @@ # 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): + if ( + self.hasSelectedText() and + 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 @@ -3632,14 +3706,18 @@ else: # determine the start of the comment block begline = line - while begline > 0 and \ - self.__isCommentedLine(self.text(begline - 1), commentStr): + while ( + begline > 0 and + self.__isCommentedLine(self.text(begline - 1), commentStr) + ): begline -= 1 # determine the end of the comment block endline = line lines = self.lines() - while endline < lines and \ - self.__isCommentedLine(self.text(endline + 1), commentStr): + while ( + endline < lines and + self.__isCommentedLine(self.text(endline + 1), commentStr) + ): endline += 1 self.setSelection(begline, 0, endline, self.lineLength(endline)) @@ -4268,23 +4346,27 @@ self.setMarginSensitivity(self.__bmMargin, True) self.setMarginMarkerMask(self.__bmMargin, marginBmMask) - marginBpMask = (1 << self.breakpoint) | \ - (1 << self.cbreakpoint) | \ - (1 << self.tbreakpoint) | \ - (1 << self.tcbreakpoint) | \ - (1 << self.dbreakpoint) + marginBpMask = ( + (1 << self.breakpoint) | + (1 << self.cbreakpoint) | + (1 << self.tbreakpoint) | + (1 << self.tcbreakpoint) | + (1 << self.dbreakpoint) + ) self.setMarginWidth(self.__bpMargin, 16) self.setMarginSensitivity(self.__bpMargin, True) self.setMarginMarkerMask(self.__bpMargin, marginBpMask) - marginIndicMask = (1 << self.syntaxerror) | \ - (1 << self.notcovered) | \ - (1 << self.taskmarker) | \ - (1 << self.warning) | \ - (1 << self.__changeMarkerUnsaved) | \ - (1 << self.__changeMarkerSaved) | \ - (1 << self.currentline) | \ - (1 << self.errorline) + marginIndicMask = ( + (1 << self.syntaxerror) | + (1 << self.notcovered) | + (1 << self.taskmarker) | + (1 << self.warning) | + (1 << self.__changeMarkerUnsaved) | + (1 << self.__changeMarkerSaved) | + (1 << self.currentline) | + (1 << self.errorline) + ) self.setMarginWidth(self.__indicMargin, 16) self.setMarginSensitivity(self.__indicMargin, True) self.setMarginMarkerMask(self.__indicMargin, marginIndicMask) @@ -4426,9 +4508,11 @@ self.indicatorDefine( self.searchIndicator, QsciScintilla.INDIC_BOX, Preferences.getEditorColour("SearchMarkers")) - if not Preferences.getEditor("SearchMarkersEnabled") and \ - not Preferences.getEditor("QuickSearchMarkersEnabled") and \ - not Preferences.getEditor("MarkOccurrencesEnabled"): + if ( + not Preferences.getEditor("SearchMarkersEnabled") and + not Preferences.getEditor("QuickSearchMarkersEnabled") and + not Preferences.getEditor("MarkOccurrencesEnabled") + ): self.clearAllIndicators(self.searchIndicator) self.spellingIndicator = QsciScintilla.INDIC_CONTAINER + 1 @@ -4466,9 +4550,11 @@ """ Private method to configure the eol mode of the editor. """ - if self.fileName and \ - self.project.isOpen() and \ - self.project.isProjectFile(self.fileName): + if ( + self.fileName and + self.project.isOpen() and + self.project.isProjectFile(self.fileName) + ): eolMode = self.__getEditorConfig("EOLMode", nodefault=True) if eolMode is None: eolStr = self.project.getEolString() @@ -4527,8 +4613,9 @@ if Preferences.getEditor("CallTipsEnabled"): if calltipsStyle == QsciScintilla.CallTipsNoContext: self.setCallTipsStyle(QsciScintilla.CallTipsNoContext) - elif calltipsStyle == \ - QsciScintilla.CallTipsNoAutoCompletionContext: + elif ( + calltipsStyle == QsciScintilla.CallTipsNoAutoCompletionContext + ): self.setCallTipsStyle( QsciScintilla.CallTipsNoAutoCompletionContext) else: @@ -4580,8 +4667,8 @@ (boolean) """ if enable: - autoCompletionSource = \ - Preferences.getEditor("AutoCompletionSource") + autoCompletionSource = Preferences.getEditor( + "AutoCompletionSource") if autoCompletionSource == QsciScintilla.AcsDocument: self.setAutoCompletionSource(QsciScintilla.AcsDocument) elif autoCompletionSource == QsciScintilla.AcsAPIs: @@ -4610,8 +4697,10 @@ """ char = chr(charNumber) # update code documentation viewer - if char == "(" and \ - Preferences.getDocuViewer("ShowInfoOnOpenParenthesis"): + if ( + char == "(" and + Preferences.getDocuViewer("ShowInfoOnOpenParenthesis") + ): self.vm.showEditorInfo(self) if self.isListActive(): @@ -4624,8 +4713,10 @@ else: self.__acTimer.stop() - if self.callTipsStyle() != QsciScintilla.CallTipsNone and \ - self.lexer_ is not None and chr(charNumber) in '()': + if ( + self.callTipsStyle() != QsciScintilla.CallTipsNone and + self.lexer_ is not None and chr(charNumber) in '()' + ): self.callTip() if not self.isCallTipActive(): @@ -4686,8 +4777,10 @@ @param asynchroneous flag indicating an asynchroneous function @type bool """ - if key in self.__completionListHookFunctions or \ - key in self.__completionListAsyncHookFunctions: + if ( + key in self.__completionListHookFunctions or + key in self.__completionListAsyncHookFunctions + ): # it was already registered E5MessageBox.warning( self, @@ -4742,8 +4835,10 @@ if self.isListActive(): self.cancelList() - if self.__completionListHookFunctions or \ - self.__completionListAsyncHookFunctions: + if ( + self.__completionListHookFunctions or + self.__completionListAsyncHookFunctions + ): # Avoid delayed auto-completion after cursor repositioning self.__acText = self.__getAcText() if auto and Preferences.getEditor("AutoCompletionTimeout"): @@ -4846,8 +4941,10 @@ self.__acWatchdog.stop() # Autocomplete with QScintilla if no results present - if Preferences.getEditor("AutoCompletionScintillaOnFail") and \ - not self.__acCompletions: + if ( + Preferences.getEditor("AutoCompletionScintillaOnFail") and + not self.__acCompletions + ): self.autoCompleteQScintilla() return @@ -5169,9 +5266,12 @@ evt.accept() if self.__marginNumber(evt.x()) == -1: self.spellingMenuPos = self.positionFromPoint(evt.pos()) - if self.spellingMenuPos >= 0 and \ - self.spell is not None and \ - self.hasIndicator(self.spellingIndicator, self.spellingMenuPos): + if ( + self.spellingMenuPos >= 0 and + self.spell is not None and + self.hasIndicator(self.spellingIndicator, + self.spellingMenuPos) + ): self.spellingMenu.popup(evt.globalPos()) else: self.menu.popup(evt.globalPos()) @@ -5208,8 +5308,10 @@ self.menuActs["Show"].setEnabled(True) else: self.menuActs["Show"].setEnabled(False) - if self.fileName and \ - (self.isPyFile() or self.isRubyFile()): + if ( + self.fileName and + (self.isPyFile() or self.isRubyFile()) + ): self.menuActs["Diagrams"].setEnabled(True) else: self.menuActs["Diagrams"].setEnabled(False) @@ -5289,22 +5391,27 @@ 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) basename = os.path.splitext(fn)[0] tbasename = os.path.splitext(tfn)[0] - prEnable = prEnable or \ - os.path.isfile("{0}.profile".format(basename)) or \ + prEnable = ( + prEnable or + os.path.isfile("{0}.profile".format(basename)) or os.path.isfile("{0}.profile".format(tbasename)) + ) coEnable = ( - coEnable or - os.path.isfile("{0}.coverage".format(basename)) or - os.path.isfile("{0}.coverage".format(tbasename))) and \ + (coEnable or + os.path.isfile("{0}.coverage".format(basename)) or + os.path.isfile("{0}.coverage".format(tbasename))) and (self.project.isPy3Project() or - self.project.isPy2Project()) + self.project.isPy2Project()) + ) # now check ourselves fn = self.getFileName() @@ -5312,14 +5419,17 @@ tfn = Utilities.getTestFileName(fn) basename = os.path.splitext(fn)[0] tbasename = os.path.splitext(tfn)[0] - prEnable = prEnable or \ - os.path.isfile("{0}.profile".format(basename)) or \ + prEnable = ( + prEnable or + os.path.isfile("{0}.profile".format(basename)) or os.path.isfile("{0}.profile".format(tbasename)) + ) coEnable = ( - coEnable or - os.path.isfile("{0}.coverage".format(basename)) or - os.path.isfile("{0}.coverage".format(tbasename))) and \ + (coEnable or + os.path.isfile("{0}.coverage".format(basename)) or + os.path.isfile("{0}.coverage".format(tbasename))) and self.isPyFile() + ) # now check for syntax errors if self.hasSyntaxErrors(): @@ -5339,8 +5449,10 @@ Private slot handling the aboutToShow signal of the diagrams context menu. """ - if self.project.isOpen() and \ - self.project.isProjectSource(self.fileName): + if ( + self.project.isOpen() and + self.project.isProjectSource(self.fileName) + ): self.applicationDiagramMenuAct.setEnabled(True) else: self.applicationDiagramMenuAct.setEnabled(False) @@ -5403,8 +5515,10 @@ self.marginMenuActs["GotoSyntaxError"].setEnabled(hasSyntaxErrors) self.marginMenuActs["ClearSyntaxError"].setEnabled(hasSyntaxErrors) - if hasSyntaxErrors and \ - self.markersAtLine(self.line) & (1 << self.syntaxerror): + if ( + hasSyntaxErrors and + self.markersAtLine(self.line) & (1 << self.syntaxerror) + ): self.marginMenuActs["ShowSyntaxError"].setEnabled(True) else: self.marginMenuActs["ShowSyntaxError"].setEnabled(False) @@ -5413,8 +5527,10 @@ self.marginMenuActs["PreviousWarningMarker"].setEnabled( hasWarnings) self.marginMenuActs["ClearWarnings"].setEnabled(hasWarnings) - if hasWarnings and \ - self.markersAtLine(self.line) & (1 << self.warning): + if ( + hasWarnings and + self.markersAtLine(self.line) & (1 << self.warning) + ): self.marginMenuActs["ShowWarning"].setEnabled(True) else: self.marginMenuActs["ShowWarning"].setEnabled(False) @@ -5538,8 +5654,10 @@ if line1Text in ["", "\r", "\n", "\r\n"]: return - if line0Text.rstrip("\r\n\\ \t").endswith(("'", '"')) and \ - line1Text.lstrip().startswith(("'", '"')): + if ( + line0Text.rstrip("\r\n\\ \t").endswith(("'", '"')) and + line1Text.lstrip().startswith(("'", '"')) + ): # merging multi line strings startChars = "\r\n\\ \t'\"" endChars = " \t'\"" @@ -5594,9 +5712,11 @@ @return flag indicating this editor should be saved (boolean) """ - return bool(self.fileName) and \ - not self.autosaveManuallyDisabled and \ + return ( + bool(self.fileName) and + not self.autosaveManuallyDisabled and not self.isReadOnly() + ) def checkSyntax(self): """ @@ -5607,8 +5727,10 @@ # adjustment for MicroPython fileType = "Python3" - if self.syntaxCheckService is None or \ - fileType not in self.syntaxCheckService.getLanguages(): + if ( + self.syntaxCheckService is None or + fileType not in self.syntaxCheckService.getLanguages() + ): return if Preferences.getEditor("AutoCheckSyntax"): @@ -5709,8 +5831,10 @@ # 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) @@ -5887,8 +6011,10 @@ # 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) @@ -5981,8 +6107,10 @@ self.syntaxerrorToggled.emit(self) else: for handle in list(self.syntaxerrors.keys()): - if self.markerLine(handle) == line - 1 and \ - (msg, index) not in self.syntaxerrors[handle]: + if ( + self.markerLine(handle) == line - 1 and + (msg, index) not in self.syntaxerrors[handle] + ): self.syntaxerrors[handle].append((msg, index)) if show: self.setCursorPosition(line - 1, index) @@ -6136,8 +6264,10 @@ self.syntaxerrorToggled.emit(self) else: for handle in list(self.warnings.keys()): - if self.markerLine(handle) == line - 1 and \ - warn not in self.warnings[handle]: + if ( + self.markerLine(handle) == line - 1 and + warn not in self.warnings[handle] + ): self.warnings[handle].append(warn) else: for handle in list(self.warnings.keys()): @@ -6304,8 +6434,9 @@ Private slot to define the style used by inline annotations. """ if hasattr(QsciScintilla, "annotate"): - self.annotationWarningStyle = \ + self.annotationWarningStyle = ( QsciScintilla.STYLE_LASTPREDEFINED + 1 + ) self.SendScintilla( QsciScintilla.SCI_STYLESETFORE, self.annotationWarningStyle, @@ -6395,8 +6526,10 @@ """ 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) @@ -6727,18 +6860,20 @@ except AttributeError: pass self.__updateReadOnly(False) - if self.vm.editorsCheckFocusInEnabled() and \ - not self.inReopenPrompt and self.fileName and \ - QFileInfo(self.fileName).lastModified().toString() != \ - self.lastModified.toString(): + if ( + self.vm.editorsCheckFocusInEnabled() and + not self.inReopenPrompt and self.fileName and + QFileInfo(self.fileName).lastModified().toString() != + self.lastModified.toString() + ): self.inReopenPrompt = True if Preferences.getEditor("AutoReopen") and not self.isModified(): self.refresh() else: msg = self.tr( """<p>The file <b>{0}</b> has been changed while it""" - """ was opened in eric6. Reread it?</p>""")\ - .format(self.fileName) + """ was opened in eric6. Reread it?</p>""" + ).format(self.fileName) yesDefault = True if self.isModified(): msg += self.tr( @@ -6785,8 +6920,10 @@ @param evt the event, that was generated (QEvent) """ - if evt.type() == QEvent.WindowStateChange and \ - bool(self.fileName): + if ( + evt.type() == QEvent.WindowStateChange and + bool(self.fileName) + ): if self.windowState() == Qt.WindowStates(Qt.WindowMinimized): cap = os.path.basename(self.fileName) else: @@ -6900,8 +7037,10 @@ if self.fileName == "": return - readOnly = not QFileInfo(self.fileName).isWritable() or \ + readOnly = ( + not QFileInfo(self.fileName).isWritable() or self.isReadOnly() + ) if not bForce and (readOnly == self.isReadOnly()): return @@ -7205,8 +7344,10 @@ if not self.checkDirty(): return - package = os.path.isdir(self.fileName) and \ + package = ( + os.path.isdir(self.fileName) and self.fileName or os.path.dirname(self.fileName) + ) res = E5MessageBox.yesNo( self, self.tr("Package Diagram"), @@ -7225,8 +7366,10 @@ 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.tr("Imports Diagram"), @@ -7372,8 +7515,10 @@ """ Public slot to handle the opening of a project. """ - if self.fileName and \ - self.project.isProjectSource(self.fileName): + if ( + self.fileName and + self.project.isProjectSource(self.fileName) + ): self.project.projectPropertiesChanged.connect( self.__projectPropertiesChanged) self.setSpellingForProject() @@ -7429,9 +7574,11 @@ Public method to set the spell checking options for files belonging to the current project. """ - if self.fileName and \ - self.project.isOpen() and \ - self.project.isProjectSource(self.fileName): + if ( + self.fileName and + self.project.isOpen() and + self.project.isProjectSource(self.fileName) + ): pwl, pel = self.project.getProjectDictionaries() self.__setSpellingLanguage(self.project.getProjectSpellLanguage(), pwl=pwl, pel=pel) @@ -7465,8 +7612,10 @@ if self.__spellCheckStringsOnly: style = self.styleAt(pos) if self.lexer_ is not None: - return self.lexer_.isCommentStyle(style) or \ + return ( + self.lexer_.isCommentStyle(style) or self.lexer_.isStringStyle(style) + ) return True @pyqtSlot(int) @@ -7611,10 +7760,14 @@ and if it is inside a remotely initiated shared edit session (boolean, boolean, boolean, boolean) """ - return bool(self.fileName) and \ - self.project.isOpen() and \ - self.project.isProjectFile(self.fileName), \ - self.__isShared, self.__inSharedEdit, self.__inRemoteSharedEdit + return ( + (bool(self.fileName) and + self.project.isOpen() and + self.project.isProjectFile(self.fileName)), + self.__isShared, + self.__inSharedEdit, + self.__inRemoteSharedEdit + ) def shareConnected(self, connected): """ @@ -7707,8 +7860,10 @@ @param command command string (string) """ if self.__isShared: - if self.__isSyncing and \ - not command.startswith(Editor.SyncToken + Editor.Separator): + if ( + self.__isSyncing and + not command.startswith(Editor.SyncToken + Editor.Separator) + ): self.__receivedWhileSyncing.append(command) else: self.__dispatchCommand(command) @@ -7929,8 +8084,9 @@ dlg = SortOptionsDialog() if dlg.exec_() == QDialog.Accepted: ascending, alnum, caseSensitive = dlg.getData() - origStartLine, origStartIndex, origEndLine, origEndIndex = \ + origStartLine, origStartIndex, origEndLine, origEndIndex = ( self.getRectangularSelection() + ) # convert to upper-left to lower-right startLine = min(origStartLine, origEndLine) startIndex = min(origStartIndex, origEndIndex) @@ -8011,9 +8167,11 @@ self.vm.eventFilter(self, evt) super(Editor, self).mouseReleaseEvent(evt) - if button != Qt.NoButton and \ - Preferences.getEditor("MouseClickHandlersEnabled") and \ - key in self.__mouseClickHandlers: + if ( + button != Qt.NoButton and + Preferences.getEditor("MouseClickHandlersEnabled") and + key in self.__mouseClickHandlers + ): evt.accept() self.__mouseClickHandlers[key][1](self)
--- a/eric6/QScintilla/EditorAssembly.py Wed Sep 25 18:25:43 2019 +0200 +++ b/eric6/QScintilla/EditorAssembly.py Wed Sep 25 18:37:35 2019 +0200 @@ -138,8 +138,9 @@ itm = items[key] self.__membersCombo.addItem(itm[0], key, itm[1]) memberIndex += 1 - self.__membersBoundaries[(itm[1], itm[2])] = \ + self.__membersBoundaries[(itm[1], itm[2])] = ( memberIndex + ) else: return
--- a/eric6/QScintilla/EditorButtonsWidget.py Wed Sep 25 18:25:43 2019 +0200 +++ b/eric6/QScintilla/EditorButtonsWidget.py Wed Sep 25 18:37:35 2019 +0200 @@ -10,8 +10,9 @@ from PyQt5.QtCore import pyqtSlot, Qt -from PyQt5.QtWidgets import QWidget, QVBoxLayout, QToolButton, QFrame, QMenu, \ - QSizePolicy, QScrollArea +from PyQt5.QtWidgets import ( + QWidget, QVBoxLayout, QToolButton, QFrame, QMenu, QSizePolicy, QScrollArea +) import UI.PixmapCache import Preferences @@ -253,8 +254,10 @@ Private slot to change the button states. """ provider = MarkupProviders.getMarkupProvider(self.__editor) - if self.__provider is None or \ - provider.kind() != self.__provider.kind(): + if ( + self.__provider is None or + provider.kind() != self.__provider.kind() + ): self.__provider = provider self.__buttons["bold"].setEnabled(self.__provider.hasBold())
--- a/eric6/QScintilla/Exporters/ExporterHTML.py Wed Sep 25 18:25:43 2019 +0200 +++ b/eric6/QScintilla/Exporters/ExporterHTML.py Wed Sep 25 18:37:35 2019 +0200 @@ -72,50 +72,54 @@ styleIsUsed[index] = True styleIsUsed[QsciScintilla.STYLE_DEFAULT] = True - html = \ - '''<!DOCTYPE html PUBLIC "-//W3C//DTD''' \ - ''' XHTML 1.0 Transitional//EN"\n''' \ - ''' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">''' \ - '''\n''' \ - '''<html xmlns="http://www.w3.org/1999/xhtml">\n''' \ + html = ( + '''<!DOCTYPE html PUBLIC "-//W3C//DTD''' + ''' XHTML 1.0 Transitional//EN"\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()) else: html += '''<title>{0}</title>\n'''.format( os.path.basename(self.editor.getFileName())) - html += '''<meta name="Generator" content="eric6" />\n''' \ - '''<meta http-equiv="Content-Type" ''' \ + html += ( + '''<meta name="Generator" content="eric6" />\n''' + '''<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''' \ + 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: @@ -127,11 +131,15 @@ if lex: istyle = 0 while istyle <= QsciScintilla.STYLE_MAX: - if (istyle <= QsciScintilla.STYLE_DEFAULT or - istyle > QsciScintilla.STYLE_LASTPREDEFINED) and \ - styleIsUsed[istyle]: - if lex.description(istyle) or \ - istyle == QsciScintilla.STYLE_DEFAULT: + if ( + (istyle <= QsciScintilla.STYLE_DEFAULT or + istyle > QsciScintilla.STYLE_LASTPREDEFINED) and + styleIsUsed[istyle] + ): + if ( + lex.description(istyle) or + istyle == QsciScintilla.STYLE_DEFAULT + ): font = lex.font(istyle) colour = lex.color(istyle) paper = lex.paper(istyle) @@ -147,8 +155,10 @@ html += ''' font-family: '{0}';\n'''.format( font.family()) html += ''' color: {0};\n'''.format(colour.name()) - if istyle != QsciScintilla.STYLE_DEFAULT and \ - bgColour != paper.name(): + if ( + istyle != QsciScintilla.STYLE_DEFAULT and + bgColour != paper.name() + ): html += ''' background: {0};\n'''.format( paper.name()) html += ''' text-decoration: inherit;\n''' @@ -195,10 +205,13 @@ html += '''<pre>''' if folding: - if self.editor.foldFlagsAt(line) & \ - QsciScintilla.SC_FOLDLEVELHEADERFLAG: - html += '''<span id="hd{0:d}" onclick="toggle('{1:d}')">'''\ - .format(line, line + 1) + if ( + self.editor.foldFlagsAt(line) & + QsciScintilla.SC_FOLDLEVELHEADERFLAG + ): + html += ( + '''<span id="hd{0:d}" onclick="toggle('{1:d}')">''' + ).format(line, line + 1) html += '''<span id="bt{0:d}">- </span>'''.format(line) inFoldSpan = True else: @@ -285,12 +298,14 @@ if newLevel > level: html += '''<span id="ln{0:d}">'''.format(line) levelStack.append(newLevel) - if self.editor.foldFlagsAt(line) & \ - QsciScintilla.SC_FOLDLEVELHEADERFLAG: - html += \ - '''<span id="hd{0:d}"''' \ - ''' onclick="toggle('{1:d}')">''' \ - .format(line, line + 1) + if ( + self.editor.foldFlagsAt(line) & + QsciScintilla.SC_FOLDLEVELHEADERFLAG + ): + html += ( + '''<span id="hd{0:d}"''' + ''' onclick="toggle('{1:d}')">''' + ).format(line, line + 1) html += '''<span id="bt{0:d}">- </span>'''.format(line) inFoldSpan = True else: @@ -299,8 +314,10 @@ else: html += '\n' - if styleIsUsed[styleCurrent] and \ - self.editor.byteAt(pos + 1) not in [b'\r', b'\n']: + if ( + styleIsUsed[styleCurrent] and + self.editor.byteAt(pos + 1) not in [b'\r', b'\n'] + ): # We know it's the correct next style, # but no (empty) span for an empty line html += '''<span class="S{0:0d}">'''.format(styleCurrent) @@ -385,14 +402,18 @@ else: extension = "" - if extension in \ - Preferences.getEditor("PreviewMarkdownFileNameExtensions") or \ - self.editor.getLanguage().lower() == "markdown": + if ( + extension in Preferences.getEditor( + "PreviewMarkdownFileNameExtensions") or + self.editor.getLanguage().lower() == "markdown" + ): # export markdown to HTML html = self.__generateFromMarkdown() - elif extension in \ - Preferences.getEditor("PreviewRestFileNameExtensions") or \ - self.editor.getLanguage().lower() == "restructuredtext": + elif ( + extension in Preferences.getEditor( + "PreviewRestFileNameExtensions") or + self.editor.getLanguage().lower() == "restructuredtext" + ): # export ReST to HTML html = self.__generateFromReSTDocutils() else: @@ -517,9 +538,11 @@ extensions = ['fenced_code', 'extra'] # version 2.0 supports only extension names, not instances - if markdown.version_info[0] > 2 or \ - (markdown.version_info[0] == 2 and - markdown.version_info[1] > 0): + if ( + markdown.version_info[0] > 2 or + (markdown.version_info[0] == 2 and + markdown.version_info[1] > 0) + ): class _StrikeThroughExtension(markdown.Extension): """ Class is placed here, because it depends on imported markdown, @@ -554,16 +577,18 @@ output_format=htmlFormat) if htmlFormat == "xhtml1": - head = \ - '''<!DOCTYPE html PUBLIC "-//W3C//DTD''' \ - ''' XHTML 1.0 Transitional//EN"\n''' \ - ''' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional''' \ - '''.dtd">\n''' \ + head = ( + '''<!DOCTYPE html PUBLIC "-//W3C//DTD''' + ''' XHTML 1.0 Transitional//EN"\n''' + ''' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional''' + '''.dtd">\n''' '''<html xmlns="http://www.w3.org/1999/xhtml">\n''' + ) elif htmlFormat == "html5": - head = \ - '''<!DOCTYPE html>\n''' \ + head = ( + '''<!DOCTYPE html>\n''' '''<html lang="EN">\n''' + ) else: head = '<html lang="EN">\n' head += '''<head>\n''' @@ -573,11 +598,13 @@ else: head += '''<title>{0}</title>\n'''.format( os.path.basename(self.editor.getFileName())) - head += '''<meta name="Generator" content="eric6" />\n''' \ - '''<meta http-equiv="Content-Type" ''' \ - '''content="text/html; charset=utf-8" />\n''' \ - '''</head>\n''' \ + head += ( + '''<meta name="Generator" content="eric6" />\n''' + '''<meta http-equiv="Content-Type" ''' + '''content="text/html; charset=utf-8" />\n''' + '''</head>\n''' '''<body>\n''' + ) foot = '''\n</body>\n</html>\n'''
--- a/eric6/QScintilla/Exporters/ExporterPDF.py Wed Sep 25 18:25:43 2019 +0200 +++ b/eric6/QScintilla/Exporters/ExporterPDF.py Wed Sep 25 18:37:35 2019 +0200 @@ -177,12 +177,18 @@ buf = "" if styleNext != self.styleCurrent or style_ == -1: - if self.style[self.styleCurrent].font != \ - self.style[styleNext].font 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].fore != + self.style[styleNext].fore) or + style_ == -1 + ): buf += "{0}rg ".format(self.style[styleNext].fore) return buf @@ -197,12 +203,18 @@ self.leading = self.fontSize * PDF_SPACING_DEFAULT # sanity check for page size and margins - pageWidthMin = int(self.leading) + \ - self.pageMargins["left"] + self.pageMargins["right"] + pageWidthMin = ( + int(self.leading) + + self.pageMargins["left"] + + self.pageMargins["right"] + ) if self.pageWidth < pageWidthMin: self.pageWidth = pageWidthMin - pageHeightMin = int(self.leading) + \ - self.pageMargins["top"] + self.pageMargins["bottom"] + pageHeightMin = ( + int(self.leading) + + self.pageMargins["top"] + + self.pageMargins["bottom"] + ) if self.pageHeight < pageHeightMin: self.pageHeight = pageHeightMin @@ -215,10 +227,12 @@ # *expected* to start from index 1 since they are the first objects # 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) + buffer = ( + "<</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 @@ -241,12 +255,15 @@ pageObjectStart = self.oT.index pagesRef = pageObjectStart + self.pageCount for i in range(self.pageCount): - buffer = "<</Type/Page/Parent {0:d} 0 R\n" \ - "/MediaBox[ 0 0 {1:d} {2:d}]\n" \ - "/Contents {3:d} 0 R\n" \ - "/Resources {4:d} 0 R\n>>\n".format( - pagesRef, self.pageWidth, self.pageHeight, - self.pageContentStart + i, resourceRef) + buffer = ( + "<</Type/Page/Parent {0:d} 0 R\n" + "/MediaBox[ 0 0 {1:d} {2:d}]\n" + "/Contents {3:d} 0 R\n" + "/Resources {4:d} 0 R\n>>\n" + ).format( + pagesRef, self.pageWidth, self.pageHeight, + self.pageContentStart + i, resourceRef + ) self.oT.add(buffer) # create page tree object (PDF1.4Ref(p86)) @@ -264,9 +281,10 @@ 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_): @@ -483,8 +501,10 @@ while istyle <= QsciScintilla.STYLE_MAX: if (istyle <= QsciScintilla.STYLE_DEFAULT or istyle > QsciScintilla.STYLE_LASTPREDEFINED): - if lex.description(istyle) or \ - istyle == QsciScintilla.STYLE_DEFAULT: + if ( + lex.description(istyle) or + istyle == QsciScintilla.STYLE_DEFAULT + ): style = PDFStyle() font = lex.font(istyle) @@ -558,8 +578,10 @@ 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()
--- a/eric6/QScintilla/Exporters/ExporterRTF.py Wed Sep 25 18:25:43 2019 +0200 +++ b/eric6/QScintilla/Exporters/ExporterRTF.py Wed Sep 25 18:37:35 2019 +0200 @@ -179,8 +179,10 @@ 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: @@ -190,18 +192,24 @@ font.family())) fontKey = fontCount fontCount += 1 - lastStyle = self.RTF_SETFONTFACE + \ + lastStyle = ( + self.RTF_SETFONTFACE + "{0:d}".format(fontKey) + ) else: lastStyle = self.RTF_SETFONTFACE + "0" if wysiwyg and QFontInfo(font).pointSize(): - lastStyle += self.RTF_SETFONTSIZE + \ + lastStyle += ( + self.RTF_SETFONTSIZE + "{0:d}".format( QFontInfo(font).pointSize() << 1) + ) else: - lastStyle += self.RTF_SETFONTSIZE + \ + lastStyle += ( + self.RTF_SETFONTSIZE + "{0:d}".format(fontsize) + ) sColour = lex.color(istyle) sColourKey = None @@ -213,8 +221,10 @@ colors[colorCount] = sColour sColourKey = colorCount colorCount += 1 - lastStyle += self.RTF_SETCOLOR + \ + lastStyle += ( + self.RTF_SETCOLOR + "{0:d}".format(sColourKey) + ) sColour = lex.paper(istyle) sColourKey = None @@ -226,8 +236,10 @@ colors[colorCount] = sColour sColourKey = colorCount colorCount += 1 - lastStyle += self.RTF_SETBACKGROUND + \ + lastStyle += ( + self.RTF_SETBACKGROUND + "{0:d}".format(sColourKey) + ) if font.bold(): lastStyle += self.RTF_BOLD_ON @@ -239,22 +251,27 @@ 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_SETCOLOR + "0" + \ - self.RTF_SETBACKGROUND + "1" + \ - self.RTF_BOLD_OFF + self.RTF_ITALIC_OFF + styles[0] = ( + 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 + ) f.write(self.RTF_FONTDEFCLOSE + self.RTF_COLORDEFOPEN) for value in list(colors.values()): @@ -268,11 +285,14 @@ self.RTF_BODYOPEN + self.RTF_SETFONTFACE + "0" + self.RTF_SETFONTSIZE + "{0:d}".format(fontsize) + self.RTF_SETCOLOR + "0 ") - lastStyle = 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 + lastStyle = ( + 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 + ) lengthDoc = self.editor.length() prevCR = False
--- a/eric6/QScintilla/Exporters/ExporterTEX.py Wed Sep 25 18:25:43 2019 +0200 +++ b/eric6/QScintilla/Exporters/ExporterTEX.py Wed Sep 25 18:37:35 2019 +0200 @@ -131,15 +131,21 @@ "TeX/FullPathAsTitle") lex = self.editor.getLexer() - self.defaultPaper = lex and \ - lex.paper(QsciScintilla.STYLE_DEFAULT) or \ + self.defaultPaper = ( + lex and + lex.paper(QsciScintilla.STYLE_DEFAULT) or self.editor.paper().name() - self.defaultColor = lex and \ - lex.color(QsciScintilla.STYLE_DEFAULT) or \ + ) + self.defaultColor = ( + lex and + lex.color(QsciScintilla.STYLE_DEFAULT) or self.editor.color().name() - self.defaultFont = lex and \ - lex.color(QsciScintilla.STYLE_DEFAULT) or \ + ) + self.defaultFont = ( + lex and + lex.color(QsciScintilla.STYLE_DEFAULT) or Preferences.getEditorOtherFonts("DefaultFont") + ) lengthDoc = self.editor.length() styleIsUsed = {} @@ -173,11 +179,15 @@ if lex: istyle = 0 while istyle <= QsciScintilla.STYLE_MAX: - if (istyle <= QsciScintilla.STYLE_DEFAULT or - istyle > QsciScintilla.STYLE_LASTPREDEFINED) and \ - styleIsUsed[istyle]: - if lex.description(istyle) or \ - istyle == QsciScintilla.STYLE_DEFAULT: + if ( + (istyle <= QsciScintilla.STYLE_DEFAULT or + istyle > QsciScintilla.STYLE_LASTPREDEFINED) and + styleIsUsed[istyle] + ): + if ( + lex.description(istyle) or + istyle == QsciScintilla.STYLE_DEFAULT + ): font = lex.font(istyle) colour = lex.color(istyle) paper = lex.paper(istyle) @@ -233,8 +243,10 @@ 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(
--- a/eric6/QScintilla/Lexers/Lexer.py Wed Sep 25 18:25:43 2019 +0200 +++ b/eric6/QScintilla/Lexers/Lexer.py Wed Sep 25 18:37:35 2019 +0200 @@ -79,9 +79,10 @@ @return flag (boolean) """ - return \ - (self.streamCommentString['start'] != "") and \ - (self.streamCommentString['end'] != "") + return ( + self.streamCommentString['start'] != "" and + self.streamCommentString['end'] != "" + ) def boxCommentStr(self): """ @@ -98,10 +99,11 @@ @return flag (boolean) """ - return \ - (self.boxCommentString['start'] != "") and \ - (self.boxCommentString['middle'] != "") and \ + return ( + (self.boxCommentString['start'] != "") and + (self.boxCommentString['middle'] != "") and (self.boxCommentString['end'] != "") + ) def alwaysKeepTabs(self): """
--- a/eric6/QScintilla/Lexers/LexerPygments.py Wed Sep 25 18:25:43 2019 +0200 +++ b/eric6/QScintilla/Lexers/LexerPygments.py Wed Sep 25 18:37:35 2019 +0200 @@ -9,8 +9,9 @@ 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 PyQt5.QtGui import QColor, QFont
--- a/eric6/QScintilla/Lexers/LexerPython.py Wed Sep 25 18:25:43 2019 +0200 +++ b/eric6/QScintilla/Lexers/LexerPython.py Wed Sep 25 18:37:35 2019 +0200 @@ -183,8 +183,11 @@ if m: last -= indent_width - if lead_spaces % indent_width != 0 or lead_spaces == 0 \ - or self.lastIndented != line: + if ( + lead_spaces % indent_width != 0 or + lead_spaces == 0 or + self.lastIndented != line + ): indentDifference = last - lead_spaces else: indentDifference = -indent_width
--- a/eric6/QScintilla/Lexers/LexerQSS.py Wed Sep 25 18:25:43 2019 +0200 +++ b/eric6/QScintilla/Lexers/LexerQSS.py Wed Sep 25 18:37:35 2019 +0200 @@ -87,69 +87,73 @@ @return string giving the keywords (string) or None """ if kwSet == 1: - return "alternate-background-color background background-color" \ - " background-image background-repeat background-position" \ - " background-attachment background-clip background-origin" \ - " border border-top border-right border-bottom border-left" \ - " border-color border-top-color border-right-color" \ - " border-bottom-color border-left-color border-image" \ - " border-radius border-top-left-radius" \ - " border-top-right-radius border-bottom-right-radius" \ - " border-bottom-left-radius border-style border-top-style" \ - " border-right-style border-bottom-style border-left-style" \ - " border-width border-top-width border-right-width" \ - " border-bottom-width border-left-width bottom button-layout" \ - " color dialogbuttonbox-buttons-have-icons font font-family" \ - " font-size font-style font-weight gridline-color" \ - " height icon-size image image-position left" \ - " lineedit-password-character margin margin-top margin-right" \ - " margin-bottom margin-left max-height max-width" \ - " messagebox-text-interaction-flags min-height min-width" \ - " opacity outline padding padding-top padding-right" \ - " padding-bottom padding-left" \ - " paint-alternating-row-colors-for-empty-area" \ - " position right selection-background-color selection-color" \ - " show-decoration-selected spacing subcontrol-origin" \ - " subcontrol-position text-align text-decoration" \ - " top width" \ - "" \ - " backward-icon cd-icon computer-icon desktop-icon" \ - " dialog-apply-icon dialog-cancel-icon dialog-close-icon" \ - " dialog-discard-icon dialog-help-icon dialog-no-icon" \ - " dialog-ok-icon dialog-open-icon dialog-reset-icon" \ - " dialog-save-icon dialog-yes-icon directory-closed-icon" \ - " directory-icon directory-link-icon directory-open-icon" \ - " dockwidget-close-icon downarrow-icon dvd-icon file-icon" \ - " file-link-icon filedialog-contentsview-icon" \ - " filedialog-detailedview-icon filedialog-end-icon" \ - " filedialog-infoview-icon filedialog-listview-icon" \ - " filedialog-new-directory-icon" \ - " filedialog-parent-directory-icon filedialog-start-icon" \ - " floppy-icon forward-icon harddisk-icon home-icon" \ - " leftarrow-icon messagebox-critical-icon" \ - " messagebox-information-icon messagebox-question-icon" \ - " messagebox-warning-icon network-icon rightarrow-icon" \ - " titlebar-contexthelp-icon titlebar-maximize-icon" \ - " titlebar-menu-icon titlebar-minimize-icon" \ - " titlebar-normal-icon titlebar-shade-icon" \ + return ( + "alternate-background-color background background-color" + " background-image background-repeat background-position" + " background-attachment background-clip background-origin" + " border border-top border-right border-bottom border-left" + " border-color border-top-color border-right-color" + " border-bottom-color border-left-color border-image" + " border-radius border-top-left-radius" + " border-top-right-radius border-bottom-right-radius" + " border-bottom-left-radius border-style border-top-style" + " border-right-style border-bottom-style border-left-style" + " border-width border-top-width border-right-width" + " border-bottom-width border-left-width bottom button-layout" + " color dialogbuttonbox-buttons-have-icons font font-family" + " font-size font-style font-weight gridline-color" + " height icon-size image image-position left" + " lineedit-password-character margin margin-top margin-right" + " margin-bottom margin-left max-height max-width" + " messagebox-text-interaction-flags min-height min-width" + " opacity outline padding padding-top padding-right" + " padding-bottom padding-left" + " paint-alternating-row-colors-for-empty-area" + " position right selection-background-color selection-color" + " show-decoration-selected spacing subcontrol-origin" + " subcontrol-position text-align text-decoration" + " top width" + "" + " backward-icon cd-icon computer-icon desktop-icon" + " dialog-apply-icon dialog-cancel-icon dialog-close-icon" + " dialog-discard-icon dialog-help-icon dialog-no-icon" + " dialog-ok-icon dialog-open-icon dialog-reset-icon" + " dialog-save-icon dialog-yes-icon directory-closed-icon" + " directory-icon directory-link-icon directory-open-icon" + " dockwidget-close-icon downarrow-icon dvd-icon file-icon" + " file-link-icon filedialog-contentsview-icon" + " filedialog-detailedview-icon filedialog-end-icon" + " filedialog-infoview-icon filedialog-listview-icon" + " filedialog-new-directory-icon" + " filedialog-parent-directory-icon filedialog-start-icon" + " floppy-icon forward-icon harddisk-icon home-icon" + " leftarrow-icon messagebox-critical-icon" + " messagebox-information-icon messagebox-question-icon" + " messagebox-warning-icon network-icon rightarrow-icon" + " titlebar-contexthelp-icon titlebar-maximize-icon" + " titlebar-menu-icon titlebar-minimize-icon" + " titlebar-normal-icon titlebar-shade-icon" " titlebar-unshade-icon trash-icon uparrow-icon" + ) elif kwSet == 2: - return "active adjoins-item alternate bottom checked closable" \ - " closed default disabled editable edit-focus enabled" \ - " exclusive first flat floatable focus has-children" \ - " has-siblings horizontal hover indeterminate last left" \ - " maximized middle minimized movable no-frame" \ - " non-exclusive off on only-one open next-selected" \ - " pressed previous-selected read-only right selected top" \ - " unchecked vertical window" \ - "" \ - " add-line add-page branch chunk close-button corner" \ - " down-arrow down-button drop-down float-button groove" \ - " indicator handle icon item left-arrow left-corner" \ - " menu-arrow menu-button menu-indicator right-arrow" \ - " pane right-corner scroller section separator sub-line" \ - " sub-page tab tab-bar tear tearoff text title up-arrow" \ + return ( + "active adjoins-item alternate bottom checked closable" + " closed default disabled editable edit-focus enabled" + " exclusive first flat floatable focus has-children" + " has-siblings horizontal hover indeterminate last left" + " maximized middle minimized movable no-frame" + " non-exclusive off on only-one open next-selected" + " pressed previous-selected read-only right selected top" + " unchecked vertical window" + "" + " add-line add-page branch chunk close-button corner" + " down-arrow down-button drop-down float-button groove" + " indicator handle icon item left-arrow left-corner" + " menu-arrow menu-button menu-indicator right-arrow" + " pane right-corner scroller section separator sub-line" + " sub-page tab tab-bar tear tearoff text title up-arrow" " up-button" + ) return None
--- a/eric6/QScintilla/Lexers/SubstyledLexer.py Wed Sep 25 18:25:43 2019 +0200 +++ b/eric6/QScintilla/Lexers/SubstyledLexer.py Wed Sep 25 18:37:35 2019 +0200 @@ -95,9 +95,9 @@ if subStyleLength: self.__subStyles[baseStyle] = {} for subStyle in range(subStyleLength): - substyleKey = \ - "Scintilla/{0}/style{1}/substyle{2}/"\ - .format(self.language(), baseStyle, subStyle) + substyleKey = ( + "Scintilla/{0}/style{1}/substyle{2}/" + ).format(self.language(), baseStyle, subStyle) if settings.contains(substyleKey + "Description"): subStyleData = {} subStyleData["Description"] = settings.value( @@ -121,8 +121,9 @@ style["font_family"] = settings.value(key) key = substyleKey + "font_size" if settings.contains(key): - style["font_size"] = \ + style["font_size"] = ( int(settings.value(key)) + ) key = substyleKey + "font_bold" if settings.contains(key): style["font_bold"] = Preferences.toBool( @@ -133,19 +134,22 @@ settings.value(key)) key = substyleKey + "font_underline" if settings.contains(key): - style["font_underline"] = \ + style["font_underline"] = ( Preferences.toBool(settings.value(key)) + ) subStyleData["Style"] = style - self.__subStyles[baseStyle][subStyle] = \ + self.__subStyles[baseStyle][subStyle] = ( subStyleData + ) else: # initialize with default - self.__subStyles[baseStyle][subStyle] = \ + self.__subStyles[baseStyle][subStyle] = ( copy.deepcopy(self.defaultSubStyles [baseStyle][subStyle]) + ) self.__subStylesInitialized = True @@ -253,8 +257,9 @@ subStyleLength = int(settings.value(key)) if subStyleLength: for subStyle in range(subStyleLength): - substyleKey = "Scintilla/{0}/style{1}/substyle{2}/"\ - .format(self.language(), baseStyle, subStyle) + substyleKey = ( + "Scintilla/{0}/style{1}/substyle{2}/" + ).format(self.language(), baseStyle, subStyle) settings.remove(substyleKey) # Step 2: save the defined sub-styles @@ -269,8 +274,10 @@ self.language(), baseStyle, subStyleIndex) subStyleData = self.__subStyles[baseStyle][subStyle] - if not subStyleData["Description"] and \ - not subStyleData["Words"]: + if ( + not subStyleData["Description"] and + not subStyleData["Words"] + ): # invalid or incomplete sub-style definition continue @@ -370,8 +377,9 @@ @type int """ if style in self.__subStyles and substyle in self.__subStyles[style]: - self.__subStyles[style][substyle]["Description"] = \ + self.__subStyles[style][substyle]["Description"] = ( description.strip() + ) def substyleDescription(self, style, substyle): """ @@ -435,8 +443,9 @@ @type int """ if style in self.__subStyles and substyle in self.__subStyles[style]: - self.__subStyles[style][substyle]["Style"]["fore"] = \ + self.__subStyles[style][substyle]["Style"]["fore"] = ( color.red() << 16 | color.green() << 8 | color.blue() + ) def substyleColor(self, style, substyle): """ @@ -474,8 +483,9 @@ @type int """ if style in self.__subStyles and substyle in self.__subStyles[style]: - self.__subStyles[style][substyle]["Style"]["paper"] = \ + self.__subStyles[style][substyle]["Style"]["paper"] = ( color.red() << 16 | color.green() << 8 | color.blue() + ) def substylePaper(self, style, substyle): """ @@ -513,8 +523,9 @@ @type int """ if style in self.__subStyles and substyle in self.__subStyles[style]: - self.__subStyles[style][substyle]["Style"]["eolfill"] = \ + self.__subStyles[style][substyle]["Style"]["eolfill"] = ( eolFill + ) def substyleEolFill(self, style, substyle): """ @@ -548,16 +559,21 @@ @type int """ if style in self.__subStyles and substyle in self.__subStyles[style]: - self.__subStyles[style][substyle]["Style"]["font_family"] = \ + self.__subStyles[style][substyle]["Style"]["font_family"] = ( font.family() - self.__subStyles[style][substyle]["Style"]["font_size"] = \ + ) + self.__subStyles[style][substyle]["Style"]["font_size"] = ( font.pointSize() - self.__subStyles[style][substyle]["Style"]["font_bold"] = \ + ) + self.__subStyles[style][substyle]["Style"]["font_bold"] = ( font.bold() - self.__subStyles[style][substyle]["Style"]["font_italic"] = \ + ) + self.__subStyles[style][substyle]["Style"]["font_italic"] = ( font.italic() - self.__subStyles[style][substyle]["Style"]["font_underline"] = \ + ) + self.__subStyles[style][substyle]["Style"]["font_underline"] = ( font.underline() + ) def substyleFont(self, style, substyle): """ @@ -600,8 +616,10 @@ """ description = "" - if style in self.defaultSubStyles and \ - substyle in self.defaultSubStyles[style]: + if ( + style in self.defaultSubStyles and + substyle in self.defaultSubStyles[style] + ): substyleData = self.defaultSubStyles[style][substyle] description = substyleData["Description"].strip() @@ -620,8 +638,10 @@ """ words = "" - if style in self.defaultSubStyles and \ - substyle in self.defaultSubStyles[style]: + if ( + style in self.defaultSubStyles and + substyle in self.defaultSubStyles[style] + ): substyleData = self.defaultSubStyles[style][substyle] words = substyleData["Words"].strip() @@ -640,8 +660,10 @@ """ color = self.defaultColor(style) - if style in self.defaultSubStyles and \ - substyle in self.defaultSubStyles[style]: + if ( + style in self.defaultSubStyles and + substyle in self.defaultSubStyles[style] + ): styleData = self.defaultSubStyles[style][substyle]["Style"] if "fore" in styleData: color = QColor( @@ -665,8 +687,10 @@ """ color = self.defaultPaper(style) - if style in self.defaultSubStyles and \ - substyle in self.defaultSubStyles[style]: + if ( + style in self.defaultSubStyles and + substyle in self.defaultSubStyles[style] + ): styleData = self.defaultSubStyles[style][substyle]["Style"] if "paper" in styleData: color = QColor( @@ -690,8 +714,10 @@ """ eolFill = self.defaultEolFill(style) - if style in self.defaultSubStyles and \ - substyle in self.defaultSubStyles[style]: + if ( + style in self.defaultSubStyles and + substyle in self.defaultSubStyles[style] + ): styleData = self.defaultSubStyles[style][substyle]["Style"] if "eolfill" in styleData: eolFill = styleData["eolfill"] @@ -711,8 +737,10 @@ """ font = self.defaultFont(style) - if style in self.defaultSubStyles and \ - substyle in self.defaultSubStyles[style]: + if ( + style in self.defaultSubStyles and + substyle in self.defaultSubStyles[style] + ): styleData = self.defaultSubStyles[style][substyle]["Style"] if "font_family" in styleData: font.setFamily(styleData["font_family"])
--- a/eric6/QScintilla/Lexers/__init__.py Wed Sep 25 18:25:43 2019 +0200 +++ b/eric6/QScintilla/Lexers/__init__.py Wed Sep 25 18:37:35 2019 +0200 @@ -163,21 +163,29 @@ } if QSCINTILLA_VERSION() >= 0x020a00: - supportedLanguages["JSON"] = \ - [QCoreApplication.translate('Lexers', "JSON"), - 'dummy.json', "lexerJSON.png"] - supportedLanguages["Markdown"] = \ - [QCoreApplication.translate('Lexers', "Markdown"), - 'dummy.md', "lexerMarkdown.png"] + supportedLanguages["JSON"] = [ + QCoreApplication.translate('Lexers', "JSON"), + 'dummy.json', + "lexerJSON.png" + ] + supportedLanguages["Markdown"] = [ + QCoreApplication.translate('Lexers', "Markdown"), + 'dummy.md', + "lexerMarkdown.png" + ] for name in LexerRegistry: if not name.startswith("Pygments|"): - supportedLanguages[name] = \ - LexerRegistry[name][:2] + [LexerRegistry[name][6]] + supportedLanguages[name] = ( + LexerRegistry[name][:2] + + [LexerRegistry[name][6]] + ) - supportedLanguages["Guessed"] = \ - [QCoreApplication.translate('Lexers', "Pygments"), 'dummy.pygments', - ""] + supportedLanguages["Guessed"] = [ + QCoreApplication.translate('Lexers', "Pygments"), + 'dummy.pygments', + "" + ] return supportedLanguages
--- a/eric6/QScintilla/MarkupProviders/HtmlProvider.py Wed Sep 25 18:25:43 2019 +0200 +++ b/eric6/QScintilla/MarkupProviders/HtmlProvider.py Wed Sep 25 18:37:35 2019 +0200 @@ -298,8 +298,9 @@ from .ImageMarkupDialog import ImageMarkupDialog dlg = ImageMarkupDialog(ImageMarkupDialog.HtmlMode) if dlg.exec_() == QDialog.Accepted: - address, altText, title, originalSize, width, height = \ + address, altText, title, originalSize, width, height = ( dlg.getData() + ) markup = '<img src="{0}"'.format(address) if altText: @@ -368,8 +369,9 @@ lineSeparator = editor.getLineSeparator() editor.beginUndoAction() if editor.hasSelectedText(): - startLine, startIndex, endLine, endIndex = \ + startLine, startIndex, endLine, endIndex = ( editor.getSelection() + ) if endIndex == 0: endLine -= 1 for line in range(startLine, endLine + 1): @@ -394,8 +396,9 @@ if listElements == 0: listElements = 1 cline, cindex = editor.getCursorPosition() - listBody = \ + listBody = ( listElements * " <li></li>{0}".format(lineSeparator) + ) markup = "<{1}>{0}{2}</{1}>{0}".format( lineSeparator, listType, listBody) if cindex == 0:
--- a/eric6/QScintilla/MarkupProviders/ImageMarkupDialog.py Wed Sep 25 18:25:43 2019 +0200 +++ b/eric6/QScintilla/MarkupProviders/ImageMarkupDialog.py Wed Sep 25 18:37:35 2019 +0200 @@ -130,9 +130,10 @@ self.widthSpinBox.setValue(image.width()) self.heightSpinBox.setValue(image.height()) self.__originalImageSize = image.size() - self.__aspectRatio = \ - float(self.__originalImageSize.height()) / \ + self.__aspectRatio = ( + float(self.__originalImageSize.height()) / self.__originalImageSize.width() + ) else: self.widthSpinBox.setValue(0) self.heightSpinBox.setValue(0) @@ -183,8 +184,10 @@ @param width width for the image @type int """ - if self.aspectRatioCheckBox.isChecked() and \ - self.widthSpinBox.hasFocus(): + if ( + self.aspectRatioCheckBox.isChecked() and + self.widthSpinBox.hasFocus() + ): height = width * self.__aspectRatio self.heightSpinBox.setValue(height) @@ -196,8 +199,10 @@ @param height height for the image @type int """ - if self.aspectRatioCheckBox.isChecked() and \ - self.heightSpinBox.hasFocus(): + if ( + self.aspectRatioCheckBox.isChecked() and + self.heightSpinBox.hasFocus() + ): width = height / self.__aspectRatio self.widthSpinBox.setValue(width)
--- a/eric6/QScintilla/MarkupProviders/MarkdownProvider.py Wed Sep 25 18:25:43 2019 +0200 +++ b/eric6/QScintilla/MarkupProviders/MarkdownProvider.py Wed Sep 25 18:37:35 2019 +0200 @@ -302,8 +302,9 @@ from .ImageMarkupDialog import ImageMarkupDialog dlg = ImageMarkupDialog(ImageMarkupDialog.MarkDownMode) if dlg.exec_() == QDialog.Accepted: - address, altText, title, originalSize, width, height = \ + address, altText, title, originalSize, width, height = ( dlg.getData() + ) if title: markup = ''.format(altText, address, title) @@ -371,8 +372,9 @@ lineSeparator = editor.getLineSeparator() editor.beginUndoAction() if editor.hasSelectedText(): - startLine, startIndex, endLine, endIndex = \ + startLine, startIndex, endLine, endIndex = ( editor.getSelection() + ) if endIndex == 0: endLine -= 1 for line in range(startLine, endLine + 1): @@ -391,8 +393,9 @@ if listElements == 0: listElements = 1 cline, cindex = editor.getCursorPosition() - listBody = \ + listBody = ( listElements * "{1}{0}".format(lineSeparator, markup) + ) if cindex == 0: editor.insertAt(listBody, cline, cindex) editor.setCursorPosition(cline, len(markup))
--- a/eric6/QScintilla/MarkupProviders/RestructuredTextProvider.py Wed Sep 25 18:25:43 2019 +0200 +++ b/eric6/QScintilla/MarkupProviders/RestructuredTextProvider.py Wed Sep 25 18:37:35 2019 +0200 @@ -324,8 +324,9 @@ from .ImageMarkupDialog import ImageMarkupDialog dlg = ImageMarkupDialog(ImageMarkupDialog.RestMode) if dlg.exec_() == QDialog.Accepted: - address, altText, title, originalSize, width, height = \ + address, altText, title, originalSize, width, height = ( dlg.getData() + ) lineSeparator = editor.getLineSeparator() markup = ".. image:: {0}{1}".format(address, lineSeparator) @@ -399,8 +400,9 @@ lineSeparator = editor.getLineSeparator() editor.beginUndoAction() if editor.hasSelectedText(): - startLine, startIndex, endLine, endIndex = \ + startLine, startIndex, endLine, endIndex = ( editor.getSelection() + ) if endIndex == 0: endLine -= 1 for line in range(startLine, endLine + 1): @@ -419,8 +421,9 @@ if listElements == 0: listElements = 1 cline, cindex = editor.getCursorPosition() - listBody = \ + listBody = ( listElements * "{1}{0}".format(lineSeparator, markup) + ) if cindex == 0: editor.insertAt(listBody, cline, cindex) editor.setCursorPosition(cline, len(markup))
--- a/eric6/QScintilla/MarkupProviders/__init__.py Wed Sep 25 18:25:43 2019 +0200 +++ b/eric6/QScintilla/MarkupProviders/__init__.py Wed Sep 25 18:37:35 2019 +0200 @@ -29,19 +29,25 @@ extension = os.path.normcase(os.path.splitext(fn)[1][1:]) else: extension = "" - if extension in \ - Preferences.getEditor("PreviewHtmlFileNameExtensions") or \ - editor.getLanguage() == "HTML": + if ( + extension in Preferences.getEditor( + "PreviewHtmlFileNameExtensions") or + editor.getLanguage() == "HTML" + ): from .HtmlProvider import HtmlProvider return HtmlProvider() - elif extension in \ - Preferences.getEditor("PreviewMarkdownFileNameExtensions") or \ - editor.getLanguage().lower() == "markdown": + elif ( + extension in Preferences.getEditor( + "PreviewMarkdownFileNameExtensions") or + editor.getLanguage().lower() == "markdown" + ): from .MarkdownProvider import MarkdownProvider return MarkdownProvider() - elif extension in \ - Preferences.getEditor("PreviewRestFileNameExtensions") or \ - editor.getLanguage().lower() == "restructuredtext": + elif ( + extension in Preferences.getEditor( + "PreviewRestFileNameExtensions") or + editor.getLanguage().lower() == "restructuredtext" + ): from .RestructuredTextProvider import RestructuredTextProvider return RestructuredTextProvider()
--- a/eric6/QScintilla/MiniEditor.py Wed Sep 25 18:25:43 2019 +0200 +++ b/eric6/QScintilla/MiniEditor.py Wed Sep 25 18:37:35 2019 +0200 @@ -11,11 +11,15 @@ import os import re -from PyQt5.QtCore import QSignalMapper, QPoint, QTimer, QFileInfo, \ - pyqtSignal, QSize, QRegExp, Qt, QCoreApplication +from PyQt5.QtCore import ( + QSignalMapper, QPoint, QTimer, QFileInfo, pyqtSignal, QSize, QRegExp, Qt, + QCoreApplication +) from PyQt5.QtGui import QCursor, QKeySequence, QPalette, QFont -from PyQt5.QtWidgets import QWidget, QWhatsThis, QActionGroup, QDialog, \ - QInputDialog, QApplication, QMenu, QVBoxLayout, QLabel +from PyQt5.QtWidgets import ( + QWidget, QWhatsThis, QActionGroup, QDialog, QInputDialog, QApplication, + QMenu, QVBoxLayout, QLabel +) from PyQt5.QtPrintSupport import QPrinter, QPrintDialog, QAbstractPrintDialog from PyQt5.Qsci import QsciScintilla @@ -2342,10 +2346,12 @@ modified = False - if (not self.__getEditorConfig("TabForIndentation")) and \ - Preferences.getEditor("ConvertTabsOnLoad") and \ - not (self.lexer_ and - self.lexer_.alwaysKeepTabs()): + if ( + not self.__getEditorConfig("TabForIndentation") and + Preferences.getEditor("ConvertTabsOnLoad") and + not (self.lexer_ and + self.lexer_.alwaysKeepTabs()) + ): txtExpanded = txt.expandtabs(self.__getEditorConfig("TabWidth")) if txtExpanded != txt: modified = True @@ -2757,8 +2763,9 @@ printer.setDocName(self.tr("Untitled")) if printDialog.printRange() == QAbstractPrintDialog.Selection: # get the selection - fromLine, fromIndex, toLine, toIndex = \ + fromLine, fromIndex, toLine, toIndex = ( self.__textEdit.getSelection() + ) if toIndex == 0: toLine -= 1 # Qscintilla seems to print one line more than told @@ -2856,8 +2863,9 @@ languages = sorted(list(supportedLanguages.keys())) for language in languages: if language != "Guessed": - self.supportedLanguages[language] = \ + self.supportedLanguages[language] = ( supportedLanguages[language][:2] + ) act = menu.addAction( UI.PixmapCache.getIcon(supportedLanguages[language][2]), self.supportedLanguages[language][0]) @@ -2937,8 +2945,11 @@ """ Private method used to reset the language selection. """ - if self.lexer_ is not None and \ - (self.lexer_.lexer() == "container" or self.lexer_.lexer() is None): + if ( + self.lexer_ is not None and + (self.lexer_.lexer() == "container" or + self.lexer_.lexer() is None) + ): self.__textEdit.SCN_STYLENEEDED.disconnect(self.__styleNeeded) self.apiLanguage = "" @@ -2977,8 +2988,10 @@ @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 @@ -3006,8 +3019,11 @@ language (string) @keyparam pyname name of the pygments lexer to use (string) """ - if self.lexer_ is not None and \ - (self.lexer_.lexer() == "container" or self.lexer_.lexer() is None): + if ( + self.lexer_ is not None and + (self.lexer_.lexer() == "container" or + self.lexer_.lexer() is None) + ): self.__textEdit.SCN_STYLENEEDED.disconnect(self.__styleNeeded) filename = os.path.basename(filename) @@ -3063,9 +3079,11 @@ if self.filetype == "": line0 = self.__textEdit.text(0) - if line0.startswith("#!") and \ - ("python2" in line0 or - ("python" in line0 and "python3" not in line0)): + if ( + line0.startswith("#!") and + ("python2" in line0 or + ("python" in line0 and "python3" not in line0)) + ): return True if self.__curFile is not None:
--- a/eric6/QScintilla/Printer.py Wed Sep 25 18:25:43 2019 +0200 +++ b/eric6/QScintilla/Printer.py Wed Sep 25 18:37:35 2019 +0200 @@ -63,8 +63,8 @@ fn = self.docName() header = QCoreApplication.translate( - 'Printer', '{0} - Printed on {1}, {2} - Page {3}')\ - .format(fn, self.date, self.time, pagenr) + '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
--- a/eric6/QScintilla/QsciScintillaCompat.py Wed Sep 25 18:25:43 2019 +0200 +++ b/eric6/QScintilla/QsciScintillaCompat.py Wed Sep 25 18:37:35 2019 +0200 @@ -11,8 +11,10 @@ from PyQt5.QtCore import pyqtSignal, Qt, QPoint from PyQt5.QtGui import QPalette, QColor, QFontMetrics from PyQt5.QtWidgets import QApplication, QListWidget -from PyQt5.Qsci import QsciScintillaBase, QsciScintilla, \ +from PyQt5.Qsci import ( + QsciScintillaBase, QsciScintilla, QSCINTILLA_VERSION as QSCIQSCINTILLA_VERSION +) ############################################################################### @@ -185,9 +187,10 @@ if isinstance(pos, int): scipos = pos else: - scipos = \ - self.SendScintilla(QsciScintilla.SCI_POSITIONFROMPOINT, - pos.x(), pos.y()) + scipos = self.SendScintilla( + QsciScintilla.SCI_POSITIONFROMPOINT, + pos.x(), pos.y() + ) line = self.SendScintilla(QsciScintilla.SCI_LINEFROMPOSITION, scipos) if line >= self.lines(): line = -1 @@ -303,9 +306,10 @@ @return fold level of the given line (integer) """ lvl = self.SendScintilla(QsciScintilla.SCI_GETFOLDLEVEL, line) - return \ - (lvl & QsciScintilla.SC_FOLDLEVELNUMBERMASK) - \ + return ( + (lvl & QsciScintilla.SC_FOLDLEVELNUMBERMASK) - QsciScintilla.SC_FOLDLEVELBASE + ) def foldFlagsAt(self, line): """ @@ -544,9 +548,11 @@ @return flag indicating a rectangular selection (boolean) """ startLine, startIndex, endLine, endIndex = self.getSelection() - return startLine != -1 and \ - startLine != endLine and \ + return ( + startLine != -1 and + startLine != endLine and self.SendScintilla(QsciScintilla.SCI_SELECTIONISRECTANGLE) + ) def getRectangularSelection(self): """ @@ -980,12 +986,16 @@ @param color color to be used by the indicator (QColor) @exception ValueError the indicator or style are not valid """ - if indicator < QsciScintilla.INDIC_CONTAINER or \ - indicator > QsciScintilla.INDIC_MAX: + if ( + indicator < QsciScintilla.INDIC_CONTAINER or + indicator > QsciScintilla.INDIC_MAX + ): raise ValueError("indicator number out of range") - if style < QsciScintilla.INDIC_PLAIN or \ - style > self.IndicatorStyleMax: + if ( + style < QsciScintilla.INDIC_PLAIN or + style > self.IndicatorStyleMax + ): raise ValueError("style out of range") self.SendScintilla(QsciScintilla.SCI_INDICSETSTYLE, indicator, style) @@ -1011,8 +1021,10 @@ QsciScintilla.INDIC_CONTAINER .. QsciScintilla.INDIC_MAX) @exception ValueError the indicator or style are not valid """ - if indicator < QsciScintilla.INDIC_CONTAINER or \ - indicator > QsciScintilla.INDIC_MAX: + if ( + indicator < QsciScintilla.INDIC_CONTAINER or + indicator > QsciScintilla.INDIC_MAX + ): raise ValueError("indicator number out of range") self.SendScintilla(QsciScintilla.SCI_SETINDICATORCURRENT, indicator) @@ -1554,8 +1566,9 @@ maxWidth = averageCharWidth * self.maxChars if width > maxWidth: width = maxWidth - height += userListWidget.horizontalScrollBar().sizeHint()\ - .height() + height += ( + userListWidget.horizontalScrollBar().sizeHint().height() + ) # List box doesn't honor limited size to show scroll bars, e.g. # Python 2 on Win 10. So just force it. userListWidget.setHorizontalScrollBarPolicy(
--- a/eric6/QScintilla/SearchReplaceWidget.py Wed Sep 25 18:25:43 2019 +0200 +++ b/eric6/QScintilla/SearchReplaceWidget.py Wed Sep 25 18:37:35 2019 +0200 @@ -9,8 +9,9 @@ from PyQt5.QtCore import pyqtSignal, Qt, pyqtSlot, QEvent -from PyQt5.QtWidgets import QWidget, QHBoxLayout, QToolButton, QScrollArea, \ - QSizePolicy, QFrame +from PyQt5.QtWidgets import ( + QWidget, QHBoxLayout, QToolButton, QScrollArea, QSizePolicy, QFrame +) from .Editor import Editor @@ -308,10 +309,14 @@ if selections is None: selections = self.__selections if selections: - lineNumbers = [sel[0] for sel in selections] + \ - [sel[2] for sel in selections] - indexNumbers = [sel[1] for sel in selections] + \ - [sel[3] for sel in selections] + lineNumbers = ( + [sel[0] for sel in selections] + + [sel[2] for sel in selections] + ) + indexNumbers = ( + [sel[1] for sel in selections] + + [sel[3] for sel in selections] + ) startLine, startIndex, endLine, endIndex = ( min(lineNumbers), min(indexNumbers), max(lineNumbers), max(indexNumbers)) @@ -462,9 +467,11 @@ lineFrom, indexFrom = aw.lineIndexFromPosition(tgtPos) lineTo, indexTo = aw.lineIndexFromPosition(tgtPos + tgtLen) for sel in self.__selections: - if lineFrom == sel[0] and \ - indexFrom >= sel[1] and \ - indexTo <= sel[3]: + if ( + lineFrom == sel[0] and + indexFrom >= sel[1] and + indexTo <= sel[3] + ): indicate = True break else: @@ -501,8 +508,10 @@ lineFrom, indexFrom, lineTo, indexTo = aw.getSelection() boundary = self.__selectionBoundary() if backwards: - if self.ui.selectionCheckBox.isChecked() and \ - (lineFrom, indexFrom, lineTo, indexTo) == boundary: + if ( + self.ui.selectionCheckBox.isChecked() and + (lineFrom, indexFrom, lineTo, indexTo) == boundary + ): # initial call line, index = boundary[2:] else: @@ -513,10 +522,12 @@ else: line = lineFrom index = indexFrom - if self.ui.selectionCheckBox.isChecked() and \ - line == boundary[0] and \ - index >= 0 and \ - index < boundary[1]: + if ( + self.ui.selectionCheckBox.isChecked() and + line == boundary[0] and + index >= 0 and + index < boundary[1] + ): ok = False if ok and index < 0: @@ -539,8 +550,10 @@ else: index = aw.lineLength(line) else: - if self.ui.selectionCheckBox.isChecked() and \ - (lineFrom, indexFrom, lineTo, indexTo) == boundary: + if ( + self.ui.selectionCheckBox.isChecked() and + (lineFrom, indexFrom, lineTo, indexTo) == boundary + ): # initial call line, index = boundary[:2] else: @@ -567,24 +580,30 @@ lineFrom, indexFrom, lineTo, indexTo = aw.getSelection() if len(self.__selections) > 1: for sel in self.__selections: - if lineFrom == sel[0] and \ - indexFrom >= sel[1] and \ - indexTo <= sel[3]: + if ( + lineFrom == sel[0] and + indexFrom >= sel[1] and + indexTo <= sel[3] + ): ok = True break else: ok = False - elif (lineFrom == boundary[0] and indexFrom >= boundary[1]) or \ - (lineFrom > boundary[0] and lineFrom < boundary[2]) or \ - (lineFrom == boundary[2] and indexFrom <= boundary[3]): + elif ( + (lineFrom == boundary[0] and indexFrom >= boundary[1]) or + (lineFrom > boundary[0] and lineFrom < boundary[2]) or + (lineFrom == boundary[2] and indexFrom <= boundary[3]) + ): ok = True else: ok = False if not ok and len(self.__selections) > 1: # try again - while not ok and \ + while ( + not ok and ((backwards and lineFrom >= boundary[0]) or - (not backwards and lineFrom <= boundary[2])): + (not backwards and lineFrom <= boundary[2])) + ): for ind in range(len(self.__selections)): if lineFrom == self.__selections[ind][0]: after = indexTo > self.__selections[ind][3] @@ -593,13 +612,15 @@ line, index = self.__selections[ind][2:] else: if ind > 0: - line, index = \ + line, index = ( self.__selections[ind - 1][2:] + ) else: if after: if ind < len(self.__selections) - 1: - line, index = \ + line, index = ( self.__selections[ind + 1][:2] + ) else: line, index = self.__selections[ind][:2] break @@ -616,14 +637,17 @@ posix=posixMode, cxx11=cxx11Mode) if ok: - lineFrom, indexFrom, lineTo, indexTo = \ + 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]: + ) + 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: @@ -644,23 +668,28 @@ posix=posixMode, cxx11=cxx11Mode) if ok: - lineFrom, indexFrom, lineTo, indexTo = \ + lineFrom, indexFrom, lineTo, indexTo = ( aw.getSelection() + ) if len(self.__selections) > 1: for sel in self.__selections: - if lineFrom == sel[0] and \ - indexFrom >= sel[1] and \ - indexTo <= sel[3]: + if ( + lineFrom == sel[0] and + indexFrom >= sel[1] and + indexTo <= sel[3] + ): ok = True break else: ok = False - elif (lineFrom == boundary[0] and - indexFrom >= boundary[1]) or \ - (lineFrom > boundary[0] and - lineFrom < boundary[2]) or \ - (lineFrom == boundary[2] and - indexFrom <= boundary[3]): + elif ( + (lineFrom == boundary[0] and + indexFrom >= boundary[1]) or + (lineFrom > boundary[0] and + lineFrom < boundary[2]) or + (lineFrom == boundary[2] and + indexFrom <= boundary[3]) + ): ok = True else: ok = False @@ -728,8 +757,9 @@ if not self.__finding and isinstance(editor, Editor): if editor.hasSelectedText(): selections = editor.getSelections() - line1, index1, line2, index2 = \ + line1, index1, line2, index2 = ( self.__selectionBoundary(selections) + ) if line1 != line2: self.ui.selectionCheckBox.setEnabled(True) self.ui.selectionCheckBox.setChecked(True) @@ -779,8 +809,10 @@ self.__finding = True # Check enabled status due to dual purpose usage of this method - if not self.ui.replaceButton.isEnabled() and \ - not self.ui.replaceSearchButton.isEnabled(): + if ( + not self.ui.replaceButton.isEnabled() and + not self.ui.replaceSearchButton.isEnabled() + ): return ftxt = self.ui.findtextCombo.currentText() @@ -871,16 +903,20 @@ lineFrom, indexFrom, lineTo, indexTo = aw.getSelection() if len(self.__selections) > 1: for sel in self.__selections: - if lineFrom == sel[0] and \ - indexFrom >= sel[1] and \ - indexTo <= sel[3]: + if ( + lineFrom == sel[0] and + indexFrom >= sel[1] and + indexTo <= sel[3] + ): ok = True break else: ok = False - elif (lineFrom == boundary[0] and indexFrom >= boundary[1]) or \ - (lineFrom > boundary[0] and lineFrom < boundary[2]) or \ - (lineFrom == boundary[2] and indexFrom <= boundary[3]): + elif ( + (lineFrom == boundary[0] and indexFrom >= boundary[1]) or + (lineFrom > boundary[0] and lineFrom < boundary[2]) or + (lineFrom == boundary[2] and indexFrom <= boundary[3]) + ): ok = True else: ok = False @@ -892,8 +928,9 @@ after = indexTo > self.__selections[ind][3] if after: if ind < len(self.__selections) - 1: - line, index = \ + line, index = ( self.__selections[ind + 1][:2] + ) else: line, index = self.__selections[ind][:2] break @@ -908,14 +945,17 @@ posix=posixMode, cxx11=cxx11Mode) if ok: - lineFrom, indexFrom, lineTo, indexTo = \ + 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]: + ) + 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 @@ -1054,8 +1094,8 @@ """ super(SearchReplaceSlidingWidget, self).__init__(parent) - self.__searchReplaceWidget = \ - SearchReplaceWidget(replace, vm, self, True) + self.__searchReplaceWidget = SearchReplaceWidget( + replace, vm, self, True) self.__layout = QHBoxLayout(self) self.setLayout(self.__layout)
--- a/eric6/QScintilla/Shell.py Wed Sep 25 18:25:43 2019 +0200 +++ b/eric6/QScintilla/Shell.py Wed Sep 25 18:37:35 2019 +0200 @@ -18,8 +18,10 @@ from PyQt5.QtCore import pyqtSignal, QFileInfo, Qt, QEvent from PyQt5.QtGui import QClipboard, QPalette, QFont -from PyQt5.QtWidgets import QDialog, QInputDialog, QApplication, QMenu, \ - QWidget, QHBoxLayout, QVBoxLayout, QShortcut, QSizePolicy +from PyQt5.QtWidgets import ( + QDialog, QInputDialog, QApplication, QMenu, QWidget, QHBoxLayout, + QVBoxLayout, QShortcut, QSizePolicy +) from PyQt5.Qsci import QsciScintilla from E5Gui.E5Application import e5App @@ -367,8 +369,9 @@ QsciScintilla.SCI_CANCEL: self.__QScintillaCancel, } - self.__historyNavigateByCursor = \ + self.__historyNavigateByCursor = ( Preferences.getShell("HistoryNavigateByCursor") + ) self.__queuedText = '' self.__blockTextProcessing = False @@ -582,8 +585,10 @@ calltipsStyle = Preferences.getEditor("CallTipsStyle") if calltipsStyle == QsciScintilla.CallTipsNoContext: self.setCallTipsStyle(QsciScintilla.CallTipsNoContext) - elif calltipsStyle == \ - QsciScintilla.CallTipsNoAutoCompletionContext: + elif ( + calltipsStyle == + QsciScintilla.CallTipsNoAutoCompletionContext + ): self.setCallTipsStyle( QsciScintilla.CallTipsNoAutoCompletionContext) else: @@ -631,9 +636,10 @@ self.__setMargin0() self.__setAutoCompletion(self.clientType) self.__setCallTips(self.clientType) - self.racEnabled = \ - Preferences.getShell("AutoCompletionEnabled") and \ + self.racEnabled = ( + Preferences.getShell("AutoCompletionEnabled") and (cap & HasCompleter) > 0 + ) if self.clientType not in self.__historyLists: # load history list @@ -653,8 +659,10 @@ """ if index is None: # determine based on history style - if self.clientType and \ - self.__historyStyle == ShellHistoryStyle.WindowsStyle: + if ( + self.clientType and + self.__historyStyle == ShellHistoryStyle.WindowsStyle + ): idx = int(Preferences.Prefs.settings.value( "Shell/HistoryIndexes/" + self.clientType, -1)) if idx >= len(self.__history): @@ -666,8 +674,10 @@ self.__histidx = index if self.__histidx >= len(self.__history): self.__histidx = -1 - if self.clientType and \ - self.__historyStyle == ShellHistoryStyle.WindowsStyle: + if ( + self.clientType and + self.__historyStyle == ShellHistoryStyle.WindowsStyle + ): Preferences.Prefs.settings.setValue( "Shell/HistoryIndexes/" + self.clientType, self.__histidx) @@ -869,8 +879,10 @@ """ self .__clientError() - if not self.__windowed and \ - Preferences.getDebugger("ShowExceptionInShell"): + if ( + not self.__windowed and + Preferences.getDebugger("ShowExceptionInShell") + ): if exceptionType: if stackTrace: self.__write( @@ -903,8 +915,10 @@ """ self .__clientError() - if not self.__windowed and \ - Preferences.getDebugger("ShowExceptionInShell"): + if ( + not self.__windowed and + Preferences.getDebugger("ShowExceptionInShell") + ): if message is None: self.__write(self.tr("Unspecified syntax error.\n")) else: @@ -1300,8 +1314,7 @@ ac = self.isListActive() super(Shell, self).keyPressEvent(ev) self.incrementalSearchActive = True - if ac and \ - self.racEnabled: + if ac and self.racEnabled: self.dbs.remoteCompletion(self.completionText + txt) else: self.__insertTextNoEcho(txt) @@ -1608,8 +1621,10 @@ if buf.startswith(sys.ps2): buf = buf.replace(sys.ps2, "") if buf and self.incrementalSearchActive: - if self.incrementalSearchString and \ - buf.startswith(self.incrementalSearchString): + if ( + self.incrementalSearchString and + buf.startswith(self.incrementalSearchString) + ): idx, found = self.__rsearchHistory( self.incrementalSearchString, self.__histidx) if found and idx >= 0: @@ -1651,8 +1666,10 @@ if buf.startswith(sys.ps2): buf = buf.replace(sys.ps2, "") if buf and self.incrementalSearchActive: - if self.incrementalSearchString and \ - buf.startswith(self.incrementalSearchString): + if ( + self.incrementalSearchString and + buf.startswith(self.incrementalSearchString) + ): idx, found = self.__searchHistory( self.incrementalSearchString, self.__histidx) if found and idx >= 0: @@ -1753,8 +1770,10 @@ self.__setHistoryIndex(index=-1) elif self.__historyStyle == ShellHistoryStyle.WindowsStyle: if historyIndex is None: - if self.__histidx - 1 > 0 and \ - cmd != self.__history[self.__histidx - 1]: + if ( + self.__histidx - 1 > 0 and + cmd != self.__history[self.__histidx - 1] + ): self.__setHistoryIndex(index=-1) else: self.__setHistoryIndex(historyIndex) @@ -1771,8 +1790,9 @@ self.dbs.startClient( False, forProject=True, workingDir=self.__project.getProjectPath()) - self.__currentWorkingDirectory = \ + self.__currentWorkingDirectory = ( self.__project.getProjectPath() + ) else: self.dbs.startClient( False, venvName=self.__currentVenv, @@ -1798,8 +1818,10 @@ else: cmd = '' elif cmd in ['envs', 'environments']: - venvs = e5App().getObject("VirtualEnvManager")\ + venvs = ( + e5App().getObject("VirtualEnvManager") .getVirtualenvNames() + ) s = self.tr('Available Virtual Environments:\n{0}\n').format( '\n'.join("- {0}".format(venv) for venv in sorted(venvs)) ) @@ -1812,8 +1834,10 @@ self.__write(s) self.__clientStatement(False) return - elif cmd in ["quit", "quit()", "exit", "exit()"] and \ - self.__windowed: + elif ( + cmd in ["quit", "quit()", "exit", "exit()"] and + self.__windowed + ): # call main window quit() self.vm.quit() return @@ -1891,8 +1915,10 @@ idx = 0 else: idx = startIdx + 1 - while idx < len(self.__history) and \ - not self.__history[idx].startswith(txt): + while ( + idx < len(self.__history) and + not self.__history[idx].startswith(txt) + ): idx += 1 found = (idx < len(self.__history) and self.__history[idx].startswith(txt)) @@ -1914,8 +1940,10 @@ idx = len(self.__history) - 1 else: idx = startIdx - 1 - while idx >= 0 and \ - not self.__history[idx].startswith(txt): + while ( + idx >= 0 and + not self.__history[idx].startswith(txt) + ): idx -= 1 found = idx >= 0 and self.__history[idx].startswith(txt) return idx, found @@ -1976,8 +2004,9 @@ venvName = action.text() if venvName == self.tr("Project"): if self.__project.isOpen(): - self.__currentWorkingDirectory = \ + self.__currentWorkingDirectory = ( self.__project.getProjectPath() + ) self.dbs.startClient(False, forProject=True, workingDir=self.__currentWorkingDirectory) else: @@ -2003,15 +2032,16 @@ # do the history related stuff self.__maxHistoryEntries = Preferences.getShell("MaxHistoryEntries") for key in list(self.__historyLists.keys()): - self.__historyLists[key] = \ + self.__historyLists[key] = ( self.__historyLists[key][-self.__maxHistoryEntries:] + ) self.__historyStyle = Preferences.getShell("HistoryStyle") self.__historyWrap = Preferences.getShell("HistoryWrap") self.__setHistoryIndex() if not self.__windowed: self.hmenu.menuAction().setEnabled(self.isHistoryEnabled()) - self.__historyNavigateByCursor = \ - Preferences.getShell("HistoryNavigateByCursor") + self.__historyNavigateByCursor = Preferences.getShell( + "HistoryNavigateByCursor") self.historyStyleChanged.emit(self.__historyStyle) # do stdout /stderr stuff @@ -2069,8 +2099,10 @@ @param event the drag enter event (QDragEnterEvent) """ - self.inDragDrop = event.mimeData().hasUrls() or \ + self.inDragDrop = ( + event.mimeData().hasUrls() or event.mimeData().hasText() + ) if self.inDragDrop: event.acceptProposedAction() else:
--- a/eric6/QScintilla/ShellWindow.py Wed Sep 25 18:25:43 2019 +0200 +++ b/eric6/QScintilla/ShellWindow.py Wed Sep 25 18:37:35 2019 +0200 @@ -11,11 +11,13 @@ import sys import os -from PyQt5.QtCore import Qt, QCoreApplication, QPoint, QSize, QSignalMapper, \ - QProcess +from PyQt5.QtCore import ( + Qt, QCoreApplication, QPoint, QSize, QSignalMapper, QProcess +) from PyQt5.QtGui import QKeySequence -from PyQt5.QtWidgets import QWidget, QVBoxLayout, QApplication, QAction, \ - QWhatsThis, QDialog +from PyQt5.QtWidgets import ( + QWidget, QVBoxLayout, QApplication, QAction, QWhatsThis, QDialog +) from PyQt5.Qsci import QsciScintilla from E5Gui.E5MainWindow import E5MainWindow
--- a/eric6/QScintilla/SpellChecker.py Wed Sep 25 18:25:43 2019 +0200 +++ b/eric6/QScintilla/SpellChecker.py Wed Sep 25 18:37:35 2019 +0200 @@ -402,8 +402,9 @@ """ Public method to check the current selection. """ - selStartLine, selStartIndex, selEndLine, selEndIndex = \ + selStartLine, selStartIndex, selEndLine, selEndIndex = ( self.editor.getSelection() + ) self.__checkDocumentPart( self.editor.positionFromLineIndex(selStartLine, selStartIndex), self.editor.positionFromLineIndex(selEndLine, selEndIndex) @@ -523,11 +524,13 @@ 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): + if ( + (wordEnd - wordStart) >= self.minimumWordSize and + self.__checkRegion(wordStart) + ): try: if spell.check(word): continue
--- a/eric6/QScintilla/TypingCompleters/CompleterPython.py Wed Sep 25 18:25:43 2019 +0200 +++ b/eric6/QScintilla/TypingCompleters/CompleterPython.py Wed Sep 25 18:37:35 2019 +0200 @@ -61,30 +61,30 @@ """ self.setEnabled( Preferences.getEditorTyping("Python/EnabledTypingAids")) - self.__insertClosingBrace = \ - Preferences.getEditorTyping("Python/InsertClosingBrace") - self.__indentBrace = \ - Preferences.getEditorTyping("Python/IndentBrace") - self.__skipBrace = \ - Preferences.getEditorTyping("Python/SkipBrace") - self.__insertQuote = \ - Preferences.getEditorTyping("Python/InsertQuote") - self.__dedentElse = \ - Preferences.getEditorTyping("Python/DedentElse") - self.__dedentExcept = \ - Preferences.getEditorTyping("Python/DedentExcept") - self.__insertImport = \ - Preferences.getEditorTyping("Python/InsertImport") - self.__importBraceType = \ - Preferences.getEditorTyping("Python/ImportBraceType") - self.__insertSelf = \ - Preferences.getEditorTyping("Python/InsertSelf") - self.__insertBlank = \ - Preferences.getEditorTyping("Python/InsertBlank") - self.__colonDetection = \ - Preferences.getEditorTyping("Python/ColonDetection") - self.__dedentDef = \ - Preferences.getEditorTyping("Python/DedentDef") + self.__insertClosingBrace = Preferences.getEditorTyping( + "Python/InsertClosingBrace") + self.__indentBrace = Preferences.getEditorTyping( + "Python/IndentBrace") + self.__skipBrace = Preferences.getEditorTyping( + "Python/SkipBrace") + self.__insertQuote = Preferences.getEditorTyping( + "Python/InsertQuote") + self.__dedentElse = Preferences.getEditorTyping( + "Python/DedentElse") + self.__dedentExcept = Preferences.getEditorTyping( + "Python/DedentExcept") + self.__insertImport = Preferences.getEditorTyping( + "Python/InsertImport") + self.__importBraceType = Preferences.getEditorTyping( + "Python/ImportBraceType") + self.__insertSelf = Preferences.getEditorTyping( + "Python/InsertSelf") + self.__insertBlank = Preferences.getEditorTyping( + "Python/InsertBlank") + self.__colonDetection = Preferences.getEditorTyping( + "Python/ColonDetection") + self.__dedentDef = Preferences.getEditorTyping( + "Python/DedentDef") def charAdded(self, charNumber): """ @@ -99,19 +99,23 @@ line, col = self.editor.getCursorPosition() - if self.__inComment(line, col) or \ - (char != '"' and self.__inDoubleQuotedString()) or \ - (char != '"' and self.__inTripleDoubleQuotedString()) or \ - (char != "'" and self.__inSingleQuotedString()) or \ - (char != "'" and self.__inTripleSingleQuotedString()): + if ( + self.__inComment(line, col) or + (char != '"' and self.__inDoubleQuotedString()) or + (char != '"' and self.__inTripleDoubleQuotedString()) or + (char != "'" and self.__inSingleQuotedString()) or + (char != "'" and self.__inTripleSingleQuotedString()) + ): return # open parenthesis # insert closing parenthesis and self if char == '(': txt = self.editor.text(line)[:col] - if self.__insertSelf and \ - self.__defRX.exactMatch(txt): + if ( + self.__insertSelf and + self.__defRX.exactMatch(txt) + ): if self.__isClassMethodDef(): self.editor.insert('cls') self.editor.setCursorPosition(line, col + 3) @@ -122,8 +126,10 @@ self.editor.insert('self') self.editor.setCursorPosition(line, col + 4) if self.__insertClosingBrace: - if self.__defRX.exactMatch(txt) or \ - self.__classRX.exactMatch(txt): + if ( + self.__defRX.exactMatch(txt) or + self.__classRX.exactMatch(txt) + ): self.editor.insert('):') else: self.editor.insert(')') @@ -271,15 +277,19 @@ edInd = self.editor.indentation(ifLine) if self.__elseRX.indexIn(txt) == 0 and edInd <= indentation: indentation = edInd - 1 - elif self.__elifRX.indexIn(txt) == 0 and \ - edInd == indentation and \ - edInd == prevInd: + elif ( + self.__elifRX.indexIn(txt) == 0 and + edInd == indentation and + edInd == prevInd + ): indentation = edInd - 1 - elif (self.__ifRX.indexIn(txt) == 0 or - self.__whileRX.indexIn(txt) == 0 or - self.__forRX.indexIn(txt) == 0 or - self.__tryRX.indexIn(txt) == 0) and \ - edInd <= indentation: + elif ( + (self.__ifRX.indexIn(txt) == 0 or + self.__whileRX.indexIn(txt) == 0 or + self.__forRX.indexIn(txt) == 0 or + self.__tryRX.indexIn(txt) == 0) and + edInd <= indentation + ): self.editor.cancelList() self.editor.setIndentation(line, edInd) break @@ -298,9 +308,11 @@ while tryLine >= 0: txt = self.editor.text(tryLine) edInd = self.editor.indentation(tryLine) - if (self.__exceptcRX.indexIn(txt) == 0 or - self.__finallyRX.indexIn(txt) == 0) and \ - edInd <= indentation: + if ( + (self.__exceptcRX.indexIn(txt) == 0 or + self.__finallyRX.indexIn(txt) == 0) and + edInd <= indentation + ): indentation = edInd - 1 elif (self.__exceptRX.indexIn(txt) == 0 or self.__tryRX.indexIn(txt) == 0) and edInd <= indentation: @@ -322,10 +334,12 @@ edInd = self.editor.indentation(tryLine) if self.__finallyRX.indexIn(txt) == 0 and edInd <= indentation: indentation = edInd - 1 - elif (self.__tryRX.indexIn(txt) == 0 or - self.__exceptcRX.indexIn(txt) == 0 or - self.__exceptRX.indexIn(txt) == 0) and \ - edInd <= indentation: + elif ( + (self.__tryRX.indexIn(txt) == 0 or + self.__exceptcRX.indexIn(txt) == 0 or + self.__exceptRX.indexIn(txt) == 0) and + edInd <= indentation + ): self.editor.cancelList() self.editor.setIndentation(line, edInd) break @@ -346,8 +360,9 @@ if self.__defRX.indexIn(txt) == 0 and edInd < indentation: newInd = edInd elif self.__classRX.indexIn(txt) == 0 and edInd < indentation: - newInd = edInd + \ - (self.editor.indentationWidth() or self.editor.tabWidth()) + newInd = edInd + ( + self.editor.indentationWidth() or self.editor.tabWidth() + ) if newInd >= 0: self.editor.cancelList() self.editor.setIndentation(line, newInd) @@ -365,15 +380,21 @@ curLine = line - 1 while curLine >= 0: txt = self.editor.text(curLine) - if (self.__defSelfRX.indexIn(txt) == 0 or - self.__defClsRX.indexIn(txt) == 0) and \ - self.editor.indentation(curLine) == indentation: + if ( + (self.__defSelfRX.indexIn(txt) == 0 or + self.__defClsRX.indexIn(txt) == 0) and + self.editor.indentation(curLine) == indentation + ): return True - elif self.__classRX.indexIn(txt) == 0 and \ - self.editor.indentation(curLine) < indentation: + elif ( + self.__classRX.indexIn(txt) == 0 and + self.editor.indentation(curLine) < indentation + ): return True - elif self.__defRX.indexIn(txt) == 0 and \ - self.editor.indentation(curLine) <= indentation: + elif ( + self.__defRX.indexIn(txt) == 0 and + self.editor.indentation(curLine) <= indentation + ): return False curLine -= 1 return False @@ -388,8 +409,10 @@ line, col = self.editor.getCursorPosition() indentation = self.editor.indentation(line) curLine = line - 1 - if self.__classmethodRX.indexIn(self.editor.text(curLine)) == 0 and \ - self.editor.indentation(curLine) == indentation: + if ( + self.__classmethodRX.indexIn(self.editor.text(curLine)) == 0 and + self.editor.indentation(curLine) == indentation + ): return True return False @@ -403,8 +426,10 @@ line, col = self.editor.getCursorPosition() indentation = self.editor.indentation(line) curLine = line - 1 - if self.__staticmethodRX.indexIn(self.editor.text(curLine)) == 0 and \ - self.editor.indentation(curLine) == indentation: + if ( + self.__staticmethodRX.indexIn(self.editor.text(curLine)) == 0 and + self.editor.indentation(curLine) == indentation + ): return True return False @@ -443,8 +468,10 @@ @return flag indicating, if the cursor is inside a triple double quoted string (boolean) """ - return self.editor.currentStyle() == \ + return ( + self.editor.currentStyle() == QsciLexerPython.TripleDoubleQuotedString + ) def __inSingleQuotedString(self): """ @@ -464,5 +491,7 @@ @return flag indicating, if the cursor is inside a triple single quoted string (boolean) """ - return self.editor.currentStyle() == \ + return ( + self.editor.currentStyle() == QsciLexerPython.TripleSingleQuotedString + )
--- a/eric6/QScintilla/TypingCompleters/CompleterRuby.py Wed Sep 25 18:25:43 2019 +0200 +++ b/eric6/QScintilla/TypingCompleters/CompleterRuby.py Wed Sep 25 18:37:35 2019 +0200 @@ -42,20 +42,20 @@ Public slot called to reread the configuration parameters. """ self.setEnabled(Preferences.getEditorTyping("Ruby/EnabledTypingAids")) - self.__insertClosingBrace = \ - Preferences.getEditorTyping("Ruby/InsertClosingBrace") - self.__indentBrace = \ - Preferences.getEditorTyping("Ruby/IndentBrace") - self.__skipBrace = \ - Preferences.getEditorTyping("Ruby/SkipBrace") - self.__insertQuote = \ - Preferences.getEditorTyping("Ruby/InsertQuote") - self.__insertBlank = \ - Preferences.getEditorTyping("Ruby/InsertBlank") - self.__insertHereDoc = \ - Preferences.getEditorTyping("Ruby/InsertHereDoc") - self.__insertInlineDoc = \ - Preferences.getEditorTyping("Ruby/InsertInlineDoc") + self.__insertClosingBrace = Preferences.getEditorTyping( + "Ruby/InsertClosingBrace") + self.__indentBrace = Preferences.getEditorTyping( + "Ruby/IndentBrace") + self.__skipBrace = Preferences.getEditorTyping( + "Ruby/SkipBrace") + self.__insertQuote = Preferences.getEditorTyping( + "Ruby/InsertQuote") + self.__insertBlank = Preferences.getEditorTyping( + "Ruby/InsertBlank") + self.__insertHereDoc = Preferences.getEditorTyping( + "Ruby/InsertHereDoc") + self.__insertInlineDoc = Preferences.getEditorTyping( + "Ruby/InsertInlineDoc") def charAdded(self, charNumber): """ @@ -70,11 +70,13 @@ line, col = self.editor.getCursorPosition() - if self.__inComment(line, col) or \ - self.__inDoubleQuotedString() or \ - self.__inSingleQuotedString() or \ - self.__inHereDocument() or \ - self.__inInlineDocument(): + if ( + self.__inComment(line, col) or + self.__inDoubleQuotedString() or + self.__inSingleQuotedString() or + self.__inHereDocument() or + self.__inInlineDocument() + ): return # open parenthesis