5 |
5 |
6 """ |
6 """ |
7 Module implementing the main user interface. |
7 Module implementing the main user interface. |
8 """ |
8 """ |
9 |
9 |
10 from __future__ import unicode_literals |
|
11 try: |
|
12 str = unicode # __IGNORE_EXCEPTION__ |
|
13 except NameError: |
|
14 pass |
|
15 |
10 |
16 import os |
11 import os |
17 import sys |
12 import sys |
18 import logging |
13 import logging |
19 |
14 |
20 from PyQt5.QtCore import pyqtSlot, QTimer, QFile, QFileInfo, pyqtSignal, \ |
15 from PyQt5.QtCore import ( |
21 PYQT_VERSION_STR, QDate, QIODevice, qVersion, QProcess, QSize, QUrl, \ |
16 pyqtSlot, QTimer, QFile, QFileInfo, pyqtSignal, PYQT_VERSION_STR, QDate, |
22 QObject, Qt, QUuid, QThread |
17 QIODevice, qVersion, QProcess, QSize, QUrl, QObject, Qt, QUuid, QThread, |
|
18 QUrlQuery |
|
19 ) |
23 from PyQt5.QtGui import QKeySequence, QDesktopServices |
20 from PyQt5.QtGui import QKeySequence, QDesktopServices |
24 from PyQt5.QtWidgets import QSizePolicy, QWidget, QWhatsThis, QToolBar, \ |
21 from PyQt5.QtWidgets import ( |
25 QDialog, QSplitter, QApplication, QMenu, QVBoxLayout, QDockWidget, \ |
22 QSizePolicy, QWidget, QWhatsThis, QToolBar, QDialog, QSplitter, |
26 QAction, QLabel |
23 QApplication, QMenu, QVBoxLayout, QDockWidget, QAction, QLabel |
|
24 ) |
27 from PyQt5.Qsci import QSCINTILLA_VERSION_STR |
25 from PyQt5.Qsci import QSCINTILLA_VERSION_STR |
28 from PyQt5.QtNetwork import QNetworkProxyFactory, QNetworkAccessManager, \ |
26 from PyQt5.QtNetwork import ( |
29 QNetworkRequest, QNetworkReply |
27 QNetworkProxyFactory, QNetworkAccessManager, QNetworkRequest, QNetworkReply |
|
28 ) |
30 |
29 |
31 from .Info import Version, VersionOnly, BugAddress, Program, FeatureAddress |
30 from .Info import Version, VersionOnly, BugAddress, Program, FeatureAddress |
32 from . import Config |
31 from . import Config |
33 |
32 |
34 from E5Gui.E5SingleApplication import E5SingleApplicationServer |
33 from E5Gui.E5SingleApplication import E5SingleApplicationServer |
45 import Utilities |
44 import Utilities |
46 |
45 |
47 import UI.PixmapCache |
46 import UI.PixmapCache |
48 |
47 |
49 from E5Network.E5NetworkIcon import E5NetworkIcon |
48 from E5Network.E5NetworkIcon import E5NetworkIcon |
50 from E5Network.E5NetworkProxyFactory import E5NetworkProxyFactory, \ |
49 from E5Network.E5NetworkProxyFactory import ( |
51 proxyAuthenticationRequired |
50 E5NetworkProxyFactory, proxyAuthenticationRequired |
|
51 ) |
52 try: |
52 try: |
53 from E5Network.E5SslErrorHandler import E5SslErrorHandler |
53 from E5Network.E5SslErrorHandler import E5SslErrorHandler |
54 SSL_AVAILABLE = True |
54 SSL_AVAILABLE = True |
55 except ImportError: |
55 except ImportError: |
56 SSL_AVAILABLE = False |
56 SSL_AVAILABLE = False |
57 |
57 |
58 from eric6config import getConfig |
58 from eric6config import getConfig |
59 |
|
60 from Globals import qVersionTuple |
|
61 |
59 |
62 |
60 |
63 class Redirector(QObject): |
61 class Redirector(QObject): |
64 """ |
62 """ |
65 Helper class used to redirect stdout and stderr to the log window. |
63 Helper class used to redirect stdout and stderr to the log window. |
661 self.pluginManager.activatePlugins() |
659 self.pluginManager.activatePlugins() |
662 splash.showMessage(self.tr("Generating Plugins Toolbars...")) |
660 splash.showMessage(self.tr("Generating Plugins Toolbars...")) |
663 self.pluginManager.initPluginToolbars(self.toolbarManager) |
661 self.pluginManager.initPluginToolbars(self.toolbarManager) |
664 if Preferences.getPluginManager("StartupCleanup"): |
662 if Preferences.getPluginManager("StartupCleanup"): |
665 splash.showMessage(self.tr("Cleaning Plugins Download Area...")) |
663 splash.showMessage(self.tr("Cleaning Plugins Download Area...")) |
666 from PluginManager.PluginRepositoryDialog import \ |
664 from PluginManager.PluginRepositoryDialog import ( |
667 PluginRepositoryDownloadCleanup |
665 PluginRepositoryDownloadCleanup |
|
666 ) |
668 PluginRepositoryDownloadCleanup(quiet=True) |
667 PluginRepositoryDownloadCleanup(quiet=True) |
669 |
668 |
670 # now read the keyboard shortcuts for all the actions |
669 # now read the keyboard shortcuts for all the actions |
671 from Preferences import Shortcuts |
670 from Preferences import Shortcuts |
672 Shortcuts.readShortcuts() |
671 Shortcuts.readShortcuts() |
744 @exception ValueError raised to indicate an invalid layout type |
743 @exception ValueError raised to indicate an invalid layout type |
745 """ |
744 """ |
746 # Create the view manager depending on the configuration setting |
745 # Create the view manager depending on the configuration setting |
747 logging.debug("Creating Viewmanager...") |
746 logging.debug("Creating Viewmanager...") |
748 import ViewManager |
747 import ViewManager |
749 self.viewmanager = \ |
748 self.viewmanager = ViewManager.factory( |
750 ViewManager.factory(self, self, debugServer, self.pluginManager) |
749 self, self, debugServer, self.pluginManager) |
751 leftWidget = QWidget() |
750 leftWidget = QWidget() |
752 layout = QVBoxLayout() |
751 layout = QVBoxLayout() |
753 layout.setContentsMargins(1, 1, 1, 1) |
752 layout.setContentsMargins(1, 1, 1, 1) |
754 layout.setSpacing(1) |
753 layout.setSpacing(1) |
755 layout.addWidget(self.viewmanager.mainWidget()) |
754 layout.addWidget(self.viewmanager.mainWidget()) |
977 elif self.__shellPosition == "right": |
976 elif self.__shellPosition == "right": |
978 self.__shellParent = self.rToolboxDock |
977 self.__shellParent = self.rToolboxDock |
979 else: |
978 else: |
980 self.__shellParent = self.hToolboxDock |
979 self.__shellParent = self.hToolboxDock |
981 from QScintilla.Shell import ShellAssembly |
980 from QScintilla.Shell import ShellAssembly |
982 self.shellAssembly = \ |
981 self.shellAssembly = ShellAssembly( |
983 ShellAssembly(debugServer, self.viewmanager, self.project, True) |
982 debugServer, self.viewmanager, self.project, True) |
984 self.shell = self.shellAssembly.shell() |
983 self.shell = self.shellAssembly.shell() |
985 self.__shellParent.widget().insertItem( |
984 self.__shellParent.widget().insertItem( |
986 0, self.shellAssembly, UI.PixmapCache.getIcon("shell.png"), |
985 0, self.shellAssembly, UI.PixmapCache.getIcon("shell.png"), |
987 self.tr("Shell")) |
986 self.tr("Shell")) |
988 |
987 |
1174 elif self.__shellPosition == "right": |
1173 elif self.__shellPosition == "right": |
1175 self.__shellParent = self.rightSidebar |
1174 self.__shellParent = self.rightSidebar |
1176 else: |
1175 else: |
1177 self.__shellParent = self.bottomSidebar |
1176 self.__shellParent = self.bottomSidebar |
1178 from QScintilla.Shell import ShellAssembly |
1177 from QScintilla.Shell import ShellAssembly |
1179 self.shellAssembly = \ |
1178 self.shellAssembly = ShellAssembly( |
1180 ShellAssembly(debugServer, self.viewmanager, self.project, True) |
1179 debugServer, self.viewmanager, self.project, True) |
1181 self.shell = self.shellAssembly.shell() |
1180 self.shell = self.shellAssembly.shell() |
1182 self.__shellParent.insertTab(0, self.shellAssembly, |
1181 self.__shellParent.insertTab(0, self.shellAssembly, |
1183 UI.PixmapCache.getIcon("shell.png"), |
1182 UI.PixmapCache.getIcon("shell.png"), |
1184 self.tr("Shell")) |
1183 self.tr("Shell")) |
1185 |
1184 |
1473 |
1472 |
1474 @param editor filename to be displayed (string) |
1473 @param editor filename to be displayed (string) |
1475 @param project project name to be displayed (string) |
1474 @param project project name to be displayed (string) |
1476 """ |
1475 """ |
1477 if editor is not None and self.captionShowsFilename: |
1476 if editor is not None and self.captionShowsFilename: |
1478 self.capEditor = \ |
1477 self.capEditor = Utilities.compactPath(editor, self.maxFilePathLen) |
1479 Utilities.compactPath(editor, self.maxFilePathLen) |
|
1480 if project is not None: |
1478 if project is not None: |
1481 self.capProject = project |
1479 self.capProject = project |
1482 |
1480 |
1483 if self.passiveMode: |
1481 if self.passiveMode: |
1484 if not self.capProject and not self.capEditor: |
1482 if not self.capProject and not self.capEditor: |
1979 self.condaWidgetActivateAct.triggered.connect( |
1977 self.condaWidgetActivateAct.triggered.connect( |
1980 self.__activateCondaWidget) |
1978 self.__activateCondaWidget) |
1981 self.actions.append(self.condaWidgetActivateAct) |
1979 self.actions.append(self.condaWidgetActivateAct) |
1982 self.addAction(self.condaWidgetActivateAct) |
1980 self.addAction(self.condaWidgetActivateAct) |
1983 |
1981 |
1984 # TODO: add action for "MicroPython", Ctrl+Alt+Shift+M |
|
1985 if self.microPythonWidget is not None: |
1982 if self.microPythonWidget is not None: |
1986 self.microPythonWidgetActivateAct = E5Action( |
1983 self.microPythonWidgetActivateAct = E5Action( |
1987 self.tr('MicroPython'), |
1984 self.tr('MicroPython'), |
1988 self.tr('MicroPython'), |
1985 self.tr('MicroPython'), |
1989 QKeySequence(self.tr("Ctrl+Alt+Shift+M")), |
1986 QKeySequence(self.tr("Ctrl+Alt+Shift+M")), |
2037 """ with a word selected, this word is search in the Qt help""" |
2034 """ with a word selected, this word is search in the Qt help""" |
2038 """ collection.</p>""" |
2035 """ collection.</p>""" |
2039 )) |
2036 )) |
2040 self.helpviewerAct.triggered.connect(self.__helpViewer) |
2037 self.helpviewerAct.triggered.connect(self.__helpViewer) |
2041 self.actions.append(self.helpviewerAct) |
2038 self.actions.append(self.helpviewerAct) |
2042 ## else: |
|
2043 ## self.helpviewerAct = None |
|
2044 |
2039 |
2045 self.__initQtDocActions() |
2040 self.__initQtDocActions() |
2046 self.__initPythonDocActions() |
2041 self.__initPythonDocActions() |
2047 self.__initEricDocAction() |
2042 self.__initEricDocAction() |
2048 self.__initPySideDocActions() |
2043 self.__initPySideDocActions() |
2780 self.pyqt4DocAct.triggered.connect(self.__showPyQt4Doc) |
2775 self.pyqt4DocAct.triggered.connect(self.__showPyQt4Doc) |
2781 self.actions.append(self.pyqt4DocAct) |
2776 self.actions.append(self.pyqt4DocAct) |
2782 except ImportError: |
2777 except ImportError: |
2783 self.pyqt4DocAct = None |
2778 self.pyqt4DocAct = None |
2784 |
2779 |
2785 try: |
2780 self.pyqt5DocAct = E5Action( |
2786 import PyQt5 # __IGNORE_WARNING__ |
2781 self.tr('PyQt5 Documentation'), |
2787 self.pyqt5DocAct = E5Action( |
2782 self.tr('PyQt&5 Documentation'), |
2788 self.tr('PyQt5 Documentation'), |
2783 0, 0, self, 'pyqt5_documentation') |
2789 self.tr('PyQt&5 Documentation'), |
2784 self.pyqt5DocAct.setStatusTip(self.tr( |
2790 0, 0, self, 'pyqt5_documentation') |
2785 'Open PyQt5 Documentation')) |
2791 self.pyqt5DocAct.setStatusTip(self.tr( |
2786 self.pyqt5DocAct.setWhatsThis(self.tr( |
2792 'Open PyQt5 Documentation')) |
2787 """<b>PyQt5 Documentation</b>""" |
2793 self.pyqt5DocAct.setWhatsThis(self.tr( |
2788 """<p>Display the PyQt5 Documentation. Dependent upon your""" |
2794 """<b>PyQt5 Documentation</b>""" |
2789 """ settings, this will either show the help in Eric's""" |
2795 """<p>Display the PyQt5 Documentation. Dependent upon your""" |
2790 """ internal help viewer/web browser, or execute a web""" |
2796 """ settings, this will either show the help in Eric's""" |
2791 """ browser or Qt Assistant. </p>""" |
2797 """ internal help viewer/web browser, or execute a web""" |
2792 )) |
2798 """ browser or Qt Assistant. </p>""" |
2793 self.pyqt5DocAct.triggered.connect(self.__showPyQt5Doc) |
2799 )) |
2794 self.actions.append(self.pyqt5DocAct) |
2800 self.pyqt5DocAct.triggered.connect(self.__showPyQt5Doc) |
|
2801 self.actions.append(self.pyqt5DocAct) |
|
2802 except ImportError: |
|
2803 self.pyqt5DocAct = None |
|
2804 |
2795 |
2805 def __initPythonDocActions(self): |
2796 def __initPythonDocActions(self): |
2806 """ |
2797 """ |
2807 Private slot to initialize the actions to show the Python |
2798 Private slot to initialize the actions to show the Python |
2808 documentation. |
2799 documentation. |
2976 |
2969 |
2977 ############################################################## |
2970 ############################################################## |
2978 ## Project menu |
2971 ## Project menu |
2979 ############################################################## |
2972 ############################################################## |
2980 |
2973 |
2981 self.__menus["project"], self.__menus["project_tools"] = \ |
2974 self.__menus["project"], self.__menus["project_tools"] = ( |
2982 self.project.initMenus() |
2975 self.project.initMenus() |
|
2976 ) |
2983 mb.addMenu(self.__menus["project"]) |
2977 mb.addMenu(self.__menus["project"]) |
2984 mb.addMenu(self.__menus["project_tools"]) |
2978 mb.addMenu(self.__menus["project_tools"]) |
2985 |
2979 |
2986 ############################################################## |
2980 ############################################################## |
2987 ## Start and Debug menus |
2981 ## Start and Debug menus |
2988 ############################################################## |
2982 ############################################################## |
2989 |
2983 |
2990 self.__menus["start"], self.__menus["debug"] = \ |
2984 self.__menus["start"], self.__menus["debug"] = ( |
2991 self.debuggerUI.initMenus() |
2985 self.debuggerUI.initMenus() |
|
2986 ) |
2992 mb.addMenu(self.__menus["start"]) |
2987 mb.addMenu(self.__menus["start"]) |
2993 mb.addMenu(self.__menus["debug"]) |
2988 mb.addMenu(self.__menus["debug"]) |
2994 |
2989 |
2995 ############################################################## |
2990 ############################################################## |
2996 ## Extras menu |
2991 ## Extras menu |
3121 |
3116 |
3122 self.__menus["subwindow"] = QMenu(self.tr("&Windows"), |
3117 self.__menus["subwindow"] = QMenu(self.tr("&Windows"), |
3123 self.__menus["window"]) |
3118 self.__menus["window"]) |
3124 self.__menus["subwindow"].setTearOffEnabled(True) |
3119 self.__menus["subwindow"].setTearOffEnabled(True) |
3125 # central park |
3120 # central park |
3126 try: |
3121 self.__menus["subwindow"].addSection(self.tr("Central Park")) |
3127 self.__menus["subwindow"].addSection(self.tr("Central Park")) |
|
3128 except AttributeError: |
|
3129 # Qt4 |
|
3130 self.__menus["subwindow"].addSeparator() |
|
3131 self.__menus["subwindow"].addAction(self.viewmanagerActivateAct) |
3122 self.__menus["subwindow"].addAction(self.viewmanagerActivateAct) |
3132 # left side |
3123 # left side |
3133 try: |
3124 self.__menus["subwindow"].addSection(self.tr("Left Side")) |
3134 self.__menus["subwindow"].addSection(self.tr("Left Side")) |
|
3135 except AttributeError: |
|
3136 # Qt4 |
|
3137 pass |
|
3138 if self.__shellPosition == "left": |
3125 if self.__shellPosition == "left": |
3139 self.__menus["subwindow"].addAction(self.shellActivateAct) |
3126 self.__menus["subwindow"].addAction(self.shellActivateAct) |
3140 self.__menus["subwindow"].addAction(self.pbActivateAct) |
3127 self.__menus["subwindow"].addAction(self.pbActivateAct) |
3141 self.__menus["subwindow"].addAction(self.mpbActivateAct) |
3128 self.__menus["subwindow"].addAction(self.mpbActivateAct) |
3142 if self.templateViewer is not None: |
3129 if self.templateViewer is not None: |
3144 if self.browser is not None: |
3131 if self.browser is not None: |
3145 self.__menus["subwindow"].addAction(self.browserActivateAct) |
3132 self.__menus["subwindow"].addAction(self.browserActivateAct) |
3146 if self.symbolsViewer is not None: |
3133 if self.symbolsViewer is not None: |
3147 self.__menus["subwindow"].addAction(self.symbolsViewerActivateAct) |
3134 self.__menus["subwindow"].addAction(self.symbolsViewerActivateAct) |
3148 # bottom side |
3135 # bottom side |
3149 try: |
3136 self.__menus["subwindow"].addSection(self.tr("Bottom Side")) |
3150 self.__menus["subwindow"].addSection(self.tr("Bottom Side")) |
|
3151 except AttributeError: |
|
3152 # Qt4 |
|
3153 self.__menus["subwindow"].addSeparator() |
|
3154 if self.__shellPosition == "bottom": |
3137 if self.__shellPosition == "bottom": |
3155 self.__menus["subwindow"].addAction(self.shellActivateAct) |
3138 self.__menus["subwindow"].addAction(self.shellActivateAct) |
3156 self.__menus["subwindow"].addAction(self.taskViewerActivateAct) |
3139 self.__menus["subwindow"].addAction(self.taskViewerActivateAct) |
3157 self.__menus["subwindow"].addAction(self.logViewerActivateAct) |
3140 self.__menus["subwindow"].addAction(self.logViewerActivateAct) |
3158 if self.numbersViewer is not None: |
3141 if self.numbersViewer is not None: |
3159 self.__menus["subwindow"].addAction(self.numbersViewerActivateAct) |
3142 self.__menus["subwindow"].addAction(self.numbersViewerActivateAct) |
3160 try: |
3143 self.__menus["subwindow"].addSection(self.tr("Right Side")) |
3161 self.__menus["subwindow"].addSection(self.tr("Right Side")) |
|
3162 except AttributeError: |
|
3163 # Qt4 |
|
3164 self.__menus["subwindow"].addSeparator() |
|
3165 # right side |
3144 # right side |
3166 if self.__shellPosition == "right": |
3145 if self.__shellPosition == "right": |
3167 self.__menus["subwindow"].addAction(self.shellActivateAct) |
3146 self.__menus["subwindow"].addAction(self.shellActivateAct) |
3168 if self.codeDocumentationViewer is not None: |
3147 if self.codeDocumentationViewer is not None: |
3169 self.__menus["subwindow"].addAction( |
3148 self.__menus["subwindow"].addAction( |
3179 if self.irc is not None: |
3158 if self.irc is not None: |
3180 self.__menus["subwindow"].addAction(self.ircActivateAct) |
3159 self.__menus["subwindow"].addAction(self.ircActivateAct) |
3181 if self.microPythonWidget is not None: |
3160 if self.microPythonWidget is not None: |
3182 self.__menus["subwindow"].addAction( |
3161 self.__menus["subwindow"].addAction( |
3183 self.microPythonWidgetActivateAct) |
3162 self.microPythonWidgetActivateAct) |
3184 try: |
3163 self.__menus["subwindow"].addSection(self.tr("Plug-ins")) |
3185 self.__menus["subwindow"].addSection(self.tr("Plug-ins")) |
|
3186 except AttributeError: |
|
3187 # Qt4 |
|
3188 self.__menus["subwindow"].addSeparator() |
|
3189 |
3164 |
3190 ############################################################## |
3165 ############################################################## |
3191 ## Window/Toolbars menu |
3166 ## Window/Toolbars menu |
3192 ############################################################## |
3167 ############################################################## |
3193 |
3168 |
3194 self.__menus["toolbars"] = \ |
3169 self.__menus["toolbars"] = QMenu( |
3195 QMenu(self.tr("&Toolbars"), self.__menus["window"]) |
3170 self.tr("&Toolbars"), self.__menus["window"]) |
3196 self.__menus["toolbars"].setTearOffEnabled(True) |
3171 self.__menus["toolbars"].setTearOffEnabled(True) |
3197 self.__menus["toolbars"].aboutToShow.connect(self.__showToolbarsMenu) |
3172 self.__menus["toolbars"].aboutToShow.connect(self.__showToolbarsMenu) |
3198 self.__menus["toolbars"].triggered.connect(self.__TBMenuTriggered) |
3173 self.__menus["toolbars"].triggered.connect(self.__TBMenuTriggered) |
3199 |
3174 |
3200 self.__showWindowMenu() # to initialize these actions |
3175 self.__showWindowMenu() # to initialize these actions |
3668 sizeStr = "32-Bit" |
3643 sizeStr = "32-Bit" |
3669 |
3644 |
3670 versionText = self.tr( |
3645 versionText = self.tr( |
3671 """<h3>Version Numbers</h3>""" |
3646 """<h3>Version Numbers</h3>""" |
3672 """<table>""") |
3647 """<table>""") |
3673 versionText += """<tr><td><b>Python</b></td><td>{0}, {1}</td></tr>"""\ |
3648 versionText += ( |
3674 .format(sys.version.split()[0], sizeStr) |
3649 """<tr><td><b>Python</b></td><td>{0}, {1}</td></tr>""" |
3675 versionText += """<tr><td><b>Qt</b></td><td>{0}</td></tr>"""\ |
3650 ).format(sys.version.split()[0], sizeStr) |
3676 .format(qVersion()) |
3651 versionText += ( |
3677 versionText += """<tr><td><b>PyQt</b></td><td>{0}</td></tr>"""\ |
3652 """<tr><td><b>Qt</b></td><td>{0}</td></tr>""" |
3678 .format(PYQT_VERSION_STR) |
3653 ).format(qVersion()) |
3679 versionText += """<tr><td><b>sip</b></td><td>{0}</td></tr>"""\ |
3654 versionText += ( |
3680 .format(sip_version_str) |
3655 """<tr><td><b>PyQt</b></td><td>{0}</td></tr>""" |
3681 versionText += """<tr><td><b>QScintilla</b></td><td>{0}</td></tr>"""\ |
3656 ).format(PYQT_VERSION_STR) |
3682 .format(QSCINTILLA_VERSION_STR) |
3657 versionText += ( |
|
3658 """<tr><td><b>sip</b></td><td>{0}</td></tr>""" |
|
3659 ).format(sip_version_str) |
|
3660 versionText += ( |
|
3661 """<tr><td><b>QScintilla</b></td><td>{0}</td></tr>""" |
|
3662 ).format(QSCINTILLA_VERSION_STR) |
3683 try: |
3663 try: |
3684 from WebBrowser.Tools import WebBrowserTools |
3664 from WebBrowser.Tools import WebBrowserTools |
3685 chromeVersion = WebBrowserTools.getWebEngineVersions()[0] |
3665 chromeVersion = WebBrowserTools.getWebEngineVersions()[0] |
3686 versionText += \ |
3666 versionText += ( |
3687 """<tr><td><b>WebEngine</b></td><td>{0}</td></tr>"""\ |
3667 """<tr><td><b>WebEngine</b></td><td>{0}</td></tr>""" |
3688 .format(chromeVersion) |
3668 ).format(chromeVersion) |
3689 except ImportError: |
3669 except ImportError: |
3690 pass |
3670 pass |
3691 try: |
3671 versionText += ("""<tr><td><b>{0}</b></td><td>{1}</td></tr>""" |
3692 from PyQt5.QtWebKit import qWebKitVersion |
3672 ).format(Program, Version) |
3693 versionText += """<tr><td><b>WebKit</b></td><td>{0}</td></tr>"""\ |
|
3694 .format(qWebKitVersion()) |
|
3695 except ImportError: |
|
3696 pass |
|
3697 versionText += """<tr><td><b>{0}</b></td><td>{1}</td></tr>"""\ |
|
3698 .format(Program, Version) |
|
3699 versionText += self.tr("""</table>""") |
3673 versionText += self.tr("""</table>""") |
3700 |
3674 |
3701 E5MessageBox.about(self, Program, versionText) |
3675 E5MessageBox.about(self, Program, versionText) |
3702 |
3676 |
3703 def __reportBug(self): |
3677 def __reportBug(self): |
3770 Utilities.generateVersionInfo("\r\n"), |
3744 Utilities.generateVersionInfo("\r\n"), |
3771 Utilities.generatePluginsVersionInfo("\r\n"), |
3745 Utilities.generatePluginsVersionInfo("\r\n"), |
3772 Utilities.generateDistroInfo("\r\n")) |
3746 Utilities.generateDistroInfo("\r\n")) |
3773 |
3747 |
3774 url = QUrl("mailto:{0}".format(address)) |
3748 url = QUrl("mailto:{0}".format(address)) |
3775 if qVersionTuple() >= (5, 0, 0): |
3749 urlQuery = QUrlQuery(url) |
3776 from PyQt5.QtCore import QUrlQuery |
3750 urlQuery.addQueryItem("subject", subject) |
3777 urlQuery = QUrlQuery(url) |
3751 urlQuery.addQueryItem("body", body) |
3778 urlQuery.addQueryItem("subject", subject) |
3752 url.setQuery(urlQuery) |
3779 urlQuery.addQueryItem("body", body) |
|
3780 url.setQuery(urlQuery) |
|
3781 else: |
|
3782 url.addQueryItem("subject", subject) |
|
3783 url.addQueryItem("body", body) |
|
3784 QDesktopServices.openUrl(url) |
3753 QDesktopServices.openUrl(url) |
3785 |
3754 |
3786 def checkForErrorLog(self): |
3755 def checkForErrorLog(self): |
3787 """ |
3756 """ |
3788 Public method to check for the presence of an error log and ask the |
3757 Public method to check for the presence of an error log and ask the |
4312 self.profiles[self.currentProfile][2][4] = state |
4281 self.profiles[self.currentProfile][2][4] = state |
4313 state = self.rightSidebar.saveState() |
4282 state = self.rightSidebar.saveState() |
4314 self.profiles[self.currentProfile][2][5] = state |
4283 self.profiles[self.currentProfile][2][5] = state |
4315 # step 2: save the visibility of the windows of the active profile |
4284 # step 2: save the visibility of the windows of the active profile |
4316 if self.__layoutType == "Toolboxes": |
4285 if self.__layoutType == "Toolboxes": |
4317 self.profiles[self.currentProfile][1][0] = \ |
4286 self.profiles[self.currentProfile][1][0] = ( |
4318 self.lToolboxDock.isVisible() |
4287 self.lToolboxDock.isVisible() |
4319 self.profiles[self.currentProfile][1][1] = \ |
4288 ) |
|
4289 self.profiles[self.currentProfile][1][1] = ( |
4320 self.hToolboxDock.isVisible() |
4290 self.hToolboxDock.isVisible() |
4321 self.profiles[self.currentProfile][1][2] = \ |
4291 ) |
|
4292 self.profiles[self.currentProfile][1][2] = ( |
4322 self.rToolboxDock.isVisible() |
4293 self.rToolboxDock.isVisible() |
|
4294 ) |
4323 elif self.__layoutType == "Sidebars": |
4295 elif self.__layoutType == "Sidebars": |
4324 self.profiles[self.currentProfile][1][0] = \ |
4296 self.profiles[self.currentProfile][1][0] = ( |
4325 self.leftSidebar.isVisible() |
4297 self.leftSidebar.isVisible() |
4326 self.profiles[self.currentProfile][1][1] = \ |
4298 ) |
|
4299 self.profiles[self.currentProfile][1][1] = ( |
4327 self.bottomSidebar.isVisible() |
4300 self.bottomSidebar.isVisible() |
4328 self.profiles[self.currentProfile][1][2] = \ |
4301 ) |
|
4302 self.profiles[self.currentProfile][1][2] = ( |
4329 self.rightSidebar.isVisible() |
4303 self.rightSidebar.isVisible() |
|
4304 ) |
4330 Preferences.setUI("ViewProfiles2", self.profiles) |
4305 Preferences.setUI("ViewProfiles2", self.profiles) |
4331 |
4306 |
4332 def __activateViewProfile(self, name, save=True): |
4307 def __activateViewProfile(self, name, save=True): |
4333 """ |
4308 """ |
4334 Private slot to activate a view profile. |
4309 Private slot to activate a view profile. |
4795 |
4770 |
4796 def __toolGroupsConfiguration(self): |
4771 def __toolGroupsConfiguration(self): |
4797 """ |
4772 """ |
4798 Private slot to handle the tool groups configuration menu entry. |
4773 Private slot to handle the tool groups configuration menu entry. |
4799 """ |
4774 """ |
4800 from Preferences.ToolGroupConfigurationDialog import \ |
4775 from Preferences.ToolGroupConfigurationDialog import ( |
4801 ToolGroupConfigurationDialog |
4776 ToolGroupConfigurationDialog |
|
4777 ) |
4802 dlg = ToolGroupConfigurationDialog( |
4778 dlg = ToolGroupConfigurationDialog( |
4803 self.toolGroups, self.currentToolGroup, self) |
4779 self.toolGroups, self.currentToolGroup, self) |
4804 if dlg.exec_() == QDialog.Accepted: |
4780 if dlg.exec_() == QDialog.Accepted: |
4805 self.toolGroups, self.currentToolGroup = dlg.getToolGroups() |
4781 self.toolGroups, self.currentToolGroup = dlg.getToolGroups() |
4806 |
4782 |
5192 '<p>The file <b>{0}</b> does not exist or' |
5171 '<p>The file <b>{0}</b> does not exist or' |
5193 ' is zero length.</p>') |
5172 ' is zero length.</p>') |
5194 .format(fn)) |
5173 .format(fn)) |
5195 return |
5174 return |
5196 |
5175 |
5197 if not os.path.isfile(viewer) or \ |
5176 if ( |
5198 not proc.startDetached(sys.executable, args): |
5177 not os.path.isfile(viewer) or |
|
5178 not proc.startDetached(sys.executable, args) |
|
5179 ): |
5199 E5MessageBox.critical( |
5180 E5MessageBox.critical( |
5200 self, |
5181 self, |
5201 self.tr('Process Generation Error'), |
5182 self.tr('Process Generation Error'), |
5202 self.tr( |
5183 self.tr( |
5203 '<p>Could not start UI Previewer.<br>' |
5184 '<p>Could not start UI Previewer.<br>' |
5247 '<p>The file <b>{0}</b> does not exist or' |
5228 '<p>The file <b>{0}</b> does not exist or' |
5248 ' is zero length.</p>') |
5229 ' is zero length.</p>') |
5249 .format(fn)) |
5230 .format(fn)) |
5250 return |
5231 return |
5251 |
5232 |
5252 if not os.path.isfile(viewer) or \ |
5233 if ( |
5253 not proc.startDetached(sys.executable, args): |
5234 not os.path.isfile(viewer) or |
|
5235 not proc.startDetached(sys.executable, args) |
|
5236 ): |
5254 E5MessageBox.critical( |
5237 E5MessageBox.critical( |
5255 self, |
5238 self, |
5256 self.tr('Process Generation Error'), |
5239 self.tr('Process Generation Error'), |
5257 self.tr( |
5240 self.tr( |
5258 '<p>Could not start Translation Previewer.<br>' |
5241 '<p>Could not start Translation Previewer.<br>' |
5268 browser = os.path.join(getConfig("ericDir"), "eric6_sqlbrowser.py") |
5251 browser = os.path.join(getConfig("ericDir"), "eric6_sqlbrowser.py") |
5269 |
5252 |
5270 args = [] |
5253 args = [] |
5271 args.append(browser) |
5254 args.append(browser) |
5272 |
5255 |
5273 if not os.path.isfile(browser) or \ |
5256 if ( |
5274 not proc.startDetached(sys.executable, args): |
5257 not os.path.isfile(browser) or |
|
5258 not proc.startDetached(sys.executable, args) |
|
5259 ): |
5275 E5MessageBox.critical( |
5260 E5MessageBox.critical( |
5276 self, |
5261 self, |
5277 self.tr('Process Generation Error'), |
5262 self.tr('Process Generation Error'), |
5278 self.tr( |
5263 self.tr( |
5279 '<p>Could not start SQL Browser.<br>' |
5264 '<p>Could not start SQL Browser.<br>' |
5338 snap = os.path.join(getConfig("ericDir"), "eric6_snap.py") |
5323 snap = os.path.join(getConfig("ericDir"), "eric6_snap.py") |
5339 |
5324 |
5340 args = [] |
5325 args = [] |
5341 args.append(snap) |
5326 args.append(snap) |
5342 |
5327 |
5343 if not os.path.isfile(snap) or \ |
5328 if ( |
5344 not proc.startDetached(sys.executable, args): |
5329 not os.path.isfile(snap) or |
|
5330 not proc.startDetached(sys.executable, args) |
|
5331 ): |
5345 E5MessageBox.critical( |
5332 E5MessageBox.critical( |
5346 self, |
5333 self, |
5347 self.tr('Process Generation Error'), |
5334 self.tr('Process Generation Error'), |
5348 self.tr( |
5335 self.tr( |
5349 '<p>Could not start Snapshot tool.<br>' |
5336 '<p>Could not start Snapshot tool.<br>' |
5411 procData = (None,) |
5398 procData = (None,) |
5412 program = tool['executable'] |
5399 program = tool['executable'] |
5413 args = [] |
5400 args = [] |
5414 argv = Utilities.parseOptionString(tool['arguments']) |
5401 argv = Utilities.parseOptionString(tool['arguments']) |
5415 args.extend(argv) |
5402 args.extend(argv) |
5416 t = self.tr("Starting process '{0} {1}'.\n")\ |
5403 t = self.tr("Starting process '{0} {1}'.\n" |
5417 .format(program, tool['arguments']) |
5404 ).format(program, tool['arguments']) |
5418 self.appendToStdout(t) |
5405 self.appendToStdout(t) |
5419 |
5406 |
5420 proc.finished.connect(self.__toolFinished) |
5407 proc.finished.connect(self.__toolFinished) |
5421 if tool['redirect'] != 'no': |
5408 if tool['redirect'] != 'no': |
5422 proc.readyReadStandardOutput.connect(self.__processToolStdout) |
5409 proc.readyReadStandardOutput.connect(self.__processToolStdout) |
5451 |
5438 |
5452 # loop through all running tool processes |
5439 # loop through all running tool processes |
5453 for program, toolProc, toolProcData in self.toolProcs: |
5440 for program, toolProc, toolProcData in self.toolProcs: |
5454 toolProc.setReadChannel(QProcess.StandardOutput) |
5441 toolProc.setReadChannel(QProcess.StandardOutput) |
5455 |
5442 |
5456 if toolProcData[0] is None or \ |
5443 if ( |
5457 toolProcData[1] not in ["insert", "replaceSelection"]: |
5444 toolProcData[0] is None or |
|
5445 toolProcData[1] not in ["insert", "replaceSelection"] |
|
5446 ): |
5458 # not connected to an editor or wrong mode |
5447 # not connected to an editor or wrong mode |
5459 while toolProc.canReadLine(): |
5448 while toolProc.canReadLine(): |
5460 output = str(toolProc.readLine(), ioEncoding, 'replace') |
5449 output = str(toolProc.readLine(), ioEncoding, 'replace') |
5461 s = "{0} - {1}".format(program, output) |
5450 s = "{0} - {1}".format(program, output) |
5462 self.appendToStdout(s) |
5451 self.appendToStdout(s) |
5514 """ |
5503 """ |
5515 pythonDocDir = Preferences.getHelp("PythonDocDir") |
5504 pythonDocDir = Preferences.getHelp("PythonDocDir") |
5516 if not pythonDocDir: |
5505 if not pythonDocDir: |
5517 if Utilities.isWindowsPlatform(): |
5506 if Utilities.isWindowsPlatform(): |
5518 venvName = Preferences.getDebugger("Python3VirtualEnv") |
5507 venvName = Preferences.getDebugger("Python3VirtualEnv") |
5519 interpreter = e5App().getObject("VirtualEnvManager")\ |
5508 interpreter = ( |
|
5509 e5App().getObject("VirtualEnvManager") |
5520 .getVirtualenvInterpreter(venvName) |
5510 .getVirtualenvInterpreter(venvName) |
|
5511 ) |
5521 if interpreter: |
5512 if interpreter: |
5522 default = os.path.join(os.path.dirname(interpreter), "doc") |
5513 default = os.path.join(os.path.dirname(interpreter), "doc") |
5523 else: |
5514 else: |
5524 default = "" |
5515 default = "" |
5525 pythonDocDir = \ |
5516 pythonDocDir = Utilities.getEnvironmentEntry( |
5526 Utilities.getEnvironmentEntry("PYTHON3DOCDIR", default) |
5517 "PYTHON3DOCDIR", default) |
5527 else: |
5518 else: |
5528 pythonDocDir = Utilities.getEnvironmentEntry( |
5519 pythonDocDir = Utilities.getEnvironmentEntry( |
5529 "PYTHON3DOCDIR", |
5520 "PYTHON3DOCDIR", |
5530 '/usr/share/doc/packages/python3/html') |
5521 '/usr/share/doc/packages/python3/html') |
5531 if not pythonDocDir.startswith(("http://", "https://", "qthelp://")): |
5522 if not pythonDocDir.startswith(("http://", "https://", "qthelp://")): |
5582 """ |
5573 """ |
5583 pythonDocDir = Preferences.getHelp("Python2DocDir") |
5574 pythonDocDir = Preferences.getHelp("Python2DocDir") |
5584 if not pythonDocDir: |
5575 if not pythonDocDir: |
5585 if Utilities.isWindowsPlatform(): |
5576 if Utilities.isWindowsPlatform(): |
5586 venvName = Preferences.getDebugger("Python2VirtualEnv") |
5577 venvName = Preferences.getDebugger("Python2VirtualEnv") |
5587 interpreter = e5App().getObject("VirtualEnvManager")\ |
5578 interpreter = ( |
|
5579 e5App().getObject("VirtualEnvManager") |
5588 .getVirtualenvInterpreter(venvName) |
5580 .getVirtualenvInterpreter(venvName) |
|
5581 ) |
5589 if interpreter: |
5582 if interpreter: |
5590 default = os.path.join(os.path.dirname(interpreter), "doc") |
5583 default = os.path.join(os.path.dirname(interpreter), "doc") |
5591 else: |
5584 else: |
5592 default = "" |
5585 default = "" |
5593 pythonDocDir = \ |
5586 pythonDocDir = Utilities.getEnvironmentEntry( |
5594 Utilities.getEnvironmentEntry("PYTHON2DOCDIR", default) |
5587 "PYTHON2DOCDIR", default) |
5595 else: |
5588 else: |
5596 pythonDocDir = Utilities.getEnvironmentEntry( |
5589 pythonDocDir = Utilities.getEnvironmentEntry( |
5597 "PYTHON2DOCDIR", |
5590 "PYTHON2DOCDIR", |
5598 '/usr/share/doc/packages/python/html') |
5591 '/usr/share/doc/packages/python/html') |
5599 if not pythonDocDir.startswith(("http://", "https://", "qthelp://")): |
5592 if not pythonDocDir.startswith(("http://", "https://", "qthelp://")): |
5985 if self.__webBrowserProcess is None: |
5978 if self.__webBrowserProcess is None: |
5986 webBrowsers = [ |
5979 webBrowsers = [ |
5987 os.path.join( |
5980 os.path.join( |
5988 os.path.dirname(__file__), "..", "eric6_browser.py"), |
5981 os.path.dirname(__file__), "..", "eric6_browser.py"), |
5989 # QtWebEngine based web browser |
5982 # QtWebEngine based web browser |
5990 os.path.join( |
|
5991 os.path.dirname(__file__), "..", "eric6_webbrowser.py"), |
|
5992 # QtWebKit based web browser |
|
5993 ] |
5983 ] |
5994 process = QProcess() |
5984 process = QProcess() |
5995 for browser in webBrowsers: |
5985 for browser in webBrowsers: |
5996 args = [ |
5986 args = [ |
5997 browser, |
5987 browser, |
6039 @type QProcess |
6029 @type QProcess |
6040 @return error indication (1 = connection not possible, 0 = ok, |
6030 @return error indication (1 = connection not possible, 0 = ok, |
6041 -1 = server exited with an error code) |
6031 -1 = server exited with an error code) |
6042 @rtype int |
6032 @rtype int |
6043 """ |
6033 """ |
6044 from WebBrowser.WebBrowserSingleApplication import \ |
6034 from WebBrowser.WebBrowserSingleApplication import ( |
6045 WebBrowserSingleApplicationClient |
6035 WebBrowserSingleApplicationClient |
|
6036 ) |
6046 |
6037 |
6047 webBrowserClient = WebBrowserSingleApplicationClient( |
6038 webBrowserClient = WebBrowserSingleApplicationClient( |
6048 self.__webBrowserSAName) |
6039 self.__webBrowserSAName) |
6049 connectCount = 30 |
6040 connectCount = 30 |
6050 while connectCount: |
6041 while connectCount: |
6053 break |
6044 break |
6054 else: |
6045 else: |
6055 connectCount -= 1 |
6046 connectCount -= 1 |
6056 QThread.msleep(1000) |
6047 QThread.msleep(1000) |
6057 QApplication.processEvents() |
6048 QApplication.processEvents() |
6058 if process.state() == QProcess.NotRunning and \ |
6049 if ( |
6059 process.exitStatus() == QProcess.NormalExit and \ |
6050 process.state() == QProcess.NotRunning and |
6060 process.exitCode() == 100: |
6051 process.exitStatus() == QProcess.NormalExit and |
|
6052 process.exitCode() == 100 |
|
6053 ): |
6061 # Process exited prematurely due to missing pre-requisites |
6054 # Process exited prematurely due to missing pre-requisites |
6062 return -1 |
6055 return -1 |
6063 if res <= 0: |
6056 if res <= 0: |
6064 E5MessageBox.warning( |
6057 E5MessageBox.warning( |
6065 self, |
6058 self, |
6143 QApplication.processEvents() |
6136 QApplication.processEvents() |
6144 if self.__configurationDialog.result() == QDialog.Accepted: |
6137 if self.__configurationDialog.result() == QDialog.Accepted: |
6145 self.__configurationDialog.setPreferences() |
6138 self.__configurationDialog.setPreferences() |
6146 Preferences.syncPreferences() |
6139 Preferences.syncPreferences() |
6147 self.__preferencesChanged() |
6140 self.__preferencesChanged() |
6148 self.__lastConfigurationPageName = \ |
6141 self.__lastConfigurationPageName = ( |
6149 self.__configurationDialog.getConfigurationPageName() |
6142 self.__configurationDialog.getConfigurationPageName() |
6150 self.__expandedConfigurationEntries = \ |
6143 ) |
|
6144 self.__expandedConfigurationEntries = ( |
6151 self.__configurationDialog.getExpandedEntries() |
6145 self.__configurationDialog.getExpandedEntries() |
|
6146 ) |
6152 |
6147 |
6153 self.__configurationDialog.deleteLater() |
6148 self.__configurationDialog.deleteLater() |
6154 self.__configurationDialog = None |
6149 self.__configurationDialog = None |
6155 |
6150 |
6156 def __exportPreferences(self): |
6151 def __exportPreferences(self): |
6246 |
6241 |
6247 self.masterPasswordChanged.emit(oldPassword, newPassword) |
6242 self.masterPasswordChanged.emit(oldPassword, newPassword) |
6248 Preferences.convertPasswords(oldPassword, newPassword) |
6243 Preferences.convertPasswords(oldPassword, newPassword) |
6249 variant = Globals.getWebBrowserSupport() |
6244 variant = Globals.getWebBrowserSupport() |
6250 if variant == "QtWebEngine": |
6245 if variant == "QtWebEngine": |
6251 from WebBrowser.Passwords.PasswordManager import \ |
6246 from WebBrowser.Passwords.PasswordManager import ( |
6252 PasswordManager |
6247 PasswordManager |
6253 pwManager = PasswordManager() |
6248 ) |
6254 pwManager.masterPasswordChanged(oldPassword, newPassword) |
|
6255 elif variant == "QtWebKit": |
|
6256 from Helpviewer.Passwords.PasswordManager import \ |
|
6257 PasswordManager |
|
6258 pwManager = PasswordManager() |
6249 pwManager = PasswordManager() |
6259 pwManager.masterPasswordChanged(oldPassword, newPassword) |
6250 pwManager.masterPasswordChanged(oldPassword, newPassword) |
6260 Utilities.crypto.changeRememberedMaster(newPassword) |
6251 Utilities.crypto.changeRememberedMaster(newPassword) |
6261 |
6252 |
6262 def __reloadAPIs(self): |
6253 def __reloadAPIs(self): |
6366 from .ClearPrivateDataDialog import ClearPrivateDataDialog |
6357 from .ClearPrivateDataDialog import ClearPrivateDataDialog |
6367 dlg = ClearPrivateDataDialog(self) |
6358 dlg = ClearPrivateDataDialog(self) |
6368 if dlg.exec_() == QDialog.Accepted: |
6359 if dlg.exec_() == QDialog.Accepted: |
6369 # recent files, recent projects, recent multi projects, |
6360 # recent files, recent projects, recent multi projects, |
6370 # debug histories, shell histories |
6361 # debug histories, shell histories |
6371 (files, projects, multiProjects, debug, shell, vcs, plugins) = \ |
6362 (files, projects, multiProjects, debug, shell, vcs, plugins) = ( |
6372 dlg.getData() |
6363 dlg.getData() |
|
6364 ) |
6373 if files: |
6365 if files: |
6374 # clear list of recently opened files |
6366 # clear list of recently opened files |
6375 self.viewmanager.clearRecent() |
6367 self.viewmanager.clearRecent() |
6376 if projects: |
6368 if projects: |
6377 # clear list of recently opened projects and other histories |
6369 # clear list of recently opened projects and other histories |
6404 """ |
6396 """ |
6405 Private slot to handle the projectOpened signal. |
6397 Private slot to handle the projectOpened signal. |
6406 """ |
6398 """ |
6407 from Debugger.DebugClientCapabilities import HasUnittest |
6399 from Debugger.DebugClientCapabilities import HasUnittest |
6408 self.__setWindowCaption(project=self.project.name) |
6400 self.__setWindowCaption(project=self.project.name) |
6409 cap = e5App().getObject("DebugServer")\ |
6401 cap = e5App().getObject("DebugServer").getClientCapabilities( |
6410 .getClientCapabilities(self.project.getProjectLanguage()) |
6402 self.project.getProjectLanguage()) |
6411 self.utProjectAct.setEnabled(cap & HasUnittest) |
6403 self.utProjectAct.setEnabled(cap & HasUnittest) |
6412 self.utProjectOpen = cap & HasUnittest |
6404 self.utProjectOpen = cap & HasUnittest |
6413 |
6405 |
6414 def __projectClosed(self): |
6406 def __projectClosed(self): |
6415 """ |
6407 """ |
6682 |
6674 |
6683 def __writeCrashSession(self): |
6675 def __writeCrashSession(self): |
6684 """ |
6676 """ |
6685 Private slot to write a crash session file. |
6677 Private slot to write a crash session file. |
6686 """ |
6678 """ |
6687 if not self.__readingSession and \ |
6679 if ( |
6688 not self.__disableCrashSession and \ |
6680 not self.__readingSession and |
6689 Preferences.getUI("CrashSessionEnabled"): |
6681 not self.__disableCrashSession and |
|
6682 Preferences.getUI("CrashSessionEnabled") |
|
6683 ): |
6690 self.__writeSession(crashSession=True) |
6684 self.__writeSession(crashSession=True) |
6691 |
6685 |
6692 def __readCrashSession(self): |
6686 def __readCrashSession(self): |
6693 """ |
6687 """ |
6694 Private method to check for and read a crash session. |
6688 Private method to check for and read a crash session. |
6695 |
6689 |
6696 @return flag indicating a crash session file was found and read |
6690 @return flag indicating a crash session file was found and read |
6697 @rtype bool |
6691 @rtype bool |
6698 """ |
6692 """ |
6699 res = False |
6693 res = False |
6700 if not self.__disableCrashSession and \ |
6694 if ( |
6701 not self.__noCrashOpenAtStartup and \ |
6695 not self.__disableCrashSession and |
6702 Preferences.getUI("OpenCrashSessionOnStartup"): |
6696 not self.__noCrashOpenAtStartup and |
|
6697 Preferences.getUI("OpenCrashSessionOnStartup") |
|
6698 ): |
6703 fn = os.path.join(Utilities.getConfigDir(), |
6699 fn = os.path.join(Utilities.getConfigDir(), |
6704 "eric6_crash_session.e5s") |
6700 "eric6_crash_session.e5s") |
6705 if os.path.exists(fn): |
6701 if os.path.exists(fn): |
6706 yes = E5MessageBox.yesNo( |
6702 yes = E5MessageBox.yesNo( |
6707 self, |
6703 self, |
6757 @keyparam searchDir directory to search in (string) |
6753 @keyparam searchDir directory to search in (string) |
6758 @keyparam openFiles flag indicating to operate on open files (boolean) |
6754 @keyparam openFiles flag indicating to operate on open files (boolean) |
6759 """ |
6755 """ |
6760 if self.replaceFilesDialog is None: |
6756 if self.replaceFilesDialog is None: |
6761 from .FindFileDialog import FindFileDialog |
6757 from .FindFileDialog import FindFileDialog |
6762 self.replaceFilesDialog = \ |
6758 self.replaceFilesDialog = FindFileDialog( |
6763 FindFileDialog(self.project, replaceMode=True) |
6759 self.project, replaceMode=True) |
6764 self.replaceFilesDialog.sourceFile.connect( |
6760 self.replaceFilesDialog.sourceFile.connect( |
6765 self.viewmanager.openSourceFile) |
6761 self.viewmanager.openSourceFile) |
6766 self.replaceFilesDialog.designerFile.connect(self.__designer) |
6762 self.replaceFilesDialog.designerFile.connect(self.__designer) |
6767 if searchDir: |
6763 if searchDir: |
6768 self.replaceFilesDialog.setSearchDirectory(searchDir) |
6764 self.replaceFilesDialog.setSearchDirectory(searchDir) |
7131 self.__replies.remove(reply) |
7127 self.__replies.remove(reply) |
7132 if reply.error() == QNetworkReply.NoError: |
7128 if reply.error() == QNetworkReply.NoError: |
7133 ioEncoding = Preferences.getSystem("IOEncoding") |
7129 ioEncoding = Preferences.getSystem("IOEncoding") |
7134 versions = str(reply.readAll(), ioEncoding, 'replace').splitlines() |
7130 versions = str(reply.readAll(), ioEncoding, 'replace').splitlines() |
7135 reply.close() |
7131 reply.close() |
7136 if reply.error() != QNetworkReply.NoError or \ |
7132 if ( |
7137 len(versions) == 0 or \ |
7133 reply.error() != QNetworkReply.NoError or |
7138 versions[0].startswith("<"): |
7134 len(versions) == 0 or |
|
7135 versions[0].startswith("<") |
|
7136 ): |
7139 # network error or an error page |
7137 # network error or an error page |
7140 self.httpAlternative += 1 |
7138 self.httpAlternative += 1 |
7141 if self.httpAlternative >= len(self.__httpAlternatives): |
7139 if self.httpAlternative >= len(self.__httpAlternatives): |
7142 self.__inVersionCheck = False |
7140 self.__inVersionCheck = False |
7143 if self.__versionCheckProgress is not None: |
7141 if self.__versionCheckProgress is not None: |
7297 line = 0 |
7295 line = 0 |
7298 while line < len(versions): |
7296 while line < len(versions): |
7299 if versions[line] == "---": |
7297 if versions[line] == "---": |
7300 break |
7298 break |
7301 |
7299 |
7302 versionText += """<tr><td>{0}</td><td><a href="{1}">{2}</a>""" \ |
7300 versionText += ( |
7303 """</td></tr>""".format( |
7301 """<tr><td>{0}</td><td><a href="{1}">{2}</a></td></tr>""" |
7304 versions[line], versions[line + 1], |
7302 ).format( |
7305 'sourceforge' in versions[line + 1] and |
7303 versions[line], versions[line + 1], |
7306 "SourceForge" or versions[line + 1]) |
7304 'sourceforge' in versions[line + 1] and |
|
7305 "SourceForge" or versions[line + 1]) |
7307 line += 2 |
7306 line += 2 |
7308 versionText += self.tr("""</table>""") |
7307 versionText += self.tr("""</table>""") |
7309 |
7308 |
7310 self.__versionsDialog = E5MessageBox.E5MessageBox( |
7309 self.__versionsDialog = E5MessageBox.E5MessageBox( |
7311 E5MessageBox.NoIcon, |
7310 E5MessageBox.NoIcon, |