src/eric7/UI/UserInterface.py

branch
eric7-maintenance
changeset 11063
bb05d1db9286
parent 11019
27cd57e98461
parent 11056
cef972a17097
child 11118
967a88a16a21
--- a/src/eric7/UI/UserInterface.py	Thu Oct 31 10:54:59 2024 +0100
+++ b/src/eric7/UI/UserInterface.py	Sat Nov 30 11:08:07 2024 +0100
@@ -1677,7 +1677,7 @@
         opens = 0
         for filename in args.file_or_project:
             try:
-                ext = os.path.normcase(os.path.splitext(filename)[1])
+                ext = os.path.splitext(filename)[1].lower()
             except IndexError:
                 ext = ""
 
@@ -3855,7 +3855,7 @@
         ## Remote Server menu
         ##############################################################
 
-        self.__menus["server"] = self.__ericServerInterface.initMenu()
+        self.__menus["server"] = self.__ericServerInterface.initMenus()
 
         ##############################################################
         ## Sessions menu
@@ -5163,7 +5163,7 @@
 
         return False
 
-    def __performUpgrade(self, upgradeType):
+    def __performUpgrade(self, upgradeType, startup=False):
         """
         Private method to perform the requested upgrade operation.
 
@@ -5174,10 +5174,14 @@
         @param upgradeType upgrade operation (one of 'eric', 'ericpyqt',
             'pyqt')
         @type str
+        @param startup flag indicating a call during the IDE startup (defaults to False)
+        @type bool (optional)
         """
         ericApp().closeAllWindows()
         program = PythonUtilities.getPythonExecutable()
-        ericStartArgs = ["-m", "eric7", "--start-session"]
+        ericStartArgs = (
+            ["-m", "eric7"] if startup else ["-m", "eric7", "--start-session"]
+        )
         ericStartArgs.extend(self.__restartArgs)
 
         upgrader = os.path.join(os.path.dirname(__file__), "upgrader.py")
@@ -6577,7 +6581,6 @@
         dlg = IconEditorWindow(fn, self, fromEric=True, project=self.project)
         dlg.show()
 
-    @pyqtSlot()
     @pyqtSlot(str)
     def __showPixmap(self, fn):
         """
@@ -6592,7 +6595,6 @@
         if dlg.getStatus():
             dlg.show()
 
-    @pyqtSlot()
     @pyqtSlot(str)
     def __showSvg(self, fn):
         """
@@ -8533,6 +8535,10 @@
         # shut down the global file system watcher
         EricFileSystemWatcher.instance().shutdown()
 
+        # revert changes to sys.stdout and sys.stderr
+        sys.stdout = sys.__stdout__
+        sys.stderr = sys.__stderr__
+
         return True
 
     def isOnline(self):
@@ -8558,18 +8564,23 @@
     ## Below are methods to check for new versions
     ##############################################
 
-    def performVersionCheck(self):
+    def performVersionCheck(self, startup=False):
         """
         Public method to check for an update even if not installed via PyPI.
+
+        @param startup flag indicating a call during the IDE startup (defaults to False)
+        @type bool (optional)
+        @return flag indicating an upgrade is available and was selected by the user
+        @rtype bool
         """
         if self.isOnline():
             if VersionOnly.startswith(("rev_", "@@")):
                 # cannot check against development or source installation
-                return
+                return False
             else:
                 period = Preferences.getUI("PerformVersionCheck")
                 if period == 0:
-                    return
+                    return False
                 elif period in [2, 3, 4]:
                     lastCheck = Preferences.getSettings().value(
                         "Updates/LastCheckDate", QDate(1970, 1, 1)
@@ -8585,7 +8596,7 @@
                             )
                         ):
                             # daily, weekly, monthly
-                            return
+                            return False
 
             versionTuple = EricUtilities.versionToTuple(VersionOnly)
             availableVersions = self.pipInterface.getPackageVersions("eric-ide")
@@ -8615,7 +8626,10 @@
                     ),
                 )
                 if yes and self.__shutdown():
-                    self.__performUpgrade("eric")
+                    self.__performUpgrade("eric", startup=startup)
+                    return True
+
+        return False
 
     def __sslErrors(self, reply, errors):
         """

eric ide

mercurial