eric7/WebBrowser/WebBrowserWindow.py

branch
eric7
changeset 8565
207b47c2eed9
parent 8564
c48137b0d7ba
child 8580
e91b276e0771
equal deleted inserted replaced
8564:c48137b0d7ba 8565:207b47c2eed9
27 ) 27 )
28 from PyQt6.QtWebEngineCore import ( 28 from PyQt6.QtWebEngineCore import (
29 QWebEngineSettings, QWebEnginePage, QWebEngineProfile, QWebEngineScript 29 QWebEngineSettings, QWebEnginePage, QWebEngineProfile, QWebEngineScript
30 ) 30 )
31 try: 31 try:
32 from PyQt6.QtHelp import QHelpEngine, QHelpEngineCore, QHelpFilterData 32 from PyQt6.QtHelp import QHelpEngine
33 QTHELP_AVAILABLE = True 33 QTHELP_AVAILABLE = True
34 except ImportError: 34 except ImportError:
35 QTHELP_AVAILABLE = False 35 QTHELP_AVAILABLE = False
36 36
37 from EricGui.EricAction import EricAction 37 from EricGui.EricAction import EricAction
195 195
196 if WebBrowserWindow._useQtHelp: 196 if WebBrowserWindow._useQtHelp:
197 self.__helpEngine = QHelpEngine( 197 self.__helpEngine = QHelpEngine(
198 WebBrowserWindow.getQtHelpCollectionFileName(), 198 WebBrowserWindow.getQtHelpCollectionFileName(),
199 self) 199 self)
200 self.__helpEngine.setReadOnly(False)
201 self.__helpEngine.setupData()
200 self.__helpEngine.setUsesFilterEngine(True) 202 self.__helpEngine.setUsesFilterEngine(True)
201 self.__removeOldDocumentation() 203 self.__removeOldDocumentation()
202 self.__helpEngine.warning.connect(self.__warning) 204 self.__helpEngine.warning.connect(self.__warning)
203 else: 205 else:
204 self.__helpEngine = None 206 self.__helpEngine = None
269 self.__indexDock.setWidget(self.__indexWindow) 271 self.__indexDock.setWidget(self.__indexWindow)
270 self.addDockWidget(Qt.DockWidgetArea.LeftDockWidgetArea, 272 self.addDockWidget(Qt.DockWidgetArea.LeftDockWidgetArea,
271 self.__indexDock) 273 self.__indexDock)
272 274
273 # setup the search widget 275 # setup the search widget
274 self.__searchWord = searchWord
275 self.__indexing = False 276 self.__indexing = False
276 self.__indexingProgress = None 277 self.__indexingProgress = None
277 self.__searchEngine = self.__helpEngine.searchEngine() 278 self.__searchEngine = self.__helpEngine.searchEngine()
278 self.__searchEngine.indexingStarted.connect( 279 self.__searchEngine.indexingStarted.connect(
279 self.__indexingStarted) 280 self.__indexingStarted)
435 self.__searchWindow.newWindow.connect(self.openUrlNewWindow) 436 self.__searchWindow.newWindow.connect(self.openUrlNewWindow)
436 437
437 state = Preferences.getWebBrowser("WebBrowserState") 438 state = Preferences.getWebBrowser("WebBrowserState")
438 self.restoreState(state) 439 self.restoreState(state)
439 440
440 self.__initHelpDb()
441
442 self.__virusTotal = VirusTotalAPI(self) 441 self.__virusTotal = VirusTotalAPI(self)
443 self.__virusTotal.submitUrlError.connect( 442 self.__virusTotal.submitUrlError.connect(
444 self.__virusTotalSubmitUrlError) 443 self.__virusTotalSubmitUrlError)
445 self.__virusTotal.urlScanReport.connect( 444 self.__virusTotal.urlScanReport.connect(
446 self.__virusTotalUrlScanReport) 445 self.__virusTotalUrlScanReport)
476 475
477 QTimer.singleShot(0, syncMgr.loadSettings) 476 QTimer.singleShot(0, syncMgr.loadSettings)
478 477
479 if WebBrowserWindow._useQtHelp: 478 if WebBrowserWindow._useQtHelp:
480 QTimer.singleShot(50, self.__lookForNewDocumentation) 479 QTimer.singleShot(50, self.__lookForNewDocumentation)
481 if self.__searchWord is not None: 480 if searchWord:
482 QTimer.singleShot(0, self.__searchForWord) 481 QTimer.singleShot(0, lambda: self.__searchForWord(searchWord))
483 482
484 def __del__(self): 483 def __del__(self):
485 """ 484 """
486 Special method called during object destruction. 485 Special method called during object destruction.
487 486
2309 "ComboBoxWithEnoughWidth") 2308 "ComboBoxWithEnoughWidth")
2310 self.filterCombo.setMinimumWidth(comboWidth) 2309 self.filterCombo.setMinimumWidth(comboWidth)
2311 filtertb.addWidget(QLabel(self.tr("Filtered by: "))) 2310 filtertb.addWidget(QLabel(self.tr("Filtered by: ")))
2312 filtertb.addWidget(self.filterCombo) 2311 filtertb.addWidget(self.filterCombo)
2313 self.__helpEngine.setupFinished.connect(self.__setupFilterCombo) 2312 self.__helpEngine.setupFinished.connect(self.__setupFilterCombo)
2314 self.filterCombo.currentTextChanged.connect( 2313 self.filterCombo.currentIndexChanged.connect(
2315 self.__filterQtHelpDocumentation) 2314 self.__filterQtHelpDocumentation)
2316 self.__setupFilterCombo() 2315 self.__setupFilterCombo()
2317 self.__toolbars["filter"] = (filtertb.windowTitle(), filtertb) 2316 self.__toolbars["filter"] = (filtertb.windowTitle(), filtertb)
2318 2317
2319 settingstb = self.addToolBar(self.tr("Settings")) 2318 settingstb = self.addToolBar(self.tr("Settings"))
2350 vttb.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon) 2349 vttb.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon)
2351 vttb.addAction(self.virustotalScanCurrentAct) 2350 vttb.addAction(self.virustotalScanCurrentAct)
2352 vttb.addAction(self.virustotalIpReportAct) 2351 vttb.addAction(self.virustotalIpReportAct)
2353 vttb.addAction(self.virustotalDomainReportAct) 2352 vttb.addAction(self.virustotalDomainReportAct)
2354 self.__toolbars["virustotal"] = (vttb.windowTitle(), vttb) 2353 self.__toolbars["virustotal"] = (vttb.windowTitle(), vttb)
2355 2354
2355 @pyqtSlot()
2356 def __nextTab(self): 2356 def __nextTab(self):
2357 """ 2357 """
2358 Private slot used to show the next tab. 2358 Private slot used to show the next tab.
2359 """ 2359 """
2360 fwidget = QApplication.focusWidget() 2360 fwidget = QApplication.focusWidget()
2361 while fwidget and not hasattr(fwidget, 'nextTab'): 2361 while fwidget and not hasattr(fwidget, 'nextTab'):
2362 fwidget = fwidget.parent() 2362 fwidget = fwidget.parent()
2363 if fwidget: 2363 if fwidget:
2364 fwidget.nextTab() 2364 fwidget.nextTab()
2365 2365
2366 @pyqtSlot()
2366 def __prevTab(self): 2367 def __prevTab(self):
2367 """ 2368 """
2368 Private slot used to show the previous tab. 2369 Private slot used to show the previous tab.
2369 """ 2370 """
2370 fwidget = QApplication.focusWidget() 2371 fwidget = QApplication.focusWidget()
2371 while fwidget and not hasattr(fwidget, 'prevTab'): 2372 while fwidget and not hasattr(fwidget, 'prevTab'):
2372 fwidget = fwidget.parent() 2373 fwidget = fwidget.parent()
2373 if fwidget: 2374 if fwidget:
2374 fwidget.prevTab() 2375 fwidget.prevTab()
2375 2376
2377 @pyqtSlot()
2376 def __switchTab(self): 2378 def __switchTab(self):
2377 """ 2379 """
2378 Private slot used to switch between the current and the previous 2380 Private slot used to switch between the current and the previous
2379 current tab. 2381 current tab.
2380 """ 2382 """
2381 fwidget = QApplication.focusWidget() 2383 fwidget = QApplication.focusWidget()
2382 while fwidget and not hasattr(fwidget, 'switchTab'): 2384 while fwidget and not hasattr(fwidget, 'switchTab'):
2383 fwidget = fwidget.parent() 2385 fwidget = fwidget.parent()
2384 if fwidget: 2386 if fwidget:
2385 fwidget.switchTab() 2387 fwidget.switchTab()
2386 2388
2389 @pyqtSlot()
2387 def __whatsThis(self): 2390 def __whatsThis(self):
2388 """ 2391 """
2389 Private slot called in to enter Whats This mode. 2392 Private slot called in to enter Whats This mode.
2390 """ 2393 """
2391 QWhatsThis.enterWhatsThisMode() 2394 QWhatsThis.enterWhatsThisMode()
2392 2395
2393 def __titleChanged(self, browser, title): 2396 def __titleChanged(self, browser, title):
2394 """ 2397 """
2395 Private slot called to handle a change of a browser's title. 2398 Private slot called to handle a change of a browser's title.
2396 2399
2397 @param browser reference to the browser (WebBrowserView) 2400 @param browser reference to the browser
2398 @param title new title (string) 2401 @type WebBrowserView
2402 @param title new title
2403 @type str
2399 """ 2404 """
2400 self.historyManager().updateHistoryEntry( 2405 self.historyManager().updateHistoryEntry(
2401 browser.url().toString(), title) 2406 browser.url().toString(), title)
2402 2407
2403 @pyqtSlot() 2408 @pyqtSlot()
2482 '<p>Could not start the process.<br>' 2487 '<p>Could not start the process.<br>'
2483 'Ensure that it is available as <b>{0}</b>.</p>' 2488 'Ensure that it is available as <b>{0}</b>.</p>'
2484 ).format(applPath), 2489 ).format(applPath),
2485 self.tr('OK')) 2490 self.tr('OK'))
2486 2491
2492 @pyqtSlot()
2487 def __openFile(self): 2493 def __openFile(self):
2488 """ 2494 """
2489 Private slot called to open a file. 2495 Private slot called to open a file.
2490 """ 2496 """
2491 fn = EricFileDialog.getOpenFileName( 2497 fn = EricFileDialog.getOpenFileName(
2501 if Utilities.isWindowsPlatform(): 2507 if Utilities.isWindowsPlatform():
2502 url = "file:///" + Utilities.fromNativeSeparators(fn) 2508 url = "file:///" + Utilities.fromNativeSeparators(fn)
2503 else: 2509 else:
2504 url = "file://" + fn 2510 url = "file://" + fn
2505 self.currentBrowser().setSource(QUrl(url)) 2511 self.currentBrowser().setSource(QUrl(url))
2506 2512
2513 @pyqtSlot()
2507 def __openFileNewTab(self): 2514 def __openFileNewTab(self):
2508 """ 2515 """
2509 Private slot called to open a file in a new tab. 2516 Private slot called to open a file in a new tab.
2510 """ 2517 """
2511 fn = EricFileDialog.getOpenFileName( 2518 fn = EricFileDialog.getOpenFileName(
2521 if Utilities.isWindowsPlatform(): 2528 if Utilities.isWindowsPlatform():
2522 url = "file:///" + Utilities.fromNativeSeparators(fn) 2529 url = "file:///" + Utilities.fromNativeSeparators(fn)
2523 else: 2530 else:
2524 url = "file://" + fn 2531 url = "file://" + fn
2525 self.newTab(url) 2532 self.newTab(url)
2526 2533
2534 @pyqtSlot()
2527 def __savePageAs(self): 2535 def __savePageAs(self):
2528 """ 2536 """
2529 Private slot to save the current page. 2537 Private slot to save the current page.
2530 """ 2538 """
2531 browser = self.currentBrowser() 2539 browser = self.currentBrowser()
2539 shot. 2547 shot.
2540 """ 2548 """
2541 from .PageScreenDialog import PageScreenDialog 2549 from .PageScreenDialog import PageScreenDialog
2542 self.__pageScreen = PageScreenDialog(self.currentBrowser()) 2550 self.__pageScreen = PageScreenDialog(self.currentBrowser())
2543 self.__pageScreen.show() 2551 self.__pageScreen.show()
2544 2552
2553 @pyqtSlot()
2545 def __about(self): 2554 def __about(self):
2546 """ 2555 """
2547 Private slot to show the about information. 2556 Private slot to show the about information.
2548 """ 2557 """
2549 chromeVersion, webengineVersion = ( 2558 chromeVersion, webengineVersion = (
2557 """<p>The eric Web Browser is a combined help file and HTML""" 2566 """<p>The eric Web Browser is a combined help file and HTML"""
2558 """ browser. It is part of the eric development""" 2567 """ browser. It is part of the eric development"""
2559 """ toolset.</p>""" 2568 """ toolset.</p>"""
2560 """<p>It is based on QtWebEngine {1} and Chrome {2}.</p>""" 2569 """<p>It is based on QtWebEngine {1} and Chrome {2}.</p>"""
2561 ).format(Version, webengineVersion, chromeVersion)) 2570 ).format(Version, webengineVersion, chromeVersion))
2562 2571
2572 @pyqtSlot()
2563 def __aboutQt(self): 2573 def __aboutQt(self):
2564 """ 2574 """
2565 Private slot to show info about Qt. 2575 Private slot to show info about Qt.
2566 """ 2576 """
2567 EricMessageBox.aboutQt(self, self.tr("eric Web Browser")) 2577 EricMessageBox.aboutQt(self, self.tr("eric Web Browser"))
2568 2578
2579 @pyqtSlot(bool)
2569 def setBackwardAvailable(self, b): 2580 def setBackwardAvailable(self, b):
2570 """ 2581 """
2571 Public slot called when backward references are available. 2582 Public slot called when backward references are available.
2572 2583
2573 @param b flag indicating availability of the backwards action (boolean) 2584 @param b flag indicating availability of the backwards action
2585 @type bool
2574 """ 2586 """
2575 self.backAct.setEnabled(b) 2587 self.backAct.setEnabled(b)
2576 self.__navigationBar.backButton().setEnabled(b) 2588 self.__navigationBar.backButton().setEnabled(b)
2577 2589
2590 @pyqtSlot(bool)
2578 def setForwardAvailable(self, b): 2591 def setForwardAvailable(self, b):
2579 """ 2592 """
2580 Public slot called when forward references are available. 2593 Public slot called when forward references are available.
2581 2594
2582 @param b flag indicating the availability of the forwards action 2595 @param b flag indicating the availability of the forwards action
2583 (boolean) 2596 @type bool
2584 """ 2597 """
2585 self.forwardAct.setEnabled(b) 2598 self.forwardAct.setEnabled(b)
2586 self.__navigationBar.forwardButton().setEnabled(b) 2599 self.__navigationBar.forwardButton().setEnabled(b)
2587 2600
2601 @pyqtSlot(bool)
2588 def setLoadingActions(self, b): 2602 def setLoadingActions(self, b):
2589 """ 2603 """
2590 Public slot to set the loading dependent actions. 2604 Public slot to set the loading dependent actions.
2591 2605
2592 @param b flag indicating the loading state to consider (boolean) 2606 @param b flag indicating the loading state to consider
2607 @type bool
2593 """ 2608 """
2594 self.reloadAct.setEnabled(not b) 2609 self.reloadAct.setEnabled(not b)
2595 self.stopAct.setEnabled(b) 2610 self.stopAct.setEnabled(b)
2596 2611
2597 self.__navigationBar.reloadStopButton().setLoading(b) 2612 self.__navigationBar.reloadStopButton().setLoading(b)
2598 2613
2614 @pyqtSlot()
2599 def __addBookmark(self): 2615 def __addBookmark(self):
2600 """ 2616 """
2601 Private slot called to add the displayed file to the bookmarks. 2617 Private slot called to add the displayed file to the bookmarks.
2602 """ 2618 """
2603 from .WebBrowserPage import WebBrowserPage 2619 from .WebBrowserPage import WebBrowserPage
2636 dlg.setDescription(description) 2652 dlg.setDescription(description)
2637 menu = self.bookmarksManager().menu() 2653 menu = self.bookmarksManager().menu()
2638 idx = self.bookmarksManager().bookmarksModel().nodeIndex(menu) 2654 idx = self.bookmarksManager().bookmarksModel().nodeIndex(menu)
2639 dlg.setCurrentIndex(idx) 2655 dlg.setCurrentIndex(idx)
2640 dlg.exec() 2656 dlg.exec()
2641 2657
2658 @pyqtSlot()
2642 def __addBookmarkFolder(self): 2659 def __addBookmarkFolder(self):
2643 """ 2660 """
2644 Private slot to add a new bookmarks folder. 2661 Private slot to add a new bookmarks folder.
2645 """ 2662 """
2646 from .Bookmarks.AddBookmarkDialog import AddBookmarkDialog 2663 from .Bookmarks.AddBookmarkDialog import AddBookmarkDialog
2648 menu = self.bookmarksManager().menu() 2665 menu = self.bookmarksManager().menu()
2649 idx = self.bookmarksManager().bookmarksModel().nodeIndex(menu) 2666 idx = self.bookmarksManager().bookmarksModel().nodeIndex(menu)
2650 dlg.setCurrentIndex(idx) 2667 dlg.setCurrentIndex(idx)
2651 dlg.setFolder(True) 2668 dlg.setFolder(True)
2652 dlg.exec() 2669 dlg.exec()
2653 2670
2671 @pyqtSlot()
2654 def __showBookmarksDialog(self): 2672 def __showBookmarksDialog(self):
2655 """ 2673 """
2656 Private slot to show the bookmarks dialog. 2674 Private slot to show the bookmarks dialog.
2657 """ 2675 """
2658 from .Bookmarks.BookmarksDialog import BookmarksDialog 2676 from .Bookmarks.BookmarksDialog import BookmarksDialog
2660 self.__bookmarksDialog.openUrl.connect(self.openUrl) 2678 self.__bookmarksDialog.openUrl.connect(self.openUrl)
2661 self.__bookmarksDialog.newTab.connect(self.openUrlNewTab) 2679 self.__bookmarksDialog.newTab.connect(self.openUrlNewTab)
2662 self.__bookmarksDialog.newBackgroundTab.connect( 2680 self.__bookmarksDialog.newBackgroundTab.connect(
2663 self.openUrlNewBackgroundTab) 2681 self.openUrlNewBackgroundTab)
2664 self.__bookmarksDialog.show() 2682 self.__bookmarksDialog.show()
2665 2683
2684 @pyqtSlot()
2666 def bookmarkAll(self): 2685 def bookmarkAll(self):
2667 """ 2686 """
2668 Public slot to bookmark all open tabs. 2687 Public slot to bookmark all open tabs.
2669 """ 2688 """
2670 from .WebBrowserPage import WebBrowserPage 2689 from .WebBrowserPage import WebBrowserPage
2713 bookmark.url = url 2732 bookmark.url = url
2714 bookmark.title = title 2733 bookmark.title = title
2715 bookmark.desc = description 2734 bookmark.desc = description
2716 2735
2717 self.bookmarksManager().addBookmark(folder, bookmark) 2736 self.bookmarksManager().addBookmark(folder, bookmark)
2718 2737
2738 @pyqtSlot()
2719 def __find(self): 2739 def __find(self):
2720 """ 2740 """
2721 Private slot to handle the find action. 2741 Private slot to handle the find action.
2722 2742
2723 It opens the search dialog in order to perform the various 2743 It opens the search dialog in order to perform the various
2870 2890
2871 def shutdown(self): 2891 def shutdown(self):
2872 """ 2892 """
2873 Public method to shut down the web browser. 2893 Public method to shut down the web browser.
2874 2894
2875 @return flag indicating successful shutdown (boolean) 2895 @return flag indicating successful shutdown
2896 @rtype bool
2876 """ 2897 """
2877 if not self.__shallShutDown(): 2898 if not self.__shallShutDown():
2878 return False 2899 return False
2879 2900
2880 if ( 2901 if (
2924 if browser != self: 2945 if browser != self:
2925 browser.close() 2946 browser.close()
2926 self.close() 2947 self.close()
2927 2948
2928 return True 2949 return True
2929 2950
2951 @pyqtSlot()
2930 def __backward(self): 2952 def __backward(self):
2931 """ 2953 """
2932 Private slot called to handle the backward action. 2954 Private slot called to handle the backward action.
2933 """ 2955 """
2934 self.currentBrowser().backward() 2956 self.currentBrowser().backward()
2935 2957
2958 @pyqtSlot()
2936 def __forward(self): 2959 def __forward(self):
2937 """ 2960 """
2938 Private slot called to handle the forward action. 2961 Private slot called to handle the forward action.
2939 """ 2962 """
2940 self.currentBrowser().forward() 2963 self.currentBrowser().forward()
2941 2964
2965 @pyqtSlot()
2942 def __home(self): 2966 def __home(self):
2943 """ 2967 """
2944 Private slot called to handle the home action. 2968 Private slot called to handle the home action.
2945 """ 2969 """
2946 self.currentBrowser().home() 2970 self.currentBrowser().home()
2947 2971
2972 @pyqtSlot()
2948 def __reload(self): 2973 def __reload(self):
2949 """ 2974 """
2950 Private slot called to handle the reload action. 2975 Private slot called to handle the reload action.
2951 """ 2976 """
2952 self.currentBrowser().reloadBypassingCache() 2977 self.currentBrowser().reloadBypassingCache()
2953 2978
2979 @pyqtSlot()
2954 def __stopLoading(self): 2980 def __stopLoading(self):
2955 """ 2981 """
2956 Private slot called to handle loading of the current page. 2982 Private slot called to handle loading of the current page.
2957 """ 2983 """
2958 self.currentBrowser().stop() 2984 self.currentBrowser().stop()
2959 2985
2986 @pyqtSlot(int)
2960 def __zoomValueChanged(self, value): 2987 def __zoomValueChanged(self, value):
2961 """ 2988 """
2962 Private slot to handle value changes of the zoom widget. 2989 Private slot to handle value changes of the zoom widget.
2963 2990
2964 @param value zoom value (integer) 2991 @param value zoom value
2992 @type int
2965 """ 2993 """
2966 self.currentBrowser().setZoomValue(value) 2994 self.currentBrowser().setZoomValue(value)
2967 2995
2996 @pyqtSlot()
2968 def __zoomIn(self): 2997 def __zoomIn(self):
2969 """ 2998 """
2970 Private slot called to handle the zoom in action. 2999 Private slot called to handle the zoom in action.
2971 """ 3000 """
2972 self.currentBrowser().zoomIn() 3001 self.currentBrowser().zoomIn()
2973 self.__zoomWidget.setValue(self.currentBrowser().zoomValue()) 3002 self.__zoomWidget.setValue(self.currentBrowser().zoomValue())
2974 3003
3004 @pyqtSlot()
2975 def __zoomOut(self): 3005 def __zoomOut(self):
2976 """ 3006 """
2977 Private slot called to handle the zoom out action. 3007 Private slot called to handle the zoom out action.
2978 """ 3008 """
2979 self.currentBrowser().zoomOut() 3009 self.currentBrowser().zoomOut()
2980 self.__zoomWidget.setValue(self.currentBrowser().zoomValue()) 3010 self.__zoomWidget.setValue(self.currentBrowser().zoomValue())
2981 3011
3012 @pyqtSlot()
2982 def __zoomReset(self): 3013 def __zoomReset(self):
2983 """ 3014 """
2984 Private slot called to handle the zoom reset action. 3015 Private slot called to handle the zoom reset action.
2985 """ 3016 """
2986 self.currentBrowser().zoomReset() 3017 self.currentBrowser().zoomReset()
2987 self.__zoomWidget.setValue(self.currentBrowser().zoomValue()) 3018 self.__zoomWidget.setValue(self.currentBrowser().zoomValue())
2988 3019
3020 @pyqtSlot()
2989 def toggleFullScreen(self): 3021 def toggleFullScreen(self):
2990 """ 3022 """
2991 Public slot called to toggle the full screen mode. 3023 Public slot called to toggle the full screen mode.
2992 """ 3024 """
2993 if self.__htmlFullScreen: 3025 if self.__htmlFullScreen:
3018 screen mode 3050 screen mode
3019 @rtype bool 3051 @rtype bool
3020 """ 3052 """
3021 return self.isFullScreen() and self.__navigationContainer.isVisible() 3053 return self.isFullScreen() and self.__navigationContainer.isVisible()
3022 3054
3055 @pyqtSlot()
3023 def showFullScreenNavigation(self): 3056 def showFullScreenNavigation(self):
3024 """ 3057 """
3025 Public slot to show full screen navigation. 3058 Public slot to show full screen navigation.
3026 """ 3059 """
3027 if self.__htmlFullScreen: 3060 if self.__htmlFullScreen:
3031 self.__hideNavigationTimer.stop() 3064 self.__hideNavigationTimer.stop()
3032 3065
3033 self.__navigationContainer.show() 3066 self.__navigationContainer.show()
3034 self.__tabWidget.tabBar().show() 3067 self.__tabWidget.tabBar().show()
3035 3068
3069 @pyqtSlot()
3036 def hideFullScreenNavigation(self): 3070 def hideFullScreenNavigation(self):
3037 """ 3071 """
3038 Public slot to hide full screen navigation. 3072 Public slot to hide full screen navigation.
3039 """ 3073 """
3040 if not self.__hideNavigationTimer.isActive(): 3074 if not self.__hideNavigationTimer.isActive():
3041 self.__hideNavigationTimer.start() 3075 self.__hideNavigationTimer.start()
3042 3076
3077 @pyqtSlot()
3043 def __hideNavigation(self): 3078 def __hideNavigation(self):
3044 """ 3079 """
3045 Private slot to hide full screen navigation by timer. 3080 Private slot to hide full screen navigation by timer.
3046 """ 3081 """
3047 browser = self.currentBrowser() 3082 browser = self.currentBrowser()
3049 3084
3050 if self.isFullScreen() and mouseInBrowser: 3085 if self.isFullScreen() and mouseInBrowser:
3051 self.__navigationContainer.hide() 3086 self.__navigationContainer.hide()
3052 self.__tabWidget.tabBar().hide() 3087 self.__tabWidget.tabBar().hide()
3053 3088
3089 @pyqtSlot()
3054 def __copy(self): 3090 def __copy(self):
3055 """ 3091 """
3056 Private slot called to handle the copy action. 3092 Private slot called to handle the copy action.
3057 """ 3093 """
3058 self.currentBrowser().copy() 3094 self.currentBrowser().copy()
3059 3095
3096 @pyqtSlot()
3060 def __cut(self): 3097 def __cut(self):
3061 """ 3098 """
3062 Private slot called to handle the cut action. 3099 Private slot called to handle the cut action.
3063 """ 3100 """
3064 self.currentBrowser().cut() 3101 self.currentBrowser().cut()
3065 3102
3103 @pyqtSlot()
3066 def __paste(self): 3104 def __paste(self):
3067 """ 3105 """
3068 Private slot called to handle the paste action. 3106 Private slot called to handle the paste action.
3069 """ 3107 """
3070 self.currentBrowser().paste() 3108 self.currentBrowser().paste()
3071 3109
3110 @pyqtSlot()
3072 def __undo(self): 3111 def __undo(self):
3073 """ 3112 """
3074 Private slot to handle the undo action. 3113 Private slot to handle the undo action.
3075 """ 3114 """
3076 self.currentBrowser().undo() 3115 self.currentBrowser().undo()
3077 3116
3117 @pyqtSlot()
3078 def __redo(self): 3118 def __redo(self):
3079 """ 3119 """
3080 Private slot to handle the redo action. 3120 Private slot to handle the redo action.
3081 """ 3121 """
3082 self.currentBrowser().redo() 3122 self.currentBrowser().redo()
3083 3123
3124 @pyqtSlot()
3084 def __selectAll(self): 3125 def __selectAll(self):
3085 """ 3126 """
3086 Private slot to handle the select all action. 3127 Private slot to handle the select all action.
3087 """ 3128 """
3088 self.currentBrowser().selectAll() 3129 self.currentBrowser().selectAll()
3089 3130
3131 @pyqtSlot()
3090 def __unselect(self): 3132 def __unselect(self):
3091 """ 3133 """
3092 Private slot to clear the selection of the current browser. 3134 Private slot to clear the selection of the current browser.
3093 """ 3135 """
3094 self.currentBrowser().unselect() 3136 self.currentBrowser().unselect()
3142 3184
3143 @return list of references to web browsers (list of WebBrowserView) 3185 @return list of references to web browsers (list of WebBrowserView)
3144 """ 3186 """
3145 return self.__tabWidget.browsers() 3187 return self.__tabWidget.browsers()
3146 3188
3189 @pyqtSlot(int)
3147 def __currentChanged(self, index): 3190 def __currentChanged(self, index):
3148 """ 3191 """
3149 Private slot to handle the currentChanged signal. 3192 Private slot to handle the currentChanged signal.
3150 3193
3151 @param index index of the current tab (integer) 3194 @param index index of the current tab
3195 @type int
3152 """ 3196 """
3153 if index > -1: 3197 if index > -1:
3154 cb = self.currentBrowser() 3198 cb = self.currentBrowser()
3155 if cb is not None: 3199 if cb is not None:
3156 self.setForwardAvailable(cb.isForwardAvailable()) 3200 self.setForwardAvailable(cb.isForwardAvailable())
3158 self.setLoadingActions(cb.isLoading()) 3202 self.setLoadingActions(cb.isLoading())
3159 3203
3160 # set value of zoom widget 3204 # set value of zoom widget
3161 self.__zoomWidget.setValue(cb.zoomValue()) 3205 self.__zoomWidget.setValue(cb.zoomValue())
3162 3206
3207 @pyqtSlot()
3163 def __showPreferences(self): 3208 def __showPreferences(self):
3164 """ 3209 """
3165 Private slot to set the preferences. 3210 Private slot to set the preferences.
3166 """ 3211 """
3167 from Preferences.ConfigurationDialog import ( 3212 from Preferences.ConfigurationDialog import (
3184 dlg.setPreferences() 3229 dlg.setPreferences()
3185 Preferences.syncPreferences() 3230 Preferences.syncPreferences()
3186 self.preferencesChanged() 3231 self.preferencesChanged()
3187 self.__lastConfigurationPageName = dlg.getConfigurationPageName() 3232 self.__lastConfigurationPageName = dlg.getConfigurationPageName()
3188 3233
3234 @pyqtSlot()
3189 def preferencesChanged(self): 3235 def preferencesChanged(self):
3190 """ 3236 """
3191 Public slot to handle a change of preferences. 3237 Public slot to handle a change of preferences.
3192 """ 3238 """
3193 self.setStyle(Preferences.getUI("Style"), 3239 self.setStyle(Preferences.getUI("Style"),
3257 if local: 3303 if local:
3258 # we were called from our local configuration dialog 3304 # we were called from our local configuration dialog
3259 Preferences.convertPasswords(oldPassword, newPassword) 3305 Preferences.convertPasswords(oldPassword, newPassword)
3260 Utilities.crypto.changeRememberedMaster(newPassword) 3306 Utilities.crypto.changeRememberedMaster(newPassword)
3261 3307
3308 @pyqtSlot()
3262 def __showAcceptedLanguages(self): 3309 def __showAcceptedLanguages(self):
3263 """ 3310 """
3264 Private slot to configure the accepted languages for web pages. 3311 Private slot to configure the accepted languages for web pages.
3265 """ 3312 """
3266 from .WebBrowserLanguagesDialog import WebBrowserLanguagesDialog 3313 from .WebBrowserLanguagesDialog import WebBrowserLanguagesDialog
3267 dlg = WebBrowserLanguagesDialog(self) 3314 dlg = WebBrowserLanguagesDialog(self)
3268 dlg.exec() 3315 dlg.exec()
3269 self.networkManager().languagesChanged() 3316 self.networkManager().languagesChanged()
3270 3317
3318 @pyqtSlot()
3271 def __showCookiesConfiguration(self): 3319 def __showCookiesConfiguration(self):
3272 """ 3320 """
3273 Private slot to configure the cookies handling. 3321 Private slot to configure the cookies handling.
3274 """ 3322 """
3275 from .CookieJar.CookiesConfigurationDialog import ( 3323 from .CookieJar.CookiesConfigurationDialog import (
3342 if cls._cookieJar is None: 3390 if cls._cookieJar is None:
3343 from .CookieJar.CookieJar import CookieJar 3391 from .CookieJar.CookieJar import CookieJar
3344 cls._cookieJar = CookieJar() 3392 cls._cookieJar = CookieJar()
3345 3393
3346 return cls._cookieJar 3394 return cls._cookieJar
3347 3395
3396 @pyqtSlot()
3348 def __clearIconsDatabase(self): 3397 def __clearIconsDatabase(self):
3349 """ 3398 """
3350 Private slot to clear the favicons databse. 3399 Private slot to clear the favicons databse.
3351 """ 3400 """
3352 WebIconProvider.instance().clear() 3401 WebIconProvider.instance().clear()
3353 3402
3403 @pyqtSlot()
3354 def __showWebIconsDialog(self): 3404 def __showWebIconsDialog(self):
3355 """ 3405 """
3356 Private slot to show a dialog to manage the favicons database. 3406 Private slot to show a dialog to manage the favicons database.
3357 """ 3407 """
3358 WebIconProvider.instance().showWebIconDialog() 3408 WebIconProvider.instance().showWebIconDialog()
3382 self.newTab(url) 3432 self.newTab(url)
3383 else: 3433 else:
3384 cb.setUrl(url) 3434 cb.setUrl(url)
3385 self.__activating = False 3435 self.__activating = False
3386 3436
3437 @pyqtSlot()
3387 def __activateCurrentBrowser(self): 3438 def __activateCurrentBrowser(self):
3388 """ 3439 """
3389 Private slot to activate the current browser. 3440 Private slot to activate the current browser.
3390 """ 3441 """
3391 self.currentBrowser().setFocus() 3442 self.currentBrowser().setFocus()
3392 3443
3444 @pyqtSlot()
3393 def __syncTOC(self): 3445 def __syncTOC(self):
3394 """ 3446 """
3395 Private slot to synchronize the TOC with the currently shown page. 3447 Private slot to synchronize the TOC with the currently shown page.
3396 """ 3448 """
3397 if WebBrowserWindow._useQtHelp: 3449 if WebBrowserWindow._useQtHelp:
3398 with EricOverrideCursor(): 3450 with EricOverrideCursor():
3399 url = self.currentBrowser().source() 3451 url = self.currentBrowser().source()
3400 self.__showTocWindow() 3452 self.__showTocWindow()
3401 if not self.__tocWindow.syncToContent(url): 3453 if not self.__tocWindow.syncToContent(url):
3402 self.statusBar().showMessage( 3454 self.statusBar().showMessage(
3403 self.tr("Could not find an associated content."), 5000) 3455 self.tr("Could not find any associated content."),
3456 5000)
3404 3457
3405 def __showTocWindow(self): 3458 def __showTocWindow(self):
3406 """ 3459 """
3407 Private method to show the table of contents window. 3460 Private method to show the table of contents window.
3408 """ 3461 """
3430 @param widget reference to the widget to be activated (QWidget) 3483 @param widget reference to the widget to be activated (QWidget)
3431 """ 3484 """
3432 widget.parent().show() 3485 widget.parent().show()
3433 widget.parent().raise_() 3486 widget.parent().raise_()
3434 widget.setFocus() 3487 widget.setFocus()
3435 3488
3489 @pyqtSlot()
3436 def __setupFilterCombo(self): 3490 def __setupFilterCombo(self):
3437 """ 3491 """
3438 Private slot to setup the filter combo box. 3492 Private slot to setup the filter combo box.
3439 """ 3493 """
3440 if WebBrowserWindow._useQtHelp: 3494 if WebBrowserWindow._useQtHelp:
3441 activeFilter = self.filterCombo.currentText() 3495 activeFilter = self.filterCombo.currentText()
3442 if not activeFilter: 3496 if not activeFilter:
3443 activeFilter = self.__helpEngine.filterEngine().activeFilter() 3497 activeFilter = self.__helpEngine.filterEngine().activeFilter()
3498 allFilters = self.__helpEngine.filterEngine().filters()
3444 self.filterCombo.clear() 3499 self.filterCombo.clear()
3445 self.filterCombo.addItems(sorted( 3500 self.filterCombo.addItem(self.tr("Unfiltered"))
3446 self.__helpEngine.filterEngine().filters())) 3501 if allFilters:
3502 self.filterCombo.insertSeparator(1)
3503 for helpFilter in sorted(allFilters):
3504 self.filterCombo.addItem(helpFilter, helpFilter)
3447 self.filterCombo.setCurrentText(activeFilter) 3505 self.filterCombo.setCurrentText(activeFilter)
3448 3506
3449 def __filterQtHelpDocumentation(self, activeFilter): 3507 @pyqtSlot(int)
3508 def __filterQtHelpDocumentation(self, index):
3450 """ 3509 """
3451 Private slot to filter the QtHelp documentation. 3510 Private slot to filter the QtHelp documentation.
3452 3511
3453 @param activeFilter current text of the filter combobox 3512 @param index index of the selected QtHelp documentation filter
3454 @type str 3513 @type int
3455 """ 3514 """
3456 if self.__helpEngine: 3515 if self.__helpEngine:
3457 self.__helpEngine.filterEngine().setActiveFilter(activeFilter) 3516 helpFilter = self.filterCombo.itemData(index)
3458 3517 self.__helpEngine.filterEngine().setActiveFilter(helpFilter)
3518
3519 @pyqtSlot()
3459 def __manageQtHelpDocumentation(self): 3520 def __manageQtHelpDocumentation(self):
3460 """ 3521 """
3461 Private slot to manage the QtHelp documentation database. 3522 Private slot to manage the QtHelp documentation database.
3462 """ 3523 """
3463 if WebBrowserWindow._useQtHelp: 3524 if WebBrowserWindow._useQtHelp:
3474 3535
3475 @return dictionary with tab id as key and host/namespace as value 3536 @return dictionary with tab id as key and host/namespace as value
3476 """ 3537 """
3477 return self.__tabWidget.getSourceFileList() 3538 return self.__tabWidget.getSourceFileList()
3478 3539
3540 @pyqtSlot()
3479 def __indexingStarted(self): 3541 def __indexingStarted(self):
3480 """ 3542 """
3481 Private slot to handle the start of the indexing process. 3543 Private slot to handle the start of the indexing process.
3482 """ 3544 """
3483 if WebBrowserWindow._useQtHelp: 3545 if WebBrowserWindow._useQtHelp:
3500 progressBar.setSizePolicy(sizePolicy) 3562 progressBar.setSizePolicy(sizePolicy)
3501 layout.addWidget(progressBar) 3563 layout.addWidget(progressBar)
3502 3564
3503 self.statusBar().insertPermanentWidget( 3565 self.statusBar().insertPermanentWidget(
3504 0, self.__indexingProgress) 3566 0, self.__indexingProgress)
3505 3567
3568 @pyqtSlot()
3506 def __indexingFinished(self): 3569 def __indexingFinished(self):
3507 """ 3570 """
3508 Private slot to handle the start of the indexing process. 3571 Private slot to handle the start of the indexing process.
3509 """ 3572 """
3510 if WebBrowserWindow._useQtHelp: 3573 if WebBrowserWindow._useQtHelp:
3511 self.statusBar().removeWidget(self.__indexingProgress) 3574 self.statusBar().removeWidget(self.__indexingProgress)
3512 self.__indexingProgress = None 3575 self.__indexingProgress = None
3513 self.__indexing = False 3576 self.__indexing = False
3514 if self.__searchWord is not None: 3577
3515 self.__searchForWord() 3578 @pyqtSlot(str)
3516 3579 def __searchForWord(self, searchWord):
3517 def __searchForWord(self):
3518 """ 3580 """
3519 Private slot to search for a word. 3581 Private slot to search for a word.
3520 """ 3582
3521 if ( 3583 @param searchWord word to search for
3522 WebBrowserWindow._useQtHelp and 3584 @type str
3523 not self.__indexing and 3585 """
3524 self.__searchWord is not None 3586 if WebBrowserWindow._useQtHelp and searchWord:
3525 ): 3587 if self.__indexing:
3526 self.__searchDock.show() 3588 # Try again a second later
3527 self.__searchDock.raise_() 3589 QTimer.singleShot(
3528 self.__searchEngine.search(self.__searchWord) 3590 1000,
3529 self.__searchWord = None 3591 lambda: self.__searchForWord(searchWord)
3592 )
3593 else:
3594 self.__searchDock.show()
3595 self.__searchDock.raise_()
3596 self.__searchEngine.search(searchWord)
3530 3597
3531 def search(self, word): 3598 def search(self, word):
3532 """ 3599 """
3533 Public method to search for a word. 3600 Public method to search for a word.
3534 3601
3535 @param word word to search for (string) 3602 @param word word to search for
3603 @type str
3536 """ 3604 """
3537 if WebBrowserWindow._useQtHelp: 3605 if WebBrowserWindow._useQtHelp:
3538 self.__searchWord = word 3606 self.__searchForWord(word)
3539 self.__searchForWord() 3607
3540 3608 @pyqtSlot()
3541 def __removeOldDocumentation(self): 3609 def __removeOldDocumentation(self):
3542 """ 3610 """
3543 Private slot to remove non-existing documentation from the help engine. 3611 Private slot to remove non-existing documentation from the help engine.
3544 """ 3612 """
3545 if WebBrowserWindow._useQtHelp: 3613 if WebBrowserWindow._useQtHelp:
3546 for namespace in self.__helpEngine.registeredDocumentations(): 3614 for namespace in self.__helpEngine.registeredDocumentations():
3547 docFile = self.__helpEngine.documentationFileName(namespace) 3615 docFile = self.__helpEngine.documentationFileName(namespace)
3548 if not os.path.exists(docFile): 3616 if not os.path.exists(docFile):
3549 self.__helpEngine.unregisterDocumentation(namespace) 3617 self.__helpEngine.unregisterDocumentation(namespace)
3550 3618
3619 @pyqtSlot()
3551 def __lookForNewDocumentation(self): 3620 def __lookForNewDocumentation(self):
3552 """ 3621 """
3553 Private slot to look for new documentation to be loaded into the 3622 Private slot to look for new documentation to be loaded into the
3554 help database. 3623 help database.
3555 """ 3624 """
3562 self.__helpInstaller.docsInstalled.connect(self.__docsInstalled) 3631 self.__helpInstaller.docsInstalled.connect(self.__docsInstalled)
3563 3632
3564 self.statusBar().showMessage( 3633 self.statusBar().showMessage(
3565 self.tr("Looking for Documentation...")) 3634 self.tr("Looking for Documentation..."))
3566 self.__helpInstaller.installDocs() 3635 self.__helpInstaller.installDocs()
3567 3636
3637 @pyqtSlot(str)
3568 def __showInstallationError(self, message): 3638 def __showInstallationError(self, message):
3569 """ 3639 """
3570 Private slot to show installation errors. 3640 Private slot to show installation errors.
3571 3641
3572 @param message message to be shown (string) 3642 @param message message to be shown
3643 @type str
3573 """ 3644 """
3574 EricMessageBox.warning( 3645 EricMessageBox.warning(
3575 self, 3646 self,
3576 self.tr("eric Web Browser"), 3647 self.tr("eric Web Browser"),
3577 message) 3648 message)
3578 3649
3650 @pyqtSlot(bool)
3579 def __docsInstalled(self, installed): 3651 def __docsInstalled(self, installed):
3580 """ 3652 """
3581 Private slot handling the end of documentation installation. 3653 Private slot handling the end of documentation installation.
3582 3654
3583 @param installed flag indicating that documents were installed 3655 @param installed flag indicating that documents were installed
3584 (boolean) 3656 @type bool
3585 """ 3657 """
3586 if WebBrowserWindow._useQtHelp: 3658 if WebBrowserWindow._useQtHelp:
3587 self.statusBar().clearMessage() 3659 self.statusBar().clearMessage()
3588 3660 self.__helpEngine.setupData()
3589 def __initHelpDb(self): 3661
3590 """ 3662 @pyqtSlot(str)
3591 Private slot to initialize the documentation database.
3592 """
3593 if WebBrowserWindow._useQtHelp:
3594 unfiltered = self.tr("Unfiltered")
3595 filterEngine = self.__helpEngine.filterEngine()
3596 if unfiltered not in filterEngine.filters():
3597 filterEngine.setFilterData(unfiltered, QHelpFilterData())
3598
3599 self.__helpEngine.blockSignals(True)
3600 filterEngine.setActiveFilter(unfiltered)
3601 self.__helpEngine.blockSignals(False)
3602
3603 def __warning(self, msg): 3663 def __warning(self, msg):
3604 """ 3664 """
3605 Private slot handling warnings from the help engine. 3665 Private slot handling warnings from the help engine.
3606 3666
3607 @param msg message sent by the help engine (string) 3667 @param msg message sent by the help engine
3668 @type str
3608 """ 3669 """
3609 EricMessageBox.warning( 3670 EricMessageBox.warning(
3610 self, 3671 self,
3611 self.tr("Help Engine"), msg) 3672 self.tr("Help Engine"), msg)
3612 3673
3674 @pyqtSlot()
3613 def __aboutToShowSettingsMenu(self): 3675 def __aboutToShowSettingsMenu(self):
3614 """ 3676 """
3615 Private slot to show the Settings menu. 3677 Private slot to show the Settings menu.
3616 """ 3678 """
3617 self.editMessageFilterAct.setEnabled( 3679 self.editMessageFilterAct.setEnabled(
3618 EricErrorMessage.messageHandlerInstalled()) 3680 EricErrorMessage.messageHandlerInstalled())
3619 3681
3682 @pyqtSlot()
3620 def __clearPrivateData(self): 3683 def __clearPrivateData(self):
3621 """ 3684 """
3622 Private slot to clear the private data. 3685 Private slot to clear the private data.
3623 """ 3686 """
3624 from .WebBrowserClearPrivateDataDialog import ( 3687 from .WebBrowserClearPrivateDataDialog import (
3657 self.passwordManager().clear() 3720 self.passwordManager().clear()
3658 if zoomValues: 3721 if zoomValues:
3659 ZoomManager.instance().clear() 3722 ZoomManager.instance().clear()
3660 if sslExceptions: 3723 if sslExceptions:
3661 self.networkManager().clearSslExceptions() 3724 self.networkManager().clearSslExceptions()
3662 3725
3726 @pyqtSlot()
3663 def __showEnginesConfigurationDialog(self): 3727 def __showEnginesConfigurationDialog(self):
3664 """ 3728 """
3665 Private slot to show the search engines configuration dialog. 3729 Private slot to show the search engines configuration dialog.
3666 """ 3730 """
3667 from .OpenSearch.OpenSearchDialog import OpenSearchDialog 3731 from .OpenSearch.OpenSearchDialog import OpenSearchDialog
3675 action. 3739 action.
3676 3740
3677 @return reference to the search engines configuration action (QAction) 3741 @return reference to the search engines configuration action (QAction)
3678 """ 3742 """
3679 return self.searchEnginesAct 3743 return self.searchEnginesAct
3680 3744
3745 @pyqtSlot()
3681 def __showPasswordsDialog(self): 3746 def __showPasswordsDialog(self):
3682 """ 3747 """
3683 Private slot to show the passwords management dialog. 3748 Private slot to show the passwords management dialog.
3684 """ 3749 """
3685 from .Passwords.PasswordsDialog import PasswordsDialog 3750 from .Passwords.PasswordsDialog import PasswordsDialog
3686 3751
3687 dlg = PasswordsDialog(self) 3752 dlg = PasswordsDialog(self)
3688 dlg.exec() 3753 dlg.exec()
3689 3754
3755 @pyqtSlot()
3690 def __showCertificateErrorsDialog(self): 3756 def __showCertificateErrorsDialog(self):
3691 """ 3757 """
3692 Private slot to show the certificate errors management dialog. 3758 Private slot to show the certificate errors management dialog.
3693 """ 3759 """
3694 self.networkManager().showSslErrorExceptionsDialog() 3760 self.networkManager().showSslErrorExceptionsDialog()
3695 3761
3762 @pyqtSlot()
3696 def __showAdBlockDialog(self): 3763 def __showAdBlockDialog(self):
3697 """ 3764 """
3698 Private slot to show the AdBlock configuration dialog. 3765 Private slot to show the AdBlock configuration dialog.
3699 """ 3766 """
3700 self.adBlockManager().showDialog() 3767 self.adBlockManager().showDialog()
3701 3768
3769 @pyqtSlot()
3702 def __showPersonalInformationDialog(self): 3770 def __showPersonalInformationDialog(self):
3703 """ 3771 """
3704 Private slot to show the Personal Information configuration dialog. 3772 Private slot to show the Personal Information configuration dialog.
3705 """ 3773 """
3706 self.personalInformationManager().showConfigurationDialog() 3774 self.personalInformationManager().showConfigurationDialog()
3707 3775
3776 @pyqtSlot()
3708 def __showGreaseMonkeyConfigDialog(self): 3777 def __showGreaseMonkeyConfigDialog(self):
3709 """ 3778 """
3710 Private slot to show the GreaseMonkey scripts configuration dialog. 3779 Private slot to show the GreaseMonkey scripts configuration dialog.
3711 """ 3780 """
3712 self.greaseMonkeyManager().showConfigurationDialog() 3781 self.greaseMonkeyManager().showConfigurationDialog()
3713 3782
3783 @pyqtSlot()
3714 def __showFeaturePermissionDialog(self): 3784 def __showFeaturePermissionDialog(self):
3715 """ 3785 """
3716 Private slot to show the feature permission dialog. 3786 Private slot to show the feature permission dialog.
3717 """ 3787 """
3718 self.featurePermissionManager().showFeaturePermissionsDialog() 3788 self.featurePermissionManager().showFeaturePermissionsDialog()
3719 3789
3790 @pyqtSlot()
3720 def __showZoomValuesDialog(self): 3791 def __showZoomValuesDialog(self):
3721 """ 3792 """
3722 Private slot to show the zoom values management dialog. 3793 Private slot to show the zoom values management dialog.
3723 """ 3794 """
3724 from .ZoomManager.ZoomValuesDialog import ZoomValuesDialog 3795 from .ZoomManager.ZoomValuesDialog import ZoomValuesDialog
3725 3796
3726 dlg = ZoomValuesDialog(self) 3797 dlg = ZoomValuesDialog(self)
3727 dlg.exec() 3798 dlg.exec()
3728 3799
3800 @pyqtSlot()
3729 def __showDownloadsWindow(self): 3801 def __showDownloadsWindow(self):
3730 """ 3802 """
3731 Private slot to show the downloads dialog. 3803 Private slot to show the downloads dialog.
3732 """ 3804 """
3733 self.downloadManager().show() 3805 self.downloadManager().show()
3734 3806
3807 @pyqtSlot()
3735 def __showPageSource(self): 3808 def __showPageSource(self):
3736 """ 3809 """
3737 Private slot to show the source of the current page in an editor. 3810 Private slot to show the source of the current page in an editor.
3738 """ 3811 """
3739 self.currentBrowser().page().toHtml(self.__showPageSourceCallback) 3812 self.currentBrowser().page().toHtml(self.__showPageSourceCallback)
3749 editor = MiniEditor(parent=self) 3822 editor = MiniEditor(parent=self)
3750 editor.setText(src, "Html") 3823 editor.setText(src, "Html")
3751 editor.setLanguage("dummy.html") 3824 editor.setLanguage("dummy.html")
3752 editor.show() 3825 editor.show()
3753 3826
3827 @pyqtSlot()
3754 def __toggleJavaScriptConsole(self): 3828 def __toggleJavaScriptConsole(self):
3755 """ 3829 """
3756 Private slot to toggle the JavaScript console. 3830 Private slot to toggle the JavaScript console.
3757 """ 3831 """
3758 if self.__javascriptConsoleDock.isVisible(): 3832 if self.__javascriptConsoleDock.isVisible():
3790 from .Bookmarks.BookmarksManager import BookmarksManager 3864 from .Bookmarks.BookmarksManager import BookmarksManager
3791 cls._bookmarksManager = BookmarksManager() 3865 cls._bookmarksManager = BookmarksManager()
3792 3866
3793 return cls._bookmarksManager 3867 return cls._bookmarksManager
3794 3868
3869 @pyqtSlot(QUrl)
3870 @pyqtSlot(QUrl, str)
3795 def openUrl(self, url, title=None): 3871 def openUrl(self, url, title=None):
3796 """ 3872 """
3797 Public slot to load a URL in the current tab. 3873 Public slot to load a URL in the current tab.
3798 3874
3799 @param url URL to be opened (QUrl) 3875 @param url URL to be opened
3800 @param title title of the bookmark (string) 3876 @type QUrl
3877 @param title title of the bookmark
3878 @type str
3801 """ 3879 """
3802 self.__linkActivated(url) 3880 self.__linkActivated(url)
3803 3881
3882 @pyqtSlot(QUrl)
3883 @pyqtSlot(QUrl, str)
3804 def openUrlNewTab(self, url, title=None): 3884 def openUrlNewTab(self, url, title=None):
3805 """ 3885 """
3806 Public slot to load a URL in a new tab. 3886 Public slot to load a URL in a new tab.
3807 3887
3808 @param url URL to be opened (QUrl) 3888 @param url URL to be opened
3809 @param title title of the bookmark (string) 3889 @type QUrl
3890 @param title title of the bookmark
3891 @type str
3810 """ 3892 """
3811 self.newTab(url) 3893 self.newTab(url)
3812 3894
3895 @pyqtSlot(QUrl)
3896 @pyqtSlot(QUrl, str)
3813 def openUrlNewBackgroundTab(self, url, title=None): 3897 def openUrlNewBackgroundTab(self, url, title=None):
3814 """ 3898 """
3815 Public slot to load a URL in a new background tab. 3899 Public slot to load a URL in a new background tab.
3816 3900
3817 @param url URL to be opened (QUrl) 3901 @param url URL to be opened
3818 @param title title of the bookmark (string) 3902 @type QUrl
3903 @param title title of the bookmark
3904 @type str
3819 """ 3905 """
3820 self.newTab(url, background=True) 3906 self.newTab(url, background=True)
3821 3907
3908 @pyqtSlot(QUrl)
3909 @pyqtSlot(QUrl, str)
3822 def openUrlNewWindow(self, url, title=None): 3910 def openUrlNewWindow(self, url, title=None):
3823 """ 3911 """
3824 Public slot to load a URL in a new window. 3912 Public slot to load a URL in a new window.
3825 3913
3826 @param url URL to be opened (QUrl) 3914 @param url URL to be opened
3827 @param title title of the bookmark (string) 3915 @type QUrl
3916 @param title title of the bookmark
3917 @type str
3828 """ 3918 """
3829 self.newWindow(url) 3919 self.newWindow(url)
3830 3920
3921 @pyqtSlot(QUrl)
3922 @pyqtSlot(QUrl, str)
3831 def openUrlNewPrivateWindow(self, url, title=None): 3923 def openUrlNewPrivateWindow(self, url, title=None):
3832 """ 3924 """
3833 Public slot to load a URL in a new private window. 3925 Public slot to load a URL in a new private window.
3834 3926
3835 @param url URL to be opened (QUrl) 3927 @param url URL to be opened
3836 @param title title of the bookmark (string) 3928 @type QUrl
3929 @param title title of the bookmark
3930 @type str
3837 """ 3931 """
3838 self.newPrivateWindow(url) 3932 self.newPrivateWindow(url)
3839 3933
3934 @pyqtSlot()
3840 def __sendPageLink(self): 3935 def __sendPageLink(self):
3841 """ 3936 """
3842 Private slot to send the link of the current page via email. 3937 Private slot to send the link of the current page via email.
3843 """ 3938 """
3844 url = self.currentBrowser().url() 3939 url = self.currentBrowser().url()
4102 for codec in codecNames: 4197 for codec in codecNames:
4103 self.__createTextEncodingAction(codec, defaultCodec, menu) 4198 self.__createTextEncodingAction(codec, defaultCodec, menu)
4104 4199
4105 parentMenu.addMenu(menu) 4200 parentMenu.addMenu(menu)
4106 4201
4202 @pyqtSlot()
4107 def __aboutToShowTextEncodingMenu(self): 4203 def __aboutToShowTextEncodingMenu(self):
4108 """ 4204 """
4109 Private slot to populate the text encoding menu. 4205 Private slot to populate the text encoding menu.
4110 """ 4206 """
4111 self.__textEncodingMenu.clear() 4207 self.__textEncodingMenu.clear()
4152 self.__createTextEncodingSubmenu(self.tr("Apple"), macCodecs, 4248 self.__createTextEncodingSubmenu(self.tr("Apple"), macCodecs,
4153 self.__textEncodingMenu) 4249 self.__textEncodingMenu)
4154 self.__createTextEncodingSubmenu(self.tr("Other"), otherCodecs, 4250 self.__createTextEncodingSubmenu(self.tr("Other"), otherCodecs,
4155 self.__textEncodingMenu) 4251 self.__textEncodingMenu)
4156 4252
4253 @pyqtSlot(QAction)
4157 def __setTextEncoding(self, act): 4254 def __setTextEncoding(self, act):
4158 """ 4255 """
4159 Private slot to set the selected text encoding as the default for 4256 Private slot to set the selected text encoding as the default for
4160 this session. 4257 this session.
4161 4258
4162 @param act reference to the selected action (QAction) 4259 @param act reference to the selected action
4260 @type QAction
4163 """ 4261 """
4164 codec = act.data() 4262 codec = act.data()
4165 if codec == "": 4263 if codec == "":
4166 self.webSettings().setDefaultTextEncoding("") 4264 self.webSettings().setDefaultTextEncoding("")
4167 else: 4265 else:
4216 menu.triggered.connect(self.__TBMenuTriggered) 4314 menu.triggered.connect(self.__TBMenuTriggered)
4217 4315
4218 self.__populateToolbarsMenu(menu) 4316 self.__populateToolbarsMenu(menu)
4219 4317
4220 return menu 4318 return menu
4221 4319
4320 @pyqtSlot()
4222 def __showToolbarsMenu(self): 4321 def __showToolbarsMenu(self):
4223 """ 4322 """
4224 Private slot to display the Toolbars menu. 4323 Private slot to display the Toolbars menu.
4225 """ 4324 """
4226 self.__populateToolbarsMenu(self.__toolbarsMenu) 4325 self.__populateToolbarsMenu(self.__toolbarsMenu)
4362 from .Feeds.FeedsManager import FeedsManager 4461 from .Feeds.FeedsManager import FeedsManager
4363 cls._feedsManager = FeedsManager() 4462 cls._feedsManager = FeedsManager()
4364 4463
4365 return cls._feedsManager 4464 return cls._feedsManager
4366 4465
4466 @pyqtSlot()
4367 def __showFeedsManager(self): 4467 def __showFeedsManager(self):
4368 """ 4468 """
4369 Private slot to show the feeds manager dialog. 4469 Private slot to show the feeds manager dialog.
4370 """ 4470 """
4371 feedsManager = self.feedsManager() 4471 feedsManager = self.feedsManager()
4390 feedsManager.newBackgroundTab.disconnect(self.openUrlNewBackgroundTab) 4490 feedsManager.newBackgroundTab.disconnect(self.openUrlNewBackgroundTab)
4391 feedsManager.newWindow.disconnect(self.openUrlNewWindow) 4491 feedsManager.newWindow.disconnect(self.openUrlNewWindow)
4392 feedsManager.newPrivateWindow.disconnect(self.openUrlNewPrivateWindow) 4492 feedsManager.newPrivateWindow.disconnect(self.openUrlNewPrivateWindow)
4393 feedsManager.rejected.disconnect() 4493 feedsManager.rejected.disconnect()
4394 4494
4495 @pyqtSlot()
4395 def __showSiteinfoDialog(self): 4496 def __showSiteinfoDialog(self):
4396 """ 4497 """
4397 Private slot to show the site info dialog. 4498 Private slot to show the site info dialog.
4398 """ 4499 """
4399 from .SiteInfo.SiteInfoDialog import SiteInfoDialog 4500 from .SiteInfo.SiteInfoDialog import SiteInfoDialog
4411 from .UserAgent.UserAgentManager import UserAgentManager 4512 from .UserAgent.UserAgentManager import UserAgentManager
4412 cls._userAgentsManager = UserAgentManager() 4513 cls._userAgentsManager = UserAgentManager()
4413 4514
4414 return cls._userAgentsManager 4515 return cls._userAgentsManager
4415 4516
4517 @pyqtSlot()
4416 def __showUserAgentsDialog(self): 4518 def __showUserAgentsDialog(self):
4417 """ 4519 """
4418 Private slot to show the user agents management dialog. 4520 Private slot to show the user agents management dialog.
4419 """ 4521 """
4420 from .UserAgent.UserAgentsDialog import UserAgentsDialog 4522 from .UserAgent.UserAgentsDialog import UserAgentsDialog
4433 from .Sync.SyncManager import SyncManager 4535 from .Sync.SyncManager import SyncManager
4434 cls._syncManager = SyncManager() 4536 cls._syncManager = SyncManager()
4435 4537
4436 return cls._syncManager 4538 return cls._syncManager
4437 4539
4540 @pyqtSlot()
4438 def __showSyncDialog(self): 4541 def __showSyncDialog(self):
4439 """ 4542 """
4440 Private slot to show the synchronization dialog. 4543 Private slot to show the synchronization dialog.
4441 """ 4544 """
4442 self.syncManager().showSyncDialog() 4545 self.syncManager().showSyncDialog()
4550 4653
4551 ########################################################################### 4654 ###########################################################################
4552 ## Interface to VirusTotal below ## 4655 ## Interface to VirusTotal below ##
4553 ########################################################################### 4656 ###########################################################################
4554 4657
4658 @pyqtSlot()
4555 def __virusTotalScanCurrentSite(self): 4659 def __virusTotalScanCurrentSite(self):
4556 """ 4660 """
4557 Private slot to ask VirusTotal for a scan of the URL of the current 4661 Private slot to ask VirusTotal for a scan of the URL of the current
4558 browser. 4662 browser.
4559 """ 4663 """
4569 4673
4570 @param url URL to be scanned (QUrl) 4674 @param url URL to be scanned (QUrl)
4571 """ 4675 """
4572 self.__virusTotal.submitUrl(url) 4676 self.__virusTotal.submitUrl(url)
4573 4677
4678 @pyqtSlot(str)
4574 def __virusTotalSubmitUrlError(self, msg): 4679 def __virusTotalSubmitUrlError(self, msg):
4575 """ 4680 """
4576 Private slot to handle an URL scan submission error. 4681 Private slot to handle an URL scan submission error.
4577 4682
4578 @param msg error message (str) 4683 @param msg error message
4684 @type str
4579 """ 4685 """
4580 EricMessageBox.critical( 4686 EricMessageBox.critical(
4581 self, 4687 self,
4582 self.tr("VirusTotal Scan"), 4688 self.tr("VirusTotal Scan"),
4583 self.tr("""<p>The VirusTotal scan could not be""" 4689 self.tr("""<p>The VirusTotal scan could not be"""
4584 """ scheduled.<p>\n<p>Reason: {0}</p>""").format(msg)) 4690 """ scheduled.<p>\n<p>Reason: {0}</p>""").format(msg))
4585 4691
4692 @pyqtSlot(str)
4586 def __virusTotalUrlScanReport(self, url): 4693 def __virusTotalUrlScanReport(self, url):
4587 """ 4694 """
4588 Private slot to initiate the display of the URL scan report page. 4695 Private slot to initiate the display of the URL scan report page.
4589 4696
4590 @param url URL of the URL scan report page (string) 4697 @param url URL of the URL scan report page
4698 @type str
4591 """ 4699 """
4592 self.newTab(url) 4700 self.newTab(url)
4593 4701
4702 @pyqtSlot(str)
4594 def __virusTotalFileScanReport(self, url): 4703 def __virusTotalFileScanReport(self, url):
4595 """ 4704 """
4596 Private slot to initiate the display of the file scan report page. 4705 Private slot to initiate the display of the file scan report page.
4597 4706
4598 @param url URL of the file scan report page (string) 4707 @param url URL of the file scan report page
4708 @type str
4599 """ 4709 """
4600 self.newTab(url) 4710 self.newTab(url)
4601 4711
4712 @pyqtSlot()
4602 def __virusTotalIpAddressReport(self): 4713 def __virusTotalIpAddressReport(self):
4603 """ 4714 """
4604 Private slot to retrieve an IP address report. 4715 Private slot to retrieve an IP address report.
4605 """ 4716 """
4606 ip, ok = QInputDialog.getText( 4717 ip, ok = QInputDialog.getText(
4616 self, 4727 self,
4617 self.tr("IP Address Report"), 4728 self.tr("IP Address Report"),
4618 self.tr("""The given IP address is not in dotted quad""" 4729 self.tr("""The given IP address is not in dotted quad"""
4619 """ notation.""")) 4730 """ notation."""))
4620 4731
4732 @pyqtSlot()
4621 def __virusTotalDomainReport(self): 4733 def __virusTotalDomainReport(self):
4622 """ 4734 """
4623 Private slot to retrieve a domain report. 4735 Private slot to retrieve a domain report.
4624 """ 4736 """
4625 domain, ok = QInputDialog.getText( 4737 domain, ok = QInputDialog.getText(
4850 from .Session.SessionManager import SessionManager 4962 from .Session.SessionManager import SessionManager
4851 cls._sessionManager = SessionManager() 4963 cls._sessionManager = SessionManager()
4852 4964
4853 return cls._sessionManager 4965 return cls._sessionManager
4854 4966
4967 @pyqtSlot()
4855 def __showSessionManagerDialog(self): 4968 def __showSessionManagerDialog(self):
4856 """ 4969 """
4857 Private slot to show the session manager dialog. 4970 Private slot to show the session manager dialog.
4858 """ 4971 """
4859 self.sessionManager().showSessionManagerDialog() 4972 self.sessionManager().showSessionManagerDialog()
4874 from .SafeBrowsing.SafeBrowsingManager import SafeBrowsingManager 4987 from .SafeBrowsing.SafeBrowsingManager import SafeBrowsingManager
4875 cls._safeBrowsingManager = SafeBrowsingManager() 4988 cls._safeBrowsingManager = SafeBrowsingManager()
4876 4989
4877 return cls._safeBrowsingManager 4990 return cls._safeBrowsingManager
4878 4991
4992 @pyqtSlot()
4879 def __showSafeBrowsingDialog(self): 4993 def __showSafeBrowsingDialog(self):
4880 """ 4994 """
4881 Private slot to show the safe browsing management dialog. 4995 Private slot to show the safe browsing management dialog.
4882 """ 4996 """
4883 self.safeBrowsingManager().showSafeBrowsingDialog() 4997 self.safeBrowsingManager().showSafeBrowsingDialog()
4898 from .Network.ProtocolHandlerManager import ProtocolHandlerManager 5012 from .Network.ProtocolHandlerManager import ProtocolHandlerManager
4899 cls._protocolHandlerManager = ProtocolHandlerManager() 5013 cls._protocolHandlerManager = ProtocolHandlerManager()
4900 5014
4901 return cls._protocolHandlerManager 5015 return cls._protocolHandlerManager
4902 5016
5017 @pyqtSlot()
4903 def __showProtocolHandlerManagerDialog(self): 5018 def __showProtocolHandlerManagerDialog(self):
4904 """ 5019 """
4905 Private slot to show the protocol handler manager dialog. 5020 Private slot to show the protocol handler manager dialog.
4906 """ 5021 """
4907 self.protocolHandlerManager().showProtocolHandlerManagerDialog() 5022 self.protocolHandlerManager().showProtocolHandlerManagerDialog()
4947 5062
4948 @param word word to be searched for 5063 @param word word to be searched for
4949 @type str 5064 @type str
4950 """ 5065 """
4951 if WebBrowserWindow._useQtHelp: 5066 if WebBrowserWindow._useQtHelp:
4952 self.__searchWord = word 5067 self.__searchForWord(word)
4953 self.__searchForWord()
4954 5068
4955 self.raise_() 5069 self.raise_()
4956 self.activateWindow() 5070 self.activateWindow()
4957 5071
4958 ###################################################### 5072 ######################################################
4959 ## Methods below implement shortcuts related functions 5073 ## Methods below implement shortcuts related functions
4960 ###################################################### 5074 ######################################################
4961 5075
5076 @pyqtSlot()
4962 def __configShortcuts(self): 5077 def __configShortcuts(self):
4963 """ 5078 """
4964 Private slot to configure the keyboard shortcuts. 5079 Private slot to configure the keyboard shortcuts.
4965 """ 5080 """
4966 if self.__shortcutsDialog is None: 5081 if self.__shortcutsDialog is None:
4967 from Preferences.ShortcutsDialog import ShortcutsDialog 5082 from Preferences.ShortcutsDialog import ShortcutsDialog
4968 self.__shortcutsDialog = ShortcutsDialog(self) 5083 self.__shortcutsDialog = ShortcutsDialog(self)
4969 self.__shortcutsDialog.populate(helpViewer=self) 5084 self.__shortcutsDialog.populate(helpViewer=self)
4970 self.__shortcutsDialog.show() 5085 self.__shortcutsDialog.show()
4971 5086
5087 @pyqtSlot()
4972 def __exportShortcuts(self): 5088 def __exportShortcuts(self):
4973 """ 5089 """
4974 Private slot to export the keyboard shortcuts. 5090 Private slot to export the keyboard shortcuts.
4975 """ 5091 """
4976 fn, selectedFilter = EricFileDialog.getSaveFileNameAndFilter( 5092 fn, selectedFilter = EricFileDialog.getSaveFileNameAndFilter(
5001 ) 5117 )
5002 5118
5003 if ok: 5119 if ok:
5004 from Preferences import Shortcuts 5120 from Preferences import Shortcuts
5005 Shortcuts.exportShortcuts(fn, helpViewer=self) 5121 Shortcuts.exportShortcuts(fn, helpViewer=self)
5006 5122
5123 @pyqtSlot()
5007 def __importShortcuts(self): 5124 def __importShortcuts(self):
5008 """ 5125 """
5009 Private slot to import the keyboard shortcuts. 5126 Private slot to import the keyboard shortcuts.
5010 """ 5127 """
5011 fn = EricFileDialog.getOpenFileName( 5128 fn = EricFileDialog.getOpenFileName(

eric ide

mercurial