src/eric7/UI/UserInterface.py

branch
eric7-maintenance
changeset 11063
bb05d1db9286
parent 11019
27cd57e98461
parent 11056
cef972a17097
child 11118
967a88a16a21
equal deleted inserted replaced
11020:b011307033d5 11063:bb05d1db9286
1675 return 1675 return
1676 1676
1677 opens = 0 1677 opens = 0
1678 for filename in args.file_or_project: 1678 for filename in args.file_or_project:
1679 try: 1679 try:
1680 ext = os.path.normcase(os.path.splitext(filename)[1]) 1680 ext = os.path.splitext(filename)[1].lower()
1681 except IndexError: 1681 except IndexError:
1682 ext = "" 1682 ext = ""
1683 1683
1684 if ext in (".epj",): 1684 if ext in (".epj",):
1685 self.project.openProject(filename) 1685 self.project.openProject(filename)
3853 3853
3854 ############################################################## 3854 ##############################################################
3855 ## Remote Server menu 3855 ## Remote Server menu
3856 ############################################################## 3856 ##############################################################
3857 3857
3858 self.__menus["server"] = self.__ericServerInterface.initMenu() 3858 self.__menus["server"] = self.__ericServerInterface.initMenus()
3859 3859
3860 ############################################################## 3860 ##############################################################
3861 ## Sessions menu 3861 ## Sessions menu
3862 ############################################################## 3862 ##############################################################
3863 3863
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,
6575 from eric7.IconEditor.IconEditorWindow import IconEditorWindow 6579 from eric7.IconEditor.IconEditorWindow import IconEditorWindow
6576 6580
6577 dlg = IconEditorWindow(fn, self, fromEric=True, project=self.project) 6581 dlg = IconEditorWindow(fn, self, fromEric=True, project=self.project)
6578 dlg.show() 6582 dlg.show()
6579 6583
6580 @pyqtSlot()
6581 @pyqtSlot(str) 6584 @pyqtSlot(str)
6582 def __showPixmap(self, fn): 6585 def __showPixmap(self, fn):
6583 """ 6586 """
6584 Private slot to show a pixmap in a dialog. 6587 Private slot to show a pixmap in a dialog.
6585 6588
6590 6593
6591 dlg = PixmapDiagram(fn, self) 6594 dlg = PixmapDiagram(fn, self)
6592 if dlg.getStatus(): 6595 if dlg.getStatus():
6593 dlg.show() 6596 dlg.show()
6594 6597
6595 @pyqtSlot()
6596 @pyqtSlot(str) 6598 @pyqtSlot(str)
6597 def __showSvg(self, fn): 6599 def __showSvg(self, fn):
6598 """ 6600 """
6599 Private slot to show a SVG file in a dialog. 6601 Private slot to show a SVG file in a dialog.
6600 6602
8531 self.shutdownCalled = True 8533 self.shutdownCalled = True
8532 8534
8533 # shut down the global file system watcher 8535 # shut down the global file system watcher
8534 EricFileSystemWatcher.instance().shutdown() 8536 EricFileSystemWatcher.instance().shutdown()
8535 8537
8538 # revert changes to sys.stdout and sys.stderr
8539 sys.stdout = sys.__stdout__
8540 sys.stderr = sys.__stderr__
8541
8536 return True 8542 return True
8537 8543
8538 def isOnline(self): 8544 def isOnline(self):
8539 """ 8545 """
8540 Public method to get the online state. 8546 Public method to get the online state.
8556 8562
8557 ############################################## 8563 ##############################################
8558 ## Below are methods to check for new versions 8564 ## Below are methods to check for new versions
8559 ############################################## 8565 ##############################################
8560 8566
8561 def performVersionCheck(self): 8567 def performVersionCheck(self, startup=False):
8562 """ 8568 """
8563 Public method to check for an update even if not installed via PyPI. 8569 Public method to check for an update even if not installed via PyPI.
8570
8571 @param startup flag indicating a call during the IDE startup (defaults to False)
8572 @type bool (optional)
8573 @return flag indicating an upgrade is available and was selected by the user
8574 @rtype bool
8564 """ 8575 """
8565 if self.isOnline(): 8576 if self.isOnline():
8566 if VersionOnly.startswith(("rev_", "@@")): 8577 if VersionOnly.startswith(("rev_", "@@")):
8567 # cannot check against development or source installation 8578 # cannot check against development or source installation
8568 return 8579 return False
8569 else: 8580 else:
8570 period = Preferences.getUI("PerformVersionCheck") 8581 period = Preferences.getUI("PerformVersionCheck")
8571 if period == 0: 8582 if period == 0:
8572 return 8583 return False
8573 elif period in [2, 3, 4]: 8584 elif period in [2, 3, 4]:
8574 lastCheck = Preferences.getSettings().value( 8585 lastCheck = Preferences.getSettings().value(
8575 "Updates/LastCheckDate", QDate(1970, 1, 1) 8586 "Updates/LastCheckDate", QDate(1970, 1, 1)
8576 ) 8587 )
8577 if lastCheck.isValid(): 8588 if lastCheck.isValid():
8583 period == 4 8594 period == 4
8584 and (lastCheck.daysTo(now) < lastCheck.daysInMonth()) 8595 and (lastCheck.daysTo(now) < lastCheck.daysInMonth())
8585 ) 8596 )
8586 ): 8597 ):
8587 # daily, weekly, monthly 8598 # daily, weekly, monthly
8588 return 8599 return False
8589 8600
8590 versionTuple = EricUtilities.versionToTuple(VersionOnly) 8601 versionTuple = EricUtilities.versionToTuple(VersionOnly)
8591 availableVersions = self.pipInterface.getPackageVersions("eric-ide") 8602 availableVersions = self.pipInterface.getPackageVersions("eric-ide")
8592 newerVersionsTuple = [ 8603 newerVersionsTuple = [
8593 EricUtilities.versionToTuple(v) 8604 EricUtilities.versionToTuple(v)
8613 if p not in (0, None) 8624 if p not in (0, None)
8614 ), 8625 ),
8615 ), 8626 ),
8616 ) 8627 )
8617 if yes and self.__shutdown(): 8628 if yes and self.__shutdown():
8618 self.__performUpgrade("eric") 8629 self.__performUpgrade("eric", startup=startup)
8630 return True
8631
8632 return False
8619 8633
8620 def __sslErrors(self, reply, errors): 8634 def __sslErrors(self, reply, errors):
8621 """ 8635 """
8622 Private slot to handle SSL errors. 8636 Private slot to handle SSL errors.
8623 8637

eric ide

mercurial