UI/UserInterface.py

branch
Py2 comp.
changeset 3142
55030c09e142
parent 3080
6c0a430b19df
parent 3116
ee0a183cec81
child 3145
a9de05d4a22f
equal deleted inserted replaced
3141:72f3bde98c58 3142:55030c09e142
138 maxMenuFilePathLen = 75 138 maxMenuFilePathLen = 75
139 139
140 LeftSide = 1 140 LeftSide = 1
141 BottomSide = 2 141 BottomSide = 2
142 RightSide = 3 142 RightSide = 3
143
144 ErrorLogFileName = "eric5_error.log"
143 145
144 def __init__(self, app, locale, splash, plugin, noOpenAtStartup, 146 def __init__(self, app, locale, splash, plugin, noOpenAtStartup,
145 restartArguments): 147 restartArguments):
146 """ 148 """
147 Constructor 149 Constructor
1622 )) 1624 ))
1623 self.showVersionsAct.triggered[()].connect( 1625 self.showVersionsAct.triggered[()].connect(
1624 self.showAvailableVersionsInfo) 1626 self.showAvailableVersionsInfo)
1625 self.actions.append(self.showVersionsAct) 1627 self.actions.append(self.showVersionsAct)
1626 1628
1629 self.showErrorLogAct = E5Action(
1630 self.trUtf8('Show Error Log'),
1631 self.trUtf8('Show Error &Log...'),
1632 0, 0, self, 'show_error_log')
1633 self.showErrorLogAct.setStatusTip(self.trUtf8('Show Error Log'))
1634 self.showErrorLogAct.setWhatsThis(self.trUtf8(
1635 """<b>Show Error Log...</b>"""
1636 """<p>Opens a dialog showing the most recent error log.</p>"""
1637 ))
1638 self.showErrorLogAct.triggered[()].connect(self.__showErrorLog)
1639 self.actions.append(self.showErrorLogAct)
1640
1627 self.reportBugAct = E5Action( 1641 self.reportBugAct = E5Action(
1628 self.trUtf8('Report Bug'), 1642 self.trUtf8('Report Bug'),
1629 self.trUtf8('Report &Bug...'), 1643 self.trUtf8('Report &Bug...'),
1630 0, 0, self, 'report_bug') 1644 0, 0, self, 'report_bug')
1631 self.reportBugAct.setStatusTip(self.trUtf8('Report a bug')) 1645 self.reportBugAct.setStatusTip(self.trUtf8('Report a bug'))
2169 self.pluginRepoAct.setWhatsThis(self.trUtf8( 2183 self.pluginRepoAct.setWhatsThis(self.trUtf8(
2170 """<b>Plugin Repository...</b>""" 2184 """<b>Plugin Repository...</b>"""
2171 """<p>This opens a dialog, that shows a list of plugins """ 2185 """<p>This opens a dialog, that shows a list of plugins """
2172 """available on the Internet.</p>""" 2186 """available on the Internet.</p>"""
2173 )) 2187 ))
2174 self.pluginRepoAct.triggered[()].connect(self.__showPluginsAvailable) 2188 self.pluginRepoAct.triggered[()].connect(self.showPluginsAvailable)
2175 self.actions.append(self.pluginRepoAct) 2189 self.actions.append(self.pluginRepoAct)
2176 2190
2177 # initialize viewmanager actions 2191 # initialize viewmanager actions
2178 self.viewmanager.initActions() 2192 self.viewmanager.initActions()
2179 2193
2496 self.__menus["help"].addAction(self.versionAct) 2510 self.__menus["help"].addAction(self.versionAct)
2497 self.__menus["help"].addSeparator() 2511 self.__menus["help"].addSeparator()
2498 self.__menus["help"].addAction(self.checkUpdateAct) 2512 self.__menus["help"].addAction(self.checkUpdateAct)
2499 self.__menus["help"].addAction(self.showVersionsAct) 2513 self.__menus["help"].addAction(self.showVersionsAct)
2500 self.__menus["help"].addSeparator() 2514 self.__menus["help"].addSeparator()
2515 self.__menus["help"].addAction(self.showErrorLogAct)
2501 self.__menus["help"].addAction(self.reportBugAct) 2516 self.__menus["help"].addAction(self.reportBugAct)
2502 self.__menus["help"].addAction(self.requestFeatureAct) 2517 self.__menus["help"].addAction(self.requestFeatureAct)
2503 self.__menus["help"].addSeparator() 2518 self.__menus["help"].addSeparator()
2504 self.__menus["help"].addAction(self.whatsThisAct) 2519 self.__menus["help"].addAction(self.whatsThisAct)
2505 self.__menus["help"].aboutToShow.connect(self.__showHelpMenu) 2520 self.__menus["help"].aboutToShow.connect(self.__showHelpMenu)
2839 """ 2854 """
2840 Private slot to display the Help menu. 2855 Private slot to display the Help menu.
2841 """ 2856 """
2842 self.checkUpdateAct.setEnabled(not self.__inVersionCheck) 2857 self.checkUpdateAct.setEnabled(not self.__inVersionCheck)
2843 self.showVersionsAct.setEnabled(not self.__inVersionCheck) 2858 self.showVersionsAct.setEnabled(not self.__inVersionCheck)
2859 self.showErrorLogAct.setEnabled(self.__hasErrorLog())
2844 2860
2845 self.showMenu.emit("Help", self.__menus["help"]) 2861 self.showMenu.emit("Help", self.__menus["help"])
2846 2862
2847 def __showSettingsMenu(self): 2863 def __showSettingsMenu(self):
2848 """ 2864 """
3004 """ 3020 """
3005 Public method to check for the presence of an error log and ask the 3021 Public method to check for the presence of an error log and ask the
3006 user, what to do with it. 3022 user, what to do with it.
3007 """ 3023 """
3008 if Preferences.getUI("CheckErrorLog"): 3024 if Preferences.getUI("CheckErrorLog"):
3009 logFile = os.path.join(Utilities.getConfigDir(), "eric5_error.log") 3025 logFile = os.path.join(Utilities.getConfigDir(),
3026 self.ErrorLogFileName)
3010 if os.path.exists(logFile): 3027 if os.path.exists(logFile):
3011 from .ErrorLogDialog import ErrorLogDialog 3028 from .ErrorLogDialog import ErrorLogDialog
3012 dlg = ErrorLogDialog(logFile, self) 3029 dlg = ErrorLogDialog(logFile, False, self)
3013 dlg.exec_() 3030 dlg.exec_()
3031
3032 def __hasErrorLog(self):
3033 """
3034 Private method to check, if an error log file exists.
3035
3036 @return flag indicating the existence of an error log file (boolean)
3037 """
3038 logFile = os.path.join(Utilities.getConfigDir(),
3039 self.ErrorLogFileName)
3040 return os.path.exists(logFile)
3041
3042 def __showErrorLog(self):
3043 """
3044 Private slot to show the most recent error log message.
3045 """
3046 logFile = os.path.join(Utilities.getConfigDir(),
3047 self.ErrorLogFileName)
3048 if os.path.exists(logFile):
3049 from .ErrorLogDialog import ErrorLogDialog
3050 dlg = ErrorLogDialog(logFile, True, self)
3051 dlg.show()
3014 3052
3015 def __compareFiles(self): 3053 def __compareFiles(self):
3016 """ 3054 """
3017 Private slot to handle the Compare Files dialog. 3055 Private slot to handle the Compare Files dialog.
3018 """ 3056 """
5567 """ 5605 """
5568 from PluginManager.PluginUninstallDialog import PluginUninstallDialog 5606 from PluginManager.PluginUninstallDialog import PluginUninstallDialog
5569 dlg = PluginUninstallDialog(self.pluginManager, self) 5607 dlg = PluginUninstallDialog(self.pluginManager, self)
5570 dlg.exec_() 5608 dlg.exec_()
5571 5609
5572 def __showPluginsAvailable(self): 5610 def showPluginsAvailable(self):
5573 """ 5611 """
5574 Private slot to show the plugins available for download. 5612 Public slot to show the plugins available for download.
5575 """ 5613 """
5576 from PluginManager.PluginRepositoryDialog import PluginRepositoryDialog 5614 from PluginManager.PluginRepositoryDialog import PluginRepositoryDialog
5577 dlg = PluginRepositoryDialog(self) 5615 dlg = PluginRepositoryDialog(self)
5578 res = dlg.exec_() 5616 res = dlg.exec_()
5579 if res == (QDialog.Accepted + 1): 5617 if res == (QDialog.Accepted + 1):
5582 def __pluginsConfigure(self): 5620 def __pluginsConfigure(self):
5583 """ 5621 """
5584 Private slot to show the plugin manager configuration page. 5622 Private slot to show the plugin manager configuration page.
5585 """ 5623 """
5586 self.showPreferences("pluginManagerPage") 5624 self.showPreferences("pluginManagerPage")
5625
5626 def checkPluginUpdatesAvailable(self):
5627 """
5628 Public method to check the availability of updates of plug-ins.
5629 """
5630 self.pluginManager.checkPluginUpdatesAvailable()
5587 5631
5588 ################################################################# 5632 #################################################################
5589 ## Drag and Drop Support 5633 ## Drag and Drop Support
5590 ################################################################# 5634 #################################################################
5591 5635
5755 if lastCheck.isValid(): 5799 if lastCheck.isValid():
5756 now = QDate.currentDate() 5800 now = QDate.currentDate()
5757 if period == 2 and lastCheck.day() == now.day(): 5801 if period == 2 and lastCheck.day() == now.day():
5758 # daily 5802 # daily
5759 return 5803 return
5760 elif period == 3 and lastCheck.daysTo(now) < 7: 5804 elif (period == 3 and
5805 lastCheck.weekNumber() == now.weekNumber()):
5761 # weekly 5806 # weekly
5762 return 5807 return
5763 elif period == 4 and lastCheck.month() == now.month(): 5808 elif period == 4 and lastCheck.month() == now.month():
5764 # monthly 5809 # monthly
5765 return 5810 return
5772 self.__versionCheckCanceled = False 5817 self.__versionCheckCanceled = False
5773 if manual: 5818 if manual:
5774 if self.__versionCheckProgress is None: 5819 if self.__versionCheckProgress is None:
5775 self.__versionCheckProgress = E5ProgressDialog( 5820 self.__versionCheckProgress = E5ProgressDialog(
5776 "", self.trUtf8("&Cancel"), 5821 "", self.trUtf8("&Cancel"),
5777 0, len(self.__httpAlternatives), 5822 0, len(self.__httpAlternatives),
5778 self.trUtf8("%v/%m"), self) 5823 self.trUtf8("%v/%m"), self)
5779 self.__versionCheckProgress.setMinimumDuration(0) 5824 self.__versionCheckProgress.setMinimumDuration(0)
5780 self.__versionCheckProgress.canceled.connect( 5825 self.__versionCheckProgress.canceled.connect(
5781 self.__versionsDownloadCanceled) 5826 self.__versionsDownloadCanceled)
5782 self.__versionCheckProgress.setLabelText( 5827 self.__versionCheckProgress.setLabelText(
5783 self.trUtf8("Trying host {0}").format(url.host())) 5828 self.trUtf8("Trying host {0}").format(url.host()))

eric ide

mercurial