--- a/eric6/ViewManager/ViewManager.py Mon Sep 09 18:52:08 2019 +0200 +++ b/eric6/ViewManager/ViewManager.py Thu Oct 03 11:12:10 2019 +0200 @@ -7,15 +7,18 @@ Module implementing the viewmanager base class. """ -from __future__ import unicode_literals import os -from PyQt5.QtCore import pyqtSignal, pyqtSlot, QSignalMapper, QTimer, \ - QFileInfo, QRegExp, Qt, QCoreApplication, QPoint +from PyQt5.QtCore import ( + pyqtSignal, pyqtSlot, QSignalMapper, QTimer, QFileInfo, QRegExp, Qt, + QCoreApplication, QPoint +) from PyQt5.QtGui import QColor, QKeySequence, QPalette, QPixmap -from PyQt5.QtWidgets import QLineEdit, QToolBar, QWidgetAction, QDialog, \ - QApplication, QMenu, QComboBox, QWidget +from PyQt5.QtWidgets import ( + QLineEdit, QToolBar, QWidgetAction, QDialog, QApplication, QMenu, + QComboBox, QWidget +) from PyQt5.Qsci import QsciScintilla from E5Gui.E5Application import e5App @@ -339,6 +342,8 @@ """ raise RuntimeError('Not implemented') + return False + def canTile(self): """ Public method to signal if tiling of managed windows is available. @@ -348,6 +353,8 @@ """ raise RuntimeError('Not implemented') + return False + def tile(self): """ Public method to tile the managed windows. @@ -373,6 +380,8 @@ """ raise RuntimeError('Not implemented') + return None # __IGNORE_WARNING_M831__ + def _removeAllViews(self): """ Protected method to remove all views (i.e. windows). @@ -1063,7 +1072,7 @@ QKeySequence(QCoreApplication.translate( 'ViewManager', "Ctrl+J", "Edit|Join Lines")), 0, - self.copyActGrp, 'vm_edit_join_lines') + self.editActGrp, 'vm_edit_join_lines') self.joinAct.setStatusTip(QCoreApplication.translate( 'ViewManager', 'Join Lines')) self.joinAct.setWhatsThis(QCoreApplication.translate( @@ -5441,8 +5450,10 @@ self.sbZoom.setEnabled(True) self.sbZoom.setValue(now.getZoom()) - if not isinstance(now, (Editor, Shell)) and \ - now is not self.quickFindtextCombo: + if ( + not isinstance(now, (Editor, Shell)) and + now is not self.quickFindtextCombo + ): self.searchActGrp.setEnabled(False) if now is self.quickFindtextCombo: @@ -5681,8 +5692,9 @@ # first we have to check if quick search is active # and try to activate it if not if self.__quickSearchToolbarVisibility is None: - self.__quickSearchToolbarVisibility = \ + self.__quickSearchToolbarVisibility = ( self.__quickSearchToolbar.isVisible() + ) if not self.__quickSearchToolbar.isVisible(): self.__quickSearchToolbar.show() if not self.quickFindtextCombo.lineEdit().hasFocus(): @@ -5752,8 +5764,9 @@ # first we have to check if quick search is active # and try to activate it if not if self.__quickSearchToolbarVisibility is None: - self.__quickSearchToolbarVisibility = \ + self.__quickSearchToolbarVisibility = ( self.__quickSearchToolbar.isVisible() + ) if not self.__quickSearchToolbar.isVisible(): self.__quickSearchToolbar.show() if not self.quickFindtextCombo.lineEdit().hasFocus(): @@ -6549,10 +6562,13 @@ dictionaryFile, str(err))) return - fileInfo = dictionaryFile if len(dictionaryFile) < 40 \ + fileInfo = ( + dictionaryFile if len(dictionaryFile) < 40 else "...{0}".format(dictionaryFile[-40:]) - from QScintilla.SpellingDictionaryEditDialog import \ + ) + from QScintilla.SpellingDictionaryEditDialog import ( SpellingDictionaryEditDialog + ) dlg = SpellingDictionaryEditDialog( data, QCoreApplication.translate('ViewManager', "Editing {0}") @@ -6709,8 +6725,10 @@ self.astViewerAct.setEnabled(True) # activate the autosave timer - if not self.autosaveTimer.isActive() and \ - self.autosaveInterval > 0: + if ( + not self.autosaveTimer.isActive() and + self.autosaveInterval > 0 + ): self.autosaveTimer.start(self.autosaveInterval * 60000) def __autosave(self): @@ -6870,11 +6888,15 @@ # reload the autosave timer setting self.autosaveInterval = Preferences.getEditor("AutosaveInterval") if len(self.editors): - if self.autosaveTimer.isActive() and \ - self.autosaveInterval == 0: + if ( + self.autosaveTimer.isActive() and + self.autosaveInterval == 0 + ): self.autosaveTimer.stop() - elif not self.autosaveTimer.isActive() and \ - self.autosaveInterval > 0: + elif ( + not self.autosaveTimer.isActive() and + self.autosaveInterval > 0 + ): self.autosaveTimer.start(self.autosaveInterval * 60000) self.__enableSpellingActions() @@ -6990,8 +7012,10 @@ cursor is not at the end of the line. """ focusWidget = QApplication.focusWidget() - if focusWidget == e5App().getObject("Shell") or \ - focusWidget == self.quickFindtextCombo: + if ( + focusWidget == e5App().getObject("Shell") or + focusWidget == self.quickFindtextCombo + ): return else: aw = self.activeWindow() @@ -7093,8 +7117,10 @@ @return name of directory to start (string) """ # if we have an active source, return its path - if self.activeWindow() is not None and \ - self.activeWindow().getFileName(): + if ( + self.activeWindow() is not None and + self.activeWindow().getFileName() + ): return os.path.dirname(self.activeWindow().getFileName()) # check, if there is an active project and return its path @@ -7102,8 +7128,10 @@ return e5App().getObject("Project").ppath else: - return Preferences.getMultiProject("Workspace") or \ + return ( + Preferences.getMultiProject("Workspace") or Utilities.getHomeDir() + ) def _getOpenFileFilter(self): """ @@ -7115,8 +7143,10 @@ @return name of the filename filter (string) or None """ - if self.activeWindow() is not None and \ - self.activeWindow().getFileName(): + if ( + self.activeWindow() is not None and + self.activeWindow().getFileName() + ): ext = os.path.splitext(self.activeWindow().getFileName())[1] rx = QRegExp(r".*\*\.{0}[ )].*".format(ext[1:])) import QScintilla.Lexers