Mon, 07 Nov 2022 17:19:58 +0100
Corrected/acknowledged some bad import style and removed some obsolete code.
--- a/eric7.epj Sun Nov 06 11:22:39 2022 +0100 +++ b/eric7.epj Mon Nov 07 17:19:58 2022 +0100 @@ -62,7 +62,7 @@ "CopyrightAuthor": "", "CopyrightMinFileSize": 0, "DocstringType": "eric_black", - "EnabledCheckerCategories": "C, D, E, M, N, Y, W", + "EnabledCheckerCategories": "C, D, E, I, M, N, Y, W", "ExcludeFiles": "*/ThirdParty/*, */coverage/*, */Ui_*.py, */Examples/*, */pycodestyle.py,*/pyflakes/checker.py,*/mccabe.py,*/eradicate.py,*/ast_unparse.py,*/piplicenses.py,*/pipdeptree.py", "ExcludeMessages": "C101,E203,E265,E266,E305,E402,M201,M301,M302,M303,M304,M305,M306,M307,M308,M311,M312,M313,M314,M315,M321,M701,M702,M811,M834,N802,N803,N807,N808,N821,W293,W503,Y119,Y401,Y402", "FixCodes": "", @@ -70,10 +70,15 @@ "FutureChecker": "", "HangClosing": false, "ImportsChecker": { - "ApplicationPackageNames": [], + "ApplicationPackageNames": [ + "eric7" + ], "BanRelativeImports": "", "BannedModules": [], + "CombinedAsImports": true, "SortCaseSensitive": false, + "SortFromFirst": false, + "SortIgnoringStyle": false, "SortOrder": "natural" }, "IncludeMessages": "", @@ -1000,6 +1005,7 @@ "ExcludeFiles": "*/ThirdParty/*, */coverage/*, Ui_*.py, *_rc.py" }, "isort": { + "combine_as_imports": true, "config_source": "project", "extend_skip_glob": [ "*/Examples/*",
--- a/pyproject.toml Sun Nov 06 11:22:39 2022 +0100 +++ b/pyproject.toml Mon Nov 07 17:19:58 2022 +0100 @@ -199,6 +199,7 @@ "*/piplicenses.py", "*/pipdeptree.py", ] +combine_as_imports = true # #known_first_party = ["eric7"] #import_heading_stdlib = "Standard Library"
--- a/scripts/create_windows_links.py Sun Nov 06 11:22:39 2022 +0100 +++ b/scripts/create_windows_links.py Mon Nov 07 17:19:58 2022 +0100 @@ -13,6 +13,12 @@ import os import sys +try: + import winreg +except ImportError: + print("This script is to be used on Windows platforms only. Aborting...") + sys.exit(1) + from eric7.Globals import getConfig @@ -70,11 +76,6 @@ @rtype any """ try: - import winreg - except ImportError: - return None - - try: registryKey = winreg.OpenKey(winreg.HKEY_CURRENT_USER, path, 0, winreg.KEY_READ) value, _ = winreg.QueryValueEx(registryKey, name) winreg.CloseKey(registryKey) @@ -168,4 +169,4 @@ raise # -# eflag: noqa = M801 +# eflag: noqa = M801, I102
--- a/scripts/install-debugclients.py Sun Nov 06 11:22:39 2022 +0100 +++ b/scripts/install-debugclients.py Mon Nov 07 17:19:58 2022 +0100 @@ -14,11 +14,13 @@ import compileall import contextlib import fnmatch +import getopt import io import os import re import shutil import sys +import sysconfig # Define the globals. progName = None @@ -86,8 +88,6 @@ """ global modDir, pyModDir - import sysconfig - modDir = sysconfig.get_path("platlib") pyModDir = modDir @@ -227,8 +227,6 @@ @param argv the list of command line arguments. """ - import getopt - # Parse the command line. global progName, modDir, doCleanup, doCompile, distDir global sourceDir, eric7SourceDir
--- a/scripts/install-i18n.py Sun Nov 06 11:22:39 2022 +0100 +++ b/scripts/install-i18n.py Mon Nov 07 17:19:58 2022 +0100 @@ -9,6 +9,7 @@ Installation script for the eric IDE translation files. """ +import getopt import glob import os import shutil @@ -90,8 +91,6 @@ @param argv list of command line arguments (list of strings) """ - import getopt - # Parse the command line. global progName, privateInstall progName = os.path.basename(argv[0])
--- a/scripts/install.py Sun Nov 06 11:22:39 2022 +0100 +++ b/scripts/install.py Mon Nov 07 17:19:58 2022 +0100 @@ -13,6 +13,7 @@ import contextlib import datetime import fnmatch +import getopt import getpass import glob import io @@ -1965,7 +1966,7 @@ @rtype any """ try: - import winreg + import winreg # __IGNORE_WARNING_I103__ except ImportError: return None @@ -2074,8 +2075,6 @@ @param argv list of command line arguments @type list of str """ - import getopt - # Parse the command line. global progName, modDir, doCleanup, doCompile, distDir, cfg, apisDir global sourceDir, eric7SourceDir, configName @@ -2317,4 +2316,4 @@ raise # -# eflag: noqa = M801 +# eflag: noqa = M801, I101, I102
--- a/scripts/uninstall-debugclients.py Sun Nov 06 11:22:39 2022 +0100 +++ b/scripts/uninstall-debugclients.py Mon Nov 07 17:19:58 2022 +0100 @@ -11,6 +11,7 @@ """ import contextlib +import getopt import os import shutil import sys @@ -90,8 +91,6 @@ @param argv the list of command line arguments. """ - import getopt - initGlobals() # Parse the command line.
--- a/scripts/uninstall.py Sun Nov 06 11:22:39 2022 +0100 +++ b/scripts/uninstall.py Mon Nov 07 17:19:58 2022 +0100 @@ -11,6 +11,7 @@ """ import contextlib +import getopt import glob import os import shutil @@ -386,7 +387,7 @@ Remove the eric configuration directory. """ try: - from PyQt6.QtCore import QSettings + from PyQt6.QtCore import QSettings # __IGNORE_WARNING_I10__ except ImportError: print("No PyQt variant installed. The configuration directory") print("cannot be determined. You have to remove it manually.\n") @@ -432,7 +433,7 @@ @rtype any """ # From http://stackoverflow.com/a/35286642 - import winreg + import winreg # __IGNORE_WARNING_I103__ try: registryKey = winreg.OpenKey(winreg.HKEY_CURRENT_USER, path, 0, winreg.KEY_READ) @@ -478,8 +479,6 @@ @param argv list of command line arguments """ - import getopt - initGlobals() # Parse the command line.
--- a/src/eric7/CondaInterface/Conda.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/CondaInterface/Conda.py Mon Nov 07 17:19:58 2022 +0100 @@ -489,6 +489,8 @@ Note: only one of name or prefix must be given. """ + from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog + if name and prefix: raise RuntimeError("Only one of 'name' or 'prefix' must be given.") @@ -496,10 +498,6 @@ raise RuntimeError("One of 'name' or 'prefix' must be given.") if packages: - from eric7.UI.DeleteFilesConfirmationDialog import ( - DeleteFilesConfirmationDialog, - ) - dlg = DeleteFilesConfirmationDialog( self.parent(), self.tr("Uninstall Packages"),
--- a/src/eric7/CondaInterface/CondaPackagesWidget.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/CondaInterface/CondaPackagesWidget.py Mon Nov 07 17:19:58 2022 +0100 @@ -428,10 +428,10 @@ @param item reference to the package item @type QTreeWidgetItem """ + from .CondaPackageDetailsWidget import CondaPackageDetailsDialog + details = item.data(0, self.PackageDetailedDataRole) if details: - from .CondaPackageDetailsWidget import CondaPackageDetailsDialog - dlg = CondaPackageDetailsDialog(details, self) dlg.exec() @@ -563,9 +563,9 @@ """ Private slot to show some information about the conda installation. """ - infoDict = self.__conda.getCondaInformation() + from .CondaInfoDialog import CondaInfoDialog - from .CondaInfoDialog import CondaInfoDialog + infoDict = self.__conda.getCondaInformation() dlg = CondaInfoDialog(infoDict, self) dlg.exec() @@ -620,14 +620,14 @@ """ Private slot to generate a requirements file. """ + from .CondaExportDialog import CondaExportDialog + prefix = self.environmentsComboBox.itemData( self.environmentsComboBox.currentIndex() ) if prefix: env = self.environmentsComboBox.currentText() - from .CondaExportDialog import CondaExportDialog - self.__requirementsDialog = CondaExportDialog(self.__conda, env, prefix) self.__requirementsDialog.show() QApplication.processEvents()
--- a/src/eric7/Cooperation/ChatWidget.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Cooperation/ChatWidget.py Mon Nov 07 17:19:58 2022 +0100 @@ -402,9 +402,9 @@ @param fileName project relative file name of the editor (string) @param message command message (string) """ - self.editorCommand.emit(hashStr, fileName, message) + from eric7.QScintilla.Editor import Editor - from eric7.QScintilla.Editor import Editor + self.editorCommand.emit(hashStr, fileName, message) if message.startswith( Editor.StartEditToken + Editor.Separator
--- a/src/eric7/CycloneDXInterface/CycloneDXUtilities.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/CycloneDXInterface/CycloneDXUtilities.py Mon Nov 07 17:19:58 2022 +0100 @@ -21,8 +21,11 @@ from cyclonedx.model.bom import Bom from cyclonedx.model.component import Component from cyclonedx.model.vulnerability import Vulnerability, VulnerabilitySource -from cyclonedx.output import OutputFormat, SchemaVersion -from cyclonedx.output import get_instance as get_output_instance +from cyclonedx.output import ( + OutputFormat, + SchemaVersion, + get_instance as get_output_instance, +) from cyclonedx.parser import BaseParser from cyclonedx_py.parser.pipenv import PipEnvFileParser from cyclonedx_py.parser.poetry import PoetryFileParser @@ -278,11 +281,11 @@ """ # add a Tool entry for eric7 try: - from importlib.metadata import version as meta_version + from importlib.metadata import version as meta_version # __IGNORE_WARNING_I10__ __EricToolVersion = str(meta_version("eric-ide")) except Exception: - from eric7.UI.Info import Version + from eric7.UI.Info import Version # __IGNORE_WARNING_I101__ __EricToolVersion = Version
--- a/src/eric7/DataViews/PyCoverageDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/DataViews/PyCoverageDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -10,8 +10,6 @@ import os import time -from coverage import Coverage -from coverage.misc import CoverageException from PyQt6.QtCore import Qt, QUrl, pyqtSignal, pyqtSlot from PyQt6.QtGui import QDesktopServices from PyQt6.QtWidgets import ( @@ -24,6 +22,8 @@ ) from eric7 import Utilities +from eric7.DebugClients.Python.coverage import Coverage +from eric7.DebugClients.Python.coverage.misc import CoverageException from eric7.EricWidgets import EricMessageBox from eric7.EricWidgets.EricApplication import ericApp
--- a/src/eric7/DebugClients/Python/DebugBase.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/DebugClients/Python/DebugBase.py Mon Nov 07 17:19:58 2022 +0100 @@ -168,7 +168,7 @@ with contextlib.suppress(ImportError, AttributeError): if "__pypy__" in sys.builtin_module_names: - import __pypy__ + import __pypy__ # __IGNORE_WARNING_I10__ __pypy__.locals_to_fast(cf) return @@ -466,7 +466,7 @@ @type bool """ if globalsDict is None: - import __main__ + import __main__ # __IGNORE_WARNING_I10__ globalsDict = __main__.__dict__
--- a/src/eric7/DebugClients/Python/DebugClientBase.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/DebugClients/Python/DebugClientBase.py Mon Nov 07 17:19:58 2022 +0100 @@ -15,6 +15,7 @@ import json import os import re +import runpy import select import signal import socket @@ -530,7 +531,7 @@ ) elif method == "RequestCoverage": - from coverage import Coverage + from coverage import Coverage # __IGNORE_WARNING_I10__ self.disassembly = None sys.argv = [] @@ -576,7 +577,7 @@ elif method == "RequestProfile": sys.setprofile(None) - import PyProfile + import PyProfile # __IGNORE_WARNING_I10__ self.disassembly = None sys.argv = [] @@ -1939,8 +1940,6 @@ if codeStr: code = self.__compileCommand(codeStr) elif scriptModule: - import runpy - modName, modSpec, code = runpy._get_module_details(scriptModule) self.running = code.co_filename self.debugMod.__dict__.clear()
--- a/src/eric7/DebugClients/Python/DebugVariables.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/DebugClients/Python/DebugVariables.py Mon Nov 07 17:19:58 2022 +0100 @@ -807,21 +807,21 @@ # array.array may not be imported (yet) if _TryArray and "array" in sys.modules: - import array + import array # __IGNORE_WARNING_I10__ _TypeMap.append((array.array, arrayResolver)) _TryArray = False # numpy may not be imported (yet) if _TryNumpy and "numpy" in sys.modules: - import numpy + import numpy # __IGNORE_WARNING_I10__ _TypeMap.append((numpy.ndarray, ndarrayResolver)) _TryNumpy = False # django may not be imported (yet) if _TryDjango and "django" in sys.modules: - from django.utils.datastructures import MultiValueDict + from django.utils.datastructures import MultiValueDict # __IGNORE_WARNING_I10__ # it should go before dict _TypeMap.insert(0, (MultiValueDict, multiValueDictResolver))
--- a/src/eric7/DebugClients/Python/FlexCompleter.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/DebugClients/Python/FlexCompleter.py Mon Nov 07 17:19:58 2022 +0100 @@ -49,6 +49,8 @@ """ import builtins +import keyword +import re import __main__ @@ -135,8 +137,6 @@ @return A list of all keywords, built-in functions and names currently defined in self.namespace that match. """ - import keyword - matches = [] seen = {"__builtins__"} n = len(text) @@ -178,8 +178,6 @@ @param text The text to be completed. (string) @return A list of all matches. """ - import re - m = re.match(r"(\w+(\.\w+)*)\.(\w*)", text) if not m: return []
--- a/src/eric7/DebugClients/Python/MultiProcessDebugExtension.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/DebugClients/Python/MultiProcessDebugExtension.py Mon Nov 07 17:19:58 2022 +0100 @@ -9,6 +9,8 @@ """ import contextlib +import os +import sys from DebugUtilities import ( isPythonProgram, @@ -69,8 +71,6 @@ """ Function replacing the 'execl' functions of the os module. """ - import os - if _shallPatch(): args = patchArguments(_debugClient, args) if isPythonProgram(args[0]): @@ -99,8 +99,6 @@ """ Function replacing the 'execv' functions of the os module. """ - import os - if _shallPatch(): args = patchArguments(_debugClient, args) if isPythonProgram(args[0]): @@ -129,8 +127,6 @@ """ Function replacing the 'execve' functions of the os module. """ - import os - if _shallPatch(): args = patchArguments(_debugClient, args) if isPythonProgram(args[0]): @@ -159,8 +155,6 @@ """ Function replacing the 'spawnl' functions of the os module. """ - import os - args = patchArguments(_debugClient, args) return getattr(os, originalName)(mode, path, *args) @@ -186,8 +180,6 @@ """ Function replacing the 'spawnv' functions of the os module. """ - import os - args = patchArguments(_debugClient, args) return getattr(os, originalName)(mode, path, args) @@ -213,8 +205,6 @@ """ Function replacing the 'spawnve' functions of the os module. """ - import os - args = patchArguments(_debugClient, args) return getattr(os, originalName)(mode, path, args, env) @@ -242,8 +232,6 @@ """ Function replacing the 'posix_spawn' functions of the os module. """ - import os - argv = patchArguments(_debugClient, argv) return getattr(os, originalName)(path, argv, env, **kwargs) @@ -270,7 +258,7 @@ Function replacing the 'fork_exec' functions of the _posixsubprocess module. """ - import _posixsubprocess + import _posixsubprocess # __IGNORE_WARNING_I103__ if _shallPatch(): args = patchArguments(_debugClient, args) @@ -297,9 +285,6 @@ """ Function replacing the 'fork' function of the os module. """ - import os - import sys - # A simple fork will result in a new python process isNewPythonProcess = True frame = sys._getframe() @@ -377,9 +362,9 @@ or _winapi module. """ try: - import _subprocess + import _subprocess # __IGNORE_WARNING_I10__ except ImportError: - import _winapi as _subprocess + import _winapi as _subprocess # __IGNORE_WARNING_I10__ return getattr(_subprocess, originalName)( appName, patchArgumentStringWindows(_debugClient, cmdline), *args ) @@ -403,9 +388,6 @@ # return without patching return - import os - import sys - # patch 'os.exec...()' functions # - patchModule(os, "execl", createExecl) # - patchModule(os, "execle", createExecl) @@ -432,14 +414,14 @@ if isWindowsPlatform(): try: - import _subprocess + import _subprocess # __IGNORE_WARNING_I10__ except ImportError: - import _winapi as _subprocess + import _winapi as _subprocess # __IGNORE_WARNING_I10__ patchModule(_subprocess, "CreateProcess", createCreateProcess) else: patchModule(os, "fork", createFork) with contextlib.suppress(ImportError): - import _posixsubprocess + import _posixsubprocess # __IGNORE_WARNING_I10__ patchModule(_posixsubprocess, "fork_exec", createForkExec)
--- a/src/eric7/DebugClients/Python/eric7dbgstub.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/DebugClients/Python/eric7dbgstub.py Mon Nov 07 17:19:58 2022 +0100 @@ -35,7 +35,7 @@ res = True try: if kind == "standard": - import DebugClient + import DebugClient # __IGNORE_WARNING_I10__ debugger = DebugClient.DebugClient() else:
--- a/src/eric7/DebugClients/Python/getpass.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/DebugClients/Python/getpass.py Mon Nov 07 17:19:58 2022 +0100 @@ -13,6 +13,13 @@ is to provide a debugger compatible variant of the a.m. functions. """ +import os + +try: + import pwd +except ImportError: + pwd = None + __all__ = ["getpass", "getuser"] @@ -28,17 +35,16 @@ """ # this is copied from the original getpass.py - import os - for name in ("LOGNAME", "USER", "LNAME", "USERNAME"): user = os.environ.get(name) if user: return user # If this fails, the exception will "explain" why - import pwd + if pwd: + return pwd.getpwuid(os.getuid())[0] - return pwd.getpwuid(os.getuid())[0] + return "<unknown" def getpass(prompt="Password: ", stream=None):
--- a/src/eric7/Debugger/BreakPointViewer.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Debugger/BreakPointViewer.py Mon Nov 07 17:19:58 2022 +0100 @@ -304,6 +304,8 @@ @param index index of breakpoint to be edited @type QModelIndex """ + from .EditBreakpointDialog import EditBreakpointDialog + sindex = self.__toSourceIndex(index) if sindex.isValid(): bp = self.__model.getBreakPointByIndex(sindex) @@ -313,8 +315,6 @@ fn, line, cond, temp, enabled, count = bp[:6] fnHistory, condHistory = self.__loadRecent() - from .EditBreakpointDialog import EditBreakpointDialog - dlg = EditBreakpointDialog( (fn, line), (cond, temp, enabled, count), condHistory, self, modal=True )
--- a/src/eric7/Debugger/DebugUI.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Debugger/DebugUI.py Mon Nov 07 17:19:58 2022 +0100 @@ -1681,6 +1681,8 @@ @param debuggerId ID of the debugger backend @type str """ + from .EditBreakpointDialog import EditBreakpointDialog + EricMessageBox.critical( self.ui, self.tr("Breakpoint Condition Error"), @@ -1709,8 +1711,6 @@ else [] ) - from .EditBreakpointDialog import EditBreakpointDialog - dlg = EditBreakpointDialog( (fn, line), (cond, temp, enabled, count), condHistory, self.ui, modal=True ) @@ -1739,6 +1739,8 @@ @param debuggerId ID of the debugger backend @type str """ + from .EditWatchpointDialog import EditWatchpointDialog + EricMessageBox.critical( self.ui, self.tr("Watch Expression Error"), @@ -1759,8 +1761,6 @@ cond, special, temp, enabled, count = wp[:5] - from .EditWatchpointDialog import EditWatchpointDialog - dlg = EditWatchpointDialog((cond, temp, enabled, count, special), self.ui) if dlg.exec() == QDialog.DialogCode.Accepted: cond, temp, enabled, count, special = dlg.getData()
--- a/src/eric7/Debugger/DebugViewer.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Debugger/DebugViewer.py Mon Nov 07 17:19:58 2022 +0100 @@ -42,6 +42,14 @@ from eric7 import Preferences from eric7.EricGui import EricPixmapCache from eric7.EricWidgets.EricTabWidget import EricTabWidget +from eric7.UI.PythonDisViewer import PythonDisViewer, PythonDisViewerModes + +from .BreakPointViewer import BreakPointViewer +from .CallStackViewer import CallStackViewer +from .CallTraceViewer import CallTraceViewer +from .ExceptionLogger import ExceptionLogger +from .VariablesViewer import VariablesViewer +from .WatchPointViewer import WatchPointViewer class DebugViewer(QWidget): @@ -122,8 +130,6 @@ self.__tabWidget = EricTabWidget() self.__mainSplitter.addWidget(self.__tabWidget) - from .VariablesViewer import VariablesViewer - # add the global variables viewer self.gvvWidget = QWidget() self.gvvWidgetVLayout = QVBoxLayout(self.gvvWidget) @@ -257,8 +263,6 @@ self.preferencesChanged.connect(self.globalsViewer.preferencesChanged) self.preferencesChanged.connect(self.localsViewer.preferencesChanged) - from .CallStackViewer import CallStackViewer - # add the call stack viewer self.callStackViewer = CallStackViewer(self.debugServer) index = self.__tabWidget.addTab( @@ -268,8 +272,6 @@ self.callStackViewer.sourceFile.connect(self.sourceFile) self.callStackViewer.frameSelected.connect(self.__callStackFrameSelected) - from .CallTraceViewer import CallTraceViewer - # add the call trace viewer self.callTraceViewer = CallTraceViewer(self.debugServer, self) index = self.__tabWidget.addTab( @@ -280,8 +282,6 @@ ) self.callTraceViewer.sourceFile.connect(self.sourceFile) - from .BreakPointViewer import BreakPointViewer - # add the breakpoint viewer self.breakpointViewer = BreakPointViewer() self.breakpointViewer.setModel(self.debugServer.getBreakPointModel()) @@ -293,8 +293,6 @@ ) self.breakpointViewer.sourceFile.connect(self.sourceFile) - from .WatchPointViewer import WatchPointViewer - # add the watch expression viewer self.watchpointViewer = WatchPointViewer() self.watchpointViewer.setModel(self.debugServer.getWatchPointModel()) @@ -305,8 +303,6 @@ index, self.tr("Shows a list of defined watchpoints.") ) - from .ExceptionLogger import ExceptionLogger - # add the exception logger self.exceptionLogger = ExceptionLogger() index = self.__tabWidget.addTab( @@ -316,8 +312,6 @@ index, self.tr("Shows a list of raised exceptions.") ) - from eric7.UI.PythonDisViewer import PythonDisViewer, PythonDisViewerModes - # add the Python disassembly viewer self.disassemblyViewer = PythonDisViewer( None, mode=PythonDisViewerModes.TRACEBACK
--- a/src/eric7/Debugger/DebuggerInterfacePython.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Debugger/DebuggerInterfacePython.py Mon Nov 07 17:19:58 2022 +0100 @@ -8,6 +8,7 @@ """ import contextlib +import json import logging import os import shlex @@ -1368,8 +1369,6 @@ @param sock reference to the socket the data was received from @type QTcpSocket """ - import json - try: commandDict = json.loads(jsonStr.strip()) except (TypeError, ValueError) as err: @@ -1590,8 +1589,6 @@ debuggerId is not given) @type QTcpSocket """ - import json - commandDict = { "jsonrpc": "2.0", "method": command,
--- a/src/eric7/Debugger/StartDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Debugger/StartDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -109,19 +109,25 @@ self.dialogType = dialogType if dialogType == 0: - from .Ui_StartDebugDialog import Ui_StartDebugDialog + from .Ui_StartDebugDialog import ( # __IGNORE_WARNING_I101__ + Ui_StartDebugDialog, + ) self.ui = Ui_StartDebugDialog() elif dialogType == 1: - from .Ui_StartRunDialog import Ui_StartRunDialog + from .Ui_StartRunDialog import Ui_StartRunDialog # __IGNORE_WARNING_I101__ self.ui = Ui_StartRunDialog() elif dialogType == 2: - from .Ui_StartCoverageDialog import Ui_StartCoverageDialog + from .Ui_StartCoverageDialog import ( # __IGNORE_WARNING_I101__ + Ui_StartCoverageDialog, + ) self.ui = Ui_StartCoverageDialog() elif dialogType == 3: - from .Ui_StartProfileDialog import Ui_StartProfileDialog + from .Ui_StartProfileDialog import ( # __IGNORE_WARNING_I101__ + Ui_StartProfileDialog, + ) self.ui = Ui_StartProfileDialog() self.ui.setupUi(self) @@ -358,6 +364,8 @@ """ Private slot to edit a history list. """ + from .StartHistoryEditDialog import StartHistoryEditDialog + histories = [ "", self.tr("Script Name"), @@ -395,8 +403,6 @@ history = [combo.itemText(idx) for idx in range(combo.count())] if history: - from .StartHistoryEditDialog import StartHistoryEditDialog - dlg = StartHistoryEditDialog(history, self) if dlg.exec() == QDialog.DialogCode.Accepted: history = dlg.getHistory()
--- a/src/eric7/Debugger/VariablesViewer.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Debugger/VariablesViewer.py Mon Nov 07 17:19:58 2022 +0100 @@ -628,11 +628,8 @@ indentation = 0 # Check if text is longer than available space fontMetrics = QFontMetrics(self.treeView.font()) - try: - textSize = fontMetrics.horizontalAdvance(tooltip) - except AttributeError: - textSize = fontMetrics.width(tooltip) - textSize += indentation + 5 # How to determine border size? + textSize = fontMetrics.horizontalAdvance(tooltip) + indentation + 5 + # How to determine border size? header = self.treeView.header() if textSize >= header.sectionSize(column): return tooltip @@ -1115,6 +1112,8 @@ @param index reference to the variable item @type QModelIndex """ + from .VariableDetailDialog import VariableDetailDialog + node = self.proxyModel.mapToSource(index).internalPointer() val = node.value @@ -1149,8 +1148,6 @@ name = "".join(nlist) # now show the dialog - from .VariableDetailDialog import VariableDetailDialog - dlg = VariableDetailDialog(name, vtype, val) dlg.exec()
--- a/src/eric7/Debugger/WatchPointViewer.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Debugger/WatchPointViewer.py Mon Nov 07 17:19:58 2022 +0100 @@ -285,6 +285,8 @@ @param index index of watch expression to be edited (QModelIndex) """ + from .EditWatchpointDialog import EditWatchpointDialog + sindex = self.__toSourceIndex(index) if sindex.isValid(): wp = self.__model.getWatchPointByIndex(sindex) @@ -293,8 +295,6 @@ cond, special, temp, enabled, count = wp[:5] - from .EditWatchpointDialog import EditWatchpointDialog - dlg = EditWatchpointDialog((cond, temp, enabled, count, special), self) if dlg.exec() == QDialog.DialogCode.Accepted: cond, temp, enabled, count, special = dlg.getData()
--- a/src/eric7/EricGraphics/EricGraphicsView.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/EricGraphics/EricGraphicsView.py Mon Nov 07 17:19:58 2022 +0100 @@ -11,6 +11,7 @@ from PyQt6.QtCore import QRectF, QSize, QSizeF, Qt, pyqtSignal from PyQt6.QtGui import QBrush, QColor, QFont, QPainter, QPixmap +from PyQt6.QtSvg import QSvgGenerator from PyQt6.QtWidgets import QGraphicsView from eric7 import Preferences @@ -326,8 +327,6 @@ paintDevice = QPixmap(int(rect.width()), int(rect.height())) paintDevice.fill(self.backgroundBrush().color()) else: - from PyQt6.QtSvg import QSvgGenerator - paintDevice = QSvgGenerator() paintDevice.setResolution(100) # 100 dpi paintDevice.setSize(QSize(int(rect.width()), int(rect.height())))
--- a/src/eric7/EricNetwork/EricNetworkProxyFactory.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/EricNetwork/EricNetworkProxyFactory.py Mon Nov 07 17:19:58 2022 +0100 @@ -44,12 +44,12 @@ @param proxy reference to the proxy object (QNetworkProxy) @param auth reference to the authenticator object (QAuthenticator) """ + from eric7.UI.AuthenticationDialog import AuthenticationDialog + info = QCoreApplication.translate( "EricNetworkProxyFactory", "<b>Connect to proxy '{0}' using:</b>" ).format(Utilities.html_encode(proxy.hostName())) - from eric7.UI.AuthenticationDialog import AuthenticationDialog - dlg = AuthenticationDialog(info, proxy.user(), True) dlg.setData(proxy.user(), proxy.password()) if dlg.exec() == QDialog.DialogCode.Accepted:
--- a/src/eric7/EricNetwork/EricSslCertificateSelectionDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/EricNetwork/EricSslCertificateSelectionDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -114,7 +114,7 @@ Private slot to show data of the selected certificate. """ with contextlib.suppress(ImportError): - from eric7.EricNetwork.EricSslCertificatesInfoDialog import ( + from eric7.EricNetwork.EricSslCertificatesInfoDialog import ( # __IGNORE_WARNING__ EricSslCertificatesInfoDialog, )
--- a/src/eric7/EricNetwork/EricSslCertificatesDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/EricNetwork/EricSslCertificatesDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -121,7 +121,7 @@ Private slot to show data of the selected server certificate. """ with contextlib.suppress(ImportError): - from eric7.EricNetwork.EricSslCertificatesInfoDialog import ( + from eric7.EricNetwork.EricSslCertificatesInfoDialog import ( # __IGNORE_WARNING__ EricSslCertificatesInfoDialog, ) @@ -340,7 +340,7 @@ Private slot to show data of the selected CA certificate. """ with contextlib.suppress(ImportError): - from eric7.EricNetwork.EricSslCertificatesInfoDialog import ( + from eric7.EricNetwork.EricSslCertificatesInfoDialog import ( # __IGNORE_WARNING__ EricSslCertificatesInfoDialog, )
--- a/src/eric7/EricNetwork/EricSslUtilities.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/EricNetwork/EricSslUtilities.py Mon Nov 07 17:19:58 2022 +0100 @@ -13,7 +13,7 @@ Function to initialize some global SSL stuff. """ try: - from PyQt6.QtNetwork import QSslConfiguration + from PyQt6.QtNetwork import QSslConfiguration # __IGNORE_WARNING_I10__ except ImportError: # no SSL available, so there is nothing to initialize return
--- a/src/eric7/EricWidgets/EricModelMenu.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/EricWidgets/EricModelMenu.py Mon Nov 07 17:19:58 2022 +0100 @@ -272,10 +272,7 @@ """ fm = QFontMetrics(self.font()) if self.__maxWidth == -1: - try: - self.__maxWidth = fm.horizontalAdvance("m") * 30 - except AttributeError: - self.__maxWidth = fm.width("m") * 30 + self.__maxWidth = fm.horizontalAdvance("m") * 30 smallText = fm.elidedText(text, Qt.TextElideMode.ElideMiddle, self.__maxWidth) return QAction(icon, smallText, parent)
--- a/src/eric7/EricWidgets/EricSqueezeLabels.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/EricWidgets/EricSqueezeLabels.py Mon Nov 07 17:19:58 2022 +0100 @@ -37,10 +37,7 @@ @param event reference to the paint event (QPaintEvent) """ fm = self.fontMetrics() - try: - pixelLength = fm.horizontalAdvance(self.__text) - except AttributeError: - pixelLength = fm.width(self.__text) + pixelLength = fm.horizontalAdvance(self.__text) if pixelLength > self.contentsRect().width(): self.__elided = fm.elidedText( self.text(), Qt.TextElideMode.ElideMiddle, self.width() @@ -131,7 +128,4 @@ @return length of the wrapped text in pixels (integer) """ fm = self.fontMetrics() - try: - return fm.horizontalAdvance(self.__surrounding.format(txt)) - except AttributeError: - return fm.width(self.__surrounding.format(txt)) + return fm.horizontalAdvance(self.__surrounding.format(txt))
--- a/src/eric7/EricWidgets/EricTextEditSearchWidget.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/EricWidgets/EricTextEditSearchWidget.py Mon Nov 07 17:19:58 2022 +0100 @@ -443,7 +443,7 @@ @param backwards flag indicating a backwards search @type bool """ - from PyQt6.QtWebEngineCore import QWebEnginePage + from PyQt6.QtWebEngineCore import QWebEnginePage # __IGNORE_WARNING_I102__ findFlags = QWebEnginePage.FindFlag(0) if self.caseCheckBox.isChecked():
--- a/src/eric7/EricWidgets/EricZoomWidget.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/EricWidgets/EricZoomWidget.py Mon Nov 07 17:19:58 2022 +0100 @@ -287,10 +287,7 @@ ) fmtStr = "{0}%" if self.__percent else "{0}" label = fmtStr.format("0" * labelLen) - try: - width = self.valueLabel.fontMetrics().horizontalAdvance(label) - except AttributeError: - width = self.valueLabel.fontMetrics().width(label) + width = self.valueLabel.fontMetrics().horizontalAdvance(label) self.valueLabel.setMinimumWidth(width) self.valueLabel.setMaximumWidth(width)
--- a/src/eric7/EricXML/MultiProjectReader.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/EricXML/MultiProjectReader.py Mon Nov 07 17:19:58 2022 +0100 @@ -9,6 +9,8 @@ import os +from PyQt6.QtCore import QUuid + from eric7 import Utilities from .Config import multiProjectFileFormatVersion @@ -85,8 +87,6 @@ project["uid"] = uid else: # upgrade from pre 5.1 format - from PyQt6.QtCore import QUuid - project["uid"] = QUuid.createUuid().toString() project["master"] = self.toBool(self.attribute("isMaster", "False"))
--- a/src/eric7/EricXML/TasksReader.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/EricXML/TasksReader.py Mon Nov 07 17:19:58 2022 +0100 @@ -10,6 +10,8 @@ import contextlib import time +from PyQt6.QtCore import QUuid + from eric7 import Utilities from eric7.EricWidgets.EricApplication import ericApp from eric7.Tasks.Task import TaskPriority, TaskType @@ -103,8 +105,6 @@ task["uid"] = uid else: # upgrade from pre 6.0 format - from PyQt6.QtCore import QUuid - task["uid"] = QUuid.createUuid().toString() parentUid = self.attribute("parent_uid", "") expanded = self.toBool(self.attribute("expanded", "True"))
--- a/src/eric7/Globals/__init__.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Globals/__init__.py Mon Nov 07 17:19:58 2022 +0100 @@ -298,8 +298,6 @@ @return path to the PyQt6 modules directory @rtype str """ - import sysconfig - pyqtPath = os.path.join(sysconfig.get_path("platlib"), "PyQt6") if os.path.exists(pyqtPath): return pyqtPath @@ -317,6 +315,7 @@ @rtype str """ from eric7 import Preferences + from eric7.EricWidgets.EricApplication import ericApp toolsPath = "" @@ -332,8 +331,6 @@ if not toolsPath: program = "pylupdate{0}".format(version) if venvName: - from eric7.EricWidgets.EricApplication import ericApp - venvManager = ericApp().getObject("VirtualEnvManager") dirName = venvManager.getVirtualenvDirectory(venvName) else: @@ -384,7 +381,7 @@ if not binPath: with contextlib.suppress(ImportError): # if qt6-applications is not installed just go to the next step - import qt6_applications + import qt6_applications # __IGNORE_WARNING_I10__ if libexec: binPath = os.path.join( @@ -620,9 +617,9 @@ @rtype str """ try: - from eric7.eric7config import getConfig + from eric7.eric7config import getConfig # __IGNORE_WARNING_I101__ except ImportError: - from eric7config import getConfig + from eric7config import getConfig # __IGNORE_WARNING_I10__ scriptPath = os.path.join(getConfig("ericDir"), "Tools", "webBrowserSupport.py") proc = QProcess()
--- a/src/eric7/Graphics/PixmapDiagram.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Graphics/PixmapDiagram.py Mon Nov 07 17:19:58 2022 +0100 @@ -18,7 +18,7 @@ QPalette, QPixmap, ) -from PyQt6.QtPrintSupport import QPrintDialog, QPrinter +from PyQt6.QtPrintSupport import QPrintDialog, QPrinter, QPrintPreviewDialog from PyQt6.QtWidgets import QLabel, QMenu, QScrollArea, QSizePolicy, QToolBar from eric7 import Preferences @@ -377,8 +377,6 @@ """ Private slot called to show a print preview of the diagram. """ - from PyQt6.QtPrintSupport import QPrintPreviewDialog - printer = QPrinter(mode=QPrinter.PrinterMode.ScreenResolution) printer.setFullPage(True) if Preferences.getPrinter("ColorMode"):
--- a/src/eric7/Graphics/SvgDiagram.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Graphics/SvgDiagram.py Mon Nov 07 17:19:58 2022 +0100 @@ -9,7 +9,7 @@ from PyQt6.QtCore import QEvent, QMarginsF, QSize, Qt from PyQt6.QtGui import QAction, QColor, QFont, QPageLayout, QPainter, QPalette -from PyQt6.QtPrintSupport import QPrintDialog, QPrinter +from PyQt6.QtPrintSupport import QPrintDialog, QPrinter, QPrintPreviewDialog from PyQt6.QtSvgWidgets import QSvgWidget from PyQt6.QtWidgets import QMenu, QScrollArea, QSizePolicy, QToolBar @@ -335,8 +335,6 @@ """ Private slot called to show a print preview of the diagram. """ - from PyQt6.QtPrintSupport import QPrintPreviewDialog - printer = QPrinter(mode=QPrinter.PrinterMode.ScreenResolution) printer.setFullPage(True) if Preferences.getPrinter("ColorMode"):
--- a/src/eric7/Graphics/UMLDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Graphics/UMLDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -20,6 +20,12 @@ from eric7.EricWidgets.EricMainWindow import EricMainWindow from eric7.UI import Config +from .ApplicationDiagramBuilder import ApplicationDiagramBuilder +from .ImportsDiagramBuilder import ImportsDiagramBuilder +from .PackageDiagramBuilder import PackageDiagramBuilder +from .UMLClassDiagramBuilder import UMLClassDiagramBuilder +from .UMLGraphicsView import UMLGraphicsView + class UMLDialogType(enum.Enum): """ @@ -82,8 +88,6 @@ self.__project = project self.__diagramType = diagramType - from .UMLGraphicsView import UMLGraphicsView - self.scene = QGraphicsScene(0.0, 0.0, 800.0, 600.0) self.umlView = UMLGraphicsView(self.scene, parent=self) self.builder = self.__diagramBuilder(self.__diagramType, path, **kwargs) @@ -209,26 +213,18 @@ @rtype UMLDiagramBuilder """ if diagramType == UMLDialogType.CLASS_DIAGRAM: - from .UMLClassDiagramBuilder import UMLClassDiagramBuilder - return UMLClassDiagramBuilder( self, self.umlView, self.__project, path, **kwargs ) elif diagramType == UMLDialogType.PACKAGE_DIAGRAM: - from .PackageDiagramBuilder import PackageDiagramBuilder - return PackageDiagramBuilder( self, self.umlView, self.__project, path, **kwargs ) elif diagramType == UMLDialogType.IMPORTS_DIAGRAM: - from .ImportsDiagramBuilder import ImportsDiagramBuilder - return ImportsDiagramBuilder( self, self.umlView, self.__project, path, **kwargs ) elif diagramType == UMLDialogType.APPLICATION_DIAGRAM: - from .ApplicationDiagramBuilder import ApplicationDiagramBuilder - return ApplicationDiagramBuilder( self, self.umlView, self.__project, **kwargs )
--- a/src/eric7/Graphics/UMLGraphicsView.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Graphics/UMLGraphicsView.py Mon Nov 07 17:19:58 2022 +0100 @@ -11,7 +11,7 @@ from PyQt6.QtCore import QEvent, QMarginsF, QRectF, QSignalMapper, Qt, pyqtSignal from PyQt6.QtGui import QAction, QPageLayout -from PyQt6.QtPrintSupport import QPrintDialog, QPrinter +from PyQt6.QtPrintSupport import QPrintDialog, QPrinter, QPrintPreviewDialog from PyQt6.QtWidgets import QDialog, QGraphicsView, QToolBar from eric7 import Preferences @@ -21,6 +21,10 @@ from eric7.EricWidgets.EricZoomWidget import EricZoomWidget from eric7.UI import Config +from .AssociationItem import AssociationItem +from .ClassItem import ClassItem +from .ModuleItem import ModuleItem +from .PackageItem import PackageItem from .UMLItem import UMLItem @@ -466,8 +470,6 @@ """ Public slot called to show a print preview of the diagram. """ - from PyQt6.QtPrintSupport import QPrintPreviewDialog - printer = QPrinter(mode=QPrinter.PrinterMode.PrinterResolution) printer.setFullPage(True) if Preferences.getPrinter("ColorMode"): @@ -752,11 +754,6 @@ return False, 0 self.diagramName = data[0].split(": ", 1)[1].strip() - from .AssociationItem import AssociationItem - from .ClassItem import ClassItem - from .ModuleItem import ModuleItem - from .PackageItem import PackageItem - for linenum, line in enumerate(data[1:], start=1): if not line.startswith(("item:", "association:")): return False, linenum @@ -813,8 +810,6 @@ item.toDict() for item in self.filteredItems(self.scene().items(), UMLItem) ] - from .AssociationItem import AssociationItem - associations = [ assoc.toDict() for assoc in self.filteredItems(self.scene().items(), AssociationItem)
--- a/src/eric7/HelpViewer/HelpViewerWidget.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/HelpViewer/HelpViewerWidget.py Mon Nov 07 17:19:58 2022 +0100 @@ -622,12 +622,12 @@ @rtype tuple of (HelpViewerImpl, EricTextEditType) """ if WEBENGINE_AVAILABLE: - from .HelpViewerImplQWE import HelpViewerImplQWE + from .HelpViewerImplQWE import HelpViewerImplQWE # __IGNORE_WARNING_I101__ viewer = HelpViewerImplQWE(self.__helpEngine, self) viewerType = EricTextEditType.QWEBENGINEVIEW else: - from .HelpViewerImplQTB import HelpViewerImplQTB + from .HelpViewerImplQTB import HelpViewerImplQTB # __IGNORE_WARNING_I101__ viewer = HelpViewerImplQTB(self.__helpEngine, self) viewerType = EricTextEditType.QTEXTBROWSER @@ -1100,6 +1100,8 @@ """ Private method to initialize global QWebEngine related objects. """ + from eric7.WebBrowser.Network.QtHelpSchemeHandler import QtHelpSchemeHandler + self.__webProfile = QWebEngineProfile.defaultProfile() self.__webProfile.setHttpCacheType( QWebEngineProfile.HttpCacheType.MemoryHttpCache @@ -1108,8 +1110,6 @@ self.__initQWebEngineSettings() - from eric7.WebBrowser.Network.QtHelpSchemeHandler import QtHelpSchemeHandler - self.__qtHelpSchemeHandler = QtHelpSchemeHandler(self.__helpEngine) self.__webProfile.installUrlSchemeHandler( QByteArray(b"qthelp"), self.__qtHelpSchemeHandler
--- a/src/eric7/HexEdit/HexEditSearchReplaceWidget.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/HexEdit/HexEditSearchReplaceWidget.py Mon Nov 07 17:19:58 2022 +0100 @@ -69,12 +69,16 @@ self.__findHistory = mainWindow.getSRHistory("search") if replace: - from .Ui_HexEditReplaceWidget import Ui_HexEditReplaceWidget + from .Ui_HexEditReplaceWidget import ( # __IGNORE_WARNING_I101__ + Ui_HexEditReplaceWidget, + ) self.__replaceHistory = mainWindow.getSRHistory("replace") self.__ui = Ui_HexEditReplaceWidget() else: - from .Ui_HexEditSearchWidget import Ui_HexEditSearchWidget + from .Ui_HexEditSearchWidget import ( # __IGNORE_WARNING_I101__ + Ui_HexEditSearchWidget, + ) self.__ui = Ui_HexEditSearchWidget() self.__ui.setupUi(self)
--- a/src/eric7/HexEdit/HexEditWidget.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/HexEdit/HexEditWidget.py Mon Nov 07 17:19:58 2022 +0100 @@ -542,10 +542,7 @@ @type QFont """ super().setFont(font) - try: - self.__pxCharWidth = self.fontMetrics().horizontalAdvance("2") - except AttributeError: - self.__pxCharWidth = self.fontMetrics().width("2") + self.__pxCharWidth = self.fontMetrics().horizontalAdvance("2") self.__pxCharHeight = self.fontMetrics().height() self.__pxGapAdr = self.__pxCharWidth // 2 self.__pxGapAdrHex = self.__pxCharWidth
--- a/src/eric7/JediInterface/AssistantJedi.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/JediInterface/AssistantJedi.py Mon Nov 07 17:19:58 2022 +0100 @@ -14,6 +14,8 @@ from eric7 import Preferences +from .JediServer import JediServer + class AssistantJedi(QObject): """ @@ -39,8 +41,6 @@ self.__editors = [] self.__menuActions = {} - from .JediServer import JediServer - self.__jediServer = JediServer(self.__vm, project, self.__ui) self.__jediServer.activate()
--- a/src/eric7/JediInterface/JediServer.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/JediInterface/JediServer.py Mon Nov 07 17:19:58 2022 +0100 @@ -18,7 +18,7 @@ from eric7.EricNetwork.EricJsonServer import EricJsonServer from eric7.EricWidgets import EricMessageBox from eric7.EricWidgets.EricApplication import ericApp -from eric7.QScintilla.Editor import Editor +from eric7.QScintilla.Editor import Editor, ReferenceItem from .RefactoringPreviewDialog import RefactoringPreviewDialog @@ -413,8 +413,6 @@ """ euuid = result["Uuid"] with contextlib.suppress(ImportError): - from eric7.QScintilla.Editor import ReferenceItem - if "Error" not in result: # ignore errors silently references = result["GotoReferencesList"]
--- a/src/eric7/MicroPython/CircuitPythonDevices.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/MicroPython/CircuitPythonDevices.py Mon Nov 07 17:19:58 2022 +0100 @@ -231,6 +231,8 @@ """ Private slot to flash a CircuitPython firmware to the device. """ + from .UF2FlashDialog import UF2FlashDialog + lBoardName = self.microPython.getCurrentBoard().lower() if lBoardName: for name in self.__nonUF2devices: @@ -238,8 +240,6 @@ self.__nonUF2devices[name]() break else: - from .UF2FlashDialog import UF2FlashDialog - dlg = UF2FlashDialog(boardType="circuitpython") dlg.exec()
--- a/src/eric7/MicroPython/MicroPythonDevices.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/MicroPython/MicroPythonDevices.py Mon Nov 07 17:19:58 2022 +0100 @@ -12,6 +12,7 @@ import os from PyQt6.QtCore import QCoreApplication, QObject, pyqtSlot +from PyQt6.QtSerialPort import QSerialPortInfo from PyQt6.QtWidgets import QInputDialog from eric7 import Preferences @@ -282,8 +283,6 @@ list of tuples of (int, int, str), list of tuples of (int, int, str, str) """ - from PyQt6.QtSerialPort import QSerialPortInfo - foundDevices = [] unknownDevices = [] unknownPorts = [] @@ -410,27 +409,29 @@ @rtype MicroPythonDevice """ if deviceType == "esp": - from .EspDevices import EspDevice + from .EspDevices import EspDevice # __IGNORE_WARNING_I101__ return EspDevice(microPythonWidget, deviceType) elif deviceType == "circuitpython": - from .CircuitPythonDevices import CircuitPythonDevice + from .CircuitPythonDevices import CircuitPythonDevice # __IGNORE_WARNING_I101__ return CircuitPythonDevice(microPythonWidget, deviceType) elif deviceType in ("bbc_microbit", "calliope"): - from .MicrobitDevices import MicrobitDevice + from .MicrobitDevices import MicrobitDevice # __IGNORE_WARNING_I101__ return MicrobitDevice(microPythonWidget, deviceType) elif deviceType == "pyboard": - from .PyBoardDevices import PyBoardDevice + from .PyBoardDevices import PyBoardDevice # __IGNORE_WARNING_I101__ return PyBoardDevice(microPythonWidget, deviceType) elif deviceType == "rp2040": - from .RP2040Devices import RP2040Device + from .RP2040Devices import RP2040Device # __IGNORE_WARNING_I101__ return RP2040Device(microPythonWidget, deviceType) elif deviceType == "generic": - from .GenericMicroPythonDevices import GenericMicroPythonDevice + from .GenericMicroPythonDevices import ( # __IGNORE_WARNING_I101__ + GenericMicroPythonDevice, + ) return GenericMicroPythonDevice(microPythonWidget, deviceType, vid, pid) else:
--- a/src/eric7/MicroPython/MicroPythonFileManagerWidget.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/MicroPython/MicroPythonFileManagerWidget.py Mon Nov 07 17:19:58 2022 +0100 @@ -622,9 +622,9 @@ @param message message to be shown @type str """ + from .MicroPythonProgressInfoDialog import MicroPythonProgressInfoDialog + if self.__progressInfoDialog is None: - from .MicroPythonProgressInfoDialog import MicroPythonProgressInfoDialog - self.__progressInfoDialog = MicroPythonProgressInfoDialog(self) self.__progressInfoDialog.finished.connect( self.__progressInfoDialogFinished
--- a/src/eric7/MicroPython/MicroPythonWidget.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/MicroPython/MicroPythonWidget.py Mon Nov 07 17:19:58 2022 +0100 @@ -31,11 +31,13 @@ from eric7.EricGui.EricOverrideCursor import EricOverrideCursor, EricOverridenCursor from eric7.EricWidgets import EricFileDialog, EricMessageBox from eric7.EricWidgets.EricApplication import ericApp +from eric7.EricWidgets.EricListSelectionDialog import EricListSelectionDialog from eric7.EricWidgets.EricProcessDialog import EricProcessDialog from eric7.EricWidgets.EricZoomWidget import EricZoomWidget from eric7.UI.Info import BugAddress from . import MicroPythonDevices, UF2FlashDialog +from .MicroPythonFileManagerWidget import MicroPythonFileManagerWidget from .Ui_MicroPythonWidget import Ui_MicroPythonWidget try: @@ -44,7 +46,6 @@ HAS_QTCHART = True except ImportError: HAS_QTCHART = False -from .MicroPythonFileManagerWidget import MicroPythonFileManagerWidget try: from .MicroPythonCommandsInterface import MicroPythonCommandsInterface @@ -1086,10 +1087,10 @@ """ Private method to connect to the selected device. """ + from .ConnectionSelectionDialog import ConnectionSelectionDialog + port = self.getCurrentPort() if not port: - from .ConnectionSelectionDialog import ConnectionSelectionDialog - with EricOverridenCursor(): dlg = ConnectionSelectionDialog( self.__unknownPorts, self.__lastPort, self.__lastDeviceType @@ -1526,11 +1527,11 @@ """ Private slot to show all available information about a board. """ + from .BoardDataDialog import BoardDataDialog + try: boardInfo = self.__interface.getBoardInformation() - from .BoardDataDialog import BoardDataDialog - dlg = BoardDataDialog(boardInfo) dlg.exec() except Exception as exc: @@ -1883,10 +1884,6 @@ from .AddEditDevicesDialog import AddEditDevicesDialog if len(devices) > 1: - from eric7.EricWidgets.EricListSelectionDialog import ( - EricListSelectionDialog, - ) - sdlg = EricListSelectionDialog( [d[2] for d in devices], title=self.tr("Add Unknown Devices"),
--- a/src/eric7/MicroPython/UF2FlashDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/MicroPython/UF2FlashDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -12,6 +12,7 @@ import shutil from PyQt6.QtCore import QCoreApplication, QEventLoop, Qt, QThread, pyqtSlot +from PyQt6.QtSerialPort import QSerialPortInfo from PyQt6.QtWidgets import QDialog from eric7 import Utilities @@ -600,8 +601,6 @@ VID and PID @rtype list of tuple of (str, str, int, int) """ - from PyQt6.QtSerialPort import QSerialPortInfo - foundDevices = [] availablePorts = QSerialPortInfo.availablePorts()
--- a/src/eric7/MicroPython/UnknownDevicesDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/MicroPython/UnknownDevicesDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -79,12 +79,12 @@ @param item reference to the item to be edited @type QListWidgetItem """ + from .AddEditDevicesDialog import AddEditDevicesDialog + if item is None: # play it safe return - from .AddEditDevicesDialog import AddEditDevicesDialog - dlg = AddEditDevicesDialog(deviceData=item.data(self.DeviceDataRole)) if dlg.exec() == QDialog.DialogCode.Accepted: deviceDict = dlg.getDeviceDict()
--- a/src/eric7/MultiProject/AddProjectDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/MultiProject/AddProjectDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -9,7 +9,7 @@ import os -from PyQt6.QtCore import pyqtSlot +from PyQt6.QtCore import QUuid, pyqtSlot from PyQt6.QtWidgets import QDialog, QDialogButtonBox from eric7 import Preferences, Utilities @@ -86,8 +86,6 @@ """ if not self.uid: # new project entry - from PyQt6.QtCore import QUuid - self.uid = QUuid.createUuid().toString() filename = self.filenamePicker.text()
--- a/src/eric7/MultiProject/MultiProject.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/MultiProject/MultiProject.py Mon Nov 07 17:19:58 2022 +0100 @@ -21,6 +21,7 @@ from eric7.EricGui.EricOverrideCursor import EricOverrideCursor from eric7.EricWidgets import EricFileDialog, EricMessageBox, EricPathPickerDialog from eric7.EricWidgets.EricPathPickerDialog import EricPathPickerModes +from eric7.EricXML.MultiProjectReader import MultiProjectReader from eric7.Globals import recentNameMultiProject from eric7.UI import Config @@ -229,8 +230,6 @@ f = QFile(fn) if f.open(QIODevice.OpenModeFlag.ReadOnly): with EricOverrideCursor(): - from eric7.EricXML.MultiProjectReader import MultiProjectReader - reader = MultiProjectReader(f, self) reader.readXML() f.close() @@ -487,11 +486,11 @@ This method displays the new multi project dialog and initializes the multi project object with the data entered. """ + from .PropertiesDialog import PropertiesDialog + if not self.checkDirty(): return - from .PropertiesDialog import PropertiesDialog - dlg = PropertiesDialog(self, True) if dlg.exec() == QDialog.DialogCode.Accepted: self.closeMultiProject()
--- a/src/eric7/MultiProject/MultiProjectBrowser.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/MultiProject/MultiProjectBrowser.py Mon Nov 07 17:19:58 2022 +0100 @@ -356,14 +356,14 @@ """ Private method to show the data of a project entry. """ + from .AddProjectDialog import AddProjectDialog + itm = self.currentItem() if itm is not None and itm.parent() is not None: uid = itm.data(0, MultiProjectBrowser.ProjectUidRole) if uid: project = self.multiProject.getProject(uid) if project is not None: - from .AddProjectDialog import AddProjectDialog - dlg = AddProjectDialog( self, project=project,
--- a/src/eric7/Network/IRC/IrcNetworkEditDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Network/IRC/IrcNetworkEditDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -48,7 +48,7 @@ if networkName: self.__network = copy.deepcopy(self.__manager.getNetwork(networkName)) else: - from .IrcNetworkManager import IrcNetwork + from .IrcNetworkManager import IrcNetwork # __IGNORE_WARNING_I101__ self.__network = IrcNetwork("") @@ -95,9 +95,9 @@ @param currentIdentity name of the identity to select (string) """ - self.identityCombo.clear() + from .IrcNetworkManager import IrcIdentity - from .IrcNetworkManager import IrcIdentity + self.identityCombo.clear() identities = sorted(self.__manager.getIdentityNames()) identities[ @@ -221,6 +221,9 @@ @param itm reference to the item to be edited (QTreeWidgetItem) """ + from .IrcChannelEditDialog import IrcChannelEditDialog + from .IrcNetworkManager import IrcChannel + if itm: channel = self.__network.getChannel(itm.text(0)) name = channel.getName() @@ -232,12 +235,8 @@ key = "" autoJoin = False - from .IrcChannelEditDialog import IrcChannelEditDialog - dlg = IrcChannelEditDialog(name, key, autoJoin, itm is not None, self) if dlg.exec() == QDialog.DialogCode.Accepted: - from .IrcNetworkManager import IrcChannel - name, key, autoJoin = dlg.getData() channel = IrcChannel(name) channel.setKey(key)
--- a/src/eric7/Network/IRC/IrcNetworkListDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Network/IRC/IrcNetworkListDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -68,14 +68,14 @@ @param itm reference to the network entry (QTreeWidgetItem) """ + from .IrcNetworkManager import IrcIdentity + # step 1: delete all child entries children = itm.takeChildren() for child in children: del child # step 2: (re-)add the child entries - from .IrcNetworkManager import IrcIdentity - networkName = itm.text(0) network = self.__manager.getNetwork(networkName) server = network.getServer() @@ -136,10 +136,10 @@ """ Private slot to edit the selected network. """ + from .IrcNetworkEditDialog import IrcNetworkEditDialog + itm = self.networksList.selectedItems()[0] if itm: - from .IrcNetworkEditDialog import IrcNetworkEditDialog - networkName = itm.text(0) dlg = IrcNetworkEditDialog(self.__manager, networkName, self) if dlg.exec() == QDialog.DialogCode.Accepted:
--- a/src/eric7/Network/IRC/IrcWidget.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Network/IRC/IrcWidget.py Mon Nov 07 17:19:58 2022 +0100 @@ -32,6 +32,7 @@ from eric7.Globals import isMacPlatform from eric7.UI.Info import Copyright, Version +from .IrcNetworkManager import IrcNetworkManager from .Ui_IrcWidget import Ui_IrcWidget @@ -57,8 +58,6 @@ super().__init__(parent) self.setupUi(self) - from .IrcNetworkManager import IrcNetworkManager - self.__ircNetworkManager = IrcNetworkManager(self) self.__leaveButton = QToolButton(self) @@ -307,13 +306,13 @@ @param name name of the channel (string) @param key key of the channel (string) """ + from .IrcChannelWidget import IrcChannelWidget + # step 1: check, if this channel is already joined for channel in self.__channelList: if channel.name() == name: return - from .IrcChannelWidget import IrcChannelWidget - channel = IrcChannelWidget(self) channel.setName(name) channel.setUserName(self.__nickName)
--- a/src/eric7/PipInterface/Pip.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/PipInterface/Pip.py Mon Nov 07 17:19:58 2022 +0100 @@ -20,6 +20,7 @@ from eric7.EricNetwork.EricNetworkProxyFactory import proxyAuthenticationRequired from eric7.EricWidgets import EricMessageBox from eric7.EricWidgets.EricApplication import ericApp +from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog try: from eric7.EricNetwork.EricSslErrorHandler import EricSslErrorHandler @@ -505,10 +506,6 @@ """ res = False if packages and venvName: - from eric7.UI.DeleteFilesConfirmationDialog import ( - DeleteFilesConfirmationDialog, - ) - dlg = DeleteFilesConfirmationDialog( self.parent(), self.tr("Uninstall Packages"), @@ -533,9 +530,9 @@ @param venvName name of the virtual environment to be used @type str """ + from .PipFileSelectionDialog import PipFileSelectionDialog + if venvName: - from .PipFileSelectionDialog import PipFileSelectionDialog - dlg = PipFileSelectionDialog(self, "requirements", install=False) if dlg.exec() == QDialog.DialogCode.Accepted: requirements, _user = dlg.getData() @@ -546,10 +543,6 @@ except OSError: return - from eric7.UI.DeleteFilesConfirmationDialog import ( - DeleteFilesConfirmationDialog, - ) - dlg = DeleteFilesConfirmationDialog( self.parent(), self.tr("Uninstall Packages"),
--- a/src/eric7/PipInterface/PipLicensesDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/PipInterface/PipLicensesDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -7,6 +7,7 @@ Module implementing a dialog to show the licenses of an environment. """ +import csv import os import re @@ -179,8 +180,6 @@ """ Private slot to save the license information as a CSV file. """ - import csv - fileName, selectedFilter = EricFileDialog.getSaveFileNameAndFilter( self, self.tr("Save as CSV"),
--- a/src/eric7/PipInterface/PipPackagesWidget.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/PipInterface/PipPackagesWidget.py Mon Nov 07 17:19:58 2022 +0100 @@ -1108,12 +1108,12 @@ (defaults to False) @type bool (optional) """ + from .PipPackageDetailsDialog import PipPackageDetailsDialog + with EricOverrideCursor(): packageData = self.__pip.getPackageDetails(packageName, packageVersion) if packageData: - from .PipPackageDetailsDialog import PipPackageDetailsDialog - self.showDetailsButton.setEnabled(True) if installable: @@ -1332,10 +1332,10 @@ """ Private slot to install packages to be given by the user. """ + from .PipPackagesInputDialog import PipPackagesInputDialog + venvName = self.environmentsComboBox.currentText() if venvName: - from .PipPackagesInputDialog import PipPackagesInputDialog - dlg = PipPackagesInputDialog(self, self.tr("Install Packages")) if dlg.exec() == QDialog.DialogCode.Accepted: packages, user = dlg.getData() @@ -1346,10 +1346,10 @@ """ Private slot to install a package available on local storage. """ + from .PipFileSelectionDialog import PipFileSelectionDialog + venvName = self.environmentsComboBox.currentText() if venvName: - from .PipFileSelectionDialog import PipFileSelectionDialog - dlg = PipFileSelectionDialog(self, "package") if dlg.exec() == QDialog.DialogCode.Accepted: package, user = dlg.getData() @@ -1395,10 +1395,10 @@ """ Private slot to generate the contents for a requirements file. """ + from .PipFreezeDialog import PipFreezeDialog, PipFreezeDialogModes + venvName = self.environmentsComboBox.currentText() if venvName: - from .PipFreezeDialog import PipFreezeDialog, PipFreezeDialogModes - self.__freezeDialog = PipFreezeDialog( self.__pip, mode=PipFreezeDialogModes.Requirements, parent=self ) @@ -1410,10 +1410,10 @@ """ Private slot to generate the contents for a constraints file. """ + from .PipFreezeDialog import PipFreezeDialog, PipFreezeDialogModes + venvName = self.environmentsComboBox.currentText() if venvName: - from .PipFreezeDialog import PipFreezeDialog, PipFreezeDialogModes - self.__freezeDialog = PipFreezeDialog( self.__pip, mode=PipFreezeDialogModes.Constraints, parent=self ) @@ -1953,7 +1953,7 @@ """ Private slot to create a "Software Bill Of Material" file. """ - import CycloneDXInterface + import CycloneDXInterface # __IGNORE_WARNING_I102__ venvName = self.environmentsComboBox.currentText() if venvName == self.__pip.getProjectEnvironmentString():
--- a/src/eric7/PluginManager/PluginInfoDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/PluginManager/PluginInfoDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -115,13 +115,13 @@ @param item reference to the selected item (QTreeWidgetItem) @param column column number (integer) """ + from .PluginDetailsDialog import PluginDetailsDialog + moduleName = item.text(0) details = self.pm.getPluginDetails(moduleName) if details is None: pass else: - from .PluginDetailsDialog import PluginDetailsDialog - dlg = PluginDetailsDialog(details, self) dlg.show()
--- a/src/eric7/PluginManager/PluginInstallDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/PluginManager/PluginInstallDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -33,6 +33,7 @@ from eric7.EricWidgets.EricMainWindow import EricMainWindow from eric7.Utilities.uic import compileUiFiles +from .PluginManager import PluginManager from .Ui_PluginInstallDialog import Ui_PluginInstallDialog @@ -55,8 +56,6 @@ if pluginManager is None: # started as external plugin installer - from .PluginManager import PluginManager - self.__pluginManager = PluginManager(doLoadPlugins=False) self.__external = True else:
--- a/src/eric7/PluginManager/PluginManager.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/PluginManager/PluginManager.py Mon Nov 07 17:19:58 2022 +0100 @@ -25,6 +25,7 @@ from eric7.EricNetwork.EricNetworkProxyFactory import proxyAuthenticationRequired from eric7.EricWidgets import EricMessageBox from eric7.EricWidgets.EricApplication import ericApp +from eric7.EricXML.PluginRepositoryReader import PluginRepositoryReader from eric7.Globals import getConfig try: @@ -1327,8 +1328,6 @@ url = Preferences.getUI("PluginRepositoryUrl7") # read the repository file - from eric7.EricXML.PluginRepositoryReader import PluginRepositoryReader - reader = PluginRepositoryReader(f, self.checkPluginEntry) reader.readXML() if url != Preferences.getUI("PluginRepositoryUrl7"): @@ -1453,7 +1452,7 @@ pip = ericApp().getObject("Pip") except KeyError: # Installation is performed via the plug-in installation script. - from eric7.PipInterface.Pip import Pip + from eric7.PipInterface.Pip import Pip # __IGNORE_WARNING_I101__ pip = Pip(self) pip.installPackages(packages, interpreter=Globals.getPythonExecutable())
--- a/src/eric7/PluginManager/PluginRepositoryDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/PluginManager/PluginRepositoryDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -48,6 +48,7 @@ from eric7.EricWidgets import EricMessageBox from eric7.EricWidgets.EricApplication import ericApp from eric7.EricWidgets.EricMainWindow import EricMainWindow +from eric7.EricXML.PluginRepositoryReader import PluginRepositoryReader from eric7.Globals import getConfig try: @@ -60,6 +61,7 @@ except ImportError: SSL_AVAILABLE = False +from .PluginManager import PluginManager from .Ui_PluginRepositoryDialog import Ui_PluginRepositoryDialog @@ -100,8 +102,6 @@ if pluginManager is None: # started as external plug-in repository dialog - from .PluginManager import PluginManager - self.__pluginManager = PluginManager() self.__external = True else: @@ -547,8 +547,6 @@ self.__repositoryMissing = False f = QFile(self.pluginRepositoryFile) if f.open(QIODevice.OpenModeFlag.ReadOnly): - from eric7.EricXML.PluginRepositoryReader import PluginRepositoryReader - reader = PluginRepositoryReader(f, self.addEntry) reader.readXML() self.repositoryList.resizeColumnToContents(0) @@ -1151,8 +1149,6 @@ if os.path.exists(pluginRepositoryFile): f = QFile(pluginRepositoryFile) if f.open(QIODevice.OpenModeFlag.ReadOnly): - from eric7.EricXML.PluginRepositoryReader import PluginRepositoryReader - reader = PluginRepositoryReader(f, registerPlugin) reader.readXML()
--- a/src/eric7/PluginManager/PluginUninstallDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/PluginManager/PluginUninstallDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -22,6 +22,7 @@ from eric7.EricWidgets.EricApplication import ericApp from eric7.EricWidgets.EricMainWindow import EricMainWindow +from .PluginManager import PluginManager from .Ui_PluginUninstallDialog import Ui_PluginUninstallDialog @@ -46,8 +47,6 @@ if pluginManager is None: # started as external plugin deinstaller - from .PluginManager import PluginManager - self.__pluginManager = PluginManager(doLoadPlugins=False) self.__external = True else:
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Annotations/AnnotationsChecker.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Annotations/AnnotationsChecker.py Mon Nov 07 17:19:58 2022 +0100 @@ -192,6 +192,8 @@ """ Private method to check for function annotation issues. """ + from .AnnotationsFunctionVisitor import FunctionVisitor + suppressNoneReturning = self.__args.get( "SuppressNoneReturning", AnnotationsCheckerDefaultArgs["SuppressNoneReturning"], @@ -226,8 +228,6 @@ ) ) - from .AnnotationsFunctionVisitor import FunctionVisitor - visitor = FunctionVisitor(self.__source) visitor.visit(self.__tree)
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleChecker.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleChecker.py Mon Nov 07 17:19:58 2022 +0100 @@ -15,6 +15,7 @@ import pycodestyle +from CodeStyleFixer import CodeStyleFixer from Complexity.ComplexityChecker import ComplexityChecker from DocStyle.DocStyleChecker import DocStyleChecker from Imports.ImportsChecker import ImportsChecker @@ -390,10 +391,8 @@ stats = {} - if fixIssues: - from CodeStyleFixer import CodeStyleFixer - - fixer = CodeStyleFixer( + fixer = ( + CodeStyleFixer( filename, source, fixCodes, @@ -404,9 +403,9 @@ eol, backup, ) - # always fix in place - else: - fixer = None + if fixIssues + else None + ) if not errors: if includeMessages: @@ -484,7 +483,9 @@ if sys.version_info >= (3, 8, 0): # annotations with type comments are supported from # Python 3.8 on - from Annotations.AnnotationsChecker import AnnotationsChecker + from Annotations.AnnotationsChecker import ( # __IGNORE_WARNING_I10__ + AnnotationsChecker, + ) annotationsChecker = AnnotationsChecker( source,
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCheckerDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCheckerDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -2069,9 +2069,7 @@ settings.setValue( "PEP8/SortIgnoringStyle", self.sortIgnoreStyleCheckBox.isChecked() ) - settings.setValue( - "PEP8/SortFromFirst", self.sortFromFirstCheckBox.isChecked() - ) + settings.setValue("PEP8/SortFromFirst", self.sortFromFirstCheckBox.isChecked()) @pyqtSlot() def on_resetDefaultButton_clicked(self):
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCodeSelectionDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCodeSelectionDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -13,6 +13,7 @@ from PyQt6.QtWidgets import QDialog, QTreeWidgetItem from . import CodeStyleCheckerUtilities +from .CodeStyleFixer import FixableCodeStyleIssues from .translations import getMessageCodes, getTranslatedMessage from .Ui_CodeStyleCodeSelectionDialog import Ui_CodeStyleCodeSelectionDialog @@ -47,8 +48,6 @@ codeList = [code for code in codeList if code[0] not in categories] if showFixCodes: - from .CodeStyleFixer import FixableCodeStyleIssues - selectableCodes = FixableCodeStyleIssues else: selectableCodes = [x for x in getMessageCodes() if not x.startswith("FIX")]
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleFixer.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleFixer.py Mon Nov 07 17:19:58 2022 +0100 @@ -7,9 +7,11 @@ Module implementing a class to fix certain code style issues. """ +import codecs import contextlib import os import re +import textwrap import tokenize from io import StringIO @@ -269,8 +271,6 @@ @param encoding encoding of the source file (string) @return error message on failure (tuple of str) """ - import codecs - if not self.__modified: # no need to write return None @@ -2742,8 +2742,6 @@ # Trim comments that end with things like --------- return newText[:maxLength] + self.__eol elif isLast and re.match(r"\s*#+\s*\w+", newText): - import textwrap - splitLines = textwrap.wrap( newText.lstrip(" \t#"), initial_indent=indentation,
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Miscellaneous/MiscellaneousChecker.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Miscellaneous/MiscellaneousChecker.py Mon Nov 07 17:19:58 2022 +0100 @@ -213,8 +213,6 @@ r'^(?:[^\'"]*[\'"][^\'"]*[\'"])*\s*%|^\s*%' ) - import builtins - self.__builtins = [b for b in dir(builtins) if b not in self.BuiltinsWhiteList] self.__eradicator = Eradicator()
--- a/src/eric7/Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheck.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheck.py Mon Nov 07 17:19:58 2022 +0100 @@ -8,6 +8,7 @@ """ import ast +import builtins import contextlib import multiprocessing import queue @@ -232,8 +233,6 @@ errors), the message, a list with arguments for the message) @rtype dict """ - import builtins - try: codestring = normalizeCode(codestring) @@ -249,7 +248,7 @@ if filename.endswith(".ptl"): try: - import quixote.ptl_compile + import quixote.ptl_compile # __IGNORE_WARNING_I10__ except ImportError: return [{"error": (filename, 0, 0, "", "Quixote plugin not found.")}] template = quixote.ptl_compile.Template(codestring, filename)
--- a/src/eric7/Plugins/CheckerPlugins/SyntaxChecker/jsCheckSyntax.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Plugins/CheckerPlugins/SyntaxChecker/jsCheckSyntax.py Mon Nov 07 17:19:58 2022 +0100 @@ -168,8 +168,8 @@ (file name, line number, column, codestring (only at syntax errors), the message, a list with arguments for the message) """ - import jasy.script.parse.Parser as jsParser - import jasy.script.tokenize.Tokenizer as jsTokenizer + import jasy.script.parse.Parser as jsParser # __IGNORE_WARNING_I102__ + import jasy.script.tokenize.Tokenizer as jsTokenizer # __IGNORE_WARNING_I102__ codestring = normalizeCode(codestring)
--- a/src/eric7/Plugins/CheckerPlugins/SyntaxChecker/jsonCheckSyntax.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Plugins/CheckerPlugins/SyntaxChecker/jsonCheckSyntax.py Mon Nov 07 17:19:58 2022 +0100 @@ -7,6 +7,7 @@ Module implementing the syntax check for JSON. """ +import json import multiprocessing import queue @@ -174,8 +175,6 @@ errors), the message, a list with arguments for the message) @rtype dict """ - import json - codestring = normalizeCode(codestring) try:
--- a/src/eric7/Plugins/CheckerPlugins/SyntaxChecker/tomlCheckSyntax.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Plugins/CheckerPlugins/SyntaxChecker/tomlCheckSyntax.py Mon Nov 07 17:19:58 2022 +0100 @@ -175,9 +175,12 @@ @rtype dict """ try: - import tomlkit + import tomlkit # __IGNORE_WARNING_I10__ - from tomlkit.exceptions import KeyAlreadyPresent, ParseError + from tomlkit.exceptions import ( # __IGNORE_WARNING_I10__ + KeyAlreadyPresent, + ParseError, + ) except ImportError: error = "tomlkit not available. Install it via the PyPI interface." return [{"error": (file, 0, 0, "", error)}]
--- a/src/eric7/Plugins/CheckerPlugins/SyntaxChecker/yamlCheckSyntax.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Plugins/CheckerPlugins/SyntaxChecker/yamlCheckSyntax.py Mon Nov 07 17:19:58 2022 +0100 @@ -175,7 +175,7 @@ @rtype dict """ try: - from yaml import MarkedYAMLError, safe_load_all + from yaml import MarkedYAMLError, safe_load_all # __IGNORE_WARNING_I10__ except ImportError: error = "pyyaml not available. Install it via the PyPI interface." return [{"error": (file, 0, 0, "", error)}]
--- a/src/eric7/Plugins/PluginCodeStyleChecker.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Plugins/PluginCodeStyleChecker.py Mon Nov 07 17:19:58 2022 +0100 @@ -368,6 +368,8 @@ """ Private slot used to check the project files for code style. """ + from eric7.Plugins.CheckerPlugins.CodeStyleChecker import CodeStyleCheckerDialog + project = ericApp().getObject("Project") project.saveAllScripts() ppath = project.getProjectPath() @@ -377,8 +379,6 @@ if file.endswith(tuple(Preferences.getPython("Python3Extensions"))) ] - from eric7.Plugins.CheckerPlugins.CodeStyleChecker import CodeStyleCheckerDialog - self.__projectCodeStyleCheckerDialog = ( CodeStyleCheckerDialog.CodeStyleCheckerDialog(self) ) @@ -390,6 +390,8 @@ Private method to handle the code style check context menu action of the project sources browser. """ + from eric7.Plugins.CheckerPlugins.CodeStyleChecker import CodeStyleCheckerDialog + browser = ericApp().getObject("ProjectBrowser").getProjectBrowser("sources") if browser.getSelectedItemsCount([ProjectBrowserFileItem]) > 1: fn = [] @@ -405,8 +407,6 @@ fn = itm.dirName() isDir = True - from eric7.Plugins.CheckerPlugins.CodeStyleChecker import CodeStyleCheckerDialog - self.__projectBrowserCodeStyleCheckerDialog = ( CodeStyleCheckerDialog.CodeStyleCheckerDialog(self) ) @@ -458,16 +458,14 @@ Private slot to handle the code style check context menu action of the editors. """ + from eric7.Plugins.CheckerPlugins.CodeStyleChecker import CodeStyleCheckerDialog + editor = ericApp().getObject("ViewManager").activeWindow() if ( editor is not None and editor.checkDirty() and editor.getFileName() is not None ): - from eric7.Plugins.CheckerPlugins.CodeStyleChecker import ( - CodeStyleCheckerDialog, - ) - self.__editorCodeStyleCheckerDialog = ( CodeStyleCheckerDialog.CodeStyleCheckerDialog(self) )
--- a/src/eric7/Plugins/PluginEricapi.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Plugins/PluginEricapi.py Mon Nov 07 17:19:58 2022 +0100 @@ -173,6 +173,9 @@ from eric7.Plugins.DocumentationPlugins.Ericapi.EricapiConfigDialog import ( EricapiConfigDialog, ) + from eric7.Plugins.DocumentationPlugins.Ericapi.EricapiExecDialog import ( + EricapiExecDialog, + ) eolTranslation = { "\r": "cr", @@ -194,10 +197,6 @@ args.append("--eol={0}".format(eolTranslation[project.getEolString()])) # now do the call - from eric7.Plugins.DocumentationPlugins.Ericapi.EricapiExecDialog import ( - EricapiExecDialog, - ) - dia = EricapiExecDialog("Ericapi") res = dia.start(args, startDir) if res:
--- a/src/eric7/Plugins/PluginEricdoc.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Plugins/PluginEricdoc.py Mon Nov 07 17:19:58 2022 +0100 @@ -217,6 +217,9 @@ from eric7.Plugins.DocumentationPlugins.Ericdoc.EricdocConfigDialog import ( EricdocConfigDialog, ) + from eric7.Plugins.DocumentationPlugins.Ericdoc.EricdocExecDialog import ( + EricdocExecDialog, + ) eolTranslation = { "\r": "cr", @@ -238,10 +241,6 @@ args.append("--eol={0}".format(eolTranslation[project.getEolString()])) # now do the call - from eric7.Plugins.DocumentationPlugins.Ericdoc.EricdocExecDialog import ( - EricdocExecDialog, - ) - dia = EricdocExecDialog("Ericdoc") res = dia.start(args, startDir) if res:
--- a/src/eric7/Plugins/PluginSyntaxChecker.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Plugins/PluginSyntaxChecker.py Mon Nov 07 17:19:58 2022 +0100 @@ -50,14 +50,14 @@ @param ui reference to the user interface object (UI.UserInterface) """ + from eric7.Plugins.CheckerPlugins.SyntaxChecker.SyntaxCheckService import ( + SyntaxCheckService, + ) + super().__init__(ui) self.__ui = ui self.__initialize() - from eric7.Plugins.CheckerPlugins.SyntaxChecker.SyntaxCheckService import ( - SyntaxCheckService, - ) - self.syntaxCheckService = SyntaxCheckService() ericApp().registerObject("SyntaxCheckService", self.syntaxCheckService) @@ -310,6 +310,10 @@ """ Private slot used to check the project files for syntax errors. """ + from eric7.Plugins.CheckerPlugins.SyntaxChecker.SyntaxCheckerDialog import ( + SyntaxCheckerDialog, + ) + project = ericApp().getObject("Project") project.saveAllScripts() ppath = project.getProjectPath() @@ -320,10 +324,6 @@ if file.endswith(extensions) ] - from eric7.Plugins.CheckerPlugins.SyntaxChecker.SyntaxCheckerDialog import ( - SyntaxCheckerDialog, - ) - self.__projectSyntaxCheckerDialog = SyntaxCheckerDialog() self.__projectSyntaxCheckerDialog.show() self.__projectSyntaxCheckerDialog.prepare(files, project) @@ -333,6 +333,10 @@ Private method to handle the syntax check context menu action of the project sources browser. """ + from eric7.Plugins.CheckerPlugins.SyntaxChecker.SyntaxCheckerDialog import ( + SyntaxCheckerDialog, + ) + browser = ericApp().getObject("ProjectBrowser").getProjectBrowser("sources") if browser.getSelectedItemsCount([ProjectBrowserFileItem]) > 1: fn = [] @@ -345,10 +349,6 @@ except AttributeError: fn = itm.dirName() - from eric7.Plugins.CheckerPlugins.SyntaxChecker.SyntaxCheckerDialog import ( - SyntaxCheckerDialog, - ) - self.__projectBrowserSyntaxCheckerDialog = SyntaxCheckerDialog() self.__projectBrowserSyntaxCheckerDialog.show() self.__projectBrowserSyntaxCheckerDialog.start(fn) @@ -395,12 +395,12 @@ Private slot to handle the syntax check context menu action of the editors. """ + from eric7.Plugins.CheckerPlugins.SyntaxChecker.SyntaxCheckerDialog import ( + SyntaxCheckerDialog, + ) + editor = ericApp().getObject("ViewManager").activeWindow() if editor is not None: - from eric7.Plugins.CheckerPlugins.SyntaxChecker.SyntaxCheckerDialog import ( - SyntaxCheckerDialog, - ) - self.__editorSyntaxCheckerDialog = SyntaxCheckerDialog() self.__editorSyntaxCheckerDialog.show() if editor.isJavascriptFile():
--- a/src/eric7/Plugins/PluginVcsGit.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Plugins/PluginVcsGit.py Mon Nov 07 17:19:58 2022 +0100 @@ -104,8 +104,9 @@ @param configDlg reference to the configuration dialog (QDialog) @return reference to the configuration page """ + from eric7.Plugins.VcsPlugins.vcsGit.ConfigurationPage.GitPage import GitPage + global gitCfgPluginObject - from eric7.Plugins.VcsPlugins.vcsGit.ConfigurationPage.GitPage import GitPage if gitCfgPluginObject is None: gitCfgPluginObject = VcsGitPlugin(None) @@ -181,11 +182,11 @@ @param ui reference to the user interface object (UI.UserInterface) """ + from eric7.Plugins.VcsPlugins.vcsGit.ProjectHelper import GitProjectHelper + super().__init__(ui) self.__ui = ui - from eric7.Plugins.VcsPlugins.vcsGit.ProjectHelper import GitProjectHelper - self.__projectHelperObject = GitProjectHelper(None, None) with contextlib.suppress(KeyError): ericApp().registerPluginObject(
--- a/src/eric7/Plugins/PluginVcsMercurial.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Plugins/PluginVcsMercurial.py Mon Nov 07 17:19:58 2022 +0100 @@ -101,11 +101,12 @@ @param configDlg reference to the configuration dialog (QDialog) @return reference to the configuration page """ - global mercurialCfgPluginObject from eric7.Plugins.VcsPlugins.vcsMercurial.ConfigurationPage.MercurialPage import ( MercurialPage, ) + global mercurialCfgPluginObject + if mercurialCfgPluginObject is None: mercurialCfgPluginObject = VcsMercurialPlugin(None) page = MercurialPage(mercurialCfgPluginObject) @@ -188,11 +189,11 @@ @param ui reference to the user interface object (UI.UserInterface) """ + from eric7.Plugins.VcsPlugins.vcsMercurial.ProjectHelper import HgProjectHelper + super().__init__(ui) self.__ui = ui - from eric7.Plugins.VcsPlugins.vcsMercurial.ProjectHelper import HgProjectHelper - self.__projectHelperObject = HgProjectHelper(None, None) with contextlib.suppress(KeyError): ericApp().registerPluginObject(
--- a/src/eric7/Plugins/PluginVcsPySvn.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Plugins/PluginVcsPySvn.py Mon Nov 07 17:19:58 2022 +0100 @@ -43,7 +43,7 @@ @return dictionary containing the data to be shown """ try: - import pysvn + import pysvn # __IGNORE_WARNING_I10__ try: text = os.path.dirname(pysvn.__file__) @@ -104,11 +104,12 @@ @param configDlg reference to the configuration dialog (QDialog) @return reference to the configuration page """ - global subversionCfgPluginObject from eric7.Plugins.VcsPlugins.vcsPySvn.ConfigurationPage.SubversionPage import ( SubversionPage, ) + global subversionCfgPluginObject + if subversionCfgPluginObject is None: subversionCfgPluginObject = VcsPySvnPlugin(None) page = SubversionPage(subversionCfgPluginObject) @@ -154,6 +155,8 @@ @param ui reference to the user interface object (UI.UserInterface) """ + from eric7.Plugins.VcsPlugins.vcsPySvn.ProjectHelper import PySvnProjectHelper + super().__init__(ui) self.__ui = ui @@ -162,8 +165,6 @@ "LogLimit": 20, } - from eric7.Plugins.VcsPlugins.vcsPySvn.ProjectHelper import PySvnProjectHelper - self.__projectHelperObject = PySvnProjectHelper(None, None) with contextlib.suppress(KeyError): ericApp().registerPluginObject(
--- a/src/eric7/Plugins/PluginVcsSubversion.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Plugins/PluginVcsSubversion.py Mon Nov 07 17:19:58 2022 +0100 @@ -159,6 +159,10 @@ @param ui reference to the user interface object (UI.UserInterface) """ + from eric7.Plugins.VcsPlugins.vcsSubversion.ProjectHelper import ( + SvnProjectHelper, + ) + super().__init__(ui) self.__ui = ui @@ -167,10 +171,6 @@ "LogLimit": 20, } - from eric7.Plugins.VcsPlugins.vcsSubversion.ProjectHelper import ( - SvnProjectHelper, - ) - self.__projectHelperObject = SvnProjectHelper(None, None) with contextlib.suppress(KeyError): ericApp().registerPluginObject(
--- a/src/eric7/Plugins/UiExtensionPlugins/Translator/TranslatorEngines/__init__.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Plugins/UiExtensionPlugins/Translator/TranslatorEngines/__init__.py Mon Nov 07 17:19:58 2022 +0100 @@ -73,31 +73,31 @@ @rtype TranslatorEngine """ if name == "deepl": - from .DeepLEngine import DeepLEngine + from .DeepLEngine import DeepLEngine # __IGNORE_WARNING_I101__ engine = DeepLEngine(plugin, parent) elif name == "googlev1": - from .GoogleV1Engine import GoogleV1Engine + from .GoogleV1Engine import GoogleV1Engine # __IGNORE_WARNING_I101__ engine = GoogleV1Engine(plugin, parent) elif name == "googlev2": - from .GoogleV2Engine import GoogleV2Engine + from .GoogleV2Engine import GoogleV2Engine # __IGNORE_WARNING_I101__ engine = GoogleV2Engine(plugin, parent) elif name == "ibm_watson": - from .IbmWatsonEngine import IbmWatsonEngine + from .IbmWatsonEngine import IbmWatsonEngine # __IGNORE_WARNING_I101__ engine = IbmWatsonEngine(plugin, parent) elif name == "microsoft": - from .MicrosoftEngine import MicrosoftEngine + from .MicrosoftEngine import MicrosoftEngine # __IGNORE_WARNING_I101__ engine = MicrosoftEngine(plugin, parent) elif name == "mymemory": - from .MyMemoryEngine import MyMemoryEngine + from .MyMemoryEngine import MyMemoryEngine # __IGNORE_WARNING_I101__ engine = MyMemoryEngine(plugin, parent) elif name == "yandex": - from .YandexEngine import YandexEngine + from .YandexEngine import YandexEngine # __IGNORE_WARNING_I101__ engine = YandexEngine(plugin, parent) else:
--- a/src/eric7/Plugins/UiExtensionPlugins/Translator/TranslatorWidget.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Plugins/UiExtensionPlugins/Translator/TranslatorWidget.py Mon Nov 07 17:19:58 2022 +0100 @@ -9,7 +9,7 @@ import sys -from PyQt6.QtCore import QTemporaryFile, pyqtSlot +from PyQt6.QtCore import QTemporaryFile, QUrl, pyqtSlot from PyQt6.QtWidgets import QWidget if "--no-multimedia" in sys.argv: @@ -401,9 +401,9 @@ @return tuple of translated text and flag indicating success @rtype tuple of (str, bool) """ + from .TranslatorRequest import TranslatorRequest + if self.__translatorRequest is None: - from .TranslatorRequest import TranslatorRequest - self.__translatorRequest = TranslatorRequest(self) self.__ensureTranslationEngineReady() @@ -425,12 +425,12 @@ @param language language code of the text @type str """ + from .TranslatorRequest import TranslatorRequest + if not text or not language: return if self.__translatorRequest is None: - from .TranslatorRequest import TranslatorRequest - self.__translatorRequest = TranslatorRequest(self) if self.__mediaPlayer is None: @@ -472,8 +472,6 @@ self.__mediaFile.write(data) self.__mediaFile.close() - from PyQt6.QtCore import QUrl - self.__mediaPlayer.setSource( QUrl.fromLocalFile(self.__mediaFile.fileName()) )
--- a/src/eric7/Plugins/VcsPlugins/vcsGit/ConfigurationPage/GitPage.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Plugins/VcsPlugins/vcsGit/ConfigurationPage/GitPage.py Mon Nov 07 17:19:58 2022 +0100 @@ -82,10 +82,10 @@ """ from eric7.QScintilla.MiniEditor import MiniEditor + from ..GitUserConfigDataDialog import GitUserConfigDataDialog + cfgFile = self.__plugin.getConfigPath() if not os.path.exists(cfgFile): - from ..GitUserConfigDataDialog import GitUserConfigDataDialog - dlg = GitUserConfigDataDialog() if dlg.exec() == QDialog.DialogCode.Accepted: firstName, lastName, email = dlg.getData()
--- a/src/eric7/Plugins/VcsPlugins/vcsGit/GitLogBrowserDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Plugins/VcsPlugins/vcsGit/GitLogBrowserDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -1882,9 +1882,9 @@ """ Private slot to create a new branch starting at the selected commit. """ + from .GitBranchDialog import GitBranchDialog + if len(self.logTree.selectedItems()) == 1: - from .GitBranchDialog import GitBranchDialog - itm = self.logTree.selectedItems()[0] commit = itm.text(self.CommitIdColumn) branches = [ @@ -1920,9 +1920,9 @@ Private slot to create a new branch starting at the selected commit and switch the work tree to it. """ + from .GitBranchDialog import GitBranchDialog + if len(self.logTree.selectedItems()) == 1: - from .GitBranchDialog import GitBranchDialog - itm = self.logTree.selectedItems()[0] commit = itm.text(self.CommitIdColumn) branches = [
--- a/src/eric7/Plugins/VcsPlugins/vcsGit/GitPatchStatisticsDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Plugins/VcsPlugins/vcsGit/GitPatchStatisticsDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -49,6 +49,8 @@ @param patchCheckData tuple of data as returned by the GitPatchFilesDialog.getData() method """ + from .GitPatchFilesDialog import GitPatchFilesDialog + self.__patchCheckData = patchCheckData self.changesTreeWidget.clear() @@ -61,8 +63,6 @@ if os.path.splitdrive(repodir)[1] == os.sep: return - from .GitPatchFilesDialog import GitPatchFilesDialog - dlg = GitPatchFilesDialog(repodir, patchCheckData) if dlg.exec() == QDialog.DialogCode.Accepted: patchFilesList, stripCount, inaccurateEof, recount = dlg.getData()
--- a/src/eric7/Plugins/VcsPlugins/vcsGit/GitStatusDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Plugins/VcsPlugins/vcsGit/GitStatusDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -866,6 +866,8 @@ """ Private slot to handle the Diff context menu entry. """ + from .GitDiffDialog import GitDiffDialog + namesW = [ os.path.join(self.dname, itm.text(self.__pathColumn)) for itm in self.__getStageableItems() @@ -888,8 +890,6 @@ names = namesW + namesS if self.diff is None: - from .GitDiffDialog import GitDiffDialog - self.diff = GitDiffDialog(self.vcs) self.diff.show() self.diff.start(names, diffMode=diffMode, refreshable=True)
--- a/src/eric7/Plugins/VcsPlugins/vcsGit/git.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Plugins/VcsPlugins/vcsGit/git.py Mon Nov 07 17:19:58 2022 +0100 @@ -12,6 +12,7 @@ import pathlib import re import shutil +import sys from PyQt6.QtCore import QProcess, pyqtSignal from PyQt6.QtWidgets import QApplication, QDialog, QInputDialog, QLineEdit @@ -357,11 +358,11 @@ @param commitAll flag indicating to commit all local changes (boolean) @param amend flag indicating to amend the HEAD commit (boolean) """ + from .GitCommitDialog import GitCommitDialog + if not noDialog: # call CommitDialog and get message from there if self.__commitDialog is None: - from .GitCommitDialog import GitCommitDialog - self.__commitDialog = GitCommitDialog( self, message, amend, commitAll, self.__ui ) @@ -713,6 +714,8 @@ @param noDialog flag indicating quiet operations @return flag indicating successful operation (boolean) """ + from .GitCopyDialog import GitCopyDialog + isDir = os.path.isdir(name) res = False @@ -722,8 +725,6 @@ force = True accepted = True else: - from .GitCopyDialog import GitCopyDialog - dlg = GitCopyDialog(name, None, True) accepted = dlg.exec() == QDialog.DialogCode.Accepted if accepted: @@ -775,9 +776,9 @@ @param isFile flag indicating log for a file is to be shown (boolean) """ + from .GitLogBrowserDialog import GitLogBrowserDialog + if self.logBrowser is None: - from .GitLogBrowserDialog import GitLogBrowserDialog - self.logBrowser = GitLogBrowserDialog(self) self.logBrowser.show() self.logBrowser.raise_() @@ -789,9 +790,9 @@ @param projectDir name of the project directory (string) """ + from .GitReflogBrowserDialog import GitReflogBrowserDialog + if self.reflogBrowser is None: - from .GitReflogBrowserDialog import GitReflogBrowserDialog - self.reflogBrowser = GitReflogBrowserDialog(self) self.reflogBrowser.show() self.reflogBrowser.raise_() @@ -809,6 +810,8 @@ @param name file/directory name to be diffed (string) """ + from .GitDiffDialog import GitDiffDialog + names = name[:] if isinstance(name, list) else [name] for nam in names: if os.path.isfile(nam): @@ -820,8 +823,6 @@ if nam == project.ppath and not project.saveAllScripts(): return if self.diff is None: - from .GitDiffDialog import GitDiffDialog - self.diff = GitDiffDialog(self) self.diff.show() self.diff.raise_() @@ -836,9 +837,9 @@ @param name file/directory name(s) to show the status of (string or list of strings) """ + from .GitStatusDialog import GitStatusDialog + if self.status is None: - from .GitStatusDialog import GitStatusDialog - self.status = GitStatusDialog(self) self.status.show() self.status.raise_() @@ -891,6 +892,8 @@ or delete @rtype bool """ + from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog + args = self.initCommand("checkout") args.append("--") if isinstance(name, list): @@ -912,10 +915,6 @@ project = ericApp().getObject("Project") names = [project.getRelativePath(nam) for nam in names] if names[0]: - from eric7.UI.DeleteFilesConfirmationDialog import ( - DeleteFilesConfirmationDialog, - ) - dlg = DeleteFilesConfirmationDialog( self.parent(), self.tr("Revert changes"), @@ -953,6 +952,8 @@ @param name file/directory name to be merged (string) """ + from .GitMergeDialog import GitMergeDialog + dname, fname = self.splitPath(name) # find the root of the repo @@ -962,8 +963,6 @@ if os.path.splitdrive(repodir)[1] == os.sep: return - from .GitMergeDialog import GitMergeDialog - dlg = GitMergeDialog( self.gitGetTagsList(repodir), self.gitGetBranchesList(repodir, withMaster=True), @@ -1005,6 +1004,8 @@ @return flag indicating, that the switch contained an add or delete (boolean) """ + from .GitRevisionSelectionDialog import GitRevisionSelectionDialog + dname, fname = self.splitPath(name) # find the root of the repo @@ -1014,8 +1015,6 @@ if os.path.splitdrive(repodir)[1] == os.sep: return False - from .GitRevisionSelectionDialog import GitRevisionSelectionDialog - dlg = GitRevisionSelectionDialog( self.gitGetTagsList(repodir), self.gitGetBranchesList(repodir), @@ -1552,9 +1551,9 @@ @param skiplist name of a skip list file @type str """ + from .GitBlameDialog import GitBlameDialog + if self.blame is None: - from .GitBlameDialog import GitBlameDialog - self.blame = GitBlameDialog(self) self.blame.show() self.blame.raise_() @@ -1574,6 +1573,9 @@ @param name file/directory name to be diffed (string) """ + from .GitDiffDialog import GitDiffDialog + from .GitRevisionsSelectionDialog import GitRevisionsSelectionDialog + if isinstance(name, list): dname, fnames = self.splitPathList(name) names = name[:] @@ -1597,16 +1599,12 @@ if os.path.splitdrive(repodir)[1] == os.sep: return - from .GitRevisionsSelectionDialog import GitRevisionsSelectionDialog - dlg = GitRevisionsSelectionDialog( self.gitGetTagsList(repodir), self.gitGetBranchesList(repodir) ) if dlg.exec() == QDialog.DialogCode.Accepted: revisions = dlg.getRevisions() if self.diff is None: - from .GitDiffDialog import GitDiffDialog - self.diff = GitDiffDialog(self) self.diff.show() self.diff.raise_() @@ -1675,6 +1673,10 @@ @param revisions tuple of two revisions (tuple of strings) @exception ValueError raised to indicate an invalid name parameter """ + from eric7.UI.CompareDialog import CompareDialog + + from .GitRevisionsSelectionDialog import GitRevisionsSelectionDialog + if isinstance(name, list): raise ValueError("Wrong parameter type") @@ -1686,8 +1688,6 @@ if os.path.splitdrive(repodir)[1] == os.sep: return - from .GitRevisionsSelectionDialog import GitRevisionsSelectionDialog - dlg = GitRevisionsSelectionDialog( self.gitGetTagsList(repodir), self.gitGetBranchesList(repodir) ) @@ -1733,8 +1733,6 @@ return if self.sbsDiff is None: - from eric7.UI.CompareDialog import CompareDialog - self.sbsDiff = CompareDialog() self.sbsDiff.show() self.sbsDiff.raise_() @@ -1746,6 +1744,8 @@ @param name directory name (string) """ + from .GitFetchDialog import GitFetchDialog + # find the root of the repo repodir = self.splitPath(name)[0] while not os.path.isdir(os.path.join(repodir, self.adminDir)): @@ -1753,8 +1753,6 @@ if os.path.splitdrive(repodir)[1] == os.sep: return - from .GitFetchDialog import GitFetchDialog - dlg = GitFetchDialog(self, repodir) if dlg.exec() == QDialog.DialogCode.Accepted: ( @@ -1796,6 +1794,8 @@ @return flag indicating, that the update contained an add or delete (boolean) """ + from .GitPullDialog import GitPullDialog + # find the root of the repo repodir = self.splitPath(name)[0] while not os.path.isdir(os.path.join(repodir, self.adminDir)): @@ -1803,8 +1803,6 @@ if os.path.splitdrive(repodir)[1] == os.sep: return False - from .GitPullDialog import GitPullDialog - dlg = GitPullDialog(self, repodir) if dlg.exec() == QDialog.DialogCode.Accepted: remote, url, branches, pullAll, prune = dlg.getData() @@ -1836,6 +1834,8 @@ @param name directory name of the project to be pushed from (string) """ + from .GitPushDialog import GitPushDialog + # find the root of the repo repodir = self.splitPath(name)[0] while not os.path.isdir(os.path.join(repodir, self.adminDir)): @@ -1843,8 +1843,6 @@ if os.path.splitdrive(repodir)[1] == os.sep: return - from .GitPushDialog import GitPushDialog - dlg = GitPushDialog(self, repodir) if dlg.exec() == QDialog.DialogCode.Accepted: remote, refspecs, tags, tracking, submodule = dlg.getData() @@ -1882,8 +1880,6 @@ if os.path.splitdrive(repodir)[1] == os.sep: return - import sys - editor = sys.argv[0].replace(".py", "_editor.py") env = {"GIT_EDITOR": "{0} {1}".format(Globals.getPythonExecutable(), editor)} @@ -1959,6 +1955,8 @@ @param projectDir directory name of the project (string) @param check flag indicating to perform a check operation (boolean) """ + from .GitPatchFilesDialog import GitPatchFilesDialog + # find the root of the repo repodir = projectDir while not os.path.isdir(os.path.join(repodir, self.adminDir)): @@ -1966,8 +1964,6 @@ if os.path.splitdrive(repodir)[1] == os.sep: return - from .GitPatchFilesDialog import GitPatchFilesDialog - dlg = GitPatchFilesDialog(repodir, self.__patchCheckData) if dlg.exec() == QDialog.DialogCode.Accepted: patchFilesList, stripCount, inaccurateEof, recount = dlg.getData() @@ -2005,9 +2001,9 @@ @param projectDir directory name of the project (string) """ + from .GitPatchStatisticsDialog import GitPatchStatisticsDialog + if self.patchStatisticsDialog is None: - from .GitPatchStatisticsDialog import GitPatchStatisticsDialog - self.patchStatisticsDialog = GitPatchStatisticsDialog(self) self.patchStatisticsDialog.show() self.patchStatisticsDialog.raise_() @@ -2028,6 +2024,8 @@ @param tagName name of the tag (string) @return flag indicating a performed tag action (boolean) """ + from .GitTagDialog import GitTagDialog + dname, fname = self.splitPath(name) # find the root of the repo @@ -2037,8 +2035,6 @@ if os.path.splitdrive(repodir)[1] == os.sep: return False - from .GitTagDialog import GitTagDialog - dlg = GitTagDialog(self.gitGetTagsList(repodir), revision, tagName) if dlg.exec() == QDialog.DialogCode.Accepted: tag, revision, tagOp, tagType, force = dlg.getParameters() @@ -2119,9 +2115,9 @@ @param merged flag indicating to show only merged or non-merged branches (boolean) """ + from .GitTagBranchListDialog import GitTagBranchListDialog + if self.tagbranchList is None: - from .GitTagBranchListDialog import GitTagBranchListDialog - self.tagbranchList = GitTagBranchListDialog(self) self.tagbranchList.show() self.tagbranchList.raise_() @@ -2230,6 +2226,8 @@ a flag indicating, that the branch operation contained an add or delete (boolean) """ + from .GitBranchDialog import GitBranchDialog + dname, fname = self.splitPath(name) # find the root of the repo @@ -2239,8 +2237,6 @@ if os.path.splitdrive(repodir)[1] == os.sep: return False, False - from .GitBranchDialog import GitBranchDialog - dlg = GitBranchDialog( self.gitGetBranchesList(repodir, allBranches=True), revision, @@ -2334,6 +2330,8 @@ @param name file/directory name (string) """ + from .GitBranchPushDialog import GitBranchPushDialog + dname, fname = self.splitPath(name) # find the root of the repo @@ -2343,8 +2341,6 @@ if os.path.splitdrive(repodir)[1] == os.sep: return - from .GitBranchPushDialog import GitBranchPushDialog - dlg = GitBranchPushDialog( self.gitGetBranchesList(repodir), self.gitGetRemotesList(repodir), @@ -2396,6 +2392,8 @@ @param projectDir name of the project directory (string) """ + from .GitBundleDialog import GitBundleDialog + # find the root of the repo repodir = projectDir while not os.path.isdir(os.path.join(repodir, self.adminDir)): @@ -2403,8 +2401,6 @@ if os.path.splitdrive(repodir)[1] == os.sep: return - from .GitBundleDialog import GitBundleDialog - dlg = GitBundleDialog( self.gitGetTagsList(repodir), self.gitGetBranchesList(repodir) ) @@ -2557,6 +2553,8 @@ @param projectDir name of the project directory (string) """ + from .GitApplyBundleDataDialog import GitApplyBundleDataDialog + # find the root of the repo repodir = projectDir while not os.path.isdir(os.path.join(repodir, self.adminDir)): @@ -2573,8 +2571,6 @@ if fname: self.__lastBundlePath = os.path.dirname(fname) - from .GitApplyBundleDataDialog import GitApplyBundleDataDialog - dlg = GitApplyBundleDataDialog( self.gitGetBundleHeads(repodir, fname), self.gitGetBranchesList(repodir) ) @@ -2605,6 +2601,8 @@ @return flag indicating, that the update contained an add or delete (boolean) """ + from .GitApplyBundleDataDialog import GitApplyBundleDataDialog + # find the root of the repo repodir = projectDir while not os.path.isdir(os.path.join(repodir, self.adminDir)): @@ -2622,8 +2620,6 @@ if fname: self.__lastBundlePath = os.path.dirname(fname) - from .GitApplyBundleDataDialog import GitApplyBundleDataDialog - dlg = GitApplyBundleDataDialog( self.gitGetBundleHeads(repodir, fname), self.gitGetBranchesList(repodir) ) @@ -2662,6 +2658,9 @@ or delete (boolean) @exception ValueError raised to indicate an invalid bisect subcommand """ + from .GitBisectStartDialog import GitBisectStartDialog + from .GitRevisionSelectionDialog import GitRevisionSelectionDialog + if subcommand not in ( "start", "start_extended", @@ -2686,8 +2685,6 @@ if subcommand in ("good", "bad", "skip", "reset"): showBranches = subcommand == "reset" showHead = subcommand == "reset" - from .GitRevisionSelectionDialog import GitRevisionSelectionDialog - dlg = GitRevisionSelectionDialog( self.gitGetTagsList(repodir), self.gitGetBranchesList(repodir), @@ -2701,8 +2698,6 @@ args = self.initCommand("bisect") if subcommand == "start_extended": - from .GitBisectStartDialog import GitBisectStartDialog - dlg = GitBisectStartDialog() if dlg.exec() == QDialog.DialogCode.Accepted: bad, good, noCheckout = dlg.getData() @@ -2735,9 +2730,9 @@ @param projectDir name of the project directory (string) """ + from .GitBisectLogBrowserDialog import GitBisectLogBrowserDialog + if self.bisectlogBrowser is None: - from .GitBisectLogBrowserDialog import GitBisectLogBrowserDialog - self.bisectlogBrowser = GitBisectLogBrowserDialog(self) self.bisectlogBrowser.show() self.bisectlogBrowser.raise_() @@ -3058,9 +3053,9 @@ @param projectDir name of the project directory (string) """ + from .GitRemoteRepositoriesDialog import GitRemoteRepositoriesDialog + if self.remotesDialog is None: - from .GitRemoteRepositoriesDialog import GitRemoteRepositoriesDialog - self.remotesDialog = GitRemoteRepositoriesDialog(self) self.remotesDialog.show() self.remotesDialog.raise_() @@ -3072,6 +3067,8 @@ @param projectDir name of the project directory (string) """ + from .GitAddRemoteDialog import GitAddRemoteDialog + # find the root of the repo repodir = projectDir while not os.path.isdir(os.path.join(repodir, self.adminDir)): @@ -3079,8 +3076,6 @@ if os.path.splitdrive(repodir)[1] == os.sep: return - from .GitAddRemoteDialog import GitAddRemoteDialog - dlg = GitAddRemoteDialog() if dlg.exec() == QDialog.DialogCode.Accepted: name, url = dlg.getData() @@ -3130,6 +3125,8 @@ @param remoteUrl URL of the remote repository @type str """ + from .GitChangeRemoteUrlDialog import GitChangeRemoteUrlDialog + # find the root of the repo repodir = projectDir while not os.path.isdir(os.path.join(repodir, self.adminDir)): @@ -3140,8 +3137,6 @@ if not remoteUrl: remoteUrl = self.gitGetRemoteUrl(repodir, remoteName) - from .GitChangeRemoteUrlDialog import GitChangeRemoteUrlDialog - dlg = GitChangeRemoteUrlDialog(remoteName, remoteUrl) if dlg.exec() == QDialog.DialogCode.Accepted: name, url = dlg.getData() @@ -3166,6 +3161,8 @@ @param remoteUrl URL of the remote repository @type str """ + from .GitRemoteCredentialsDialog import GitRemoteCredentialsDialog + # find the root of the repo repodir = projectDir while not os.path.isdir(os.path.join(repodir, self.adminDir)): @@ -3176,8 +3173,6 @@ if not remoteUrl: remoteUrl = self.gitGetRemoteUrl(repodir, remoteName) - from .GitRemoteCredentialsDialog import GitRemoteCredentialsDialog - dlg = GitRemoteCredentialsDialog(remoteName, remoteUrl) if dlg.exec() == QDialog.DialogCode.Accepted: name, url = dlg.getData() @@ -3266,9 +3261,9 @@ @param commits list of commits to start the search from (list of strings) """ + from .GitDescribeDialog import GitDescribeDialog + if self.describeDialog is None: - from .GitDescribeDialog import GitDescribeDialog - self.describeDialog = GitDescribeDialog(self) self.describeDialog.show() self.describeDialog.raise_() @@ -3287,6 +3282,8 @@ @param commits list of commits to be applied (list of strings) @return flag indicating that the project should be reread (boolean) """ + from .GitCherryPickDialog import GitCherryPickDialog + # find the root of the repo repodir = projectDir while not os.path.isdir(os.path.join(repodir, self.adminDir)): @@ -3296,8 +3293,6 @@ res = False - from .GitCherryPickDialog import GitCherryPickDialog - dlg = GitCherryPickDialog(commits) if dlg.exec() == QDialog.DialogCode.Accepted: commits, cherrypickInfo, signoff, nocommit = dlg.getData() @@ -3335,8 +3330,6 @@ if os.path.splitdrive(repodir)[1] == os.sep: return False - import sys - editor = sys.argv[0].replace(".py", "_editor.py") env = {"GIT_EDITOR": "{0} {1}".format(Globals.getPythonExecutable(), editor)} @@ -3452,6 +3445,8 @@ @return flag indicating, that the save contained an add or delete (boolean) """ + from .GitStashDataDialog import GitStashDataDialog + # find the root of the repo repodir = projectDir while not os.path.isdir(os.path.join(repodir, self.adminDir)): @@ -3460,8 +3455,6 @@ return False res = False - from .GitStashDataDialog import GitStashDataDialog - dlg = GitStashDataDialog() if dlg.exec() == QDialog.DialogCode.Accepted: message, keepIndex, untracked = dlg.getData() @@ -3490,9 +3483,9 @@ @param projectDir name of the project directory (string) """ + from .GitStashBrowserDialog import GitStashBrowserDialog + if self.stashBrowser is None: - from .GitStashBrowserDialog import GitStashBrowserDialog - self.stashBrowser = GitStashBrowserDialog(self) self.stashBrowser.show() self.stashBrowser.raise_() @@ -3505,6 +3498,8 @@ @param projectDir name of the project directory (string) @param stashName name of a stash (string) """ + from .GitDiffDialog import GitDiffDialog + # find the root of the repo repodir = projectDir while not os.path.isdir(os.path.join(repodir, self.adminDir)): @@ -3526,8 +3521,6 @@ return if self.diff is None: - from .GitDiffDialog import GitDiffDialog - self.diff = GitDiffDialog(self) self.diff.show() self.diff.raise_() @@ -3770,12 +3763,11 @@ """ Public method used to edit the user configuration file. """ + from .GitUserConfigDataDialog import GitUserConfigDataDialog from .GitUtilities import getConfigPath cfgFile = getConfigPath() if not os.path.exists(cfgFile): - from .GitUserConfigDataDialog import GitUserConfigDataDialog - dlg = GitUserConfigDataDialog() if dlg.exec() == QDialog.DialogCode.Accepted: firstName, lastName, email = dlg.getData() @@ -3984,6 +3976,8 @@ @param projectDir name of the project directory (string) """ + from .GitArchiveDataDialog import GitArchiveDataDialog + # find the root of the repo repodir = projectDir while not os.path.isdir(os.path.join(repodir, self.adminDir)): @@ -3991,8 +3985,6 @@ if os.path.splitdrive(repodir)[1] == os.sep: return - from .GitArchiveDataDialog import GitArchiveDataDialog - dlg = GitArchiveDataDialog( self.gitGetTagsList(repodir), self.gitGetBranchesList(repodir, withMaster=True), @@ -4026,6 +4018,8 @@ @param projectDir name of the project directory @type str """ + from .GitSubmoduleAddDialog import GitSubmoduleAddDialog + # find the root of the repo repodir = projectDir while not os.path.isdir(os.path.join(repodir, self.adminDir)): @@ -4033,8 +4027,6 @@ if os.path.splitdrive(repodir)[1] == os.sep: return - from .GitSubmoduleAddDialog import GitSubmoduleAddDialog - dlg = GitSubmoduleAddDialog(self, repodir) if dlg.exec() == QDialog.DialogCode.Accepted: repo, branch, name, path, force = dlg.getData() @@ -4104,6 +4096,8 @@ @param projectDir name of the project directory @type str """ + from .GitSubmodulesListDialog import GitSubmodulesListDialog + # find the root of the repo repodir = projectDir while not os.path.isdir(os.path.join(repodir, self.adminDir)): @@ -4113,8 +4107,6 @@ submodulesList = self.__gitSubmodulesList(repodir) if submodulesList: - from .GitSubmodulesListDialog import GitSubmodulesListDialog - dlg = GitSubmodulesListDialog(submodulesList) dlg.exec() else: @@ -4159,10 +4151,10 @@ a cancellation @rtype tuple of (list of str, bool) """ + from .GitListDialog import GitListDialog + paths = [submodule["path"] for submodule in self.__gitSubmodulesList(repodir)] - from .GitListDialog import GitListDialog - dlg = GitListDialog(sorted(paths)) if dlg.exec() == QDialog.DialogCode.Accepted: selectedPaths = dlg.getSelection() @@ -4202,6 +4194,8 @@ @param projectDir name of the project directory @type str """ + from .GitSubmodulesDeinitDialog import GitSubmodulesDeinitDialog + # find the root of the repo repodir = projectDir while not os.path.isdir(os.path.join(repodir, self.adminDir)): @@ -4211,8 +4205,6 @@ paths = [submodule["path"] for submodule in self.__gitSubmodulesList(repodir)] - from .GitSubmodulesDeinitDialog import GitSubmodulesDeinitDialog - dlg = GitSubmodulesDeinitDialog(paths) if dlg.exec() == QDialog.DialogCode.Accepted: deinitAll, submodulePaths, force = dlg.getData() @@ -4271,6 +4263,8 @@ @param projectDir name of the project directory @type str """ + from .GitSubmodulesUpdateOptionsDialog import GitSubmodulesUpdateOptionsDialog + # find the root of the repo repodir = projectDir while not os.path.isdir(os.path.join(repodir, self.adminDir)): @@ -4280,8 +4274,6 @@ paths = [submodule["path"] for submodule in self.__gitSubmodulesList(repodir)] - from .GitSubmodulesUpdateOptionsDialog import GitSubmodulesUpdateOptionsDialog - dlg = GitSubmodulesUpdateOptionsDialog(paths) if dlg.exec() == QDialog.DialogCode.Accepted: procedure, init, remote, noFetch, force, submodulePaths = dlg.getData() @@ -4311,6 +4303,8 @@ @param projectDir name of the project directory @type str """ + from .GitSubmodulesSyncDialog import GitSubmodulesSyncDialog + # find the root of the repo repodir = projectDir while not os.path.isdir(os.path.join(repodir, self.adminDir)): @@ -4320,8 +4314,6 @@ paths = [submodule["path"] for submodule in self.__gitSubmodulesList(repodir)] - from .GitSubmodulesSyncDialog import GitSubmodulesSyncDialog - dlg = GitSubmodulesSyncDialog(paths) if dlg.exec() == QDialog.DialogCode.Accepted: submodulePaths, recursive = dlg.getData() @@ -4343,9 +4335,9 @@ @param projectDir name of the project directory @type str """ + from .GitSubmodulesStatusDialog import GitSubmodulesStatusDialog + if self.submoduleStatusDialog is None: - from .GitSubmodulesStatusDialog import GitSubmodulesStatusDialog - self.submoduleStatusDialog = GitSubmodulesStatusDialog(self) self.submoduleStatusDialog.show() self.submoduleStatusDialog.raise_() @@ -4358,6 +4350,8 @@ @param projectDir name of the project directory @type str """ + from .GitSubmodulesSummaryOptionsDialog import GitSubmodulesSummaryOptionsDialog + # find the root of the repo repodir = projectDir while not os.path.isdir(os.path.join(repodir, self.adminDir)): @@ -4367,8 +4361,6 @@ paths = [submodule["path"] for submodule in self.__gitSubmodulesList(repodir)] - from .GitSubmodulesSummaryOptionsDialog import GitSubmodulesSummaryOptionsDialog - dlg = GitSubmodulesSummaryOptionsDialog(paths) if dlg.exec() == QDialog.DialogCode.Accepted: submodulePaths, superProject, index, commit, limit = dlg.getData()
--- a/src/eric7/Plugins/VcsPlugins/vcsMercurial/CloseheadExtension/closehead.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Plugins/VcsPlugins/vcsMercurial/CloseheadExtension/closehead.py Mon Nov 07 17:19:58 2022 +0100 @@ -34,10 +34,10 @@ @param revisions revisions of branch heads to be closed @type str """ + from .HgCloseHeadSelectionDialog import HgCloseHeadSelectionDialog + message = "" if not revisions: - from .HgCloseHeadSelectionDialog import HgCloseHeadSelectionDialog - dlg = HgCloseHeadSelectionDialog(self.vcs) if dlg.exec() == QDialog.DialogCode.Accepted: revisions, message = dlg.getData()
--- a/src/eric7/Plugins/VcsPlugins/vcsMercurial/GpgExtension/gpg.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Plugins/VcsPlugins/vcsMercurial/GpgExtension/gpg.py Mon Nov 07 17:19:58 2022 +0100 @@ -80,9 +80,9 @@ @param revisions list containing the revisions to be signed @type list of str """ + from .HgGpgSignDialog import HgGpgSignDialog + if revisions is None: - from .HgGpgSignDialog import HgGpgSignDialog - dlg = HgGpgSignDialog( self.vcs.hgGetTagsList(), self.vcs.hgGetBranchesList(),
--- a/src/eric7/Plugins/VcsPlugins/vcsMercurial/HgDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Plugins/VcsPlugins/vcsMercurial/HgDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -7,7 +7,7 @@ Module implementing a dialog starting a process and showing its output. """ -from PyQt6.QtCore import QCoreApplication, Qt +from PyQt6.QtCore import QCoreApplication, QEventLoop, Qt from PyQt6.QtWidgets import QDialog, QDialogButtonBox from eric7 import Preferences, Utilities @@ -220,8 +220,6 @@ self.resultbox.ensureCursorVisible() self.errors.ensureCursorVisible() - from PyQt6.QtCore import QEventLoop - loop = QEventLoop(self) self.sendButton.clicked[bool].connect(loop.quit) self.input.returnPressed.connect(loop.quit)
--- a/src/eric7/Plugins/VcsPlugins/vcsMercurial/HgStatusDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Plugins/VcsPlugins/vcsMercurial/HgStatusDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -682,6 +682,8 @@ """ Private slot to handle the Diff context menu entry. """ + from .HgDiffDialog import HgDiffDialog + names = [ os.path.join(self.__repoPath, itm.text(self.__pathColumn)) for itm in self.__getModifiedItems() @@ -697,8 +699,6 @@ return if self.diff is None: - from .HgDiffDialog import HgDiffDialog - self.diff = HgDiffDialog(self.vcs) self.diff.show() self.diff.start(names, refreshable=True)
--- a/src/eric7/Plugins/VcsPlugins/vcsMercurial/HgStatusMonitorThread.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Plugins/VcsPlugins/vcsMercurial/HgStatusMonitorThread.py Mon Nov 07 17:19:58 2022 +0100 @@ -152,9 +152,9 @@ @return tuple containing an OK flag and potentially an error message @rtype tuple of (bool, str) """ + from .HgClient import HgClient + if self.__client is None: - from .HgClient import HgClient - client = HgClient(self.projectDir, "utf-8", self.vcs) ok, err = client.startServer() if ok:
--- a/src/eric7/Plugins/VcsPlugins/vcsMercurial/HgTagBranchListDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Plugins/VcsPlugins/vcsMercurial/HgTagBranchListDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -20,6 +20,7 @@ from eric7.EricGui import EricPixmapCache from eric7.EricWidgets import EricMessageBox from eric7.EricWidgets.EricApplication import ericApp +from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog from .Ui_HgTagBranchListDialog import Ui_HgTagBranchListDialog @@ -391,8 +392,6 @@ if itm.text(3) != "default" ] - from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog - dlg = DeleteFilesConfirmationDialog( self.parent(), self.tr("Close Branches"),
--- a/src/eric7/Plugins/VcsPlugins/vcsMercurial/HisteditExtension/HgHisteditEditor.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Plugins/VcsPlugins/vcsMercurial/HisteditExtension/HgHisteditEditor.py Mon Nov 07 17:19:58 2022 +0100 @@ -14,8 +14,11 @@ import os import sys -sys.path.insert(1, os.path.join(os.path.dirname(__file__), "..", "..", "..", "..")) -# four times up is the eric7 package directory +sys.path.insert( + 1, + os.path.join(os.path.dirname(__file__), "..", "..", "..", "..", ".."), +) +# five times up is our installation directory for arg in sys.argv[:]: if arg.startswith("--config="): @@ -51,11 +54,15 @@ if len(argv) > 1: fileName = os.path.basename(argv[1]) if fileName.startswith("hg-histedit-"): - from HgHisteditPlanEditor import HgHisteditPlanEditor + from HgHisteditPlanEditor import ( # __IGNORE_WARNING_I10__ + HgHisteditPlanEditor, + ) return HgHisteditPlanEditor(argv[1]) elif fileName.startswith("hg-editor-"): - from HgHisteditCommitEditor import HgHisteditCommitEditor + from HgHisteditCommitEditor import ( # __IGNORE_WARNING_I10__ + HgHisteditCommitEditor, + ) return HgHisteditCommitEditor(argv[1])
--- a/src/eric7/Plugins/VcsPlugins/vcsMercurial/LargefilesExtension/largefiles.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Plugins/VcsPlugins/vcsMercurial/LargefilesExtension/largefiles.py Mon Nov 07 17:19:58 2022 +0100 @@ -43,13 +43,13 @@ @exception ValueError raised to indicate a bad value for the 'direction' parameter. """ + from .LfConvertDataDialog import LfConvertDataDialog + if direction not in ["largefiles", "normal"]: raise ValueError("Bad value for 'direction' parameter.") projectDir = os.path.dirname(projectFile) - from .LfConvertDataDialog import LfConvertDataDialog - dlg = LfConvertDataDialog(projectDir, direction) if dlg.exec() == QDialog.DialogCode.Accepted: newName, minSize, patterns = dlg.getData() @@ -149,12 +149,12 @@ @param revisions list of revisions to pull (list of string) """ + from .LfRevisionsInputDialog import LfRevisionsInputDialog + revs = [] if revisions: revs = revisions else: - from .LfRevisionsInputDialog import LfRevisionsInputDialog - dlg = LfRevisionsInputDialog() if dlg.exec() == QDialog.DialogCode.Accepted: revs = dlg.getRevisions()
--- a/src/eric7/Plugins/VcsPlugins/vcsMercurial/ProjectBrowserHelper.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Plugins/VcsPlugins/vcsMercurial/ProjectBrowserHelper.py Mon Nov 07 17:19:58 2022 +0100 @@ -43,8 +43,12 @@ @param parent parent widget (QWidget) @param name name of this object (string) """ - VcsProjectBrowserHelper.__init__( - self, + from .LargefilesExtension.ProjectBrowserHelper import ( + LargefilesProjectBrowserHelper, + ) + from .ShelveExtension.ProjectBrowserHelper import ShelveProjectBrowserHelper + + super().__init__( vcsObject, browserObject, projectObject, @@ -54,11 +58,6 @@ ) # instantiate the extensions - from .LargefilesExtension.ProjectBrowserHelper import ( - LargefilesProjectBrowserHelper, - ) - from .ShelveExtension.ProjectBrowserHelper import ShelveProjectBrowserHelper - self.__extensions = { "shelve": ShelveProjectBrowserHelper( vcsObject, browserObject, projectObject
--- a/src/eric7/Plugins/VcsPlugins/vcsMercurial/ProjectHelper.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Plugins/VcsPlugins/vcsMercurial/ProjectHelper.py Mon Nov 07 17:19:58 2022 +0100 @@ -34,9 +34,6 @@ @param parent parent widget (QWidget) @param name name of this object (string) """ - VcsProjectHelper.__init__(self, vcsObject, projectObject, parent, name) - - # instantiate the extensions from .CloseheadExtension.ProjectHelper import CloseheadProjectHelper from .GpgExtension.ProjectHelper import GpgProjectHelper from .HisteditExtension.ProjectHelper import HisteditProjectHelper @@ -47,6 +44,9 @@ from .ShelveExtension.ProjectHelper import ShelveProjectHelper from .StripExtension.ProjectHelper import StripProjectHelper + super().__init__(vcsObject, projectObject, parent, name) + + # instantiate the extensions self.__extensions = { "mq": QueuesProjectHelper(), "purge": PurgeProjectHelper(),
--- a/src/eric7/Plugins/VcsPlugins/vcsMercurial/PurgeExtension/purge.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Plugins/VcsPlugins/vcsMercurial/PurgeExtension/purge.py Mon Nov 07 17:19:58 2022 +0100 @@ -9,6 +9,8 @@ from PyQt6.QtWidgets import QDialog +from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog + from ..HgDialog import HgDialog from ..HgExtension import HgExtension @@ -79,8 +81,6 @@ """Do really want to delete files not tracked by Mercurial?""" ) entries = self.__getEntries(deleteAll) - from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog - dlg = DeleteFilesConfirmationDialog(None, title, message, entries) if dlg.exec() == QDialog.DialogCode.Accepted: args = self.vcs.initCommand("purge") @@ -100,8 +100,8 @@ @param deleteAll flag indicating to list all files including ignored ones (boolean) """ - entries = self.__getEntries(deleteAll) from .HgPurgeListDialog import HgPurgeListDialog + entries = self.__getEntries(deleteAll) self.purgeListDialog = HgPurgeListDialog(entries) self.purgeListDialog.show()
--- a/src/eric7/Plugins/VcsPlugins/vcsMercurial/QueuesExtension/queues.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Plugins/VcsPlugins/vcsMercurial/QueuesExtension/queues.py Mon Nov 07 17:19:58 2022 +0100 @@ -216,12 +216,12 @@ @param editMessage flag indicating to edit the current commit message (boolean) """ + from .HgQueuesNewPatchDialog import HgQueuesNewPatchDialog + args = self.vcs.initCommand("qrefresh") if editMessage: currentMessage = self.__getCommitMessage() - from .HgQueuesNewPatchDialog import HgQueuesNewPatchDialog - dlg = HgQueuesNewPatchDialog( HgQueuesNewPatchDialog.REFRESH_MODE, currentMessage ) @@ -373,13 +373,13 @@ """ Public method to rename the current or a selected patch. """ + from .HgQueuesRenamePatchDialog import HgQueuesRenamePatchDialog + args = self.vcs.initCommand("qrename") patchnames = sorted(self.__getPatchesList(Queues.SERIES_LIST)) if patchnames: currentPatch = self.__getCurrentPatch() if currentPatch: - from .HgQueuesRenamePatchDialog import HgQueuesRenamePatchDialog - dlg = HgQueuesRenamePatchDialog(currentPatch, patchnames) if dlg.exec() == QDialog.DialogCode.Accepted: newName, selectedPatch = dlg.getData() @@ -423,13 +423,13 @@ """ Public method to fold patches into the current patch. """ + from .HgQueuesFoldDialog import HgQueuesFoldDialog + args = self.vcs.initCommand("qfold") patchnames = sorted( self.__getPatchesList(Queues.UNAPPLIED_LIST, withSummary=True) ) if patchnames: - from .HgQueuesFoldDialog import HgQueuesFoldDialog - dlg = HgQueuesFoldDialog(patchnames) if dlg.exec() == QDialog.DialogCode.Accepted: message, patchesList = dlg.getData() @@ -460,10 +460,10 @@ """ Public method to list the guards for the current or a named patch. """ + from .HgQueuesListGuardsDialog import HgQueuesListGuardsDialog + patchnames = sorted(self.__getPatchesList(Queues.SERIES_LIST)) if patchnames: - from .HgQueuesListGuardsDialog import HgQueuesListGuardsDialog - self.queuesListGuardsDialog = HgQueuesListGuardsDialog(self.vcs, patchnames) self.queuesListGuardsDialog.show() self.queuesListGuardsDialog.start() @@ -488,10 +488,10 @@ """ Public method to define guards for the current or a named patch. """ + from .HgQueuesDefineGuardsDialog import HgQueuesDefineGuardsDialog + patchnames = sorted(self.__getPatchesList(Queues.SERIES_LIST)) if patchnames: - from .HgQueuesDefineGuardsDialog import HgQueuesDefineGuardsDialog - self.queuesDefineGuardsDialog = HgQueuesDefineGuardsDialog( self.vcs, self, patchnames ) @@ -540,11 +540,11 @@ """ Public method to set the active guards. """ + from .HgQueuesGuardsSelectionDialog import HgQueuesGuardsSelectionDialog + guardsList = self.getGuardsList() if guardsList: activeGuardsList = self.getGuardsList(allGuards=False) - from .HgQueuesGuardsSelectionDialog import HgQueuesGuardsSelectionDialog - dlg = HgQueuesGuardsSelectionDialog( guardsList, activeGuards=activeGuardsList, listOnly=False ) @@ -582,10 +582,10 @@ """ Public method to list all active guards. """ + from .HgQueuesGuardsSelectionDialog import HgQueuesGuardsSelectionDialog + guardsList = self.getGuardsList(allGuards=False) if guardsList: - from .HgQueuesGuardsSelectionDialog import HgQueuesGuardsSelectionDialog - dlg = HgQueuesGuardsSelectionDialog(guardsList, listOnly=True) dlg.exec() @@ -640,6 +640,8 @@ Queues.QUEUE_PURGE, Queues.QUEUE_ACTIVATE) @exception ValueError raised to indicate an invalid operation """ + from .HgQueuesQueueManagementDialog import HgQueuesQueueManagementDialog + if operation not in ( Queues.QUEUE_PURGE, Queues.QUEUE_DELETE, @@ -654,8 +656,6 @@ else: title = self.tr("Activate Queue") - from .HgQueuesQueueManagementDialog import HgQueuesQueueManagementDialog - dlg = HgQueuesQueueManagementDialog( HgQueuesQueueManagementDialog.QUEUE_INPUT, title, True, self.vcs )
--- a/src/eric7/Plugins/VcsPlugins/vcsMercurial/RebaseExtension/rebase.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Plugins/VcsPlugins/vcsMercurial/RebaseExtension/rebase.py Mon Nov 07 17:19:58 2022 +0100 @@ -32,9 +32,9 @@ @return flag indicating that the project should be reread (boolean) """ - res = False from .HgRebaseDialog import HgRebaseDialog + res = False dlg = HgRebaseDialog( self.vcs.hgGetTagsList(), self.vcs.hgGetBranchesList(),
--- a/src/eric7/Plugins/VcsPlugins/vcsMercurial/ShelveExtension/shelve.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Plugins/VcsPlugins/vcsMercurial/ShelveExtension/shelve.py Mon Nov 07 17:19:58 2022 +0100 @@ -10,6 +10,7 @@ from PyQt6.QtWidgets import QDialog from eric7.EricWidgets import EricMessageBox +from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog from ..HgDialog import HgDialog from ..HgExtension import HgExtension @@ -66,9 +67,9 @@ or file names (list of string) @return flag indicating that the project should be reread (boolean) """ - res = False from .HgShelveDataDialog import HgShelveDataDialog + res = False dlg = HgShelveDataDialog(self.vcs.version) if dlg.exec() == QDialog.DialogCode.Accepted: shelveName, dateTime, message, addRemove, keep = dlg.getData() @@ -106,9 +107,9 @@ """ Public method to show the shelve browser dialog. """ + from .HgShelveBrowserDialog import HgShelveBrowserDialog + if self.__shelveBrowserDialog is None: - from .HgShelveBrowserDialog import HgShelveBrowserDialog - self.__shelveBrowserDialog = HgShelveBrowserDialog(self.vcs) self.__shelveBrowserDialog.show() self.__shelveBrowserDialog.start() @@ -120,9 +121,9 @@ @param shelveName name of the shelve to restore (string) @return flag indicating that the project should be reread (boolean) """ - res = False from .HgUnshelveDataDialog import HgUnshelveDataDialog + res = False dlg = HgUnshelveDataDialog(self.__hgGetShelveNamesList(), shelveName=shelveName) if dlg.exec() == QDialog.DialogCode.Accepted: shelveName, keep = dlg.getData() @@ -184,9 +185,9 @@ @param shelveNames name of shelves to delete (list of string) """ + from .HgShelvesSelectionDialog import HgShelvesSelectionDialog + if not shelveNames: - from .HgShelvesSelectionDialog import HgShelvesSelectionDialog - dlg = HgShelvesSelectionDialog( self.tr("Select the shelves to be deleted:"), self.__hgGetShelveNamesList(), @@ -196,8 +197,6 @@ else: return - from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog - dlg = DeleteFilesConfirmationDialog( None, self.tr("Delete shelves"),
--- a/src/eric7/Plugins/VcsPlugins/vcsMercurial/hg.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Plugins/VcsPlugins/vcsMercurial/hg.py Mon Nov 07 17:19:58 2022 +0100 @@ -51,6 +51,17 @@ @param parent parent widget (QWidget) @param name name of this object (string) """ + from .CloseheadExtension.closehead import Closehead + from .GpgExtension.gpg import Gpg + from .HgUtilities import getConfigPath + from .HisteditExtension.histedit import Histedit + from .LargefilesExtension.largefiles import Largefiles + from .PurgeExtension.purge import Purge + from .QueuesExtension.queues import Queues + from .RebaseExtension.rebase import Rebase + from .ShelveExtension.shelve import Shelve + from .StripExtension.strip import Strip + VersionControl.__init__(self, parent, name) self.defaultOptions = { "global": [""], @@ -117,8 +128,6 @@ self.__activeExtensions = [] - from .HgUtilities import getConfigPath - self.__iniWatcher = QFileSystemWatcher(self) self.__iniWatcher.fileChanged.connect(self.__iniFileChanged) cfgFile = getConfigPath() @@ -135,16 +144,6 @@ self.__defaultPushConfigured = False # instantiate the extensions - from .CloseheadExtension.closehead import Closehead - from .GpgExtension.gpg import Gpg - from .HisteditExtension.histedit import Histedit - from .LargefilesExtension.largefiles import Largefiles - from .PurgeExtension.purge import Purge - from .QueuesExtension.queues import Queues - from .RebaseExtension.rebase import Rebase - from .ShelveExtension.shelve import Shelve - from .StripExtension.strip import Strip - self.__extensions = { "mq": Queues(self), "purge": Purge(self), @@ -400,6 +399,8 @@ @param mq flag indicating a queue commit (boolean) @param merge flag indicating a merge commit (boolean) """ + from .HgCommitDialog import HgCommitDialog + msg = message if mq or merge: @@ -409,8 +410,6 @@ if not noDialog: # call CommitDialog and get message from there if self.__commitDialog is None: - from .HgCommitDialog import HgCommitDialog - self.__commitDialog = HgCommitDialog(self, msg, mq, merge, self.__ui) self.__commitDialog.accepted.connect(self.__vcsCommit_Step2) self.__commitDialog.show() @@ -723,6 +722,8 @@ @param noDialog flag indicating quiet operations @return flag indicating successfull operation (boolean) """ + from .HgCopyDialog import HgCopyDialog + isDir = os.path.isdir(name) res = False @@ -732,8 +733,6 @@ force = True accepted = True else: - from .HgCopyDialog import HgCopyDialog - dlg = HgCopyDialog(name, None, True) accepted = dlg.exec() == QDialog.DialogCode.Accepted if accepted: @@ -781,6 +780,8 @@ @param name file/directory name to be diffed (string) """ + from .HgDiffDialog import HgDiffDialog + names = name[:] if isinstance(name, list) else [name] for nam in names: if os.path.isfile(nam): @@ -792,8 +793,6 @@ if nam == project.ppath and not project.saveAllScripts(): return if self.diff is None: - from .HgDiffDialog import HgDiffDialog - self.diff = HgDiffDialog(self) self.diff.show() self.diff.raise_() @@ -808,9 +807,9 @@ @param name file/directory name(s) to show the status of (string or list of strings) """ + from .HgStatusDialog import HgStatusDialog + if self.status is None: - from .HgStatusDialog import HgStatusDialog - self.status = HgStatusDialog(self) self.status.show() self.status.raise_() @@ -825,9 +824,9 @@ @param largefiles flag indicating to show the largefiles status as well (boolean) """ + from .HgSummaryDialog import HgSummaryDialog + if self.summary is None: - from .HgSummaryDialog import HgSummaryDialog - self.summary = HgSummaryDialog(self) self.summary.show() self.summary.raise_() @@ -893,6 +892,8 @@ or delete @rtype bool """ + from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog + args = self.initCommand("revert") if not self.getPlugin().getPreferences("CreateBackup"): args.append("--no-backup") @@ -907,10 +908,6 @@ project = ericApp().getObject("Project") names = [project.getRelativePath(nam) for nam in names] if names[0]: - from eric7.UI.DeleteFilesConfirmationDialog import ( - DeleteFilesConfirmationDialog, - ) - dlg = DeleteFilesConfirmationDialog( self.parent(), self.tr("Revert changes"), @@ -951,9 +948,9 @@ @param rev revision to merge with @type str """ + from .HgMergeDialog import HgMergeDialog + if not rev: - from .HgMergeDialog import HgMergeDialog - dlg = HgMergeDialog( self.hgGetTagsList(), self.hgGetBranchesList(), @@ -988,6 +985,8 @@ @param name file/directory name to be merged (string) """ + from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog + args = self.initCommand("resolve") if self.getPlugin().getPreferences("InternalMerge"): args.append("--tool") @@ -1002,10 +1001,6 @@ project = ericApp().getObject("Project") names = [project.getRelativePath(nam) for nam in names] if names[0]: - from eric7.UI.DeleteFilesConfirmationDialog import ( - DeleteFilesConfirmationDialog, - ) - dlg = DeleteFilesConfirmationDialog( self.parent(), self.tr("Re-Merge"), @@ -1486,9 +1481,9 @@ @param skiplist name of a skip list file @type str """ + from .HgAnnotateDialog import HgAnnotateDialog + if self.annotate is None: - from .HgAnnotateDialog import HgAnnotateDialog - self.annotate = HgAnnotateDialog(self) self.annotate.show() self.annotate.raise_() @@ -1508,6 +1503,9 @@ @param name file/directory name to be diffed (string) """ + from .HgDiffDialog import HgDiffDialog + from .HgRevisionsSelectionDialog import HgRevisionsSelectionDialog + names = name[:] if isinstance(name, list) else [name] for nam in names: if os.path.isfile(nam): @@ -1519,8 +1517,6 @@ if nam == project.ppath and not project.saveAllScripts(): return - from .HgRevisionsSelectionDialog import HgRevisionsSelectionDialog - dlg = HgRevisionsSelectionDialog( self.hgGetTagsList(), self.hgGetBranchesList(), @@ -1529,8 +1525,6 @@ if dlg.exec() == QDialog.DialogCode.Accepted: revisions = dlg.getRevisions() if self.diff is None: - from .HgDiffDialog import HgDiffDialog - self.diff = HgDiffDialog(self) self.diff.show() self.diff.raise_() @@ -1566,12 +1560,14 @@ @param revisions tuple of two revisions (tuple of strings) @exception ValueError raised to indicate an invalid name parameter """ + from eric7.UI.CompareDialog import CompareDialog + + from .HgRevisionsSelectionDialog import HgRevisionsSelectionDialog + if isinstance(name, list): raise ValueError("Wrong parameter type") if extended: - from .HgRevisionsSelectionDialog import HgRevisionsSelectionDialog - dlg = HgRevisionsSelectionDialog( self.hgGetTagsList(), self.hgGetBranchesList(), @@ -1618,8 +1614,6 @@ return if self.sbsDiff is None: - from eric7.UI.CompareDialog import CompareDialog - self.sbsDiff = CompareDialog() self.sbsDiff.show() self.sbsDiff.raise_() @@ -1634,12 +1628,12 @@ @param isFile flag indicating log for a file is to be shown (boolean) """ + from .HgLogBrowserDialog import HgLogBrowserDialog + if name == self.getClient().getRepository(): name = None if self.logBrowser is None: - from .HgLogBrowserDialog import HgLogBrowserDialog - self.logBrowser = HgLogBrowserDialog(self) self.logBrowser.show() self.logBrowser.raise_() @@ -1650,9 +1644,9 @@ Public method used to view the log of incoming changes from the Mercurial repository. """ + from .HgLogBrowserDialog import HgLogBrowserDialog + if self.logBrowserIncoming is None: - from .HgLogBrowserDialog import HgLogBrowserDialog - self.logBrowserIncoming = HgLogBrowserDialog(self, mode="incoming") self.logBrowserIncoming.show() self.logBrowserIncoming.raise_() @@ -1663,9 +1657,9 @@ Public method used to view the log of outgoing changes from the Mercurial repository. """ + from .HgLogBrowserDialog import HgLogBrowserDialog + if self.logBrowserOutgoing is None: - from .HgLogBrowserDialog import HgLogBrowserDialog - self.logBrowserOutgoing = HgLogBrowserDialog(self, mode="outgoing") self.logBrowserOutgoing.show() self.logBrowserOutgoing.raise_() @@ -1843,9 +1837,9 @@ """ Public method used to show a list of files containing conflicts. """ + from .HgConflictsListDialog import HgConflictsListDialog + if self.conflictsDlg is None: - from .HgConflictsListDialog import HgConflictsListDialog - self.conflictsDlg = HgConflictsListDialog(self) self.conflictsDlg.show() self.conflictsDlg.raise_() @@ -1975,6 +1969,8 @@ section of the data dialog @type dict """ + from .HgRepoConfigDataDialog import HgRepoConfigDataDialog + if repoName is None: repoName = self.getClient().getRepository() @@ -1982,8 +1978,6 @@ if not os.path.exists(cfgFile): # open dialog to enter the initial data withLargefiles = self.isExtensionActive("largefiles") and withLargefiles - from .HgRepoConfigDataDialog import HgRepoConfigDataDialog - dlg = HgRepoConfigDataDialog( withLargefiles=withLargefiles, largefilesData=largefilesData ) @@ -2143,9 +2137,9 @@ @param bundleData dictionary containing the bundle creation information @type dict """ + from .HgBundleDialog import HgBundleDialog + if bundleData is None: - from .HgBundleDialog import HgBundleDialog - dlg = HgBundleDialog( self.hgGetTagsList(), self.hgGetBranchesList(), @@ -2221,6 +2215,8 @@ Public method used to view the log of incoming changes from a changegroup file. """ + from .HgLogBrowserDialog import HgLogBrowserDialog + file = EricFileDialog.getOpenFileName( None, self.tr("Preview changegroup"), @@ -2231,8 +2227,6 @@ self.__lastChangeGroupPath = os.path.dirname(file) if self.logBrowserIncoming is None: - from .HgLogBrowserDialog import HgLogBrowserDialog - self.logBrowserIncoming = HgLogBrowserDialog(self, mode="incoming") self.logBrowserIncoming.show() self.logBrowserIncoming.raise_() @@ -2291,6 +2285,8 @@ @type str @exception ValueError raised to indicate an invalid bisect subcommand """ + from .HgRevisionSelectionDialog import HgRevisionSelectionDialog + if subcommand not in ("good", "bad", "skip", "reset"): raise ValueError( self.tr("Bisect subcommand ({0}) invalid.").format(subcommand) @@ -2298,8 +2294,6 @@ rev = "" if subcommand in ("good", "bad", "skip"): - from .HgRevisionSelectionDialog import HgRevisionSelectionDialog - dlg = HgRevisionSelectionDialog( self.hgGetTagsList(), self.hgGetBranchesList(), @@ -2524,9 +2518,9 @@ @return flag indicating success (boolean) @exception ValueError raised to indicate an invalid phase """ + from .HgPhaseDialog import HgPhaseDialog + if data is None: - from .HgPhaseDialog import HgPhaseDialog - dlg = HgPhaseDialog() if dlg.exec() == QDialog.DialogCode.Accepted: data = dlg.getData() @@ -2806,6 +2800,8 @@ """ Public method to remove sub-repositories. """ + from .HgRemoveSubrepositoriesDialog import HgRemoveSubrepositoriesDialog + hgsub = self.getHgSubPath() subrepositories = [] @@ -2834,8 +2830,6 @@ ) return - from .HgRemoveSubrepositoriesDialog import HgRemoveSubrepositoriesDialog - dlg = HgRemoveSubrepositoriesDialog(subrepositories) if dlg.exec() == QDialog.DialogCode.Accepted: subrepositories, removedSubrepos, deleteSubrepos = dlg.getData() @@ -3115,11 +3109,11 @@ """ Public method used to list the available bookmarks. """ + from .HgBookmarksListDialog import HgBookmarksListDialog + self.bookmarksList = [] if self.bookmarksListDlg is None: - from .HgBookmarksListDialog import HgBookmarksListDialog - self.bookmarksListDlg = HgBookmarksListDialog(self) self.bookmarksListDlg.show() self.bookmarksListDlg.raise_() @@ -3156,11 +3150,11 @@ @param revision revision to set bookmark for (string) @param bookmark name of the bookmark (string) """ + from .HgBookmarkDialog import HgBookmarkDialog + if bool(revision) and bool(bookmark): ok = True else: - from .HgBookmarkDialog import HgBookmarkDialog - dlg = HgBookmarkDialog( HgBookmarkDialog.DEFINE_MODE, self.hgGetTagsList(), @@ -3219,9 +3213,9 @@ @param renameInfo old and new names of the bookmark @type tuple of str and str """ + from .HgBookmarkRenameDialog import HgBookmarkRenameDialog + if not renameInfo: - from .HgBookmarkRenameDialog import HgBookmarkRenameDialog - dlg = HgBookmarkRenameDialog(self.hgGetBookmarksList()) if dlg.exec() == QDialog.DialogCode.Accepted: renameInfo = dlg.getData() @@ -3244,11 +3238,11 @@ @param revision revision to set bookmark for (string) @param bookmark name of the bookmark (string) """ + from .HgBookmarkDialog import HgBookmarkDialog + if bool(revision) and bool(bookmark): ok = True else: - from .HgBookmarkDialog import HgBookmarkDialog - dlg = HgBookmarkDialog( HgBookmarkDialog.MOVE_MODE, self.hgGetTagsList(),
--- a/src/eric7/Plugins/VcsPlugins/vcsPySvn/SvnLogBrowserDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Plugins/VcsPlugins/vcsPySvn/SvnLogBrowserDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -383,12 +383,12 @@ @param rev2 second revision number (integer) @param peg_rev revision number to use as a reference (integer) """ + from .SvnDiffDialog import SvnDiffDialog + if self.sbsCheckBox.isEnabled() and self.sbsCheckBox.isChecked(): self.vcs.vcsSbsDiff(self.filename, revisions=(str(rev1), str(rev2))) else: if self.diff is None: - from .SvnDiffDialog import SvnDiffDialog - self.diff = SvnDiffDialog(self.vcs) self.diff.show() self.diff.raise_()
--- a/src/eric7/Plugins/VcsPlugins/vcsPySvn/SvnStatusDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Plugins/VcsPlugins/vcsPySvn/SvnStatusDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -759,6 +759,8 @@ """ Private slot to handle the Diff context menu entry. """ + from .SvnDiffDialog import SvnDiffDialog + names = [ os.path.join(self.dname, itm.text(self.__pathColumn)) for itm in self.__getModifiedItems() @@ -774,8 +776,6 @@ return if self.diff is None: - from .SvnDiffDialog import SvnDiffDialog - self.diff = SvnDiffDialog(self.vcs) self.diff.show() QApplication.processEvents()
--- a/src/eric7/Plugins/VcsPlugins/vcsPySvn/subversion.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Plugins/VcsPlugins/vcsPySvn/subversion.py Mon Nov 07 17:19:58 2022 +0100 @@ -24,6 +24,7 @@ from eric7.EricUtilities.EricMutexLocker import EricMutexLocker from eric7.EricWidgets import EricMessageBox from eric7.EricWidgets.EricApplication import ericApp +from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog from eric7.VCS.VersionControl import VersionControl from .SvnDialog import SvnDialog @@ -478,11 +479,11 @@ @param message message for this operation (string) @param noDialog flag indicating quiet operations """ + from .SvnCommitDialog import SvnCommitDialog + if not noDialog and not message: # call CommitDialog and get message from there if self.__commitDialog is None: - from .SvnCommitDialog import SvnCommitDialog - self.__commitDialog = SvnCommitDialog(self, self.__ui) self.__commitDialog.accepted.connect(self.__vcsCommit_Step2) self.__commitDialog.show() @@ -962,6 +963,8 @@ @param noDialog flag indicating quiet operations @return flag indicating successfull operation (boolean) """ + from .SvnCopyDialog import SvnCopyDialog + rx_prot = re.compile("(file:|svn:|svn+ssh:|http:|https:).+") opts = self.options["global"] res = False @@ -972,8 +975,6 @@ force = True accepted = True else: - from .SvnCopyDialog import SvnCopyDialog - dlg = SvnCopyDialog(name, None, True, "--force" in opts) accepted = dlg.exec() == QDialog.DialogCode.Accepted if accepted: @@ -1039,6 +1040,8 @@ @param name file/directory name to be diffed (string) """ + from .SvnDiffDialog import SvnDiffDialog + names = name[:] if isinstance(name, list) else [name] for nam in names: if os.path.isfile(nam): @@ -1050,8 +1053,6 @@ if nam == project.ppath and not project.saveAllScripts(): return if self.diff is None: - from .SvnDiffDialog import SvnDiffDialog - self.diff = SvnDiffDialog(self) self.diff.show() self.diff.raise_() @@ -1066,9 +1067,9 @@ @param name file/directory name(s) to show the status of (string or list of strings) """ + from .SvnStatusDialog import SvnStatusDialog + if self.status is None: - from .SvnStatusDialog import SvnStatusDialog - self.status = SvnStatusDialog(self) self.status.show() self.status.raise_() @@ -1082,6 +1083,8 @@ @param name file/directory name to be tagged (string) """ + from .SvnTagDialog import SvnTagDialog + dname, fname = self.splitPath(name) reposURL = self.svnGetReposName(dname) @@ -1100,8 +1103,6 @@ url = ( None if self.otherData["standardLayout"] else self.svnNormalizeURL(reposURL) ) - from .SvnTagDialog import SvnTagDialog - dlg = SvnTagDialog( self.allTagsBranchesList, url, self.otherData["standardLayout"] ) @@ -1191,10 +1192,6 @@ project = ericApp().getObject("Project") names = [project.getRelativePath(nam) for nam in name] if names[0]: - from eric7.UI.DeleteFilesConfirmationDialog import ( - DeleteFilesConfirmationDialog, - ) - dia = DeleteFilesConfirmationDialog( self.parent(), self.tr("Revert changes"), @@ -1255,6 +1252,8 @@ @return flag indicating, that the switch contained an add or delete (boolean) """ + from .SvnSwitchDialog import SvnSwitchDialog + dname, fname = self.splitPath(name) reposURL = self.svnGetReposName(dname) @@ -1273,8 +1272,6 @@ url = ( None if self.otherData["standardLayout"] else self.svnNormalizeURL(reposURL) ) - from .SvnSwitchDialog import SvnSwitchDialog - dlg = SvnSwitchDialog( self.allTagsBranchesList, url, self.otherData["standardLayout"] ) @@ -1339,11 +1336,11 @@ @param name file/directory name to be merged (string) """ + from .SvnMergeDialog import SvnMergeDialog + dname, fname = self.splitPath(name) opts = self.options["global"] - from .SvnMergeDialog import SvnMergeDialog - dlg = SvnMergeDialog( self.mergeList[0], self.mergeList[1], self.mergeList[2], "--force" in opts ) @@ -1549,6 +1546,8 @@ @return the received dictionary completed with a combination of canBeCommited and canBeAdded or None in order to signal an error """ + from .SvnDialogMixin import SvnDialogMixin + if dname.endswith(os.sep): dname = dname[:-1] dname = os.path.normcase(dname) @@ -1567,8 +1566,6 @@ if os.path.splitdrive(repodir)[1] == os.sep: return names - from .SvnDialogMixin import SvnDialogMixin - mixin = SvnDialogMixin() client = self.getClient() client.callback_get_login = mixin._clientLoginCallback @@ -1627,6 +1624,8 @@ @return the received dictionary completed with a combination of canBeCommited and canBeAdded or None in order to signal an error """ + from .SvnDialogMixin import SvnDialogMixin + if not os.path.isdir(os.path.join(dname, self.adminDir)): # not under version control -> do nothing return names @@ -1642,8 +1641,6 @@ names[name] = self.statusCache[name] if not found: - from .SvnDialogMixin import SvnDialogMixin - mixin = SvnDialogMixin() client = self.getClient() client.callback_get_login = mixin._clientLoginCallback @@ -1740,6 +1737,10 @@ @param name directory name of the working directory (string) """ + from eric7.Plugins.VcsPlugins.vcsSubversion.SvnDialog import ( + SvnDialog as SvnProcessDialog, + ) + from .SvnCommandDialog import SvnCommandDialog dlg = SvnCommandDialog(self.commandHistory, self.wdHistory, name) @@ -1759,10 +1760,6 @@ args = [] self.addArguments(args, commandList) - from eric7.Plugins.VcsPlugins.vcsSubversion.SvnDialog import ( - SvnDialog as SvnProcessDialog, - ) - dia = SvnProcessDialog(self.tr("Subversion command")) res = dia.startProcess(args, wd) if res: @@ -1959,9 +1956,9 @@ @param name file/directory name (string or list of strings) @param recursive flag indicating a recursive list is requested """ + from .SvnPropListDialog import SvnPropListDialog + if self.propList is None: - from .SvnPropListDialog import SvnPropListDialog - self.propList = SvnPropListDialog(self) self.propList.show() self.propList.raise_() @@ -2092,9 +2089,9 @@ @param tags flag indicating listing of branches or tags (False = branches, True = tags) """ + from .SvnTagBranchListDialog import SvnTagBranchListDialog + if self.tagbranchList is None: - from .SvnTagBranchListDialog import SvnTagBranchListDialog - self.tagbranchList = SvnTagBranchListDialog(self) self.tagbranchList.show() self.tagbranchList.raise_() @@ -2120,9 +2117,9 @@ @param name file name to show the blame for (string) """ + from .SvnBlameDialog import SvnBlameDialog + if self.blame is None: - from .SvnBlameDialog import SvnBlameDialog - self.blame = SvnBlameDialog(self) self.blame.show() self.blame.raise_() @@ -2143,6 +2140,9 @@ @param name file/directory name to be diffed (string) """ + from .SvnDiffDialog import SvnDiffDialog + from .SvnRevisionSelectionDialog import SvnRevisionSelectionDialog + names = name[:] if isinstance(name, list) else [name] for nam in names: if os.path.isfile(nam): @@ -2153,14 +2153,10 @@ project = ericApp().getObject("Project") if nam == project.ppath and not project.saveAllScripts(): return - from .SvnRevisionSelectionDialog import SvnRevisionSelectionDialog - dlg = SvnRevisionSelectionDialog() if dlg.exec() == QDialog.DialogCode.Accepted: revisions = dlg.getRevisions() if self.diff is None: - from .SvnDiffDialog import SvnDiffDialog - self.diff = SvnDiffDialog(self) self.diff.show() self.diff.raise_() @@ -2181,6 +2177,9 @@ @param name file/directory name to be diffed (string) """ + from .SvnDiffDialog import SvnDiffDialog + from .SvnUrlSelectionDialog import SvnUrlSelectionDialog + names = name[:] if isinstance(name, list) else [name] for nam in names: if os.path.isfile(nam): @@ -2194,14 +2193,10 @@ dname = self.splitPath(names[0])[0] - from .SvnUrlSelectionDialog import SvnUrlSelectionDialog - dlg = SvnUrlSelectionDialog(self, self.tagsList, self.branchesList, dname) if dlg.exec() == QDialog.DialogCode.Accepted: urls, summary = dlg.getURLs() if self.diff is None: - from .SvnDiffDialog import SvnDiffDialog - self.diff = SvnDiffDialog(self) self.diff.show() self.diff.raise_() @@ -2262,12 +2257,14 @@ @param revisions tuple of two revisions (tuple of strings) @exception ValueError raised to indicate an invalid name parameter type """ + from eric7.UI.CompareDialog import CompareDialog + + from .SvnRevisionSelectionDialog import SvnRevisionSelectionDialog + if isinstance(name, list): raise ValueError("Wrong parameter type") if extended: - from .SvnRevisionSelectionDialog import SvnRevisionSelectionDialog - dlg = SvnRevisionSelectionDialog() if dlg.exec() == QDialog.DialogCode.Accepted: rev1, rev2 = dlg.getRevisions() @@ -2314,8 +2311,6 @@ return if self.sbsDiff is None: - from eric7.UI.CompareDialog import CompareDialog - self.sbsDiff = CompareDialog() self.sbsDiff.show() self.sbsDiff.raise_() @@ -2329,9 +2324,9 @@ @param name file/directory name to show the log of (string) @param isFile flag indicating log for a file is to be shown (boolean) """ + from .SvnLogBrowserDialog import SvnLogBrowserDialog + if self.logBrowser is None: - from .SvnLogBrowserDialog import SvnLogBrowserDialog - self.logBrowser = SvnLogBrowserDialog(self) self.logBrowser.show() self.logBrowser.raise_() @@ -2475,6 +2470,8 @@ @param projectPath path name of the project (string) """ + from .SvnRepoBrowserDialog import SvnRepoBrowserDialog + url = self.svnGetReposName(projectPath) if projectPath else None if url is None: url, ok = QInputDialog.getText( @@ -2487,8 +2484,6 @@ return if self.repoBrowser is None: - from .SvnRepoBrowserDialog import SvnRepoBrowserDialog - self.repoBrowser = SvnRepoBrowserDialog(self) self.repoBrowser.start(url) self.repoBrowser.show()
--- a/src/eric7/Plugins/VcsPlugins/vcsSubversion/SvnLogBrowserDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Plugins/VcsPlugins/vcsSubversion/SvnLogBrowserDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -512,12 +512,12 @@ @param rev1 first revision number (integer) @param rev2 second revision number (integer) """ + from .SvnDiffDialog import SvnDiffDialog + if self.sbsCheckBox.isEnabled() and self.sbsCheckBox.isChecked(): self.vcs.vcsSbsDiff(self.filename, revisions=(str(rev1), str(rev2))) else: if self.diff is None: - from .SvnDiffDialog import SvnDiffDialog - self.diff = SvnDiffDialog(self.vcs) self.diff.show() self.diff.raise_()
--- a/src/eric7/Plugins/VcsPlugins/vcsSubversion/SvnStatusDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Plugins/VcsPlugins/vcsSubversion/SvnStatusDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -902,6 +902,8 @@ """ Private slot to handle the Diff context menu entry. """ + from .SvnDiffDialog import SvnDiffDialog + names = [ os.path.join(self.dname, itm.text(self.__pathColumn)) for itm in self.__getModifiedItems() @@ -917,8 +919,6 @@ return if self.diff is None: - from .SvnDiffDialog import SvnDiffDialog - self.diff = SvnDiffDialog(self.vcs) self.diff.show() QApplication.processEvents()
--- a/src/eric7/Plugins/VcsPlugins/vcsSubversion/subversion.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Plugins/VcsPlugins/vcsSubversion/subversion.py Mon Nov 07 17:19:58 2022 +0100 @@ -19,6 +19,7 @@ from eric7 import Preferences, Utilities from eric7.EricWidgets import EricMessageBox from eric7.EricWidgets.EricApplication import ericApp +from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog from eric7.VCS.VersionControl import VersionControl from .SvnDialog import SvnDialog @@ -455,13 +456,13 @@ @param message message for this operation (string) @param noDialog flag indicating quiet operations """ + from .SvnCommitDialog import SvnCommitDialog + msg = message if not noDialog and not msg: # call CommitDialog and get message from there if self.__commitDialog is None: - from .SvnCommitDialog import SvnCommitDialog - self.__commitDialog = SvnCommitDialog(self, self.__ui) self.__commitDialog.accepted.connect(self.__vcsCommit_Step2) self.__commitDialog.show() @@ -874,6 +875,8 @@ @param noDialog flag indicating quiet operations @return flag indicating successfull operation (boolean) """ + from .SvnCopyDialog import SvnCopyDialog + rx_prot = re.compile("(file:|svn:|svn+ssh:|http:|https:).+") opts = self.options["global"][:] force = "--force" in opts @@ -887,8 +890,6 @@ force = True accepted = True else: - from .SvnCopyDialog import SvnCopyDialog - dlg = SvnCopyDialog(name, None, True, force) accepted = dlg.exec() == QDialog.DialogCode.Accepted if accepted: @@ -944,6 +945,8 @@ @param name file/directory name to be diffed (string) """ + from .SvnDiffDialog import SvnDiffDialog + names = name[:] if isinstance(name, list) else [name] for nam in names: if os.path.isfile(nam): @@ -955,8 +958,6 @@ if nam == project.ppath and not project.saveAllScripts(): return if self.diff is None: - from .SvnDiffDialog import SvnDiffDialog - self.diff = SvnDiffDialog(self) self.diff.show() self.diff.raise_() @@ -971,9 +972,9 @@ @param name file/directory name(s) to show the status of (string or list of strings) """ + from .SvnStatusDialog import SvnStatusDialog + if self.status is None: - from .SvnStatusDialog import SvnStatusDialog - self.status = SvnStatusDialog(self) self.status.show() self.status.raise_() @@ -986,6 +987,8 @@ @param name file/directory name to be tagged (string) """ + from .SvnTagDialog import SvnTagDialog + dname, fname = self.splitPath(name) reposURL = self.svnGetReposName(dname) @@ -1004,8 +1007,6 @@ url = ( None if self.otherData["standardLayout"] else self.svnNormalizeURL(reposURL) ) - from .SvnTagDialog import SvnTagDialog - dlg = SvnTagDialog( self.allTagsBranchesList, url, self.otherData["standardLayout"] ) @@ -1089,10 +1090,6 @@ project = ericApp().getObject("Project") names = [project.getRelativePath(nam) for nam in names] if names[0]: - from eric7.UI.DeleteFilesConfirmationDialog import ( - DeleteFilesConfirmationDialog, - ) - dlg = DeleteFilesConfirmationDialog( self.parent(), self.tr("Revert changes"), @@ -1140,6 +1137,8 @@ @param name directory name to be switched (string) @return flag indicating added or changed files (boolean) """ + from .SvnSwitchDialog import SvnSwitchDialog + dname, fname = self.splitPath(name) reposURL = self.svnGetReposName(dname) @@ -1158,8 +1157,6 @@ url = ( None if self.otherData["standardLayout"] else self.svnNormalizeURL(reposURL) ) - from .SvnSwitchDialog import SvnSwitchDialog - dlg = SvnSwitchDialog( self.allTagsBranchesList, url, self.otherData["standardLayout"] ) @@ -1221,6 +1218,8 @@ @param name file/directory name to be merged (string) """ + from .SvnMergeDialog import SvnMergeDialog + dname, fname = self.splitPath(name) opts = self.options["global"][:] @@ -1228,8 +1227,6 @@ if force: del opts[opts.index("--force")] - from .SvnMergeDialog import SvnMergeDialog - dlg = SvnMergeDialog( self.mergeList[0], self.mergeList[1], self.mergeList[2], force ) @@ -1800,9 +1797,9 @@ @param name file/directory name (string or list of strings) @param recursive flag indicating a recursive list is requested """ + from .SvnPropListDialog import SvnPropListDialog + if self.propList is None: - from .SvnPropListDialog import SvnPropListDialog - self.propList = SvnPropListDialog(self) self.propList.show() self.propList.raise_() @@ -1900,9 +1897,9 @@ @param tags flag indicating listing of branches or tags (False = branches, True = tags) """ + from .SvnTagBranchListDialog import SvnTagBranchListDialog + if self.tagbranchList is None: - from .SvnTagBranchListDialog import SvnTagBranchListDialog - self.tagbranchList = SvnTagBranchListDialog(self) self.tagbranchList.show() self.tagbranchList.raise_() @@ -1931,9 +1928,9 @@ @param name file name to show the blame for (string) """ + from .SvnBlameDialog import SvnBlameDialog + if self.blame is None: - from .SvnBlameDialog import SvnBlameDialog - self.blame = SvnBlameDialog(self) self.blame.show() self.blame.raise_() @@ -1953,6 +1950,9 @@ @param name file/directory name to be diffed (string) """ + from .SvnDiffDialog import SvnDiffDialog + from .SvnRevisionSelectionDialog import SvnRevisionSelectionDialog + names = name[:] if isinstance(name, list) else [name] for nam in names: if os.path.isfile(nam): @@ -1963,13 +1963,9 @@ project = ericApp().getObject("Project") if nam == project.ppath and not project.saveAllScripts(): return - from .SvnRevisionSelectionDialog import SvnRevisionSelectionDialog - dlg = SvnRevisionSelectionDialog() if dlg.exec() == QDialog.DialogCode.Accepted: revisions = dlg.getRevisions() - from .SvnDiffDialog import SvnDiffDialog - self.diff = SvnDiffDialog(self) self.diff.show() self.diff.start(name, revisions) @@ -1988,6 +1984,9 @@ @param name file/directory name to be diffed (string) """ + from .SvnDiffDialog import SvnDiffDialog + from .SvnUrlSelectionDialog import SvnUrlSelectionDialog + names = name[:] if isinstance(name, list) else [name] for nam in names: if os.path.isfile(nam): @@ -2001,13 +2000,9 @@ dname = self.splitPath(names[0])[0] - from .SvnUrlSelectionDialog import SvnUrlSelectionDialog - dlg = SvnUrlSelectionDialog(self, self.tagsList, self.branchesList, dname) if dlg.exec() == QDialog.DialogCode.Accepted: urls, summary = dlg.getURLs() - from .SvnDiffDialog import SvnDiffDialog - self.diff = SvnDiffDialog(self) self.diff.show() QApplication.processEvents() @@ -2070,12 +2065,14 @@ @param revisions tuple of two revisions (tuple of strings) @exception ValueError raised to indicate an illegal name parameter type """ + from eric7.UI.CompareDialog import CompareDialog + + from .SvnRevisionSelectionDialog import SvnRevisionSelectionDialog + if isinstance(name, list): raise ValueError("Wrong parameter type") if extended: - from .SvnRevisionSelectionDialog import SvnRevisionSelectionDialog - dlg = SvnRevisionSelectionDialog() if dlg.exec() == QDialog.DialogCode.Accepted: rev1, rev2 = dlg.getRevisions() @@ -2122,8 +2119,6 @@ return if self.sbsDiff is None: - from eric7.UI.CompareDialog import CompareDialog - self.sbsDiff = CompareDialog() self.sbsDiff.show() self.sbsDiff.raise_() @@ -2137,9 +2132,9 @@ @param name file/directory name to show the log of (string) @param isFile flag indicating log for a file is to be shown (boolean) """ + from .SvnLogBrowserDialog import SvnLogBrowserDialog + if self.logBrowser is None: - from .SvnLogBrowserDialog import SvnLogBrowserDialog - self.logBrowser = SvnLogBrowserDialog(self) self.logBrowser.show() self.logBrowser.raise_() @@ -2230,6 +2225,8 @@ @param projectPath path name of the project (string) """ + from .SvnRepoBrowserDialog import SvnRepoBrowserDialog + url = self.svnGetReposName(projectPath) if projectPath else None if url is None: @@ -2243,8 +2240,6 @@ return if self.repoBrowser is None: - from .SvnRepoBrowserDialog import SvnRepoBrowserDialog - self.repoBrowser = SvnRepoBrowserDialog(self) self.repoBrowser.show() self.repoBrowser.raise_()
--- a/src/eric7/Plugins/WizardPlugins/QRegularExpressionWizard/QRegularExpressionWizardServer.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Plugins/WizardPlugins/QRegularExpressionWizard/QRegularExpressionWizardServer.py Mon Nov 07 17:19:58 2022 +0100 @@ -10,6 +10,8 @@ import json import sys +from PyQt6.QtCore import QRegularExpression + def rxValidate(regexp, options): """ @@ -20,36 +22,29 @@ @return tuple of flag indicating validity (boolean), error string (string) and error offset (integer) """ - try: - from PyQt6.QtCore import QRegularExpression + rxOptions = QRegularExpression.PatternOption.NoPatternOption + if "CaseInsensitiveOption" in options: + rxOptions |= QRegularExpression.PatternOption.CaseInsensitiveOption + if "MultilineOption" in options: + rxOptions |= QRegularExpression.PatternOption.MultilineOption + if "DotMatchesEverythingOption" in options: + rxOptions |= QRegularExpression.PatternOption.DotMatchesEverythingOption + if "ExtendedPatternSyntaxOption" in options: + rxOptions |= QRegularExpression.PatternOption.ExtendedPatternSyntaxOption + if "InvertedGreedinessOption" in options: + rxOptions |= QRegularExpression.PatternOption.InvertedGreedinessOption + if "UseUnicodePropertiesOption" in options: + rxOptions |= QRegularExpression.PatternOption.UseUnicodePropertiesOption + if "DontCaptureOption" in options: + rxOptions |= QRegularExpression.PatternOption.DontCaptureOption - rxOptions = QRegularExpression.PatternOption.NoPatternOption - if "CaseInsensitiveOption" in options: - rxOptions |= QRegularExpression.PatternOption.CaseInsensitiveOption - if "MultilineOption" in options: - rxOptions |= QRegularExpression.PatternOption.MultilineOption - if "DotMatchesEverythingOption" in options: - rxOptions |= QRegularExpression.PatternOption.DotMatchesEverythingOption - if "ExtendedPatternSyntaxOption" in options: - rxOptions |= QRegularExpression.PatternOption.ExtendedPatternSyntaxOption - if "InvertedGreedinessOption" in options: - rxOptions |= QRegularExpression.PatternOption.InvertedGreedinessOption - if "UseUnicodePropertiesOption" in options: - rxOptions |= QRegularExpression.PatternOption.UseUnicodePropertiesOption - if "DontCaptureOption" in options: - rxOptions |= QRegularExpression.PatternOption.DontCaptureOption - - error = "" - errorOffset = -1 - re = QRegularExpression(regexp, rxOptions) - valid = re.isValid() - if not valid: - error = re.errorString() - errorOffset = re.patternErrorOffset() - except ImportError: - valid = False - error = "ImportError" - errorOffset = 0 + error = "" + errorOffset = -1 + re = QRegularExpression(regexp, rxOptions) + valid = re.isValid() + if not valid: + error = re.errorString() + errorOffset = re.patternErrorOffset() return valid, error, errorOffset @@ -71,8 +66,6 @@ if not valid: return valid, error, errorOffset - from PyQt6.QtCore import QRegularExpression - rxOptions = QRegularExpression.PatternOption.NoPatternOption if "CaseInsensitiveOption" in options: rxOptions |= QRegularExpression.PatternOption.CaseInsensitiveOption
--- a/src/eric7/Preferences/ConfigurationDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Preferences/ConfigurationDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -131,7 +131,9 @@ self.itmDict = {} if not fromEric: - from eric7.PluginManager.PluginManager import PluginManager + from eric7.PluginManager.PluginManager import ( # __IGNORE_WARNING_I101__ + PluginManager, + ) try: self.pluginManager = ericApp().getObject("PluginManager") @@ -139,7 +141,9 @@ self.pluginManager = PluginManager(self) ericApp().registerObject("PluginManager", self.pluginManager) - from eric7.VirtualEnv.VirtualenvManager import VirtualenvManager + from eric7.VirtualEnv.VirtualenvManager import ( # __IGNORE_WARNING_I101__ + VirtualenvManager, + ) try: self.virtualenvManager = ericApp().getObject("VirtualEnvManager")
--- a/src/eric7/Preferences/ConfigurationPages/CondaPage.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Preferences/ConfigurationPages/CondaPage.py Mon Nov 07 17:19:58 2022 +0100 @@ -7,7 +7,7 @@ Module implementing the conda configuration page. """ -from eric7 import Preferences +from eric7 import CondaInterface, Preferences from eric7.EricWidgets.EricPathPicker import EricPathPickerModes from .ConfigurationPageBase import ConfigurationPageBase @@ -46,8 +46,6 @@ if condaExecutable != self.__condaExecutable: Preferences.setConda("CondaExecutable", condaExecutable) - from eric7 import CondaInterface - CondaInterface.resetInterface()
--- a/src/eric7/Preferences/ConfigurationPages/DebuggerPython3Page.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Preferences/ConfigurationPages/DebuggerPython3Page.py Mon Nov 07 17:19:58 2022 +0100 @@ -35,7 +35,9 @@ self.__virtualenvManager = ericApp().getObject("VirtualEnvManager") self.__standalone = False except KeyError: - from eric7.VirtualEnv.VirtualenvManager import VirtualenvManager + from eric7.VirtualEnv.VirtualenvManager import ( # __IGNORE_WARNING_I101__ + VirtualenvManager, + ) self.__virtualenvManager = VirtualenvManager() self.__standalone = True
--- a/src/eric7/Preferences/ConfigurationPages/EditorAPIsPage.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Preferences/ConfigurationPages/EditorAPIsPage.py Mon Nov 07 17:19:58 2022 +0100 @@ -18,6 +18,8 @@ from eric7.EricWidgets.EricApplication import ericApp from eric7.EricWidgets.EricListSelectionDialog import EricListSelectionDialog from eric7.EricWidgets.EricPathPicker import EricPathPickerModes +from eric7.QScintilla import Lexers +from eric7.QScintilla.APIsManager import APIsManager from .ConfigurationPageBase import ConfigurationPageBase from .Ui_EditorAPIsPage import Ui_EditorAPIsPage @@ -50,8 +52,6 @@ self.pluginManager = ericApp().getObject("PluginManager") self.apiAutoPrepareCheckBox.setChecked(Preferences.getEditor("AutoPrepareAPIs")) - from eric7.QScintilla import Lexers - self.apis = {} apiLanguages = sorted([""] + list(Lexers.getSupportedApiLanguages())) for lang in apiLanguages: @@ -181,8 +181,6 @@ self.apiList.addItem(api) self.prepareApiButton.setEnabled(self.apiList.count() > 0) - from eric7.QScintilla.APIsManager import APIsManager - self.__currentAPI = APIsManager().getAPIs( self.__currentApiLanguage, projectType=self.__currentApiProjectType )
--- a/src/eric7/Preferences/ConfigurationPages/EditorFilePage.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Preferences/ConfigurationPages/EditorFilePage.py Mon Nov 07 17:19:58 2022 +0100 @@ -16,6 +16,7 @@ from eric7 import Globals, Preferences from eric7.EricWidgets import EricMessageBox from eric7.EricWidgets.EricApplication import ericApp +from eric7.QScintilla import Lexers from eric7.Utilities import supportedCodecs from .ConfigurationPageBase import ConfigurationPageBase @@ -244,8 +245,6 @@ selectedOpenFilter = self.openFilesFilterComboBox.currentText() selectedSaveFilter = self.saveFilesFilterComboBox.currentText() - from eric7.QScintilla import Lexers - openFileFiltersList = ( Lexers.getOpenFileFiltersList(False, withAdditional=False) + self.openFileFilters
--- a/src/eric7/Preferences/ConfigurationPages/EditorHighlightersPage.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Preferences/ConfigurationPages/EditorHighlightersPage.py Mon Nov 07 17:19:58 2022 +0100 @@ -15,6 +15,7 @@ from eric7 import Preferences from eric7.EricGui import EricPixmapCache +from eric7.QScintilla import Lexers from .ConfigurationPageBase import ConfigurationPageBase from .Ui_EditorHighlightersPage import Ui_EditorHighlightersPage @@ -47,8 +48,6 @@ except AttributeError: self.extsep = "." - from eric7.QScintilla import Lexers - self.extras = ["-----------", self.tr("Alternative")] self.editorLexerCombo.addItem("") self.editorLexerCombo.addItem(EricPixmapCache.getIcon("fileText"), "Text")
--- a/src/eric7/Preferences/ConfigurationPages/EditorHighlightingStylesPage.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Preferences/ConfigurationPages/EditorHighlightingStylesPage.py Mon Nov 07 17:19:58 2022 +0100 @@ -22,6 +22,9 @@ from eric7.EricGui import EricPixmapCache from eric7.EricWidgets import EricFileDialog, EricMessageBox +from eric7.EricXML.HighlightingStylesReader import HighlightingStylesReader +from eric7.Preferences.HighlightingStylesFile import HighlightingStylesFile +from eric7.QScintilla import Lexers from ..SubstyleDefinitionDialog import SubstyleDefinitionDialog from .ConfigurationPageBase import ConfigurationPageBase @@ -89,8 +92,6 @@ self.lexers = lexers # set initial values - from eric7.QScintilla import Lexers - languages = sorted([""] + list(self.lexers.keys())) for language in languages: self.lexerLanguageComboBox.addItem( @@ -541,6 +542,10 @@ """ from eric7.Globals import getConfig + from .EditorHighlightingStylesSelectionDialog import ( + EditorHighlightingStylesSelectionDialog, + ) + stylesDir = getConfig("ericStylesDir") lexerNames = list(self.lexers.keys()) @@ -549,10 +554,6 @@ preselect = [self.lexer.language()] else: preselect = [] - from .EditorHighlightingStylesSelectionDialog import ( - EditorHighlightingStylesSelectionDialog, - ) - dlg = EditorHighlightingStylesSelectionDialog( lexerNames, forImport=False, preselect=preselect ) @@ -596,8 +597,6 @@ ) if ok: - from eric7.Preferences.HighlightingStylesFile import HighlightingStylesFile - highlightingStylesFile = HighlightingStylesFile() highlightingStylesFile.writeFile(str(fpath), lexers) @@ -628,8 +627,6 @@ if fn.endswith(".ehj"): # new JSON based file - from eric7.Preferences.HighlightingStylesFile import HighlightingStylesFile - highlightingStylesFile = HighlightingStylesFile() styles = highlightingStylesFile.readFile(fn) if not styles: @@ -638,10 +635,6 @@ # old XML based file f = QFile(fn) if f.open(QIODevice.OpenModeFlag.ReadOnly): - from eric7.EricXML.HighlightingStylesReader import ( - HighlightingStylesReader, - ) - reader = HighlightingStylesReader(f, self.lexers) styles = reader.readXML() f.close() @@ -673,13 +666,13 @@ (defaults to False) @type bool (optional) """ + from .EditorHighlightingStylesSelectionDialog import ( + EditorHighlightingStylesSelectionDialog, + ) + lexerNames = [d["name"] for d in stylesList if d["name"] in self.lexers] if not importAll: - from .EditorHighlightingStylesSelectionDialog import ( - EditorHighlightingStylesSelectionDialog, - ) - dlg = EditorHighlightingStylesSelectionDialog(lexerNames, forImport=True) if dlg.exec() == QDialog.DialogCode.Accepted: lexerNames = dlg.getLexerNames()
--- a/src/eric7/Preferences/ConfigurationPages/EditorKeywordsPage.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Preferences/ConfigurationPages/EditorKeywordsPage.py Mon Nov 07 17:19:58 2022 +0100 @@ -11,6 +11,8 @@ from eric7 import Preferences from eric7.EricWidgets import EricMessageBox +from eric7.QScintilla import Lexers +from eric7.QScintilla.Lexers.LexerContainer import LexerContainer from .ConfigurationPageBase import ConfigurationPageBase from .Ui_EditorKeywordsPage import Ui_EditorKeywordsPage @@ -32,9 +34,6 @@ self.setObjectName("EditorKeywordsPage") # set initial values - from eric7.QScintilla import Lexers - from eric7.QScintilla.Lexers.LexerContainer import LexerContainer - self.__keywords = { "": { "Sets": [""] * (self.MaxKeywordSets + 1),
--- a/src/eric7/Preferences/ConfigurationPages/EditorSpellCheckingPage.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Preferences/ConfigurationPages/EditorSpellCheckingPage.py Mon Nov 07 17:19:58 2022 +0100 @@ -9,6 +9,7 @@ from eric7 import Preferences from eric7.EricWidgets.EricPathPicker import EricPathPickerModes +from eric7.QScintilla.SpellChecker import SpellChecker from .ConfigurationPageBase import ConfigurationPageBase from .Ui_EditorSpellCheckingPage import Ui_EditorSpellCheckingPage @@ -33,8 +34,6 @@ self.pelPicker.setMode(EricPathPickerModes.OPEN_FILE_MODE) self.pelPicker.setFilters(self.tr("Dictionary File (*.dic);;All Files (*)")) - from eric7.QScintilla.SpellChecker import SpellChecker - languages = sorted(SpellChecker.getAvailableLanguages()) self.defaultLanguageCombo.addItems(languages) if languages:
--- a/src/eric7/Preferences/ConfigurationPages/EditorStylesPage.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Preferences/ConfigurationPages/EditorStylesPage.py Mon Nov 07 17:19:58 2022 +0100 @@ -13,6 +13,7 @@ from PyQt6.QtWidgets import QColorDialog, QFontDialog from eric7 import Preferences +from eric7.QScintilla.QsciScintillaCompat import QsciScintillaCompat from .ConfigurationPageBase import ConfigurationPageBase from .Ui_EditorStylesPage import Ui_EditorStylesPage @@ -31,8 +32,6 @@ self.setupUi(self) self.setObjectName("EditorStylesPage") - from eric7.QScintilla.QsciScintillaCompat import QsciScintillaCompat - self.foldStyles = [ QsciScintilla.FoldStyle.PlainFoldStyle.value, QsciScintilla.FoldStyle.CircledFoldStyle.value,
--- a/src/eric7/Preferences/ConfigurationPages/EmailPage.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Preferences/ConfigurationPages/EmailPage.py Mon Nov 07 17:19:58 2022 +0100 @@ -15,6 +15,7 @@ from eric7 import Preferences from eric7.EricGui.EricOverrideCursor import EricOverrideCursor from eric7.EricWidgets import EricMessageBox +from eric7.EricWidgets.EricSimpleHelpDialog import EricSimpleHelpDialog from .ConfigurationPageBase import ConfigurationPageBase from .Ui_EmailPage import Ui_EmailPage @@ -223,7 +224,9 @@ """ if self.__helpDialog is None: try: - from eric7.EricNetwork.EricGoogleMail import GoogleMailHelp + from eric7.EricNetwork.EricGoogleMail import ( # __IGNORE_WARNING__ + GoogleMailHelp, + ) helpStr = GoogleMailHelp() except ImportError: @@ -232,8 +235,6 @@ " Use the <b>{0}</b> button to install it.</p>" ).format(self.googleInstallButton.text()) - from eric7.EricWidgets.EricSimpleHelpDialog import EricSimpleHelpDialog - self.__helpDialog = EricSimpleHelpDialog( title=self.tr("Gmail API Help"), helpStr=helpStr, parent=self ) @@ -270,7 +271,7 @@ try: from eric7.EricNetwork import EricGoogleMail # __IGNORE_WARNING__ - from eric7.EricNetwork.EricGoogleMailHelpers import ( + from eric7.EricNetwork.EricGoogleMailHelpers import ( # __IGNORE_WARNING__ isClientSecretFileAvailable, )
--- a/src/eric7/Preferences/ConfigurationPages/IconsPage.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Preferences/ConfigurationPages/IconsPage.py Mon Nov 07 17:19:58 2022 +0100 @@ -176,6 +176,8 @@ """ Private slot to display a preview of an icons directory. """ + from .IconsPreviewDialog import IconsPreviewDialog + directory = self.iconDirectoryPicker.text() if directory: directories = [directory] @@ -184,8 +186,6 @@ for row in range(self.iconDirectoryList.count()): directories.append(self.iconDirectoryList.item(row).text()) if directories: - from .IconsPreviewDialog import IconsPreviewDialog - dlg = IconsPreviewDialog(directories, self) dlg.exec() @@ -194,6 +194,8 @@ """ Private slot to display a preview of the selected default icons. """ + from .IconsPreviewDialog import IconsPreviewDialog + defaultIconsPath = self.__getSelectedDefaultIconsPath() if defaultIconsPath == "automatic": if ericApp().usesDarkPalette(): @@ -201,8 +203,6 @@ else: defaultIconsPath = "breeze-light" - from .IconsPreviewDialog import IconsPreviewDialog - dlg = IconsPreviewDialog( [ os.path.join(getConfig("ericIconDir"), defaultIconsPath),
--- a/src/eric7/Preferences/ConfigurationPages/MasterPasswordEntryDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Preferences/ConfigurationPages/MasterPasswordEntryDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -10,6 +10,8 @@ from PyQt6.QtCore import pyqtSlot from PyQt6.QtWidgets import QDialog, QDialogButtonBox +from eric7.Utilities.crypto.py3PBKDF2 import verifyPassword + from .Ui_MasterPasswordEntryDialog import Ui_MasterPasswordEntryDialog @@ -45,8 +47,6 @@ enable = True error = "" if self.currentPasswordEdit.isEnabled(): - from eric7.Utilities.crypto.py3PBKDF2 import verifyPassword - enable = verifyPassword( self.currentPasswordEdit.text(), self.__oldPasswordHash )
--- a/src/eric7/Preferences/ConfigurationPages/MicroPythonPage.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Preferences/ConfigurationPages/MicroPythonPage.py Mon Nov 07 17:19:58 2022 +0100 @@ -7,6 +7,7 @@ Module implementing the MicroPython configuration page. """ + from eric7 import Preferences, Utilities from eric7.EricWidgets.EricPathPicker import EricPathPickerModes from eric7.MicroPython.MicroPythonWidget import AnsiColorSchemes @@ -14,6 +15,11 @@ from .ConfigurationPageBase import ConfigurationPageBase from .Ui_MicroPythonPage import Ui_MicroPythonPage +try: + from PyQt6.QtCharts import QChart +except ImportError: + QChart = None + class MicroPythonPage(ConfigurationPageBase, Ui_MicroPythonPage): """ @@ -36,9 +42,7 @@ self.colorSchemeComboBox.addItems(sorted(AnsiColorSchemes.keys())) # populate the chart theme combobox - try: - from PyQt6.QtCharts import QChart - + if QChart is not None: self.chartThemeComboBox.addItem(self.tr("Automatic"), -1) self.chartThemeComboBox.addItem( self.tr("Light"), QChart.ChartTheme.ChartThemeLight @@ -64,7 +68,7 @@ self.chartThemeComboBox.addItem( self.tr("Qt"), QChart.ChartTheme.ChartThemeQt ) - except ImportError: + else: self.chartThemeComboBox.setEnabled(False) self.mpyCrossPicker.setMode(EricPathPickerModes.OPEN_FILE_MODE)
--- a/src/eric7/Preferences/ConfigurationPages/NetworkPage.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Preferences/ConfigurationPages/NetworkPage.py Mon Nov 07 17:19:58 2022 +0100 @@ -122,9 +122,11 @@ self.cleanupGroup.hide() self.displayGroup.hide() else: + from eric7.WebBrowser.Download.DownloadManager import ( # __IGNORE_WARNING__ + DownloadManager, + ) + policy = Preferences.getWebBrowser("DownloadManagerRemovePolicy") - from eric7.WebBrowser.Download.DownloadManager import DownloadManager - if policy == DownloadManager.RemoveNever: self.cleanupNeverButton.setChecked(True) elif policy == DownloadManager.RemoveExit: @@ -149,7 +151,9 @@ "RequestDownloadFilename", self.requestFilenameCheckBox.isChecked() ) if self.__webEngine: - from eric7.WebBrowser.Download.DownloadManager import DownloadManager + from eric7.WebBrowser.Download.DownloadManager import ( # __IGNORE_WARNING__ + DownloadManager, + ) if self.cleanupNeverButton.isChecked(): policy = DownloadManager.RemoveNever
--- a/src/eric7/Preferences/ConfigurationPages/NotificationsPage.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Preferences/ConfigurationPages/NotificationsPage.py Mon Nov 07 17:19:58 2022 +0100 @@ -100,9 +100,9 @@ @param checked state of the button (boolean) """ + from eric7.UI.NotificationWidget import NotificationWidget + if checked: - from eric7.UI.NotificationWidget import NotificationWidget - self.__notification = NotificationWidget(parent=self, setPosition=True) self.__notification.showNotification( NotificationFrame.getIcon(NotificationTypes.OTHER),
--- a/src/eric7/Preferences/ConfigurationPages/QtPage.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Preferences/ConfigurationPages/QtPage.py Mon Nov 07 17:19:58 2022 +0100 @@ -35,7 +35,9 @@ self.__virtualenvManager = ericApp().getObject("VirtualEnvManager") self.__standalone = False except KeyError: - from eric7.VirtualEnv.VirtualenvManager import VirtualenvManager + from eric7.VirtualEnv.VirtualenvManager import ( # __IGNORE_WARNING_I101__ + VirtualenvManager, + ) self.__virtualenvManager = VirtualenvManager() self.__standalone = True
--- a/src/eric7/Preferences/ConfigurationPages/SecurityPage.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Preferences/ConfigurationPages/SecurityPage.py Mon Nov 07 17:19:58 2022 +0100 @@ -90,9 +90,9 @@ @param checked flag indicating the state of the check box (boolean) """ + from .MasterPasswordEntryDialog import MasterPasswordEntryDialog + if checked: - from .MasterPasswordEntryDialog import MasterPasswordEntryDialog - dlg = MasterPasswordEntryDialog("", self) if dlg.exec() == QDialog.DialogCode.Accepted: Preferences.setUser("MasterPassword", dlg.getMasterPassword())
--- a/src/eric7/Preferences/ConfigurationPages/WebBrowserVirusTotalPage.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Preferences/ConfigurationPages/WebBrowserVirusTotalPage.py Mon Nov 07 17:19:58 2022 +0100 @@ -24,14 +24,14 @@ """ Constructor """ + from eric7.WebBrowser.VirusTotal.VirusTotalApi import VirusTotalAPI + super().__init__() self.setupUi(self) self.setObjectName("HelpVirusTotalPage") self.testResultLabel.setHidden(True) - from eric7.WebBrowser.VirusTotal.VirusTotalApi import VirusTotalAPI - self.__vt = VirusTotalAPI(self) self.__vt.checkServiceKeyFinished.connect(self.__checkServiceKeyFinished)
--- a/src/eric7/Preferences/PreferencesLexer.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Preferences/PreferencesLexer.py Mon Nov 07 17:19:58 2022 +0100 @@ -11,6 +11,7 @@ from PyQt6.QtCore import QCoreApplication, QObject from eric7 import Globals, Preferences +from eric7.QScintilla import Lexers class PreferencesLexerError(Exception): @@ -90,8 +91,6 @@ self.__defaultFontFamily = "Bitstream Vera Sans Mono" # instantiate a lexer object for the given language - from eric7.QScintilla import Lexers - self.__lex = Lexers.getLexer(language) if self.__lex is None: raise PreferencesLexerLanguageError(language)
--- a/src/eric7/Preferences/ProgramsDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Preferences/ProgramsDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -302,7 +302,7 @@ # 7. do the spell checking entry try: - import enchant + import enchant # __IGNORE_WARNING_I10__ try: text = os.path.dirname(enchant.__file__) @@ -319,7 +319,7 @@ # 8. do the pygments entry try: - import pygments + import pygments # __IGNORE_WARNING_I10__ try: text = os.path.dirname(pygments.__file__) @@ -366,7 +366,7 @@ # 10. do the jedi related entries try: - import jedi + import jedi # __IGNORE_WARNING_I10__ try: text = os.path.dirname(jedi.__file__)
--- a/src/eric7/Preferences/Shortcuts.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Preferences/Shortcuts.py Mon Nov 07 17:19:58 2022 +0100 @@ -14,8 +14,11 @@ from eric7.EricWidgets import EricMessageBox from eric7.EricWidgets.EricApplication import ericApp +from eric7.EricXML.ShortcutsReader import ShortcutsReader from eric7.Preferences import Prefs, syncPreferences +from .ShortcutsFile import ShortcutsFile + def __readShortcut(act, category, prefClass): """ @@ -209,8 +212,6 @@ pm = ericApp().getObject("PluginManager") pm.initOnDemandPlugins() - from .ShortcutsFile import ShortcutsFile - shortcutsFile = ShortcutsFile() shortcutsFile.writeFile(fn, helpViewer) @@ -230,8 +231,6 @@ if fn.endswith(".ekj"): # new JSON based file - from .ShortcutsFile import ShortcutsFile - shortcutsFile = ShortcutsFile() shortcuts = shortcutsFile.readFile(fn) if shortcuts: @@ -242,8 +241,6 @@ # old XML based file f = QFile(fn) if f.open(QIODevice.OpenModeFlag.ReadOnly): - from eric7.EricXML.ShortcutsReader import ShortcutsReader - reader = ShortcutsReader(f) reader.readXML() f.close()
--- a/src/eric7/Preferences/ShortcutsDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Preferences/ShortcutsDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -19,6 +19,7 @@ from eric7.EricWidgets.EricApplication import ericApp from eric7.Preferences import Shortcuts +from .ShortcutDialog import ShortcutDialog from .Ui_ShortcutsDialog import Ui_ShortcutsDialog @@ -53,8 +54,6 @@ self.shortcutsList.headerItem().setText(self.shortcutsList.columnCount(), "") self.shortcutsList.header().setSortIndicator(0, Qt.SortOrder.AscendingOrder) - from .ShortcutDialog import ShortcutDialog - self.shortcutDialog = ShortcutDialog() self.shortcutDialog.shortcutChanged.connect(self.__shortcutChanged)
--- a/src/eric7/Preferences/__init__.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Preferences/__init__.py Mon Nov 07 17:19:58 2022 +0100 @@ -49,6 +49,7 @@ from eric7 import Globals from eric7.EricNetwork.EricFtp import EricFtpProxyType from eric7.EricWidgets import EricFileDialog +from eric7.EricWidgets.EricApplication import ericApp from eric7.EricWidgets.EricIconBar import EricIconBar from eric7.Project.ProjectBrowserFlags import ( AllBrowsersFlag, @@ -61,6 +62,8 @@ TranslationsBrowserFlag, ) from eric7.QScintilla.Shell import ShellHistoryStyle +from eric7.Utilities.crypto import pwConvert +from eric7.Utilities.crypto.py3PBKDF2 import hashPassword class Prefs: @@ -1791,11 +1794,11 @@ ) if venvName: try: - from eric7.EricWidgets.EricApplication import ericApp - virtualenvManager = ericApp().getObject("VirtualEnvManager") except KeyError: - from eric7.VirtualEnv.VirtualenvManager import VirtualenvManager + from eric7.VirtualEnv.VirtualenvManager import ( # __IGNORE_WARNING__ + VirtualenvManager, + ) virtualenvManager = VirtualenvManager() interpreter = virtualenvManager.getVirtualenvInterpreter(venvName) @@ -2006,8 +2009,6 @@ "ProxyPassword/Https", "ProxyPassword/Ftp", ]: - from eric7.Utilities.crypto import pwConvert - return pwConvert( Prefs.settings.value("UI/" + key, Prefs.uiDefaults[key]), encode=False ) @@ -2084,8 +2085,6 @@ "ProxyPassword/Https", "ProxyPassword/Ftp", ]: - from eric7.Utilities.crypto import pwConvert - Prefs.settings.setValue("UI/" + key, pwConvert(value, encode=True)) elif key in [ "ProxyType/Ftp", @@ -2395,13 +2394,13 @@ @return a reference to the list of lexer associations (dictionary of strings) """ + from eric7.QScintilla import Lexers + editorLexerAssoc = {} Prefs.settings.beginGroup("Editor/LexerAssociations") keyList = Prefs.settings.childKeys() Prefs.settings.endGroup() - from eric7.QScintilla import Lexers - editorLexerAssocDefaults = Lexers.getDefaultLexerAssociations() if len(keyList) == 0: @@ -2870,8 +2869,6 @@ Prefs.settings.endArray() return feeds elif key in ["SyncFtpPassword", "SyncEncryptionKey"]: - from eric7.Utilities.crypto import pwConvert - return pwConvert( Prefs.settings.value("WebBrowser/" + key, Prefs.webBrowserDefaults[key]), encode=False, @@ -3049,8 +3046,6 @@ Prefs.settings.setValue("Icon", v[2]) Prefs.settings.endArray() elif key in ["SyncFtpPassword", "SyncEncryptionKey"]: - from eric7.Utilities.crypto import pwConvert - Prefs.settings.setValue("WebBrowser/" + key, pwConvert(value, encode=True)) elif key in ["SafeBrowsingUpdateDateTime"]: # value is a QDateTime @@ -3193,8 +3188,6 @@ @return the requested user setting """ if key == "MailServerPassword": - from eric7.Utilities.crypto import pwConvert - return pwConvert( Prefs.settings.value("User/" + key, Prefs.userDefaults[key]), encode=False ) @@ -3232,12 +3225,8 @@ @param value the value to be set """ if key == "MailServerPassword": - from eric7.Utilities.crypto import pwConvert - Prefs.settings.setValue("User/" + key, pwConvert(value, encode=True)) elif key == "MasterPassword": - from eric7.Utilities.crypto.py3PBKDF2 import hashPassword - Prefs.settings.setValue("User/" + key, hashPassword(value)) else: Prefs.settings.setValue("User/" + key, value)
--- a/src/eric7/Project/CreateDialogCodeDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Project/CreateDialogCodeDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -27,6 +27,7 @@ from eric7.EricWidgets import EricMessageBox from eric7.EricWidgets.EricApplication import ericApp from eric7.Globals import getConfig +from eric7.Utilities import ModuleParser from .NewDialogClassDialog import NewDialogClassDialog from .Ui_CreateDialogCodeDialog import Ui_CreateDialogCodeDialog @@ -112,8 +113,6 @@ with contextlib.suppress(ImportError): splitExt = os.path.splitext(self.srcFile) exts = [splitExt[1]] if len(splitExt) == 2 else None - from eric7.Utilities import ModuleParser - self.__module = ModuleParser.readModule( self.srcFile, extensions=exts, caching=False )
--- a/src/eric7/Project/LexerAssociationDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Project/LexerAssociationDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -9,6 +9,7 @@ import os +from pygments.lexers import get_all_lexers from PyQt6.QtCore import Qt, pyqtSlot from PyQt6.QtWidgets import QDialog, QHeaderView, QTreeWidgetItem @@ -40,11 +41,7 @@ header.setSectionResizeMode(QHeaderView.ResizeMode.ResizeToContents) header.setSortIndicator(0, Qt.SortOrder.AscendingOrder) - try: - self.extsep = os.extsep - except AttributeError: - self.extsep = "." - + self.extsep = os.extsep self.extras = ["-----------", self.tr("Alternative")] self.editorLexerCombo.addItem("") @@ -53,8 +50,6 @@ self.editorLexerCombo.addItem(Lexers.getLanguageIcon(lang, False), lang) self.editorLexerCombo.addItems(self.extras) - from pygments.lexers import get_all_lexers - pygmentsLexers = [""] + sorted(lex[0] for lex in get_all_lexers()) self.pygmentsLexerCombo.addItems(pygmentsLexers)
--- a/src/eric7/Project/Project.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Project/Project.py Mon Nov 07 17:19:58 2022 +0100 @@ -44,6 +44,11 @@ from eric7.EricWidgets.EricApplication import ericApp from eric7.EricWidgets.EricListSelectionDialog import EricListSelectionDialog from eric7.EricWidgets.EricProgressDialog import EricProgressDialog +from eric7.EricXML.DebuggerPropertiesReader import DebuggerPropertiesReader +from eric7.EricXML.ProjectReader import ProjectReader +from eric7.EricXML.SessionReader import SessionReader +from eric7.EricXML.TasksReader import TasksReader +from eric7.EricXML.UserProjectReader import UserProjectReader from eric7.Globals import recentNameProject from eric7.Sessions.SessionFile import SessionFile from eric7.Tasks.TasksFile import TasksFile @@ -51,6 +56,7 @@ from eric7.UI.NotificationWidget import NotificationTypes from .DebuggerPropertiesFile import DebuggerPropertiesFile +from .ProjectBrowserModel import ProjectBrowserModel from .ProjectFile import ProjectFile from .UserProjectFile import UserProjectFile @@ -220,8 +226,6 @@ else: self.vcs = self.initVCS() - from .ProjectBrowserModel import ProjectBrowserModel - self.__model = ProjectBrowserModel(self) self.codemetrics = None @@ -865,8 +869,6 @@ # old XML based format f = QFile(fn) if f.open(QIODevice.OpenModeFlag.ReadOnly): - from eric7.EricXML.ProjectReader import ProjectReader - reader = ProjectReader(f, self) reader.readXML() res = not reader.hasError() @@ -1007,8 +1009,6 @@ if os.path.exists(fn): f = QFile(fn) if f.open(QIODevice.OpenModeFlag.ReadOnly): - from eric7.EricXML.UserProjectReader import UserProjectReader - reader = UserProjectReader(f, self) reader.readXML() f.close() @@ -1083,8 +1083,6 @@ if os.path.exists(fn): f = QFile(fn) if f.open(QIODevice.OpenModeFlag.ReadOnly): - from eric7.EricXML.SessionReader import SessionReader - reader = SessionReader(f, False) reader.readXML(quiet=quiet) f.close() @@ -1178,8 +1176,6 @@ if os.path.exists(fn): f = QFile(fn) if f.open(QIODevice.OpenModeFlag.ReadOnly): - from eric7.EricXML.TasksReader import TasksReader - reader = TasksReader(f, True) reader.readXML() f.close() @@ -1257,10 +1253,6 @@ f = QFile(fn) if f.open(QIODevice.OpenModeFlag.ReadOnly): - from eric7.EricXML.DebuggerPropertiesReader import ( - DebuggerPropertiesReader, - ) - reader = DebuggerPropertiesReader(f, self) reader.readXML(quiet=quiet) f.close() @@ -1481,6 +1473,8 @@ """ Public slot used to add a language to the project. """ + from .AddLanguageDialog import AddLanguageDialog + if not self.pdata["TRANSLATIONPATTERN"]: EricMessageBox.critical( self.ui, @@ -1489,8 +1483,6 @@ ) return - from .AddLanguageDialog import AddLanguageDialog - dlg = AddLanguageDialog(self.parent()) if dlg.exec() == QDialog.DialogCode.Accepted: lang = dlg.getSelectedLanguage() @@ -1582,7 +1574,7 @@ @param langFile the translation file to be removed (string) """ try: - from send2trash import send2trash as s2t + from send2trash import send2trash as s2t # __IGNORE_WARNING_I10__ except ImportError: s2t = os.remove @@ -1736,9 +1728,10 @@ @param startdir start directory for the selection dialog @type str """ + from .AddFileDialog import AddFileDialog + if startdir is None: startdir = self.ppath - from .AddFileDialog import AddFileDialog dlg = AddFileDialog(self, self.parent(), fileTypeFilter, startdir=startdir) if dlg.exec() == QDialog.DialogCode.Accepted: @@ -1907,9 +1900,10 @@ @param startdir start directory for the selection dialog @type str """ + from .AddDirectoryDialog import AddDirectoryDialog + if startdir is None: startdir = self.ppath - from .AddDirectoryDialog import AddDirectoryDialog dlg = AddDirectoryDialog(self, fileTypeFilter, self.parent(), startdir=startdir) if dlg.exec() == QDialog.DialogCode.Accepted: @@ -2362,7 +2356,7 @@ @return flag indicating success (boolean) """ try: - from send2trash import send2trash as s2t + from send2trash import send2trash as s2t # __IGNORE_WARNING_I10__ except ImportError: s2t = os.remove @@ -2410,7 +2404,7 @@ dn = os.path.join(self.ppath, dn) try: try: - from send2trash import send2trash + from send2trash import send2trash # __IGNORE_WARNING_I10__ send2trash(dn) except ImportError: @@ -2453,11 +2447,13 @@ This method displays the new project dialog and initializes the project object with the data entered. """ + from eric7.VCS.CommandOptionsDialog import VcsCommandOptionsDialog + + from .PropertiesDialog import PropertiesDialog + if not self.checkDirty(): return - from .PropertiesDialog import PropertiesDialog - dlg = PropertiesDialog(self, True) if dlg.exec() == QDialog.DialogCode.Accepted: self.closeProject() @@ -2697,10 +2693,6 @@ else: vcores = False if vcores: - from eric7.VCS.CommandOptionsDialog import ( - VcsCommandOptionsDialog, - ) - codlg = VcsCommandOptionsDialog(self.vcs) if codlg.exec() == QDialog.DialogCode.Accepted: self.vcs.vcsSetOptions(codlg.getOptions()) @@ -2774,10 +2766,6 @@ else: vcores = False if vcores: - from eric7.VCS.CommandOptionsDialog import ( - VcsCommandOptionsDialog, - ) - codlg = VcsCommandOptionsDialog(self.vcs) if codlg.exec() == QDialog.DialogCode.Accepted: self.vcs.vcsSetOptions(codlg.getOptions()) @@ -2972,11 +2960,11 @@ """ Private slot to display the user specific properties dialog. """ + from .UserPropertiesDialog import UserPropertiesDialog + vcsSystem = self.pdata["VCS"] or None vcsSystemOverride = self.pudata["VCSOVERRIDE"] or None - from .UserPropertiesDialog import UserPropertiesDialog - dlg = UserPropertiesDialog(self) if dlg.exec() == QDialog.DialogCode.Accepted: dlg.storeData() @@ -5374,6 +5362,8 @@ (EricToolBarManager) @return tuple of the generated toolbars (tuple of two QToolBar) """ + from eric7 import VCS + tb = QToolBar(self.tr("Project"), self.ui) tb.setIconSize(Config.ToolBarIconSize) tb.setObjectName("ProjectToolbar") @@ -5392,8 +5382,6 @@ toolbarManager.addAction(self.propsAct, tb.windowTitle()) toolbarManager.addAction(self.userPropsAct, tb.windowTitle()) - from eric7 import VCS - vcstb = VCS.getBasicHelper(self).initBasicToolbar(self.ui, toolbarManager) return tb, vcstb @@ -5480,9 +5468,9 @@ """ Private slot to show the Find Project File dialog. """ + from .QuickFindFileDialog import QuickFindFileDialog + if self.__findProjectFileDialog is None: - from .QuickFindFileDialog import QuickFindFileDialog - self.__findProjectFileDialog = QuickFindFileDialog(self) self.__findProjectFileDialog.sourceFile.connect(self.sourceFile) self.__findProjectFileDialog.designerFile.connect(self.designerFile) @@ -5505,6 +5493,8 @@ @param onUserDemand flag indicating whether this method was requested by the user via a menu action (boolean) """ + from .AddFoundFilesDialog import AddFoundFilesDialog + autoInclude = Preferences.getProject("AutoIncludeNewFiles") recursiveSearch = Preferences.getProject("SearchNewFilesRecursively") newFiles = [] @@ -5605,8 +5595,6 @@ return # autoInclude is not set, show a dialog - from .AddFoundFilesDialog import AddFoundFilesDialog - dlg = AddFoundFilesDialog(newFiles, self.parent(), None) res = dlg.exec() @@ -5699,6 +5687,8 @@ (boolean) @return a reference to the vcs object """ + from eric7 import VCS + vcs = None forProject = True override = False @@ -5720,8 +5710,6 @@ override = True if vcsSystem is not None: - from eric7 import VCS - try: vcs = VCS.factory(vcsSystem) except ImportError: @@ -5778,8 +5766,6 @@ if forProject: if vcs is None: - from eric7 import VCS - self.vcsProjectHelper = VCS.getBasicHelper(self) self.vcsBasicHelper = True else: @@ -5880,13 +5866,13 @@ """ Private slot used to calculate some code metrics for the project files. """ + from eric7.DataViews.CodeMetricsDialog import CodeMetricsDialog + files = [ os.path.join(self.ppath, file) for file in self.pdata["SOURCES"] if file.endswith(".py") ] - from eric7.DataViews.CodeMetricsDialog import CodeMetricsDialog - self.codemetrics = CodeMetricsDialog() self.codemetrics.show() self.codemetrics.prepare(files) @@ -5896,6 +5882,8 @@ Private slot used to show the code coverage information for the project files. """ + from eric7.DataViews.PyCoverageDialog import PyCoverageDialog + fn = self.getMainScript(True) if fn is None: EricMessageBox.critical( @@ -5931,8 +5919,6 @@ for file in self.pdata["SOURCES"] if os.path.splitext(file)[1].startswith(".py") ] - from eric7.DataViews.PyCoverageDialog import PyCoverageDialog - self.codecoverage = PyCoverageDialog() self.codecoverage.show() self.codecoverage.start(fn, files) @@ -5941,6 +5927,8 @@ """ Private slot used to show the profiling information for the project. """ + from eric7.DataViews.PyProfileDialog import PyProfileDialog + fn = self.getMainScript(True) if fn is None: EricMessageBox.critical( @@ -5971,8 +5959,6 @@ else: return - from eric7.DataViews.PyProfileDialog import PyProfileDialog - self.profiledata = PyProfileDialog() self.profiledata.show() self.profiledata.start(fn) @@ -6008,6 +5994,8 @@ """ Public method to handle the application diagram context menu action. """ + from eric7.Graphics.UMLDialog import UMLDialog, UMLDialogType + res = EricMessageBox.yesNo( self.ui, self.tr("Application Diagram"), @@ -6015,8 +6003,6 @@ yesDefault=True, ) - from eric7.Graphics.UMLDialog import UMLDialog, UMLDialogType - self.applicationDiagram = UMLDialog( UMLDialogType.APPLICATION_DIAGRAM, self, self.parent(), noModules=not res ) @@ -6823,7 +6809,7 @@ """ Private slot to create a SBOM file of the project dependencies. """ - import CycloneDXInterface + import CycloneDXInterface # __IGNORE_WARNING_I102__ CycloneDXInterface.createCycloneDXFile("<project>")
--- a/src/eric7/Project/ProjectBaseBrowser.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Project/ProjectBaseBrowser.py Mon Nov 07 17:19:58 2022 +0100 @@ -26,6 +26,7 @@ from eric7.EricWidgets.EricApplication import ericApp from eric7.UI.Browser import Browser from eric7.UI.BrowserModel import BrowserDirectoryItem, BrowserFileItem +from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog from .ProjectBrowserModel import ( ProjectBrowserDirectoryItem, @@ -305,8 +306,6 @@ dn = self.project.getRelativePath(dn) dirs.append(dn) - from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog - dlg = DeleteFilesConfirmationDialog( self.parent(), QCoreApplication.translate("ProjectBaseBrowser", "Delete directories"),
--- a/src/eric7/Project/ProjectBrowser.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Project/ProjectBrowser.py Mon Nov 07 17:19:58 2022 +0100 @@ -26,6 +26,13 @@ SourcesBrowserFlag, TranslationsBrowserFlag, ) +from .ProjectFormsBrowser import ProjectFormsBrowser +from .ProjectInterfacesBrowser import ProjectInterfacesBrowser +from .ProjectOthersBrowser import ProjectOthersBrowser +from .ProjectProtocolsBrowser import ProjectProtocolsBrowser +from .ProjectResourcesBrowser import ProjectResourcesBrowser +from .ProjectSourcesBrowser import ProjectSourcesBrowser +from .ProjectTranslationsBrowser import ProjectTranslationsBrowser class ProjectBrowser(EricTabWidget): @@ -77,14 +84,6 @@ self.__vcsStateChanged(" ") # step 1: create all the individual browsers - from .ProjectFormsBrowser import ProjectFormsBrowser - from .ProjectInterfacesBrowser import ProjectInterfacesBrowser - from .ProjectOthersBrowser import ProjectOthersBrowser - from .ProjectProtocolsBrowser import ProjectProtocolsBrowser - from .ProjectResourcesBrowser import ProjectResourcesBrowser - from .ProjectSourcesBrowser import ProjectSourcesBrowser - from .ProjectTranslationsBrowser import ProjectTranslationsBrowser - # sources browser self.psBrowser = ProjectSourcesBrowser(self.project) # forms browser
--- a/src/eric7/Project/ProjectFormsBrowser.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Project/ProjectFormsBrowser.py Mon Nov 07 17:19:58 2022 +0100 @@ -22,6 +22,7 @@ from eric7.EricWidgets.EricApplication import ericApp from eric7.EricWidgets.EricProgressDialog import EricProgressDialog from eric7.Globals import getConfig +from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog from eric7.UI.NotificationWidget import NotificationTypes from .ProjectBaseBrowser import ProjectBaseBrowser @@ -663,8 +664,6 @@ fn = self.project.getRelativePath(fn2) files.append(fn) - from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog - dlg = DeleteFilesConfirmationDialog( self.parent(), self.tr("Delete forms"), @@ -898,7 +897,9 @@ if self.hooks["generateDialogCode"] is not None: self.hooks["generateDialogCode"](fn) else: - from .CreateDialogCodeDialog import CreateDialogCodeDialog + from .CreateDialogCodeDialog import ( # __IGNORE_WARNING_I101__ + CreateDialogCodeDialog, + ) # change environment sys.path.insert(0, self.project.getProjectPath())
--- a/src/eric7/Project/ProjectInterfacesBrowser.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Project/ProjectInterfacesBrowser.py Mon Nov 07 17:19:58 2022 +0100 @@ -26,6 +26,7 @@ BrowserFileItem, BrowserMethodItem, ) +from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog from eric7.UI.NotificationWidget import NotificationTypes from .ProjectBaseBrowser import ProjectBaseBrowser @@ -456,8 +457,6 @@ fn = self.project.getRelativePath(fn2) files.append(fn) - from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog - dlg = DeleteFilesConfirmationDialog( self.parent(), self.tr("Delete interfaces"), @@ -677,9 +676,9 @@ Private method to show a dialog to configure some options for the IDL compiler. """ - params = self.project.pdata["IDLPARAMS"] + from .IdlCompilerOptionsDialog import IdlCompilerOptionsDialog - from .IdlCompilerOptionsDialog import IdlCompilerOptionsDialog + params = self.project.pdata["IDLPARAMS"] dlg = IdlCompilerOptionsDialog( params["IncludeDirs"][:],
--- a/src/eric7/Project/ProjectOthersBrowser.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Project/ProjectOthersBrowser.py Mon Nov 07 17:19:58 2022 +0100 @@ -17,6 +17,7 @@ from eric7 import Preferences from eric7.EricWidgets import EricMessageBox +from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog from eric7.Utilities import MimeTypes from .ProjectBaseBrowser import ProjectBaseBrowser @@ -443,8 +444,6 @@ del dirFullNames del dirNames - from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog - dlg = DeleteFilesConfirmationDialog( self.parent(), self.tr("Delete files/directories"),
--- a/src/eric7/Project/ProjectProtocolsBrowser.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Project/ProjectProtocolsBrowser.py Mon Nov 07 17:19:58 2022 +0100 @@ -26,6 +26,7 @@ BrowserFileItem, BrowserMethodItem, ) +from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog from eric7.UI.NotificationWidget import NotificationTypes from .ProjectBaseBrowser import ProjectBaseBrowser @@ -462,8 +463,6 @@ fn = self.project.getRelativePath(fn2) files.append(fn) - from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog - dlg = DeleteFilesConfirmationDialog( self.parent(), self.tr("Delete Protocols"),
--- a/src/eric7/Project/ProjectResourcesBrowser.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Project/ProjectResourcesBrowser.py Mon Nov 07 17:19:58 2022 +0100 @@ -19,6 +19,7 @@ from eric7.EricWidgets import EricFileDialog, EricMessageBox from eric7.EricWidgets.EricApplication import ericApp from eric7.EricWidgets.EricProgressDialog import EricProgressDialog +from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog from eric7.UI.NotificationWidget import NotificationTypes from .ProjectBaseBrowser import ProjectBaseBrowser @@ -555,8 +556,6 @@ fn = self.project.getRelativePath(fn2) files.append(fn) - from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog - dlg = DeleteFilesConfirmationDialog( self.parent(), self.tr("Delete resources"),
--- a/src/eric7/Project/ProjectSourcesBrowser.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Project/ProjectSourcesBrowser.py Mon Nov 07 17:19:58 2022 +0100 @@ -21,6 +21,7 @@ from eric7.EricGui import EricPixmapCache from eric7.EricWidgets import EricMessageBox from eric7.EricWidgets.EricApplication import ericApp +from eric7.Graphics.UMLDialog import UMLDialog, UMLDialogType from eric7.UI.BrowserModel import ( BrowserClassAttributeItem, BrowserClassItem, @@ -28,6 +29,7 @@ BrowserImportItem, BrowserMethodItem, ) +from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog from .ProjectBaseBrowser import ProjectBaseBrowser from .ProjectBrowserModel import ( @@ -879,6 +881,8 @@ """ Private method to add a new package to the project. """ + from .NewPythonPackageDialog import NewPythonPackageDialog + itm = self.model().item(self.currentIndex()) if isinstance( itm, (ProjectBrowserFileItem, BrowserClassItem, BrowserMethodItem) @@ -894,8 +898,6 @@ dn = self.project.getRelativePath(dn) if dn.startswith(os.sep): dn = dn[1:] - from .NewPythonPackageDialog import NewPythonPackageDialog - dlg = NewPythonPackageDialog(dn, self) if dlg.exec() == QDialog.DialogCode.Accepted: packageName = dlg.getData() @@ -986,8 +988,6 @@ fn = self.project.getRelativePath(fn2) files.append(fn) - from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog - dlg = DeleteFilesConfirmationDialog( self.parent(), self.tr("Delete files"), @@ -1018,11 +1018,11 @@ """ Private method to handle the code metrics context menu action. """ + from eric7.DataViews.CodeMetricsDialog import CodeMetricsDialog + itm = self.model().item(self.currentIndex()) fn = itm.fileName() - from eric7.DataViews.CodeMetricsDialog import CodeMetricsDialog - self.codemetrics = CodeMetricsDialog() self.codemetrics.show() self.codemetrics.start(fn) @@ -1031,6 +1031,8 @@ """ Private method to handle the code coverage context menu action. """ + from eric7.DataViews.PyCoverageDialog import PyCoverageDialog + itm = self.model().item(self.currentIndex()) fn = itm.fileName() pfn = self.project.getMainScript(True) @@ -1060,8 +1062,6 @@ else: return - from eric7.DataViews.PyCoverageDialog import PyCoverageDialog - self.codecoverage = PyCoverageDialog() self.codecoverage.show() self.codecoverage.start(cfn, fn) @@ -1070,6 +1070,8 @@ """ Private method to handle the show profile data context menu action. """ + from eric7.DataViews.PyProfileDialog import PyProfileDialog + itm = self.model().item(self.currentIndex()) fn = itm.fileName() pfn = self.project.getMainScript(True) @@ -1099,8 +1101,6 @@ else: return - from eric7.DataViews.PyProfileDialog import PyProfileDialog - self.profiledata = PyProfileDialog() self.profiledata.show() self.profiledata.start(pfn, fn) @@ -1131,8 +1131,6 @@ yesDefault=True, ) - from eric7.Graphics.UMLDialog import UMLDialog, UMLDialogType - self.classDiagram = UMLDialog( UMLDialogType.CLASS_DIAGRAM, self.project, fn, self, noAttrs=not res ) @@ -1154,8 +1152,6 @@ self.tr("""Include imports from external modules?"""), ) - from eric7.Graphics.UMLDialog import UMLDialog, UMLDialogType - self.importsDiagram = UMLDialog( UMLDialogType.IMPORTS_DIAGRAM, self.project, @@ -1182,8 +1178,6 @@ yesDefault=True, ) - from eric7.Graphics.UMLDialog import UMLDialog, UMLDialogType - self.packageDiagram = UMLDialog( UMLDialogType.PACKAGE_DIAGRAM, self.project, package, self, noAttrs=not res ) @@ -1200,8 +1194,6 @@ yesDefault=True, ) - from eric7.Graphics.UMLDialog import UMLDialog, UMLDialogType - self.applicationDiagram = UMLDialog( UMLDialogType.APPLICATION_DIAGRAM, self.project, self, noModules=not res )
--- a/src/eric7/Project/ProjectTranslationsBrowser.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Project/ProjectTranslationsBrowser.py Mon Nov 07 17:19:58 2022 +0100 @@ -23,6 +23,7 @@ from eric7.EricGui.EricOverrideCursor import EricOverridenCursor from eric7.EricWidgets import EricMessageBox from eric7.EricWidgets.EricApplication import ericApp +from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog from eric7.UI.NotificationWidget import NotificationTypes from .ProjectBaseBrowser import ProjectBaseBrowser @@ -772,8 +773,6 @@ translationFiles = [itm.fileName() for itm in itmList] - from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog - dlg = DeleteFilesConfirmationDialog( self.parent(), self.tr("Delete translation files"),
--- a/src/eric7/Project/PropertiesDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Project/PropertiesDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -218,9 +218,9 @@ """ Private slot to display the spelling properties dialog. """ + from .SpellingPropertiesDialog import SpellingPropertiesDialog + if self.spellPropertiesDlg is None: - from .SpellingPropertiesDialog import SpellingPropertiesDialog - self.spellPropertiesDlg = SpellingPropertiesDialog( self.project, self.newProject, self ) @@ -233,9 +233,9 @@ """ Private slot to display the translations properties dialog. """ + from .TranslationPropertiesDialog import TranslationPropertiesDialog + if self.transPropertiesDlg is None: - from .TranslationPropertiesDialog import TranslationPropertiesDialog - self.transPropertiesDlg = TranslationPropertiesDialog( self.project, self.newProject, self ) @@ -250,9 +250,9 @@ """ Private slot to display the make properties dialog. """ + from .MakePropertiesDialog import MakePropertiesDialog + if self.makePropertiesDlg is None: - from .MakePropertiesDialog import MakePropertiesDialog - self.makePropertiesDlg = MakePropertiesDialog( self.project, self.newProject, self ) @@ -291,11 +291,11 @@ """ Private slot to display a vcs information dialog. """ + from eric7.VCS.RepositoryInfoDialog import VcsRepositoryInfoDialog + if self.project.vcs is None: return - from eric7.VCS.RepositoryInfoDialog import VcsRepositoryInfoDialog - info = self.project.vcs.vcsRepositoryInfos(self.project.ppath) dlg = VcsRepositoryInfoDialog(self, info) dlg.exec()
--- a/src/eric7/Project/SpellingPropertiesDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Project/SpellingPropertiesDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -11,6 +11,7 @@ from eric7 import Preferences from eric7.EricWidgets.EricPathPicker import EricPathPickerModes +from eric7.QScintilla.SpellChecker import SpellChecker from .Ui_SpellingPropertiesDialog import Ui_SpellingPropertiesDialog @@ -42,8 +43,6 @@ self.project = project self.parent = parent - from eric7.QScintilla.SpellChecker import SpellChecker - self.spellingComboBox.addItem(self.tr("<default>")) self.spellingComboBox.addItems(sorted(SpellChecker.getAvailableLanguages()))
--- a/src/eric7/QScintilla/DocstringGenerator/BaseDocstringGenerator.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/QScintilla/DocstringGenerator/BaseDocstringGenerator.py Mon Nov 07 17:19:58 2022 +0100 @@ -142,19 +142,19 @@ @rtype str """ if docstringType == "ericdoc": - from .EricdocGenerator import generateEricDoc + from .EricdocGenerator import generateEricDoc # __IGNORE_WARNING_I101__ return generateEricDoc(functionInfo) elif docstringType == "numpydoc": - from .NumpydocGenerator import generateNumpyDoc + from .NumpydocGenerator import generateNumpyDoc # __IGNORE_WARNING_I101__ return generateNumpyDoc(functionInfo) elif docstringType == "googledoc": - from .GoogledocGenerator import generateGoogleDoc + from .GoogledocGenerator import generateGoogleDoc # __IGNORE_WARNING_I101__ return generateGoogleDoc(functionInfo, self.editor) elif docstringType == "sphinxdoc": - from .SphinxdocGenerator import generateSphinxDoc + from .SphinxdocGenerator import generateSphinxDoc # __IGNORE_WARNING_I101__ return generateSphinxDoc(functionInfo) else:
--- a/src/eric7/QScintilla/DocstringGenerator/__init__.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/QScintilla/DocstringGenerator/__init__.py Mon Nov 07 17:19:58 2022 +0100 @@ -24,11 +24,15 @@ "Python3", "MicroPython", ): - from .PyDocstringGenerator import PyDocstringGenerator + from .PyDocstringGenerator import ( # __IGNORE_WARNING_I101__ + PyDocstringGenerator, + ) return PyDocstringGenerator(editor) else: - from .BaseDocstringGenerator import BaseDocstringGenerator + from .BaseDocstringGenerator import ( # __IGNORE_WARNING_I101__ + BaseDocstringGenerator, + ) return BaseDocstringGenerator(editor)
--- a/src/eric7/QScintilla/Editor.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/QScintilla/Editor.py Mon Nov 07 17:19:58 2022 +0100 @@ -32,7 +32,12 @@ pyqtSlot, ) from PyQt6.QtGui import QActionGroup, QFont, QPainter, QPalette, QPixmap -from PyQt6.QtPrintSupport import QAbstractPrintDialog, QPrintDialog, QPrinter +from PyQt6.QtPrintSupport import ( + QAbstractPrintDialog, + QPrintDialog, + QPrinter, + QPrintPreviewDialog, +) from PyQt6.QtWidgets import QApplication, QDialog, QInputDialog, QLineEdit, QMenu from eric7 import Preferences, Utilities @@ -49,6 +54,7 @@ from eric7.UI import PythonDisViewer from eric7.Utilities import MouseUtilities +from . import Exporters, Lexers, TypingCompleters from .EditorMarkerMap import EditorMarkerMap from .QsciScintillaCompat import QsciScintillaCompat from .SpellChecker import SpellChecker @@ -740,8 +746,6 @@ if not bindName and self.filetype: # check filetype - from . import Lexers - supportedLanguages = Lexers.getSupportedLanguages() if self.filetype in supportedLanguages: bindName = supportedLanguages[self.filetype][1] @@ -1169,8 +1173,6 @@ self.languagesActGrp.addAction(self.noLanguageAct) menu.addSeparator() - from . import Lexers - self.supportedLanguages = {} supportedLanguages = Lexers.getSupportedLanguages() languages = sorted(supportedLanguages.keys()) @@ -1487,8 +1489,6 @@ @param exporterFormat format the file should be exported into (string) """ if exporterFormat: - from . import Exporters - exporter = Exporters.getExporter(exporterFormat, self) if exporter: exporter.exportSource() @@ -1527,7 +1527,7 @@ @return name of the selected pygments lexer (string) """ - from pygments.lexers import get_all_lexers + from pygments.lexers import get_all_lexers # __IGNORE_WARNING_I102__ lexerList = sorted(lex[0] for lex in get_all_lexers()) try: @@ -1888,8 +1888,6 @@ self.filetype = language.split("|")[-1] language = "" - from . import Lexers - self.lexer_ = Lexers.getLexer(language, self, pyname=pyname) if self.lexer_ is None: self.setLexer() @@ -2029,8 +2027,6 @@ elif self.isRubyFile(): apiLanguage = "Ruby" - from . import TypingCompleters - self.completer = TypingCompleters.getCompleter(apiLanguage, self) def getCompleter(self): @@ -2619,6 +2615,8 @@ @param line linenumber of the breakpoint to edit """ + from eric7.Debugger.EditBreakpointDialog import EditBreakpointDialog + if line is not None: self.line = line - 1 if self.line < 0: @@ -2639,8 +2637,6 @@ else [] ) - from eric7.Debugger.EditBreakpointDialog import EditBreakpointDialog - dlg = EditBreakpointDialog( (self.fileName, ln), (cond, temp, enabled, ignorecount), @@ -2883,8 +2879,6 @@ """ Public slot to show a print preview of the text. """ - from PyQt6.QtPrintSupport import QPrintPreviewDialog - from .Printer import Printer printer = Printer(mode=QPrinter.PrinterMode.HighResolution) @@ -3439,8 +3433,6 @@ if not path: path = Preferences.getMultiProject("Workspace") or Utilities.getHomeDir() - from . import Lexers - if self.fileName: filterPattern = "(*{0})".format(os.path.splitext(self.fileName)[1]) for fileFilter in Lexers.getSaveFileFiltersList(True): @@ -6123,11 +6115,11 @@ """ Private method to handle the code metrics context menu action. """ + from eric7.DataViews.CodeMetricsDialog import CodeMetricsDialog + if not self.checkDirty(): return - from eric7.DataViews.CodeMetricsDialog import CodeMetricsDialog - self.codemetrics = CodeMetricsDialog() self.codemetrics.show() self.codemetrics.start(self.fileName) @@ -6182,11 +6174,11 @@ """ Private method to handle the code coverage context menu action. """ + from eric7.DataViews.PyCoverageDialog import PyCoverageDialog + fn = self.__getCodeCoverageFile() self.__coverageFile = fn if fn: - from eric7.DataViews.PyCoverageDialog import PyCoverageDialog - self.codecoverage = PyCoverageDialog() self.codecoverage.show() self.codecoverage.start(fn, self.fileName) @@ -6210,14 +6202,16 @@ (defaults to None) @type str (optional) """ + from eric7.DebugClients.Python.coverage import ( # __IGNORE_WARNING_I102__ + Coverage, + ) + self.__codeCoverageHideAnnotations() fn = coverageFile if bool(coverageFile) else self.__getCodeCoverageFile() self.__coverageFile = fn if fn: - from coverage import Coverage - cover = Coverage(data_file=fn) cover.load() missing = cover.analysis2(self.fileName)[3] @@ -6317,6 +6311,8 @@ """ Private method to handle the show profile data context menu action. """ + from eric7.DataViews.PyProfileDialog import PyProfileDialog + files = set() # first check if the file belongs to a project and there is @@ -6349,8 +6345,6 @@ else: return - from eric7.DataViews.PyProfileDialog import PyProfileDialog - self.profiledata = PyProfileDialog() self.profiledata.show() self.profiledata.start(fn, self.fileName) @@ -8058,10 +8052,10 @@ """ Public slot to perform an interactive spell check of the document. """ + from .SpellCheckingDialog import SpellCheckingDialog + if self.spell: cline, cindex = self.getCursorPosition() - from .SpellCheckingDialog import SpellCheckingDialog - dlg = SpellCheckingDialog(self.spell, 0, self.length(), self) dlg.exec() self.setCursorPosition(cline, cindex) @@ -8499,11 +8493,11 @@ """ Public slot to sort the lines spanned by a rectangular selection. """ + from .SortOptionsDialog import SortOptionsDialog + if not self.selectionIsRectangle(): return - from .SortOptionsDialog import SortOptionsDialog - dlg = SortOptionsDialog() if dlg.exec() == QDialog.DialogCode.Accepted: ascending, alnum, caseSensitive = dlg.getData() @@ -8920,9 +8914,9 @@ @return reference to the docstring generator @rtype BaseDocstringGenerator """ + from . import DocstringGenerator + if self.__docstringGenerator is None: - from . import DocstringGenerator - self.__docstringGenerator = DocstringGenerator.getDocstringGenerator(self) return self.__docstringGenerator @@ -8983,7 +8977,7 @@ generator = self.getDocstringGenerator() if generator.hasFunctionDefinition(cursorPosition): - from .DocstringGenerator.BaseDocstringGenerator import ( + from .DocstringGenerator.BaseDocstringGenerator import ( # __IGNORE_WARNING__ DocstringMenuForEnterOnly, )
--- a/src/eric7/QScintilla/EditorAssembly.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/QScintilla/EditorAssembly.py Mon Nov 07 17:19:58 2022 +0100 @@ -16,6 +16,11 @@ from eric7 import Preferences from eric7.EricGui import EricPixmapCache from eric7.EricWidgets.EricApplication import ericApp +from eric7.Utilities.ModuleParser import Function + +from .Editor import Editor +from .EditorButtonsWidget import EditorButtonsWidget +from .EditorOutline import EditorOutlineView class EditorAssembly(QWidget): @@ -48,10 +53,6 @@ self.__layout.setContentsMargins(0, 0, 0, 0) self.__layout.setSpacing(1) - from .Editor import Editor - from .EditorButtonsWidget import EditorButtonsWidget - from .EditorOutline import EditorOutlineView - self.__showOutline = Preferences.getEditor("ShowSourceOutline") self.__editor = Editor(dbs, fn, vm, filetype, editor, tv) @@ -210,8 +211,6 @@ return # step 2.1: add class methods - from eric7.Utilities.ModuleParser import Function - items = [] for meth in entry.methods.values(): if meth.modifier == Function.Static:
--- a/src/eric7/QScintilla/EditorOutlineModel.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/QScintilla/EditorOutlineModel.py Mon Nov 07 17:19:58 2022 +0100 @@ -75,35 +75,37 @@ language = self.__editor.getLanguage() if language in EditorOutlineModel.SupportedLanguages: if language == "IDL": - from eric7.Utilities.ClassBrowsers import idlclbr + from eric7.Utilities.ClassBrowsers import idlclbr # __IGNORE_WARNING__ dictionary = idlclbr.scan( self.__editor.text(), self.__filename, self.__module ) idlclbr._modules.clear() elif language == "Protocol": - from eric7.Utilities.ClassBrowsers import protoclbr + from eric7.Utilities.ClassBrowsers import ( # __IGNORE_WARNING_I101__ + protoclbr, + ) dictionary = protoclbr.scan( self.__editor.text(), self.__filename, self.__module ) protoclbr._modules.clear() elif language == "Ruby": - from eric7.Utilities.ClassBrowsers import rbclbr + from eric7.Utilities.ClassBrowsers import rbclbr # __IGNORE_WARNING__ dictionary = rbclbr.scan( self.__editor.text(), self.__filename, self.__module ) rbclbr._modules.clear() elif language == "JavaScript": - from eric7.Utilities.ClassBrowsers import jsclbr + from eric7.Utilities.ClassBrowsers import jsclbr # __IGNORE_WARNING__ dictionary = jsclbr.scan( self.__editor.text(), self.__filename, self.__module ) jsclbr._modules.clear() elif language in ("Python3", "MicroPython", "Cython"): - from eric7.Utilities.ClassBrowsers import pyclbr + from eric7.Utilities.ClassBrowsers import pyclbr # __IGNORE_WARNING__ dictionary = pyclbr.scan( self.__editor.text(), self.__filename, self.__module
--- a/src/eric7/QScintilla/Exporters/ExporterHTML.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/QScintilla/Exporters/ExporterHTML.py Mon Nov 07 17:19:58 2022 +0100 @@ -22,6 +22,7 @@ from eric7 import Preferences, Utilities from eric7.EricGui.EricOverrideCursor import EricOverrideCursor from eric7.EricWidgets import EricMessageBox +from eric7.UI.Previewers import MarkdownExtensions, PreviewerHTMLStyles from .ExporterBase import ExporterBase @@ -512,7 +513,7 @@ sys.modules.pop(key) try: - import docutils.core # __IGNORE_EXCEPTION__ + import docutils.core # __IGNORE_EXCEPTION__ __IGNORE_WARNING_I10__ except ImportError: EricMessageBox.critical( self.editor, @@ -548,7 +549,7 @@ @rtype str """ try: - import markdown # __IGNORE_EXCEPTION__ + import markdown # __IGNORE_EXCEPTION__ __IGNORE_WARNING_I10__ except ImportError: EricMessageBox.critical( self.editor, @@ -563,8 +564,6 @@ ) return "" - from eric7.UI.Previewers import MarkdownExtensions, PreviewerHTMLStyles - extensions = [] text = self.editor.text()
--- a/src/eric7/QScintilla/Exporters/__init__.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/QScintilla/Exporters/__init__.py Mon Nov 07 17:19:58 2022 +0100 @@ -40,23 +40,23 @@ """ try: if exporterFormat == "HTML": - from .ExporterHTML import ExporterHTML + from .ExporterHTML import ExporterHTML # __IGNORE_WARNING_I101__ return ExporterHTML(editor) elif exporterFormat == "PDF": - from .ExporterPDF import ExporterPDF + from .ExporterPDF import ExporterPDF # __IGNORE_WARNING_I101__ return ExporterPDF(editor) elif exporterFormat == "RTF": - from .ExporterRTF import ExporterRTF + from .ExporterRTF import ExporterRTF # __IGNORE_WARNING_I101__ return ExporterRTF(editor) elif exporterFormat == "TeX": - from .ExporterTEX import ExporterTEX + from .ExporterTEX import ExporterTEX # __IGNORE_WARNING_I101__ return ExporterTEX(editor) elif exporterFormat == "ODT": - from .ExporterODT import ExporterODT + from .ExporterODT import ExporterODT # __IGNORE_WARNING_I101__ return ExporterODT(editor) except ImportError:
--- a/src/eric7/QScintilla/Lexers/LexerPython.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/QScintilla/Lexers/LexerPython.py Mon Nov 07 17:19:58 2022 +0100 @@ -8,6 +8,7 @@ """ import contextlib +import keyword import re from PyQt6.Qsci import QsciLexerPython, QsciScintilla @@ -233,8 +234,6 @@ """ if kwSet == 1: if self.language() == "Python3": - import keyword - keywords = " ".join(keyword.kwlist) elif self.language() == "MicroPython": keywords = (
--- a/src/eric7/QScintilla/Lexers/__init__.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/QScintilla/Lexers/__init__.py Mon Nov 07 17:19:58 2022 +0100 @@ -289,149 +289,151 @@ if not pyname: try: if language in ["Python", "Python3", "Cython", "MicroPython"]: - from .LexerPython import LexerPython + from .LexerPython import LexerPython # __IGNORE_WARNING_I101__ return LexerPython(language, parent) elif language == "C++": - from .LexerCPP import LexerCPP + from .LexerCPP import LexerCPP # __IGNORE_WARNING_I101__ return LexerCPP( parent, Preferences.getEditor("CppCaseInsensitiveKeywords") ) elif language == "C#": - from .LexerCSharp import LexerCSharp + from .LexerCSharp import LexerCSharp # __IGNORE_WARNING_I101__ return LexerCSharp(parent) elif language == "IDL": - from .LexerIDL import LexerIDL + from .LexerIDL import LexerIDL # __IGNORE_WARNING_I101__ return LexerIDL(parent) elif language == "Java": - from .LexerJava import LexerJava + from .LexerJava import LexerJava # __IGNORE_WARNING_I101__ return LexerJava(parent) elif language == "JavaScript": - from .LexerJavaScript import LexerJavaScript + from .LexerJavaScript import LexerJavaScript # __IGNORE_WARNING_I101__ return LexerJavaScript(parent) elif language == "SQL": - from .LexerSQL import LexerSQL + from .LexerSQL import LexerSQL # __IGNORE_WARNING_I101__ return LexerSQL(parent) elif language == "HTML": - from .LexerHTML import LexerHTML + from .LexerHTML import LexerHTML # __IGNORE_WARNING_I101__ return LexerHTML(parent) elif language == "Perl": - from .LexerPerl import LexerPerl + from .LexerPerl import LexerPerl # __IGNORE_WARNING_I101__ return LexerPerl(parent) elif language == "Bash": - from .LexerBash import LexerBash + from .LexerBash import LexerBash # __IGNORE_WARNING_I101__ return LexerBash(parent) elif language == "Ruby": - from .LexerRuby import LexerRuby + from .LexerRuby import LexerRuby # __IGNORE_WARNING_I101__ return LexerRuby(parent) elif language == "Lua": - from .LexerLua import LexerLua + from .LexerLua import LexerLua # __IGNORE_WARNING_I101__ return LexerLua(parent) elif language == "CSS": - from .LexerCSS import LexerCSS + from .LexerCSS import LexerCSS # __IGNORE_WARNING_I101__ return LexerCSS(parent) elif language == "TeX": - from .LexerTeX import LexerTeX + from .LexerTeX import LexerTeX # __IGNORE_WARNING_I101__ return LexerTeX(parent) elif language == "Diff": - from .LexerDiff import LexerDiff + from .LexerDiff import LexerDiff # __IGNORE_WARNING_I101__ return LexerDiff(parent) elif language == "Makefile": - from .LexerMakefile import LexerMakefile + from .LexerMakefile import LexerMakefile # __IGNORE_WARNING_I101__ return LexerMakefile(parent) elif language == "Properties": - from .LexerProperties import LexerProperties + from .LexerProperties import LexerProperties # __IGNORE_WARNING_I101__ return LexerProperties(parent) elif language == "Batch": - from .LexerBatch import LexerBatch + from .LexerBatch import LexerBatch # __IGNORE_WARNING_I101__ return LexerBatch(parent) elif language == "D": - from .LexerD import LexerD + from .LexerD import LexerD # __IGNORE_WARNING_I101__ return LexerD(parent) elif language == "Povray": - from .LexerPOV import LexerPOV + from .LexerPOV import LexerPOV # __IGNORE_WARNING_I101__ return LexerPOV(parent) elif language == "CMake": - from .LexerCMake import LexerCMake + from .LexerCMake import LexerCMake # __IGNORE_WARNING_I101__ return LexerCMake(parent) elif language == "VHDL": - from .LexerVHDL import LexerVHDL + from .LexerVHDL import LexerVHDL # __IGNORE_WARNING_I101__ return LexerVHDL(parent) elif language == "TCL": - from .LexerTCL import LexerTCL + from .LexerTCL import LexerTCL # __IGNORE_WARNING_I101__ return LexerTCL(parent) elif language == "Fortran": - from .LexerFortran import LexerFortran + from .LexerFortran import LexerFortran # __IGNORE_WARNING_I101__ return LexerFortran(parent) elif language == "Fortran77": - from .LexerFortran77 import LexerFortran77 + from .LexerFortran77 import LexerFortran77 # __IGNORE_WARNING_I101__ return LexerFortran77(parent) elif language == "Pascal": - from .LexerPascal import LexerPascal + from .LexerPascal import LexerPascal # __IGNORE_WARNING_I101__ return LexerPascal(parent) elif language == "PostScript": - from .LexerPostScript import LexerPostScript + from .LexerPostScript import LexerPostScript # __IGNORE_WARNING_I101__ return LexerPostScript(parent) elif language == "XML": - from .LexerXML import LexerXML + from .LexerXML import LexerXML # __IGNORE_WARNING_I101__ return LexerXML(parent) elif language == "YAML": - from .LexerYAML import LexerYAML + from .LexerYAML import LexerYAML # __IGNORE_WARNING_I101__ return LexerYAML(parent) elif language == "Matlab": - from .LexerMatlab import LexerMatlab + from .LexerMatlab import LexerMatlab # __IGNORE_WARNING_I101__ return LexerMatlab(parent) elif language == "Octave": - from .LexerOctave import LexerOctave + from .LexerOctave import LexerOctave # __IGNORE_WARNING_I101__ return LexerOctave(parent) elif language == "QSS": - from .LexerQSS import LexerQSS + from .LexerQSS import LexerQSS # __IGNORE_WARNING_I101__ return LexerQSS(parent) elif language == "Gettext": - from .LexerPO import LexerPO + from .LexerPO import LexerPO # __IGNORE_WARNING_I101__ return LexerPO(parent) elif language == "CoffeeScript": - from .LexerCoffeeScript import LexerCoffeeScript + from .LexerCoffeeScript import ( # __IGNORE_WARNING_I101__ + LexerCoffeeScript, + ) return LexerCoffeeScript(parent) elif language == "JSON": - from .LexerJSON import LexerJSON + from .LexerJSON import LexerJSON # __IGNORE_WARNING_I101__ return LexerJSON(parent) elif language == "Markdown": - from .LexerMarkdown import LexerMarkdown + from .LexerMarkdown import LexerMarkdown # __IGNORE_WARNING_I101__ return LexerMarkdown(parent)
--- a/src/eric7/QScintilla/MarkupProviders/HtmlProvider.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/QScintilla/MarkupProviders/HtmlProvider.py Mon Nov 07 17:19:58 2022 +0100 @@ -208,11 +208,11 @@ @param editor reference to the editor to work on @type Editor """ + from .HyperlinkMarkupDialog import HyperlinkMarkupDialog + if editor is None: return - from .HyperlinkMarkupDialog import HyperlinkMarkupDialog - dlg = HyperlinkMarkupDialog(True, False) if dlg.exec() == QDialog.DialogCode.Accepted: text, target, title = dlg.getData() @@ -290,11 +290,11 @@ @param editor reference to the editor to work on @type Editor """ + from .ImageMarkupDialog import ImageMarkupDialog + if editor is None: return - from .ImageMarkupDialog import ImageMarkupDialog - dlg = ImageMarkupDialog(ImageMarkupDialog.HtmlMode) if dlg.exec() == QDialog.DialogCode.Accepted: address, altText, title, originalSize, width, height = dlg.getData()
--- a/src/eric7/QScintilla/MarkupProviders/MarkdownProvider.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/QScintilla/MarkupProviders/MarkdownProvider.py Mon Nov 07 17:19:58 2022 +0100 @@ -204,11 +204,11 @@ @param editor reference to the editor to work on @type Editor """ + from .HyperlinkMarkupDialog import HyperlinkMarkupDialog + if editor is None: return - from .HyperlinkMarkupDialog import HyperlinkMarkupDialog - dlg = HyperlinkMarkupDialog(False, True) if dlg.exec() == QDialog.DialogCode.Accepted: text, target, title = dlg.getData() @@ -296,11 +296,11 @@ @param editor reference to the editor to work on @type Editor """ + from .ImageMarkupDialog import ImageMarkupDialog + if editor is None: return - from .ImageMarkupDialog import ImageMarkupDialog - dlg = ImageMarkupDialog(ImageMarkupDialog.MarkDownMode) if dlg.exec() == QDialog.DialogCode.Accepted: address, altText, title, originalSize, width, height = dlg.getData()
--- a/src/eric7/QScintilla/MarkupProviders/RestructuredTextProvider.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/QScintilla/MarkupProviders/RestructuredTextProvider.py Mon Nov 07 17:19:58 2022 +0100 @@ -202,11 +202,11 @@ @param editor reference to the editor to work on @type Editor """ + from .HyperlinkMarkupDialog import HyperlinkMarkupDialog + if editor is None: return - from .HyperlinkMarkupDialog import HyperlinkMarkupDialog - dlg = HyperlinkMarkupDialog(False, True, noTitle=True) if dlg.exec() == QDialog.DialogCode.Accepted: text, target, _ = dlg.getData() @@ -319,11 +319,11 @@ @param editor reference to the editor to work on @type Editor """ + from .ImageMarkupDialog import ImageMarkupDialog + if editor is None: return - from .ImageMarkupDialog import ImageMarkupDialog - dlg = ImageMarkupDialog(ImageMarkupDialog.RestMode) if dlg.exec() == QDialog.DialogCode.Accepted: address, altText, title, originalSize, width, height = dlg.getData()
--- a/src/eric7/QScintilla/MarkupProviders/__init__.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/QScintilla/MarkupProviders/__init__.py Mon Nov 07 17:19:58 2022 +0100 @@ -32,25 +32,27 @@ extension in Preferences.getEditor("PreviewHtmlFileNameExtensions") or editor.getLanguage() == "HTML" ): - from .HtmlProvider import HtmlProvider + from .HtmlProvider import HtmlProvider # __IGNORE_WARNING_I101__ return HtmlProvider() elif ( extension in Preferences.getEditor("PreviewMarkdownFileNameExtensions") or editor.getLanguage().lower() == "markdown" ): - from .MarkdownProvider import MarkdownProvider + from .MarkdownProvider import MarkdownProvider # __IGNORE_WARNING_I101__ return MarkdownProvider() elif ( extension in Preferences.getEditor("PreviewRestFileNameExtensions") or editor.getLanguage().lower() == "restructuredtext" ): - from .RestructuredTextProvider import RestructuredTextProvider + from .RestructuredTextProvider import ( # __IGNORE_WARNING_I101__ + RestructuredTextProvider, + ) return RestructuredTextProvider() # no supported markup provider identified - from .MarkupBase import MarkupBase + from .MarkupBase import MarkupBase # __IGNORE_WARNING_I101__ return MarkupBase()
--- a/src/eric7/QScintilla/MiniEditor.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/QScintilla/MiniEditor.py Mon Nov 07 17:19:58 2022 +0100 @@ -26,7 +26,12 @@ pyqtSlot, ) from PyQt6.QtGui import QAction, QActionGroup, QFont, QKeySequence, QPalette, QPixmap -from PyQt6.QtPrintSupport import QAbstractPrintDialog, QPrintDialog, QPrinter +from PyQt6.QtPrintSupport import ( + QAbstractPrintDialog, + QPrintDialog, + QPrinter, + QPrintPreviewDialog, +) from PyQt6.QtWidgets import ( QApplication, QDialog, @@ -50,7 +55,10 @@ from eric7.Globals import isMacPlatform from eric7.UI import Config +from . import Lexers +from .EditorOutline import EditorOutlineView from .QsciScintillaCompat import QsciScintillaCompat +from .SearchReplaceWidget import SearchReplaceWidget class MiniScintilla(QsciScintillaCompat): @@ -289,13 +297,9 @@ self.__lastLine = 0 self.srHistory = {"search": [], "replace": []} - from .SearchReplaceWidget import SearchReplaceWidget - self.__searchWidget = SearchReplaceWidget(False, self, self) self.__replaceWidget = SearchReplaceWidget(True, self, self) - from .EditorOutline import EditorOutlineView - self.__sourceOutline = EditorOutlineView(self, populate=False) self.__sourceOutline.setMaximumWidth( Preferences.getEditor("SourceOutlineWidth") @@ -538,8 +542,6 @@ elif language == "": pixmap = EricPixmapCache.getPixmap("fileText") else: - from eric7.QScintilla import Lexers - pixmap = Lexers.getLanguageIcon(language, True) self.sbLanguage.setPixmap(pixmap) if pixmap.isNull(): @@ -3678,8 +3680,6 @@ """ Private slot to show a print preview of the text. """ - from PyQt6.QtPrintSupport import QPrintPreviewDialog - from .Printer import Printer printer = Printer(mode=QPrinter.PrinterMode.HighResolution) @@ -3750,8 +3750,6 @@ self.languagesActGrp.addAction(self.noLanguageAct) menu.addSeparator() - from . import Lexers - self.supportedLanguages = {} supportedLanguages = Lexers.getSupportedLanguages() languages = sorted(supportedLanguages.keys()) @@ -3807,7 +3805,7 @@ @return name of the selected pygments lexer @rtype str """ - from pygments.lexers import get_all_lexers + from pygments.lexers import get_all_lexers # __IGNORE_WARNING_I102__ lexerList = sorted(lex[0] for lex in get_all_lexers()) try: @@ -3963,8 +3961,6 @@ else: self.filetype = language - from . import Lexers - self.lexer_ = Lexers.getLexer(language, self.__textEdit, pyname=pyname) if self.lexer_ is None: self.__textEdit.setLexer() @@ -4042,8 +4038,6 @@ if not bindName and self.filetype: # check filetype - from . import Lexers - supportedLanguages = Lexers.getSupportedLanguages() if self.filetype in supportedLanguages: bindName = supportedLanguages[self.filetype][1]
--- a/src/eric7/QScintilla/Printer.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/QScintilla/Printer.py Mon Nov 07 17:19:58 2022 +0100 @@ -73,10 +73,7 @@ painter.setPen(QColor(Qt.GlobalColor.black)) # set color if drawing: fm = painter.fontMetrics() - try: - fmWidth = fm.horizontalAdvance(header) - except AttributeError: - fmWidth = fm.width(header) + fmWidth = fm.horizontalAdvance(header) painter.drawText( area.right() - fmWidth, area.top() + painter.fontMetrics().ascent(),
--- a/src/eric7/QScintilla/SearchReplaceWidget.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/QScintilla/SearchReplaceWidget.py Mon Nov 07 17:19:58 2022 +0100 @@ -58,7 +58,7 @@ self.findHistory = vm.getSRHistory("search") if replace: - from .Ui_ReplaceWidget import Ui_ReplaceWidget + from .Ui_ReplaceWidget import Ui_ReplaceWidget # __IGNORE_WARNING_I101__ self.replaceHistory = vm.getSRHistory("replace") self.ui = Ui_ReplaceWidget() @@ -71,7 +71,7 @@ """ ) else: - from .Ui_SearchWidget import Ui_SearchWidget + from .Ui_SearchWidget import Ui_SearchWidget # __IGNORE_WARNING_I101__ self.ui = Ui_SearchWidget() whatsThis = self.tr(
--- a/src/eric7/QScintilla/Shell.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/QScintilla/Shell.py Mon Nov 07 17:19:58 2022 +0100 @@ -32,7 +32,9 @@ from eric7.EricGui import EricPixmapCache from eric7.EricWidgets import EricFileDialog, EricMessageBox from eric7.EricWidgets.EricApplication import ericApp +from eric7.UI.SearchWidget import SearchWidget +from . import Lexers from .QsciScintillaCompat import QsciScintillaCompat @@ -60,8 +62,6 @@ self.__shell = Shell(dbs, vm, project, False, self) - from eric7.UI.SearchWidget import SearchWidget - self.__searchWidget = SearchWidget(self.__shell, self, horizontal) self.__searchWidget.setSizePolicy( QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Preferred @@ -427,8 +427,6 @@ """ self.language = language if Preferences.getShell("SyntaxHighlightingEnabled"): - from . import Lexers - self.lexer_ = Lexers.getLexer(self.language, self) else: self.lexer_ = None
--- a/src/eric7/QScintilla/TypingCompleters/__init__.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/QScintilla/TypingCompleters/__init__.py Mon Nov 07 17:19:58 2022 +0100 @@ -19,15 +19,15 @@ """ try: if language in ["Python", "Python3", "MicroPython", "Cython"]: - from .CompleterPython import CompleterPython + from .CompleterPython import CompleterPython # __IGNORE_WARNING_I101__ return CompleterPython(editor, parent) elif language == "Ruby": - from .CompleterRuby import CompleterRuby + from .CompleterRuby import CompleterRuby # __IGNORE_WARNING_I101__ return CompleterRuby(editor, parent) elif language == "YAML": - from .CompleterYaml import CompleterYaml + from .CompleterYaml import CompleterYaml # __IGNORE_WARNING_I101__ return CompleterYaml(editor, parent) else:
--- a/src/eric7/Snapshot/SnapWidget.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Snapshot/SnapWidget.py Mon Nov 07 17:19:58 2022 +0100 @@ -57,11 +57,15 @@ self.setWindowIcon(EricPixmapCache.getIcon("ericSnap")) if Globals.isWaylandSession(): - from .SnapshotWaylandGrabber import SnapshotWaylandGrabber + from .SnapshotWaylandGrabber import ( # __IGNORE_WARNING_I101__ + SnapshotWaylandGrabber, + ) self.__grabber = SnapshotWaylandGrabber(self) else: - from .SnapshotDefaultGrabber import SnapshotDefaultGrabber + from .SnapshotDefaultGrabber import ( # __IGNORE_WARNING_I101__ + SnapshotDefaultGrabber, + ) self.__grabber = SnapshotDefaultGrabber(self) self.decorationsCheckBox.hide()
--- a/src/eric7/Snapshot/SnapshotDefaultGrabber.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Snapshot/SnapshotDefaultGrabber.py Mon Nov 07 17:19:58 2022 +0100 @@ -14,6 +14,7 @@ from eric7 import Globals from .SnapshotModes import SnapshotModes +from .SnapshotTimer import SnapshotTimer class SnapshotDefaultGrabber(QObject): @@ -39,8 +40,6 @@ self.__grabberWidget.move(-10000, -10000) self.__grabberWidget.installEventFilter(self) - from .SnapshotTimer import SnapshotTimer - self.__grabTimer = SnapshotTimer() self.__grabTimer.timeout.connect(self.__grabTimerTimeout)
--- a/src/eric7/Snapshot/SnapshotTimer.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Snapshot/SnapshotTimer.py Mon Nov 07 17:19:58 2022 +0100 @@ -40,14 +40,9 @@ self.__toggle = True # text is taken from paintEvent with maximum number plus some margin - try: - fmWidth = self.fontMetrics().horizontalAdvance( - self.tr("Snapshot will be taken in %n seconds", "", 99) - ) - except AttributeError: - fmWidth = self.fontMetrics().width( - self.tr("Snapshot will be taken in %n seconds", "", 99) - ) + fmWidth = self.fontMetrics().horizontalAdvance( + self.tr("Snapshot will be taken in %n seconds", "", 99) + ) self.resize(fmWidth + 6, self.fontMetrics().height() + 4) self.__timer.timeout.connect(self.__bell)
--- a/src/eric7/Snapshot/SnapshotWaylandGrabber.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Snapshot/SnapshotWaylandGrabber.py Mon Nov 07 17:19:58 2022 +0100 @@ -26,6 +26,7 @@ from eric7.EricWidgets import EricMessageBox from .SnapshotModes import SnapshotModes +from .SnapshotTimer import SnapshotTimer class SnapshotWaylandGrabber(QObject): @@ -46,8 +47,6 @@ """ super().__init__(parent) - from .SnapshotTimer import SnapshotTimer - self.__grabTimer = SnapshotTimer() self.__grabTimer.timeout.connect(self.__performGrab)
--- a/src/eric7/SqlBrowser/SqlBrowser.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/SqlBrowser/SqlBrowser.py Mon Nov 07 17:19:58 2022 +0100 @@ -19,6 +19,8 @@ from eric7.EricWidgets.EricMainWindow import EricMainWindow from eric7.UI import Config +from .SqlBrowserWidget import SqlBrowserWidget + class SqlBrowser(EricMainWindow): """ @@ -44,8 +46,6 @@ self.setStyle(Preferences.getUI("Style"), Preferences.getUI("StyleSheet")) - from .SqlBrowserWidget import SqlBrowserWidget - self.__browser = SqlBrowserWidget(self) self.setCentralWidget(self.__browser)
--- a/src/eric7/Tasks/TaskViewer.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Tasks/TaskViewer.py Mon Nov 07 17:19:58 2022 +0100 @@ -37,6 +37,8 @@ from eric7.Utilities.AutoSaver import AutoSaver from .Task import Task, TaskPriority, TaskType +from .TaskFilter import TaskFilter +from .TaskPropertiesDialog import TaskPropertiesDialog class TaskViewer(QTreeWidget): @@ -76,8 +78,6 @@ self.project = project self.__projectTasksScanFilter = "" - from .TaskFilter import TaskFilter - self.taskFilter = TaskFilter() self.taskFilter.setActive(False) @@ -532,8 +532,6 @@ """ Private slot to handle the "Properties" context menu entry. """ - from .TaskPropertiesDialog import TaskPropertiesDialog - task = self.currentItem() dlg = TaskPropertiesDialog(task, parent=self, projectOpen=self.projectOpen) if dlg.exec() == QDialog.DialogCode.Accepted and dlg.isManualTaskMode(): @@ -557,8 +555,6 @@ """ Private slot to handle the "New Task" context menu entry. """ - from .TaskPropertiesDialog import TaskPropertiesDialog - dlg = TaskPropertiesDialog(None, parent=self, projectOpen=self.projectOpen) if dlg.exec() == QDialog.DialogCode.Accepted: ( @@ -585,8 +581,6 @@ parentTask = self.currentItem() projectTask = parentTask.isProjectTask() - from .TaskPropertiesDialog import TaskPropertiesDialog - dlg = TaskPropertiesDialog(None, parent=self, projectOpen=self.projectOpen) dlg.setSubTaskMode(projectTask) if dlg.exec() == QDialog.DialogCode.Accepted:
--- a/src/eric7/Templates/TemplatePropertiesDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Templates/TemplatePropertiesDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -13,6 +13,8 @@ from eric7 import Preferences from eric7.EricWidgets import EricMessageBox +from eric7.EricWidgets.EricSimpleHelpDialog import EricSimpleHelpDialog +from eric7.QScintilla import Lexers from .Ui_TemplatePropertiesDialog import Ui_TemplatePropertiesDialog @@ -51,8 +53,6 @@ ) self.nameEdit.setValidator(self.__nameValidator) - from eric7.QScintilla import Lexers - self.languages = [("All", self.tr("All"))] supportedLanguages = Lexers.getSupportedLanguages() languages = sorted(supportedLanguages.keys()) @@ -114,8 +114,6 @@ Private slot to show some help. """ if self.__helpDialog is None: - from eric7.EricWidgets.EricSimpleHelpDialog import EricSimpleHelpDialog - self.__helpDialog = EricSimpleHelpDialog( title=self.tr("Template Help"), label=self.tr("<b>Template Help</b>"),
--- a/src/eric7/Templates/TemplateViewer.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Templates/TemplateViewer.py Mon Nov 07 17:19:58 2022 +0100 @@ -19,7 +19,9 @@ from eric7.EricGui import EricPixmapCache from eric7.EricWidgets import EricFileDialog, EricMessageBox from eric7.EricWidgets.EricApplication import ericApp +from eric7.EricXML.TemplatesReader import TemplatesReader +from .TemplatePropertiesDialog import TemplatePropertiesDialog from .TemplatesFile import TemplatesFile @@ -485,8 +487,6 @@ itm.getName() if isinstance(itm, TemplateGroup) else itm.getGroupName() ) - from .TemplatePropertiesDialog import TemplatePropertiesDialog - dlg = TemplatePropertiesDialog(self) dlg.setSelectedGroup(groupName) if dlg.exec() == QDialog.DialogCode.Accepted: @@ -498,8 +498,6 @@ """ Private slot to handle the Add Group context menu action. """ - from .TemplatePropertiesDialog import TemplatePropertiesDialog - dlg = TemplatePropertiesDialog(self, True) if dlg.exec() == QDialog.DialogCode.Accepted: name, language = dlg.getData() @@ -513,8 +511,6 @@ itm = self.currentItem() editGroup = not isinstance(itm, TemplateEntry) - from .TemplatePropertiesDialog import TemplatePropertiesDialog - dlg = TemplatePropertiesDialog(self, editGroup, itm) if dlg.exec() == QDialog.DialogCode.Accepted: if editGroup: @@ -716,6 +712,9 @@ @param itm reference to the template item to apply (TemplateEntry) """ + from .TemplateMultipleVariablesDialog import TemplateMultipleVariablesDialog + from .TemplateSingleVariableDialog import TemplateSingleVariableDialog + editor = self.viewmanager.activeWindow() if editor is None: return @@ -732,17 +731,12 @@ if variables: if Preferences.getTemplates("SingleDialog"): - from .TemplateMultipleVariablesDialog import ( - TemplateMultipleVariablesDialog, - ) dlg = TemplateMultipleVariablesDialog(variables, self) if dlg.exec() == QDialog.DialogCode.Accepted: varValues.update(dlg.getVariables()) ok = True else: - from .TemplateSingleVariableDialog import TemplateSingleVariableDialog - for var in variables: dlg = TemplateSingleVariableDialog(var, self) if dlg.exec() == QDialog.DialogCode.Accepted: @@ -1003,8 +997,6 @@ else: f = QFile(filename) if f.open(QIODevice.OpenModeFlag.ReadOnly): - from eric7.EricXML.TemplatesReader import TemplatesReader - reader = TemplatesReader(f, viewer=self) reader.readXML() f.close()
--- a/src/eric7/Testing/Interfaces/PytestRunner.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Testing/Interfaces/PytestRunner.py Mon Nov 07 17:19:58 2022 +0100 @@ -13,7 +13,11 @@ import sys import time -sys.path.insert(2, os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))) +sys.path.insert( + 2, + os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "..")), +) +# three times up is our installation directory with contextlib.suppress(ImportError): import pytest @@ -301,7 +305,7 @@ plugins. """ try: - import pytest + import pytest # __IGNORE_WARNING_I10__ versions = { "name": "pytest", @@ -326,7 +330,7 @@ Function to determine the defined markers and their descriptions. """ try: - import pytest + import pytest # __IGNORE_WARNING_I10__ # --capture=sys needed on Windows to avoid # ValueError: saved filedescriptor not valid anymore
--- a/src/eric7/Testing/Interfaces/UnittestRunner.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Testing/Interfaces/UnittestRunner.py Mon Nov 07 17:19:58 2022 +0100 @@ -13,7 +13,11 @@ import time import unittest -sys.path.insert(2, os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))) +sys.path.insert( + 2, + os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "..")), +) +# three times up is our installation directory class EricTestResult(unittest.TestResult): @@ -357,7 +361,7 @@ ) ), ) - from eric7.DebugClients.Python.coverage import Coverage + from coverage import Coverage # __IGNORE_WARNING_I10__ cover = Coverage(data_file=covDataFile) if coverageErase:
--- a/src/eric7/Testing/TestingWidget.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Testing/TestingWidget.py Mon Nov 07 17:19:58 2022 +0100 @@ -16,6 +16,7 @@ from PyQt6.QtWidgets import QAbstractButton, QComboBox, QDialogButtonBox, QWidget from eric7 import Preferences +from eric7.DataViews.PyCoverageDialog import PyCoverageDialog from eric7.EricGui import EricPixmapCache from eric7.EricWidgets import EricMessageBox from eric7.EricWidgets.EricApplication import ericApp @@ -174,7 +175,9 @@ self.__projectEnvironmentMarker = self.tr("<project>") except KeyError: # we were called as a standalone application - from eric7.VirtualEnv.VirtualenvManager import VirtualenvManager + from eric7.VirtualEnv.VirtualenvManager import ( # __IGNORE_WARNING_I101__ + VirtualenvManager, + ) self.__venvManager = VirtualenvManager(self) self.__venvManager.virtualEnvironmentAdded.connect( @@ -751,6 +754,8 @@ """ Private slot to show a window containing the list of defined markers. """ + from .MarkersWindow import MarkersWindow + venvName = self.venvComboBox.currentText() if venvName: framework = self.frameworkComboBox.currentText() @@ -767,8 +772,6 @@ markers = executor.getMarkers(interpreter, workdir) if self.__markersWindow is None: - from .MarkersWindow import MarkersWindow - self.__markersWindow = MarkersWindow() self.__markersWindow.showMarkers(markers) @@ -1091,8 +1094,6 @@ run. """ if self.__coverageDialog is None: - from eric7.DataViews.PyCoverageDialog import PyCoverageDialog - self.__coverageDialog = PyCoverageDialog(self) self.__coverageDialog.openFile.connect(self.__openEditor)
--- a/src/eric7/Toolbox/Startup.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Toolbox/Startup.py Mon Nov 07 17:19:58 2022 +0100 @@ -273,7 +273,7 @@ app.setQuitOnLastWindowClosed(quitOnLastWindowClosed) # the following code depends upon a valid application object - from eric7 import Preferences + from eric7 import Preferences # __IGNORE_WARNING_I101__ # set the application style sheet app.setStyleSheetFile(Preferences.getUI("StyleSheet")) @@ -299,7 +299,7 @@ if installErrorHandler: # generate a graphical error handler - from eric7.EricWidgets import EricErrorMessage + from eric7.EricWidgets import EricErrorMessage # __IGNORE_WARNING_I101__ eMsg = EricErrorMessage.qtHandler() eMsg.setMinimumSize(600, 400)
--- a/src/eric7/Tools/TRPreviewer.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Tools/TRPreviewer.py Mon Nov 07 17:19:58 2022 +0100 @@ -44,6 +44,8 @@ from eric7.EricWidgets.EricMainWindow import EricMainWindow from eric7.UI import Config +from .TRSingleApplication import TRSingleApplicationServer + noTranslationName = QCoreApplication.translate("TRPreviewer", "<No translation>") @@ -128,8 +130,6 @@ self.__updateActions() # fire up the single application server - from .TRSingleApplication import TRSingleApplicationServer - self.SAServer = TRSingleApplicationServer(self) self.SAServer.loadForm.connect(self.preview.loadWidget) self.SAServer.loadTranslation.connect(self.translations.add)
--- a/src/eric7/Tools/TrayStarter.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Tools/TrayStarter.py Mon Nov 07 17:19:58 2022 +0100 @@ -12,7 +12,9 @@ import pathlib import sys -from PyQt6.QtCore import QProcess, QSettings +from PyQt6 import sip +from PyQt6.Qsci import QSCINTILLA_VERSION_STR +from PyQt6.QtCore import PYQT_VERSION_STR, QProcess, QSettings, qVersion from PyQt6.QtGui import QCursor from PyQt6.QtWidgets import QApplication, QDialog, QMenu, QSystemTrayIcon @@ -573,16 +575,9 @@ """ Private slot to handle the Versions dialog. """ - from PyQt6.Qsci import QSCINTILLA_VERSION_STR - from PyQt6.QtCore import PYQT_VERSION_STR, qVersion - try: - try: - from PyQt6 import sip - except ImportError: - import sip sip_version_str = sip.SIP_VERSION_STR - except (ImportError, AttributeError): + except AttributeError: sip_version_str = "sip version not available" versionText = self.tr("""<h3>Version Numbers</h3>""" """<table>""") @@ -608,7 +603,9 @@ # webengine (chromium) version with contextlib.suppress(ImportError): - from eric7.WebBrowser.Tools import WebBrowserTools + from eric7.WebBrowser.Tools import ( # __IGNORE_WARNING_I101__ + WebBrowserTools, + ) ( chromiumVersion,
--- a/src/eric7/Tools/UIPreviewer.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Tools/UIPreviewer.py Mon Nov 07 17:19:58 2022 +0100 @@ -13,7 +13,7 @@ from PyQt6 import uic from PyQt6.QtCore import QDir, QEvent, QSize, Qt from PyQt6.QtGui import QAction, QImageWriter, QKeySequence, QPainter -from PyQt6.QtPrintSupport import QPrintDialog, QPrinter +from PyQt6.QtPrintSupport import QPrintDialog, QPrinter, QPrintPreviewDialog from PyQt6.QtWidgets import ( QApplication, QComboBox, @@ -563,8 +563,6 @@ """ Private slot to handle the Print Preview menu action. """ - from PyQt6.QtPrintSupport import QPrintPreviewDialog - if self.mainWidget is None: EricMessageBox.critical( self,
--- a/src/eric7/UI/Browser.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/UI/Browser.py Mon Nov 07 17:19:58 2022 +0100 @@ -36,6 +36,7 @@ from eric7.EricWidgets import EricFileDialog, EricMessageBox from eric7.EricWidgets.EricApplication import ericApp from eric7.Project.ProjectBrowserModel import ProjectBrowserSimpleDirectoryItem +from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog from eric7.Utilities import MimeTypes from .BrowserModel import ( @@ -1012,15 +1013,13 @@ @type str """ try: - from send2trash import send2trash as s2t + from send2trash import send2trash as s2t # __IGNORE_WARNING_I10__ trashMsg = self.tr("Do you really want to move this file to the" " trash?") except ImportError: s2t = os.remove trashMsg = self.tr("Do you really want to delete this file?") - from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog - dlg = DeleteFilesConfirmationDialog( self.parent(), self.tr("Delete File"), trashMsg, [fn] ) @@ -1045,7 +1044,7 @@ @type str """ try: - from send2trash import send2trash + from send2trash import send2trash # __IGNORE_WARNING_I10__ s2tAvailable = True trashMsg = self.tr( @@ -1055,8 +1054,6 @@ s2tAvailable = False trashMsg = self.tr("Do you really want to delete this directory?") - from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog - dlg = DeleteFilesConfirmationDialog( self.parent(), self.tr("Delete Directory"), trashMsg, [dn] ) @@ -1089,7 +1086,7 @@ fileNames.append(itm.fileName()) try: - from send2trash import send2trash as s2t + from send2trash import send2trash as s2t # __IGNORE_WARNING_I10__ trashMsg = self.tr( "Do you really want to move these files to the" " trash?" @@ -1098,8 +1095,6 @@ s2t = os.remove trashMsg = self.tr("Do you really want to delete these files?") - from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog - dlg = DeleteFilesConfirmationDialog( self.parent(), self.tr("Delete Files"), trashMsg, sorted(fileNames) )
--- a/src/eric7/UI/BrowserModel.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/UI/BrowserModel.py Mon Nov 07 17:19:58 2022 +0100 @@ -26,6 +26,7 @@ from eric7 import Preferences, Utilities from eric7.EricGui import EricPixmapCache +from eric7.Utilities.ClassBrowsers import ClbrBaseClasses BrowserItemRoot = 0 BrowserItemDirectory = 1 @@ -1484,8 +1485,6 @@ self._classObject = cl self._filename = filename - from eric7.Utilities.ClassBrowsers import ClbrBaseClasses - self.isfunction = isinstance(self._classObject, ClbrBaseClasses.Function) self.ismodule = isinstance(self._classObject, ClbrBaseClasses.Module) self.isenum = isinstance(self._classObject, ClbrBaseClasses.Enum) @@ -1612,8 +1611,6 @@ name = fn.name BrowserItem.__init__(self, parent, name) - from eric7.Utilities.ClassBrowsers import ClbrBaseClasses - self.type_ = BrowserItemMethod self._name = name self._functionObject = fn
--- a/src/eric7/UI/CodeDocumentationViewer.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/UI/CodeDocumentationViewer.py Mon Nov 07 17:19:58 2022 +0100 @@ -89,8 +89,12 @@ self.__verticalLayout.setContentsMargins(0, 0, 0, 0) try: - from PyQt6.QtWebEngineCore import QWebEngineSettings - from PyQt6.QtWebEngineWidgets import QWebEngineView + from PyQt6.QtWebEngineCore import ( # __IGNORE_WARNING_I10__ + QWebEngineSettings, + ) + from PyQt6.QtWebEngineWidgets import ( # __IGNORE_WARNING_I10__ + QWebEngineView, + ) self.__contents = QWebEngineView(self) self.__contents.page().linkHovered.connect(self.__showLink)
--- a/src/eric7/UI/EmailDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/UI/EmailDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -33,6 +33,7 @@ from eric7 import Preferences, Utilities from eric7.EricGui.EricOverrideCursor import EricOverrideCursor from eric7.EricWidgets import EricFileDialog, EricMessageBox +from eric7.EricWidgets.EricSimpleHelpDialog import EricSimpleHelpDialog from .Info import BugAddress, FeatureAddress from .Ui_EmailDialog import Ui_EmailDialog @@ -157,7 +158,9 @@ """ if self.__helpDialog is None: try: - from eric7.EricNetwork.EricGoogleMail import GoogleMailHelp + from eric7.EricNetwork.EricGoogleMail import ( # __IGNORE_WARNING__ + GoogleMailHelp, + ) helpStr = GoogleMailHelp() except ImportError: @@ -166,8 +169,6 @@ " Change to the Email configuration page for more.</p>" ) - from eric7.EricWidgets.EricSimpleHelpDialog import EricSimpleHelpDialog - self.__helpDialog = EricSimpleHelpDialog( title=self.tr("Gmail API Help"), helpStr=helpStr, parent=self ) @@ -407,7 +408,9 @@ @type email.mime.text.MIMEBase """ try: - from eric7.EricNetwork.EricGoogleMail import EricGoogleMail + from eric7.EricNetwork.EricGoogleMail import ( # __IGNORE_WARNING_I101__ + EricGoogleMail, + ) if self.__googleMail is None: self.__googleMail = EricGoogleMail(self)
--- a/src/eric7/UI/InstallInfoDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/UI/InstallInfoDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -16,6 +16,7 @@ from eric7 import Globals from eric7.EricGui import EricPixmapCache from eric7.EricWidgets import EricMessageBox +from eric7.EricWidgets.EricPlainTextDialog import EricPlainTextDialog from .Ui_InstallInfoDialog import Ui_InstallInfoDialog @@ -272,8 +273,6 @@ ) ) - from eric7.EricWidgets.EricPlainTextDialog import EricPlainTextDialog - dlg = EricPlainTextDialog( title=self.tr("Upgrade Instructions"), text="\n".join(updateTextList) )
--- a/src/eric7/UI/LogView.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/UI/LogView.py Mon Nov 07 17:19:58 2022 +0100 @@ -22,6 +22,8 @@ from eric7.EricGui import EricPixmapCache from eric7.EricWidgets.EricApplication import ericApp +from .SearchWidget import SearchWidget + class LogViewer(QWidget): """ @@ -42,8 +44,6 @@ self.__ui = ui self.__logViewer = LogViewerEdit(self) - from .SearchWidget import SearchWidget - self.__searchWidget = SearchWidget(self.__logViewer, self) self.__searchWidget.setSizePolicy( QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Preferred
--- a/src/eric7/UI/NotificationWidget.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/UI/NotificationWidget.py Mon Nov 07 17:19:58 2022 +0100 @@ -202,13 +202,7 @@ if not self.__settingPosition: pos = Preferences.getUI("NotificationPosition") - try: - screen = self.screen() - except AttributeError: - # < Qt 5.15 - from PyQt6.QtGui import QGuiApplication - - screen = QGuiApplication.screenAt(pos) + screen = self.screen() screenGeom = screen.geometry() newX = pos.x()
--- a/src/eric7/UI/Previewer.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/UI/Previewer.py Mon Nov 07 17:19:58 2022 +0100 @@ -222,7 +222,9 @@ if language in ["HTML", "Markdown", "ReST"]: if self.__htmlPreviewer is None: - from .Previewers.PreviewerHTML import PreviewerHTML + from .Previewers.PreviewerHTML import ( # __IGNORE_WARNING_I101__ + PreviewerHTML, + ) self.__htmlPreviewer = PreviewerHTML() self.addWidget(self.__htmlPreviewer) @@ -230,7 +232,9 @@ self.__htmlPreviewer.processEditor(editor) elif language == "QSS": if self.__qssPreviewer is None: - from .Previewers.PreviewerQSS import PreviewerQSS + from .Previewers.PreviewerQSS import ( # __IGNORE_WARNING_I101__ + PreviewerQSS, + ) self.__qssPreviewer = PreviewerQSS() self.addWidget(self.__qssPreviewer)
--- a/src/eric7/UI/Previewers/PreviewerHTML.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/UI/Previewers/PreviewerHTML.py Mon Nov 07 17:19:58 2022 +0100 @@ -16,7 +16,7 @@ import tempfile import threading -from PyQt6.QtCore import Qt, QThread, QUrl, pyqtSignal, pyqtSlot +from PyQt6.QtCore import QEventLoop, QPoint, Qt, QThread, QUrl, pyqtSignal, pyqtSlot from PyQt6.QtGui import QCursor, QGuiApplication from PyQt6.QtWidgets import ( QCheckBox, @@ -58,7 +58,9 @@ self.__previewAvailable = True try: - from PyQt6.QtWebEngineWidgets import QWebEngineView + from PyQt6.QtWebEngineWidgets import ( # __IGNORE_WARNING_I10__ + QWebEngineView, + ) self.previewView = QWebEngineView(self) self.previewView.page().linkHovered.connect(self.__showLink) @@ -286,8 +288,6 @@ """ Private method to save scroll bar positions for a previewed editor. """ - from PyQt6.QtCore import QPoint - try: pos = self.previewView.scrollPosition() except AttributeError: @@ -328,8 +328,6 @@ @return result of the script @rtype depending upon script result """ - from PyQt6.QtCore import QEventLoop - loop = QEventLoop() resultDict = {"res": None} @@ -636,7 +634,9 @@ @return processed HTML (string) """ try: - from sphinx.application import Sphinx # __IGNORE_EXCEPTION__ + from sphinx.application import ( # __IGNORE_EXCEPTION__ __IGNORE_WARNING__ + Sphinx, + ) except ImportError: return self.tr( """<p>ReStructuredText preview requires the""" @@ -705,8 +705,8 @@ sys.modules.pop(key) try: - import docutils.core # __IGNORE_EXCEPTION__ - import docutils.utils # __IGNORE_EXCEPTION__ + import docutils.core # __IGNORE_EXCEPTION__ __IGNORE_WARNING_I10__ + import docutils.utils # __IGNORE_EXCEPTION__ __IGNORE_WARNING_I10__ except ImportError: return self.tr( """<p>ReStructuredText preview requires the""" @@ -752,7 +752,7 @@ @rtype str """ try: - import markdown # __IGNORE_EXCEPTION__ + import markdown # __IGNORE_EXCEPTION__ __IGNORE_WARNING_I10__ except ImportError: return self.tr( """<p>Markdown preview requires the <b>Markdown</b> """ @@ -762,7 +762,7 @@ """installation instructions.</a></p>""" ) - from . import MarkdownExtensions, PreviewerHTMLStyles + from . import MarkdownExtensions, PreviewerHTMLStyles # __IGNORE_WARNING_I101__ extensions = []
--- a/src/eric7/UI/SearchWidget.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/UI/SearchWidget.py Mon Nov 07 17:19:58 2022 +0100 @@ -43,11 +43,13 @@ super().__init__(parent) if showLine: - from .Ui_SearchWidgetLine import Ui_SearchWidgetLine + from .Ui_SearchWidgetLine import ( # __IGNORE_WARNING_I101__ + Ui_SearchWidgetLine, + ) self.__ui = Ui_SearchWidgetLine() else: - from .Ui_SearchWidget import Ui_SearchWidget + from .Ui_SearchWidget import Ui_SearchWidget # __IGNORE_WARNING_I101__ self.__ui = Ui_SearchWidget() self.__ui.setupUi(self)
--- a/src/eric7/UI/SymbolsWidget.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/UI/SymbolsWidget.py Mon Nov 07 17:19:58 2022 +0100 @@ -527,10 +527,7 @@ QHeaderView.ResizeMode.Fixed ) fm = self.fontMetrics() - try: - em = fm.horizontalAdvance("M") - except AttributeError: - em = fm.width("M") + em = fm.horizontalAdvance("M") self.symbolsTable.horizontalHeader().resizeSection(0, em * 5) self.symbolsTable.horizontalHeader().resizeSection(1, em * 5) self.symbolsTable.horizontalHeader().resizeSection(2, em * 6)
--- a/src/eric7/UI/UserInterface.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/UI/UserInterface.py Mon Nov 07 17:19:58 2022 +0100 @@ -18,6 +18,7 @@ import shutil import sys +from PyQt6 import sip from PyQt6.Qsci import QSCINTILLA_VERSION_STR from PyQt6.QtCore import ( PYQT_VERSION_STR, @@ -53,7 +54,10 @@ QWidget, ) -from eric7 import Globals, Preferences, Utilities +from eric7 import Globals, Preferences, Testing, Utilities +from eric7.CondaInterface.Conda import Conda +from eric7.Debugger.DebugServer import DebugServer +from eric7.Debugger.DebugUI import DebugUI from eric7.EricGui import EricPixmapCache from eric7.EricGui.EricAction import EricAction, createActionGroup from eric7.EricNetwork.EricNetworkIcon import EricNetworkIcon @@ -68,9 +72,21 @@ from eric7.EricWidgets.EricSingleApplication import EricSingleApplicationServer from eric7.EricWidgets.EricToolBarManager import EricToolBarManager from eric7.EricWidgets.EricZoomWidget import EricZoomWidget +from eric7.EricXML.SessionReader import SessionReader +from eric7.EricXML.TasksReader import TasksReader from eric7.Globals import getConfig +from eric7.MultiProject.MultiProject import MultiProject +from eric7.PipInterface.Pip import Pip +from eric7.PluginManager.PluginManager import PluginManager +from eric7.PluginManager.PluginRepositoryDialog import PluginRepositoryDownloadCleanup +from eric7.Preferences import Shortcuts +from eric7.Project.Project import Project +from eric7.QScintilla.SpellChecker import SpellChecker from eric7.Sessions.SessionFile import SessionFile from eric7.Tasks.TasksFile import TasksFile +from eric7.Testing.TestingWidget import clearSavedHistories +from eric7.Utilities.BackgroundService import BackgroundService +from eric7.VirtualEnv.VirtualenvManager import VirtualenvManager from . import Config from .Info import BugAddress, FeatureAddress, Program, Version, VersionOnly @@ -281,56 +297,40 @@ # Generate the conda interface logging.debug("Creating Conda Interface...") - from eric7.CondaInterface.Conda import Conda - self.condaInterface = Conda(self) ericApp().registerObject("Conda", self.condaInterface) # Generate the pip interface logging.debug("Creating Pip Interface...") - from eric7.PipInterface.Pip import Pip - self.pipInterface = Pip(self) ericApp().registerObject("Pip", self.pipInterface) # Generate the virtual environment manager logging.debug("Creating Virtual Environments Manager...") - from eric7.VirtualEnv.VirtualenvManager import VirtualenvManager - self.virtualenvManager = VirtualenvManager(self) # register it early because it is needed very soon ericApp().registerObject("VirtualEnvManager", self.virtualenvManager) # Generate an empty project object and multi project object logging.debug("Creating Project Manager...") - from eric7.Project.Project import Project - self.project = Project(self) ericApp().registerObject("Project", self.project) - from eric7.MultiProject.MultiProject import MultiProject - logging.debug("Creating Multi-Project Manager...") self.multiProject = MultiProject(self.project, self) # Generate the debug server object logging.debug("Creating Debug Server...") - from eric7.Debugger.DebugServer import DebugServer - self.__debugServer = DebugServer( self.__originalPathString, project=self.project, parent=self ) # Create the background service object - from eric7.Utilities.BackgroundService import BackgroundService - self.backgroundService = BackgroundService(self) splash.showMessage(self.tr("Initializing Plugin Manager...")) # Initialize the Plugin Manager (Plugins are initialized later - from eric7.PluginManager.PluginManager import PluginManager - self.pluginManager = PluginManager( self, self.__disabledPlugins, develPlugin=plugin ) @@ -342,14 +342,14 @@ self.__webBrowserSAName = QUuid.createUuid().toString()[1:-1] # set spellchecker defaults - from eric7.QScintilla.SpellChecker import SpellChecker - SpellChecker.setDefaultLanguage( Preferences.getEditor("SpellCheckingDefaultLanguage") ) with contextlib.suppress(ImportError, AttributeError): - from eric7.EricWidgets.EricSpellCheckedTextEdit import SpellCheckMixin + from eric7.EricWidgets.EricSpellCheckedTextEdit import ( # __IGNORE_WARNING__ + SpellCheckMixin, + ) pwl = SpellChecker.getUserDictionaryPath(isException=False) pel = SpellChecker.getUserDictionaryPath(isException=True) @@ -368,8 +368,6 @@ # Generate the debugger part of the ui logging.debug("Creating Debugger UI...") - from eric7.Debugger.DebugUI import DebugUI - self.debuggerUI = DebugUI( self, self.viewmanager, self.__debugServer, self.debugViewer, self.project ) @@ -746,15 +744,9 @@ self.pluginManager.initPluginToolbars(self.toolbarManager) if Preferences.getPluginManager("StartupCleanup"): splash.showMessage(self.tr("Cleaning Plugins Download Area...")) - from eric7.PluginManager.PluginRepositoryDialog import ( - PluginRepositoryDownloadCleanup, - ) - PluginRepositoryDownloadCleanup(quiet=True) # now read the keyboard shortcuts for all the actions - from eric7.Preferences import Shortcuts - Shortcuts.readShortcuts() # restore toolbar manager state @@ -835,66 +827,62 @@ """ Private method to create the various application objects. """ + from eric7 import ViewManager + from eric7.Debugger.DebugViewer import DebugViewer + from eric7.JediInterface.AssistantJedi import AssistantJedi + from eric7.MultiProject.MultiProjectBrowser import MultiProjectBrowser + from eric7.PluginManager.PluginRepositoryDialog import PluginRepositoryWidget + from eric7.Project.ProjectBrowser import ProjectBrowser + from eric7.QScintilla.Shell import ShellAssembly + from eric7.Tasks.TaskViewer import TaskViewer + from eric7.VCS.StatusWidget import StatusWidget + from eric7.VirtualEnv.VirtualenvManagerWidgets import VirtualenvManagerWidget + + from .LogView import LogViewer + from .Previewer import Previewer + from .PythonAstViewer import PythonAstViewer + from .PythonDisViewer import PythonDisViewer + # Create the view manager depending on the configuration setting logging.debug("Creating Viewmanager...") - from eric7 import ViewManager - self.viewmanager = ViewManager.factory( self, self, self.__debugServer, self.pluginManager ) # Create previewer logging.debug("Creating Previewer...") - from .Previewer import Previewer - self.__previewer = Previewer(self.viewmanager) # Create AST viewer logging.debug("Creating Python AST Viewer") - from .PythonAstViewer import PythonAstViewer - self.__astViewer = PythonAstViewer(self.viewmanager) # Create DIS viewer logging.debug("Creating Python Disassembly Viewer") - from .PythonDisViewer import PythonDisViewer - self.__disViewer = PythonDisViewer(self.viewmanager) # Create the project browser logging.debug("Creating Project Browser...") - from eric7.Project.ProjectBrowser import ProjectBrowser - self.projectBrowser = ProjectBrowser(self.project) # Create the multi project browser logging.debug("Creating Multiproject Browser...") - from eric7.MultiProject.MultiProjectBrowser import MultiProjectBrowser - self.multiProjectBrowser = MultiProjectBrowser(self.multiProject, self.project) # Create the task viewer part of the user interface logging.debug("Creating Task Viewer...") - from eric7.Tasks.TaskViewer import TaskViewer - self.taskViewer = TaskViewer(None, self.project) # Create the log viewer part of the user interface logging.debug("Creating Log Viewer...") - from .LogView import LogViewer - self.logViewer = LogViewer(self) # Create the debug viewer logging.debug("Creating Debug Viewer...") - from eric7.Debugger.DebugViewer import DebugViewer - self.debugViewer = DebugViewer(self.__debugServer) # Create the shell logging.debug("Creating Shell...") - from eric7.QScintilla.Shell import ShellAssembly - self.shellAssembly = ShellAssembly( self.__debugServer, self.viewmanager, self.project, True ) @@ -903,7 +891,9 @@ if Preferences.getUI("ShowTemplateViewer"): # Create the template viewer part of the user interface logging.debug("Creating Template Viewer...") - from eric7.Templates.TemplateViewer import TemplateViewer + from eric7.Templates.TemplateViewer import ( # __IGNORE_WARNING_I101__ + TemplateViewer, + ) self.templateViewer = TemplateViewer(None, self.viewmanager) else: @@ -913,7 +903,7 @@ if Preferences.getUI("ShowFileBrowser"): # Create the file browser logging.debug("Creating File Browser...") - from .Browser import Browser + from .Browser import Browser # __IGNORE_WARNING_I101__ self.browser = Browser() else: @@ -923,7 +913,7 @@ if Preferences.getUI("ShowSymbolsViewer"): # Create the symbols viewer logging.debug("Creating Symbols Viewer...") - from .SymbolsWidget import SymbolsWidget + from .SymbolsWidget import SymbolsWidget # __IGNORE_WARNING_I101__ self.symbolsViewer = SymbolsWidget() else: @@ -933,7 +923,9 @@ if Preferences.getUI("ShowCodeDocumentationViewer"): # Create the code documentation viewer logging.debug("Creating Code Documentation Viewer...") - from .CodeDocumentationViewer import CodeDocumentationViewer + from .CodeDocumentationViewer import ( # __IGNORE_WARNING_I101__ + CodeDocumentationViewer, + ) self.codeDocumentationViewer = CodeDocumentationViewer(self) else: @@ -943,7 +935,9 @@ if Preferences.getUI("ShowPyPIPackageManager"): # Create the PyPI package manager logging.debug("Creating PyPI Package Manager...") - from eric7.PipInterface.PipPackagesWidget import PipPackagesWidget + from eric7.PipInterface.PipPackagesWidget import ( # __IGNORE_WARNING__ + PipPackagesWidget, + ) self.pipWidget = PipPackagesWidget(self.pipInterface) else: @@ -953,7 +947,9 @@ if Preferences.getUI("ShowCondaPackageManager"): # Create the conda package manager logging.debug("Creating Conda Package Manager...") - from eric7.CondaInterface.CondaPackagesWidget import CondaPackagesWidget + from eric7.CondaInterface.CondaPackagesWidget import ( # __IGNORE_WARNING__ + CondaPackagesWidget, + ) self.condaWidget = CondaPackagesWidget(self.condaInterface) else: @@ -963,7 +959,9 @@ if Preferences.getUI("ShowCooperation"): # Create the chat part of the user interface logging.debug("Creating Chat Widget...") - from eric7.Cooperation.ChatWidget import ChatWidget + from eric7.Cooperation.ChatWidget import ( # __IGNORE_WARNING_I101__ + ChatWidget, + ) self.cooperation = ChatWidget(self) else: @@ -973,7 +971,7 @@ if Preferences.getUI("ShowIrc"): # Create the IRC part of the user interface logging.debug("Creating IRC Widget...") - from eric7.Network.IRC.IrcWidget import IrcWidget + from eric7.Network.IRC.IrcWidget import IrcWidget # __IGNORE_WARNING_I101__ self.irc = IrcWidget(self) else: @@ -983,7 +981,9 @@ if Preferences.getUI("ShowMicroPython"): # Create the MicroPython part of the user interface logging.debug("Creating MicroPython Widget...") - from eric7.MicroPython.MicroPythonWidget import MicroPythonWidget + from eric7.MicroPython.MicroPythonWidget import ( # __IGNORE_WARNING_I101__ + MicroPythonWidget, + ) self.microPythonWidget = MicroPythonWidget(self) else: @@ -993,7 +993,7 @@ if Preferences.getUI("ShowNumbersViewer"): # Create the numbers viewer logging.debug("Creating Numbers Viewer...") - from .NumbersWidget import NumbersWidget + from .NumbersWidget import NumbersWidget # __IGNORE_WARNING_I101__ self.numbersViewer = NumbersWidget() else: @@ -1002,13 +1002,9 @@ # Create the Jedi Assistant logging.debug("Creating Jedi Assistant...") - from eric7.JediInterface.AssistantJedi import AssistantJedi - self.jediAssistant = AssistantJedi(self, self.viewmanager, self.project) # Create the plug-ins repository viewer - from eric7.PluginManager.PluginRepositoryDialog import PluginRepositoryWidget - self.pluginRepositoryViewer = PluginRepositoryWidget( self.pluginManager, integrated=True, parent=self ) @@ -1017,8 +1013,6 @@ ) # Create the virtual environments management widget - from eric7.VirtualEnv.VirtualenvManagerWidgets import VirtualenvManagerWidget - self.__virtualenvManagerWidget = VirtualenvManagerWidget( self.virtualenvManager, self ) @@ -1027,7 +1021,7 @@ self.__replaceFileDialog = None if Preferences.getUI("ShowFindFileWidget"): # Create the find in files widget - from .FindFileWidget import FindFileWidget + from .FindFileWidget import FindFileWidget # __IGNORE_WARNING_I101__ self.__findFileWidget = FindFileWidget(self.project, self) self.__findFileWidget.sourceFile.connect(self.viewmanager.openSourceFile) @@ -1043,7 +1037,9 @@ self.__findLocationDialog = None if Preferences.getUI("ShowFindLocationWidget"): # Create the find location (file) widget - from .FindLocationWidget import FindLocationWidget + from .FindLocationWidget import ( # __IGNORE_WARNING_I101__ + FindLocationWidget, + ) self.__findLocationWidget = FindLocationWidget(self.project, self) self.__findLocationWidget.sourceFile.connect( @@ -1059,8 +1055,6 @@ self.__findLocationWidget = None # Create the VCS Status widget - from eric7.VCS.StatusWidget import StatusWidget - self.__vcsStatusWidget = StatusWidget(self.project, self.viewmanager, self) if ( @@ -1069,7 +1063,9 @@ ): # Create the embedded help viewer logging.debug("Creating Internal Help Viewer...") - from eric7.HelpViewer.HelpViewerWidget import HelpViewerWidget + from eric7.HelpViewer.HelpViewerWidget import ( # __IGNORE_WARNING_I101__ + HelpViewerWidget, + ) self.__helpViewerWidget = HelpViewerWidget(self) else: @@ -4359,6 +4355,8 @@ """ Private slot to set up the status bar. """ + from eric7.VCS.StatusMonitorLed import StatusMonitorLedWidget + self.__statusBar = self.statusBar() self.__statusBar.setSizeGripEnabled(True) @@ -4440,8 +4438,6 @@ self.sbZoom, ) - from eric7.VCS.StatusMonitorLed import StatusMonitorLedWidget - self.sbVcsMonitorLed = StatusMonitorLedWidget(self.project, self.__statusBar) self.__statusBar.addPermanentWidget(self.sbVcsMonitorLed) @@ -4599,12 +4595,8 @@ from .VersionsDialog import VersionsDialog try: - try: - from PyQt6 import sip - except ImportError: - import sip sip_version_str = sip.SIP_VERSION_STR - except (ImportError, AttributeError): + except AttributeError: sip_version_str = "sip version not available" sizeStr = "64-Bit" if sys.maxsize > 2**32 else "32-Bit" @@ -4626,13 +4618,13 @@ PYQT_VERSION_STR ) with contextlib.suppress(ImportError, AttributeError): - from PyQt6 import QtCharts + from PyQt6 import QtCharts # __IGNORE_WARNING_I10__ versionText += ( """<tr><td><b>PyQt6-Charts</b></td><td>{0}</td></tr>""" ).format(QtCharts.PYQT_CHART_VERSION_STR) with contextlib.suppress(ImportError, AttributeError): - from PyQt6 import QtWebEngineCore + from PyQt6 import QtWebEngineCore # __IGNORE_WARNING_I10__ versionText += ( """<tr><td><b>PyQt6-WebEngine</b></td><td>{0}</td></tr>""" @@ -4646,7 +4638,9 @@ # webengine (chromium) version with contextlib.suppress(ImportError): - from eric7.WebBrowser.Tools import WebBrowserTools + from eric7.WebBrowser.Tools import ( # __IGNORE_WARNING_I101__ + WebBrowserTools, + ) ( chromiumVersion, @@ -4724,7 +4718,7 @@ self.showPreferences("emailPage") return - from .EmailDialog import EmailDialog + from .EmailDialog import EmailDialog # __IGNORE_WARNING_I101__ self.dlg = EmailDialog(mode=mode) if attachFile is not None: @@ -4767,11 +4761,11 @@ Public method to check for the presence of an error log and ask the user, what to do with it. """ + from .ErrorLogDialog import ErrorLogDialog + if Preferences.getUI("CheckErrorLog"): logFile = os.path.join(Utilities.getConfigDir(), self.ErrorLogFileName) if os.path.exists(logFile): - from .ErrorLogDialog import ErrorLogDialog - dlg = ErrorLogDialog(logFile, False, self) dlg.exec() @@ -4788,10 +4782,10 @@ """ Private slot to show the most recent error log message. """ + from .ErrorLogDialog import ErrorLogDialog + logFile = os.path.join(Utilities.getConfigDir(), self.ErrorLogFileName) if os.path.exists(logFile): - from .ErrorLogDialog import ErrorLogDialog - dlg = ErrorLogDialog(logFile, True, self) dlg.show() @@ -4810,11 +4804,11 @@ """ Private slot to handle the Compare Files dialog. """ + from .DiffDialog import DiffDialog + aw = self.viewmanager.activeWindow() fn = aw and aw.getFileName() or None if self.diffDlg is None: - from .DiffDialog import DiffDialog - self.diffDlg = DiffDialog() self.diffDlg.show(fn) @@ -4822,11 +4816,11 @@ """ Private slot to handle the Compare Files dialog. """ + from .CompareDialog import CompareDialog + aw = self.viewmanager.activeWindow() fn = aw and aw.getFileName() or None if self.compareDlg is None: - from .CompareDialog import CompareDialog - self.compareDlg = CompareDialog() self.compareDlg.show(fn) @@ -5961,9 +5955,9 @@ """ Private slot to generate the testing dialog on demand. """ + from eric7.Testing.TestingWidget import TestingWidget + if self.__testingWidget is None: - from eric7.Testing.TestingWidget import TestingWidget - self.__testingWidget = TestingWidget() self.__testingWidget.testFile.connect(self.viewmanager.setFileLine) self.__testingWidget.testRunStopped.connect(self.__testingStopped) @@ -7158,10 +7152,10 @@ @param pageName name of the configuration page to show (string) """ + from eric7.Preferences.ConfigurationDialog import ConfigurationDialog + if self.__configurationDialog is None: # only one invocation at a time is allowed - from eric7.Preferences.ConfigurationDialog import ConfigurationDialog - self.__configurationDialog = ConfigurationDialog( self, "Configuration", @@ -7237,6 +7231,8 @@ """ Private slot to handle a change of the preferences. """ + from eric7.HexEdit.HexEditMainWindow import HexEditMainWindow + self.setStyle(Preferences.getUI("Style"), Preferences.getUI("StyleSheet")) if Preferences.getUI("SingleApplicationMode"): @@ -7273,14 +7269,14 @@ self.performVersionCheck() - from eric7.QScintilla.SpellChecker import SpellChecker - SpellChecker.setDefaultLanguage( Preferences.getEditor("SpellCheckingDefaultLanguage") ) with contextlib.suppress(ImportError, AttributeError): - from eric7.EricWidgets.EricSpellCheckedTextEdit import SpellCheckMixin + from eric7.EricWidgets.EricSpellCheckedTextEdit import ( # __IGNORE_WARNING__ + SpellCheckMixin, + ) pwl = SpellChecker.getUserDictionaryPath(isException=False) pel = SpellChecker.getUserDictionaryPath(isException=True) @@ -7295,8 +7291,6 @@ QNetworkProxyFactory.setApplicationProxyFactory(self.__proxyFactory) QNetworkProxyFactory.setUseSystemConfiguration(False) - from eric7.HexEdit.HexEditMainWindow import HexEditMainWindow - for hexEditor in HexEditMainWindow.windows: hexEditor.preferencesChanged() @@ -7328,7 +7322,9 @@ Preferences.convertPasswords(oldPassword, newPassword) variant = Globals.getWebBrowserSupport() if variant == "QtWebEngine": - from eric7.WebBrowser.Passwords.PasswordManager import PasswordManager + from eric7.WebBrowser.Passwords.PasswordManager import ( # __IGNORE_WARNING__ + PasswordManager, + ) pwManager = PasswordManager() pwManager.masterPasswordChanged(oldPassword, newPassword) @@ -7345,9 +7341,9 @@ Private slot to display a dialog show a list of external tools used by eric. """ + from eric7.Preferences.ProgramsDialog import ProgramsDialog + if self.programsDialog is None: - from eric7.Preferences.ProgramsDialog import ProgramsDialog - self.programsDialog = ProgramsDialog(self) self.programsDialog.show() @@ -7384,9 +7380,9 @@ """ Private slot to configure the keyboard shortcuts. """ + from eric7.Preferences.ShortcutsDialog import ShortcutsDialog + if self.shortcutsDialog is None: - from eric7.Preferences.ShortcutsDialog import ShortcutsDialog - self.shortcutsDialog = ShortcutsDialog(self) self.shortcutsDialog.populate() self.shortcutsDialog.show() @@ -7427,8 +7423,6 @@ ) if ok: - from eric7.Preferences import Shortcuts - Shortcuts.exportShortcuts(str(fpath)) def __importShortcuts(self): @@ -7445,8 +7439,6 @@ ) if fn: - from eric7.Preferences import Shortcuts - Shortcuts.importShortcuts(fn) def __showCertificatesDialog(self): @@ -7498,8 +7490,6 @@ if testing: # clear the unit test histories if self.__testingWidget is None: - from eric7.Testing.TestingWidget import clearSavedHistories - clearSavedHistories() else: self.__testingWidget.clearRecent() @@ -7574,14 +7564,15 @@ """ self.wizardsMenuAct.setEnabled(len(self.__menus["wizards"].actions()) > 0) - if fn and str(fn) != "None": - from eric7 import Testing - - if Testing.isLanguageSupported( + if ( + fn + and str(fn) != "None" + and Testing.isLanguageSupported( self.viewmanager.getOpenEditor(fn).getFileType() - ): - self.testScriptAct.setEnabled(True) - self.__testingEditorOpen = True + ) + ): + self.testScriptAct.setEnabled(True) + self.__testingEditorOpen = True def __checkActions(self, editor): """ @@ -7591,13 +7582,10 @@ """ fn = editor.getFileName() if editor else None - if fn: - from eric7 import Testing - - if Testing.isLanguageSupported(editor.getFileType()): - self.testScriptAct.setEnabled(True) - self.__testingEditorOpen = True - return + if fn and Testing.isLanguageSupported(editor.getFileType()): + self.testScriptAct.setEnabled(True) + self.__testingEditorOpen = True + return self.testScriptAct.setEnabled(False) @@ -7622,8 +7610,6 @@ if os.path.exists(fn): f = QFile(fn) if f.open(QIODevice.OpenModeFlag.ReadOnly): - from eric7.EricXML.TasksReader import TasksReader - reader = TasksReader(f, viewer=self.taskViewer) reader.readXML() f.close() @@ -7692,8 +7678,6 @@ # old XML based format f = QFile(fn) if f.open(QIODevice.OpenModeFlag.ReadOnly): - from eric7.EricXML.SessionReader import SessionReader - self.__readingSession = True reader = SessionReader(f, True) reader.readXML() @@ -7806,9 +7790,9 @@ """ Public slot to show the Find File by Name dialog. """ + from .FindFileNameDialog import FindFileNameDialog + if self.findFileNameDialog is None: - from .FindFileNameDialog import FindFileNameDialog - self.findFileNameDialog = FindFileNameDialog(self.project) self.findFileNameDialog.sourceFile.connect(self.viewmanager.openSourceFile) self.findFileNameDialog.designerFile.connect(self.__designer) @@ -7828,6 +7812,8 @@ (defaults to False) @type bool (optional) """ + from .FindFileWidget import FindFileDialog + if Preferences.getUI("ShowFindFileWidget"): # embedded tool self.__activateFindFileWidget() @@ -7837,8 +7823,6 @@ else: # external dialog if self.__findFileDialog is None: - from .FindFileWidget import FindFileDialog - self.__findFileDialog = FindFileDialog(self.project, self) self.__findFileDialog.sourceFile.connect( self.viewmanager.openSourceFile @@ -7865,6 +7849,8 @@ (defaults to False) @type bool (optional) """ + from .FindFileWidget import FindFileDialog + if Preferences.getUI("ShowFindFileWidget"): # embedded tool self.__activateFindFileWidget() @@ -7874,8 +7860,6 @@ else: # external dialog if self.__replaceFileDialog is None: - from .FindFileWidget import FindFileDialog - self.__replaceFileDialog = FindFileDialog(self.project, self) self.__replaceFileDialog.sourceFile.connect( self.viewmanager.openSourceFile @@ -7908,14 +7892,14 @@ """ Public method to show the Find File widget. """ + from .FindLocationWidget import FindLocationDialog + if Preferences.getUI("ShowFindLocationWidget"): # embedded tool self.__activateFindLocationWidget() else: # external dialog if self.__findLocationDialog is None: - from .FindLocationWidget import FindLocationDialog - self.__findLocationDialog = FindLocationDialog(self.project, self) self.__findLocationDialog.sourceFile.connect( self.viewmanager.openSourceFile @@ -8528,9 +8512,9 @@ (None = use configured timeout, 0 = indefinitely) @type int """ + from .NotificationWidget import NotificationWidget + if self.__notification is None: - from .NotificationWidget import NotificationWidget - self.__notification = NotificationWidget(parent=self) if timeout is None: timeout = Preferences.getUI("NotificationTimeout")
--- a/src/eric7/Utilities/ClassBrowsers/__init__.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Utilities/ClassBrowsers/__init__.py Mon Nov 07 17:19:58 2022 +0100 @@ -69,33 +69,33 @@ path = [] if path is None else path[:] if ext in __extensions["IDL"]: - from . import idlclbr + from . import idlclbr # __IGNORE_WARNING_I101__ dictionary = idlclbr.readmodule_ex(module, path) idlclbr._modules.clear() elif ext in __extensions["ProtoBuf"]: - from . import protoclbr + from . import protoclbr # __IGNORE_WARNING_I101__ dictionary = protoclbr.readmodule_ex(module, path) protoclbr._modules.clear() elif ext in __extensions["Ruby"]: - from . import rbclbr + from . import rbclbr # __IGNORE_WARNING_I101__ dictionary = rbclbr.readmodule_ex(module, path) rbclbr._modules.clear() elif ext in __extensions["JavaScript"]: - from . import jsclbr + from . import jsclbr # __IGNORE_WARNING_I101__ dictionary = jsclbr.readmodule_ex(module, path) jsclbr._modules.clear() elif ext in Preferences.getPython("Python3Extensions") or isPyFile: - from . import pyclbr + from . import pyclbr # __IGNORE_WARNING_I101__ dictionary = pyclbr.readmodule_ex(module, path, isPyFile=isPyFile) pyclbr._modules.clear() else: # try Python if it is without extension - from . import pyclbr + from . import pyclbr # __IGNORE_WARNING_I101__ dictionary = pyclbr.readmodule_ex(module, path) pyclbr._modules.clear()
--- a/src/eric7/Utilities/ModuleParser.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Utilities/ModuleParser.py Mon Nov 07 17:19:58 2022 +0100 @@ -25,13 +25,13 @@ from eric7 import Utilities __all__ = [ - "Module", + "Attribute", "Class", "Function", - "Attribute", + "Module", "RbModule", + "getTypeFromTypeName", "readModule", - "getTypeFromTypeName", ] TABWIDTH = 4
--- a/src/eric7/Utilities/__init__.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Utilities/__init__.py Mon Nov 07 17:19:58 2022 +0100 @@ -14,6 +14,7 @@ import functools import getpass import glob +import json import os import pathlib import re @@ -21,32 +22,16 @@ import subprocess # secok import sys - -def __showwarning(message, category, filename, lineno, file=None, line=""): - """ - Module function to raise a SyntaxError for a SyntaxWarning. - - @param message warning object - @param category type object of the warning - @param filename name of the file causing the warning (string) - @param lineno line number causing the warning (integer) - @param file file to write the warning message to (ignored) - @param line line causing the warning (ignored) - @raise err exception of type SyntaxError - """ - if category is SyntaxWarning: - err = SyntaxError(str(message)) - err.filename = filename - err.lineno = lineno - raise err - +with contextlib.suppress(ImportError): + import pwd # only available on Unix systems import warnings -warnings.showwarning = __showwarning - from codecs import BOM_UTF8, BOM_UTF16, BOM_UTF32 +import chardet + +from PyQt6 import sip from PyQt6.Qsci import QSCINTILLA_VERSION_STR, QsciScintilla from PyQt6.QtCore import ( PYQT_VERSION_STR, @@ -79,11 +64,35 @@ sessionType, setConfigDir, ) + +# TODO: move 'normalizeCode' here from eric7.Plugins.CheckerPlugins.SyntaxChecker.SyntaxCheck import ( # __IGNORE_WARNING__ normalizeCode, ) from eric7.UI.Info import Program, Version + +def __showwarning(message, category, filename, lineno, file=None, line=""): + """ + Module function to raise a SyntaxError for a SyntaxWarning. + + @param message warning object + @param category type object of the warning + @param filename name of the file causing the warning (string) + @param lineno line number causing the warning (integer) + @param file file to write the warning message to (ignored) + @param line line causing the warning (ignored) + @raise err exception of type SyntaxError + """ + if category is SyntaxWarning: + err = SyntaxError(str(message)) + err.filename = filename + err.lineno = lineno + raise err + + +warnings.showwarning = __showwarning + configDir = None codingBytes_regexps = [ @@ -316,8 +325,6 @@ if Preferences.getEditor("AdvancedEncodingDetection"): # Try the universal character encoding detector try: - import chardet - guess = chardet.detect(text) if guess and guess["confidence"] > 0.95 and guess["encoding"] is not None: codec = guess["encoding"].lower() @@ -506,8 +513,6 @@ # try codec detection try: - import chardet - guess = chardet.detect(buffer) if guess and guess["encoding"] is not None: codec = guess["encoding"].lower() @@ -1641,8 +1646,6 @@ if isWindowsPlatform(): return win32_getRealName() else: - import pwd - user = getpass.getuser() return pwd.getpwnam(user).pw_gecos @@ -2035,12 +2038,8 @@ @rtype str """ try: - try: - from PyQt6 import sip - except ImportError: - import sip sip_version_str = sip.SIP_VERSION_STR - except (ImportError, AttributeError): + except AttributeError: sip_version_str = "sip version not available" sizeStr = "64-Bit" if sys.maxsize > 2**32 else "32-Bit" @@ -2051,13 +2050,13 @@ info.append(" Qt {0}".format(qVersion())) info.append(" PyQt6 {0}".format(PYQT_VERSION_STR)) try: - from PyQt6 import QtCharts + from PyQt6 import QtCharts # __IGNORE_WARNING_I10__ info.append(" PyQt6-Charts {0}".format(QtCharts.PYQT_CHART_VERSION_STR)) except (ImportError, AttributeError): info.append(" PyQt6-Charts not installed") try: - from PyQt6 import QtWebEngineCore + from PyQt6 import QtWebEngineCore # __IGNORE_WARNING_I10__ info.append( " PyQt6-WebEngine {0}".format(QtWebEngineCore.PYQT_WEBENGINE_VERSION_STR) @@ -2069,7 +2068,7 @@ with contextlib.suppress(ImportError): from PyQt6 import QtWebEngineWidgets # __IGNORE_WARNING__ - from eric7.WebBrowser.Tools import WebBrowserTools + from eric7.WebBrowser.Tools import WebBrowserTools # __IGNORE_WARNING_I101__ ( chromiumVersion, @@ -2177,8 +2176,6 @@ is returned, if the interpreter is the one used to run eric itself @rtype list of str """ - import json - sysPath = [] getSysPathSkript = os.path.join(os.path.dirname(__file__), "GetSysPath.py") @@ -2216,7 +2213,7 @@ @param pid process id (integer) @return result of the kill (boolean) """ - import win32api + import win32api # __IGNORE_WARNING_I102__ handle = win32api.OpenProcess(1, 0, pid) return 0 != win32api.TerminateProcess(handle, 0) @@ -2229,7 +2226,7 @@ @return user name (string) """ try: - import win32api + import win32api # __IGNORE_WARNING_I10__ return win32api.GetUserName() except ImportError: @@ -2246,8 +2243,6 @@ @return real name of the current user (string) """ - import ctypes - GetUserNameEx = ctypes.windll.secur32.GetUserNameExW NameDisplay = 3
--- a/src/eric7/Utilities/crypto/__init__.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Utilities/crypto/__init__.py Mon Nov 07 17:19:58 2022 +0100 @@ -60,6 +60,8 @@ """ Private module function to get the password from the user. """ + from .py3PBKDF2 import verifyPassword + global MasterPassword pw, ok = QInputDialog.getText( @@ -69,8 +71,6 @@ QLineEdit.EchoMode.Password, ) if ok: - from .py3PBKDF2 import verifyPassword - masterPassword = Preferences.getUser("MasterPassword") try: if masterPassword: @@ -113,6 +113,9 @@ @return encrypted password (string) and flag indicating success (boolean) """ + from .py3AES import encryptData + from .py3PBKDF2 import hashPasswordTuple + if masterPW is None: if MasterPassword is None: __getMasterPassword() @@ -121,12 +124,8 @@ masterPW = pwDecode(MasterPassword) - from .py3PBKDF2 import hashPasswordTuple - digestname, iterations, salt, pwHash = hashPasswordTuple(masterPW) key = pwHash[:32] - from .py3AES import encryptData - try: cipher = encryptData(key, pw.encode("utf-8")) except ValueError: @@ -154,6 +153,9 @@ @return decrypted password (string) and flag indicating success (boolean) """ + from .py3AES import decryptData + from .py3PBKDF2 import rehashPassword + if not epw.startswith(CryptoMarker): return epw, False # it was not encoded using pwEncrypt @@ -165,9 +167,6 @@ masterPW = pwDecode(MasterPassword) - from .py3AES import decryptData - from .py3PBKDF2 import rehashPassword - hashParameters, epw = epw[3:].rsplit(Delimiter, 1) try: # recreate the key used to encrypt @@ -312,12 +311,12 @@ @return decrypted data (bytes) and flag indicating success (boolean) """ + from .py3AES import decryptData + from .py3PBKDF2 import rehashPassword + if not edata.startswith(CryptoMarker.encode("utf-8")): return edata, False # it was not encoded using dataEncrypt - from .py3AES import decryptData - from .py3PBKDF2 import rehashPassword - hashParametersBytes, edata = edata[3:].rsplit(Delimiter.encode("utf-8"), 1) hashParameters = hashParametersBytes.decode() try:
--- a/src/eric7/VCS/ProjectHelper.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/VCS/ProjectHelper.py Mon Nov 07 17:19:58 2022 +0100 @@ -20,8 +20,11 @@ from eric7.EricGui.EricAction import EricAction from eric7.EricWidgets import EricMessageBox from eric7.EricWidgets.EricApplication import ericApp +from eric7.Project.PropertiesDialog import PropertiesDialog from eric7.UI import Config +from .CommandOptionsDialog import VcsCommandOptionsDialog + class VcsProjectHelper(QObject): """ @@ -260,8 +263,6 @@ else: vcores = False if vcores: - from .CommandOptionsDialog import VcsCommandOptionsDialog - codlg = VcsCommandOptionsDialog(vcs) if codlg.exec() == QDialog.DialogCode.Accepted: vcs.vcsSetOptions(codlg.getOptions()) @@ -341,8 +342,6 @@ self.project.ppath = projectdir self.project.opened = True - from eric7.Project.PropertiesDialog import PropertiesDialog - dlg = PropertiesDialog(self.project, False) if dlg.exec() == QDialog.DialogCode.Accepted: dlg.storeData() @@ -484,8 +483,6 @@ else: vcores = False if vcores: - from .CommandOptionsDialog import VcsCommandOptionsDialog - codlg = VcsCommandOptionsDialog(self.project.vcs) if codlg.exec() == QDialog.DialogCode.Accepted: self.project.vcs.vcsSetOptions(codlg.getOptions()) @@ -582,8 +579,6 @@ return if self.vcs.vcsSupportCommandOptions(): - from .CommandOptionsDialog import VcsCommandOptionsDialog - codlg = VcsCommandOptionsDialog(self.vcs) if codlg.exec() == QDialog.DialogCode.Accepted: self.vcs.vcsSetOptions(codlg.getOptions()) @@ -697,12 +692,12 @@ """ Protected slot called to show some vcs information. """ + from .RepositoryInfoDialog import VcsRepositoryInfoDialog + if self.vcs is None: # just in case return - from .RepositoryInfoDialog import VcsRepositoryInfoDialog - info = self.vcs.vcsRepositoryInfos(self.project.ppath) dlg = VcsRepositoryInfoDialog(None, info) dlg.exec()
--- a/src/eric7/VCS/__init__.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/VCS/__init__.py Mon Nov 07 17:19:58 2022 +0100 @@ -62,11 +62,11 @@ @return reference to the basic VCS project helper singleton (VcsProjectHelper) """ + from .ProjectHelper import VcsProjectHelper + global VcsBasicHelperSingleton if VcsBasicHelperSingleton is None: - from .ProjectHelper import VcsProjectHelper - VcsBasicHelperSingleton = VcsProjectHelper(None, project) return VcsBasicHelperSingleton
--- a/src/eric7/ViewManager/ViewManager.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/ViewManager/ViewManager.py Mon Nov 07 17:19:58 2022 +0100 @@ -31,7 +31,14 @@ from eric7.EricWidgets import EricFileDialog, EricMessageBox from eric7.EricWidgets.EricApplication import ericApp from eric7.Globals import isMacPlatform, recentNameFiles +from eric7.QScintilla import Exporters, Lexers +from eric7.QScintilla.APIsManager import APIsManager from eric7.QScintilla.Editor import Editor +from eric7.QScintilla.EditorAssembly import EditorAssembly +from eric7.QScintilla.Shell import Shell +from eric7.QScintilla.SpellChecker import SpellChecker +from eric7.QScintilla.SpellingDictionaryEditDialog import SpellingDictionaryEditDialog +from eric7.QScintilla.ZoomDialog import ZoomDialog from eric7.UI import Config @@ -135,8 +142,6 @@ self.autosaveTimer.timeout.connect(self.__autosave) # initialize the APIs manager - from eric7.QScintilla.APIsManager import APIsManager - self.apisManager = APIsManager(parent=self) self.__cooperationClient = None @@ -936,8 +941,6 @@ """ menu = QMenu(QCoreApplication.translate("ViewManager", "Export as")) - from eric7.QScintilla import Exporters - supportedExporters = Exporters.getSupportedFormats() exporters = sorted(supportedExporters.keys()) for exporter in exporters: @@ -5838,8 +5841,6 @@ elif language == "": pixmap = EricPixmapCache.getPixmap("fileText") else: - from eric7.QScintilla import Lexers - pixmap = Lexers.getLanguageIcon(language, True) self.sbLang.setPixmap(pixmap) if pixmap.isNull(): @@ -5951,8 +5952,6 @@ if Utilities.samepath(fn, editor.getFileName()): break else: - from eric7.QScintilla.EditorAssembly import EditorAssembly - assembly = EditorAssembly( self.dbs, fn, @@ -6384,8 +6383,6 @@ if now is None: return - from eric7.QScintilla.Shell import Shell - if not isinstance(now, (Editor, Shell)): self.editActGrp.setEnabled(False) self.copyActGrp.setEnabled(False) @@ -6789,8 +6786,6 @@ else self.activeWindow() ) if aw: - from eric7.QScintilla.ZoomDialog import ZoomDialog - dlg = ZoomDialog(aw.getZoom(), self.ui, None, True) if dlg.exec() == QDialog.DialogCode.Accepted: value = dlg.getZoomSize() @@ -7215,8 +7210,6 @@ pel = ericApp().getObject("Project").getProjectDictionaries()[1] self.__editProjectPelAct.setEnabled(projetOpen and bool(pel)) - from eric7.QScintilla.SpellChecker import SpellChecker - pwl = SpellChecker.getUserDictionaryPath() self.__editUserPwlAct.setEnabled(bool(pwl)) pel = SpellChecker.getUserDictionaryPath(True) @@ -7300,9 +7293,6 @@ if len(dictionaryFile) < 40 else "...{0}".format(dictionaryFile[-40:]) ) - from eric7.QScintilla.SpellingDictionaryEditDialog import ( - SpellingDictionaryEditDialog, - ) dlg = SpellingDictionaryEditDialog( data, @@ -7871,8 +7861,6 @@ if self.activeWindow() is not None and self.activeWindow().getFileName(): ext = os.path.splitext(self.activeWindow().getFileName())[1] rx = re.compile(r".*\*\.{0}[ )].*".format(ext[1:])) - from eric7.QScintilla import Lexers - filters = Lexers.getOpenFileFiltersList() index = -1 for i in range(len(filters)):
--- a/src/eric7/VirtualEnv/VirtualenvManager.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/VirtualEnv/VirtualenvManager.py Mon Nov 07 17:19:58 2022 +0100 @@ -19,6 +19,7 @@ from eric7 import Globals, Preferences from eric7.EricWidgets import EricMessageBox from eric7.EricWidgets.EricApplication import ericApp +from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog class VirtualenvManager(QObject): @@ -196,6 +197,7 @@ @type str """ from .VirtualenvConfigurationDialog import VirtualenvConfigurationDialog + from .VirtualenvExecDialog import VirtualenvExecDialog if not baseDir: baseDir = self.__virtualEnvironmentsBaseDir @@ -219,8 +221,6 @@ ) else: # now do the call - from .VirtualenvExecDialog import VirtualenvExecDialog - dia = VirtualenvExecDialog(resultDict, self) dia.show() dia.start(resultDict["arguments"]) @@ -237,6 +237,7 @@ from .VirtualenvUpgradeConfigurationDialog import ( VirtualenvUpgradeConfigurationDialog, ) + from .VirtualenvUpgradeExecDialog import VirtualenvUpgradeExecDialog venvDirectory = self.getVirtualenvDirectory(venvName) if not os.path.exists(os.path.join(venvDirectory, "pyvenv.cfg")): @@ -247,8 +248,6 @@ if dlg.exec() == QDialog.DialogCode.Accepted: pythonExe, args, createLog = dlg.getData() - from .VirtualenvUpgradeExecDialog import VirtualenvUpgradeExecDialog - dia = VirtualenvUpgradeExecDialog(venvName, pythonExe, createLog, self) dia.show() dia.start(args) @@ -286,6 +285,11 @@ @param description descriptive text for the environment @type str """ + from .VirtualenvInterpreterSelectionDialog import ( + VirtualenvInterpreterSelectionDialog, + ) + from .VirtualenvNameDialog import VirtualenvNameDialog + if venvName in self.__virtualEnvironments: ok = EricMessageBox.yesNo( None, @@ -297,8 +301,6 @@ icon=EricMessageBox.Warning, ) if not ok: - from .VirtualenvNameDialog import VirtualenvNameDialog - dlg = VirtualenvNameDialog( list(self.__virtualEnvironments.keys()), venvName ) @@ -308,10 +310,6 @@ venvName = dlg.getName() if not venvInterpreter: - from .VirtualenvInterpreterSelectionDialog import ( - VirtualenvInterpreterSelectionDialog, - ) - dlg = VirtualenvInterpreterSelectionDialog(venvName, venvDirectory) if dlg.exec() == QDialog.DialogCode.Accepted: venvInterpreter = dlg.getData() @@ -471,10 +469,6 @@ ) ) if venvMessages: - from eric7.UI.DeleteFilesConfirmationDialog import ( - DeleteFilesConfirmationDialog, - ) - dlg = DeleteFilesConfirmationDialog( None, self.tr("Delete Virtual Environments"), @@ -540,10 +534,6 @@ ) ) if venvMessages: - from eric7.UI.DeleteFilesConfirmationDialog import ( - DeleteFilesConfirmationDialog, - ) - dlg = DeleteFilesConfirmationDialog( None, self.tr("Remove Virtual Environments"), @@ -582,9 +572,9 @@ @param modal flag indicating that the dialog should be shown in a blocking mode """ + from .VirtualenvManagerWidgets import VirtualenvManagerDialog + if modal: - from .VirtualenvManagerWidgets import VirtualenvManagerDialog - virtualenvManagerDialog = VirtualenvManagerDialog(self, self.__ui) virtualenvManagerDialog.exec() self.virtualEnvironmentsListChanged.emit()
--- a/src/eric7/VirtualEnv/VirtualenvManagerWidgets.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/VirtualEnv/VirtualenvManagerWidgets.py Mon Nov 07 17:19:58 2022 +0100 @@ -188,11 +188,11 @@ """ Private slot to edit the selected entry. """ + from .VirtualenvAddEditDialog import VirtualenvAddEditDialog + selectedItem = self.venvList.selectedItems()[0] oldVenvName = selectedItem.text(0) - from .VirtualenvAddEditDialog import VirtualenvAddEditDialog - dlg = VirtualenvAddEditDialog( self.__manager, selectedItem.text(0), @@ -464,9 +464,9 @@ @param parent reference to the parent widget (QWidget) """ - super().__init__(parent) + from eric7.VirtualEnv.VirtualenvManager import VirtualenvManager - from eric7.VirtualEnv.VirtualenvManager import VirtualenvManager + super().__init__(parent) self.__virtualenvManager = VirtualenvManager(self)
--- a/src/eric7/WebBrowser/AdBlock/AdBlockDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/AdBlock/AdBlockDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -13,6 +13,7 @@ from eric7 import Preferences from eric7.EricGui import EricPixmapCache from eric7.EricWidgets import EricMessageBox +from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow from .Ui_AdBlockDialog import Ui_AdBlockDialog @@ -75,11 +76,11 @@ """ Private slot to populate the tab widget with subscriptions. """ + from .AdBlockTreeWidget import AdBlockTreeWidget + if self.__loaded or not self.adBlockGroup.isChecked(): return - from .AdBlockTreeWidget import AdBlockTreeWidget - for subscription in self.__manager.subscriptions(): tree = AdBlockTreeWidget(subscription, self.subscriptionsTabWidget) icon = ( @@ -204,8 +205,6 @@ """ Private slot to browse the list of available AdBlock subscriptions. """ - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow - mw = WebBrowserWindow.mainWindow() mw.newTab("http://adblockplus.org/en/subscriptions") mw.raise_() @@ -214,8 +213,6 @@ """ Private slot to show the web page about how to write filters. """ - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow - mw = WebBrowserWindow.mainWindow() mw.newTab("http://adblockplus.org/en/filters") mw.raise_() @@ -307,8 +304,6 @@ if value != Preferences.getWebBrowser("AdBlockUpdatePeriod"): Preferences.setWebBrowser("AdBlockUpdatePeriod", value) - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow - manager = WebBrowserWindow.adBlockManager() for subscription in manager.subscriptions(): subscription.checkForUpdate()
--- a/src/eric7/WebBrowser/AdBlock/AdBlockExceptionsDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/AdBlock/AdBlockExceptionsDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -11,6 +11,7 @@ from PyQt6.QtWidgets import QDialog from eric7.EricGui import EricPixmapCache +from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow from .Ui_AdBlockExceptionsDialog import Ui_AdBlockExceptionsDialog @@ -88,8 +89,6 @@ for row in range(self.hostList.count()): hosts.append(self.hostList.item(row).text()) - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow - WebBrowserWindow.adBlockManager().setExceptions(hosts) super().accept()
--- a/src/eric7/WebBrowser/AdBlock/AdBlockManager.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/AdBlock/AdBlockManager.py Mon Nov 07 17:19:58 2022 +0100 @@ -17,6 +17,7 @@ from eric7.EricUtilities.EricMutexLocker import EricMutexLocker from eric7.EricWidgets import EricMessageBox from eric7.Utilities.AutoSaver import AutoSaver +from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow from .AdBlockMatcher import AdBlockMatcher from .AdBlockSubscription import AdBlockSubscription @@ -81,16 +82,12 @@ self.__interceptor = AdBlockUrlInterceptor(self) - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow - WebBrowserWindow.networkManager().installUrlInterceptor(self.__interceptor) def __rulesChanged(self): """ Private slot handling a change of the AdBlock rules. """ - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow - WebBrowserWindow.mainWindow().reloadUserStyleSheet() self.__updateMatcher() @@ -125,8 +122,6 @@ if self.isEnabled() == enabled: return - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow - self.__enabled = enabled for mainWindow in WebBrowserWindow.mainWindows(): mainWindow.adBlockIcon().setEnabled(enabled) @@ -198,9 +193,9 @@ @return reference to the page block object @rtype AdBlockPage """ + from .AdBlockPage import AdBlockPage + if self.__adBlockPage is None: - from .AdBlockPage import AdBlockPage - self.__adBlockPage = AdBlockPage(self) return self.__adBlockPage @@ -328,6 +323,8 @@ @return flag indicating success @rtype bool """ + from .AdBlockSubscription import AdBlockSubscription + if url.path() != "subscribe": return False @@ -345,10 +342,6 @@ ).format(title), ) if res: - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow - - from .AdBlockSubscription import AdBlockSubscription - dlg = WebBrowserWindow.adBlockManager().showDialog() subscription = AdBlockSubscription( url, False, WebBrowserWindow.adBlockManager() @@ -497,17 +490,19 @@ return subscriptions - def showDialog(self): + def showDialog(self, parent=None): """ Public slot to show the AdBlock subscription management dialog. + @param parent reference to the parent widget + @type QWidget @return reference to the dialog @rtype AdBlockDialog """ + from .AdBlockDialog import AdBlockDialog + if self.__adBlockDialog is None: - from .AdBlockDialog import AdBlockDialog - - self.__adBlockDialog = AdBlockDialog(self) + self.__adBlockDialog = AdBlockDialog(self, parent=parent) self.__adBlockDialog.show() return self.__adBlockDialog @@ -611,9 +606,9 @@ @return reference to the exceptions dialog @rtype AdBlockExceptionsDialog """ + from .AdBlockExceptionsDialog import AdBlockExceptionsDialog + if self.__adBlockExceptionsDialog is None: - from .AdBlockExceptionsDialog import AdBlockExceptionsDialog - self.__adBlockExceptionsDialog = AdBlockExceptionsDialog() self.__adBlockExceptionsDialog.load(self.__exceptedHosts) @@ -661,8 +656,6 @@ """ Private slot to update the adblock matcher. """ - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow - WebBrowserWindow.networkManager().removeUrlInterceptor(self.__interceptor) if self.__enabled:
--- a/src/eric7/WebBrowser/AdBlock/AdBlockPage.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/AdBlock/AdBlockPage.py Mon Nov 07 17:19:58 2022 +0100 @@ -9,6 +9,8 @@ from PyQt6.QtCore import QObject +from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow + from ..Tools import Scripts from ..WebBrowserPage import WebBrowserPage @@ -27,8 +29,6 @@ if page is None: return - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow - manager = WebBrowserWindow.adBlockManager() if not manager.isEnabled(): return
--- a/src/eric7/WebBrowser/AdBlock/AdBlockSubscription.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/AdBlock/AdBlockSubscription.py Mon Nov 07 17:19:58 2022 +0100 @@ -28,6 +28,7 @@ from eric7 import Preferences, Utilities from eric7.EricWidgets import EricMessageBox +from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow class AdBlockSubscription(QObject): @@ -137,8 +138,6 @@ QByteArray(urlQuery.queryItemValue("requiresTitle").encode()) ) if self.__requiresLocation and self.__requiresTitle: - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow - WebBrowserWindow.adBlockManager().loadRequiredSubscription( self.__requiresLocation, self.__requiresTitle ) @@ -292,6 +291,8 @@ """ Private method to load the rules of the subscription. """ + from .AdBlockRule import AdBlockRule + fileName = self.rulesFileName() if os.path.exists(fileName): try: @@ -310,8 +311,6 @@ os.unlink(fileName) self.__lastUpdate = QDateTime() else: - from .AdBlockRule import AdBlockRule - self.__updatePeriod = 0 self.__remoteModified = QDateTime() self.__rules = [] @@ -405,8 +404,6 @@ self.__loadRules() return - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow - reply = WebBrowserWindow.networkManager().get(QNetworkRequest(self.location())) reply.finished.connect(lambda: self.__rulesDownloaded(reply)) self.__downloading = reply @@ -449,8 +446,6 @@ fileName = self.rulesFileName() try: with open(fileName, "wb") as f: - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow - if ( WebBrowserWindow.adBlockManager().useLimitedEasyList() and self.url() @@ -672,8 +667,6 @@ self.rulesEnabledChanged.emit() if rule.isCSSRule(): - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow - WebBrowserWindow.mainWindow().reloadUserStyleSheet() return rule
--- a/src/eric7/WebBrowser/AdBlock/AdBlockTreeWidget.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/AdBlock/AdBlockTreeWidget.py Mon Nov 07 17:19:58 2022 +0100 @@ -120,6 +120,8 @@ @param filterRule filter to be added @type str """ + from .AdBlockRule import AdBlockRule + if not self.__subscription.canEditRules(): return @@ -133,8 +135,6 @@ if not ok or filterRule == "": return - from .AdBlockRule import AdBlockRule - rule = AdBlockRule(filterRule, self.__subscription) self.__subscription.addRule(rule) @@ -184,6 +184,8 @@ @param itm changed item @type QTreeWidgetItem """ + from .AdBlockRule import AdBlockRule + if itm is None or self.__itemChangingBlock: return @@ -201,8 +203,6 @@ rule = self.__subscription.setRuleEnabled(offset, True) self.__adjustItemFeatures(itm, rule) elif self.__subscription.canEditRules(): - from .AdBlockRule import AdBlockRule - # Custom rule has been changed rule = self.__subscription.replaceRule( AdBlockRule(itm.text(0), self.__subscription), offset
--- a/src/eric7/WebBrowser/Bookmarks/AddBookmarkDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/Bookmarks/AddBookmarkDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -10,6 +10,8 @@ from PyQt6.QtCore import QModelIndex, QSortFilterProxyModel from PyQt6.QtWidgets import QDialog, QTreeView +from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow + from .Ui_AddBookmarkDialog import Ui_AddBookmarkDialog @@ -90,8 +92,6 @@ self.__addFolder = False if self.__bookmarksManager is None: - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow - self.__bookmarksManager = WebBrowserWindow.bookmarksManager() self.__proxyModel = AddBookmarkProxyModel(self) @@ -221,14 +221,14 @@ """ Public slot handling the acceptance of the dialog. """ + from .BookmarkNode import BookmarkNode + if ( not self.__addFolder and not self.addressEdit.text() ) or not self.nameEdit.text(): super().accept() return - from .BookmarkNode import BookmarkNode - idx = self.currentIndex() if not idx.isValid(): idx = self.__bookmarksManager.bookmarksModel().index(0, 0)
--- a/src/eric7/WebBrowser/Bookmarks/BookmarkPropertiesDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/Bookmarks/BookmarkPropertiesDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -9,6 +9,9 @@ from PyQt6.QtWidgets import QDialog +from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow + +from .BookmarkNode import BookmarkNode from .Ui_BookmarkPropertiesDialog import Ui_BookmarkPropertiesDialog @@ -27,8 +30,6 @@ super().__init__(parent) self.setupUi(self) - from .BookmarkNode import BookmarkNode - self.__node = node if self.__node.type() == BookmarkNode.Folder: self.addressLabel.hide() @@ -56,8 +57,6 @@ super().accept() return - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow - bookmarksManager = WebBrowserWindow.bookmarksManager() title = self.nameEdit.text() if title != self.__node.title:
--- a/src/eric7/WebBrowser/Bookmarks/BookmarksDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/Bookmarks/BookmarksDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -12,6 +12,7 @@ from PyQt6.QtWidgets import QApplication, QDialog, QInputDialog, QLineEdit, QMenu from eric7.EricCore.EricTreeSortFilterProxyModel import EricTreeSortFilterProxyModel +from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow from .Ui_BookmarksDialog import Ui_BookmarksDialog @@ -46,8 +47,6 @@ self.__bookmarksManager = manager if self.__bookmarksManager is None: - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow - self.__bookmarksManager = WebBrowserWindow.bookmarksManager() self.__bookmarksModel = self.__bookmarksManager.bookmarksModel() @@ -60,10 +59,7 @@ self.bookmarksTree.setModel(self.__proxyModel) self.bookmarksTree.setExpanded(self.__proxyModel.index(0, 0), True) fm = QFontMetrics(self.font()) - try: - header = fm.horizontalAdvance("m") * 40 - except AttributeError: - header = fm.width("m") * 40 + header = fm.horizontalAdvance("m") * 40 self.bookmarksTree.header().resizeSection(0, header) self.bookmarksTree.header().setStretchLastSection(True) self.bookmarksTree.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu) @@ -258,8 +254,6 @@ return if newWindow: - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow - url = idx.sibling(idx.row(), 1).data(BookmarksModel.UrlRole) if privateWindow: WebBrowserWindow.mainWindow().newPrivateWindow(url)
--- a/src/eric7/WebBrowser/Bookmarks/BookmarksImporters/ChromeImporter.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/Bookmarks/BookmarksImporters/ChromeImporter.py Mon Nov 07 17:19:58 2022 +0100 @@ -127,6 +127,8 @@ @return imported bookmarks (BookmarkNode) """ + from ..BookmarkNode import BookmarkNode + try: with open(self.__fileName, "r", encoding="utf-8") as f: contents = json.load(f) @@ -137,8 +139,6 @@ ).format(self.__fileName, str(err)) return None - from ..BookmarkNode import BookmarkNode - importRootNode = BookmarkNode(BookmarkNode.Folder) if contents["version"] == 1: self.__processRoots(contents["roots"], importRootNode)
--- a/src/eric7/WebBrowser/Bookmarks/BookmarksImporters/OperaImporter.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/Bookmarks/BookmarksImporters/OperaImporter.py Mon Nov 07 17:19:58 2022 +0100 @@ -97,6 +97,8 @@ @return imported bookmarks (BookmarkNode) """ + from ..BookmarkNode import BookmarkNode + try: with open(self.__fileName, "r", encoding="utf-8") as f: contents = f.read() @@ -109,8 +111,6 @@ folderStack = [] - from ..BookmarkNode import BookmarkNode - importRootNode = BookmarkNode(BookmarkNode.Folder) folderStack.append(importRootNode)
--- a/src/eric7/WebBrowser/Bookmarks/BookmarksImporters/SafariImporter.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/Bookmarks/BookmarksImporters/SafariImporter.py Mon Nov 07 17:19:58 2022 +0100 @@ -99,6 +99,8 @@ @return imported bookmarks (BookmarkNode) """ + from ..BookmarkNode import BookmarkNode + try: with open(self.__fileName, "rb") as f: bookmarksDict = plistlib.load(f) @@ -109,8 +111,6 @@ ) return None - from ..BookmarkNode import BookmarkNode - importRootNode = BookmarkNode(BookmarkNode.Folder) if ( bookmarksDict["WebBookmarkFileVersion"] == 1
--- a/src/eric7/WebBrowser/Bookmarks/BookmarksImporters/XbelImporter.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/Bookmarks/BookmarksImporters/XbelImporter.py Mon Nov 07 17:19:58 2022 +0100 @@ -13,6 +13,7 @@ from eric7.EricGui import EricPixmapCache +from ..BookmarksManager import BookmarksManager from .BookmarksImporter import BookmarksImporter @@ -31,8 +32,6 @@ raise ValueError("Unsupported browser ID given ({0}).".format(sourceId)) if sourceId == "e5browser": - from ..BookmarksManager import BookmarksManager - bookmarksFile = BookmarksManager.getFileName() return ( EricPixmapCache.getPixmap("ericWeb48"), @@ -136,6 +135,7 @@ @return imported bookmarks (BookmarkNode) """ + from ..BookmarkNode import BookmarkNode from ..XbelReader import XbelReader reader = XbelReader() @@ -149,8 +149,6 @@ ).format(reader.lineNumber(), reader.columnNumber(), reader.errorString()) return None - from ..BookmarkNode import BookmarkNode - importRootNode.setType(BookmarkNode.Folder) if self._id == "e5browser": importRootNode.title = self.tr("eric Web Browser Import")
--- a/src/eric7/WebBrowser/Bookmarks/BookmarksImporters/__init__.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/Bookmarks/BookmarksImporters/__init__.py Mon Nov 07 17:19:58 2022 +0100 @@ -66,31 +66,31 @@ @exception ValueError raised to indicate an unsupported importer """ if sourceId in ["e5browser", "xbel", "konqueror"]: - from . import XbelImporter + from . import XbelImporter # __IGNORE_WARNING_I101__ return XbelImporter.getImporterInfo(sourceId) elif sourceId == "html": - from . import HtmlImporter + from . import HtmlImporter # __IGNORE_WARNING_I101__ return HtmlImporter.getImporterInfo(sourceId) elif sourceId in ["chrome", "chromium"]: - from . import ChromeImporter + from . import ChromeImporter # __IGNORE_WARNING_I101__ return ChromeImporter.getImporterInfo(sourceId) elif sourceId == "opera": - from . import OperaImporter + from . import OperaImporter # __IGNORE_WARNING_I101__ return OperaImporter.getImporterInfo(sourceId) elif sourceId == "firefox": - from . import FirefoxImporter + from . import FirefoxImporter # __IGNORE_WARNING_I101__ return FirefoxImporter.getImporterInfo(sourceId) elif sourceId == "ie": - from . import IExplorerImporter + from . import IExplorerImporter # __IGNORE_WARNING_I101__ return IExplorerImporter.getImporterInfo(sourceId) elif sourceId == "safari": - from . import SafariImporter + from . import SafariImporter # __IGNORE_WARNING_I101__ return SafariImporter.getImporterInfo(sourceId) else: @@ -107,31 +107,31 @@ @exception ValueError raised to indicate an unsupported importer """ if sourceId in ["e5browser", "xbel", "konqueror"]: - from . import XbelImporter + from . import XbelImporter # __IGNORE_WARNING_I101__ return XbelImporter.XbelImporter(sourceId, parent) elif sourceId == "html": - from . import HtmlImporter + from . import HtmlImporter # __IGNORE_WARNING_I101__ return HtmlImporter.HtmlImporter(sourceId, parent) elif sourceId in ["chrome", "chromium"]: - from . import ChromeImporter + from . import ChromeImporter # __IGNORE_WARNING_I101__ return ChromeImporter.ChromeImporter(sourceId, parent) elif sourceId == "opera": - from . import OperaImporter + from . import OperaImporter # __IGNORE_WARNING_I101__ return OperaImporter.OperaImporter(sourceId, parent) elif sourceId == "firefox": - from . import FirefoxImporter + from . import FirefoxImporter # __IGNORE_WARNING_I101__ return FirefoxImporter.FirefoxImporter(sourceId, parent) elif sourceId == "ie": - from . import IExplorerImporter + from . import IExplorerImporter # __IGNORE_WARNING_I101__ return IExplorerImporter.IExplorerImporter(sourceId, parent) elif sourceId == "safari": - from . import SafariImporter + from . import SafariImporter # __IGNORE_WARNING_I101__ return SafariImporter.SafariImporter(sourceId, parent) else:
--- a/src/eric7/WebBrowser/Bookmarks/BookmarksManager.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/Bookmarks/BookmarksManager.py Mon Nov 07 17:19:58 2022 +0100 @@ -129,6 +129,8 @@ @exception RuntimeError raised to indicate an error loading the bookmarks """ + from .XbelReader import XbelReader + if self.__loaded: return @@ -141,8 +143,6 @@ ) bookmarkFile.open(QIODevice.OpenModeFlag.ReadOnly) - from .XbelReader import XbelReader - reader = XbelReader() self.__bookmarkRootNode = reader.read(bookmarkFile) if reader.error() != QXmlStreamReader.Error.NoError: @@ -199,11 +199,11 @@ """ Public method to save the bookmarks. """ + from .XbelWriter import XbelWriter + if not self.__loaded: return - from .XbelWriter import XbelWriter - writer = XbelWriter() bookmarkFile = self.getFileName() @@ -374,9 +374,9 @@ @return reference to the bookmarks model (BookmarksModel) """ + from .BookmarksModel import BookmarksModel + if self.__bookmarksModel is None: - from .BookmarksModel import BookmarksModel - self.__bookmarksModel = BookmarksModel(self, self) return self.__bookmarksModel @@ -416,11 +416,11 @@ fpath = fpath.with_suffix(ex) if fpath.suffix == ".html": - from .NsHtmlWriter import NsHtmlWriter + from .NsHtmlWriter import NsHtmlWriter # __IGNORE_WARNING_I101__ writer = NsHtmlWriter() else: - from .XbelWriter import XbelWriter + from .XbelWriter import XbelWriter # __IGNORE_WARNING_I101__ writer = XbelWriter() if not writer.write(str(fpath), self.__bookmarkRootNode):
--- a/src/eric7/WebBrowser/Bookmarks/BookmarksMenu.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/Bookmarks/BookmarksMenu.py Mon Nov 07 17:19:58 2022 +0100 @@ -12,6 +12,7 @@ from PyQt6.QtWidgets import QMenu from eric7.EricWidgets.EricModelMenu import EricModelMenu +from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow from .BookmarkNode import BookmarkNode from .BookmarksModel import BookmarksModel @@ -235,8 +236,6 @@ idx = self.index(act) url = idx.data(BookmarksModel.UrlRole) - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow - WebBrowserWindow.mainWindow().newWindow(url) self.__updateVisitCount(idx) @@ -250,8 +249,6 @@ idx = self.index(act) url = idx.data(BookmarksModel.UrlRole) - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow - WebBrowserWindow.mainWindow().newPrivateWindow(url) self.__updateVisitCount(idx)
--- a/src/eric7/WebBrowser/Bookmarks/BookmarksModel.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/Bookmarks/BookmarksModel.py Mon Nov 07 17:19:58 2022 +0100 @@ -22,6 +22,7 @@ ) from eric7.EricGui import EricPixmapCache +from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow class BookmarksModel(QAbstractItemModel): @@ -175,11 +176,11 @@ @param role data role (integer) @return bookmark data """ + from .BookmarkNode import BookmarkNode + if not index.isValid() or index.model() != self: return None - from .BookmarkNode import BookmarkNode - bookmarkNode = self.node(index) if role in [Qt.ItemDataRole.EditRole, Qt.ItemDataRole.DisplayRole]: if bookmarkNode.type() == BookmarkNode.Separator: @@ -212,8 +213,6 @@ if bookmarkNode.type() == BookmarkNode.Folder: return EricPixmapCache.getIcon("dirOpen") - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow - return WebBrowserWindow.icon(QUrl(bookmarkNode.url)) return None @@ -306,14 +305,14 @@ @param parent index of the parent node (QModelIndex) @return flag indicating the presence of children (boolean) """ + from .BookmarkNode import BookmarkNode + if parent is None: parent = QModelIndex() if not parent.isValid(): return True - from .BookmarkNode import BookmarkNode - parentNode = self.node(parent) return parentNode.type() == BookmarkNode.Folder @@ -324,6 +323,8 @@ @param index index of the node cell (QModelIndex) @return flags (Qt.ItemFlags) """ + from .BookmarkNode import BookmarkNode + if not index.isValid(): return Qt.ItemFlag.NoItemFlags @@ -339,8 +340,6 @@ flags |= Qt.ItemFlag.ItemIsDragEnabled - from .BookmarkNode import BookmarkNode - if (index.column() == 0 and type_ != BookmarkNode.Separator) or ( index.column() == 1 and type_ == BookmarkNode.Bookmark ): @@ -406,6 +405,9 @@ @param parent index of the parent node (QModelIndex) @return flag indicating successful acceptance of the data (boolean) """ + from .BookmarkNode import BookmarkNode + from .XbelReader import XbelReader + if action == Qt.DropAction.IgnoreAction: return True @@ -418,8 +420,6 @@ if not data.hasUrls(): return False - from .BookmarkNode import BookmarkNode - node = BookmarkNode(BookmarkNode.Bookmark, parentNode) node.url = bytes(data.urls()[0].toEncoded()).decode() @@ -439,8 +439,6 @@ undoStack = self.__bookmarksManager.undoRedoStack() undoStack.beginMacro("Move Bookmarks") - from .XbelReader import XbelReader - while not stream.atEnd(): encodedData = QByteArray() stream >> encodedData
--- a/src/eric7/WebBrowser/Bookmarks/BookmarksToolBar.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/Bookmarks/BookmarksToolBar.py Mon Nov 07 17:19:58 2022 +0100 @@ -13,6 +13,7 @@ from PyQt6.QtWidgets import QMenu from eric7.EricWidgets.EricModelToolBar import EricModelToolBar +from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow from .BookmarksModel import BookmarksModel @@ -209,8 +210,6 @@ idx = self.index(act) url = idx.data(BookmarksModel.UrlRole) - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow - WebBrowserWindow.mainWindow().newPrivateWindow(url) self.__updateVisitCount(idx)
--- a/src/eric7/WebBrowser/CookieJar/CookieExceptionsModel.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/CookieJar/CookieExceptionsModel.py Mon Nov 07 17:19:58 2022 +0100 @@ -47,14 +47,9 @@ if role == Qt.ItemDataRole.SizeHintRole: fm = QFontMetrics(QFont()) height = fm.height() + fm.height() // 3 - try: - width = fm.horizontalAdvance( - self.headerData(section, orientation, Qt.ItemDataRole.DisplayRole) - ) - except AttributeError: - width = fm.width( - self.headerData(section, orientation, Qt.ItemDataRole.DisplayRole) - ) + width = fm.horizontalAdvance( + self.headerData(section, orientation, Qt.ItemDataRole.DisplayRole) + ) return QSize(width, height) if ( @@ -194,11 +189,11 @@ @param rule type of rule to add (CookieJar.Allow, CookieJar.Block or CookieJar.AllowForSession) """ + from .CookieJar import CookieJar + if not host: return - from .CookieJar import CookieJar - if rule == CookieJar.Allow: self.__addHost( host,
--- a/src/eric7/WebBrowser/CookieJar/CookiesDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/CookieJar/CookiesDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -99,12 +99,12 @@ """ Private slot to add a new exception. """ + from .CookiesExceptionsDialog import CookiesExceptionsDialog + current = self.cookiesTree.currentItem() if current is None: return - from .CookiesExceptionsDialog import CookiesExceptionsDialog - domain = current.text(0) dlg = CookiesExceptionsDialog(self.__cookieJar, self) dlg.setDomainName(domain)
--- a/src/eric7/WebBrowser/CookieJar/CookiesExceptionsDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/CookieJar/CookiesExceptionsDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -55,21 +55,10 @@ for section in range(self.__exceptionsModel.columnCount()): header = self.exceptionsTable.horizontalHeader().sectionSizeHint(section) if section == 0: - try: - header = fm.horizontalAdvance( - "averagebiglonghost.averagedomain.info" - ) - except AttributeError: - header = fm.width("averagebiglonghost.averagedomain.info") + header = fm.horizontalAdvance("averagebiglonghost.averagedomain.info") elif section == 1: - try: - header = fm.horizontalAdvance(self.tr("Allow For Session")) - except AttributeError: - header = fm.width(self.tr("Allow For Session")) - try: - buffer = fm.horizontalAdvance("mm") - except AttributeError: - buffer = fm.width("mm") + header = fm.horizontalAdvance(self.tr("Allow For Session")) + buffer = fm.horizontalAdvance("mm") header += buffer self.exceptionsTable.horizontalHeader().resizeSection(section, header)
--- a/src/eric7/WebBrowser/Download/DownloadItem.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/Download/DownloadItem.py Mon Nov 07 17:19:58 2022 +0100 @@ -149,6 +149,8 @@ """ Private method to get the file name to save to from the user. """ + from .DownloadAskActionDialog import DownloadAskActionDialog + if self.__gettingFileName: return @@ -174,8 +176,6 @@ self.__autoOpen = False if not savePage: - from .DownloadAskActionDialog import DownloadAskActionDialog - url = self.__downloadRequest.url() mimetype = MimeTypes.mimeType(originalFileName) dlg = DownloadAskActionDialog(
--- a/src/eric7/WebBrowser/Download/DownloadManager.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/Download/DownloadManager.py Mon Nov 07 17:19:58 2022 +0100 @@ -237,6 +237,12 @@ download data. @type QWebEngineDownloadRequest """ + from eric7.WebBrowser.SafeBrowsing.SafeBrowsingManager import ( + SafeBrowsingManager, + ) + + from .DownloadItem import DownloadItem + url = downloadRequest.url() if url.isEmpty(): return @@ -244,10 +250,6 @@ self.__closeDownloadTab(url) # Safe Browsing - from eric7.WebBrowser.SafeBrowsing.SafeBrowsingManager import ( - SafeBrowsingManager, - ) - if SafeBrowsingManager.isEnabled(): threatLists = WebBrowserWindow.safeBrowsingManager().lookupUrl(url)[0] if threatLists: @@ -272,8 +274,6 @@ window = WebBrowserWindow.getWindow() pageUrl = window.currentBrowser().url() if window else QUrl() - from .DownloadItem import DownloadItem - itm = DownloadItem( downloadRequest=downloadRequest, pageUrl=pageUrl, parent=self ) @@ -408,8 +408,6 @@ if self.removePolicy() == DownloadManager.RemoveExit: return - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow - if WebBrowserWindow.isPrivate(): return @@ -422,6 +420,8 @@ """ Private method to load the download settings. """ + from .DownloadItem import DownloadItem + if self.__loaded: return @@ -431,14 +431,10 @@ pos = Preferences.getWebBrowser("DownloadManagerPosition") self.move(pos) - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow - if not WebBrowserWindow.isPrivate(): downloads = Preferences.getWebBrowser("DownloadManagerDownloads") for download in downloads: if not download["URL"].isEmpty() and bool(download["Location"]): - from .DownloadItem import DownloadItem - itm = DownloadItem(parent=self) itm.setData(download) self.__addItem(itm, append=True) @@ -564,7 +560,7 @@ @rtype QWinTaskbarButton or None """ if Globals.isWindowsPlatform(): - from PyQt6.QtWinExtras import QWinTaskbarButton + from PyQt6.QtWinExtras import QWinTaskbarButton # __IGNORE_WARNING_I10__ if self.__winTaskbarButton is None: window = WebBrowserWindow.mainWindow()
--- a/src/eric7/WebBrowser/FeaturePermissions/FeaturePermissionManager.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/FeaturePermissions/FeaturePermissionManager.py Mon Nov 07 17:19:58 2022 +0100 @@ -12,6 +12,7 @@ from PyQt6.QtWidgets import QDialog from eric7 import Globals, Preferences +from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow class FeaturePermissionManager(QObject): @@ -145,6 +146,8 @@ @param feature requested feature @type QWebEnginePage.Feature """ + from .FeaturePermissionBar import FeaturePermissionBar + if origin is None or origin.isEmpty(): return @@ -159,8 +162,6 @@ page.setFeaturePermission(origin, feature, permission) return - from .FeaturePermissionBar import FeaturePermissionBar - bar = FeaturePermissionBar(page, origin, feature, self) bar.show() @@ -206,8 +207,6 @@ if not self.__loaded: return - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow - if WebBrowserWindow.isPrivate(): return @@ -217,17 +216,20 @@ self.__featurePermissions[feature][permission], ) - def showFeaturePermissionsDialog(self): + def showFeaturePermissionsDialog(self, parent=None): """ Public method to show a dialog to manage the remembered feature permissions. + + @param parent reference to the parent widget + @type QWidget """ + from .FeaturePermissionsDialog import FeaturePermissionsDialog + if not self.__loaded: self.__loadSettings() - from .FeaturePermissionsDialog import FeaturePermissionsDialog - - dlg = FeaturePermissionsDialog(self.__featurePermissions) + dlg = FeaturePermissionsDialog(self.__featurePermissions, parent=parent) if dlg.exec() == QDialog.DialogCode.Accepted: newFeaturePermissions = dlg.getData() self.__featurePermissions = newFeaturePermissions
--- a/src/eric7/WebBrowser/Feeds/FeedsDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/Feeds/FeedsDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -14,6 +14,7 @@ from eric7.EricGui import EricPixmapCache from eric7.UI.NotificationWidget import NotificationTypes +from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow from .Ui_FeedsDialog import Ui_FeedsDialog @@ -72,8 +73,6 @@ title = button.feed[0] if button.feed[0] else self.__browser.url().host() - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow - feedsManager = WebBrowserWindow.feedsManager() if feedsManager.addFeed(urlString, title, self.__browser.icon()): WebBrowserWindow.showNotification(
--- a/src/eric7/WebBrowser/Feeds/FeedsManager.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/Feeds/FeedsManager.py Mon Nov 07 17:19:58 2022 +0100 @@ -15,6 +15,7 @@ from eric7 import Preferences from eric7.EricGui import EricPixmapCache from eric7.EricWidgets import EricMessageBox +from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow from .Ui_FeedsManager import Ui_FeedsManager @@ -161,6 +162,8 @@ """ Private slot to edit the selected feed. """ + from .FeedEditDialog import FeedEditDialog + itm = self.feedsTree.selectedItems()[0] origTitle = itm.text(0) origUrlString = itm.data(0, FeedsManager.UrlStringRole) @@ -173,8 +176,6 @@ if feedToChange: feedIndex = self.__feeds.index(feedToChange) - from .FeedEditDialog import FeedEditDialog - dlg = FeedEditDialog(origUrlString, origTitle) if dlg.exec() == QDialog.DialogCode.Accepted: urlString, title = dlg.getData() @@ -262,8 +263,6 @@ for child in itm.takeChildren(): del child - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow - request = QNetworkRequest(QUrl(urlString)) reply = WebBrowserWindow.networkManager().get(request) reply.finished.connect(lambda: self.__feedLoaded(reply))
--- a/src/eric7/WebBrowser/GreaseMonkey/GreaseMonkeyAddScriptDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/GreaseMonkey/GreaseMonkeyAddScriptDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -16,6 +16,7 @@ from eric7.EricGui import EricPixmapCache from eric7.UI.NotificationWidget import NotificationTypes +from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow from .Ui_GreaseMonkeyAddScriptDialog import Ui_GreaseMonkeyAddScriptDialog @@ -70,14 +71,13 @@ """ Private slot to show an editor window with the source code. """ + from eric7.QScintilla.MiniEditor import MiniEditor from eric7.WebBrowser.Tools import WebBrowserTools tmpFileName = WebBrowserTools.ensureUniqueFilename( os.path.join(QDir.tempPath(), "tmp-userscript.js") ) if shutil.copy(self.__script.fileName(), tmpFileName): - from eric7.QScintilla.MiniEditor import MiniEditor - editor = MiniEditor(tmpFileName, "JavaScript", self) editor.show() @@ -94,8 +94,6 @@ msg = self.tr("<p>Cannot install script.</p>") success = False - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow - if success: WebBrowserWindow.showNotification( EricPixmapCache.getPixmap("greaseMonkey48"),
--- a/src/eric7/WebBrowser/GreaseMonkey/GreaseMonkeyConfiguration/GreaseMonkeyConfigurationDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/GreaseMonkey/GreaseMonkeyConfiguration/GreaseMonkeyConfigurationDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -75,12 +75,12 @@ @param item reference to the double clicked item (QListWidgetItem) """ + from .GreaseMonkeyConfigurationScriptInfoDialog import ( + GreaseMonkeyConfigurationScriptInfoDialog, + ) + script = self.__getScript(item) if script is not None: - from .GreaseMonkeyConfigurationScriptInfoDialog import ( - GreaseMonkeyConfigurationScriptInfoDialog, - ) - infoDlg = GreaseMonkeyConfigurationScriptInfoDialog(script, self) infoDlg.exec()
--- a/src/eric7/WebBrowser/GreaseMonkey/GreaseMonkeyConfiguration/GreaseMonkeyConfigurationListDelegate.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/GreaseMonkey/GreaseMonkeyConfiguration/GreaseMonkeyConfigurationListDelegate.py Mon Nov 07 17:19:58 2022 +0100 @@ -135,10 +135,7 @@ name = index.data(Qt.ItemDataRole.DisplayRole) leftTitleEdge = leftPos + 2 rightTitleEdge = rightPos - self.__padding - try: - leftPosForVersion = titleMetrics.horizontalAdvance(name) + self.__padding - except AttributeError: - leftPosForVersion = titleMetrics.width(name) + self.__padding + leftPosForVersion = titleMetrics.horizontalAdvance(name) + self.__padding nameRect = QRect( leftTitleEdge, opt.rect.top() + self.__padding,
--- a/src/eric7/WebBrowser/GreaseMonkey/GreaseMonkeyDownloader.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/GreaseMonkey/GreaseMonkeyDownloader.py Mon Nov 07 17:19:58 2022 +0100 @@ -13,6 +13,7 @@ from PyQt6.QtCore import QObject, QSettings, pyqtSignal, pyqtSlot from PyQt6.QtNetwork import QNetworkReply, QNetworkRequest +from eric7.WebBrowser.Tools import WebBrowserTools from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow @@ -82,8 +83,6 @@ return if not self.__fileName: - from eric7.WebBrowser.Tools import WebBrowserTools - filePath = os.path.join( self.__manager.scriptsDirectory(), WebBrowserTools.getFileNameFromUrl(self.__reply.url()), @@ -132,8 +131,6 @@ elif not name.endswith(".js"): name += ".js" filePath = os.path.join(self.__manager.requireScriptsDirectory(), name) - from eric7.WebBrowser.Tools import WebBrowserTools - self.__fileName = WebBrowserTools.ensureUniqueFilename(filePath, "{0}") if not pathlib.Path(self.__fileName).is_absolute(): self.__fileName = os.path.join(
--- a/src/eric7/WebBrowser/GreaseMonkey/GreaseMonkeyManager.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/GreaseMonkey/GreaseMonkeyManager.py Mon Nov 07 17:19:58 2022 +0100 @@ -63,7 +63,8 @@ """ Public method to show the configuration dialog. - @param parent reference to the parent widget (QWidget) + @param parent reference to the parent widget + @type QWidget """ from .GreaseMonkeyConfiguration import GreaseMonkeyConfigurationDialog @@ -117,17 +118,16 @@ @param downloader reference to the downloader object @type GreaseMonkeyDownloader """ + from .GreaseMonkeyAddScriptDialog import GreaseMonkeyAddScriptDialog + from .GreaseMonkeyScript import GreaseMonkeyScript + if downloader in self.__downloaders: self.__downloaders.remove(downloader) deleteScript = True - from .GreaseMonkeyScript import GreaseMonkeyScript - script = GreaseMonkeyScript(self, fileName) if script.isValid(): if not self.containsScript(script.fullName()): - from .GreaseMonkeyAddScriptDialog import GreaseMonkeyAddScriptDialog - dlg = GreaseMonkeyAddScriptDialog(self, script) deleteScript = dlg.exec() != QDialog.DialogCode.Accepted else: @@ -310,6 +310,8 @@ """ Private slot to load the available scripts into the manager. """ + from .GreaseMonkeyScript import GreaseMonkeyScript + scriptsDir = QDir(self.scriptsDirectory()) if not scriptsDir.exists(): scriptsDir.mkpath(self.scriptsDirectory()) @@ -321,8 +323,6 @@ "GreaseMonkeyDisabledScripts" ) - from .GreaseMonkeyScript import GreaseMonkeyScript - for fileName in scriptsDir.entryList(["*.js"], QDir.Filter.Files): absolutePath = scriptsDir.absoluteFilePath(fileName) script = GreaseMonkeyScript(self, absolutePath)
--- a/src/eric7/WebBrowser/History/HistoryDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/History/HistoryDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -12,6 +12,7 @@ from PyQt6.QtWidgets import QApplication, QDialog, QMenu from eric7.EricCore.EricTreeSortFilterProxyModel import EricTreeSortFilterProxyModel +from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow from .HistoryModel import HistoryModel from .Ui_HistoryDialog import Ui_HistoryDialog @@ -49,8 +50,6 @@ self.__historyManager = manager if self.__historyManager is None: - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow - self.__historyManager = WebBrowserWindow.historyManager() self.__model = self.__historyManager.historyTreeModel() @@ -61,10 +60,7 @@ self.historyTree.setModel(self.__proxyModel) self.historyTree.expandAll() fm = QFontMetrics(self.font()) - try: - header = fm.horizontalAdvance("m") * 40 - except AttributeError: - header = fm.width("m") * 40 + header = fm.horizontalAdvance("m") * 40 self.historyTree.header().resizeSection(0, header) self.historyTree.header().resizeSection(1, header) self.historyTree.header().setStretchLastSection(True)
--- a/src/eric7/WebBrowser/History/HistoryManager.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/History/HistoryManager.py Mon Nov 07 17:19:58 2022 +0100 @@ -30,6 +30,10 @@ from eric7.EricWidgets import EricMessageBox from eric7.Utilities.AutoSaver import AutoSaver +from .HistoryFilterModel import HistoryFilterModel +from .HistoryModel import HistoryModel +from .HistoryTreeModel import HistoryTreeModel + HISTORY_VERSION_42 = 42 HISTORY_VERSION_60 = 60 HISTORY_VERSIONS = [HISTORY_VERSION_60, HISTORY_VERSION_42] @@ -150,10 +154,6 @@ self.__load() - from .HistoryFilterModel import HistoryFilterModel - from .HistoryModel import HistoryModel - from .HistoryTreeModel import HistoryTreeModel - self.__historyModel = HistoryModel(self, self) self.__historyFilterModel = HistoryFilterModel(self.__historyModel, self) self.__historyTreeModel = HistoryTreeModel(self.__historyFilterModel, self)
--- a/src/eric7/WebBrowser/History/HistoryMenu.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/History/HistoryMenu.py Mon Nov 07 17:19:58 2022 +0100 @@ -24,6 +24,7 @@ from eric7.EricGui import EricPixmapCache from eric7.EricWidgets import EricMessageBox from eric7.EricWidgets.EricModelMenu import EricModelMenu +from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow from .HistoryModel import HistoryModel @@ -341,8 +342,6 @@ @return flag indicating if any actions were added (boolean) """ if self.__historyManager is None: - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow - self.__historyManager = WebBrowserWindow.historyManager() self.__historyMenuModel = HistoryMenuModel( self.__historyManager.historyTreeModel(), self @@ -430,12 +429,7 @@ Private slot to populate the closed tabs menu. """ fm = self.__closedTabsMenu.fontMetrics() - try: - maxWidth = fm.horizontalAdvance("m") * 40 - except AttributeError: - maxWidth = fm.width("m") * 40 - - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow + maxWidth = fm.horizontalAdvance("m") * 40 self.__closedTabsMenu.clear() for index, tab in enumerate( @@ -524,8 +518,6 @@ @return flag indicating if any actions were added (boolean) """ if self.__historyMenuModel is None: - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow - historyManager = WebBrowserWindow.historyManager() self.__historyMenuModel = HistoryMostVisitedMenuModel( historyManager.historyFilterModel(), self
--- a/src/eric7/WebBrowser/Navigation/NavigationBar.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/Navigation/NavigationBar.py Mon Nov 07 17:19:58 2022 +0100 @@ -23,6 +23,7 @@ from eric7.EricGui import EricPixmapCache from eric7.EricWidgets.EricToolButton import EricToolButton from eric7.WebBrowser.Download.DownloadManagerButton import DownloadManagerButton +from eric7.WebBrowser.WebBrowserWebSearchWidget import WebBrowserWebSearchWidget from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow from .ReloadStopButton import ReloadStopButton @@ -123,8 +124,6 @@ urlBar = self.__mw.tabWidget().stackedUrlBar() self.__navigationSplitter.addWidget(urlBar) - from eric7.WebBrowser.WebBrowserWebSearchWidget import WebBrowserWebSearchWidget - self.__searchEdit = WebBrowserWebSearchWidget(self.__mw, self) sizePolicy = QSizePolicy( QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Preferred
--- a/src/eric7/WebBrowser/Network/EricSchemeHandler.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/Network/EricSchemeHandler.py Mon Nov 07 17:19:58 2022 +0100 @@ -12,6 +12,7 @@ from eric7.EricUtilities.EricMutexLocker import EricMutexLocker from eric7.EricWidgets.EricApplication import ericApp +from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow from ..Tools.WebBrowserTools import getHtmlPage, getJavascript, pixmapFileToDataUrl @@ -274,8 +275,6 @@ self._speedDialPage = page - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow - dial = WebBrowserWindow.speedDial() page = ( self._speedDialPage.replace("@INITIAL-SCRIPT@", dial.initialScript())
--- a/src/eric7/WebBrowser/Network/NetworkManager.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/Network/NetworkManager.py Mon Nov 07 17:19:58 2022 +0100 @@ -20,9 +20,13 @@ from PyQt6.QtWidgets import QDialog, QStyle from eric7 import Preferences -from eric7.EricNetwork.EricNetworkProxyFactory import proxyAuthenticationRequired +from eric7.EricNetwork.EricNetworkProxyFactory import ( + EricNetworkProxyFactory, + proxyAuthenticationRequired, +) from eric7.EricWidgets import EricMessageBox from eric7.EricWidgets.EricApplication import ericApp +from eric7.UI.AuthenticationDialog import AuthenticationDialog from eric7.Utilities.AutoSaver import AutoSaver from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow @@ -34,6 +38,7 @@ SSL_AVAILABLE = False from ..Tools.WebBrowserTools import getHtmlPage, pixmapToDataUrl +from .EricSchemeHandler import EricSchemeHandler from .NetworkUrlInterceptor import NetworkUrlInterceptor @@ -55,8 +60,6 @@ """ super().__init__(parent) - from eric7.EricNetwork.EricNetworkProxyFactory import EricNetworkProxyFactory - self.__proxyFactory = EricNetworkProxyFactory() if Preferences.getUI("UseSystemProxy"): QNetworkProxyFactory.setUseSystemConfiguration(True) @@ -85,15 +88,15 @@ lambda reply, auth: self.authentication(reply.url(), auth) ) - from .EricSchemeHandler import EricSchemeHandler - self.__ericSchemeHandler = EricSchemeHandler() WebBrowserWindow.webProfile().installUrlSchemeHandler( QByteArray(b"eric"), self.__ericSchemeHandler ) if engine: - from .QtHelpSchemeHandler import QtHelpSchemeHandler + from .QtHelpSchemeHandler import ( # __IGNORE_WARNING_I101__ + QtHelpSchemeHandler, + ) self.__qtHelpSchemeHandler = QtHelpSchemeHandler(engine) WebBrowserWindow.webProfile().installUrlSchemeHandler( @@ -112,8 +115,6 @@ if not self.__loaded: return - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow - if not WebBrowserWindow.isPrivate(): dbString = json.dumps(self.__permanentlyIgnoredSslErrors) Preferences.setWebBrowser("SslExceptionsDB", dbString) @@ -145,15 +146,21 @@ # set proxy factory to None to avoid crashes QNetworkProxyFactory.setApplicationProxyFactory(None) - def showSslErrorExceptionsDialog(self): + def showSslErrorExceptionsDialog(self, parent=None): """ Public method to show the SSL error exceptions dialog. + + @param parent reference to the parent widget + @type QWidget """ + from .SslErrorExceptionsDialog import SslErrorExceptionsDialog + self.__load() - from .SslErrorExceptionsDialog import SslErrorExceptionsDialog - - dlg = SslErrorExceptionsDialog(self.__permanentlyIgnoredSslErrors) + dlg = SslErrorExceptionsDialog( + self.__permanentlyIgnoredSslErrors, + parent=parent, + ) if dlg.exec() == QDialog.DialogCode.Accepted: self.__permanentlyIgnoredSslErrors = dlg.getSslErrorExceptions() self.changed.emit() @@ -293,9 +300,6 @@ else self.tr("<b>Enter username and password for '{0}'</b>").format(urlRoot) ) - from eric7.UI.AuthenticationDialog import AuthenticationDialog - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow - dlg = AuthenticationDialog( info, auth.user(),
--- a/src/eric7/WebBrowser/OpenSearch/OpenSearchDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/OpenSearch/OpenSearchDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -40,7 +40,7 @@ self.enginesTable.horizontalHeader().setStretchLastSection(True) self.enginesTable.verticalHeader().hide() self.enginesTable.verticalHeader().setDefaultSectionSize( - 1.2 * self.fontMetrics().height() + int(1.2 * self.fontMetrics().height()) ) self.enginesTable.selectionModel().selectionChanged.connect(
--- a/src/eric7/WebBrowser/OpenSearch/OpenSearchEngineAction.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/OpenSearch/OpenSearchEngineAction.py Mon Nov 07 17:19:58 2022 +0100 @@ -10,6 +10,8 @@ from PyQt6.QtCore import QUrl from PyQt6.QtGui import QAction, QIcon, QPixmap +from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow + class OpenSearchEngineAction(QAction): """ @@ -28,8 +30,6 @@ self.__engine = engine if self.__engine.networkAccessManager() is None: - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow - self.__engine.setNetworkAccessManager(WebBrowserWindow.networkManager()) self.setText(engine.name()) @@ -43,8 +43,6 @@ """ image = self.__engine.image() if image.isNull(): - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow - self.setIcon(WebBrowserWindow.icon(QUrl(self.__engine.imageUrl()))) else: self.setIcon(QIcon(QPixmap.fromImage(image)))
--- a/src/eric7/WebBrowser/OpenSearch/OpenSearchEngineModel.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/OpenSearch/OpenSearchEngineModel.py Mon Nov 07 17:19:58 2022 +0100 @@ -13,6 +13,8 @@ from PyQt6.QtCore import QAbstractTableModel, QModelIndex, Qt, QUrl from PyQt6.QtGui import QIcon, QPixmap +from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow + class OpenSearchEngineModel(QAbstractTableModel): """ @@ -131,8 +133,6 @@ elif role == Qt.ItemDataRole.DecorationRole: image = engine.image() if image.isNull(): - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow - icon = WebBrowserWindow.icon(QUrl(engine.imageUrl())) else: icon = QIcon(QPixmap.fromImage(image))
--- a/src/eric7/WebBrowser/OpenSearch/OpenSearchManager.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/OpenSearch/OpenSearchManager.py Mon Nov 07 17:19:58 2022 +0100 @@ -18,6 +18,7 @@ from eric7.EricWidgets import EricMessageBox from eric7.EricWidgets.EricApplication import ericApp from eric7.Utilities.AutoSaver import AutoSaver +from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow class OpenSearchManager(QObject): @@ -170,8 +171,6 @@ if not url.isValid(): return False - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow - reply = WebBrowserWindow.networkManager().get(QNetworkRequest(url)) reply.finished.connect(lambda: self.__engineFromUrlAvailable(reply)) reply.setParent(self) @@ -187,12 +186,12 @@ (string) @return flag indicating success (boolean) """ + from .OpenSearchReader import OpenSearchReader + file_ = QFile(filename) if not file_.open(QIODevice.OpenModeFlag.ReadOnly): return False - from .OpenSearchReader import OpenSearchReader - reader = OpenSearchReader() engine = reader.read(file_) @@ -235,6 +234,8 @@ @param view reference to the web browser view @type WebBrowserView """ + from .OpenSearchEngine import OpenSearchEngine + if not res: return @@ -277,8 +278,6 @@ actionUrl.setQuery(searchUrlQuery) - from .OpenSearchEngine import OpenSearchEngine - engine = OpenSearchEngine() engine.setName(engineName) engine.setDescription(engineName) @@ -344,13 +343,13 @@ @param dirName name of the directory to write the files to (string) """ + from .OpenSearchWriter import OpenSearchWriter + qdir = QDir() if not qdir.mkpath(dirName): return qdir.setPath(dirName) - from .OpenSearchWriter import OpenSearchWriter - writer = OpenSearchWriter() for engine in list(self.__engines.values()): @@ -475,13 +474,13 @@ @param reply reference to the network reply @type QNetworkReply """ + from .OpenSearchReader import OpenSearchReader + reply.close() if reply in self.__replies: self.__replies.remove(reply) if reply.error() == QNetworkReply.NetworkError.NoError: - from .OpenSearchReader import OpenSearchReader - reader = OpenSearchReader() engine = reader.read(reply) @@ -498,8 +497,6 @@ return else: # some error happened - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow - WebBrowserWindow.getWindow().statusBar().showMessage( reply.errorString(), 10000 )
--- a/src/eric7/WebBrowser/Passwords/PasswordReader.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/Passwords/PasswordReader.py Mon Nov 07 17:19:58 2022 +0100 @@ -109,6 +109,8 @@ """ Private method to read the forms information. """ + from .LoginForm import LoginForm + if not self.isStartElement() and self.name() != "Forms": return @@ -116,8 +118,6 @@ self.readNext() if self.isStartElement(): if self.name() == "Form": - from .LoginForm import LoginForm - attributes = self.attributes() key = attributes.value("key") form = LoginForm()
--- a/src/eric7/WebBrowser/Passwords/PasswordsDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/Passwords/PasswordsDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -12,7 +12,9 @@ from PyQt6.QtWidgets import QDialog from eric7.EricWidgets import EricMessageBox +from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow +from .PasswordModel import PasswordModel from .Ui_PasswordsDialog import Ui_PasswordsDialog @@ -37,10 +39,6 @@ self.removeButton.clicked.connect(self.passwordsTable.removeSelected) self.removeAllButton.clicked.connect(self.passwordsTable.removeAll) - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow - - from .PasswordModel import PasswordModel - self.passwordsTable.verticalHeader().hide() self.__passwordModel = PasswordModel(WebBrowserWindow.passwordManager(), self) self.__proxyModel = QSortFilterProxyModel(self) @@ -63,24 +61,12 @@ for section in range(self.__passwordModel.columnCount()): header = self.passwordsTable.horizontalHeader().sectionSizeHint(section) if section == 0: - try: - header = fm.horizontalAdvance("averagebiglongsitename") - except AttributeError: - header = fm.width("averagebiglongsitename") + header = fm.horizontalAdvance("averagebiglongsitename") elif section == 1: - try: - header = fm.horizontalAdvance("averagelongusername") - except AttributeError: - header = fm.width("averagelongusername") + header = fm.horizontalAdvance("averagelongusername") elif section == 2: - try: - header = fm.horizontalAdvance("averagelongpassword") - except AttributeError: - header = fm.width("averagelongpassword") - try: - buffer = fm.horizontalAdvance("mm") - except AttributeError: - buffer = fm.width("mm") + header = fm.horizontalAdvance("averagelongpassword") + buffer = fm.horizontalAdvance("mm") header += buffer self.passwordsTable.horizontalHeader().resizeSection(section, header) self.passwordsTable.horizontalHeader().setStretchLastSection(True)
--- a/src/eric7/WebBrowser/PersonalInformationManager/PersonalInformationManager.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/PersonalInformationManager/PersonalInformationManager.py Mon Nov 07 17:19:58 2022 +0100 @@ -113,13 +113,16 @@ self.__loaded = True - def showConfigurationDialog(self): + def showConfigurationDialog(self, parent=None): """ Public method to show the configuration dialog. + + @param parent reference to the parent widget + @type QWidget """ from .PersonalDataDialog import PersonalDataDialog - dlg = PersonalDataDialog() + dlg = PersonalDataDialog(parent=parent) if dlg.exec() == QDialog.DialogCode.Accepted: dlg.storeData() self.__loadSettings()
--- a/src/eric7/WebBrowser/QtHelp/HelpIndexWidget.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/QtHelp/HelpIndexWidget.py Mon Nov 07 17:19:58 2022 +0100 @@ -147,9 +147,9 @@ @return selected document @rtype QHelpLink """ - document = QHelpLink() + from .HelpTopicDialog import HelpTopicDialog - from .HelpTopicDialog import HelpTopicDialog + document = QHelpLink() dlg = HelpTopicDialog(self, helpKeyword, documents) if dlg.exec() == QDialog.DialogCode.Accepted:
--- a/src/eric7/WebBrowser/QtHelp/QtHelpDocumentationSettingsWidget.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/QtHelp/QtHelpDocumentationSettingsWidget.py Mon Nov 07 17:19:58 2022 +0100 @@ -44,7 +44,9 @@ ericApp().getObject("PluginManager").getPluginQtHelpFiles() ) except KeyError: - from eric7.PluginManager.PluginManager import PluginManager + from eric7.PluginManager.PluginManager import ( # __IGNORE_WARNING_I101__ + PluginManager, + ) pluginManager = PluginManager(self, doLoadPlugins=False) pluginManager.loadDocumentationSetPlugins()
--- a/src/eric7/WebBrowser/SafeBrowsing/SafeBrowsingDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/SafeBrowsing/SafeBrowsingDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -14,6 +14,7 @@ from eric7.EricGui import EricPixmapCache from eric7.EricGui.EricOverrideCursor import EricOverrideCursor from eric7.EricWidgets import EricMessageBox +from eric7.EricWidgets.EricSimpleHelpDialog import EricSimpleHelpDialog from .Ui_SafeBrowsingDialog import Ui_SafeBrowsingDialog @@ -75,11 +76,9 @@ Private slot to show some help text "How to create a safe browsing API key.". """ - if self.__gsbHelpDialog is None: - from eric7.EricWidgets.EricSimpleHelpDialog import EricSimpleHelpDialog + from . import SafeBrowsingHelp - from . import SafeBrowsingHelp - + if self.__gsbHelpDialog is None: helpStr = SafeBrowsingHelp() self.__gsbHelpDialog = EricSimpleHelpDialog( title=self.tr("Google Safe Browsing API Help"),
--- a/src/eric7/WebBrowser/SafeBrowsing/SafeBrowsingManager.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/SafeBrowsing/SafeBrowsingManager.py Mon Nov 07 17:19:58 2022 +0100 @@ -30,6 +30,7 @@ from eric7 import Preferences, Utilities from eric7.EricGui import EricPixmapCache from eric7.UI.NotificationWidget import NotificationTypes +from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow from .SafeBrowsingAPIClient import SafeBrowsingAPIClient from .SafeBrowsingCache import SafeBrowsingCache @@ -368,11 +369,9 @@ """ Public slot to show the safe browsing management dialog. """ - if self.__gsbDialog is None: - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow + from .SafeBrowsingDialog import SafeBrowsingDialog - from .SafeBrowsingDialog import SafeBrowsingDialog - + if self.__gsbDialog is None: self.__gsbDialog = SafeBrowsingDialog( self, parent=WebBrowserWindow.mainWindow() )
--- a/src/eric7/WebBrowser/Session/SessionManager.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/Session/SessionManager.py Mon Nov 07 17:19:58 2022 +0100 @@ -40,6 +40,7 @@ from eric7 import Preferences, Utilities from eric7.EricGui.EricOverrideCursor import EricOverrideCursor from eric7.EricWidgets import EricMessageBox +from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow class SessionMetaData: @@ -412,8 +413,6 @@ if not sessionData or not sessionData["Windows"]: return - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow - window = WebBrowserWindow.mainWindow() if (flags & SessionManager.SwitchSession) == SessionManager.SwitchSession:
--- a/src/eric7/WebBrowser/SiteInfo/SiteInfoDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/SiteInfo/SiteInfoDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -227,8 +227,6 @@ self.__imageReply.deleteLater() self.__imageReply = None - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow - self.__imageReply = WebBrowserWindow.networkManager().get( QNetworkRequest(imageUrl) )
--- a/src/eric7/WebBrowser/SpeedDial/SpeedDial.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/SpeedDial/SpeedDial.py Mon Nov 07 17:19:58 2022 +0100 @@ -24,6 +24,7 @@ from eric7.Utilities.AutoSaver import AutoSaver from ..Tools.WebBrowserTools import pixmapFileToDataUrl +from .Page import Page class SpeedDial(QObject): @@ -73,8 +74,6 @@ if url.isEmpty(): return - from .Page import Page - page = Page(self.__escapeUrl(url.toString()), self.__escapeTitle(title)) self.__webPages.append(page) self.__regenerateScript = True @@ -176,12 +175,12 @@ """ Private method to load the speed dial configuration. """ + from .SpeedDialReader import SpeedDialReader + allPages, pagesPerRow, speedDialSize = [], 0, 0 speedDialFile = self.getFileName() if os.path.exists(speedDialFile): - from .SpeedDialReader import SpeedDialReader - reader = SpeedDialReader() allPages, pagesPerRow, speedDialSize = reader.read(speedDialFile) @@ -267,8 +266,6 @@ if page.url == urlString: return page - from .Page import Page - return Page() def urlForShortcut(self, key): @@ -297,8 +294,6 @@ self.__webPages = [] self.__regenerateScript = True - from .Page import Page - for entry in entries: if not entry: continue @@ -329,11 +324,11 @@ @param loadTitle flag indicating to get the title for the thumbnail from the site (boolean) """ + from .PageThumbnailer import PageThumbnailer + if not url: return - from .PageThumbnailer import PageThumbnailer - thumbnailer = PageThumbnailer(self) thumbnailer.setUrl(QUrl.fromEncoded(url.encode("utf-8"))) thumbnailer.setLoadTitle(loadTitle)
--- a/src/eric7/WebBrowser/SpeedDial/SpeedDialReader.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/SpeedDial/SpeedDialReader.py Mon Nov 07 17:19:58 2022 +0100 @@ -10,6 +10,8 @@ from PyQt6.QtCore import QCoreApplication, QFile, QIODevice, QXmlStreamReader +from .Page import Page + class SpeedDialReader(QXmlStreamReader): """ @@ -99,8 +101,6 @@ if url: if not title: title = url - from .Page import Page - page = Page(url, title) self.__pages.append(page) else:
--- a/src/eric7/WebBrowser/SpellCheck/ManageDictionariesDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/SpellCheck/ManageDictionariesDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -20,6 +20,7 @@ from eric7 import Preferences from eric7.EricWidgets import EricMessageBox +from eric7.EricXML.SpellCheckDictionariesReader import SpellCheckDictionariesReader from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow from .Ui_ManageDictionariesDialog import Ui_ManageDictionariesDialog @@ -238,10 +239,6 @@ listFileData = reply.readAll() # extract the dictionaries - from eric7.EricXML.SpellCheckDictionariesReader import ( - SpellCheckDictionariesReader, - ) - reader = SpellCheckDictionariesReader(listFileData, self.addEntry) reader.readXML() url = Preferences.getWebBrowser("SpellCheckDictionariesUrl")
--- a/src/eric7/WebBrowser/Sync/SyncAssistantDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/Sync/SyncAssistantDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -12,6 +12,14 @@ from eric7 import Globals from eric7.EricGui import EricPixmapCache +from . import SyncGlobals +from .SyncCheckPage import SyncCheckPage +from .SyncDataPage import SyncDataPage +from .SyncDirectorySettingsPage import SyncDirectorySettingsPage +from .SyncEncryptionPage import SyncEncryptionPage +from .SyncFtpSettingsPage import SyncFtpSettingsPage +from .SyncHostTypePage import SyncHostTypePage + class SyncAssistantDialog(QWizard): """ @@ -26,14 +34,6 @@ """ super().__init__(parent) - from . import SyncGlobals - from .SyncCheckPage import SyncCheckPage - from .SyncDataPage import SyncDataPage - from .SyncDirectorySettingsPage import SyncDirectorySettingsPage - from .SyncEncryptionPage import SyncEncryptionPage - from .SyncFtpSettingsPage import SyncFtpSettingsPage - from .SyncHostTypePage import SyncHostTypePage - self.setPage(SyncGlobals.PageData, SyncDataPage(self)) self.setPage(SyncGlobals.PageEncryption, SyncEncryptionPage(self)) self.setPage(SyncGlobals.PageType, SyncHostTypePage(self))
--- a/src/eric7/WebBrowser/Sync/SyncCheckPage.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/Sync/SyncCheckPage.py Mon Nov 07 17:19:58 2022 +0100 @@ -12,6 +12,7 @@ from eric7 import Preferences from eric7.EricGui import EricPixmapCache +from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow from . import SyncGlobals from .Ui_SyncCheckPage import Ui_SyncCheckPage @@ -39,8 +40,6 @@ forceUpload = self.field("ReencryptData") - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow - syncMgr = WebBrowserWindow.syncManager() syncMgr.syncError.connect(self.__syncError) syncMgr.syncStatus.connect(self.__updateMessages)
--- a/src/eric7/WebBrowser/Sync/SyncDataPage.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/Sync/SyncDataPage.py Mon Nov 07 17:19:58 2022 +0100 @@ -11,6 +11,7 @@ from eric7 import Preferences +from . import SyncGlobals from .Ui_SyncDataPage import Ui_SyncDataPage @@ -51,8 +52,6 @@ Preferences.setWebBrowser("SyncUserAgents", self.userAgentsCheckBox.isChecked()) Preferences.setWebBrowser("SyncSpeedDial", self.speedDialCheckBox.isChecked()) - from . import SyncGlobals - if self.activeCheckBox.isChecked(): return SyncGlobals.PageEncryption else:
--- a/src/eric7/WebBrowser/Sync/SyncDirectorySettingsPage.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/Sync/SyncDirectorySettingsPage.py Mon Nov 07 17:19:58 2022 +0100 @@ -12,6 +12,7 @@ from eric7 import Preferences from eric7.EricWidgets.EricPathPicker import EricPathPickerModes +from . import SyncGlobals from .Ui_SyncDirectorySettingsPage import Ui_SyncDirectorySettingsPage @@ -43,8 +44,6 @@ # save the settings Preferences.setWebBrowser("SyncDirectoryPath", self.directoryPicker.text()) - from . import SyncGlobals - return SyncGlobals.PageCheck def isComplete(self):
--- a/src/eric7/WebBrowser/Sync/SyncEncryptionPage.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/Sync/SyncEncryptionPage.py Mon Nov 07 17:19:58 2022 +0100 @@ -12,6 +12,7 @@ from eric7 import Preferences +from . import SyncGlobals from .Ui_SyncEncryptionPage import Ui_SyncEncryptionPage @@ -65,8 +66,6 @@ "SyncEncryptPasswordsOnly", self.loginsOnlyCheckBox.isChecked() ) - from . import SyncGlobals - return SyncGlobals.PageType def isComplete(self):
--- a/src/eric7/WebBrowser/Sync/SyncFtpSettingsPage.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/Sync/SyncFtpSettingsPage.py Mon Nov 07 17:19:58 2022 +0100 @@ -11,6 +11,7 @@ from eric7 import Preferences +from . import SyncGlobals from .Ui_SyncFtpSettingsPage import Ui_SyncFtpSettingsPage @@ -54,8 +55,6 @@ Preferences.setWebBrowser("SyncFtpPort", self.portSpinBox.value()) Preferences.setWebBrowser("SyncFtpIdleTimeout", self.idleSpinBox.value()) - from . import SyncGlobals - return SyncGlobals.PageCheck def isComplete(self):
--- a/src/eric7/WebBrowser/Sync/SyncManager.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/Sync/SyncManager.py Mon Nov 07 17:19:58 2022 +0100 @@ -14,6 +14,8 @@ from eric7 import Preferences from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow +from . import SyncGlobals + class SyncManager(QObject): """ @@ -78,14 +80,14 @@ self.__handler.shutdown() if self.syncEnabled(): - from . import SyncGlobals - if Preferences.getWebBrowser("SyncType") == SyncGlobals.SyncTypeFtp: - from .FtpSyncHandler import FtpSyncHandler + from .FtpSyncHandler import FtpSyncHandler # __IGNORE_WARNING_I101__ self.__handler = FtpSyncHandler(self) elif Preferences.getWebBrowser("SyncType") == SyncGlobals.SyncTypeDirectory: - from .DirectorySyncHandler import DirectorySyncHandler + from .DirectorySyncHandler import ( # __IGNORE_WARNING_I101__ + DirectorySyncHandler, + ) self.__handler = DirectorySyncHandler(self) self.__handler.syncError.connect(self.__syncError)
--- a/src/eric7/WebBrowser/TabManager/TabManagerWidget.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/TabManager/TabManagerWidget.py Mon Nov 07 17:19:58 2022 +0100 @@ -121,12 +121,12 @@ @type dict with WebBrowserWindow as key and list of WebBrowserView as value """ + from ..Bookmarks.AddBookmarkDialog import AddBookmarkDialog + from ..Bookmarks.BookmarkNode import BookmarkNode + if not browsersDict: return - from ..Bookmarks.AddBookmarkDialog import AddBookmarkDialog - from ..Bookmarks.BookmarkNode import BookmarkNode - dlg = AddBookmarkDialog() dlg.setFolder(True) dlg.setTitle(self.tr("Saved Tabs"))
--- a/src/eric7/WebBrowser/Tools/Scripts.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/Tools/Scripts.py Mon Nov 07 17:19:58 2022 +0100 @@ -75,7 +75,9 @@ }})()""" - from eric7.WebBrowser.WebBrowserPage import WebBrowserPage + from eric7.WebBrowser.WebBrowserPage import ( # __IGNORE_WARNING_I101__ + WebBrowserPage, + ) match = ( "// @exclude eric:*"
--- a/src/eric7/WebBrowser/Tools/WebBrowserTools.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/Tools/WebBrowserTools.py Mon Nov 07 17:19:58 2022 +0100 @@ -218,7 +218,7 @@ @rtype tuple of (str, str, str) """ try: - from PyQt6.QtWebEngineCore import ( + from PyQt6.QtWebEngineCore import ( # __IGNORE_WARNING_I10__ qWebEngineChromiumSecurityPatchVersion, qWebEngineChromiumVersion, qWebEngineVersion, @@ -229,7 +229,7 @@ webengineVersion = qWebEngineVersion() except ImportError: # backwards compatibility for PyQt < 6.3.1 - from PyQt6.QtWebEngineCore import QWebEngineProfile + from PyQt6.QtWebEngineCore import QWebEngineProfile # __IGNORE_WARNING_I10__ useragent = QWebEngineProfile.defaultProfile().httpUserAgent() match = re.search(r"""Chrome/([\d.]+)""", useragent)
--- a/src/eric7/WebBrowser/Tools/WebHitTestResult.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/Tools/WebHitTestResult.py Mon Nov 07 17:19:58 2022 +0100 @@ -13,6 +13,7 @@ # from PyQt6.QtCore import QPoint, QRect, QUrl +from PyQt6.QtWebEngineCore import QWebEngineContextMenuRequest class WebHitTestResult: @@ -120,8 +121,6 @@ @param data context menu data @type QWebEngineContextMenuRequest """ - from PyQt6.QtWebEngineCore import QWebEngineContextMenuRequest - if data.position() != self.__pos: return
--- a/src/eric7/WebBrowser/Tools/WebIconProvider.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/Tools/WebIconProvider.py Mon Nov 07 17:19:58 2022 +0100 @@ -109,7 +109,9 @@ if not self.__loaded: return - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow + from eric7.WebBrowser.WebBrowserWindow import ( # __IGNORE_WARNING_I101__ + WebBrowserWindow, + ) if not WebBrowserWindow.isPrivate() and bool(self.__iconDatabasePath): db = {} @@ -219,15 +221,18 @@ self.changed.emit() self.__saveTimer.saveIfNeccessary() - def showWebIconDialog(self): + def showWebIconDialog(self, parent=None): """ Public method to show a dialog to manage the Favicons. + + @param parent reference to the parent widget + @type QWidget """ + from .WebIconDialog import WebIconDialog + self.load() - from .WebIconDialog import WebIconDialog - - dlg = WebIconDialog(self.__iconsDB) + dlg = WebIconDialog(self.__iconsDB, parent=parent) if dlg.exec() == QDialog.DialogCode.Accepted: changed = False urls = dlg.getUrls()
--- a/src/eric7/WebBrowser/UrlBar/BookmarkActionSelectionDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/UrlBar/BookmarkActionSelectionDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -12,6 +12,7 @@ from PyQt6.QtWidgets import QDialog from eric7.EricGui import EricPixmapCache +from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow from .Ui_BookmarkActionSelectionDialog import Ui_BookmarkActionSelectionDialog @@ -42,8 +43,6 @@ self.icon.setPixmap(EricPixmapCache.getPixmap("bookmark32")) - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow - if WebBrowserWindow.bookmarksManager().bookmarkForUrl(url) is None: self.__bmAction = self.AddBookmark self.bookmarkPushButton.setText(self.tr("Add Bookmark"))
--- a/src/eric7/WebBrowser/UrlBar/BookmarkInfoDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/UrlBar/BookmarkInfoDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -12,6 +12,7 @@ from PyQt6.QtWidgets import QDialog from eric7.EricGui import EricPixmapCache +from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow from .Ui_BookmarkInfoDialog import Ui_BookmarkInfoDialog @@ -67,8 +68,6 @@ self.__bookmark is not None and self.titleEdit.text() != self.__bookmark.title ): - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow - bm = WebBrowserWindow.bookmarksManager() bm.setTitle(self.__bookmark, self.titleEdit.text()) self.close()
--- a/src/eric7/WebBrowser/UrlBar/FavIconLabel.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/UrlBar/FavIconLabel.py Mon Nov 07 17:19:58 2022 +0100 @@ -113,12 +113,12 @@ @param pos position the popup should be shown at @type QPoint """ + from ..SiteInfo.SiteInfoWidget import SiteInfoWidget + if self.__browser is None: return url = self.__browser.url() if url.isValid() and url.scheme() not in ["eric", "about", "data", "chrome"]: - from ..SiteInfo.SiteInfoWidget import SiteInfoWidget - info = SiteInfoWidget(self.__browser, self) info.showAt(pos)
--- a/src/eric7/WebBrowser/UrlBar/UrlBar.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/UrlBar/UrlBar.py Mon Nov 07 17:19:58 2022 +0100 @@ -136,12 +136,12 @@ """ Private slot to check the current URL for the bookmarked state. """ + from eric7.WebBrowser.Bookmarks.BookmarkNode import BookmarkNode + manager = self.__mw.bookmarksManager() if manager.bookmarkForUrl(self.__browser.url()) is not None: self.__bookmarkAction.setIcon(self.__bmActiveIcon) bookmarks = manager.bookmarksForUrl(self.__browser.url()) - from eric7.WebBrowser.Bookmarks.BookmarkNode import BookmarkNode - for bookmark in bookmarks: manager.setTimestamp( bookmark, BookmarkNode.TsVisited, QDateTime.currentDateTime() @@ -251,6 +251,7 @@ Private slot to show a dialog with some bookmark info. """ from .BookmarkActionSelectionDialog import BookmarkActionSelectionDialog + from .BookmarkInfoDialog import BookmarkInfoDialog url = self.__browser.url() dlg = BookmarkActionSelectionDialog(url) @@ -260,8 +261,6 @@ self.__browser.addBookmark() elif action == BookmarkActionSelectionDialog.EditBookmark: bookmark = self.__mw.bookmarksManager().bookmarkForUrl(url) - from .BookmarkInfoDialog import BookmarkInfoDialog - dlg = BookmarkInfoDialog(bookmark, self.__browser) dlg.exec() elif action == BookmarkActionSelectionDialog.AddSpeeddial: @@ -421,12 +420,12 @@ @param pos position to show the info at @type QPoint """ + from eric7.WebBrowser.SafeBrowsing.SafeBrowsingInfoWidget import ( + SafeBrowsingInfoWidget, + ) + threatInfo = self.__safeBrowsingLabel.getThreatInfo() if threatInfo: - from eric7.WebBrowser.SafeBrowsing.SafeBrowsingInfoWidget import ( - SafeBrowsingInfoWidget, - ) - widget = SafeBrowsingInfoWidget(threatInfo, self.__browser) widget.showAt(pos)
--- a/src/eric7/WebBrowser/UserAgent/UserAgentManager.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/UserAgent/UserAgentManager.py Mon Nov 07 17:19:58 2022 +0100 @@ -57,11 +57,11 @@ """ Public slot to save the user agent entries to disk. """ + from .UserAgentWriter import UserAgentWriter + if not self.__loaded: return - from .UserAgentWriter import UserAgentWriter - agentFile = self.getFileName() writer = UserAgentWriter() if not writer.write(agentFile, self.__agents): @@ -79,9 +79,9 @@ """ Private method to load the saved user agent settings. """ - agentFile = self.getFileName() from .UserAgentReader import UserAgentReader + agentFile = self.getFileName() reader = UserAgentReader() self.__agents = reader.read(agentFile) if reader.error() != QXmlStreamReader.Error.NoError:
--- a/src/eric7/WebBrowser/UserAgent/UserAgentMenu.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/UserAgent/UserAgentMenu.py Mon Nov 07 17:19:58 2022 +0100 @@ -15,6 +15,8 @@ from PyQt6.QtWidgets import QInputDialog, QLineEdit, QMenu from eric7.EricWidgets import EricMessageBox +from eric7.WebBrowser.WebBrowserPage import WebBrowserPage +from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow class UserAgentMenu(QMenu): @@ -36,8 +38,6 @@ self.__url = url if self.__url: if self.__url.isValid(): - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow - self.__manager = WebBrowserWindow.userAgentsManager() else: self.__url = None @@ -62,8 +62,6 @@ self.__manager.userAgentForUrl(self.__url) == "" ) else: - from eric7.WebBrowser.WebBrowserPage import WebBrowserPage - self.__defaultUserAgent.setChecked(WebBrowserPage.userAgent() == "") self.addAction(self.__defaultUserAgent) self.__actionGroup.addAction(self.__defaultUserAgent) @@ -89,8 +87,6 @@ if self.__url: self.__manager.removeUserAgent(self.__url.host()) else: - from eric7.WebBrowser.WebBrowserPage import WebBrowserPage - WebBrowserPage.setUserAgent("") def __switchToOtherUserAgent(self): @@ -122,8 +118,6 @@ if self.__url: self.__manager.setUserAgentForUrl(self.__url, act.data()) else: - from eric7.WebBrowser.WebBrowserPage import WebBrowserPage - WebBrowserPage.setUserAgent(act.data()) def __addDefaultActions(self): @@ -140,12 +134,11 @@ menuStack = [] isChecked = False - if self.__url: - currentUserAgentString = self.__manager.userAgentForUrl(self.__url) - else: - from eric7.WebBrowser.WebBrowserPage import WebBrowserPage - - currentUserAgentString = WebBrowserPage.userAgent() + currentUserAgentString = ( + self.__manager.userAgentForUrl(self.__url) + if self.__url + else WebBrowserPage.userAgent() + ) xml = QXmlStreamReader(defaultUserAgents) while not xml.atEnd(): xml.readNext()
--- a/src/eric7/WebBrowser/VirusTotal/VirusTotalApi.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/VirusTotal/VirusTotalApi.py Mon Nov 07 17:19:58 2022 +0100 @@ -299,6 +299,8 @@ @param reply reference to the network reply @type QNetworkReply """ + from .VirusTotalIpReportDialog import VirusTotalIpReportDialog + if reply.error() == QNetworkReply.NetworkError.NoError: result = json.loads(str(reply.readAll(), "utf-8")) if result["response_code"] == 0: @@ -324,8 +326,6 @@ except KeyError: urls = [] - from .VirusTotalIpReportDialog import VirusTotalIpReportDialog - self.__ipReportDlg = VirusTotalIpReportDialog( self.__lastIP, owner, resolutions, urls ) @@ -364,6 +364,8 @@ @param reply reference to the network reply @type QNetworkReply """ + from .VirusTotalDomainReportDialog import VirusTotalDomainReportDialog + if reply.error() == QNetworkReply.NetworkError.NoError: result = json.loads(str(reply.readAll(), "utf-8")) if result["response_code"] == 0: @@ -422,8 +424,6 @@ with contextlib.suppress(KeyError): webutationData["verdict"] = webutation["Verdict"] - from .VirusTotalDomainReportDialog import VirusTotalDomainReportDialog - self.__domainReportDlg = VirusTotalDomainReportDialog( self.__lastDomain, resolutions,
--- a/src/eric7/WebBrowser/WebBrowserPage.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/WebBrowserPage.py Mon Nov 07 17:19:58 2022 +0100 @@ -138,6 +138,10 @@ @return flag indicating acceptance @rtype bool """ + from eric7.WebBrowser.SafeBrowsing.SafeBrowsingManager import ( + SafeBrowsingManager, + ) + scheme = url.scheme() if scheme == "mailto": QDesktopServices.openUrl(url) @@ -172,10 +176,6 @@ # Safe Browsing self.__badSite = False - from eric7.WebBrowser.SafeBrowsing.SafeBrowsingManager import ( - SafeBrowsingManager, - ) - if ( SafeBrowsingManager.isEnabled() and url.scheme() not in SafeBrowsingManager.getIgnoreSchemes() @@ -641,7 +641,9 @@ @type QPoint """ if SSL_AVAILABLE and self.__sslConfiguration is not None: - from eric7.EricNetwork.EricSslInfoWidget import EricSslInfoWidget + from eric7.EricNetwork.EricSslInfoWidget import ( # __IGNORE_WARNING_I101__ + EricSslInfoWidget, + ) widget = EricSslInfoWidget(self.url(), self.__sslConfiguration, self.__view) widget.showAt(pos)
--- a/src/eric7/WebBrowser/WebBrowserTabWidget.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/WebBrowserTabWidget.py Mon Nov 07 17:19:58 2022 +0100 @@ -11,7 +11,12 @@ from PyQt6.QtCore import QMarginsF, Qt, QUrl, pyqtSignal, pyqtSlot from PyQt6.QtGui import QIcon, QPageLayout, QPainter, QPixmap -from PyQt6.QtPrintSupport import QAbstractPrintDialog, QPrintDialog, QPrinter +from PyQt6.QtPrintSupport import ( + QAbstractPrintDialog, + QPrintDialog, + QPrinter, + QPrintPreviewDialog, +) from PyQt6.QtWidgets import QDialog, QHBoxLayout, QMenu, QToolButton, QWidget from eric7 import Globals, Preferences, Utilities @@ -20,10 +25,14 @@ from eric7.EricWidgets import EricMessageBox from eric7.EricWidgets.EricApplication import ericApp from eric7.EricWidgets.EricTabWidget import EricTabWidget +from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow from . import WebInspector +from .ClosedTabsManager import ClosedTabsManager from .Tools import WebBrowserTools +from .UrlBar.StackedUrlBar import StackedUrlBar from .WebBrowserPage import WebBrowserPage +from .WebBrowserTabBar import WebBrowserTabBar from .WebBrowserView import WebBrowserView @@ -78,8 +87,6 @@ """ super().__init__(parent, dnd=True) - from .WebBrowserTabBar import WebBrowserTabBar - self.__tabBar = WebBrowserTabBar(self) self.setCustomTabBar(True, self.__tabBar) @@ -89,13 +96,9 @@ self.setDocumentMode(True) self.setElideMode(Qt.TextElideMode.ElideNone) - from .ClosedTabsManager import ClosedTabsManager - self.__closedTabsManager = ClosedTabsManager(self) self.__closedTabsManager.closedTabAvailable.connect(self.__closedTabAvailable) - from .UrlBar.StackedUrlBar import StackedUrlBar - self.__stackedUrlBar = StackedUrlBar(self) self.__tabBar.tabMoved.connect(self.__stackedUrlBar.moveBar) @@ -401,6 +404,9 @@ @return reference to the new browser @rtype WebBrowserView """ + from .History.HistoryCompleter import HistoryCompleter, HistoryCompletionModel + from .UrlBar.UrlBar import UrlBar + if link is None: linkName = "" elif isinstance(link, QUrl): @@ -408,17 +414,8 @@ else: linkName = link - from .UrlBar.UrlBar import UrlBar - urlbar = UrlBar(self.__mainWindow, self) if self.__historyCompleter is None: - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow - - from .History.HistoryCompleter import ( - HistoryCompleter, - HistoryCompletionModel, - ) - histMgr = WebBrowserWindow.historyManager() self.__historyCompletionModel = HistoryCompletionModel(self) self.__historyCompletionModel.setSourceModel(histMgr.historyFilterModel()) @@ -698,6 +695,8 @@ @param browser reference to the browser to be printed (HelpBrowser) """ + from .Tools.PrintToPdfDialog import PrintToPdfDialog + if browser is None: browser = self.currentBrowser() @@ -706,8 +705,6 @@ name = name.rsplit(".", 1)[0] name += ".pdf" if hasattr(browser.page(), "printToPdf"): - from .Tools.PrintToPdfDialog import PrintToPdfDialog - if not name: name = "printout.pdf" dlg = PrintToPdfDialog(name, self) @@ -783,8 +780,6 @@ @param browser reference to the browser to be printed (WebBrowserView) """ - from PyQt6.QtPrintSupport import QPrintPreviewDialog - if browser is None: browser = self.currentBrowser() @@ -933,8 +928,6 @@ self.__mainWindow.setLoadingActions(True) elif progress == 100: - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow - self.resetAnimation(index) self.setTabIcon(index, WebBrowserWindow.icon(browser.url())) self.showMessage.emit(self.tr("Finished loading")) @@ -1147,10 +1140,7 @@ Private slot to populate the closed tabs menu. """ fm = self.__closedTabsMenu.fontMetrics() - try: - maxWidth = fm.horizontalAdvance("m") * 40 - except AttributeError: - maxWidth = fm.width("m") * 40 + maxWidth = fm.horizontalAdvance("m") * 40 self.__closedTabsMenu.clear() for index, tab in enumerate(self.__closedTabsManager.allClosedTabs()):
--- a/src/eric7/WebBrowser/WebBrowserView.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/WebBrowserView.py Mon Nov 07 17:19:58 2022 +0100 @@ -46,6 +46,7 @@ from eric7.EricWidgets.EricApplication import ericApp from eric7.Globals import qVersionTuple from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow +from eric7.WebBrowser.ZoomManager import ZoomManager from . import WebInspector from .Tools import Scripts @@ -466,8 +467,6 @@ self.setZoomFactor(value / 100.0) self.__currentZoom = value if saveValue and not self.__mw.isPrivate(): - from eric7.WebBrowser.ZoomManager import ZoomManager - ZoomManager.instance().setZoomValue(self.url(), value) self.zoomValueChanged.emit(value) @@ -863,6 +862,9 @@ @param hitTest reference to the hit test object @type WebHitTestResult """ + from .OpenSearch.OpenSearchEngineAction import OpenSearchEngineAction + from .WebBrowserLanguagesDialog import WebBrowserLanguagesDialog + if not menu.isEmpty(): menu.addSeparator() @@ -879,8 +881,6 @@ self.__searchDefaultRequested, ) - from .OpenSearch.OpenSearchEngineAction import OpenSearchEngineAction - self.__searchMenu = menu.addMenu(self.tr("Search with...")) engineNames = self.__mw.openSearchManager().allEnginesNames() for engineName in engineNames: @@ -892,8 +892,6 @@ menu.addSeparator() - from .WebBrowserLanguagesDialog import WebBrowserLanguagesDialog - languages = Preferences.toList( Preferences.getSettings().value( "WebBrowser/AcceptLanguages", @@ -938,6 +936,9 @@ @param menu reference to the menu to be populated @type QMenu """ + from .UserAgent.UserAgentMenu import UserAgentMenu + from .WebBrowserLanguagesDialog import WebBrowserLanguagesDialog + menu.addAction(self.__mw.newTabAct) menu.addAction(self.__mw.newAct) menu.addSeparator() @@ -988,8 +989,6 @@ act.triggered.connect(functools.partial(self.__sendLink, act)) menu.addSeparator() - from .UserAgent.UserAgentMenu import UserAgentMenu - self.__userAgentMenu = UserAgentMenu(self.tr("User Agent"), url=self.url()) menu.addMenu(self.__userAgentMenu) menu.addSeparator() @@ -1023,8 +1022,6 @@ act.setData(w3url) act.triggered.connect(functools.partial(self.__openLinkInNewTab, act)) - from .WebBrowserLanguagesDialog import WebBrowserLanguagesDialog - languages = Preferences.toList( Preferences.getSettings().value( "WebBrowser/AcceptLanguages", @@ -1055,9 +1052,9 @@ @param pos position to be tested @type QPoint """ - self.__clickedPos = self.mapToViewport(pos) + from .Tools import Scripts - from .Tools import Scripts + self.__clickedPos = self.mapToViewport(pos) script = Scripts.getFormData(self.__clickedPos) self.page().runJavaScript( @@ -1159,12 +1156,12 @@ @param act reference to the action that triggered @type QAction """ + from .Bookmarks.AddBookmarkDialog import AddBookmarkDialog + url = act.data() if url.isEmpty(): return - from .Bookmarks.AddBookmarkDialog import AddBookmarkDialog - dlg = AddBookmarkDialog() dlg.setUrl(bytes(url.toEncoded()).decode()) dlg.exec() @@ -1360,13 +1357,13 @@ meta attributes @type list """ + from .Bookmarks.AddBookmarkDialog import AddBookmarkDialog + description = "" for meta in res: if meta["name"] == "description": description = meta["content"] - from .Bookmarks.AddBookmarkDialog import AddBookmarkDialog - dlg = AddBookmarkDialog() dlg.setUrl(bytes(self.url().toEncoded()).decode()) dlg.setTitle(self.title()) @@ -1711,9 +1708,9 @@ @param icon web site icon @type QIcon """ - self.__siteIcon = icon + from eric7.WebBrowser.Tools import WebIconProvider - from eric7.WebBrowser.Tools import WebIconProvider + self.__siteIcon = icon WebIconProvider.instance().saveIcon(self) @@ -1726,11 +1723,11 @@ @return web site icon @rtype QIcon """ + from eric7.WebBrowser.Tools import WebIconProvider + if not self.__siteIcon.isNull(): return QIcon(self.__siteIcon) - from eric7.WebBrowser.Tools import WebIconProvider - return WebIconProvider.instance().iconForUrl(self.url()) def title(self): @@ -1867,8 +1864,6 @@ QApplication.processEvents() QTimer.singleShot(200, self.__renderPreview) - from eric7.WebBrowser.ZoomManager import ZoomManager - zoomValue = ZoomManager.instance().zoomValue(self.url()) self.setZoomValue(zoomValue) @@ -1890,12 +1885,10 @@ @param lastModified last modified value @type str """ + from .Bookmarks.BookmarkNode import BookmarkNode + modified = QDateTime.fromString(lastModified, "MM/dd/yyyy hh:mm:ss") if modified.isValid(): - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow - - from .Bookmarks.BookmarkNode import BookmarkNode - manager = WebBrowserWindow.bookmarksManager() for bookmark in manager.bookmarksForUrl(self.url()): manager.setTimestamp(bookmark, BookmarkNode.TsModified, modified) @@ -2263,6 +2256,8 @@ @return tuple containing the title, URL and web icon @rtype tuple of (str, str, QIcon) """ + from eric7.WebBrowser.Tools import WebIconProvider + title = sessionData.get("Title", "") urlStr = sessionData.get("Url", "") @@ -2272,8 +2267,6 @@ icon = QIcon() stream >> icon else: - from eric7.WebBrowser.Tools import WebIconProvider - icon = WebIconProvider.instance().iconForUrl(QUrl.fromUserInput(urlStr)) return title, urlStr, icon @@ -2317,6 +2310,8 @@ @param quotaRequest reference to the quota request object @type QWebEngineQuotaRequest """ + from .Download.DownloadUtilities import dataString + acceptRequest = Preferences.getWebBrowser("AcceptQuotaRequest") # map yes/no/ask from (0, 1, 2) if acceptRequest == 0: @@ -2327,8 +2322,6 @@ ok = False else: # ask user - from .Download.DownloadUtilities import dataString - sizeStr = dataString(quotaRequest.requestedSize()) ok = EricMessageBox.yesNo( @@ -2358,6 +2351,10 @@ found in system's client certificate store @type QWebEngineClientCertificateSelection """ + from eric7.EricNetwork.EricSslCertificateSelectionDialog import ( + EricSslCertificateSelectionDialog, + ) + certificates = clientCertificateSelection.certificates() if len(certificates) == 0: clientCertificateSelection.selectNone() @@ -2365,10 +2362,6 @@ clientCertificateSelection.select(certificates[0]) else: certificate = None - from eric7.EricNetwork.EricSslCertificateSelectionDialog import ( - EricSslCertificateSelectionDialog, - ) - dlg = EricSslCertificateSelectionDialog(certificates, self) if dlg.exec() == QDialog.DialogCode.Accepted: certificate = dlg.getSelectedCertificate() @@ -2392,7 +2385,9 @@ @param accessRequest reference to the file system access request object @type QWebEngineFileSystemAccessRequest """ - from PyQt6.QtWebEngineCore import QWebEngineFileSystemAccessRequest + from PyQt6.QtWebEngineCore import ( # __IGNORE_WARNING_I102__ + QWebEngineFileSystemAccessRequest, + ) acceptRequest = Preferences.getWebBrowser("AcceptFileSystemAccessRequest") # map yes/no/ask from (0, 1, 2)
--- a/src/eric7/WebBrowser/WebBrowserWebSearchWidget.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/WebBrowserWebSearchWidget.py Mon Nov 07 17:19:58 2022 +0100 @@ -15,6 +15,8 @@ from eric7 import Preferences from eric7.EricGui import EricPixmapCache from eric7.EricWidgets.EricLineEdit import EricClearableLineEdit, EricLineEditSide +from eric7.EricWidgets.EricLineEditButton import EricLineEditButton +from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow from .WebBrowserPage import WebBrowserPage @@ -37,11 +39,9 @@ @param parent reference to the parent widget @type QWidget """ - super().__init__(parent) + from .OpenSearch.OpenSearchManager import OpenSearchManager - from eric7.EricWidgets.EricLineEditButton import EricLineEditButton - - from .OpenSearch.OpenSearchManager import OpenSearchManager + super().__init__(parent) self.__mw = mainWindow @@ -99,8 +99,6 @@ if not searchText: return - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow - if WebBrowserWindow.isPrivate(): return @@ -244,9 +242,10 @@ """ Private slot to handle the display of the engines menu. """ - self.__enginesMenu.clear() + from .OpenSearch.OpenSearchEngineAction import OpenSearchEngineAction + from .Tools import Scripts - from .OpenSearch.OpenSearchEngineAction import OpenSearchEngineAction + self.__enginesMenu.clear() engineNames = self.__openSearchManager.allEnginesNames() for engineName in engineNames: @@ -260,8 +259,6 @@ action.setChecked(True) cb = self.__mw.currentBrowser() - from .Tools import Scripts - script = Scripts.getOpenSearchLinks() cb.page().runJavaScript( script, WebBrowserPage.SafeJsWorld, self.__showEnginesMenuCallback
--- a/src/eric7/WebBrowser/WebBrowserWindow.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/WebBrowserWindow.py Mon Nov 07 17:19:58 2022 +0100 @@ -60,12 +60,14 @@ from eric7.EricGui.EricAction import EricAction from eric7.EricGui.EricOverrideCursor import EricOverrideCursor from eric7.EricNetwork.EricNetworkIcon import EricNetworkIcon +from eric7.EricNetwork.EricSslUtilities import initSSL from eric7.EricWidgets import EricErrorMessage, EricFileDialog, EricMessageBox from eric7.EricWidgets.EricApplication import ericApp from eric7.EricWidgets.EricMainWindow import EricMainWindow from eric7.EricWidgets.EricZoomWidget import EricZoomWidget from eric7.Globals import getConfig from eric7.Preferences import Shortcuts +from eric7.Preferences.ShortcutsDialog import ShortcutsDialog from eric7.UI import Config from eric7.UI.Info import Version from eric7.UI.NotificationWidget import NotificationTypes @@ -168,6 +170,21 @@ @param saname name to be used for the single application server @type str """ + from .AdBlock.AdBlockIcon import AdBlockIcon + from .Bookmarks.BookmarksToolBar import BookmarksToolBar + from .Navigation.NavigationBar import NavigationBar + from .Navigation.NavigationContainer import NavigationContainer + from .QtHelp.HelpIndexWidget import HelpIndexWidget + from .QtHelp.HelpSearchWidget import HelpSearchWidget + from .QtHelp.HelpTocWidget import HelpTocWidget + from .SearchWidget import SearchWidget + from .StatusBar.ImagesIcon import ImagesIcon + from .StatusBar.JavaScriptIcon import JavaScriptIcon + from .VirusTotal.VirusTotalApi import VirusTotalAPI + from .WebBrowserJavaScriptConsole import WebBrowserJavaScriptConsole + from .WebBrowserTabWidget import WebBrowserTabWidget + from .WebBrowserView import WebBrowserView + self.__hideNavigationTimer = None super().__init__(parent) @@ -196,25 +213,9 @@ self.__windowStates = Qt.WindowState.WindowNoState self.__isClosing = False - from .AdBlock.AdBlockIcon import AdBlockIcon - from .Bookmarks.BookmarksToolBar import BookmarksToolBar - from .Navigation.NavigationBar import NavigationBar - from .Navigation.NavigationContainer import NavigationContainer - from .QtHelp.HelpIndexWidget import HelpIndexWidget - from .QtHelp.HelpSearchWidget import HelpSearchWidget - from .QtHelp.HelpTocWidget import HelpTocWidget - from .SearchWidget import SearchWidget - from .StatusBar.ImagesIcon import ImagesIcon - from .StatusBar.JavaScriptIcon import JavaScriptIcon - from .VirusTotal.VirusTotalApi import VirusTotalAPI - from .WebBrowserTabWidget import WebBrowserTabWidget - from .WebBrowserView import WebBrowserView - self.setStyle(Preferences.getUI("Style"), Preferences.getUI("StyleSheet")) # initialize some SSL stuff - from eric7.EricNetwork.EricSslUtilities import initSSL - initSSL() if WebBrowserWindow._useQtHelp: @@ -309,8 +310,6 @@ self.addDockWidget(Qt.DockWidgetArea.LeftDockWidgetArea, self.__searchDock) # JavaScript Console window - from .WebBrowserJavaScriptConsole import WebBrowserJavaScriptConsole - self.__javascriptConsole = WebBrowserJavaScriptConsole(self) self.__javascriptConsoleDock = QDockWidget(self.tr("JavaScript Console")) self.__javascriptConsoleDock.setObjectName("JavascriptConsole") @@ -1846,9 +1845,9 @@ self.__actions.append(self.clearIconsAct) self.manageIconsAct = EricAction( - self.tr("Manage saved Favicons"), + self.tr("Manage Saved Favicons"), EricPixmapCache.getIcon("icons"), - self.tr("Manage saved Favicons"), + self.tr("Manage Saved Favicons"), 0, 0, self, @@ -1859,7 +1858,7 @@ ) self.manageIconsAct.setWhatsThis( self.tr( - """<b>Manage saved Favicons</b>""" + """<b>Manage Saved Favicons</b>""" """<p>This shows a dialog to manage the saved favicons of""" """ previously visited URLs.</p>""" ) @@ -2304,6 +2303,10 @@ """ Private method to create the menus. """ + from .Bookmarks.BookmarksMenu import BookmarksMenuBarMenu + from .History.HistoryMenu import HistoryMenu + from .UserAgent.UserAgentMenu import UserAgentMenu + mb = self.menuBar() menu = mb.addMenu(self.tr("&File")) @@ -2373,8 +2376,6 @@ menu.addAction(self.fullScreenAct) self.addActions(menu.actions()) - from .History.HistoryMenu import HistoryMenu - self.historyMenu = HistoryMenu(self, self.__tabWidget) self.historyMenu.setTitle(self.tr("H&istory")) self.historyMenu.openUrl.connect(self.openUrl) @@ -2391,8 +2392,6 @@ self.historyMenu.setInitialActions(historyActions) self.addActions(historyActions) - from .Bookmarks.BookmarksMenu import BookmarksMenuBarMenu - self.bookmarksMenu = BookmarksMenuBarMenu(self) self.bookmarksMenu.setTitle(self.tr("&Bookmarks")) self.bookmarksMenu.openUrl.connect(self.openUrl) @@ -2440,8 +2439,6 @@ self.__settingsMenu = menu self.__settingsMenu.aboutToShow.connect(self.__aboutToShowSettingsMenu) - from .UserAgent.UserAgentMenu import UserAgentMenu - self.__userAgentMenu = UserAgentMenu(self.tr("Global User Agent")) menu.addMenu(self.__userAgentMenu) menu.addAction(self.userAgentManagerAct) @@ -3063,13 +3060,13 @@ @param res result of the JavaScript @type list """ + from .Bookmarks.AddBookmarkDialog import AddBookmarkDialog + description = "" for meta in res: if meta["name"] == "description": description = meta["content"] - from .Bookmarks.AddBookmarkDialog import AddBookmarkDialog - dlg = AddBookmarkDialog() dlg.setUrl(url) dlg.setTitle(title) @@ -3147,13 +3144,13 @@ @param res result of the JavaScript @type list """ + from .Bookmarks.BookmarkNode import BookmarkNode + description = "" for meta in res: if meta["name"] == "description": description = meta["content"] - from .Bookmarks.BookmarkNode import BookmarkNode - bookmark = BookmarkNode(BookmarkNode.Bookmark) bookmark.url = url bookmark.title = title @@ -3809,9 +3806,9 @@ @return reference to the network access manager (NetworkManager) """ + from .Network.NetworkManager import NetworkManager + if cls._networkManager is None: - from .Network.NetworkManager import NetworkManager - cls._networkManager = NetworkManager(cls.helpEngine()) return cls._networkManager @@ -3823,9 +3820,9 @@ @return reference to the cookie jar (CookieJar) """ + from .CookieJar.CookieJar import CookieJar + if cls._cookieJar is None: - from .CookieJar.CookieJar import CookieJar - cls._cookieJar = CookieJar() return cls._cookieJar @@ -3842,7 +3839,7 @@ """ Private slot to show a dialog to manage the favicons database. """ - WebIconProvider.instance().showWebIconDialog() + WebIconProvider.instance().showWebIconDialog(self) @pyqtSlot(QUrl) def urlHandler(self, url): @@ -3959,7 +3956,7 @@ Private slot to manage the QtHelp documentation database. """ if WebBrowserWindow._useQtHelp: - from .QtHelp.QtHelpDocumentationConfigurationDialog import ( + from .QtHelp.QtHelpDocumentationConfigurationDialog import ( # __IGNORE_WARNING__ QtHelpDocumentationConfigurationDialog, ) @@ -4057,7 +4054,9 @@ help database. """ if WebBrowserWindow._useQtHelp: - from .QtHelp.HelpDocsInstaller import HelpDocsInstaller + from .QtHelp.HelpDocsInstaller import ( # __IGNORE_WARNING_I101__ + HelpDocsInstaller, + ) self.__helpInstaller = HelpDocsInstaller(self.__helpEngine.collectionFile()) self.__helpInstaller.errorMessage.connect(self.__showInstallationError) @@ -4192,35 +4191,35 @@ """ Private slot to show the certificate errors management dialog. """ - self.networkManager().showSslErrorExceptionsDialog() + self.networkManager().showSslErrorExceptionsDialog(self) @pyqtSlot() def __showAdBlockDialog(self): """ Private slot to show the AdBlock configuration dialog. """ - self.adBlockManager().showDialog() + self.adBlockManager().showDialog(self) @pyqtSlot() def __showPersonalInformationDialog(self): """ Private slot to show the Personal Information configuration dialog. """ - self.personalInformationManager().showConfigurationDialog() + self.personalInformationManager().showConfigurationDialog(parent=self) @pyqtSlot() def __showGreaseMonkeyConfigDialog(self): """ Private slot to show the GreaseMonkey scripts configuration dialog. """ - self.greaseMonkeyManager().showConfigurationDialog() + self.greaseMonkeyManager().showConfigurationDialog(parent=self) @pyqtSlot() def __showFeaturePermissionDialog(self): """ Private slot to show the feature permission dialog. """ - self.featurePermissionManager().showFeaturePermissionsDialog() + self.featurePermissionManager().showFeaturePermissionsDialog(self) @pyqtSlot() def __showZoomValuesDialog(self): @@ -4296,9 +4295,9 @@ @return reference to the bookmarks manager (BookmarksManager) """ + from .Bookmarks.BookmarksManager import BookmarksManager + if cls._bookmarksManager is None: - from .Bookmarks.BookmarksManager import BookmarksManager - cls._bookmarksManager = BookmarksManager() return cls._bookmarksManager @@ -4385,9 +4384,9 @@ @return reference to the history manager (HistoryManager) """ + from .History.HistoryManager import HistoryManager + if cls._historyManager is None: - from .History.HistoryManager import HistoryManager - cls._historyManager = HistoryManager() return cls._historyManager @@ -4399,9 +4398,9 @@ @return reference to the password manager (PasswordManager) """ + from .Passwords.PasswordManager import PasswordManager + if cls._passwordManager is None: - from .Passwords.PasswordManager import PasswordManager - cls._passwordManager = PasswordManager() return cls._passwordManager @@ -4413,9 +4412,9 @@ @return reference to the AdBlock manager (AdBlockManager) """ + from .AdBlock.AdBlockManager import AdBlockManager + if cls._adblockManager is None: - from .AdBlock.AdBlockManager import AdBlockManager - cls._adblockManager = AdBlockManager() return cls._adblockManager @@ -4435,9 +4434,9 @@ @return reference to the download manager (DownloadManager) """ + from .Download.DownloadManager import DownloadManager + if cls._downloadManager is None: - from .Download.DownloadManager import DownloadManager - cls._downloadManager = DownloadManager() return cls._downloadManager @@ -4450,9 +4449,9 @@ @return reference to the personal information manager (PersonalInformationManager) """ + from .PersonalInformationManager import PersonalInformationManager + if cls._personalInformationManager is None: - from .PersonalInformationManager import PersonalInformationManager - cls._personalInformationManager = ( PersonalInformationManager.PersonalInformationManager() ) @@ -4466,9 +4465,9 @@ @return reference to the GreaseMonkey manager (GreaseMonkeyManager) """ + from .GreaseMonkey.GreaseMonkeyManager import GreaseMonkeyManager + if cls._greaseMonkeyManager is None: - from .GreaseMonkey.GreaseMonkeyManager import GreaseMonkeyManager - cls._greaseMonkeyManager = GreaseMonkeyManager() return cls._greaseMonkeyManager @@ -4481,11 +4480,11 @@ @return reference to the feature permission manager @rtype FeaturePermissionManager """ + from .FeaturePermissions.FeaturePermissionManager import ( + FeaturePermissionManager, + ) + if cls._featurePermissionManager is None: - from .FeaturePermissions.FeaturePermissionManager import ( - FeaturePermissionManager, - ) - cls._featurePermissionManager = FeaturePermissionManager() return cls._featurePermissionManager @@ -4498,9 +4497,9 @@ @return reference to the image finder object @rtype ImageSearchEngine """ + from .ImageSearch.ImageSearchEngine import ImageSearchEngine + if cls._imageSearchEngine is None: - from .ImageSearch.ImageSearchEngine import ImageSearchEngine - cls._imageSearchEngine = ImageSearchEngine() return cls._imageSearchEngine @@ -4513,9 +4512,9 @@ @return reference to the auto scroller object @rtype AutoScroller """ + from .AutoScroll.AutoScroller import AutoScroller + if cls._autoScroller is None: - from .AutoScroll.AutoScroller import AutoScroller - cls._autoScroller = AutoScroller() return cls._autoScroller @@ -4528,9 +4527,9 @@ @return reference to the tab manager widget @rtype TabManagerWidget """ + from .TabManager.TabManagerWidget import TabManagerWidget + if cls._tabManager is None: - from .TabManager.TabManagerWidget import TabManagerWidget - cls._tabManager = TabManagerWidget(cls.mainWindow()) # do the connections @@ -4862,9 +4861,9 @@ @return reference to the RSS feeds manager (FeedsManager) """ + from .Feeds.FeedsManager import FeedsManager + if cls._feedsManager is None: - from .Feeds.FeedsManager import FeedsManager - cls._feedsManager = FeedsManager() return cls._feedsManager @@ -4914,9 +4913,9 @@ @return reference to the user agents manager (UserAgentManager) """ + from .UserAgent.UserAgentManager import UserAgentManager + if cls._userAgentsManager is None: - from .UserAgent.UserAgentManager import UserAgentManager - cls._userAgentsManager = UserAgentManager() return cls._userAgentsManager @@ -4938,9 +4937,9 @@ @return reference to the data synchronization manager (SyncManager) """ + from .Sync.SyncManager import SyncManager + if cls._syncManager is None: - from .Sync.SyncManager import SyncManager - cls._syncManager = SyncManager() return cls._syncManager @@ -4959,9 +4958,9 @@ @return reference to the speed dial (SpeedDial) """ + from .SpeedDial.SpeedDial import SpeedDial + if cls._speedDial is None: - from .SpeedDial.SpeedDial import SpeedDial - cls._speedDial = SpeedDial() return cls._speedDial @@ -5174,6 +5173,8 @@ @param styleSheetFile name of the user style sheet file (string) """ + from .WebBrowserPage import WebBrowserPage + name = "_eric_userstylesheet" userStyle = "" @@ -5186,8 +5187,6 @@ self.webProfile().scripts().remove(scripts[0]) if userStyle: - from .WebBrowserPage import WebBrowserPage - script = QWebEngineScript() script.setName(name) script.setInjectionPoint(QWebEngineScript.InjectionPoint.DocumentCreation) @@ -5219,9 +5218,9 @@ (None = use configured timeout, 0 = indefinitely) @type int """ + from eric7.UI.NotificationWidget import NotificationWidget + if cls._notification is None: - from eric7.UI.NotificationWidget import NotificationWidget - cls._notification = NotificationWidget() if timeout is None: @@ -5279,6 +5278,8 @@ @return reference to the web profile object @rtype QWebEngineProfile """ + from .WebBrowserPage import WebBrowserPage + if cls._webProfile is None: if private: cls._webProfile = QWebEngineProfile() @@ -5324,8 +5325,6 @@ ) # Setup QWebChannel user scripts - from .WebBrowserPage import WebBrowserPage - # WebChannel for SafeJsWorld script = QWebEngineScript() script.setName("_eric_webchannel") @@ -5377,9 +5376,9 @@ @return reference to the session manager @rtype SessionManager """ + from .Session.SessionManager import SessionManager + if cls._sessionManager is None and not cls._isPrivate: - from .Session.SessionManager import SessionManager - cls._sessionManager = SessionManager() return cls._sessionManager @@ -5403,9 +5402,9 @@ @return reference to the safe browsing manager @rtype SafeBrowsingManager """ + from .SafeBrowsing.SafeBrowsingManager import SafeBrowsingManager + if cls._safeBrowsingManager is None: - from .SafeBrowsing.SafeBrowsingManager import SafeBrowsingManager - cls._safeBrowsingManager = SafeBrowsingManager() return cls._safeBrowsingManager @@ -5429,9 +5428,9 @@ @return reference to the protocol handler manager @rtype ProtocolHandlerManager """ + from .Network.ProtocolHandlerManager import ProtocolHandlerManager + if cls._protocolHandlerManager is None: - from .Network.ProtocolHandlerManager import ProtocolHandlerManager - cls._protocolHandlerManager = ProtocolHandlerManager() return cls._protocolHandlerManager @@ -5501,8 +5500,6 @@ Private slot to configure the keyboard shortcuts. """ if self.__shortcutsDialog is None: - from eric7.Preferences.ShortcutsDialog import ShortcutsDialog - self.__shortcutsDialog = ShortcutsDialog(self) self.__shortcutsDialog.populate(helpViewer=self) self.__shortcutsDialog.show() @@ -5544,8 +5541,6 @@ ) if ok: - from eric7.Preferences import Shortcuts - Shortcuts.exportShortcuts(fn, helpViewer=self) @pyqtSlot() @@ -5563,6 +5558,4 @@ ) if fn: - from eric7.Preferences import Shortcuts - Shortcuts.importShortcuts(fn, helpViewer=self)
--- a/src/eric7/WebBrowser/ZoomManager/ZoomManager.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/ZoomManager/ZoomManager.py Mon Nov 07 17:19:58 2022 +0100 @@ -66,11 +66,11 @@ """ Public method to save the zoom values. """ + from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow + if not self.__loaded: return - from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow - if not WebBrowserWindow.isPrivate(): dbString = json.dumps(self.__zoomDB) Preferences.setWebBrowser("ZoomValuesDB", dbString)
--- a/src/eric7/WebBrowser/ZoomManager/ZoomValuesDialog.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/WebBrowser/ZoomManager/ZoomValuesDialog.py Mon Nov 07 17:19:58 2022 +0100 @@ -25,16 +25,16 @@ @param parent reference to the parent widget (QWidget) """ + from eric7.WebBrowser.ZoomManager import ZoomManager + + from .ZoomValuesModel import ZoomValuesModel + super().__init__(parent) self.setupUi(self) self.removeButton.clicked.connect(self.zoomValuesTable.removeSelected) self.removeAllButton.clicked.connect(self.zoomValuesTable.removeAll) - from eric7.WebBrowser.ZoomManager import ZoomManager - - from .ZoomValuesModel import ZoomValuesModel - self.zoomValuesTable.verticalHeader().hide() self.__zoomValuesModel = ZoomValuesModel(ZoomManager.instance(), self) self.__proxyModel = QSortFilterProxyModel(self) @@ -57,19 +57,10 @@ for section in range(self.__zoomValuesModel.columnCount()): header = self.zoomValuesTable.horizontalHeader().sectionSizeHint(section) if section == 0: - try: - header = fm.horizontalAdvance("extraveryveryverylongsitename") - except AttributeError: - header = fm.width("extraveryveryverylongsitename") + header = fm.horizontalAdvance("extraveryveryverylongsitename") elif section == 1: - try: - header = fm.horizontalAdvance("averagelongzoomvalue") - except AttributeError: - header = fm.width("averagelongzoomvalue") - try: - buffer = fm.width("mm") - except AttributeError: - buffer = fm.width("mm") + header = fm.horizontalAdvance("averagelongzoomvalue") + buffer = fm.horizontalAdvance("mm") header += buffer self.zoomValuesTable.horizontalHeader().resizeSection(section, header) self.zoomValuesTable.horizontalHeader().setStretchLastSection(True)
--- a/src/eric7/eric7_api.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/eric7_api.py Mon Nov 07 17:19:58 2022 +0100 @@ -13,6 +13,7 @@ """ import fnmatch +import getopt import glob import os import sys @@ -109,8 +110,6 @@ """ global supportedExtensions - import getopt - try: opts, args = getopt.getopt( sys.argv[1:],
--- a/src/eric7/eric7_browser.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/eric7_browser.py Mon Nov 07 17:19:58 2022 +0100 @@ -15,6 +15,8 @@ import os import sys +from PyQt6.QtGui import QGuiApplication + app = None SettingsDir = None @@ -59,7 +61,7 @@ app.exec() sys.exit(100) -from PyQt6.QtWebEngineCore import QWebEngineUrlScheme +from PyQt6.QtWebEngineCore import QWebEngineUrlScheme # __IGNORE_WARNING_I201__ from eric7.EricWidgets.EricApplication import EricApplication from eric7.Globals import AppInfo @@ -132,8 +134,6 @@ """ global app - from PyQt6.QtGui import QGuiApplication - QGuiApplication.setDesktopFileName("eric7_browser.desktop") options = [
--- a/src/eric7/eric7_compare.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/eric7_compare.py Mon Nov 07 17:19:58 2022 +0100 @@ -15,6 +15,8 @@ import os import sys +from PyQt6.QtGui import QGuiApplication + for arg in sys.argv[:]: if arg.startswith("--config="): from eric7 import Globals @@ -61,8 +63,6 @@ """ Main entry point into the application. """ - from PyQt6.QtGui import QGuiApplication - QGuiApplication.setDesktopFileName("eric7_compare.desktop") options = [
--- a/src/eric7/eric7_configure.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/eric7_configure.py Mon Nov 07 17:19:58 2022 +0100 @@ -13,6 +13,8 @@ import os import sys +from PyQt6.QtGui import QGuiApplication + for arg in sys.argv[:]: if arg.startswith("--config="): from eric7 import Globals @@ -54,8 +56,6 @@ """ Main entry point into the application. """ - from PyQt6.QtGui import QGuiApplication - QGuiApplication.setDesktopFileName("eric7_configure.desktop") options = [
--- a/src/eric7/eric7_diff.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/eric7_diff.py Mon Nov 07 17:19:58 2022 +0100 @@ -15,6 +15,8 @@ import os import sys +from PyQt6.QtGui import QGuiApplication + for arg in sys.argv[:]: if arg.startswith("--config="): from eric7 import Globals @@ -53,8 +55,6 @@ """ Main entry point into the application. """ - from PyQt6.QtGui import QGuiApplication - QGuiApplication.setDesktopFileName("eric7_diff.desktop") options = [
--- a/src/eric7/eric7_doc.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/eric7_doc.py Mon Nov 07 17:19:58 2022 +0100 @@ -13,6 +13,7 @@ """ import fnmatch +import getopt import glob import os import shutil @@ -144,8 +145,6 @@ """ Main entry point into the application. """ - import getopt - try: opts, args = getopt.getopt( sys.argv[1:],
--- a/src/eric7/eric7_editor.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/eric7_editor.py Mon Nov 07 17:19:58 2022 +0100 @@ -15,6 +15,8 @@ import os import sys +from PyQt6.QtGui import QGuiApplication + for arg in sys.argv[:]: if arg.startswith("--config="): from eric7 import Globals @@ -56,8 +58,6 @@ """ Main entry point into the application. """ - from PyQt6.QtGui import QGuiApplication - QGuiApplication.setDesktopFileName("eric7_editor.desktop") options = [
--- a/src/eric7/eric7_hexeditor.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/eric7_hexeditor.py Mon Nov 07 17:19:58 2022 +0100 @@ -15,6 +15,8 @@ import os import sys +from PyQt6.QtGui import QGuiApplication + for arg in sys.argv[:]: if arg.startswith("--config="): from eric7 import Globals @@ -59,8 +61,6 @@ """ Main entry point into the application. """ - from PyQt6.QtGui import QGuiApplication - QGuiApplication.setDesktopFileName("eric7_hexeditor.desktop") options = [
--- a/src/eric7/eric7_iconeditor.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/eric7_iconeditor.py Mon Nov 07 17:19:58 2022 +0100 @@ -15,6 +15,8 @@ import os import sys +from PyQt6.QtGui import QGuiApplication + for arg in sys.argv[:]: if arg.startswith("--config="): from eric7 import Globals @@ -59,8 +61,6 @@ """ Main entry point into the application. """ - from PyQt6.QtGui import QGuiApplication - QGuiApplication.setDesktopFileName("eric7_iconeditor.desktop") options = [
--- a/src/eric7/eric7_ide.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/eric7_ide.py Mon Nov 07 17:19:58 2022 +0100 @@ -37,6 +37,7 @@ try: from PyQt6.QtCore import QCoreApplication, QLibraryInfo, QTimer, qWarning + from PyQt6.QtGui import QGuiApplication except ImportError: try: from tkinter import messagebox @@ -86,9 +87,12 @@ ) sys.argv.remove(arg) -# make Third-Party package available as a packages repository +# make Third-Party package 'Jasy' available as a packages repository sys.path.insert(2, os.path.join(os.path.dirname(__file__), "ThirdParty", "Jasy")) +# make Python debug client available as a package repository (needed for 'coverage') +sys.path.insert(2, os.path.join(os.path.dirname(__file__), "DebugClients", "Python")) + from eric7.EricWidgets.EricApplication import EricApplication @@ -231,8 +235,6 @@ sys.excepthook = excepthook multiprocessing.set_start_method("spawn") - from PyQt6.QtGui import QGuiApplication - QGuiApplication.setDesktopFileName("eric7.desktop") options = [ @@ -282,7 +284,7 @@ pathList.insert(0, exeDir) os.environ["PATH"] = os.pathsep.join(pathList) - from eric7.Toolbox import Startup + from eric7.Toolbox import Startup # __IGNORE_WARNING_I101__ # set the library paths for plugins Startup.setLibraryPaths() @@ -297,7 +299,7 @@ ddindex = Startup.handleArgs(sys.argv, appinfo) logging.debug("Importing Preferences") - from eric7 import Preferences + from eric7 import Preferences # __IGNORE_WARNING_I101__ if Preferences.getUI("SingleApplicationMode"): handleSingleApplication(ddindex) @@ -309,7 +311,10 @@ Startup.initializeResourceSearchPath(app) # generate and show a splash window, if not suppressed - from eric7.UI.SplashScreen import NoneSplashScreen, SplashScreen + from eric7.UI.SplashScreen import ( # __IGNORE_WARNING_I101__ + NoneSplashScreen, + SplashScreen, + ) if "--no-splash" in sys.argv and sys.argv.index("--no-splash") < ddindex: sys.argv.remove("--no-splash") @@ -378,14 +383,14 @@ loc = Startup.loadTranslators(qtTransDir, app, ("qscintilla",)) # Initialize SSL stuff - from eric7.EricNetwork.EricSslUtilities import initSSL + from eric7.EricNetwork.EricSslUtilities import initSSL # __IGNORE_WARNING_I101__ initSSL() splash.showMessage(QCoreApplication.translate("eric7_ide", "Starting...")) # We can only import these after creating the EricApplication because they # make Qt calls that need the EricApplication to exist. - from eric7.UI.UserInterface import UserInterface + from eric7.UI.UserInterface import UserInterface # __IGNORE_WARNING_I101__ splash.showMessage( QCoreApplication.translate("eric7_ide", "Generating Main Window...") @@ -408,7 +413,7 @@ QTimer.singleShot(0, uiStartUp) # generate a graphical error handler - from eric7.EricWidgets import EricErrorMessage + from eric7.EricWidgets import EricErrorMessage # __IGNORE_WARNING_I101__ eMsg = EricErrorMessage.qtHandler() eMsg.setMinimumSize(600, 400)
--- a/src/eric7/eric7_plugininstall.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/eric7_plugininstall.py Mon Nov 07 17:19:58 2022 +0100 @@ -14,6 +14,8 @@ import os import sys +from PyQt6.QtGui import QGuiApplication + for arg in sys.argv[:]: if arg.startswith("--config="): from eric7 import Globals @@ -52,8 +54,6 @@ """ Main entry point into the application. """ - from PyQt6.QtGui import QGuiApplication - QGuiApplication.setDesktopFileName("eric7_plugininstall.desktop") options = [
--- a/src/eric7/eric7_pluginrepository.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/eric7_pluginrepository.py Mon Nov 07 17:19:58 2022 +0100 @@ -14,6 +14,8 @@ import os import sys +from PyQt6.QtGui import QGuiApplication + for arg in sys.argv[:]: if arg.startswith("--config="): from eric7 import Globals @@ -52,8 +54,6 @@ """ Main entry point into the application. """ - from PyQt6.QtGui import QGuiApplication - QGuiApplication.setDesktopFileName("eric7_pluginrepository.desktop") options = [
--- a/src/eric7/eric7_pluginuninstall.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/eric7_pluginuninstall.py Mon Nov 07 17:19:58 2022 +0100 @@ -14,6 +14,8 @@ import os import sys +from PyQt6.QtGui import QGuiApplication + for arg in sys.argv[:]: if arg.startswith("--config="): from eric7 import Globals @@ -52,8 +54,6 @@ """ Main entry point into the application. """ - from PyQt6.QtGui import QGuiApplication - QGuiApplication.setDesktopFileName("eric7_pluginuninstall.desktop") options = [
--- a/src/eric7/eric7_post_install.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/eric7_post_install.py Mon Nov 07 17:19:58 2022 +0100 @@ -67,7 +67,7 @@ @rtype any """ try: - import winreg + import winreg # __IGNORE_WARNING_I10__ except ImportError: return None @@ -122,8 +122,8 @@ @param iconPath path of the icon file @type str """ - from pywintypes import com_error - from win32com.client import Dispatch + from pywintypes import com_error # __IGNORE_WARNING_I102__ + from win32com.client import Dispatch # __IGNORE_WARNING_I102__ with contextlib.suppress(com_error): shell = Dispatch("WScript.Shell")
--- a/src/eric7/eric7_qregularexpression.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/eric7_qregularexpression.py Mon Nov 07 17:19:58 2022 +0100 @@ -15,6 +15,8 @@ import os import sys +from PyQt6.QtGui import QGuiApplication + for arg in sys.argv[:]: if arg.startswith("--config="): from eric7 import Globals @@ -55,8 +57,6 @@ """ Main entry point into the application. """ - from PyQt6.QtGui import QGuiApplication - QGuiApplication.setDesktopFileName("eric7_qregularexpression.desktop") options = [
--- a/src/eric7/eric7_re.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/eric7_re.py Mon Nov 07 17:19:58 2022 +0100 @@ -15,6 +15,8 @@ import os import sys +from PyQt6.QtGui import QGuiApplication + for arg in sys.argv[:]: if arg.startswith("--config="): from eric7 import Globals @@ -55,8 +57,6 @@ """ Main entry point into the application. """ - from PyQt6.QtGui import QGuiApplication - QGuiApplication.setDesktopFileName("eric7_re.desktop") options = [
--- a/src/eric7/eric7_shell.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/eric7_shell.py Mon Nov 07 17:19:58 2022 +0100 @@ -14,6 +14,8 @@ import os import sys +from PyQt6.QtGui import QGuiApplication + originalPathString = os.getenv("PATH") for arg in sys.argv[:]: @@ -54,8 +56,6 @@ """ Main entry point into the application. """ - from PyQt6.QtGui import QGuiApplication - QGuiApplication.setDesktopFileName("eric7_shell.desktop") options = [
--- a/src/eric7/eric7_snap.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/eric7_snap.py Mon Nov 07 17:19:58 2022 +0100 @@ -14,6 +14,8 @@ import os import sys +from PyQt6.QtGui import QGuiApplication + for arg in sys.argv[:]: if arg.startswith("--config="): from eric7 import Globals @@ -52,8 +54,6 @@ """ Main entry point into the application. """ - from PyQt6.QtGui import QGuiApplication - QGuiApplication.setDesktopFileName("eric7_snap.desktop") options = [
--- a/src/eric7/eric7_sqlbrowser.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/eric7_sqlbrowser.py Mon Nov 07 17:19:58 2022 +0100 @@ -14,6 +14,8 @@ import os import sys +from PyQt6.QtGui import QGuiApplication + for arg in sys.argv[:]: if arg.startswith("--config="): from eric7 import Globals @@ -55,8 +57,6 @@ """ Main entry point into the application. """ - from PyQt6.QtGui import QGuiApplication - QGuiApplication.setDesktopFileName("eric7_sqlbrowser.desktop") options = [
--- a/src/eric7/eric7_testing.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/eric7_testing.py Mon Nov 07 17:19:58 2022 +0100 @@ -15,6 +15,8 @@ import os import sys +from PyQt6.QtGui import QGuiApplication + for arg in sys.argv[:]: if arg.startswith("--config="): from eric7 import Globals @@ -36,6 +38,9 @@ from eric7.Globals import AppInfo from eric7.Toolbox import Startup +# make Python debug client available as a package repository (needed for 'coverage') +sys.path.insert(2, os.path.join(os.path.dirname(__file__), "DebugClients", "Python")) + def createMainWidget(argv): """ @@ -59,8 +64,6 @@ """ Main entry point into the application. """ - from PyQt6.QtGui import QGuiApplication - QGuiApplication.setDesktopFileName("eric7_testing.desktop") options = [
--- a/src/eric7/eric7_tray.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/eric7_tray.py Mon Nov 07 17:19:58 2022 +0100 @@ -15,6 +15,8 @@ import os import sys +from PyQt6.QtGui import QGuiApplication + SettingsDir = None for arg in sys.argv[:]: @@ -55,8 +57,6 @@ """ Main entry point into the application. """ - from PyQt6.QtGui import QGuiApplication - QGuiApplication.setDesktopFileName("eric7_tray.desktop") options = [
--- a/src/eric7/eric7_trpreviewer.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/eric7_trpreviewer.py Mon Nov 07 17:19:58 2022 +0100 @@ -15,6 +15,8 @@ import os import sys +from PyQt6.QtGui import QGuiApplication + for arg in sys.argv[:]: if arg.startswith("--config="): from eric7 import Globals @@ -62,8 +64,6 @@ """ global app - from PyQt6.QtGui import QGuiApplication - QGuiApplication.setDesktopFileName("eric7_trpreviewer.desktop") options = [
--- a/src/eric7/eric7_uipreviewer.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/eric7_uipreviewer.py Mon Nov 07 17:19:58 2022 +0100 @@ -15,6 +15,8 @@ import os import sys +from PyQt6.QtGui import QGuiApplication + for arg in sys.argv[:]: if arg.startswith("--config="): from eric7 import Globals @@ -56,8 +58,6 @@ """ Main entry point into the application. """ - from PyQt6.QtGui import QGuiApplication - QGuiApplication.setDesktopFileName("eric7_uipreviewer.desktop") options = [
--- a/src/eric7/eric7_virtualenv.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/eric7_virtualenv.py Mon Nov 07 17:19:58 2022 +0100 @@ -14,6 +14,8 @@ import os import sys +from PyQt6.QtGui import QGuiApplication + for arg in sys.argv[:]: if arg.startswith("--config="): from eric7 import Globals @@ -54,8 +56,6 @@ """ Main entry point into the application. """ - from PyQt6.QtGui import QGuiApplication - QGuiApplication.setDesktopFileName("eric7_virtualenv.desktop") options = [