src/eric7/UI/UserInterface.py

branch
eric7
changeset 11045
72202235e0bb
parent 11033
6b197c3389f7
child 11056
cef972a17097
diff -r 6d9f0f28de34 -r 72202235e0bb src/eric7/UI/UserInterface.py
--- a/src/eric7/UI/UserInterface.py	Sat Nov 09 15:59:29 2024 +0100
+++ b/src/eric7/UI/UserInterface.py	Sat Nov 09 17:09:09 2024 +0100
@@ -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")
@@ -8562,18 +8566,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)
@@ -8589,7 +8598,7 @@
                             )
                         ):
                             # daily, weekly, monthly
-                            return
+                            return False
 
             versionTuple = EricUtilities.versionToTuple(VersionOnly)
             availableVersions = self.pipInterface.getPackageVersions("eric-ide")
@@ -8619,7 +8628,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