src/eric7/UI/UserInterface.py

branch
eric7-maintenance
changeset 9654
7328efba128b
parent 9554
fe8c29d7cf96
parent 9653
e67609152c5e
child 9725
b9a29a7aa820
--- a/src/eric7/UI/UserInterface.py	Thu Dec 01 10:18:07 2022 +0100
+++ b/src/eric7/UI/UserInterface.py	Mon Jan 02 11:16:03 2023 +0100
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 
-# Copyright (c) 2002 - 2022 Detlev Offenbach <detlev@die-offenbachs.de>
+# Copyright (c) 2002 - 2023 Detlev Offenbach <detlev@die-offenbachs.de>
 #
 
 """
@@ -83,6 +83,13 @@
 from eric7.Project.Project import Project
 from eric7.QScintilla.SpellChecker import SpellChecker
 from eric7.Sessions.SessionFile import SessionFile
+from eric7.SystemUtilities import (
+    DesktopUtilities,
+    FileSystemUtilities,
+    OSUtilities,
+    PythonUtilities,
+    QtUtilities,
+)
 from eric7.Tasks.TasksFile import TasksFile
 from eric7.Testing.TestingWidget import clearSavedHistories
 from eric7.Utilities.BackgroundService import BackgroundService
@@ -665,6 +672,9 @@
             splash.showMessage(self.tr("Cleaning Plugins Download Area..."))
             PluginRepositoryDownloadCleanup(quiet=True)
 
+        if self.__findFileWidget:
+            self.__findFileWidget.populateFileCategories()
+
         # now read the keyboard shortcuts for all the actions
         Shortcuts.readShortcuts()
 
@@ -702,7 +712,7 @@
         # environment
         splash.showMessage(self.tr("Starting Debugger..."))
         if Preferences.getShell("StartWithMostRecentlyUsedEnvironment"):
-            venvName=Preferences.getShell("LastVirtualEnvironment")
+            venvName = Preferences.getShell("LastVirtualEnvironment")
             if venvName == "embedded environment":
                 venvName = ""
             self.__debugServer.startClient(False, venvName=venvName)
@@ -1622,7 +1632,7 @@
         # flag indicating '--' options was found
         ddseen = False
 
-        argChars = ["-", "/"] if Utilities.isWindowsPlatform() else ["-"]
+        argChars = ["-", "/"] if OSUtilities.isWindowsPlatform() else ["-"]
 
         for arg in args:
             # handle a request to start with last session
@@ -1807,7 +1817,9 @@
         @param project project name to be displayed (string)
         """
         if editor is not None and self.captionShowsFilename:
-            self.capEditor = Utilities.compactPath(editor, self.maxFilePathLen)
+            self.capEditor = FileSystemUtilities.compactPath(
+                editor, self.maxFilePathLen
+            )
         if project is not None:
             self.capProject = project
 
@@ -2419,7 +2431,7 @@
             )
             self.codeDocumentationViewerActivateAct.setStatusTip(
                 self.tr(
-                    "Switch the input focus to the Code Documentation Viewer" " window."
+                    "Switch the input focus to the Code Documentation Viewer window."
                 )
             )
             self.codeDocumentationViewerActivateAct.setWhatsThis(
@@ -2538,7 +2550,7 @@
         )
         self.virtualenvManagerActivateAct.setStatusTip(
             self.tr(
-                "Switch the input focus to the Virtual Environments Manager" " window."
+                "Switch the input focus to the Virtual Environments Manager window."
             )
         )
         self.virtualenvManagerActivateAct.setWhatsThis(
@@ -2711,9 +2723,7 @@
         )
         self.versionAct.setStatusTip(self.tr("Display version information"))
         self.versionAct.setWhatsThis(
-            self.tr(
-                """<b>Show Versions</b>""" """<p>Display version information.</p>"""
-            )
+            self.tr("""<b>Show Versions</b><p>Display version information.</p>""")
         )
         self.versionAct.triggered.connect(self.__showVersions)
         self.actions.append(self.versionAct)
@@ -2760,9 +2770,7 @@
         )
         self.reportBugAct.setStatusTip(self.tr("Report a bug"))
         self.reportBugAct.setWhatsThis(
-            self.tr(
-                """<b>Report Bug...</b>""" """<p>Opens a dialog to report a bug.</p>"""
-            )
+            self.tr("""<b>Report Bug...</b><p>Opens a dialog to report a bug.</p>""")
         )
         self.reportBugAct.triggered.connect(self.__reportBug)
         self.actions.append(self.reportBugAct)
@@ -2861,9 +2869,7 @@
         )
         self.testScriptAct.setStatusTip(self.tr("Run tests of the current script"))
         self.testScriptAct.setWhatsThis(
-            self.tr(
-                """<b>Test Script</b>""" """<p>Run tests with the current script.</p>"""
-            )
+            self.tr("""<b>Test Script</b><p>Run tests with the current script.</p>""")
         )
         self.testScriptAct.triggered.connect(self.__startTestScript)
         self.testScriptAct.setEnabled(False)
@@ -2880,25 +2886,24 @@
         )
         self.testProjectAct.setStatusTip(self.tr("Run tests of the current project"))
         self.testProjectAct.setWhatsThis(
-            self.tr(
-                """<b>Test Project</b>""" """<p>Run test of the current project.</p>"""
-            )
+            self.tr("""<b>Test Project</b><p>Run test of the current project.</p>""")
         )
         self.testProjectAct.triggered.connect(self.__startTestProject)
         self.testProjectAct.setEnabled(False)
         self.actions.append(self.testProjectAct)
 
         # check for Qt5 designer and linguist
-        if Utilities.isWindowsPlatform():
+        if OSUtilities.isWindowsPlatform():
             designerExe = os.path.join(
-                Utilities.getQtBinariesPath(),
-                "{0}.exe".format(Utilities.generateQtToolName("designer")),
-            )
-        elif Utilities.isMacPlatform():
-            designerExe = Utilities.getQtMacBundle("designer")
+                QtUtilities.getQtBinariesPath(),
+                "{0}.exe".format(QtUtilities.generateQtToolName("designer")),
+            )
+        elif OSUtilities.isMacPlatform():
+            designerExe = QtUtilities.getQtMacBundle("designer")
         else:
             designerExe = os.path.join(
-                Utilities.getQtBinariesPath(), Utilities.generateQtToolName("designer")
+                QtUtilities.getQtBinariesPath(),
+                QtUtilities.generateQtToolName("designer"),
             )
         if os.path.exists(designerExe):
             self.designer4Act = EricAction(
@@ -2912,23 +2917,24 @@
             )
             self.designer4Act.setStatusTip(self.tr("Start Qt-Designer"))
             self.designer4Act.setWhatsThis(
-                self.tr("""<b>Qt-Designer</b>""" """<p>Start Qt-Designer.</p>""")
+                self.tr("""<b>Qt-Designer</b><p>Start Qt-Designer.</p>""")
             )
             self.designer4Act.triggered.connect(self.__designer)
             self.actions.append(self.designer4Act)
         else:
             self.designer4Act = None
 
-        if Utilities.isWindowsPlatform():
+        if OSUtilities.isWindowsPlatform():
             linguistExe = os.path.join(
-                Utilities.getQtBinariesPath(),
-                "{0}.exe".format(Utilities.generateQtToolName("linguist")),
-            )
-        elif Utilities.isMacPlatform():
-            linguistExe = Utilities.getQtMacBundle("linguist")
+                QtUtilities.getQtBinariesPath(),
+                "{0}.exe".format(QtUtilities.generateQtToolName("linguist")),
+            )
+        elif OSUtilities.isMacPlatform():
+            linguistExe = QtUtilities.getQtMacBundle("linguist")
         else:
             linguistExe = os.path.join(
-                Utilities.getQtBinariesPath(), Utilities.generateQtToolName("linguist")
+                QtUtilities.getQtBinariesPath(),
+                QtUtilities.generateQtToolName("linguist"),
             )
         if os.path.exists(linguistExe):
             self.linguist4Act = EricAction(
@@ -2942,7 +2948,7 @@
             )
             self.linguist4Act.setStatusTip(self.tr("Start Qt-Linguist"))
             self.linguist4Act.setWhatsThis(
-                self.tr("""<b>Qt-Linguist</b>""" """<p>Start Qt-Linguist.</p>""")
+                self.tr("""<b>Qt-Linguist</b><p>Start Qt-Linguist.</p>""")
             )
             self.linguist4Act.triggered.connect(self.__linguist)
             self.actions.append(self.linguist4Act)
@@ -2960,7 +2966,7 @@
         )
         self.uipreviewerAct.setStatusTip(self.tr("Start the UI Previewer"))
         self.uipreviewerAct.setWhatsThis(
-            self.tr("""<b>UI Previewer</b>""" """<p>Start the UI Previewer.</p>""")
+            self.tr("""<b>UI Previewer</b><p>Start the UI Previewer.</p>""")
         )
         self.uipreviewerAct.triggered.connect(self.__UIPreviewer)
         self.actions.append(self.uipreviewerAct)
@@ -3034,7 +3040,7 @@
         )
         self.sqlBrowserAct.setStatusTip(self.tr("Browse a SQL database"))
         self.sqlBrowserAct.setWhatsThis(
-            self.tr("""<b>SQL Browser</b>""" """<p>Browse a SQL database.</p>""")
+            self.tr("""<b>SQL Browser</b><p>Browse a SQL database.</p>""")
         )
         self.sqlBrowserAct.triggered.connect(self.__sqlBrowser)
         self.actions.append(self.sqlBrowserAct)
@@ -3240,7 +3246,7 @@
         )
         self.reloadAPIsAct.setStatusTip(self.tr("Reload the API information"))
         self.reloadAPIsAct.setWhatsThis(
-            self.tr("""<b>Reload APIs</b>""" """<p>Reload the API information.</p>""")
+            self.tr("""<b>Reload APIs</b><p>Reload the API information.</p>""")
         )
         self.reloadAPIsAct.triggered.connect(self.__reloadAPIs)
         self.actions.append(self.reloadAPIsAct)
@@ -3714,7 +3720,7 @@
         Private slot to initialize the actions to show the PySide
         documentation.
         """
-        if Utilities.checkPyside(variant=2):
+        if QtUtilities.checkPyside(variant=2):
             self.pyside2DocAct = EricAction(
                 self.tr("PySide2 Documentation"),
                 self.tr("PySide2 Documentation"),
@@ -3740,7 +3746,7 @@
         else:
             self.pyside2DocAct = None
 
-        if Utilities.checkPyside(variant=6):
+        if QtUtilities.checkPyside(variant=6):
             self.pyside6DocAct = EricAction(
                 self.tr("PySide6 Documentation"),
                 self.tr("PySide6 Documentation"),
@@ -3772,7 +3778,7 @@
         """
         self.__menus = {}
         mb = self.menuBar()
-        if Utilities.isLinuxPlatform() and not Preferences.getUI("UseNativeMenuBar"):
+        if OSUtilities.isLinuxPlatform() and not Preferences.getUI("UseNativeMenuBar"):
             mb.setNativeMenuBar(False)
 
         ##############################################################
@@ -4521,7 +4527,7 @@
 
         sizeStr = "64-Bit" if sys.maxsize > 2**32 else "32-Bit"
 
-        versionText = self.tr("""<h2>Version Numbers</h2>""" """<table>""")
+        versionText = self.tr("""<h2>Version Numbers</h2><table>""")
 
         # Python version
         versionText += ("""<tr><td><b>Python</b></td><td>{0}, {1}</td></tr>""").format(
@@ -4581,8 +4587,8 @@
         )
 
         # desktop and session type
-        desktop = Globals.desktopName()
-        session = Globals.sessionType()
+        desktop = DesktopUtilities.desktopName()
+        session = DesktopUtilities.sessionType()
         if desktop or session:
             versionText += "<tr><td></td><td></td></tr>"
             if desktop:
@@ -4684,7 +4690,7 @@
         from .ErrorLogDialog import ErrorLogDialog
 
         if Preferences.getUI("CheckErrorLog"):
-            logFile = os.path.join(Utilities.getConfigDir(), self.ErrorLogFileName)
+            logFile = os.path.join(Globals.getConfigDir(), self.ErrorLogFileName)
             if os.path.exists(logFile):
                 dlg = ErrorLogDialog(logFile, False, self)
                 dlg.exec()
@@ -4695,7 +4701,7 @@
 
         @return flag indicating the existence of an error log file (boolean)
         """
-        logFile = os.path.join(Utilities.getConfigDir(), self.ErrorLogFileName)
+        logFile = os.path.join(Globals.getConfigDir(), self.ErrorLogFileName)
         return os.path.exists(logFile)
 
     def __showErrorLog(self):
@@ -4704,7 +4710,7 @@
         """
         from .ErrorLogDialog import ErrorLogDialog
 
-        logFile = os.path.join(Utilities.getConfigDir(), self.ErrorLogFileName)
+        logFile = os.path.join(Globals.getConfigDir(), self.ErrorLogFileName)
         if os.path.exists(logFile):
             dlg = ErrorLogDialog(logFile, True, self)
             dlg.show()
@@ -4956,7 +4962,7 @@
 
         if res and self.__shutdown():
             ericApp().closeAllWindows()
-            program = Globals.getPythonExecutable()
+            program = PythonUtilities.getPythonExecutable()
             args = ["-m", "eric7", "--start-session"]
             args.extend(self.__restartArgs)
             QProcess.startDetached(program, args)
@@ -5050,7 +5056,7 @@
         @type str
         """
         ericApp().closeAllWindows()
-        program = Globals.getPythonExecutable()
+        program = PythonUtilities.getPythonExecutable()
         ericStartArgs = ["-m", "eric7", "--start-session"]
         ericStartArgs.extend(self.__restartArgs)
 
@@ -5069,7 +5075,7 @@
         """
         if not Preferences.getUI("SingleApplicationMode"):
             # start eric without loading anything and without crash session
-            program = Globals.getPythonExecutable()
+            program = PythonUtilities.getPythonExecutable()
             eric7 = os.path.join(os.path.dirname(__file__), "..", "eric7_ide.py")
             args = [eric7, "--no-open", "--disable-crash"]
             QProcess.startDetached(program, args)
@@ -5989,13 +5995,14 @@
                 )
                 return
 
-        if Utilities.isMacPlatform():
-            designer, args = Utilities.prepareQtMacBundle("designer", args)
+        if OSUtilities.isMacPlatform():
+            designer, args = QtUtilities.prepareQtMacBundle("designer", args)
         else:
             designer = os.path.join(
-                Utilities.getQtBinariesPath(), Utilities.generateQtToolName("designer")
-            )
-            if Utilities.isWindowsPlatform():
+                QtUtilities.getQtBinariesPath(),
+                QtUtilities.generateQtToolName("designer"),
+            )
+            if OSUtilities.isWindowsPlatform():
                 designer += ".exe"
 
         if designer:
@@ -6056,13 +6063,14 @@
                 )
                 return
 
-        if Utilities.isMacPlatform():
-            linguist, args = Utilities.prepareQtMacBundle("linguist", args)
+        if OSUtilities.isMacPlatform():
+            linguist, args = QtUtilities.prepareQtMacBundle("linguist", args)
         else:
             linguist = os.path.join(
-                Utilities.getQtBinariesPath(), Utilities.generateQtToolName("linguist")
-            )
-            if Utilities.isWindowsPlatform():
+                QtUtilities.getQtBinariesPath(),
+                QtUtilities.generateQtToolName("linguist"),
+            )
+            if OSUtilities.isWindowsPlatform():
                 linguist += ".exe"
 
         if linguist:
@@ -6099,13 +6107,14 @@
             args.append("-showUrl")
             args.append(home)
 
-        if Utilities.isMacPlatform():
-            assistant, args = Utilities.prepareQtMacBundle("assistant", args)
+        if OSUtilities.isMacPlatform():
+            assistant, args = QtUtilities.prepareQtMacBundle("assistant", args)
         else:
             assistant = os.path.join(
-                Utilities.getQtBinariesPath(), Utilities.generateQtToolName("assistant")
-            )
-            if Utilities.isWindowsPlatform():
+                QtUtilities.getQtBinariesPath(),
+                QtUtilities.generateQtToolName("assistant"),
+            )
+            if OSUtilities.isWindowsPlatform():
                 assistant += ".exe"
 
         if assistant:
@@ -6231,7 +6240,7 @@
                 return
 
         if not os.path.isfile(viewer) or not proc.startDetached(
-            Globals.getPythonExecutable(), args
+            PythonUtilities.getPythonExecutable(), args
         ):
             EricMessageBox.critical(
                 self,
@@ -6290,7 +6299,7 @@
                         return
 
         if not os.path.isfile(viewer) or not proc.startDetached(
-            Globals.getPythonExecutable(), args
+            PythonUtilities.getPythonExecutable(), args
         ):
             EricMessageBox.critical(
                 self,
@@ -6313,7 +6322,7 @@
         args.append(browser)
 
         if not os.path.isfile(browser) or not proc.startDetached(
-            Globals.getPythonExecutable(), args
+            PythonUtilities.getPythonExecutable(), args
         ):
             EricMessageBox.critical(
                 self,
@@ -6403,7 +6412,7 @@
         args.append(snap)
 
         if not os.path.isfile(snap) or not proc.startDetached(
-            Globals.getPythonExecutable(), args
+            PythonUtilities.getPythonExecutable(), args
         ):
             EricMessageBox.critical(
                 self,
@@ -6580,7 +6589,7 @@
         """
         pythonDocDir = Preferences.getHelp("PythonDocDir")
         if not pythonDocDir:
-            if Utilities.isWindowsPlatform():
+            if OSUtilities.isWindowsPlatform():
                 venvName = Preferences.getDebugger("Python3VirtualEnv")
                 interpreter = (
                     ericApp()
@@ -6591,18 +6600,18 @@
                     default = os.path.join(os.path.dirname(interpreter), "doc")
                 else:
                     default = ""
-                pythonDocDir = Utilities.getEnvironmentEntry("PYTHON3DOCDIR", default)
+                pythonDocDir = OSUtilities.getEnvironmentEntry("PYTHON3DOCDIR", default)
             else:
-                pythonDocDir = Utilities.getEnvironmentEntry(
+                pythonDocDir = OSUtilities.getEnvironmentEntry(
                     "PYTHON3DOCDIR", "/usr/share/doc/packages/python3/html"
                 )
         if not pythonDocDir.startswith(("http://", "https://", "qthelp://")):
             if pythonDocDir.startswith("file://"):
                 pythonDocDir = pythonDocDir[7:]
             if not os.path.splitext(pythonDocDir)[1]:
-                home = Utilities.normjoinpath(pythonDocDir, "index.html")
-
-                if Utilities.isWindowsPlatform() and not os.path.exists(home):
+                home = FileSystemUtilities.normjoinpath(pythonDocDir, "index.html")
+
+                if OSUtilities.isWindowsPlatform() and not os.path.exists(home):
                     pyversion = sys.hexversion >> 16
                     vers = "{0:d}{1:d}".format(
                         (pyversion >> 8) & 0xFF, pyversion & 0xFF
@@ -6623,8 +6632,8 @@
                 return
 
             if not home.endswith(".chm"):
-                if Utilities.isWindowsPlatform():
-                    home = "file:///" + Utilities.fromNativeSeparators(home)
+                if OSUtilities.isWindowsPlatform():
+                    home = "file:///" + FileSystemUtilities.fromNativeSeparators(home)
                 else:
                     home = "file://" + home
         else:
@@ -6671,7 +6680,7 @@
             if qtDocDir.startswith("file://"):
                 qtDocDir = qtDocDir[7:]
             if not os.path.splitext(qtDocDir)[1]:
-                home = Utilities.normjoinpath(qtDocDir, "index.html")
+                home = FileSystemUtilities.normjoinpath(qtDocDir, "index.html")
             else:
                 home = qtDocDir
 
@@ -6686,8 +6695,8 @@
                 )
                 return
 
-            if Utilities.isWindowsPlatform():
-                home = "file:///" + Utilities.fromNativeSeparators(home)
+            if OSUtilities.isWindowsPlatform():
+                home = "file:///" + FileSystemUtilities.fromNativeSeparators(home)
             else:
                 home = "file://" + home
 
@@ -6715,7 +6724,7 @@
         """
         pyqtDocDir = Preferences.getHelp("PyQt{0}DocDir".format(variant))
         if not pyqtDocDir:
-            pyqtDocDir = Utilities.getEnvironmentEntry(
+            pyqtDocDir = OSUtilities.getEnvironmentEntry(
                 "PYQT{0}DOCDIR".format(variant), None
             )
 
@@ -6737,8 +6746,10 @@
                     pyqtDocDir = pyqtDocDir[7:]
                 if not os.path.splitext(pyqtDocDir)[1]:
                     possibleHomes = [
-                        Utilities.normjoinpath(pyqtDocDir, "index.html"),
-                        Utilities.normjoinpath(pyqtDocDir, "class_reference.html"),
+                        FileSystemUtilities.normjoinpath(pyqtDocDir, "index.html"),
+                        FileSystemUtilities.normjoinpath(
+                            pyqtDocDir, "class_reference.html"
+                        ),
                     ]
                     for possibleHome in possibleHomes:
                         if os.path.exists(possibleHome):
@@ -6758,8 +6769,8 @@
                 )
                 return
 
-            if Utilities.isWindowsPlatform():
-                home = "file:///" + Utilities.fromNativeSeparators(home)
+            if OSUtilities.isWindowsPlatform():
+                home = "file:///" + FileSystemUtilities.fromNativeSeparators(home)
             else:
                 home = "file://" + home
         else:
@@ -6786,7 +6797,7 @@
         """
         home = Preferences.getHelp("EricDocDir")
         if not home:
-            home = Utilities.normjoinpath(
+            home = FileSystemUtilities.normjoinpath(
                 getConfig("ericDocDir"), "Source", "index.html"
             )
 
@@ -6802,8 +6813,8 @@
                 )
                 return
 
-            if Utilities.isWindowsPlatform():
-                home = "file:///" + Utilities.fromNativeSeparators(home)
+            if OSUtilities.isWindowsPlatform():
+                home = "file:///" + FileSystemUtilities.fromNativeSeparators(home)
             else:
                 home = "file://" + home
 
@@ -6831,7 +6842,7 @@
         """
         pysideDocDir = Preferences.getHelp("PySide{0}DocDir".format(variant))
         if not pysideDocDir:
-            pysideDocDir = Utilities.getEnvironmentEntry(
+            pysideDocDir = OSUtilities.getEnvironmentEntry(
                 "PYSIDE{0}DOCDIR".format(variant), None
             )
 
@@ -6850,7 +6861,7 @@
             if pysideDocDir.startswith("file://"):
                 pysideDocDir = pysideDocDir[7:]
             if not os.path.splitext(pysideDocDir)[1]:
-                home = Utilities.normjoinpath(pysideDocDir, "index.html")
+                home = FileSystemUtilities.normjoinpath(pysideDocDir, "index.html")
             else:
                 home = pysideDocDir
             if not os.path.exists(home):
@@ -6864,8 +6875,8 @@
                 )
                 return
 
-            if Utilities.isWindowsPlatform():
-                home = "file:///" + Utilities.fromNativeSeparators(home)
+            if OSUtilities.isWindowsPlatform():
+                home = "file:///" + FileSystemUtilities.fromNativeSeparators(home)
             else:
                 home = "file://" + home
         else:
@@ -6950,14 +6961,12 @@
                     "--name={0}".format(self.__webBrowserSAName),
                     home,
                 ]
-                process.start(Globals.getPythonExecutable(), args)
+                process.start(PythonUtilities.getPythonExecutable(), args)
                 if not process.waitForStarted():
                     EricMessageBox.warning(
                         self,
                         self.tr("Start Web Browser"),
-                        self.tr(
-                            """The eric web browser could not be""" """ started."""
-                        ),
+                        self.tr("""The eric web browser could not be started."""),
                     )
                     return False
 
@@ -7355,7 +7364,7 @@
             self.tr("Import Keyboard Shortcuts"),
             "",
             self.tr(
-                "Keyboard Shortcuts File (*.ekj);;" "XML Keyboard shortcut file (*.e4k)"
+                "Keyboard Shortcuts File (*.ekj);;XML Keyboard shortcut file (*.e4k)"
             ),
         )
 
@@ -7514,20 +7523,20 @@
         """
         Private slot to write the tasks data to a JSON file (.etj).
         """
-        fn = os.path.join(Utilities.getConfigDir(), "eric7tasks.etj")
+        fn = os.path.join(Globals.getConfigDir(), "eric7tasks.etj")
         self.__tasksFile.writeFile(fn)
 
     def __readTasks(self):
         """
         Private slot to read in the tasks file (.etj or .e6t).
         """
-        fn = os.path.join(Utilities.getConfigDir(), "eric7tasks.etj")
+        fn = os.path.join(Globals.getConfigDir(), "eric7tasks.etj")
         if os.path.exists(fn):
             # try new style JSON file first
             self.__tasksFile.readFile(fn)
         else:
             # try old style XML file second
-            fn = os.path.join(Utilities.getConfigDir(), "eric7tasks.e6t")
+            fn = os.path.join(Globals.getConfigDir(), "eric7tasks.e6t")
             if os.path.exists(fn):
                 f = QFile(fn)
                 if f.open(QIODevice.OpenModeFlag.ReadOnly):
@@ -7539,7 +7548,7 @@
                         self,
                         self.tr("Read Tasks"),
                         self.tr(
-                            "<p>The tasks file <b>{0}</b> could not be" " read.</p>"
+                            "<p>The tasks file <b>{0}</b> could not be read.</p>"
                         ).format(fn),
                     )
 
@@ -7557,9 +7566,9 @@
         if filename:
             fn = filename
         elif crashSession:
-            fn = os.path.join(Utilities.getConfigDir(), "eric7_crash_session.esj")
+            fn = os.path.join(Globals.getConfigDir(), "eric7_crash_session.esj")
         else:
-            fn = os.path.join(Utilities.getConfigDir(), "eric7session.esj")
+            fn = os.path.join(Globals.getConfigDir(), "eric7session.esj")
 
         return self.__sessionFile.writeFile(fn)
 
@@ -7575,15 +7584,15 @@
         if filename:
             fn = filename
         else:
-            fn = os.path.join(Utilities.getConfigDir(), "eric7session.esj")
+            fn = os.path.join(Globals.getConfigDir(), "eric7session.esj")
             if not os.path.exists(fn):
-                fn = os.path.join(Utilities.getConfigDir(), "eric7session.e5s")
+                fn = os.path.join(Globals.getConfigDir(), "eric7session.e5s")
                 if not os.path.exists(fn):
                     EricMessageBox.critical(
                         self,
                         self.tr("Read Session"),
                         self.tr(
-                            "<p>The session file <b>{0}</b> could not" " be read.</p>"
+                            "<p>The session file <b>{0}</b> could not be read.</p>"
                         ).format(fn),
                     )
                     fn = ""
@@ -7610,7 +7619,7 @@
                         self,
                         self.tr("Read session"),
                         self.tr(
-                            "<p>The session file <b>{0}</b> could not be" " read.</p>"
+                            "<p>The session file <b>{0}</b> could not be read.</p>"
                         ).format(fn),
                     )
 
@@ -7626,7 +7635,7 @@
         sessionFile, selectedFilter = EricFileDialog.getSaveFileNameAndFilter(
             self,
             self.tr("Save Session"),
-            Utilities.getHomeDir(),
+            OSUtilities.getHomeDir(),
             self.tr("eric Session Files (*.esj)"),
             "",
         )
@@ -7649,8 +7658,8 @@
         sessionFile = EricFileDialog.getOpenFileName(
             self,
             self.tr("Load session"),
-            Utilities.getHomeDir(),
-            self.tr("eric Session Files (*.esj);;" "eric XML Session Files (*.e5s)"),
+            OSUtilities.getHomeDir(),
+            self.tr("eric Session Files (*.esj);;eric XML Session Files (*.e5s)"),
         )
 
         if not sessionFile:
@@ -7663,7 +7672,7 @@
         Private slot to delete the crash session file.
         """
         for ext in (".esj", ".e5s"):
-            fn = os.path.join(Utilities.getConfigDir(), f"eric7_crash_session{ext}")
+            fn = os.path.join(Globals.getConfigDir(), f"eric7_crash_session{ext}")
             if os.path.exists(fn):
                 with contextlib.suppress(OSError):
                     os.remove(fn)
@@ -7692,7 +7701,7 @@
             and not self.__noCrashOpenAtStartup
             and Preferences.getUI("OpenCrashSessionOnStartup")
         ):
-            fn = os.path.join(Utilities.getConfigDir(), "eric7_crash_session.esj")
+            fn = os.path.join(Globals.getConfigDir(), "eric7_crash_session.esj")
             if os.path.exists(fn):
                 yes = EricMessageBox.yesNo(
                     self,
@@ -7953,6 +7962,11 @@
 
         self.pluginRepositoryViewer.reloadList()
 
+        if self.__findFileWidget:
+            self.__findFileWidget.populateFileCategories()
+        if self.__findFileDialog:
+            self.__findFileDialog.populateFileCategories()
+
     def __deinstallPlugin(self):
         """
         Private slot to show a dialog to uninstall a plugin.
@@ -7962,6 +7976,11 @@
         dlg = PluginUninstallDialog(self.pluginManager, self)
         dlg.exec()
 
+        if self.__findFileWidget:
+            self.__findFileWidget.populateFileCategories()
+        if self.__findFileDialog:
+            self.__findFileDialog.populateFileCategories()
+
     @pyqtSlot()
     def __showPluginsAvailable(self):
         """
@@ -8309,7 +8328,7 @@
 
         workspace = Preferences.getMultiProject("Workspace")
         if workspace == "":
-            default = Utilities.getHomeDir()
+            default = OSUtilities.getHomeDir()
             workspace = EricFileDialog.getExistingDirectory(
                 None,
                 self.tr("Select Workspace Directory"),
@@ -8344,9 +8363,9 @@
                 vers = VersionOnly.split("snapshot-")[1]
                 return vers > snapshot
 
-        versionTuple = self.__versionToTuple(VersionOnly)
+        versionTuple = Globals.versionToTuple(VersionOnly)
         if isinstance(required, str):
-            required = self.__versionToTuple(required)
+            required = Globals.versionToTuple(required)
         try:
             res = versionTuple > required
         except TypeError:
@@ -8354,27 +8373,6 @@
             res = True
         return res
 
-    def __versionToTuple(self, version):
-        """
-        Private method to convert a version string into a tuple.
-
-        @param version version string
-        @type str
-        @return version tuple
-        @rtype tuple of int
-        """
-        versionParts = []
-        for part in version.split("."):
-            part = part.strip()
-            if part:
-                try:
-                    part = int(part)
-                except ValueError:
-                    # not an integer, ignore
-                    continue
-                versionParts.append(part)
-        return tuple(versionParts)
-
     #################################
     ## Below are some utility methods
     #################################
@@ -8494,9 +8492,7 @@
                 res = EricMessageBox.warning(
                     self,
                     self.tr("Unsaved Data Detected"),
-                    self.tr(
-                        "Some editors contain unsaved data. Shall these" " be saved?"
-                    ),
+                    self.tr("Some editors contain unsaved data. Shall these be saved?"),
                     EricMessageBox.Abort
                     | EricMessageBox.Discard
                     | EricMessageBox.Save

eric ide

mercurial