UI/UserInterface.py

branch
Py2 comp.
changeset 3060
5883ce99ee12
parent 3058
0a02c433f52d
parent 3039
8dd0165d805d
child 3080
6c0a430b19df
equal deleted inserted replaced
3058:0a02c433f52d 3060:5883ce99ee12
1149 if self.passiveMode: 1149 if self.passiveMode:
1150 if not self.capProject and not self.capEditor: 1150 if not self.capProject and not self.capEditor:
1151 self.setWindowTitle( 1151 self.setWindowTitle(
1152 self.trUtf8("{0} - Passive Mode").format(Program)) 1152 self.trUtf8("{0} - Passive Mode").format(Program))
1153 elif self.capProject and not self.capEditor: 1153 elif self.capProject and not self.capEditor:
1154 self.setWindowTitle(self.trUtf8("{0} - {1} - Passive Mode")\ 1154 self.setWindowTitle(self.trUtf8("{0} - {1} - Passive Mode")
1155 .format(self.capProject, Program)) 1155 .format(self.capProject, Program))
1156 elif not self.capProject and self.capEditor: 1156 elif not self.capProject and self.capEditor:
1157 self.setWindowTitle(self.trUtf8("{0} - {1} - Passive Mode")\ 1157 self.setWindowTitle(self.trUtf8("{0} - {1} - Passive Mode")
1158 .format(self.capEditor, Program)) 1158 .format(self.capEditor, Program))
1159 else: 1159 else:
1160 self.setWindowTitle( 1160 self.setWindowTitle(
1161 self.trUtf8("{0} - {1} - {2} - Passive Mode")\ 1161 self.trUtf8("{0} - {1} - {2} - Passive Mode")
1162 .format(self.capProject, self.capEditor, Program)) 1162 .format(self.capProject, self.capEditor, Program))
1163 else: 1163 else:
1164 if not self.capProject and not self.capEditor: 1164 if not self.capProject and not self.capEditor:
1165 self.setWindowTitle(Program) 1165 self.setWindowTitle(Program)
1166 elif self.capProject and not self.capEditor: 1166 elif self.capProject and not self.capEditor:
1591 self.versionAct.setStatusTip(self.trUtf8( 1591 self.versionAct.setStatusTip(self.trUtf8(
1592 'Display version information')) 1592 'Display version information'))
1593 self.versionAct.setWhatsThis(self.trUtf8( 1593 self.versionAct.setWhatsThis(self.trUtf8(
1594 """<b>Show Versions</b>""" 1594 """<b>Show Versions</b>"""
1595 """<p>Display version information.</p>""" 1595 """<p>Display version information.</p>"""
1596 )) 1596 ))
1597 self.versionAct.triggered[()].connect(self.__showVersions) 1597 self.versionAct.triggered[()].connect(self.__showVersions)
1598 self.actions.append(self.versionAct) 1598 self.actions.append(self.versionAct)
1599 1599
1600 self.checkUpdateAct = E5Action( 1600 self.checkUpdateAct = E5Action(
1601 self.trUtf8('Check for Updates'), 1601 self.trUtf8('Check for Updates'),
1602 self.trUtf8('Check for &Updates...'), 0, 0, self, 'check_updates') 1602 self.trUtf8('Check for &Updates...'), 0, 0, self, 'check_updates')
1603 self.checkUpdateAct.setStatusTip(self.trUtf8('Check for Updates')) 1603 self.checkUpdateAct.setStatusTip(self.trUtf8('Check for Updates'))
1604 self.checkUpdateAct.setWhatsThis(self.trUtf8( 1604 self.checkUpdateAct.setWhatsThis(self.trUtf8(
1605 """<b>Check for Updates...</b>""" 1605 """<b>Check for Updates...</b>"""
1606 """<p>Checks the internet for updates of eric5.</p>""" 1606 """<p>Checks the internet for updates of eric5.</p>"""
1607 )) 1607 ))
1608 self.checkUpdateAct.triggered[()].connect(self.performVersionCheck) 1608 self.checkUpdateAct.triggered[()].connect(self.performVersionCheck)
1609 self.actions.append(self.checkUpdateAct) 1609 self.actions.append(self.checkUpdateAct)
1610 1610
1611 self.showVersionsAct = E5Action( 1611 self.showVersionsAct = E5Action(
1612 self.trUtf8('Show downloadable versions'), 1612 self.trUtf8('Show downloadable versions'),
1616 self.trUtf8('Show the versions available for download')) 1616 self.trUtf8('Show the versions available for download'))
1617 self.showVersionsAct.setWhatsThis(self.trUtf8( 1617 self.showVersionsAct.setWhatsThis(self.trUtf8(
1618 """<b>Show downloadable versions...</b>""" 1618 """<b>Show downloadable versions...</b>"""
1619 """<p>Shows the eric5 versions available for download """ 1619 """<p>Shows the eric5 versions available for download """
1620 """from the internet.</p>""" 1620 """from the internet.</p>"""
1621 )) 1621 ))
1622 self.showVersionsAct.triggered[()].connect( 1622 self.showVersionsAct.triggered[()].connect(
1623 self.showAvailableVersionsInfo) 1623 self.showAvailableVersionsInfo)
1624 self.actions.append(self.showVersionsAct) 1624 self.actions.append(self.showVersionsAct)
1625 1625
1626 self.reportBugAct = E5Action( 1626 self.reportBugAct = E5Action(
1629 0, 0, self, 'report_bug') 1629 0, 0, self, 'report_bug')
1630 self.reportBugAct.setStatusTip(self.trUtf8('Report a bug')) 1630 self.reportBugAct.setStatusTip(self.trUtf8('Report a bug'))
1631 self.reportBugAct.setWhatsThis(self.trUtf8( 1631 self.reportBugAct.setWhatsThis(self.trUtf8(
1632 """<b>Report Bug...</b>""" 1632 """<b>Report Bug...</b>"""
1633 """<p>Opens a dialog to report a bug.</p>""" 1633 """<p>Opens a dialog to report a bug.</p>"""
1634 )) 1634 ))
1635 self.reportBugAct.triggered[()].connect(self.__reportBug) 1635 self.reportBugAct.triggered[()].connect(self.__reportBug)
1636 self.actions.append(self.reportBugAct) 1636 self.actions.append(self.reportBugAct)
1637 1637
1638 self.requestFeatureAct = E5Action( 1638 self.requestFeatureAct = E5Action(
1639 self.trUtf8('Request Feature'), 1639 self.trUtf8('Request Feature'),
1642 self.requestFeatureAct.setStatusTip(self.trUtf8( 1642 self.requestFeatureAct.setStatusTip(self.trUtf8(
1643 'Send a feature request')) 1643 'Send a feature request'))
1644 self.requestFeatureAct.setWhatsThis(self.trUtf8( 1644 self.requestFeatureAct.setWhatsThis(self.trUtf8(
1645 """<b>Request Feature...</b>""" 1645 """<b>Request Feature...</b>"""
1646 """<p>Opens a dialog to send a feature request.</p>""" 1646 """<p>Opens a dialog to send a feature request.</p>"""
1647 )) 1647 ))
1648 self.requestFeatureAct.triggered[()].connect(self.__requestFeature) 1648 self.requestFeatureAct.triggered[()].connect(self.__requestFeature)
1649 self.actions.append(self.requestFeatureAct) 1649 self.actions.append(self.requestFeatureAct)
1650 1650
1651 self.utActGrp = createActionGroup(self) 1651 self.utActGrp = createActionGroup(self)
1652 1652
2913 versionText += """<tr><td><b>QScintilla</b></td><td>{0}</td></tr>"""\ 2913 versionText += """<tr><td><b>QScintilla</b></td><td>{0}</td></tr>"""\
2914 .format(QSCINTILLA_VERSION_STR) 2914 .format(QSCINTILLA_VERSION_STR)
2915 try: 2915 try:
2916 from PyQt4.QtWebKit import qWebKitVersion 2916 from PyQt4.QtWebKit import qWebKitVersion
2917 versionText += """<tr><td><b>WebKit</b></td><td>{0}</td></tr>"""\ 2917 versionText += """<tr><td><b>WebKit</b></td><td>{0}</td></tr>"""\
2918 .format(qWebKitVersion()) 2918 .format(qWebKitVersion())
2919 except ImportError: 2919 except ImportError:
2920 pass 2920 pass
2921 versionText += """<tr><td><b>{0}</b></td><td>{1}</td></tr>"""\ 2921 versionText += """<tr><td><b>{0}</b></td><td>{1}</td></tr>"""\
2922 .format(Program, Version) 2922 .format(Program, Version)
2923 versionText += self.trUtf8("""</table>""") 2923 versionText += self.trUtf8("""</table>""")
4048 self, 4048 self,
4049 self.trUtf8('Problem'), 4049 self.trUtf8('Problem'),
4050 self.trUtf8( 4050 self.trUtf8(
4051 '<p>The file <b>{0}</b> does not exist or' 4051 '<p>The file <b>{0}</b> does not exist or'
4052 ' is zero length.</p>') 4052 ' is zero length.</p>')
4053 .format(fn)) 4053 .format(fn))
4054 return 4054 return
4055 except EnvironmentError: 4055 except EnvironmentError:
4056 E5MessageBox.critical( 4056 E5MessageBox.critical(
4057 self, 4057 self,
4058 self.trUtf8('Problem'), 4058 self.trUtf8('Problem'),
4059 self.trUtf8( 4059 self.trUtf8(
4060 '<p>The file <b>{0}</b> does not exist or' 4060 '<p>The file <b>{0}</b> does not exist or'
4061 ' is zero length.</p>') 4061 ' is zero length.</p>')
4062 .format(fn)) 4062 .format(fn))
4063 return 4063 return
4064 4064
4065 if Utilities.isMacPlatform(): 4065 if Utilities.isMacPlatform():
4066 designer, args = Utilities.prepareQtMacBundle( 4066 designer, args = Utilities.prepareQtMacBundle(
4067 "designer", version, args) 4067 "designer", version, args)
4115 self, 4115 self,
4116 self.trUtf8('Problem'), 4116 self.trUtf8('Problem'),
4117 self.trUtf8( 4117 self.trUtf8(
4118 '<p>The file <b>{0}</b> does not exist or' 4118 '<p>The file <b>{0}</b> does not exist or'
4119 ' is zero length.</p>') 4119 ' is zero length.</p>')
4120 .format(fn)) 4120 .format(fn))
4121 return 4121 return
4122 except EnvironmentError: 4122 except EnvironmentError:
4123 E5MessageBox.critical( 4123 E5MessageBox.critical(
4124 self, 4124 self,
4125 self.trUtf8('Problem'), 4125 self.trUtf8('Problem'),
4126 self.trUtf8( 4126 self.trUtf8(
4127 '<p>The file <b>{0}</b> does not exist or' 4127 '<p>The file <b>{0}</b> does not exist or'
4128 ' is zero length.</p>') 4128 ' is zero length.</p>')
4129 .format(fn)) 4129 .format(fn))
4130 return 4130 return
4131 4131
4132 if Utilities.isMacPlatform(): 4132 if Utilities.isMacPlatform():
4133 linguist, args = Utilities.prepareQtMacBundle( 4133 linguist, args = Utilities.prepareQtMacBundle(
4134 "linguist", version, args) 4134 "linguist", version, args)
4283 self, 4283 self,
4284 self.trUtf8('Problem'), 4284 self.trUtf8('Problem'),
4285 self.trUtf8( 4285 self.trUtf8(
4286 '<p>The file <b>{0}</b> does not exist or' 4286 '<p>The file <b>{0}</b> does not exist or'
4287 ' is zero length.</p>') 4287 ' is zero length.</p>')
4288 .format(fn)) 4288 .format(fn))
4289 return 4289 return
4290 except EnvironmentError: 4290 except EnvironmentError:
4291 E5MessageBox.critical( 4291 E5MessageBox.critical(
4292 self, 4292 self,
4293 self.trUtf8('Problem'), 4293 self.trUtf8('Problem'),
4294 self.trUtf8( 4294 self.trUtf8(
4295 '<p>The file <b>{0}</b> does not exist or' 4295 '<p>The file <b>{0}</b> does not exist or'
4296 ' is zero length.</p>') 4296 ' is zero length.</p>')
4297 .format(fn)) 4297 .format(fn))
4298 return 4298 return
4299 4299
4300 if not os.path.isfile(viewer) or \ 4300 if not os.path.isfile(viewer) or \
4301 not proc.startDetached(sys.executable, args): 4301 not proc.startDetached(sys.executable, args):
4302 E5MessageBox.critical( 4302 E5MessageBox.critical(
4334 self, 4334 self,
4335 self.trUtf8('Problem'), 4335 self.trUtf8('Problem'),
4336 self.trUtf8( 4336 self.trUtf8(
4337 '<p>The file <b>{0}</b> does not exist or' 4337 '<p>The file <b>{0}</b> does not exist or'
4338 ' is zero length.</p>') 4338 ' is zero length.</p>')
4339 .format(fn)) 4339 .format(fn))
4340 return 4340 return
4341 except EnvironmentError: 4341 except EnvironmentError:
4342 if not ignore: 4342 if not ignore:
4343 E5MessageBox.critical( 4343 E5MessageBox.critical(
4344 self, 4344 self,
4345 self.trUtf8('Problem'), 4345 self.trUtf8('Problem'),
4346 self.trUtf8( 4346 self.trUtf8(
4347 '<p>The file <b>{0}</b> does not exist or' 4347 '<p>The file <b>{0}</b> does not exist or'
4348 ' is zero length.</p>') 4348 ' is zero length.</p>')
4349 .format(fn)) 4349 .format(fn))
4350 return 4350 return
4351 4351
4352 if not os.path.isfile(viewer) or \ 4352 if not os.path.isfile(viewer) or \
4353 not proc.startDetached(sys.executable, args): 4353 not proc.startDetached(sys.executable, args):
4354 E5MessageBox.critical( 4354 E5MessageBox.critical(
4456 4456
4457 E5MessageBox.information( 4457 E5MessageBox.information(
4458 self, 4458 self,
4459 self.trUtf8("External Tools"), 4459 self.trUtf8("External Tools"),
4460 self.trUtf8("""No toolgroup entry '{0}' found.""") 4460 self.trUtf8("""No toolgroup entry '{0}' found.""")
4461 .format(toolGroupName) 4461 .format(toolGroupName)
4462 ) 4462 )
4463 4463
4464 def __toolExecute(self, act): 4464 def __toolExecute(self, act):
4465 """ 4465 """
4466 Private slot to execute a particular tool. 4466 Private slot to execute a particular tool.
4512 E5MessageBox.critical( 4512 E5MessageBox.critical(
4513 self, 4513 self,
4514 self.trUtf8('Process Generation Error'), 4514 self.trUtf8('Process Generation Error'),
4515 self.trUtf8( 4515 self.trUtf8(
4516 '<p>Could not start the tool entry <b>{0}</b>.<br>' 4516 '<p>Could not start the tool entry <b>{0}</b>.<br>'
4517 'Ensure that it is available as <b>{1}</b>.</p>')\ 4517 'Ensure that it is available as <b>{1}</b>.</p>')
4518 .format(tool['menutext'], tool['executable'])) 4518 .format(tool['menutext'], tool['executable']))
4519 else: 4519 else:
4520 self.toolProcs.append((program, proc, procData)) 4520 self.toolProcs.append((program, proc, procData))
4521 if tool['redirect'] == 'no': 4521 if tool['redirect'] == 'no':
4522 proc.closeReadChannel(QProcess.StandardOutput) 4522 proc.closeReadChannel(QProcess.StandardOutput)
4621 if not os.path.exists(home): 4621 if not os.path.exists(home):
4622 E5MessageBox.warning( 4622 E5MessageBox.warning(
4623 self, 4623 self,
4624 self.trUtf8("Documentation Missing"), 4624 self.trUtf8("Documentation Missing"),
4625 self.trUtf8("""<p>The documentation starting point""" 4625 self.trUtf8("""<p>The documentation starting point"""
4626 """ "<b>{0}</b>" could not be found.</p>""")\ 4626 """ "<b>{0}</b>" could not be found.</p>""")
4627 .format(home)) 4627 .format(home))
4628 return 4628 return
4629 4629
4630 if not home.endswith(".chm"): 4630 if not home.endswith(".chm"):
4631 if Utilities.isWindowsPlatform(): 4631 if Utilities.isWindowsPlatform():
4632 home = "file:///" + Utilities.fromNativeSeparators(home) 4632 home = "file:///" + Utilities.fromNativeSeparators(home)
4678 if not os.path.exists(home): 4678 if not os.path.exists(home):
4679 E5MessageBox.warning( 4679 E5MessageBox.warning(
4680 self, 4680 self,
4681 self.trUtf8("Documentation Missing"), 4681 self.trUtf8("Documentation Missing"),
4682 self.trUtf8("""<p>The documentation starting point""" 4682 self.trUtf8("""<p>The documentation starting point"""
4683 """ "<b>{0}</b>" could not be found.</p>""")\ 4683 """ "<b>{0}</b>" could not be found.</p>""")
4684 .format(home)) 4684 .format(home))
4685 return 4685 return
4686 4686
4687 if not home.endswith(".chm"): 4687 if not home.endswith(".chm"):
4688 if Utilities.isWindowsPlatform(): 4688 if Utilities.isWindowsPlatform():
4689 home = "file:///" + Utilities.fromNativeSeparators(home) 4689 home = "file:///" + Utilities.fromNativeSeparators(home)
4747 if not os.path.exists(home): 4747 if not os.path.exists(home):
4748 E5MessageBox.warning( 4748 E5MessageBox.warning(
4749 self, 4749 self,
4750 self.trUtf8("Documentation Missing"), 4750 self.trUtf8("Documentation Missing"),
4751 self.trUtf8("""<p>The documentation starting point""" 4751 self.trUtf8("""<p>The documentation starting point"""
4752 """ "<b>{0}</b>" could not be found.</p>""")\ 4752 """ "<b>{0}</b>" could not be found.</p>""")
4753 .format(home)) 4753 .format(home))
4754 return 4754 return
4755 4755
4756 if Utilities.isWindowsPlatform(): 4756 if Utilities.isWindowsPlatform():
4757 home = "file:///" + Utilities.fromNativeSeparators(home) 4757 home = "file:///" + Utilities.fromNativeSeparators(home)
4758 else: 4758 else:
4789 home = "" 4789 home = ""
4790 if pyqt4DocDir: 4790 if pyqt4DocDir:
4791 if pyqt4DocDir.startswith("file://"): 4791 if pyqt4DocDir.startswith("file://"):
4792 pyqt4DocDir = pyqt4DocDir[7:] 4792 pyqt4DocDir = pyqt4DocDir[7:]
4793 if not os.path.splitext(pyqt4DocDir)[1]: 4793 if not os.path.splitext(pyqt4DocDir)[1]:
4794 possibleHomes = [\ 4794 possibleHomes = [
4795 Utilities.normjoinpath(pyqt4DocDir, 'index.html'), 4795 Utilities.normjoinpath(pyqt4DocDir, 'index.html'),
4796 Utilities.normjoinpath(pyqt4DocDir, 'classes.html'), 4796 Utilities.normjoinpath(pyqt4DocDir, 'classes.html'),
4797 ] 4797 ]
4798 for possibleHome in possibleHomes: 4798 for possibleHome in possibleHomes:
4799 if os.path.exists(possibleHome): 4799 if os.path.exists(possibleHome):
4805 if not home or not os.path.exists(home): 4805 if not home or not os.path.exists(home):
4806 E5MessageBox.warning( 4806 E5MessageBox.warning(
4807 self, 4807 self,
4808 self.trUtf8("Documentation Missing"), 4808 self.trUtf8("Documentation Missing"),
4809 self.trUtf8("""<p>The documentation starting point""" 4809 self.trUtf8("""<p>The documentation starting point"""
4810 """ "<b>{0}</b>" could not be found.</p>""")\ 4810 """ "<b>{0}</b>" could not be found.</p>""")
4811 .format(home)) 4811 .format(home))
4812 return 4812 return
4813 4813
4814 if Utilities.isWindowsPlatform(): 4814 if Utilities.isWindowsPlatform():
4815 home = "file:///" + Utilities.fromNativeSeparators(home) 4815 home = "file:///" + Utilities.fromNativeSeparators(home)
4816 else: 4816 else:
4867 if not home or not os.path.exists(home): 4867 if not home or not os.path.exists(home):
4868 E5MessageBox.warning( 4868 E5MessageBox.warning(
4869 self, 4869 self,
4870 self.trUtf8("Documentation Missing"), 4870 self.trUtf8("Documentation Missing"),
4871 self.trUtf8("""<p>The documentation starting point""" 4871 self.trUtf8("""<p>The documentation starting point"""
4872 """ "<b>{0}</b>" could not be found.</p>""")\ 4872 """ "<b>{0}</b>" could not be found.</p>""")
4873 .format(home)) 4873 .format(home))
4874 return 4874 return
4875 4875
4876 if Utilities.isWindowsPlatform(): 4876 if Utilities.isWindowsPlatform():
4877 home = "file:///" + Utilities.fromNativeSeparators(home) 4877 home = "file:///" + Utilities.fromNativeSeparators(home)
4878 else: 4878 else:
4903 if not os.path.exists(home): 4903 if not os.path.exists(home):
4904 E5MessageBox.warning( 4904 E5MessageBox.warning(
4905 self, 4905 self,
4906 self.trUtf8("Documentation Missing"), 4906 self.trUtf8("Documentation Missing"),
4907 self.trUtf8("""<p>The documentation starting point""" 4907 self.trUtf8("""<p>The documentation starting point"""
4908 """ "<b>{0}</b>" could not be found.</p>""")\ 4908 """ "<b>{0}</b>" could not be found.</p>""")
4909 .format(home)) 4909 .format(home))
4910 return 4910 return
4911 4911
4912 if Utilities.isWindowsPlatform(): 4912 if Utilities.isWindowsPlatform():
4913 home = "file:///" + Utilities.fromNativeSeparators(home) 4913 home = "file:///" + Utilities.fromNativeSeparators(home)
4914 else: 4914 else:
4951 if not os.path.exists(home): 4951 if not os.path.exists(home):
4952 E5MessageBox.warning( 4952 E5MessageBox.warning(
4953 self, 4953 self,
4954 self.trUtf8("Documentation Missing"), 4954 self.trUtf8("Documentation Missing"),
4955 self.trUtf8("""<p>The documentation starting point""" 4955 self.trUtf8("""<p>The documentation starting point"""
4956 """ "<b>{0}</b>" could not be found.</p>""")\ 4956 """ "<b>{0}</b>" could not be found.</p>""")
4957 .format(home)) 4957 .format(home))
4958 return 4958 return
4959 4959
4960 if Utilities.isWindowsPlatform(): 4960 if Utilities.isWindowsPlatform():
4961 home = "file:///" + Utilities.fromNativeSeparators(home) 4961 home = "file:///" + Utilities.fromNativeSeparators(home)
4962 else: 4962 else:
5378 E5MessageBox.critical( 5378 E5MessageBox.critical(
5379 self, 5379 self,
5380 self.trUtf8("Save tasks"), 5380 self.trUtf8("Save tasks"),
5381 self.trUtf8( 5381 self.trUtf8(
5382 "<p>The tasks file <b>{0}</b> could not be written.</p>") 5382 "<p>The tasks file <b>{0}</b> could not be written.</p>")
5383 .format(fn)) 5383 .format(fn))
5384 return 5384 return
5385 5385
5386 from E5XML.TasksWriter import TasksWriter 5386 from E5XML.TasksWriter import TasksWriter
5387 TasksWriter(f, False).writeXML() 5387 TasksWriter(f, False).writeXML()
5388 f.close() 5388 f.close()
5404 E5MessageBox.critical( 5404 E5MessageBox.critical(
5405 self, 5405 self,
5406 self.trUtf8("Read tasks"), 5406 self.trUtf8("Read tasks"),
5407 self.trUtf8( 5407 self.trUtf8(
5408 "<p>The tasks file <b>{0}</b> could not be read.</p>") 5408 "<p>The tasks file <b>{0}</b> could not be read.</p>")
5409 .format(fn)) 5409 .format(fn))
5410 5410
5411 def __writeSession(self): 5411 def __writeSession(self):
5412 """ 5412 """
5413 Private slot to write the session data to an XML file (.e4s). 5413 Private slot to write the session data to an XML file (.e4s).
5414 """ 5414 """
5422 E5MessageBox.critical( 5422 E5MessageBox.critical(
5423 self, 5423 self,
5424 self.trUtf8("Save session"), 5424 self.trUtf8("Save session"),
5425 self.trUtf8( 5425 self.trUtf8(
5426 "<p>The session file <b>{0}</b> could not be written.</p>") 5426 "<p>The session file <b>{0}</b> could not be written.</p>")
5427 .format(fn)) 5427 .format(fn))
5428 5428
5429 def __readSession(self): 5429 def __readSession(self):
5430 """ 5430 """
5431 Private slot to read in the session file (.e4s). 5431 Private slot to read in the session file (.e4s).
5432 """ 5432 """
5434 if not os.path.exists(fn): 5434 if not os.path.exists(fn):
5435 E5MessageBox.critical( 5435 E5MessageBox.critical(
5436 self, 5436 self,
5437 self.trUtf8("Read session"), 5437 self.trUtf8("Read session"),
5438 self.trUtf8( 5438 self.trUtf8(
5439 "<p>The session file <b>{0}</b> could not be read.</p>")\ 5439 "<p>The session file <b>{0}</b> could not be read.</p>")
5440 .format(fn)) 5440 .format(fn))
5441 return 5441 return
5442 5442
5443 f = QFile(fn) 5443 f = QFile(fn)
5444 if f.open(QIODevice.ReadOnly): 5444 if f.open(QIODevice.ReadOnly):
5445 from E5XML.SessionReader import SessionReader 5445 from E5XML.SessionReader import SessionReader
5449 else: 5449 else:
5450 E5MessageBox.critical( 5450 E5MessageBox.critical(
5451 self, 5451 self,
5452 self.trUtf8("Read session"), 5452 self.trUtf8("Read session"),
5453 self.trUtf8( 5453 self.trUtf8(
5454 "<p>The session file <b>{0}</b> could not be read.</p>")\ 5454 "<p>The session file <b>{0}</b> could not be read.</p>")
5455 .format(fn)) 5455 .format(fn))
5456 5456
5457 def showFindFileByNameDialog(self): 5457 def showFindFileByNameDialog(self):
5458 """ 5458 """
5459 Public slot to show the Find File by Name dialog. 5459 Public slot to show the Find File by Name dialog.
5460 """ 5460 """
5632 else: 5632 else:
5633 E5MessageBox.information( 5633 E5MessageBox.information(
5634 self, 5634 self,
5635 self.trUtf8("Drop Error"), 5635 self.trUtf8("Drop Error"),
5636 self.trUtf8("""<p><b>{0}</b> is not a file.</p>""") 5636 self.trUtf8("""<p><b>{0}</b> is not a file.</p>""")
5637 .format(fname)) 5637 .format(fname))
5638 5638
5639 self.inDragDrop = False 5639 self.inDragDrop = False
5640 5640
5641 ########################################################## 5641 ##########################################################
5642 ## Below are methods needed for shutting down the IDE 5642 ## Below are methods needed for shutting down the IDE
5771 self.__versionCheckCanceled = False 5771 self.__versionCheckCanceled = False
5772 if manual: 5772 if manual:
5773 if self.__versionCheckProgress is None: 5773 if self.__versionCheckProgress is None:
5774 self.__versionCheckProgress = \ 5774 self.__versionCheckProgress = \
5775 QProgressDialog("", self.trUtf8("&Cancel"), 5775 QProgressDialog("", self.trUtf8("&Cancel"),
5776 0, len(self.__httpAlternatives), self) 5776 0, len(self.__httpAlternatives), self)
5777 self.__versionCheckProgress.setMinimumDuration(0) 5777 self.__versionCheckProgress.setMinimumDuration(0)
5778 self.__versionCheckProgress.canceled.connect( 5778 self.__versionCheckProgress.canceled.connect(
5779 self.__versionsDownloadCanceled) 5779 self.__versionsDownloadCanceled)
5780 self.__versionCheckProgress.setLabelText( 5780 self.__versionCheckProgress.setLabelText(
5781 self.trUtf8("Trying host {0}").format(url.host())) 5781 self.trUtf8("Trying host {0}").format(url.host()))
5887 self, 5887 self,
5888 self.trUtf8("Update available"), 5888 self.trUtf8("Update available"),
5889 self.trUtf8( 5889 self.trUtf8(
5890 """The update to <b>{0}</b> of eric5 is""" 5890 """The update to <b>{0}</b> of eric5 is"""
5891 """ available at <b>{1}</b>. Would you like to""" 5891 """ available at <b>{1}</b>. Would you like to"""
5892 """ get it?""")\ 5892 """ get it?""")
5893 .format(versions[2], versions[3]), 5893 .format(versions[2], versions[3]),
5894 yesDefault=True) 5894 yesDefault=True)
5895 url = res and versions[3] or '' 5895 url = res and versions[3] or ''
5896 elif versions[0] > Version: 5896 elif versions[0] > Version:
5897 res = E5MessageBox.yesNo( 5897 res = E5MessageBox.yesNo(
5898 self, 5898 self,
5899 self.trUtf8("Update available"), 5899 self.trUtf8("Update available"),
5900 self.trUtf8( 5900 self.trUtf8(
5901 """The update to <b>{0}</b> of eric5 is""" 5901 """The update to <b>{0}</b> of eric5 is"""
5902 """ available at <b>{1}</b>. Would you like to""" 5902 """ available at <b>{1}</b>. Would you like to"""
5903 """ get it?""")\ 5903 """ get it?""")
5904 .format(versions[0], versions[1]), 5904 .format(versions[0], versions[1]),
5905 yesDefault=True) 5905 yesDefault=True)
5906 url = res and versions[1] or '' 5906 url = res and versions[1] or ''
5907 else: 5907 else:
5908 if self.manualUpdatesCheck: 5908 if self.manualUpdatesCheck:
5909 E5MessageBox.information( 5909 E5MessageBox.information(
5919 self, 5919 self,
5920 self.trUtf8("Update available"), 5920 self.trUtf8("Update available"),
5921 self.trUtf8( 5921 self.trUtf8(
5922 """The update to <b>{0}</b> of eric5 is""" 5922 """The update to <b>{0}</b> of eric5 is"""
5923 """ available at <b>{1}</b>. Would you like""" 5923 """ available at <b>{1}</b>. Would you like"""
5924 """ to get it?""")\ 5924 """ to get it?""")
5925 .format(versions[0], versions[1]), 5925 .format(versions[0], versions[1]),
5926 yesDefault=True) 5926 yesDefault=True)
5927 url = res and versions[1] or '' 5927 url = res and versions[1] or ''
5928 else: 5928 else:
5929 if self.manualUpdatesCheck: 5929 if self.manualUpdatesCheck:
5930 E5MessageBox.information( 5930 E5MessageBox.information(
5966 break 5966 break
5967 5967
5968 versionText += """<tr><td>{0}</td><td><a href="{1}">{2}</a>""" \ 5968 versionText += """<tr><td>{0}</td><td><a href="{1}">{2}</a>""" \
5969 """</td></tr>""".format( 5969 """</td></tr>""".format(
5970 versions[line], versions[line + 1], 5970 versions[line], versions[line + 1],
5971 'sourceforge' in versions[line + 1] and \ 5971 'sourceforge' in versions[line + 1] and
5972 "SourceForge" or versions[line + 1]) 5972 "SourceForge" or versions[line + 1])
5973 line += 2 5973 line += 2
5974 versionText += self.trUtf8("""</table>""") 5974 versionText += self.trUtf8("""</table>""")
5975 5975
5976 E5MessageBox.about(self, Program, versionText) 5976 E5MessageBox.about(self, Program, versionText)
5977 5977

eric ide

mercurial