src/eric7/UI/UserInterface.py

branch
eric7
changeset 11045
72202235e0bb
parent 11033
6b197c3389f7
child 11056
cef972a17097
equal deleted inserted replaced
11044:6d9f0f28de34 11045:72202235e0bb
5161 self.__performUpgrade("ericpyqt") 5161 self.__performUpgrade("ericpyqt")
5162 return True 5162 return True
5163 5163
5164 return False 5164 return False
5165 5165
5166 def __performUpgrade(self, upgradeType): 5166 def __performUpgrade(self, upgradeType, startup=False):
5167 """ 5167 """
5168 Private method to perform the requested upgrade operation. 5168 Private method to perform the requested upgrade operation.
5169 5169
5170 This action needs to shut down eric first, start a non-PyQt application 5170 This action needs to shut down eric first, start a non-PyQt application
5171 performing the upgrade of the PyQt packages via pip and restart eric 5171 performing the upgrade of the PyQt packages via pip and restart eric
5172 with the passed arguments. The upgrade process is not visible. 5172 with the passed arguments. The upgrade process is not visible.
5173 5173
5174 @param upgradeType upgrade operation (one of 'eric', 'ericpyqt', 5174 @param upgradeType upgrade operation (one of 'eric', 'ericpyqt',
5175 'pyqt') 5175 'pyqt')
5176 @type str 5176 @type str
5177 @param startup flag indicating a call during the IDE startup (defaults to False)
5178 @type bool (optional)
5177 """ 5179 """
5178 ericApp().closeAllWindows() 5180 ericApp().closeAllWindows()
5179 program = PythonUtilities.getPythonExecutable() 5181 program = PythonUtilities.getPythonExecutable()
5180 ericStartArgs = ["-m", "eric7", "--start-session"] 5182 ericStartArgs = (
5183 ["-m", "eric7"] if startup else ["-m", "eric7", "--start-session"]
5184 )
5181 ericStartArgs.extend(self.__restartArgs) 5185 ericStartArgs.extend(self.__restartArgs)
5182 5186
5183 upgrader = os.path.join(os.path.dirname(__file__), "upgrader.py") 5187 upgrader = os.path.join(os.path.dirname(__file__), "upgrader.py")
5184 upgraderArgs = [ 5188 upgraderArgs = [
5185 upgrader, 5189 upgrader,
8560 8564
8561 ############################################## 8565 ##############################################
8562 ## Below are methods to check for new versions 8566 ## Below are methods to check for new versions
8563 ############################################## 8567 ##############################################
8564 8568
8565 def performVersionCheck(self): 8569 def performVersionCheck(self, startup=False):
8566 """ 8570 """
8567 Public method to check for an update even if not installed via PyPI. 8571 Public method to check for an update even if not installed via PyPI.
8572
8573 @param startup flag indicating a call during the IDE startup (defaults to False)
8574 @type bool (optional)
8575 @return flag indicating an upgrade is available and was selected by the user
8576 @rtype bool
8568 """ 8577 """
8569 if self.isOnline(): 8578 if self.isOnline():
8570 if VersionOnly.startswith(("rev_", "@@")): 8579 if VersionOnly.startswith(("rev_", "@@")):
8571 # cannot check against development or source installation 8580 # cannot check against development or source installation
8572 return 8581 return False
8573 else: 8582 else:
8574 period = Preferences.getUI("PerformVersionCheck") 8583 period = Preferences.getUI("PerformVersionCheck")
8575 if period == 0: 8584 if period == 0:
8576 return 8585 return False
8577 elif period in [2, 3, 4]: 8586 elif period in [2, 3, 4]:
8578 lastCheck = Preferences.getSettings().value( 8587 lastCheck = Preferences.getSettings().value(
8579 "Updates/LastCheckDate", QDate(1970, 1, 1) 8588 "Updates/LastCheckDate", QDate(1970, 1, 1)
8580 ) 8589 )
8581 if lastCheck.isValid(): 8590 if lastCheck.isValid():
8587 period == 4 8596 period == 4
8588 and (lastCheck.daysTo(now) < lastCheck.daysInMonth()) 8597 and (lastCheck.daysTo(now) < lastCheck.daysInMonth())
8589 ) 8598 )
8590 ): 8599 ):
8591 # daily, weekly, monthly 8600 # daily, weekly, monthly
8592 return 8601 return False
8593 8602
8594 versionTuple = EricUtilities.versionToTuple(VersionOnly) 8603 versionTuple = EricUtilities.versionToTuple(VersionOnly)
8595 availableVersions = self.pipInterface.getPackageVersions("eric-ide") 8604 availableVersions = self.pipInterface.getPackageVersions("eric-ide")
8596 newerVersionsTuple = [ 8605 newerVersionsTuple = [
8597 EricUtilities.versionToTuple(v) 8606 EricUtilities.versionToTuple(v)
8617 if p not in (0, None) 8626 if p not in (0, None)
8618 ), 8627 ),
8619 ), 8628 ),
8620 ) 8629 )
8621 if yes and self.__shutdown(): 8630 if yes and self.__shutdown():
8622 self.__performUpgrade("eric") 8631 self.__performUpgrade("eric", startup=startup)
8632 return True
8633
8634 return False
8623 8635
8624 def __sslErrors(self, reply, errors): 8636 def __sslErrors(self, reply, errors):
8625 """ 8637 """
8626 Private slot to handle SSL errors. 8638 Private slot to handle SSL errors.
8627 8639

eric ide

mercurial