UI/UserInterface.py

changeset 15
f6ccc31d6e72
parent 13
1af94a91f439
child 18
3b1f5d872fd7
equal deleted inserted replaced
14:092aa8fafa4e 15:f6ccc31d6e72
98 from E4XML.SessionWriter import SessionWriter 98 from E4XML.SessionWriter import SessionWriter
99 from E4XML.SessionHandler import SessionHandler 99 from E4XML.SessionHandler import SessionHandler
100 100
101 from IconEditor.IconEditorWindow import IconEditorWindow 101 from IconEditor.IconEditorWindow import IconEditorWindow
102 102
103 from eric4config import getConfig 103 from eric5config import getConfig
104 104
105 105
106 class Redirector(QObject): 106 class Redirector(QObject):
107 """ 107 """
108 Helper class used to redirect stdout and stderr to the log window 108 Helper class used to redirect stdout and stderr to the log window
1115 @param args list of files to open<br /> 1115 @param args list of files to open<br />
1116 The args are processed one at a time. All arguments after a 1116 The args are processed one at a time. All arguments after a
1117 '--' option are considered debug arguments to the program 1117 '--' option are considered debug arguments to the program
1118 for the debugger. All files named before the '--' option 1118 for the debugger. All files named before the '--' option
1119 are opened in a text editor, unless the argument ends in 1119 are opened in a text editor, unless the argument ends in
1120 .e3p, .e3pz, .e4p or .e4pz, then it is opened as a project file. 1120 .e4p or .e4pz, then it is opened as a project file.
1121 If it ends in .e4m or .e4mz, it is opened as a multiproject. 1121 If it ends in .e4m or .e4mz, it is opened as a multiproject.
1122 """ 1122 """
1123 # no args, return 1123 # no args, return
1124 if args is None: 1124 if args is None:
1125 if not self.__noOpenAtStartup: 1125 if not self.__noOpenAtStartup:
1157 continue 1157 continue
1158 1158
1159 ext = os.path.splitext(arg)[1] 1159 ext = os.path.splitext(arg)[1]
1160 ext = os.path.normcase(ext) 1160 ext = os.path.normcase(ext)
1161 1161
1162 if ext in ['.e4p', '.e4pz', '.e3p', '.e3pz']: 1162 if ext in ['.e4p', '.e4pz']:
1163 self.project.openProject(arg) 1163 self.project.openProject(arg)
1164 opens += 1 1164 opens += 1
1165 elif ext in ['.e4m', '.e4mz']: 1165 elif ext in ['.e4m', '.e4mz']:
1166 self.multiProject.openMultiProject(arg) 1166 self.multiProject.openMultiProject(arg)
1167 opens += 1 1167 opens += 1
1560 QKeySequence(self.trUtf8("F1")), 1560 QKeySequence(self.trUtf8("F1")),
1561 0, self, 'helpviewer') 1561 0, self, 'helpviewer')
1562 self.helpviewerAct.setStatusTip(self.trUtf8('Open the helpviewer window')) 1562 self.helpviewerAct.setStatusTip(self.trUtf8('Open the helpviewer window'))
1563 self.helpviewerAct.setWhatsThis(self.trUtf8( 1563 self.helpviewerAct.setWhatsThis(self.trUtf8(
1564 """<b>Helpviewer</b>""" 1564 """<b>Helpviewer</b>"""
1565 """<p>Display the eric4 web browser. This window will show""" 1565 """<p>Display the eric5 web browser. This window will show"""
1566 """ HTML help files and help from Qt help collections. It has the""" 1566 """ HTML help files and help from Qt help collections. It has the"""
1567 """ capability to navigate to links, set bookmarks, print the displayed""" 1567 """ capability to navigate to links, set bookmarks, print the displayed"""
1568 """ help and some more features. You may use it to browse the internet""" 1568 """ help and some more features. You may use it to browse the internet"""
1569 """ as well</p><p>If called with a word selected, this word is search""" 1569 """ as well</p><p>If called with a word selected, this word is search"""
1570 """ in the Qt help collection.</p>""" 1570 """ in the Qt help collection.</p>"""
1590 self.checkUpdateAct = E4Action(self.trUtf8('Check for Updates'), 1590 self.checkUpdateAct = E4Action(self.trUtf8('Check for Updates'),
1591 self.trUtf8('Check for &Updates...'), 0, 0, self, 'check_updates') 1591 self.trUtf8('Check for &Updates...'), 0, 0, self, 'check_updates')
1592 self.checkUpdateAct.setStatusTip(self.trUtf8('Check for Updates')) 1592 self.checkUpdateAct.setStatusTip(self.trUtf8('Check for Updates'))
1593 self.checkUpdateAct.setWhatsThis(self.trUtf8( 1593 self.checkUpdateAct.setWhatsThis(self.trUtf8(
1594 """<b>Check for Updates...</b>""" 1594 """<b>Check for Updates...</b>"""
1595 """<p>Checks the internet for updates of eric4.</p>""" 1595 """<p>Checks the internet for updates of eric5.</p>"""
1596 )) 1596 ))
1597 self.connect(self.checkUpdateAct, SIGNAL('triggered()'), self.performVersionCheck) 1597 self.connect(self.checkUpdateAct, SIGNAL('triggered()'), self.performVersionCheck)
1598 self.actions.append(self.checkUpdateAct) 1598 self.actions.append(self.checkUpdateAct)
1599 1599
1600 self.showVersionsAct = E4Action(self.trUtf8('Show downloadable versions'), 1600 self.showVersionsAct = E4Action(self.trUtf8('Show downloadable versions'),
1602 0, 0, self, 'show_downloadable_versions') 1602 0, 0, self, 'show_downloadable_versions')
1603 self.showVersionsAct.setStatusTip(\ 1603 self.showVersionsAct.setStatusTip(\
1604 self.trUtf8('Show the versions available for download')) 1604 self.trUtf8('Show the versions available for download'))
1605 self.showVersionsAct.setWhatsThis(self.trUtf8( 1605 self.showVersionsAct.setWhatsThis(self.trUtf8(
1606 """<b>Show downloadable versions...</b>""" 1606 """<b>Show downloadable versions...</b>"""
1607 """<p>Shows the eric4 versions available for download """ 1607 """<p>Shows the eric5 versions available for download """
1608 """from the internet.</p>""" 1608 """from the internet.</p>"""
1609 )) 1609 ))
1610 self.connect(self.showVersionsAct, SIGNAL('triggered()'), 1610 self.connect(self.showVersionsAct, SIGNAL('triggered()'),
1611 self.showAvailableVersionsInfo) 1611 self.showAvailableVersionsInfo)
1612 self.actions.append(self.showVersionsAct) 1612 self.actions.append(self.showVersionsAct)
1792 1792
1793 self.webBrowserAct = E4Action(self.trUtf8('Web Browser'), 1793 self.webBrowserAct = E4Action(self.trUtf8('Web Browser'),
1794 UI.PixmapCache.getIcon("ericWeb.png"), 1794 UI.PixmapCache.getIcon("ericWeb.png"),
1795 self.trUtf8('&Web Browser...'), 1795 self.trUtf8('&Web Browser...'),
1796 0, 0, self, 'web_browser') 1796 0, 0, self, 'web_browser')
1797 self.webBrowserAct.setStatusTip(self.trUtf8('Start the eric4 Web Browser')) 1797 self.webBrowserAct.setStatusTip(self.trUtf8('Start the eric5 Web Browser'))
1798 self.webBrowserAct.setWhatsThis(self.trUtf8( 1798 self.webBrowserAct.setWhatsThis(self.trUtf8(
1799 """<b>Web Browser</b>""" 1799 """<b>Web Browser</b>"""
1800 """<p>Browse the Internet with the eric4 Web Browser.</p>""" 1800 """<p>Browse the Internet with the eric5 Web Browser.</p>"""
1801 )) 1801 ))
1802 self.connect(self.webBrowserAct, SIGNAL('triggered()'), self.__webBrowser) 1802 self.connect(self.webBrowserAct, SIGNAL('triggered()'), self.__webBrowser)
1803 self.actions.append(self.webBrowserAct) 1803 self.actions.append(self.webBrowserAct)
1804 1804
1805 self.iconEditorAct = E4Action(self.trUtf8('Icon Editor'), 1805 self.iconEditorAct = E4Action(self.trUtf8('Icon Editor'),
1806 UI.PixmapCache.getIcon("iconEditor.png"), 1806 UI.PixmapCache.getIcon("iconEditor.png"),
1807 self.trUtf8('&Icon Editor...'), 1807 self.trUtf8('&Icon Editor...'),
1808 0, 0, self, 'icon_editor') 1808 0, 0, self, 'icon_editor')
1809 self.iconEditorAct.setStatusTip(self.trUtf8('Start the eric4 Icon Editor')) 1809 self.iconEditorAct.setStatusTip(self.trUtf8('Start the eric5 Icon Editor'))
1810 self.iconEditorAct.setWhatsThis(self.trUtf8( 1810 self.iconEditorAct.setWhatsThis(self.trUtf8(
1811 """<b>Icon Editor</b>""" 1811 """<b>Icon Editor</b>"""
1812 """<p>Starts the eric4 Icon Editor for editing simple icons.</p>""" 1812 """<p>Starts the eric5 Icon Editor for editing simple icons.</p>"""
1813 )) 1813 ))
1814 self.connect(self.iconEditorAct, SIGNAL('triggered()'), self.__editPixmap) 1814 self.connect(self.iconEditorAct, SIGNAL('triggered()'), self.__editPixmap)
1815 self.actions.append(self.iconEditorAct) 1815 self.actions.append(self.iconEditorAct)
1816 1816
1817 self.prefAct = E4Action(self.trUtf8('Preferences'), 1817 self.prefAct = E4Action(self.trUtf8('Preferences'),
1864 self.trUtf8('Show external &tools'), 0, 0, self, 'show_external_tools') 1864 self.trUtf8('Show external &tools'), 0, 0, self, 'show_external_tools')
1865 self.showExternalToolsAct.setStatusTip(self.trUtf8('Reload the API information')) 1865 self.showExternalToolsAct.setStatusTip(self.trUtf8('Reload the API information'))
1866 self.showExternalToolsAct.setWhatsThis(self.trUtf8( 1866 self.showExternalToolsAct.setWhatsThis(self.trUtf8(
1867 """<b>Show external tools</b>""" 1867 """<b>Show external tools</b>"""
1868 """<p>Opens a dialog to show the path and versions of all""" 1868 """<p>Opens a dialog to show the path and versions of all"""
1869 """ extenal tools used by eric4.</p>""" 1869 """ extenal tools used by eric5.</p>"""
1870 )) 1870 ))
1871 self.connect(self.showExternalToolsAct, SIGNAL('triggered()'), 1871 self.connect(self.showExternalToolsAct, SIGNAL('triggered()'),
1872 self.__showExternalTools) 1872 self.__showExternalTools)
1873 self.actions.append(self.showExternalToolsAct) 1873 self.actions.append(self.showExternalToolsAct)
1874 1874
2079 self.connect(self.pythonDocAct, SIGNAL('triggered()'), self.__showPythonDoc) 2079 self.connect(self.pythonDocAct, SIGNAL('triggered()'), self.__showPythonDoc)
2080 self.actions.append(self.pythonDocAct) 2080 self.actions.append(self.pythonDocAct)
2081 2081
2082 def __initEricDocAction(self): 2082 def __initEricDocAction(self):
2083 """ 2083 """
2084 Private slot to initialize the action to show the eric4 documentation. 2084 Private slot to initialize the action to show the eric5 documentation.
2085 """ 2085 """
2086 self.ericDocAct = E4Action(self.trUtf8("Eric API Documentation"), 2086 self.ericDocAct = E4Action(self.trUtf8("Eric API Documentation"),
2087 self.trUtf8('&Eric API Documentation'), 0, 0, self, 'eric_documentation') 2087 self.trUtf8('&Eric API Documentation'), 0, 0, self, 'eric_documentation')
2088 self.ericDocAct.setStatusTip(self.trUtf8("Open Eric API Documentation")) 2088 self.ericDocAct.setStatusTip(self.trUtf8("Open Eric API Documentation"))
2089 self.ericDocAct.setWhatsThis(self.trUtf8( 2089 self.ericDocAct.setWhatsThis(self.trUtf8(
2090 """<b>Eric API Documentation</b>""" 2090 """<b>Eric API Documentation</b>"""
2091 """<p>Display the Eric API documentation.""" 2091 """<p>Display the Eric API documentation."""
2092 """ The location for the documentation is the Documentation/Source""" 2092 """ The location for the documentation is the Documentation/Source"""
2093 """ subdirectory of the eric4 installation directory.</p>""" 2093 """ subdirectory of the eric5 installation directory.</p>"""
2094 )) 2094 ))
2095 self.connect(self.ericDocAct, SIGNAL('triggered()'), self.__showEricDoc) 2095 self.connect(self.ericDocAct, SIGNAL('triggered()'), self.__showEricDoc)
2096 self.actions.append(self.ericDocAct) 2096 self.actions.append(self.ericDocAct)
2097 2097
2098 def __initPySideDocActions(self): 2098 def __initPySideDocActions(self):
2692 """ 2692 """
2693 Public method to check for the presence of an error log and ask the user, 2693 Public method to check for the presence of an error log and ask the user,
2694 what to do with it. 2694 what to do with it.
2695 """ 2695 """
2696 if Preferences.getUI("CheckErrorLog"): 2696 if Preferences.getUI("CheckErrorLog"):
2697 logFile = os.path.join(Utilities.getConfigDir(), "eric4_error.log") 2697 logFile = os.path.join(Utilities.getConfigDir(), "eric5_error.log")
2698 if os.path.exists(logFile): 2698 if os.path.exists(logFile):
2699 dlg = QMessageBox(QMessageBox.Question, self.trUtf8("Error log found"), 2699 dlg = QMessageBox(QMessageBox.Question, self.trUtf8("Error log found"),
2700 self.trUtf8("An error log file was found. " 2700 self.trUtf8("An error log file was found. "
2701 "What should be done with it?")) 2701 "What should be done with it?"))
2702 try: 2702 try:
2920 QMessageBox.Yes) 2920 QMessageBox.Yes)
2921 2921
2922 if res == QMessageBox.Yes and self.__shutdown(): 2922 if res == QMessageBox.Yes and self.__shutdown():
2923 e4App().closeAllWindows() 2923 e4App().closeAllWindows()
2924 program = sys.executable 2924 program = sys.executable
2925 eric4 = os.path.join(getConfig("ericDir"), "eric4.py") 2925 eric5 = os.path.join(getConfig("ericDir"), "eric5.py")
2926 args = [eric4] 2926 args = [eric5]
2927 args.append("--start-session") 2927 args.append("--start-session")
2928 args.extend(self.__restartArgs) 2928 args.extend(self.__restartArgs)
2929 QProcess.startDetached(program, args) 2929 QProcess.startDetached(program, args)
2930 2930
2931 def __showToolsMenu(self): 2931 def __showToolsMenu(self):
3793 pass 3793 pass
3794 3794
3795 if version == 3: 3795 if version == 3:
3796 QMessageBox.information(None, 3796 QMessageBox.information(None,
3797 self.trUtf8("Qt 3 support"), 3797 self.trUtf8("Qt 3 support"),
3798 self.trUtf8("""Qt v.3 is not supported by eric4.""")) 3798 self.trUtf8("""Qt v.3 is not supported by eric5."""))
3799 return 3799 return
3800 3800
3801 args = [] 3801 args = []
3802 if fn is not None: 3802 if fn is not None:
3803 try: 3803 try:
3849 @param version indication for the requested version (Qt 4) (integer) 3849 @param version indication for the requested version (Qt 4) (integer)
3850 """ 3850 """
3851 if version < 4: 3851 if version < 4:
3852 QMessageBox.information(None, 3852 QMessageBox.information(None,
3853 self.trUtf8("Qt 3 support"), 3853 self.trUtf8("Qt 3 support"),
3854 self.trUtf8("""Qt v.3 is not supported by eric4.""")) 3854 self.trUtf8("""Qt v.3 is not supported by eric5."""))
3855 return 3855 return
3856 3856
3857 args = [] 3857 args = []
3858 if fn is not None: 3858 if fn is not None:
3859 fn = fn.replace('.qm', '.ts') 3859 fn = fn.replace('.qm', '.ts')
3908 @param version indication for the requested version (Qt 4) (integer) 3908 @param version indication for the requested version (Qt 4) (integer)
3909 """ 3909 """
3910 if version < 4: 3910 if version < 4:
3911 QMessageBox.information(None, 3911 QMessageBox.information(None,
3912 self.trUtf8("Qt 3 support"), 3912 self.trUtf8("Qt 3 support"),
3913 self.trUtf8("""Qt v.3 is not supported by eric4.""")) 3913 self.trUtf8("""Qt v.3 is not supported by eric5."""))
3914 return 3914 return
3915 3915
3916 args = [] 3916 args = []
3917 if home: 3917 if home:
3918 if version == 4: 3918 if version == 4:
4006 4006
4007 @param fn filename of the form to be previewed (string) 4007 @param fn filename of the form to be previewed (string)
4008 """ 4008 """
4009 proc = QProcess() 4009 proc = QProcess()
4010 4010
4011 viewer = os.path.join(getConfig("ericDir"), "eric4-uipreviewer.py") 4011 viewer = os.path.join(getConfig("ericDir"), "eric5-uipreviewer.py")
4012 4012
4013 args = [] 4013 args = []
4014 args.append(viewer) 4014 args.append(viewer)
4015 4015
4016 if fn is not None: 4016 if fn is not None:
4048 (list of strings) 4048 (list of strings)
4049 @param ignore flag indicating non existing files should be ignored (boolean) 4049 @param ignore flag indicating non existing files should be ignored (boolean)
4050 """ 4050 """
4051 proc = QProcess() 4051 proc = QProcess()
4052 4052
4053 viewer = os.path.join(getConfig("ericDir"), "eric4-trpreviewer.py") 4053 viewer = os.path.join(getConfig("ericDir"), "eric5-trpreviewer.py")
4054 4054
4055 args = [] 4055 args = []
4056 args.append(viewer) 4056 args.append(viewer)
4057 4057
4058 if fileNames is not None: 4058 if fileNames is not None:
4089 """ 4089 """
4090 Private slot to start the SQL browser tool. 4090 Private slot to start the SQL browser tool.
4091 """ 4091 """
4092 proc = QProcess() 4092 proc = QProcess()
4093 4093
4094 browser = os.path.join(getConfig("ericDir"), "eric4-sqlbrowser.py") 4094 browser = os.path.join(getConfig("ericDir"), "eric5-sqlbrowser.py")
4095 4095
4096 args = [] 4096 args = []
4097 args.append(browser) 4097 args.append(browser)
4098 4098
4099 if not os.path.isfile(browser) or not proc.startDetached(sys.executable, args): 4099 if not os.path.isfile(browser) or not proc.startDetached(sys.executable, args):
4544 4544
4545 self.launchHelpViewer("", searchWord = searchWord) 4545 self.launchHelpViewer("", searchWord = searchWord)
4546 4546
4547 def __webBrowser(self): 4547 def __webBrowser(self):
4548 """ 4548 """
4549 Private slot to start the eric4 web browser. 4549 Private slot to start the eric5 web browser.
4550 """ 4550 """
4551 self.launchHelpViewer("") 4551 self.launchHelpViewer("")
4552 4552
4553 def showPreferences(self, pageName = None): 4553 def showPreferences(self, pageName = None):
4554 """ 4554 """
4626 """ 4626 """
4627 self.emit(SIGNAL('reloadAPIs')) 4627 self.emit(SIGNAL('reloadAPIs'))
4628 4628
4629 def __showExternalTools(self): 4629 def __showExternalTools(self):
4630 """ 4630 """
4631 Private slot to display a dialog show a list of external tools used by eric4. 4631 Private slot to display a dialog show a list of external tools used by eric5.
4632 """ 4632 """
4633 self.programsDialog.show() 4633 self.programsDialog.show()
4634 4634
4635 def __configViewProfiles(self): 4635 def __configViewProfiles(self):
4636 """ 4636 """
4667 """ 4667 """
4668 fn, selectedFilter = QFileDialog.getSaveFileNameAndFilter(\ 4668 fn, selectedFilter = QFileDialog.getSaveFileNameAndFilter(\
4669 None, 4669 None,
4670 self.trUtf8("Export Keyboard Shortcuts"), 4670 self.trUtf8("Export Keyboard Shortcuts"),
4671 "", 4671 "",
4672 self.trUtf8("eric4 keyboard shortcut file (*.e4k);;" 4672 self.trUtf8("Keyboard shortcut file (*.e4k);;"
4673 "Compressed eric4 keyboard shortcut file (*.e4kz)"), 4673 "Compressed keyboard shortcut file (*.e4kz)"),
4674 "", 4674 "",
4675 QFileDialog.Options(QFileDialog.DontConfirmOverwrite)) 4675 QFileDialog.Options(QFileDialog.DontConfirmOverwrite))
4676 4676
4677 if not fn: 4677 if not fn:
4678 return 4678 return
4696 """ 4696 """
4697 fn = QFileDialog.getOpenFileName(\ 4697 fn = QFileDialog.getOpenFileName(\
4698 None, 4698 None,
4699 self.trUtf8("Import Keyboard Shortcuts"), 4699 self.trUtf8("Import Keyboard Shortcuts"),
4700 "", 4700 "",
4701 self.trUtf8("eric4 keyboard shortcut file (*.e4k *.e4kz);;" 4701 self.trUtf8("Keyboard shortcut file (*.e4k *.e4kz)"))
4702 "eric3 keyboard shortcut file (*.e3k *.e3kz)"))
4703 4702
4704 if fn: 4703 if fn:
4705 Shortcuts.importShortcuts(fn) 4704 Shortcuts.importShortcuts(fn)
4706 4705
4707 def __newProject(self): 4706 def __newProject(self):
4809 def __writeTasks(self): 4808 def __writeTasks(self):
4810 """ 4809 """
4811 Private slot to write the tasks data to an XML file (.e4t). 4810 Private slot to write the tasks data to an XML file (.e4t).
4812 """ 4811 """
4813 try: 4812 try:
4814 fn = os.path.join(Utilities.getConfigDir(), "eric4tasks.e4t") 4813 fn = os.path.join(Utilities.getConfigDir(), "eric5tasks.e4t")
4815 f = open(fn, "w") 4814 f = open(fn, "w")
4816 4815
4817 TasksWriter(f, False).writeXML() 4816 TasksWriter(f, False).writeXML()
4818 4817
4819 f.close() 4818 f.close()
4827 def __readTasks(self): 4826 def __readTasks(self):
4828 """ 4827 """
4829 Private slot to read in the tasks file (.e4t) 4828 Private slot to read in the tasks file (.e4t)
4830 """ 4829 """
4831 try: 4830 try:
4832 fn = os.path.join(Utilities.getConfigDir(), "eric4tasks.e4t") 4831 fn = os.path.join(Utilities.getConfigDir(), "eric5tasks.e4t")
4833 if not os.path.exists(fn): 4832 if not os.path.exists(fn):
4834 return 4833 return
4835 f = open(fn, "r") 4834 f = open(fn, "r")
4836 line = f.readline() 4835 line = f.readline()
4837 dtdLine = f.readline() 4836 dtdLine = f.readline()
4884 def __writeSession(self): 4883 def __writeSession(self):
4885 """ 4884 """
4886 Private slot to write the session data to an XML file (.e4s). 4885 Private slot to write the session data to an XML file (.e4s).
4887 """ 4886 """
4888 try: 4887 try:
4889 fn = os.path.join(Utilities.getConfigDir(), "eric4session.e4s") 4888 fn = os.path.join(Utilities.getConfigDir(), "eric5session.e4s")
4890 f = open(fn, "w") 4889 f = open(fn, "w")
4891 4890
4892 SessionWriter(f, None).writeXML() 4891 SessionWriter(f, None).writeXML()
4893 4892
4894 f.close() 4893 f.close()
4902 def __readSession(self): 4901 def __readSession(self):
4903 """ 4902 """
4904 Private slot to read in the session file (.e4s) 4903 Private slot to read in the session file (.e4s)
4905 """ 4904 """
4906 try: 4905 try:
4907 fn = os.path.join(Utilities.getConfigDir(), "eric4session.e4s") 4906 fn = os.path.join(Utilities.getConfigDir(), "eric5session.e4s")
4908 if not os.path.exists(fn): 4907 if not os.path.exists(fn):
4909 QMessageBox.critical(None, 4908 QMessageBox.critical(None,
4910 self.trUtf8("Read session"), 4909 self.trUtf8("Read session"),
4911 self.trUtf8("<p>The session file <b>{0}</b> could not be read.</p>")\ 4910 self.trUtf8("<p>The session file <b>{0}</b> could not be read.</p>")\
4912 .format(fn)) 4911 .format(fn))
5172 ## Below are methods to check for new versions 5171 ## Below are methods to check for new versions
5173 ############################################## 5172 ##############################################
5174 5173
5175 def showAvailableVersionsInfo(self): 5174 def showAvailableVersionsInfo(self):
5176 """ 5175 """
5177 Public method to show the eric4 versions available for download. 5176 Public method to show the eric5 versions available for download.
5178 """ 5177 """
5179 self.performVersionCheck(manual = True, showVersions = True) 5178 self.performVersionCheck(manual = True, showVersions = True)
5180 5179
5181 def performVersionCheck(self, manual = True, alternative = 0, showVersions = False): 5180 def performVersionCheck(self, manual = True, alternative = 0, showVersions = False):
5182 """ 5181 """
5183 Public method to check the internet for an eric4 update. 5182 Public method to check the internet for an eric5 update.
5184 5183
5185 @param manual flag indicating an invocation via the menu (boolean) 5184 @param manual flag indicating an invocation via the menu (boolean)
5186 @param alternative index of server to download from (integer) 5185 @param alternative index of server to download from (integer)
5187 @keyparam showVersion flag indicating the show versions mode (boolean) 5186 @keyparam showVersion flag indicating the show versions mode (boolean)
5188 """ 5187 """
5330 if "-snapshot-" in Version: 5329 if "-snapshot-" in Version:
5331 # check snapshot version 5330 # check snapshot version
5332 if versions[2] > Version: 5331 if versions[2] > Version:
5333 res = QMessageBox.information(None, 5332 res = QMessageBox.information(None,
5334 self.trUtf8("Update available"), 5333 self.trUtf8("Update available"),
5335 self.trUtf8("""The update to <b>{0}</b> of eric4 is available""" 5334 self.trUtf8("""The update to <b>{0}</b> of eric5 is available"""
5336 """ at <b>{1}</b>. Would you like to get it?""")\ 5335 """ at <b>{1}</b>. Would you like to get it?""")\
5337 .format(versions[2], versions[3]), 5336 .format(versions[2], versions[3]),
5338 QMessageBox.StandardButtons(\ 5337 QMessageBox.StandardButtons(\
5339 QMessageBox.No | \ 5338 QMessageBox.No | \
5340 QMessageBox.Yes), 5339 QMessageBox.Yes),
5341 QMessageBox.Yes) 5340 QMessageBox.Yes)
5342 url = res == QMessageBox.Yes and versions[3] or '' 5341 url = res == QMessageBox.Yes and versions[3] or ''
5343 elif versions[0] > Version: 5342 elif versions[0] > Version:
5344 res = QMessageBox.information(None, 5343 res = QMessageBox.information(None,
5345 self.trUtf8("Update available"), 5344 self.trUtf8("Update available"),
5346 self.trUtf8("""The update to <b>{0}</b> of eric4 is available""" 5345 self.trUtf8("""The update to <b>{0}</b> of eric5 is available"""
5347 """ at <b>{1}</b>. Would you like to get it?""")\ 5346 """ at <b>{1}</b>. Would you like to get it?""")\
5348 .format(versions[0], versions[1]), 5347 .format(versions[0], versions[1]),
5349 QMessageBox.StandardButtons(\ 5348 QMessageBox.StandardButtons(\
5350 QMessageBox.No | \ 5349 QMessageBox.No | \
5351 QMessageBox.Yes), 5350 QMessageBox.Yes),
5353 url = res == QMessageBox.Yes and versions[1] or '' 5352 url = res == QMessageBox.Yes and versions[1] or ''
5354 else: 5353 else:
5355 if self.manualUpdatesCheck: 5354 if self.manualUpdatesCheck:
5356 QMessageBox.information(None, 5355 QMessageBox.information(None,
5357 self.trUtf8("Eric4 is up to date"), 5356 self.trUtf8("Eric4 is up to date"),
5358 self.trUtf8("""You are using the latest version of eric4""")) 5357 self.trUtf8("""You are using the latest version of eric5"""))
5359 else: 5358 else:
5360 # check release version 5359 # check release version
5361 if versions[0] > Version: 5360 if versions[0] > Version:
5362 res = QMessageBox.information(None, 5361 res = QMessageBox.information(None,
5363 self.trUtf8("Update available"), 5362 self.trUtf8("Update available"),
5364 self.trUtf8("""The update to <b>{0}</b> of eric4 is available""" 5363 self.trUtf8("""The update to <b>{0}</b> of eric5 is available"""
5365 """ at <b>{1}</b>. Would you like to get it?""")\ 5364 """ at <b>{1}</b>. Would you like to get it?""")\
5366 .format(versions[0], versions[1]), 5365 .format(versions[0], versions[1]),
5367 QMessageBox.StandardButtons(\ 5366 QMessageBox.StandardButtons(\
5368 QMessageBox.No | \ 5367 QMessageBox.No | \
5369 QMessageBox.Yes), 5368 QMessageBox.Yes),
5371 url = res == QMessageBox.Yes and versions[1] or '' 5370 url = res == QMessageBox.Yes and versions[1] or ''
5372 else: 5371 else:
5373 if self.manualUpdatesCheck: 5372 if self.manualUpdatesCheck:
5374 QMessageBox.information(None, 5373 QMessageBox.information(None,
5375 self.trUtf8("Eric4 is up to date"), 5374 self.trUtf8("Eric4 is up to date"),
5376 self.trUtf8("""You are using the latest version of eric4""")) 5375 self.trUtf8("""You are using the latest version of eric5"""))
5377 except IndexError: 5376 except IndexError:
5378 QMessageBox.warning(None, 5377 QMessageBox.warning(None,
5379 self.trUtf8("Error during updates check"), 5378 self.trUtf8("Error during updates check"),
5380 self.trUtf8("""Could not perform updates check.""")) 5379 self.trUtf8("""Could not perform updates check."""))
5381 5380
5462 ## Below are methods for various checks 5461 ## Below are methods for various checks
5463 ####################################### 5462 #######################################
5464 5463
5465 def checkConfigurationStatus(self): 5464 def checkConfigurationStatus(self):
5466 """ 5465 """
5467 Public method to check, if eric4 has been configured. If it is not, 5466 Public method to check, if eric5 has been configured. If it is not,
5468 the configuration dialog is shown. 5467 the configuration dialog is shown.
5469 """ 5468 """
5470 if not Preferences.isConfigured(): 5469 if not Preferences.isConfigured():
5471 QMessageBox.information(None, 5470 QMessageBox.information(None,
5472 self.trUtf8("First time usage"), 5471 self.trUtf8("First time usage"),
5473 self.trUtf8("""eric4 has not been configured yet. """ 5472 self.trUtf8("""eric5 has not been configured yet. """
5474 """The configuration dialog will be started."""), 5473 """The configuration dialog will be started."""),
5475 QMessageBox.StandardButtons(\ 5474 QMessageBox.StandardButtons(\
5476 QMessageBox.Ok)) 5475 QMessageBox.Ok))
5477 self.showPreferences() 5476 self.showPreferences()
5478 5477
5479 def versionIsNewer(self, required, snapshot = None): 5478 def versionIsNewer(self, required, snapshot = None):
5480 """ 5479 """
5481 Public method to check, if the eric4 version is good compared to 5480 Public method to check, if the eric5 version is good compared to
5482 the required version. 5481 the required version.
5483 5482
5484 @param required required version (string) 5483 @param required required version (string)
5485 @param snapshot required snapshot version (string) 5484 @param snapshot required snapshot version (string)
5486 @return flag indicating, that the version is newer than the required one 5485 @return flag indicating, that the version is newer than the required one

eric ide

mercurial