Sat, 09 Nov 2024 17:09:09 +0100
Optimized the startup procedure to check for an upgrade before everything else.
--- a/src/eric7/APIs/Python3/eric7.api Sat Nov 09 15:59:29 2024 +0100 +++ b/src/eric7/APIs/Python3/eric7.api Sat Nov 09 17:09:09 2024 +0100 @@ -11191,7 +11191,7 @@ eric7.UI.UserInterface.UserInterface.maxMenuFilePathLen?7 eric7.UI.UserInterface.UserInterface.networkAccessManager?4() eric7.UI.UserInterface.UserInterface.onlineStateChanged?7 -eric7.UI.UserInterface.UserInterface.performVersionCheck?4() +eric7.UI.UserInterface.UserInterface.performVersionCheck?4(startup=False) eric7.UI.UserInterface.UserInterface.preferencesChanged?7 eric7.UI.UserInterface.UserInterface.processArgs?4(args) eric7.UI.UserInterface.UserInterface.processInstallInfoFile?4()
--- a/src/eric7/Documentation/Source/eric7.UI.UserInterface.html Sat Nov 09 15:59:29 2024 +0100 +++ b/src/eric7/Documentation/Source/eric7.UI.UserInterface.html Sat Nov 09 17:09:09 2024 +0100 @@ -2099,7 +2099,7 @@ </dl> <a NAME="UserInterface.__performUpgrade" ID="UserInterface.__performUpgrade"></a> <h4>UserInterface.__performUpgrade</h4> -<b>__performUpgrade</b>(<i>upgradeType</i>) +<b>__performUpgrade</b>(<i>upgradeType, startup=False</i>) <p> Private method to perform the requested upgrade operation. </p> @@ -2116,6 +2116,10 @@ upgrade operation (one of 'eric', 'ericpyqt', 'pyqt') </dd> +<dt><i>startup</i> (bool (optional))</dt> +<dd> +flag indicating a call during the IDE startup (defaults to False) +</dd> </dl> <a NAME="UserInterface.__pluginInstallFinished" ID="UserInterface.__pluginInstallFinished"></a> <h4>UserInterface.__pluginInstallFinished</h4> @@ -3619,11 +3623,30 @@ </dl> <a NAME="UserInterface.performVersionCheck" ID="UserInterface.performVersionCheck"></a> <h4>UserInterface.performVersionCheck</h4> -<b>performVersionCheck</b>(<i></i>) +<b>performVersionCheck</b>(<i>startup=False</i>) <p> Public method to check for an update even if not installed via PyPI. </p> +<dl> + +<dt><i>startup</i> (bool (optional))</dt> +<dd> +flag indicating a call during the IDE startup (defaults to False) +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +flag indicating an upgrade is available and was selected by the user +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl> <a NAME="UserInterface.processArgs" ID="UserInterface.processArgs"></a> <h4>UserInterface.processArgs</h4> <b>processArgs</b>(<i>args</i>)
--- 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): """
--- a/src/eric7/eric7_ide.py Sat Nov 09 15:59:29 2024 +0100 +++ b/src/eric7/eric7_ide.py Sat Nov 09 17:09:09 2024 +0100 @@ -312,13 +312,13 @@ del splash mainWindow.checkForErrorLog() - mainWindow.processArgs(args) - mainWindow.processInstallInfoFile() - mainWindow.checkProjectsWorkspace() - mainWindow.checkConfigurationStatus() - mainWindow.performVersionCheck() - mainWindow.checkPluginUpdatesAvailable() - mainWindow.autoConnectIrc() + if not mainWindow.performVersionCheck(startup=True): + mainWindow.processArgs(args) + mainWindow.processInstallInfoFile() + mainWindow.checkProjectsWorkspace() + mainWindow.checkConfigurationStatus() + mainWindow.checkPluginUpdatesAvailable() + mainWindow.autoConnectIrc() def main():