26 QAction, QLabel |
26 QAction, QLabel |
27 from PyQt5.Qsci import QSCINTILLA_VERSION_STR |
27 from PyQt5.Qsci import QSCINTILLA_VERSION_STR |
28 from PyQt5.QtNetwork import QNetworkProxyFactory, QNetworkAccessManager, \ |
28 from PyQt5.QtNetwork import QNetworkProxyFactory, QNetworkAccessManager, \ |
29 QNetworkRequest, QNetworkReply |
29 QNetworkRequest, QNetworkReply |
30 |
30 |
31 from Globals import qVersionTuple |
|
32 try: |
|
33 from PyQt5 import QtWebKit # __IGNORE_WARNING__ |
|
34 WEBKIT_AVAILABLE = True |
|
35 except ImportError: |
|
36 WEBKIT_AVAILABLE = False |
|
37 if qVersionTuple() < (5, 6, 0): |
|
38 WEBENGINE_AVAILABLE = False |
|
39 else: |
|
40 try: |
|
41 from PyQt5 import QtWebEngineWidgets # __IGNORE_WARNING__ |
|
42 WEBENGINE_AVAILABLE = True |
|
43 except ImportError: |
|
44 WEBENGINE_AVAILABLE = False |
|
45 |
|
46 from .Info import Version, VersionOnly, BugAddress, Program, FeatureAddress |
31 from .Info import Version, VersionOnly, BugAddress, Program, FeatureAddress |
47 from . import Config |
32 from . import Config |
48 |
33 |
49 from E5Gui.E5SingleApplication import E5SingleApplicationServer |
34 from E5Gui.E5SingleApplication import E5SingleApplicationServer |
50 from E5Gui.E5Action import E5Action, createActionGroup |
35 from E5Gui.E5Action import E5Action, createActionGroup |
573 splash.showMessage(self.tr("Initializing Tools...")) |
560 splash.showMessage(self.tr("Initializing Tools...")) |
574 self.toolGroups, self.currentToolGroup = Preferences.readToolGroups() |
561 self.toolGroups, self.currentToolGroup = Preferences.readToolGroups() |
575 self.toolProcs = [] |
562 self.toolProcs = [] |
576 self.__initExternalToolsActions() |
563 self.__initExternalToolsActions() |
577 |
564 |
578 # create a dummy help window for shortcuts handling |
|
579 # TODO: remove this in favour of standalone web browser |
|
580 if WEBKIT_AVAILABLE: |
|
581 from Helpviewer.HelpWindow import HelpWindow |
|
582 self.dummyHelpViewer = \ |
|
583 HelpWindow(None, '.', None, 'help viewer', True, True) |
|
584 else: |
|
585 self.dummyHelpViewer = None |
|
586 |
|
587 # redirect handling of http and https URLs to ourselves |
565 # redirect handling of http and https URLs to ourselves |
588 if WEBENGINE_AVAILABLE or WEBKIT_AVAILABLE: |
566 QDesktopServices.setUrlHandler("http", self.handleUrl) |
589 QDesktopServices.setUrlHandler("http", self.handleUrl) |
567 QDesktopServices.setUrlHandler("https", self.handleUrl) |
590 QDesktopServices.setUrlHandler("https", self.handleUrl) |
|
591 |
568 |
592 # register all relevant objects |
569 # register all relevant objects |
593 splash.showMessage(self.tr("Registering Objects...")) |
570 splash.showMessage(self.tr("Registering Objects...")) |
594 e5App().registerObject("UserInterface", self) |
571 e5App().registerObject("UserInterface", self) |
595 e5App().registerObject("DebugUI", self.debuggerUI) |
572 e5App().registerObject("DebugUI", self.debuggerUI) |
601 e5App().registerObject("MultiProject", self.multiProject) |
578 e5App().registerObject("MultiProject", self.multiProject) |
602 e5App().registerObject("TaskViewer", self.taskViewer) |
579 e5App().registerObject("TaskViewer", self.taskViewer) |
603 if self.templateViewer is not None: |
580 if self.templateViewer is not None: |
604 e5App().registerObject("TemplateViewer", self.templateViewer) |
581 e5App().registerObject("TemplateViewer", self.templateViewer) |
605 e5App().registerObject("Shell", self.shell) |
582 e5App().registerObject("Shell", self.shell) |
606 if self.dummyHelpViewer is not None: |
|
607 e5App().registerObject("DummyHelpViewer", self.dummyHelpViewer) |
|
608 e5App().registerObject("PluginManager", self.pluginManager) |
583 e5App().registerObject("PluginManager", self.pluginManager) |
609 e5App().registerObject("ToolbarManager", self.toolbarManager) |
584 e5App().registerObject("ToolbarManager", self.toolbarManager) |
610 if self.cooperation is not None: |
585 if self.cooperation is not None: |
611 e5App().registerObject("Cooperation", self.cooperation) |
586 e5App().registerObject("Cooperation", self.cooperation) |
612 if self.irc is not None: |
587 if self.irc is not None: |
1816 """ context help button in the titlebar.</p>""" |
1788 """ context help button in the titlebar.</p>""" |
1817 )) |
1789 )) |
1818 self.whatsThisAct.triggered.connect(self.__whatsThis) |
1790 self.whatsThisAct.triggered.connect(self.__whatsThis) |
1819 self.actions.append(self.whatsThisAct) |
1791 self.actions.append(self.whatsThisAct) |
1820 |
1792 |
1821 if WEBENGINE_AVAILABLE or WEBKIT_AVAILABLE: |
1793 self.helpviewerAct = E5Action( |
1822 self.helpviewerAct = E5Action( |
1794 self.tr('Helpviewer'), |
1823 self.tr('Helpviewer'), |
1795 UI.PixmapCache.getIcon("help.png"), |
1824 UI.PixmapCache.getIcon("help.png"), |
1796 self.tr('&Helpviewer...'), |
1825 self.tr('&Helpviewer...'), |
1797 QKeySequence(self.tr("F1")), |
1826 QKeySequence(self.tr("F1")), |
1798 0, self, 'helpviewer') |
1827 0, self, 'helpviewer') |
1799 self.helpviewerAct.setStatusTip(self.tr( |
1828 self.helpviewerAct.setStatusTip(self.tr( |
1800 'Open the helpviewer window')) |
1829 'Open the helpviewer window')) |
1801 self.helpviewerAct.setWhatsThis(self.tr( |
1830 self.helpviewerAct.setWhatsThis(self.tr( |
1802 """<b>Helpviewer</b>""" |
1831 """<b>Helpviewer</b>""" |
1803 """<p>Display the eric6 web browser. This window will show""" |
1832 """<p>Display the eric6 web browser. This window will show""" |
1804 """ HTML help files and help from Qt help collections. It""" |
1833 """ HTML help files and help from Qt help collections. It""" |
1805 """ has the capability to navigate to links, set bookmarks,""" |
1834 """ has the capability to navigate to links, set bookmarks,""" |
1806 """ print the displayed help and some more features. You may""" |
1835 """ print the displayed help and some more features. You may""" |
1807 """ use it to browse the internet as well</p><p>If called""" |
1836 """ use it to browse the internet as well</p><p>If called""" |
1808 """ with a word selected, this word is search in the Qt help""" |
1837 """ with a word selected, this word is search in the Qt help""" |
1809 """ collection.</p>""" |
1838 """ collection.</p>""" |
1810 )) |
1839 )) |
1811 self.helpviewerAct.triggered.connect(self.__helpViewer) |
1840 self.helpviewerAct.triggered.connect(self.__helpViewer) |
1812 self.actions.append(self.helpviewerAct) |
1841 self.actions.append(self.helpviewerAct) |
1813 ## else: |
1842 else: |
1814 ## self.helpviewerAct = None |
1843 self.helpviewerAct = None |
|
1844 |
1815 |
1845 self.__initQtDocActions() |
1816 self.__initQtDocActions() |
1846 self.__initPythonDocActions() |
1817 self.__initPythonDocActions() |
1847 self.__initEricDocAction() |
1818 self.__initEricDocAction() |
1848 self.__initPySideDocActions() |
1819 self.__initPySideDocActions() |
2145 """ binary files.</p>""" |
2116 """ binary files.</p>""" |
2146 )) |
2117 )) |
2147 self.hexEditorAct.triggered.connect(self.__openHexEditor) |
2118 self.hexEditorAct.triggered.connect(self.__openHexEditor) |
2148 self.actions.append(self.hexEditorAct) |
2119 self.actions.append(self.hexEditorAct) |
2149 |
2120 |
2150 if WEBENGINE_AVAILABLE or WEBKIT_AVAILABLE: |
2121 self.webBrowserAct = E5Action( |
2151 self.webBrowserAct = E5Action( |
2122 self.tr('eric6 Web Browser'), |
2152 self.tr('eric6 Web Browser'), |
2123 UI.PixmapCache.getIcon("ericWeb.png"), |
2153 UI.PixmapCache.getIcon("ericWeb.png"), |
2124 self.tr('eric6 &Web Browser...'), |
2154 self.tr('eric6 &Web Browser...'), |
2125 0, 0, self, 'web_browser') |
2155 0, 0, self, 'web_browser') |
2126 self.webBrowserAct.setStatusTip(self.tr( |
2156 self.webBrowserAct.setStatusTip(self.tr( |
2127 'Start the eric6 Web Browser')) |
2157 'Start the eric6 Web Browser')) |
2128 self.webBrowserAct.setWhatsThis(self.tr( |
2158 self.webBrowserAct.setWhatsThis(self.tr( |
2129 """<b>eric6 Web Browser</b>""" |
2159 """<b>eric6 Web Browser</b>""" |
2130 """<p>Browse the Internet with the eric6 Web Browser.</p>""" |
2160 """<p>Browse the Internet with the eric6 Web Browser.</p>""" |
2131 )) |
2161 )) |
2132 self.webBrowserAct.triggered.connect(self.__startWebBrowser) |
2162 self.webBrowserAct.triggered.connect(self.__startWebBrowser) |
2133 self.actions.append(self.webBrowserAct) |
2163 self.actions.append(self.webBrowserAct) |
2134 ## else: |
2164 else: |
2135 ## self.webBrowserAct = None |
2165 self.webBrowserAct = None |
|
2166 |
2136 |
2167 self.iconEditorAct = E5Action( |
2137 self.iconEditorAct = E5Action( |
2168 self.tr('Icon Editor'), |
2138 self.tr('Icon Editor'), |
2169 UI.PixmapCache.getIcon("iconEditor.png"), |
2139 UI.PixmapCache.getIcon("iconEditor.png"), |
2170 self.tr('&Icon Editor...'), |
2140 self.tr('&Icon Editor...'), |
3366 .format(PYQT_VERSION_STR) |
3336 .format(PYQT_VERSION_STR) |
3367 versionText += """<tr><td><b>sip</b></td><td>{0}</td></tr>"""\ |
3337 versionText += """<tr><td><b>sip</b></td><td>{0}</td></tr>"""\ |
3368 .format(sip_version_str) |
3338 .format(sip_version_str) |
3369 versionText += """<tr><td><b>QScintilla</b></td><td>{0}</td></tr>"""\ |
3339 versionText += """<tr><td><b>QScintilla</b></td><td>{0}</td></tr>"""\ |
3370 .format(QSCINTILLA_VERSION_STR) |
3340 .format(QSCINTILLA_VERSION_STR) |
3371 if WEBENGINE_AVAILABLE: |
3341 try: |
3372 from WebBrowser.Tools import WebBrowserTools |
3342 from WebBrowser.Tools import WebBrowserTools |
3373 chromeVersion = WebBrowserTools.getWebEngineVersions()[0] |
3343 chromeVersion = WebBrowserTools.getWebEngineVersions()[0] |
3374 versionText += \ |
3344 versionText += \ |
3375 """<tr><td><b>WebEngine</b></td><td>{0}</td></tr>"""\ |
3345 """<tr><td><b>WebEngine</b></td><td>{0}</td></tr>"""\ |
3376 .format(chromeVersion) |
3346 .format(chromeVersion) |
3377 if WEBKIT_AVAILABLE: |
3347 except ImportError: |
|
3348 pass |
|
3349 try: |
3378 from PyQt5.QtWebKit import qWebKitVersion |
3350 from PyQt5.QtWebKit import qWebKitVersion |
3379 versionText += """<tr><td><b>WebKit</b></td><td>{0}</td></tr>"""\ |
3351 versionText += """<tr><td><b>WebKit</b></td><td>{0}</td></tr>"""\ |
3380 .format(qWebKitVersion()) |
3352 .format(qWebKitVersion()) |
|
3353 except ImportError: |
|
3354 pass |
3381 versionText += """<tr><td><b>{0}</b></td><td>{1}</td></tr>"""\ |
3355 versionText += """<tr><td><b>{0}</b></td><td>{1}</td></tr>"""\ |
3382 .format(Program, Version) |
3356 .format(Program, Version) |
3383 versionText += self.tr("""</table>""") |
3357 versionText += self.tr("""</table>""") |
3384 |
3358 |
3385 E5MessageBox.about(self, Program, versionText) |
3359 E5MessageBox.about(self, Program, versionText) |
5653 if len(home) > 0: |
5606 if len(home) > 0: |
5654 homeUrl = QUrl(home) |
5607 homeUrl = QUrl(home) |
5655 if not homeUrl.scheme(): |
5608 if not homeUrl.scheme(): |
5656 home = QUrl.fromLocalFile(home).toString() |
5609 home = QUrl.fromLocalFile(home).toString() |
5657 |
5610 |
5658 if WEBENGINE_AVAILABLE: |
5611 launchResult = self.__launchExternalWebBrowser( |
5659 self.__launchExternalWebBrowser(home, searchWord=searchWord) |
5612 home, searchWord=searchWord) |
5660 |
5613 if not launchResult: |
5661 elif WEBKIT_AVAILABLE: |
|
5662 # TODO: change to use external web browser in single mode |
|
5663 single = useSingle |
|
5664 if WEBKIT_AVAILABLE: |
|
5665 single = single or Preferences.getHelp("SingleHelpWindow") |
|
5666 if not single or self.helpWindow is None: |
|
5667 if WEBKIT_AVAILABLE: |
|
5668 from Helpviewer.HelpWindow import HelpWindow |
|
5669 browser = HelpWindow(home, '.', None, 'help viewer', True, |
|
5670 searchWord=searchWord) |
|
5671 |
|
5672 if QApplication.desktop().width() > 400 and \ |
|
5673 QApplication.desktop().height() > 500: |
|
5674 browser.show() |
|
5675 else: |
|
5676 browser.showMaximized() |
|
5677 |
|
5678 if single: |
|
5679 self.helpWindow = browser |
|
5680 try: |
|
5681 self.helpWindow.webBrowserWindowClosed.connect( |
|
5682 self.__helpClosed) |
|
5683 except AttributeError: |
|
5684 self.helpWindow.helpClosed.connect(self.__helpClosed) |
|
5685 self.preferencesChanged.connect( |
|
5686 self.helpWindow.preferencesChanged) |
|
5687 self.masterPasswordChanged.connect( |
|
5688 self.helpWindow.masterPasswordChanged) |
|
5689 elif searchWord is not None: |
|
5690 self.helpWindow.search(searchWord) |
|
5691 self.helpWindow.raise_() |
|
5692 else: |
|
5693 self.helpWindow.newTab(home) |
|
5694 self.helpWindow.raise_() |
|
5695 |
|
5696 else: |
|
5697 self.__webBrowser(home) |
5614 self.__webBrowser(home) |
5698 |
5615 |
5699 def __launchExternalWebBrowser(self, home, searchWord=None): |
5616 def __launchExternalWebBrowser(self, home, searchWord=None): |
5700 """ |
5617 """ |
5701 Private method to start an external web browser and communicate with |
5618 Private method to start an external web browser and communicate with |
5703 |
5620 |
5704 @param home filename of file to be shown or URL to be opened |
5621 @param home filename of file to be shown or URL to be opened |
5705 @type str |
5622 @type str |
5706 @keyparam searchWord word to search for |
5623 @keyparam searchWord word to search for |
5707 @type str |
5624 @type str |
5708 """ |
5625 @return flag indicating a successful launch |
5709 from WebBrowser.WebBrowserSingleApplication import \ |
5626 @rtype bool |
5710 WebBrowserSingleApplicationClient |
5627 """ |
5711 |
|
5712 clientArgs = [] |
5628 clientArgs = [] |
5713 if searchWord: |
5629 if searchWord: |
5714 clientArgs.append("--search={0}".format(searchWord)) |
5630 clientArgs.append("--search={0}".format(searchWord)) |
5715 |
5631 |
5716 if self.__webBrowserProcess is None: |
5632 if self.__webBrowserProcess is None: |
5717 process = QProcess() |
5633 webBrowsers = [ |
5718 args = [ |
|
5719 os.path.join( |
5634 os.path.join( |
5720 os.path.dirname(__file__), "..", "eric6_browser.py"), |
5635 os.path.dirname(__file__), "..", "eric6_browser.py"), |
5721 "--qthelp", |
5636 # QtWebEngine based web browser |
5722 "--single", |
5637 os.path.join( |
5723 "--name={0}".format(self.__webBrowserSAName) |
5638 os.path.dirname(__file__), "..", "eric6_webbrowser.py"), |
|
5639 # QtWebKit based web browser |
5724 ] |
5640 ] |
5725 process.start(sys.executable, args) |
5641 process = QProcess() |
5726 if not process.waitForStarted(): |
5642 for browser in webBrowsers: |
5727 E5MessageBox.warning( |
5643 args = [ |
5728 self, |
5644 browser, |
5729 self.tr("Start Web Browser"), |
5645 "--quiet", |
5730 self.tr("""The eric6 web browser could not be started.""")) |
5646 "--qthelp", |
5731 return |
5647 "--single", |
|
5648 "--name={0}".format(self.__webBrowserSAName) |
|
5649 ] |
|
5650 process.start(sys.executable, args) |
|
5651 if not process.waitForStarted(): |
|
5652 E5MessageBox.warning( |
|
5653 self, |
|
5654 self.tr("Start Web Browser"), |
|
5655 self.tr("""The eric6 web browser could not be""" |
|
5656 """ started.""")) |
|
5657 return False |
|
5658 |
|
5659 res = self.__connectToWebBrowser(process) |
|
5660 if res == 1: |
|
5661 # connection unsuccessful |
|
5662 return False |
|
5663 elif res == 0: |
|
5664 # successful |
|
5665 break |
|
5666 else: |
|
5667 return False |
5732 |
5668 |
5733 process.finished.connect(self.__webBrowserFinished) |
5669 process.finished.connect(self.__webBrowserFinished) |
5734 self.__webBrowserProcess = process |
5670 self.__webBrowserProcess = process |
5735 |
|
5736 self.__webBrowserClient = WebBrowserSingleApplicationClient( |
|
5737 self.__webBrowserSAName) |
|
5738 connectCount = 30 |
|
5739 while connectCount: |
|
5740 res = self.__webBrowserClient.connect() |
|
5741 if res != 0: |
|
5742 break |
|
5743 else: |
|
5744 connectCount -= 1 |
|
5745 QThread.msleep(1000) |
|
5746 if res <= 0: |
|
5747 E5MessageBox.warning( |
|
5748 self, |
|
5749 self.tr("Start Web Browser"), |
|
5750 self.tr("""<p>The eric6 web browser is not started.</p>""" |
|
5751 """<p>Reason: {0}</p>""").format( |
|
5752 self.__webBrowserClient.errstr()) |
|
5753 ) |
|
5754 return |
|
5755 |
5671 |
5756 if home: |
5672 if home: |
5757 clientArgs.append(home) |
5673 clientArgs.append(home) |
5758 else: |
5674 else: |
5759 clientArgs.append("--newtab={0}".format(home)) |
5675 clientArgs.append("--newtab={0}".format(home)) |
5760 |
5676 |
5761 if clientArgs: |
5677 if clientArgs: |
5762 self.__webBrowserClient.processArgs(clientArgs, disconnect=False) |
5678 self.__webBrowserClient.processArgs(clientArgs, disconnect=False) |
|
5679 |
|
5680 return True |
|
5681 |
|
5682 def __connectToWebBrowser(self, process): |
|
5683 """ |
|
5684 Private method to connect to a started web browser. |
|
5685 |
|
5686 @param process reference to the started web browser process |
|
5687 @type QProcess |
|
5688 @return error indication (1 = connection not possible, 0 = ok, |
|
5689 -1 = server exited with an error code) |
|
5690 @rtype int |
|
5691 """ |
|
5692 from WebBrowser.WebBrowserSingleApplication import \ |
|
5693 WebBrowserSingleApplicationClient |
|
5694 |
|
5695 webBrowserClient = WebBrowserSingleApplicationClient( |
|
5696 self.__webBrowserSAName) |
|
5697 connectCount = 30 |
|
5698 while connectCount: |
|
5699 res = webBrowserClient.connect() |
|
5700 if res != 0: |
|
5701 break |
|
5702 else: |
|
5703 connectCount -= 1 |
|
5704 QThread.msleep(1000) |
|
5705 QApplication.processEvents() |
|
5706 if process.state() == QProcess.NotRunning and \ |
|
5707 process.exitStatus() == QProcess.NormalExit and \ |
|
5708 process.exitCode() == 100: |
|
5709 # Process exited prematurely due to missing pre-requisites |
|
5710 return -1 |
|
5711 if res <= 0: |
|
5712 E5MessageBox.warning( |
|
5713 self, |
|
5714 self.tr("Start Web Browser"), |
|
5715 self.tr("""<p>The eric6 web browser is not started.</p>""" |
|
5716 """<p>Reason: {0}</p>""").format( |
|
5717 webBrowserClient.errstr()) |
|
5718 ) |
|
5719 return 1 |
|
5720 |
|
5721 self.__webBrowserClient = webBrowserClient |
|
5722 return 0 |
5763 |
5723 |
5764 def __webBrowserFinished(self): |
5724 def __webBrowserFinished(self): |
5765 """ |
5725 """ |
5766 Private slot handling the end of the external web browser process. |
5726 Private slot handling the end of the external web browser process. |
5767 """ |
5727 """ |
5773 def __webBrowserShutdown(self): |
5733 def __webBrowserShutdown(self): |
5774 """ |
5734 """ |
5775 Private method to shut down the web browser. |
5735 Private method to shut down the web browser. |
5776 """ |
5736 """ |
5777 self.__webBrowserClient.processArgs(["--shutdown"], disconnect=False) |
5737 self.__webBrowserClient.processArgs(["--shutdown"], disconnect=False) |
5778 |
|
5779 def __helpClosed(self): |
|
5780 """ |
|
5781 Private slot to handle the helpClosed signal of the help window. |
|
5782 """ |
|
5783 if WEBENGINE_AVAILABLE: |
|
5784 single = Preferences.getWebBrowser("SingleWebBrowserWindow") |
|
5785 elif WEBKIT_AVAILABLE: |
|
5786 single = Preferences.getHelp("SingleHelpWindow") |
|
5787 if single: |
|
5788 self.preferencesChanged.disconnect( |
|
5789 self.helpWindow.preferencesChanged) |
|
5790 self.masterPasswordChanged.disconnect( |
|
5791 self.helpWindow.masterPasswordChanged) |
|
5792 self.helpWindow = None |
|
5793 |
5738 |
5794 def __helpViewer(self): |
5739 def __helpViewer(self): |
5795 """ |
5740 """ |
5796 Private slot to start an empty help viewer/web browser. |
5741 Private slot to start an empty help viewer/web browser. |
5797 """ |
5742 """ |
5812 E5MessageBox.critical( |
5757 E5MessageBox.critical( |
5813 self, |
5758 self, |
5814 self.tr('Open Browser'), |
5759 self.tr('Open Browser'), |
5815 self.tr('Could not start a web browser')) |
5760 self.tr('Could not start a web browser')) |
5816 |
5761 |
5817 def getHelpViewer(self, preview=False): |
|
5818 """ |
|
5819 Public method to get a reference to the help window instance. |
|
5820 |
|
5821 @keyparam preview flag indicating to get a help window for preview |
|
5822 (boolean) |
|
5823 @return reference to the help window instance (HelpWindow) |
|
5824 """ |
|
5825 # TODO: check if this method is used somewhere |
|
5826 if WEBENGINE_AVAILABLE or WEBKIT_AVAILABLE: |
|
5827 if self.helpWindow is None: |
|
5828 self.launchHelpViewer("", useSingle=True) |
|
5829 self.helpWindow.raise_() |
|
5830 return self.helpWindow |
|
5831 else: |
|
5832 return None |
|
5833 |
|
5834 @pyqtSlot() |
5762 @pyqtSlot() |
5835 @pyqtSlot(str) |
5763 @pyqtSlot(str) |
5836 def showPreferences(self, pageName=None): |
5764 def showPreferences(self, pageName=None): |
5837 """ |
5765 """ |
5838 Public slot to set the preferences. |
5766 Public slot to set the preferences. |
5841 """ |
5769 """ |
5842 from Preferences.ConfigurationDialog import ConfigurationDialog |
5770 from Preferences.ConfigurationDialog import ConfigurationDialog |
5843 dlg = ConfigurationDialog( |
5771 dlg = ConfigurationDialog( |
5844 self, 'Configuration', |
5772 self, 'Configuration', |
5845 expandedEntries=self.__expandedConfigurationEntries, |
5773 expandedEntries=self.__expandedConfigurationEntries, |
5846 webEngine=WEBENGINE_AVAILABLE, |
|
5847 ) |
5774 ) |
5848 dlg.preferencesChanged.connect(self.__preferencesChanged) |
5775 dlg.preferencesChanged.connect(self.__preferencesChanged) |
5849 dlg.masterPasswordChanged.connect(self.__masterPasswordChanged) |
5776 dlg.masterPasswordChanged.connect(self.__masterPasswordChanged) |
5850 dlg.show() |
5777 dlg.show() |
5851 if pageName is not None: |
5778 if pageName is not None: |
5951 Private slot to handle the change of the master password. |
5878 Private slot to handle the change of the master password. |
5952 |
5879 |
5953 @param oldPassword current master password (string) |
5880 @param oldPassword current master password (string) |
5954 @param newPassword new master password (string) |
5881 @param newPassword new master password (string) |
5955 """ |
5882 """ |
|
5883 import Globals |
|
5884 |
5956 self.masterPasswordChanged.emit(oldPassword, newPassword) |
5885 self.masterPasswordChanged.emit(oldPassword, newPassword) |
5957 Preferences.convertPasswords(oldPassword, newPassword) |
5886 Preferences.convertPasswords(oldPassword, newPassword) |
5958 if self.helpWindow is None: |
5887 variant = Globals.getWebBrowserSupport() |
5959 if WEBENGINE_AVAILABLE: |
5888 if variant == "QtWebEngine": |
5960 from WebBrowser.Passwords.PasswordManager import \ |
5889 from WebBrowser.Passwords.PasswordManager import \ |
5961 PasswordManager |
5890 PasswordManager |
5962 pwManager = PasswordManager() |
5891 pwManager = PasswordManager() |
5963 pwManager.masterPasswordChanged(oldPassword, newPassword) |
5892 pwManager.masterPasswordChanged(oldPassword, newPassword) |
5964 elif WEBKIT_AVAILABLE: |
5893 elif variant == "QtWebKit": |
5965 from Helpviewer.Passwords.PasswordManager import \ |
5894 from Helpviewer.Passwords.PasswordManager import \ |
5966 PasswordManager |
5895 PasswordManager |
5967 pwManager = PasswordManager() |
5896 pwManager = PasswordManager() |
5968 pwManager.masterPasswordChanged(oldPassword, newPassword) |
5897 pwManager.masterPasswordChanged(oldPassword, newPassword) |
5969 Utilities.crypto.changeRememberedMaster(newPassword) |
5898 Utilities.crypto.changeRememberedMaster(newPassword) |
5970 |
5899 |
5971 def __reloadAPIs(self): |
5900 def __reloadAPIs(self): |
5972 """ |
5901 """ |
5973 Private slot to reload the api information. |
5902 Private slot to reload the api information. |