eric6/UI/UserInterface.py

branch
maintenance
changeset 8043
0acf98cd089a
parent 7939
0fc1df79965d
parent 7973
e836d196e888
child 8142
43248bafe9b2
equal deleted inserted replaced
7991:866adc8c315b 8043:0acf98cd089a
31 QNetworkProxyFactory, QNetworkAccessManager, QNetworkRequest, QNetworkReply 31 QNetworkProxyFactory, QNetworkAccessManager, QNetworkRequest, QNetworkReply
32 ) 32 )
33 33
34 from .Info import Version, VersionOnly, BugAddress, Program, FeatureAddress 34 from .Info import Version, VersionOnly, BugAddress, Program, FeatureAddress
35 from . import Config 35 from . import Config
36 from .NotificationWidget import NotificationTypes
36 37
37 from E5Gui.E5SingleApplication import E5SingleApplicationServer 38 from E5Gui.E5SingleApplication import E5SingleApplicationServer
38 from E5Gui.E5Action import E5Action, createActionGroup 39 from E5Gui.E5Action import E5Action, createActionGroup
39 from E5Gui.E5ToolBarManager import E5ToolBarManager 40 from E5Gui.E5ToolBarManager import E5ToolBarManager
40 from E5Gui import E5MessageBox, E5FileDialog, E5ErrorMessage 41 from E5Gui import E5MessageBox, E5FileDialog, E5ErrorMessage
48 import Utilities 49 import Utilities
49 import Globals 50 import Globals
50 51
51 import UI.PixmapCache 52 import UI.PixmapCache
52 53
53 from E5Network.E5NetworkIcon import E5NetworkIcon
54 from E5Network.E5NetworkProxyFactory import ( 54 from E5Network.E5NetworkProxyFactory import (
55 E5NetworkProxyFactory, proxyAuthenticationRequired 55 E5NetworkProxyFactory, proxyAuthenticationRequired
56 ) 56 )
57 try: 57 try:
58 from E5Network.E5SslErrorHandler import E5SslErrorHandler 58 from E5Network.E5SslErrorHandler import E5SslErrorHandler
135 @signal reloadAPIs() emitted to reload the api information 135 @signal reloadAPIs() emitted to reload the api information
136 @signal showMenu(str, QMenu) emitted when a menu is about to be shown. The 136 @signal showMenu(str, QMenu) emitted when a menu is about to be shown. The
137 name of the menu and a reference to the menu are given. 137 name of the menu and a reference to the menu are given.
138 @signal masterPasswordChanged(str, str) emitted after the master 138 @signal masterPasswordChanged(str, str) emitted after the master
139 password has been changed with the old and the new password 139 password has been changed with the old and the new password
140 @signal onlineStateChanged(online) emitted to indicate a change of the
141 network state
142 """ 140 """
143 appendStderr = pyqtSignal(str) 141 appendStderr = pyqtSignal(str)
144 appendStdout = pyqtSignal(str) 142 appendStdout = pyqtSignal(str)
145 preferencesChanged = pyqtSignal() 143 preferencesChanged = pyqtSignal()
146 reloadAPIs = pyqtSignal() 144 reloadAPIs = pyqtSignal()
147 showMenu = pyqtSignal(str, QMenu) 145 showMenu = pyqtSignal(str, QMenu)
148 masterPasswordChanged = pyqtSignal(str, str) 146 masterPasswordChanged = pyqtSignal(str, str)
149 onlineStateChanged = pyqtSignal(bool)
150 147
151 maxFilePathLen = 100 148 maxFilePathLen = 100
152 maxMenuFilePathLen = 75 149 maxMenuFilePathLen = 75
153 150
154 LeftSide = 1 151 LeftSide = 1
430 self.__writeCrashSession) 427 self.__writeCrashSession)
431 428
432 self.debuggerUI.resetUI.connect(self.viewmanager.handleResetUI) 429 self.debuggerUI.resetUI.connect(self.viewmanager.handleResetUI)
433 self.debuggerUI.resetUI.connect(self.debugViewer.handleResetUI) 430 self.debuggerUI.resetUI.connect(self.debugViewer.handleResetUI)
434 self.debuggerUI.resetUI.connect(self.__debuggingDone) 431 self.debuggerUI.resetUI.connect(self.__debuggingDone)
435 self.debuggerUI.debuggingStarted.connect(
436 self.debugViewer.exceptionLogger.debuggingStarted)
437 self.debuggerUI.debuggingStarted.connect(
438 self.debugViewer.handleDebuggingStarted)
439 self.debuggerUI.debuggingStarted.connect(self.__programChange) 432 self.debuggerUI.debuggingStarted.connect(self.__programChange)
440 self.debuggerUI.debuggingStarted.connect(self.__debuggingStarted) 433 self.debuggerUI.debuggingStarted.connect(self.__debuggingStarted)
441 self.debuggerUI.compileForms.connect( 434 self.debuggerUI.compileForms.connect(
442 self.projectBrowser.pfBrowser.compileChangedForms) 435 self.projectBrowser.pfBrowser.compileChangedForms)
443 self.debuggerUI.compileResources.connect( 436 self.debuggerUI.compileResources.connect(
444 self.projectBrowser.prBrowser.compileChangedResources) 437 self.projectBrowser.prBrowser.compileChangedResources)
445 self.debuggerUI.executeMake.connect(self.project.executeMake) 438 self.debuggerUI.executeMake.connect(self.project.executeMake)
446 self.debuggerUI.appendStdout.connect(self.appendToStdout) 439 self.debuggerUI.appendStdout.connect(self.appendToStdout)
447 440
448 debugServer.passiveDebugStarted.connect(
449 self.debugViewer.exceptionLogger.debuggingStarted)
450 debugServer.passiveDebugStarted.connect(
451 self.debugViewer.handleDebuggingStarted)
452 debugServer.clientException.connect(
453 self.debugViewer.exceptionLogger.addException)
454 debugServer.clientLine.connect(
455 self.debugViewer.breakpointViewer.highlightBreakpoint)
456 debugServer.clientDisassembly.connect( 441 debugServer.clientDisassembly.connect(
457 self.debugViewer.disassemblyViewer.showDisassembly) 442 self.debugViewer.disassemblyViewer.showDisassembly)
458 debugServer.clientProcessStdout.connect(self.appendToStdout) 443 debugServer.clientProcessStdout.connect(self.appendToStdout)
459 debugServer.clientProcessStderr.connect(self.appendToStderr) 444 debugServer.clientProcessStderr.connect(self.appendToStderr)
460 debugServer.appendStdout.connect(self.appendToStdout) 445 debugServer.appendStdout.connect(self.appendToStdout)
1698 UI.PixmapCache.getIcon("newWindow"), 1683 UI.PixmapCache.getIcon("newWindow"),
1699 self.tr('New &Window'), 1684 self.tr('New &Window'),
1700 QKeySequence(self.tr("Ctrl+Shift+N", "File|New Window")), 1685 QKeySequence(self.tr("Ctrl+Shift+N", "File|New Window")),
1701 0, self, 'new_window') 1686 0, self, 'new_window')
1702 self.newWindowAct.setStatusTip(self.tr( 1687 self.newWindowAct.setStatusTip(self.tr(
1703 'Open a new eric6 instance')) 1688 'Open a new eric instance'))
1704 self.newWindowAct.setWhatsThis(self.tr( 1689 self.newWindowAct.setWhatsThis(self.tr(
1705 """<b>New Window</b>""" 1690 """<b>New Window</b>"""
1706 """<p>This opens a new instance of the eric6 IDE.</p>""" 1691 """<p>This opens a new instance of the eric IDE.</p>"""
1707 )) 1692 ))
1708 self.newWindowAct.triggered.connect(self.__newWindow) 1693 self.newWindowAct.triggered.connect(self.__newWindow)
1709 self.actions.append(self.newWindowAct) 1694 self.actions.append(self.newWindowAct)
1710 self.newWindowAct.setEnabled( 1695 self.newWindowAct.setEnabled(
1711 not Preferences.getUI("SingleApplicationMode")) 1696 not Preferences.getUI("SingleApplicationMode"))
2144 0, self, 'helpviewer') 2129 0, self, 'helpviewer')
2145 self.helpviewerAct.setStatusTip(self.tr( 2130 self.helpviewerAct.setStatusTip(self.tr(
2146 'Open the helpviewer window')) 2131 'Open the helpviewer window'))
2147 self.helpviewerAct.setWhatsThis(self.tr( 2132 self.helpviewerAct.setWhatsThis(self.tr(
2148 """<b>Helpviewer</b>""" 2133 """<b>Helpviewer</b>"""
2149 """<p>Display the eric6 web browser. This window will show""" 2134 """<p>Display the eric web browser. This window will show"""
2150 """ HTML help files and help from Qt help collections. It""" 2135 """ HTML help files and help from Qt help collections. It"""
2151 """ has the capability to navigate to links, set bookmarks,""" 2136 """ has the capability to navigate to links, set bookmarks,"""
2152 """ print the displayed help and some more features. You may""" 2137 """ print the displayed help and some more features. You may"""
2153 """ use it to browse the internet as well</p><p>If called""" 2138 """ use it to browse the internet as well</p><p>If called"""
2154 """ with a word selected, this word is search in the Qt help""" 2139 """ with a word selected, this word is search in the Qt help"""
2179 self.tr('Check for Updates'), 2164 self.tr('Check for Updates'),
2180 self.tr('Check for &Updates...'), 0, 0, self, 'check_updates') 2165 self.tr('Check for &Updates...'), 0, 0, self, 'check_updates')
2181 self.checkUpdateAct.setStatusTip(self.tr('Check for Updates')) 2166 self.checkUpdateAct.setStatusTip(self.tr('Check for Updates'))
2182 self.checkUpdateAct.setWhatsThis(self.tr( 2167 self.checkUpdateAct.setWhatsThis(self.tr(
2183 """<b>Check for Updates...</b>""" 2168 """<b>Check for Updates...</b>"""
2184 """<p>Checks the internet for updates of eric6.</p>""" 2169 """<p>Checks the internet for updates of eric.</p>"""
2185 )) 2170 ))
2186 self.checkUpdateAct.triggered.connect(self.performVersionCheck) 2171 self.checkUpdateAct.triggered.connect(self.performVersionCheck)
2187 self.actions.append(self.checkUpdateAct) 2172 self.actions.append(self.checkUpdateAct)
2188 2173
2189 self.showVersionsAct = E5Action( 2174 self.showVersionsAct = E5Action(
2192 0, 0, self, 'show_downloadable_versions') 2177 0, 0, self, 'show_downloadable_versions')
2193 self.showVersionsAct.setStatusTip( 2178 self.showVersionsAct.setStatusTip(
2194 self.tr('Show the versions available for download')) 2179 self.tr('Show the versions available for download'))
2195 self.showVersionsAct.setWhatsThis(self.tr( 2180 self.showVersionsAct.setWhatsThis(self.tr(
2196 """<b>Show downloadable versions...</b>""" 2181 """<b>Show downloadable versions...</b>"""
2197 """<p>Shows the eric6 versions available for download """ 2182 """<p>Shows the eric versions available for download """
2198 """from the internet.</p>""" 2183 """from the internet.</p>"""
2199 )) 2184 ))
2200 self.showVersionsAct.triggered.connect( 2185 self.showVersionsAct.triggered.connect(
2201 self.showAvailableVersionsInfo) 2186 self.showAvailableVersionsInfo)
2202 self.actions.append(self.showVersionsAct) 2187 self.actions.append(self.showVersionsAct)
2465 self.tr('Hex Editor'), 2450 self.tr('Hex Editor'),
2466 UI.PixmapCache.getIcon("hexEditor"), 2451 UI.PixmapCache.getIcon("hexEditor"),
2467 self.tr('&Hex Editor...'), 2452 self.tr('&Hex Editor...'),
2468 0, 0, self, 'hex_editor') 2453 0, 0, self, 'hex_editor')
2469 self.hexEditorAct.setStatusTip(self.tr( 2454 self.hexEditorAct.setStatusTip(self.tr(
2470 'Start the eric6 Hex Editor')) 2455 'Start the eric Hex Editor'))
2471 self.hexEditorAct.setWhatsThis(self.tr( 2456 self.hexEditorAct.setWhatsThis(self.tr(
2472 """<b>Hex Editor</b>""" 2457 """<b>Hex Editor</b>"""
2473 """<p>Starts the eric6 Hex Editor for viewing or editing""" 2458 """<p>Starts the eric Hex Editor for viewing or editing"""
2474 """ binary files.</p>""" 2459 """ binary files.</p>"""
2475 )) 2460 ))
2476 self.hexEditorAct.triggered.connect(self.__openHexEditor) 2461 self.hexEditorAct.triggered.connect(self.__openHexEditor)
2477 self.actions.append(self.hexEditorAct) 2462 self.actions.append(self.hexEditorAct)
2478 2463
2479 self.webBrowserAct = E5Action( 2464 self.webBrowserAct = E5Action(
2480 self.tr('eric6 Web Browser'), 2465 self.tr('eric Web Browser'),
2481 UI.PixmapCache.getIcon("ericWeb"), 2466 UI.PixmapCache.getIcon("ericWeb"),
2482 self.tr('eric6 &Web Browser...'), 2467 self.tr('eric &Web Browser...'),
2483 0, 0, self, 'web_browser') 2468 0, 0, self, 'web_browser')
2484 self.webBrowserAct.setStatusTip(self.tr( 2469 self.webBrowserAct.setStatusTip(self.tr(
2485 'Start the eric6 Web Browser')) 2470 'Start the eric Web Browser'))
2486 self.webBrowserAct.setWhatsThis(self.tr( 2471 self.webBrowserAct.setWhatsThis(self.tr(
2487 """<b>eric6 Web Browser</b>""" 2472 """<b>eric Web Browser</b>"""
2488 """<p>Browse the Internet with the eric6 Web Browser.</p>""" 2473 """<p>Browse the Internet with the eric Web Browser.</p>"""
2489 )) 2474 ))
2490 self.webBrowserAct.triggered.connect(self.__startWebBrowser) 2475 self.webBrowserAct.triggered.connect(self.__startWebBrowser)
2491 self.actions.append(self.webBrowserAct) 2476 self.actions.append(self.webBrowserAct)
2492 ## else:
2493 ## self.webBrowserAct = None
2494 2477
2495 self.iconEditorAct = E5Action( 2478 self.iconEditorAct = E5Action(
2496 self.tr('Icon Editor'), 2479 self.tr('Icon Editor'),
2497 UI.PixmapCache.getIcon("iconEditor"), 2480 UI.PixmapCache.getIcon("iconEditor"),
2498 self.tr('&Icon Editor...'), 2481 self.tr('&Icon Editor...'),
2499 0, 0, self, 'icon_editor') 2482 0, 0, self, 'icon_editor')
2500 self.iconEditorAct.setStatusTip(self.tr( 2483 self.iconEditorAct.setStatusTip(self.tr(
2501 'Start the eric6 Icon Editor')) 2484 'Start the eric Icon Editor'))
2502 self.iconEditorAct.setWhatsThis(self.tr( 2485 self.iconEditorAct.setWhatsThis(self.tr(
2503 """<b>Icon Editor</b>""" 2486 """<b>Icon Editor</b>"""
2504 """<p>Starts the eric6 Icon Editor for editing simple icons.</p>""" 2487 """<p>Starts the eric Icon Editor for editing simple icons.</p>"""
2505 )) 2488 ))
2506 self.iconEditorAct.triggered.connect(self.__editPixmap) 2489 self.iconEditorAct.triggered.connect(self.__editPixmap)
2507 self.actions.append(self.iconEditorAct) 2490 self.actions.append(self.iconEditorAct)
2508 2491
2509 self.snapshotAct = E5Action( 2492 self.snapshotAct = E5Action(
2586 self.showExternalToolsAct.setStatusTip(self.tr( 2569 self.showExternalToolsAct.setStatusTip(self.tr(
2587 'Show external tools')) 2570 'Show external tools'))
2588 self.showExternalToolsAct.setWhatsThis(self.tr( 2571 self.showExternalToolsAct.setWhatsThis(self.tr(
2589 """<b>Show external tools</b>""" 2572 """<b>Show external tools</b>"""
2590 """<p>Opens a dialog to show the path and versions of all""" 2573 """<p>Opens a dialog to show the path and versions of all"""
2591 """ extenal tools used by eric6.</p>""" 2574 """ extenal tools used by eric.</p>"""
2592 )) 2575 ))
2593 self.showExternalToolsAct.triggered.connect( 2576 self.showExternalToolsAct.triggered.connect(
2594 self.__showExternalTools) 2577 self.__showExternalTools)
2595 self.actions.append(self.showExternalToolsAct) 2578 self.actions.append(self.showExternalToolsAct)
2596 2579
2862 """ 2845 """
2863 Private slot to initialize the action to show the Qt documentation. 2846 Private slot to initialize the action to show the Qt documentation.
2864 """ 2847 """
2865 self.qt5DocAct = E5Action( 2848 self.qt5DocAct = E5Action(
2866 self.tr('Qt5 Documentation'), 2849 self.tr('Qt5 Documentation'),
2867 self.tr('Qt&5 Documentation'), 2850 self.tr('Qt5 Documentation'),
2868 0, 0, self, 'qt5_documentation') 2851 0, 0, self, 'qt5_documentation')
2869 self.qt5DocAct.setStatusTip(self.tr('Open Qt5 Documentation')) 2852 self.qt5DocAct.setStatusTip(self.tr('Open Qt5 Documentation'))
2870 self.qt5DocAct.setWhatsThis(self.tr( 2853 self.qt5DocAct.setWhatsThis(self.tr(
2871 """<b>Qt5 Documentation</b>""" 2854 """<b>Qt5 Documentation</b>"""
2872 """<p>Display the Qt5 Documentation. Dependent upon your""" 2855 """<p>Display the Qt5 Documentation. Dependent upon your"""
2873 """ settings, this will either show the help in Eric's internal""" 2856 """ settings, this will either show the help in Eric's internal"""
2874 """ help viewer/web browser, or execute a web browser or Qt""" 2857 """ help viewer/web browser, or execute a web browser or Qt"""
2875 """ Assistant. </p>""" 2858 """ Assistant. </p>"""
2876 )) 2859 ))
2877 self.qt5DocAct.triggered.connect(self.__showQt5Doc) 2860 self.qt5DocAct.triggered.connect(lambda: self.__showQtDoc(5))
2878 self.actions.append(self.qt5DocAct) 2861 self.actions.append(self.qt5DocAct)
2862
2863 self.qt6DocAct = E5Action(
2864 self.tr('Qt6 Documentation'),
2865 self.tr('Qt6 Documentation'),
2866 0, 0, self, 'qt6_documentation')
2867 self.qt6DocAct.setStatusTip(self.tr('Open Qt6 Documentation'))
2868 self.qt6DocAct.setWhatsThis(self.tr(
2869 """<b>Qt6 Documentation</b>"""
2870 """<p>Display the Qt6 Documentation. Dependent upon your"""
2871 """ settings, this will either show the help in Eric's internal"""
2872 """ help viewer/web browser, or execute a web browser or Qt"""
2873 """ Assistant. </p>"""
2874 ))
2875 self.qt6DocAct.triggered.connect(lambda: self.__showQtDoc(6))
2876 self.actions.append(self.qt6DocAct)
2879 2877
2880 self.pyqt5DocAct = E5Action( 2878 self.pyqt5DocAct = E5Action(
2881 self.tr('PyQt5 Documentation'), 2879 self.tr('PyQt5 Documentation'),
2882 self.tr('PyQt&5 Documentation'), 2880 self.tr('PyQt5 Documentation'),
2883 0, 0, self, 'pyqt5_documentation') 2881 0, 0, self, 'pyqt5_documentation')
2884 self.pyqt5DocAct.setStatusTip(self.tr( 2882 self.pyqt5DocAct.setStatusTip(self.tr(
2885 'Open PyQt5 Documentation')) 2883 'Open PyQt5 Documentation'))
2886 self.pyqt5DocAct.setWhatsThis(self.tr( 2884 self.pyqt5DocAct.setWhatsThis(self.tr(
2887 """<b>PyQt5 Documentation</b>""" 2885 """<b>PyQt5 Documentation</b>"""
2888 """<p>Display the PyQt5 Documentation. Dependent upon your""" 2886 """<p>Display the PyQt5 Documentation. Dependent upon your"""
2889 """ settings, this will either show the help in Eric's""" 2887 """ settings, this will either show the help in Eric's"""
2890 """ internal help viewer/web browser, or execute a web""" 2888 """ internal help viewer/web browser, or execute a web"""
2891 """ browser or Qt Assistant. </p>""" 2889 """ browser or Qt Assistant. </p>"""
2892 )) 2890 ))
2893 self.pyqt5DocAct.triggered.connect(self.__showPyQt5Doc) 2891 self.pyqt5DocAct.triggered.connect(
2892 lambda: self.__showPyQtDoc(variant=5))
2894 self.actions.append(self.pyqt5DocAct) 2893 self.actions.append(self.pyqt5DocAct)
2895 2894
2895 self.pyqt6DocAct = E5Action(
2896 self.tr('PyQt6 Documentation'),
2897 self.tr('PyQt6 Documentation'),
2898 0, 0, self, 'pyqt6_documentation')
2899 self.pyqt6DocAct.setStatusTip(self.tr(
2900 'Open PyQt6 Documentation'))
2901 self.pyqt6DocAct.setWhatsThis(self.tr(
2902 """<b>PyQt6 Documentation</b>"""
2903 """<p>Display the PyQt6 Documentation. Dependent upon your"""
2904 """ settings, this will either show the help in Eric's"""
2905 """ internal help viewer/web browser, or execute a web"""
2906 """ browser or Qt Assistant. </p>"""
2907 ))
2908 self.pyqt6DocAct.triggered.connect(
2909 lambda: self.__showPyQtDoc(variant=6))
2910 self.actions.append(self.pyqt6DocAct)
2911
2896 def __initPythonDocActions(self): 2912 def __initPythonDocActions(self):
2897 """ 2913 """
2898 Private slot to initialize the actions to show the Python 2914 Private slot to initialize the actions to show the Python
2899 documentation. 2915 documentation.
2900 """ 2916 """
2901 self.pythonDocAct = E5Action( 2917 self.pythonDocAct = E5Action(
2902 self.tr('Python 3 Documentation'), 2918 self.tr('Python 3 Documentation'),
2903 self.tr('Python &3 Documentation'), 2919 self.tr('Python 3 Documentation'),
2904 0, 0, self, 'python3_documentation') 2920 0, 0, self, 'python3_documentation')
2905 self.pythonDocAct.setStatusTip(self.tr( 2921 self.pythonDocAct.setStatusTip(self.tr(
2906 'Open Python 3 Documentation')) 2922 'Open Python 3 Documentation'))
2907 self.pythonDocAct.setWhatsThis(self.tr( 2923 self.pythonDocAct.setWhatsThis(self.tr(
2908 """<b>Python 3 Documentation</b>""" 2924 """<b>Python 3 Documentation</b>"""
2916 self.pythonDocAct.triggered.connect(self.__showPythonDoc) 2932 self.pythonDocAct.triggered.connect(self.__showPythonDoc)
2917 self.actions.append(self.pythonDocAct) 2933 self.actions.append(self.pythonDocAct)
2918 2934
2919 def __initEricDocAction(self): 2935 def __initEricDocAction(self):
2920 """ 2936 """
2921 Private slot to initialize the action to show the eric6 documentation. 2937 Private slot to initialize the action to show the eric documentation.
2922 """ 2938 """
2923 self.ericDocAct = E5Action( 2939 self.ericDocAct = E5Action(
2924 self.tr("Eric API Documentation"), 2940 self.tr("Eric API Documentation"),
2925 self.tr('&Eric API Documentation'), 2941 self.tr('Eric API Documentation'),
2926 0, 0, self, 'eric_documentation') 2942 0, 0, self, 'eric_documentation')
2927 self.ericDocAct.setStatusTip(self.tr( 2943 self.ericDocAct.setStatusTip(self.tr(
2928 "Open Eric API Documentation")) 2944 "Open Eric API Documentation"))
2929 self.ericDocAct.setWhatsThis(self.tr( 2945 self.ericDocAct.setWhatsThis(self.tr(
2930 """<b>Eric API Documentation</b>""" 2946 """<b>Eric API Documentation</b>"""
2931 """<p>Display the Eric API documentation. The location for the""" 2947 """<p>Display the Eric API documentation. The location for the"""
2932 """ documentation is the Documentation/Source subdirectory of""" 2948 """ documentation is the Documentation/Source subdirectory of"""
2933 """ the eric6 installation directory.</p>""" 2949 """ the eric installation directory.</p>"""
2934 )) 2950 ))
2935 self.ericDocAct.triggered.connect(self.__showEricDoc) 2951 self.ericDocAct.triggered.connect(self.__showEricDoc)
2936 self.actions.append(self.ericDocAct) 2952 self.actions.append(self.ericDocAct)
2937 2953
2938 def __initPySideDocActions(self): 2954 def __initPySideDocActions(self):
2939 """ 2955 """
2940 Private slot to initialize the actions to show the PySide 2956 Private slot to initialize the actions to show the PySide
2941 documentation. 2957 documentation.
2942 """ 2958 """
2943 if Utilities.checkPyside(): 2959 if Utilities.checkPyside(variant=2):
2944 self.pyside2DocAct = E5Action( 2960 self.pyside2DocAct = E5Action(
2945 self.tr('PySide2 Documentation'), 2961 self.tr('PySide2 Documentation'),
2946 self.tr('PySide&2 Documentation'), 2962 self.tr('PySide2 Documentation'),
2947 0, 0, self, 'pyside2_documentation') 2963 0, 0, self, 'pyside2_documentation')
2948 self.pyside2DocAct.setStatusTip(self.tr( 2964 self.pyside2DocAct.setStatusTip(self.tr(
2949 'Open PySide2 Documentation')) 2965 'Open PySide2 Documentation'))
2950 self.pyside2DocAct.setWhatsThis(self.tr( 2966 self.pyside2DocAct.setWhatsThis(self.tr(
2951 """<b>PySide2 Documentation</b>""" 2967 """<b>PySide2 Documentation</b>"""
2953 """ settings, this will either show the help in Eric's""" 2969 """ settings, this will either show the help in Eric's"""
2954 """ internal help viewer/web browser, or execute a web""" 2970 """ internal help viewer/web browser, or execute a web"""
2955 """ browser or Qt Assistant. </p>""" 2971 """ browser or Qt Assistant. </p>"""
2956 )) 2972 ))
2957 self.pyside2DocAct.triggered.connect( 2973 self.pyside2DocAct.triggered.connect(
2958 lambda: self.__showPySideDoc("2")) 2974 lambda: self.__showPySideDoc(variant=2))
2959 self.actions.append(self.pyside2DocAct) 2975 self.actions.append(self.pyside2DocAct)
2960 else: 2976 else:
2961 self.pyside2DocAct = None 2977 self.pyside2DocAct = None
2978
2979 if Utilities.checkPyside(variant=6):
2980 self.pyside6DocAct = E5Action(
2981 self.tr('PySide6 Documentation'),
2982 self.tr('PySide6 Documentation'),
2983 0, 0, self, 'pyside6_documentation')
2984 self.pyside6DocAct.setStatusTip(self.tr(
2985 'Open PySide6 Documentation'))
2986 self.pyside6DocAct.setWhatsThis(self.tr(
2987 """<b>PySide6 Documentation</b>"""
2988 """<p>Display the PySide6 Documentation. Dependent upon your"""
2989 """ settings, this will either show the help in Eric's"""
2990 """ internal help viewer/web browser, or execute a web"""
2991 """ browser or Qt Assistant. </p>"""
2992 ))
2993 self.pyside6DocAct.triggered.connect(
2994 lambda: self.__showPySideDoc(variant=6))
2995 self.actions.append(self.pyside6DocAct)
2996 else:
2997 self.pyside6DocAct = None
2962 2998
2963 def __initMenus(self): 2999 def __initMenus(self):
2964 """ 3000 """
2965 Private slot to create the menus. 3001 Private slot to create the menus.
2966 """ 3002 """
3245 self.__menus["help"].addAction(self.helpviewerAct) 3281 self.__menus["help"].addAction(self.helpviewerAct)
3246 self.__menus["help"].addSeparator() 3282 self.__menus["help"].addSeparator()
3247 self.__menus["help"].addAction(self.ericDocAct) 3283 self.__menus["help"].addAction(self.ericDocAct)
3248 self.__menus["help"].addAction(self.pythonDocAct) 3284 self.__menus["help"].addAction(self.pythonDocAct)
3249 self.__menus["help"].addAction(self.qt5DocAct) 3285 self.__menus["help"].addAction(self.qt5DocAct)
3250 if self.pyqt5DocAct is not None: 3286 self.__menus["help"].addAction(self.qt6DocAct)
3251 self.__menus["help"].addAction(self.pyqt5DocAct) 3287 self.__menus["help"].addAction(self.pyqt5DocAct)
3288 self.__menus["help"].addAction(self.pyqt6DocAct)
3252 if self.pyside2DocAct is not None: 3289 if self.pyside2DocAct is not None:
3253 self.__menus["help"].addAction(self.pyside2DocAct) 3290 self.__menus["help"].addAction(self.pyside2DocAct)
3291 if self.pyside6DocAct is not None:
3292 self.__menus["help"].addAction(self.pyside6DocAct)
3254 self.__menus["help"].addSeparator() 3293 self.__menus["help"].addSeparator()
3255 self.__menus["help"].addAction(self.versionAct) 3294 self.__menus["help"].addAction(self.versionAct)
3256 self.__menus["help"].addSeparator() 3295 self.__menus["help"].addSeparator()
3257 self.__menus["help"].addAction(self.checkUpdateAct) 3296 self.__menus["help"].addAction(self.checkUpdateAct)
3258 self.__menus["help"].addAction(self.showVersionsAct) 3297 self.__menus["help"].addAction(self.showVersionsAct)
3540 3579
3541 from VCS.StatusMonitorLed import StatusMonitorLedWidget 3580 from VCS.StatusMonitorLed import StatusMonitorLedWidget
3542 self.sbVcsMonitorLed = StatusMonitorLedWidget( 3581 self.sbVcsMonitorLed = StatusMonitorLedWidget(
3543 self.project, self.__statusBar) 3582 self.project, self.__statusBar)
3544 self.__statusBar.addPermanentWidget(self.sbVcsMonitorLed) 3583 self.__statusBar.addPermanentWidget(self.sbVcsMonitorLed)
3545
3546 self.networkIcon = E5NetworkIcon(self.__statusBar)
3547 self.__statusBar.addPermanentWidget(self.networkIcon)
3548 self.networkIcon.onlineStateChanged.connect(self.onlineStateChanged)
3549 self.networkIcon.onlineStateChanged.connect(self.__onlineStateChanged)
3550 3584
3551 def __initExternalToolsActions(self): 3585 def __initExternalToolsActions(self):
3552 """ 3586 """
3553 Private slot to create actions for the configured external tools. 3587 Private slot to create actions for the configured external tools.
3554 """ 3588 """
3805 """ 3839 """
3806 if mode == "feature": 3840 if mode == "feature":
3807 address = FeatureAddress 3841 address = FeatureAddress
3808 else: 3842 else:
3809 address = BugAddress 3843 address = BugAddress
3810 subject = "[eric6] " 3844 subject = "[eric] "
3811 if attachFile is not None: 3845 if attachFile is not None:
3812 with open(attachFile, "r", encoding="utf-8") as f: 3846 with open(attachFile, "r", encoding="utf-8") as f:
3813 body = f.read() 3847 body = f.read()
3814 if deleteAttachFile: 3848 if deleteAttachFile:
3815 os.remove(attachFile) 3849 os.remove(attachFile)
4114 args.extend(self.__restartArgs) 4148 args.extend(self.__restartArgs)
4115 QProcess.startDetached(program, args) 4149 QProcess.startDetached(program, args)
4116 4150
4117 def __newWindow(self): 4151 def __newWindow(self):
4118 """ 4152 """
4119 Private slot to start a new instance of eric6. 4153 Private slot to start a new instance of eric.
4120 """ 4154 """
4121 if not Preferences.getUI("SingleApplicationMode"): 4155 if not Preferences.getUI("SingleApplicationMode"):
4122 # start eric6 without any arguments 4156 # start eric without any arguments
4123 program = sys.executable 4157 program = sys.executable
4124 eric6 = os.path.join(getConfig("ericDir"), "eric6.py") 4158 eric6 = os.path.join(getConfig("ericDir"), "eric6.py")
4125 args = [eric6] 4159 args = [eric6]
4126 QProcess.startDetached(program, args) 4160 QProcess.startDetached(program, args)
4127 4161
5164 ) 5198 )
5165 ) 5199 )
5166 5200
5167 def __startWebBrowser(self): 5201 def __startWebBrowser(self):
5168 """ 5202 """
5169 Private slot to start the eric6 web browser. 5203 Private slot to start the eric web browser.
5170 """ 5204 """
5171 self.launchHelpViewer("") 5205 self.launchHelpViewer("")
5172 5206
5173 def __customViewer(self, home=None): 5207 def __customViewer(self, home=None):
5174 """ 5208 """
5650 elif hvType == 3: 5684 elif hvType == 3:
5651 self.__webBrowser(home) 5685 self.__webBrowser(home)
5652 else: 5686 else:
5653 self.__customViewer(home) 5687 self.__customViewer(home)
5654 5688
5655 def __showQt5Doc(self):
5656 """
5657 Private slot to show the Qt5 documentation.
5658 """
5659 self.__showQtDoc(5)
5660
5661 def __showQtDoc(self, version): 5689 def __showQtDoc(self, version):
5662 """ 5690 """
5663 Private method to show the Qt documentation. 5691 Private method to show the Qt documentation.
5664 5692
5665 @param version Qt version to show documentation for (integer) 5693 @param version Qt version to show documentation for
5666 """ 5694 @type int
5667 if version == 5: 5695 """
5668 qtDocDir = Preferences.getQt5DocDir() 5696 if version in [5, 6]:
5697 qtDocDir = Preferences.getQtDocDir(version)
5698 else:
5699 return
5669 5700
5670 if qtDocDir.startswith("qthelp://"): 5701 if qtDocDir.startswith("qthelp://"):
5671 if not os.path.splitext(qtDocDir)[1]: 5702 if not os.path.splitext(qtDocDir)[1]:
5672 home = qtDocDir + "/index.html" 5703 home = qtDocDir + "/index.html"
5673 else: 5704 else:
5707 elif hvType == 3: 5738 elif hvType == 3:
5708 self.__webBrowser(home) 5739 self.__webBrowser(home)
5709 else: 5740 else:
5710 self.__customViewer(home) 5741 self.__customViewer(home)
5711 5742
5712 def __showPyQt5Doc(self): 5743 def __showPyQtDoc(self, variant=5):
5713 """ 5744 """
5714 Private slot to show the PyQt5 documentation. 5745 Private slot to show the PyQt5/6 documentation.
5715 """ 5746
5716 pyqt5DocDir = Preferences.getHelp("PyQt5DocDir") 5747 @param variant PyQt variant to show documentation for (5 or 6)
5717 if not pyqt5DocDir: 5748 @type int or str
5718 pyqt5DocDir = Utilities.getEnvironmentEntry("PYQT5DOCDIR", None) 5749 """
5719 5750 pyqtDocDir = Preferences.getHelp("PyQt{0}DocDir".format(variant))
5720 if not pyqt5DocDir: 5751 if not pyqtDocDir:
5752 pyqtDocDir = Utilities.getEnvironmentEntry(
5753 "PYQT{0}DOCDIR".format(variant), None)
5754
5755 if not pyqtDocDir:
5721 E5MessageBox.warning( 5756 E5MessageBox.warning(
5722 self, 5757 self,
5723 self.tr("Documentation"), 5758 self.tr("Documentation"),
5724 self.tr("""<p>The PyQt5 documentation starting point""" 5759 self.tr("""<p>The PyQt{0} documentation starting point"""
5725 """ has not been configured.</p>""")) 5760 """ has not been configured.</p>""").format(variant))
5726 return 5761 return
5727 5762
5728 if not pyqt5DocDir.startswith(("http://", "https://", "qthelp://")): 5763 if not pyqtDocDir.startswith(("http://", "https://", "qthelp://")):
5729 home = "" 5764 home = ""
5730 if pyqt5DocDir: 5765 if pyqtDocDir:
5731 if pyqt5DocDir.startswith("file://"): 5766 if pyqtDocDir.startswith("file://"):
5732 pyqt5DocDir = pyqt5DocDir[7:] 5767 pyqtDocDir = pyqtDocDir[7:]
5733 if not os.path.splitext(pyqt5DocDir)[1]: 5768 if not os.path.splitext(pyqtDocDir)[1]:
5734 possibleHomes = [ 5769 possibleHomes = [
5735 Utilities.normjoinpath( 5770 Utilities.normjoinpath(
5736 pyqt5DocDir, 'index.html'), 5771 pyqtDocDir, 'index.html'),
5737 Utilities.normjoinpath( 5772 Utilities.normjoinpath(
5738 pyqt5DocDir, 'class_reference.html'), 5773 pyqtDocDir, 'class_reference.html'),
5739 ] 5774 ]
5740 for possibleHome in possibleHomes: 5775 for possibleHome in possibleHomes:
5741 if os.path.exists(possibleHome): 5776 if os.path.exists(possibleHome):
5742 home = possibleHome 5777 home = possibleHome
5743 break 5778 break
5744 else: 5779 else:
5745 home = pyqt5DocDir 5780 home = pyqtDocDir
5746 5781
5747 if not home or not os.path.exists(home): 5782 if not home or not os.path.exists(home):
5748 E5MessageBox.warning( 5783 E5MessageBox.warning(
5749 self, 5784 self,
5750 self.tr("Documentation Missing"), 5785 self.tr("Documentation Missing"),
5756 if Utilities.isWindowsPlatform(): 5791 if Utilities.isWindowsPlatform():
5757 home = "file:///" + Utilities.fromNativeSeparators(home) 5792 home = "file:///" + Utilities.fromNativeSeparators(home)
5758 else: 5793 else:
5759 home = "file://" + home 5794 home = "file://" + home
5760 else: 5795 else:
5761 home = pyqt5DocDir 5796 home = pyqtDocDir
5762 5797
5763 hvType = Preferences.getWebBrowser("HelpViewerType") 5798 hvType = Preferences.getWebBrowser("HelpViewerType")
5764 if hvType == 1: 5799 if hvType == 1:
5765 self.launchHelpViewer(home) 5800 self.launchHelpViewer(home)
5766 elif hvType == 2: 5801 elif hvType == 2:
5808 elif hvType == 3: 5843 elif hvType == 3:
5809 self.__webBrowser(home) 5844 self.__webBrowser(home)
5810 else: 5845 else:
5811 self.__customViewer(home) 5846 self.__customViewer(home)
5812 5847
5813 def __showPySideDoc(self, variant="2"): 5848 def __showPySideDoc(self, variant=2):
5814 """ 5849 """
5815 Private slot to show the PySide2 documentation. 5850 Private slot to show the PySide2/PySide6 documentation.
5816 5851
5817 @param variant PySide variant (2) 5852 @param variant PySide variant (2 or 6)
5818 @type str 5853 @type int or str
5819 """ 5854 """
5820 pysideDocDir = Preferences.getHelp("PySide2DocDir") 5855 pysideDocDir = Preferences.getHelp("PySide{0}DocDir".format(variant))
5821 if not pysideDocDir: 5856 if not pysideDocDir:
5822 pysideDocDir = Utilities.getEnvironmentEntry( 5857 pysideDocDir = Utilities.getEnvironmentEntry(
5823 "PYSIDE2DOCDIR", None) 5858 "PYSIDE{0}DOCDIR".format(variant), None)
5824 5859
5825 if not pysideDocDir: 5860 if not pysideDocDir:
5826 E5MessageBox.warning( 5861 E5MessageBox.warning(
5827 self, 5862 self,
5828 self.tr("Documentation"), 5863 self.tr("Documentation"),
5882 """ 5917 """
5883 Public slot to start the help viewer/web browser. 5918 Public slot to start the help viewer/web browser.
5884 5919
5885 @param home filename of file to be shown or URL to be opened 5920 @param home filename of file to be shown or URL to be opened
5886 @type str or QUrl 5921 @type str or QUrl
5887 @keyparam searchWord word to search for 5922 @param searchWord word to search for
5888 @type str 5923 @type str
5889 @keyparam useSingle flag indicating to use a single browser window 5924 @param useSingle flag indicating to use a single browser window
5890 @type bool 5925 @type bool
5891 """ 5926 """
5892 if isinstance(home, QUrl): 5927 if isinstance(home, QUrl):
5893 home = home.toString(QUrl.None_) 5928 home = home.toString(QUrl.None_)
5894 5929
5907 Private method to start an external web browser and communicate with 5942 Private method to start an external web browser and communicate with
5908 it. 5943 it.
5909 5944
5910 @param home filename of file to be shown or URL to be opened 5945 @param home filename of file to be shown or URL to be opened
5911 @type str 5946 @type str
5912 @keyparam searchWord word to search for 5947 @param searchWord word to search for
5913 @type str 5948 @type str
5914 @return flag indicating a successful launch 5949 @return flag indicating a successful launch
5915 @rtype bool 5950 @rtype bool
5916 """ 5951 """
5917 clientArgs = [] 5952 clientArgs = []
5937 process.start(sys.executable, args) 5972 process.start(sys.executable, args)
5938 if not process.waitForStarted(): 5973 if not process.waitForStarted():
5939 E5MessageBox.warning( 5974 E5MessageBox.warning(
5940 self, 5975 self,
5941 self.tr("Start Web Browser"), 5976 self.tr("Start Web Browser"),
5942 self.tr("""The eric6 web browser could not be""" 5977 self.tr("""The eric web browser could not be"""
5943 """ started.""")) 5978 """ started."""))
5944 return False 5979 return False
5945 5980
5946 res = self.__connectToWebBrowser(process) 5981 res = self.__connectToWebBrowser(process)
5947 if res == 1: 5982 if res == 1:
5998 return -1 6033 return -1
5999 if res <= 0: 6034 if res <= 0:
6000 E5MessageBox.warning( 6035 E5MessageBox.warning(
6001 self, 6036 self,
6002 self.tr("Start Web Browser"), 6037 self.tr("Start Web Browser"),
6003 self.tr("""<p>The eric6 web browser is not started.</p>""" 6038 self.tr("""<p>The eric web browser is not started.</p>"""
6004 """<p>Reason: {0}</p>""").format( 6039 """<p>Reason: {0}</p>""").format(
6005 webBrowserClient.errstr()) 6040 webBrowserClient.errstr())
6006 ) 6041 )
6007 return 1 6042 return 1
6008 6043
6032 6067
6033 self.launchHelpViewer("", searchWord=searchWord) 6068 self.launchHelpViewer("", searchWord=searchWord)
6034 6069
6035 def __webBrowser(self, home=""): 6070 def __webBrowser(self, home=""):
6036 """ 6071 """
6037 Private slot to start the eric6 web browser. 6072 Private slot to start the eric web browser.
6038 6073
6039 @param home full pathname of a file to display (string) 6074 @param home full pathname of a file to display (string)
6040 """ 6075 """
6041 started = QDesktopServices.openUrl(QUrl(home)) 6076 started = QDesktopServices.openUrl(QUrl(home))
6042 if not started: 6077 if not started:
6198 self.reloadAPIs.emit() 6233 self.reloadAPIs.emit()
6199 6234
6200 def __showExternalTools(self): 6235 def __showExternalTools(self):
6201 """ 6236 """
6202 Private slot to display a dialog show a list of external tools used 6237 Private slot to display a dialog show a list of external tools used
6203 by eric6. 6238 by eric.
6204 """ 6239 """
6205 if self.programsDialog is None: 6240 if self.programsDialog is None:
6206 from Preferences.ProgramsDialog import ProgramsDialog 6241 from Preferences.ProgramsDialog import ProgramsDialog
6207 self.programsDialog = ProgramsDialog(self) 6242 self.programsDialog = ProgramsDialog(self)
6208 self.programsDialog.show() 6243 self.programsDialog.show()
6569 """ 6604 """
6570 sessionFile, selectedFilter = E5FileDialog.getSaveFileNameAndFilter( 6605 sessionFile, selectedFilter = E5FileDialog.getSaveFileNameAndFilter(
6571 self, 6606 self,
6572 self.tr("Save session"), 6607 self.tr("Save session"),
6573 Utilities.getHomeDir(), 6608 Utilities.getHomeDir(),
6574 self.tr("eric6 Session Files (*.e5s)"), 6609 self.tr("eric Session Files (*.e5s)"),
6575 "") 6610 "")
6576 6611
6577 if not sessionFile: 6612 if not sessionFile:
6578 return 6613 return
6579 6614
6591 """ 6626 """
6592 sessionFile = E5FileDialog.getOpenFileName( 6627 sessionFile = E5FileDialog.getOpenFileName(
6593 self, 6628 self,
6594 self.tr("Load session"), 6629 self.tr("Load session"),
6595 Utilities.getHomeDir(), 6630 Utilities.getHomeDir(),
6596 self.tr("eric6 Session Files (*.e5s)")) 6631 self.tr("eric Session Files (*.e5s)"))
6597 6632
6598 if not sessionFile: 6633 if not sessionFile:
6599 return 6634 return
6600 6635
6601 self.__readSession(filename=sessionFile) 6636 self.__readSession(filename=sessionFile)
6666 6701
6667 def showFindFilesDialog(self, txt="", searchDir="", openFiles=False): 6702 def showFindFilesDialog(self, txt="", searchDir="", openFiles=False):
6668 """ 6703 """
6669 Public slot to show the Find In Files dialog. 6704 Public slot to show the Find In Files dialog.
6670 6705
6671 @keyparam txt text to search for (string) 6706 @param txt text to search for (string)
6672 @keyparam searchDir directory to search in (string) 6707 @param searchDir directory to search in (string)
6673 @keyparam openFiles flag indicating to operate on open files (boolean) 6708 @param openFiles flag indicating to operate on open files (boolean)
6674 """ 6709 """
6675 if self.findFilesDialog is None: 6710 if self.findFilesDialog is None:
6676 from .FindFileDialog import FindFileDialog 6711 from .FindFileDialog import FindFileDialog
6677 self.findFilesDialog = FindFileDialog(self.project) 6712 self.findFilesDialog = FindFileDialog(self.project)
6678 self.findFilesDialog.sourceFile.connect( 6713 self.findFilesDialog.sourceFile.connect(
6688 6723
6689 def showReplaceFilesDialog(self, txt="", searchDir="", openFiles=False): 6724 def showReplaceFilesDialog(self, txt="", searchDir="", openFiles=False):
6690 """ 6725 """
6691 Public slot to show the Find & Replace In Files dialog. 6726 Public slot to show the Find & Replace In Files dialog.
6692 6727
6693 @keyparam txt text to search for (string) 6728 @param txt text to search for (string)
6694 @keyparam searchDir directory to search in (string) 6729 @param searchDir directory to search in (string)
6695 @keyparam openFiles flag indicating to operate on open files (boolean) 6730 @param openFiles flag indicating to operate on open files (boolean)
6696 """ 6731 """
6697 if self.replaceFilesDialog is None: 6732 if self.replaceFilesDialog is None:
6698 from .FindFileDialog import FindFileDialog 6733 from .FindFileDialog import FindFileDialog
6699 self.replaceFilesDialog = FindFileDialog( 6734 self.replaceFilesDialog = FindFileDialog(
6700 self.project, replaceMode=True) 6735 self.project, replaceMode=True)
6784 6819
6785 def checkPluginUpdatesAvailable(self): 6820 def checkPluginUpdatesAvailable(self):
6786 """ 6821 """
6787 Public method to check the availability of updates of plug-ins. 6822 Public method to check the availability of updates of plug-ins.
6788 """ 6823 """
6789 if self.isOnline(): 6824 self.pluginManager.checkPluginUpdatesAvailable()
6790 self.pluginManager.checkPluginUpdatesAvailable()
6791 6825
6792 ################################################################# 6826 #################################################################
6793 ## Drag and Drop Support 6827 ## Drag and Drop Support
6794 ################################################################# 6828 #################################################################
6795 6829
6946 self.__saveCurrentViewProfile(True) 6980 self.__saveCurrentViewProfile(True)
6947 Preferences.saveToolGroups(self.toolGroups, self.currentToolGroup) 6981 Preferences.saveToolGroups(self.toolGroups, self.currentToolGroup)
6948 Preferences.syncPreferences() 6982 Preferences.syncPreferences()
6949 self.shutdownCalled = True 6983 self.shutdownCalled = True
6950 return True 6984 return True
6951
6952 def isOnline(self):
6953 """
6954 Public method to get the online state.
6955
6956 @return online state
6957 @rtype bool
6958 """
6959 return self.networkIcon.isOnline()
6960
6961 def __onlineStateChanged(self, online):
6962 """
6963 Private slot handling changes in online state.
6964
6965 @param online flag indicating the online state
6966 @type bool
6967 """
6968 if online:
6969 self.performVersionCheck(False)
6970 6985
6971 ############################################## 6986 ##############################################
6972 ## Below are methods to check for new versions 6987 ## Below are methods to check for new versions
6973 ############################################## 6988 ##############################################
6974 6989
6975 def showAvailableVersionsInfo(self): 6990 def showAvailableVersionsInfo(self):
6976 """ 6991 """
6977 Public method to show the eric6 versions available for download. 6992 Public method to show the eric versions available for download.
6978 """ 6993 """
6979 self.performVersionCheck(manual=True, showVersions=True) 6994 self.performVersionCheck(manual=True, showVersions=True)
6980 6995
6981 @pyqtSlot() 6996 @pyqtSlot()
6982 def performVersionCheck(self, manual=True, alternative=0, 6997 def performVersionCheck(self, manual=True, alternative=0,
6983 showVersions=False): 6998 showVersions=False):
6984 """ 6999 """
6985 Public method to check the internet for an eric6 update. 7000 Public method to check the internet for an eric update.
6986 7001
6987 @param manual flag indicating an invocation via the menu (boolean) 7002 @param manual flag indicating an invocation via the menu (boolean)
6988 @param alternative index of server to download from (integer) 7003 @param alternative index of server to download from (integer)
6989 @keyparam showVersions flag indicating the show versions mode (boolean) 7004 @param showVersions flag indicating the show versions mode (boolean)
6990 """ 7005 """
6991 if self.isOnline(): 7006 if not manual:
6992 if not manual: 7007 if VersionOnly.startswith("@@"):
6993 if VersionOnly.startswith("@@"): 7008 return
7009 else:
7010 period = Preferences.getUI("PerformVersionCheck")
7011 if period == 0:
6994 return 7012 return
6995 else: 7013 elif period in [2, 3, 4]:
6996 period = Preferences.getUI("PerformVersionCheck") 7014 lastCheck = Preferences.Prefs.settings.value(
6997 if period == 0: 7015 "Updates/LastCheckDate", QDate(1970, 1, 1))
6998 return 7016 if lastCheck.isValid():
6999 elif period in [2, 3, 4]: 7017 now = QDate.currentDate()
7000 lastCheck = Preferences.Prefs.settings.value( 7018 if period == 2 and lastCheck.day() == now.day():
7001 "Updates/LastCheckDate", QDate(1970, 1, 1)) 7019 # daily
7002 if lastCheck.isValid(): 7020 return
7003 now = QDate.currentDate() 7021 elif period == 3 and lastCheck.daysTo(now) < 7:
7004 if period == 2 and lastCheck.day() == now.day(): 7022 # weekly
7005 # daily 7023 return
7006 return 7024 elif period == 4 and (lastCheck.daysTo(now) <
7007 elif period == 3 and lastCheck.daysTo(now) < 7: 7025 lastCheck.daysInMonth()):
7008 # weekly 7026 # monthly
7009 return 7027 return
7010 elif period == 4 and (lastCheck.daysTo(now) < 7028
7011 lastCheck.daysInMonth()): 7029 self.__inVersionCheck = True
7012 # monthly 7030 self.manualUpdatesCheck = manual
7013 return 7031 self.showAvailableVersions = showVersions
7014 7032 self.httpAlternative = alternative
7015 self.__inVersionCheck = True 7033 url = QUrl(self.__httpAlternatives[alternative])
7016 self.manualUpdatesCheck = manual 7034 self.__versionCheckCanceled = False
7017 self.showAvailableVersions = showVersions 7035 if manual:
7018 self.httpAlternative = alternative 7036 if self.__versionCheckProgress is None:
7019 url = QUrl(self.__httpAlternatives[alternative]) 7037 self.__versionCheckProgress = E5ProgressDialog(
7020 self.__versionCheckCanceled = False 7038 "", self.tr("&Cancel"),
7021 if manual: 7039 0, len(self.__httpAlternatives),
7022 if self.__versionCheckProgress is None: 7040 self.tr("%v/%m"), self)
7023 self.__versionCheckProgress = E5ProgressDialog( 7041 self.__versionCheckProgress.setWindowTitle(
7024 "", self.tr("&Cancel"), 7042 self.tr("Version Check"))
7025 0, len(self.__httpAlternatives), 7043 self.__versionCheckProgress.setMinimumDuration(0)
7026 self.tr("%v/%m"), self) 7044 self.__versionCheckProgress.canceled.connect(
7027 self.__versionCheckProgress.setWindowTitle( 7045 self.__versionsDownloadCanceled)
7028 self.tr("Version Check")) 7046 self.__versionCheckProgress.setLabelText(
7029 self.__versionCheckProgress.setMinimumDuration(0) 7047 self.tr("Trying host {0}").format(url.host()))
7030 self.__versionCheckProgress.canceled.connect( 7048 self.__versionCheckProgress.setValue(alternative)
7031 self.__versionsDownloadCanceled) 7049 request = QNetworkRequest(url)
7032 self.__versionCheckProgress.setLabelText( 7050 request.setAttribute(QNetworkRequest.CacheLoadControlAttribute,
7033 self.tr("Trying host {0}").format(url.host())) 7051 QNetworkRequest.AlwaysNetwork)
7034 self.__versionCheckProgress.setValue(alternative) 7052 reply = self.__networkManager.get(request)
7035 request = QNetworkRequest(url) 7053 reply.finished.connect(lambda: self.__versionsDownloadDone(reply))
7036 request.setAttribute(QNetworkRequest.CacheLoadControlAttribute, 7054 self.__replies.append(reply)
7037 QNetworkRequest.AlwaysNetwork) 7055
7038 reply = self.__networkManager.get(request)
7039 reply.finished.connect(lambda: self.__versionsDownloadDone(reply))
7040 self.__replies.append(reply)
7041 else:
7042 if manual:
7043 E5MessageBox.warning(
7044 self,
7045 self.tr("Error getting versions information"),
7046 self.tr("""The versions information cannot not be"""
7047 """ downloaded because you are <b>offline</b>."""
7048 """ Please go online and try again."""))
7049
7050 @pyqtSlot() 7056 @pyqtSlot()
7051 def __versionsDownloadDone(self, reply): 7057 def __versionsDownloadDone(self, reply):
7052 """ 7058 """
7053 Private slot called, after the versions file has been downloaded 7059 Private slot called, after the versions file has been downloaded
7054 from the internet. 7060 from the internet.
7155 if availableSnapshotDate > installedSnapshotDate: 7161 if availableSnapshotDate > installedSnapshotDate:
7156 res = E5MessageBox.yesNo( 7162 res = E5MessageBox.yesNo(
7157 self, 7163 self,
7158 self.tr("Update available"), 7164 self.tr("Update available"),
7159 self.tr( 7165 self.tr(
7160 """The update to <b>{0}</b> of eric6 is""" 7166 """The update to <b>{0}</b> of eric is"""
7161 """ available at <b>{1}</b>. Would you like""" 7167 """ available at <b>{1}</b>. Would you like"""
7162 """ to get it?""") 7168 """ to get it?""")
7163 .format(versions[2], versions[3]), 7169 .format(versions[2], versions[3]),
7164 yesDefault=True) 7170 yesDefault=True)
7165 url = res and versions[3] or '' 7171 url = res and versions[3] or ''
7168 E5MessageBox.information( 7174 E5MessageBox.information(
7169 self, 7175 self,
7170 self.tr("Update Check"), 7176 self.tr("Update Check"),
7171 self.tr( 7177 self.tr(
7172 """You are using a snapshot release of""" 7178 """You are using a snapshot release of"""
7173 """ eric6. A more up-to-date stable release""" 7179 """ eric. A more up-to-date stable release"""
7174 """ might be available.""")) 7180 """ might be available."""))
7175 elif VersionOnly.startswith(("rev_", "@@")): 7181 elif VersionOnly.startswith(("rev_", "@@")):
7176 # check installation from source 7182 # check installation from source
7177 if self.manualUpdatesCheck: 7183 if self.manualUpdatesCheck:
7178 E5MessageBox.information( 7184 E5MessageBox.information(
7189 if availableVersionTuple > installedVersionTuple: 7195 if availableVersionTuple > installedVersionTuple:
7190 res = E5MessageBox.yesNo( 7196 res = E5MessageBox.yesNo(
7191 self, 7197 self,
7192 self.tr("Update available"), 7198 self.tr("Update available"),
7193 self.tr( 7199 self.tr(
7194 """The update to <b>{0}</b> of eric6 is""" 7200 """The update to <b>{0}</b> of eric is"""
7195 """ available at <b>{1}</b>. Would you like""" 7201 """ available at <b>{1}</b>. Would you like"""
7196 """ to get it?""") 7202 """ to get it?""")
7197 .format(versions[0], versions[1]), 7203 .format(versions[0], versions[1]),
7198 yesDefault=True) 7204 yesDefault=True)
7199 url = res and versions[1] or '' 7205 url = res and versions[1] or ''
7200 else: 7206 else:
7201 if self.manualUpdatesCheck: 7207 if self.manualUpdatesCheck:
7202 E5MessageBox.information( 7208 E5MessageBox.information(
7203 self, 7209 self,
7204 self.tr("Eric6 is up to date"), 7210 self.tr("eric is up to date"),
7205 self.tr( 7211 self.tr(
7206 """You are using the latest version of""" 7212 """You are using the latest version of"""
7207 """ eric6""")) 7213 """ eric"""))
7208 except (IndexError, TypeError): 7214 except (IndexError, TypeError):
7209 E5MessageBox.warning( 7215 E5MessageBox.warning(
7210 self, 7216 self,
7211 self.tr("Error during updates check"), 7217 self.tr("Error during updates check"),
7212 self.tr("""Could not perform updates check.""")) 7218 self.tr("""Could not perform updates check."""))
7274 ## Below are methods for various checks 7280 ## Below are methods for various checks
7275 ####################################### 7281 #######################################
7276 7282
7277 def checkConfigurationStatus(self): 7283 def checkConfigurationStatus(self):
7278 """ 7284 """
7279 Public method to check, if eric6 has been configured. If it is not, 7285 Public method to check, if eric has been configured. If it is not,
7280 the configuration dialog is shown. 7286 the configuration dialog is shown.
7281 """ 7287 """
7282 if not Preferences.isConfigured(): 7288 if not Preferences.isConfigured():
7283 self.__initDebugToolbarsLayout() 7289 self.__initDebugToolbarsLayout()
7284 7290
7285 E5MessageBox.information( 7291 E5MessageBox.information(
7286 self, 7292 self,
7287 self.tr("First time usage"), 7293 self.tr("First time usage"),
7288 self.tr("""eric6 has not been configured yet. """ 7294 self.tr("""eric has not been configured yet. """
7289 """The configuration dialog will be started.""")) 7295 """The configuration dialog will be started."""))
7290 self.showPreferences() 7296 self.showPreferences()
7291 7297
7292 def checkProjectsWorkspace(self): 7298 def checkProjectsWorkspace(self):
7293 """ 7299 """
7308 E5FileDialog.Options(E5FileDialog.Option(0))) 7314 E5FileDialog.Options(E5FileDialog.Option(0)))
7309 Preferences.setMultiProject("Workspace", workspace) 7315 Preferences.setMultiProject("Workspace", workspace)
7310 7316
7311 def versionIsNewer(self, required, snapshot=None): 7317 def versionIsNewer(self, required, snapshot=None):
7312 """ 7318 """
7313 Public method to check, if the eric6 version is good compared to 7319 Public method to check, if the eric version is good compared to
7314 the required version. 7320 the required version.
7315 7321
7316 @param required required version (string) 7322 @param required required version (string)
7317 @param snapshot required snapshot version (string) 7323 @param snapshot required snapshot version (string)
7318 @return flag indicating, that the version is newer than the required 7324 @return flag indicating, that the version is newer than the required
7381 return [p.x(), p.y(), s.width(), s.height(), not w.isHidden()] 7387 return [p.x(), p.y(), s.width(), s.height(), not w.isHidden()]
7382 7388
7383 def getOriginalPathString(self): 7389 def getOriginalPathString(self):
7384 """ 7390 """
7385 Public method to get the original PATH environment variable 7391 Public method to get the original PATH environment variable
7386 (i.e. before modifications by eric6 and PyQt5). 7392 (i.e. before modifications by eric and PyQt5).
7387 7393
7388 @return original PATH environment variable 7394 @return original PATH environment variable
7389 @rtype str 7395 @rtype str
7390 """ 7396 """
7391 return self.__originalPathString 7397 return self.__originalPathString
7407 7413
7408 ########################################## 7414 ##########################################
7409 ## Support for desktop notifications below 7415 ## Support for desktop notifications below
7410 ########################################## 7416 ##########################################
7411 7417
7412 def showNotification(self, icon, heading, text, timeout=None): 7418 def showNotification(self, icon, heading, text,
7419 kind=NotificationTypes.Information, timeout=None):
7413 """ 7420 """
7414 Public method to show a desktop notification. 7421 Public method to show a desktop notification.
7415 7422
7416 @param icon icon to be shown in the notification 7423 @param icon icon to be shown in the notification
7417 @type QPixmap 7424 @type QPixmap
7418 @param heading heading of the notification 7425 @param heading heading of the notification
7419 @type str 7426 @type str
7420 @param text text of the notification 7427 @param text text of the notification
7421 @type str 7428 @type str
7429 @param kind kind of notification to be shown
7430 @type NotificationTypes
7422 @param timeout time in seconds the notification should be shown 7431 @param timeout time in seconds the notification should be shown
7423 (None = use configured timeout, 0 = indefinitely) 7432 (None = use configured timeout, 0 = indefinitely)
7424 @type int 7433 @type int
7425 """ 7434 """
7426 if Preferences.getUI("NotificationsEnabled"): 7435 if self.__notification is None:
7427 if self.__notification is None: 7436 from .NotificationWidget import NotificationWidget
7428 from .NotificationWidget import NotificationWidget 7437 self.__notification = NotificationWidget(parent=self)
7429 self.__notification = NotificationWidget(parent=self) 7438 if timeout is None:
7430 self.__notification.setPixmap(icon) 7439 timeout = Preferences.getUI("NotificationTimeout")
7431 self.__notification.setHeading(heading) 7440 self.__notification.showNotification(icon, heading, text, kind=kind,
7432 self.__notification.setText(text) 7441 timeout=timeout)
7433 if timeout is None:
7434 timeout = Preferences.getUI("NotificationTimeout")
7435 self.__notification.setTimeout(timeout)
7436 self.__notification.move(Preferences.getUI("NotificationPosition"))
7437 self.__notification.show()
7438
7439 def notificationsEnabled(self):
7440 """
7441 Public method to check, if notifications are enabled.
7442
7443 @return flag indicating, if notifications are enabled (boolean)
7444 """
7445 return Preferences.getUI("NotificationsEnabled")
7446 7442
7447 ######################### 7443 #########################
7448 ## Support for IRC below 7444 ## Support for IRC below
7449 ######################### 7445 #########################
7450 7446

eric ide

mercurial