13 QThread, QTextCodec |
13 QThread, QTextCodec |
14 from PyQt4.QtGui import QMainWindow, QWidget, QVBoxLayout, QSizePolicy, QDockWidget, \ |
14 from PyQt4.QtGui import QMainWindow, QWidget, QVBoxLayout, QSizePolicy, QDockWidget, \ |
15 QDesktopServices, QKeySequence, QComboBox, QFont, QFontMetrics, QLabel, \ |
15 QDesktopServices, QKeySequence, QComboBox, QFont, QFontMetrics, QLabel, \ |
16 QSplitter, QMenu, QToolButton, QLineEdit, QApplication, QWhatsThis, QDialog, \ |
16 QSplitter, QMenu, QToolButton, QLineEdit, QApplication, QWhatsThis, QDialog, \ |
17 QHBoxLayout, QProgressBar, QAction, QIcon |
17 QHBoxLayout, QProgressBar, QAction, QIcon |
|
18 from PyQt4.QtNetwork import QNetworkAccessManager, QNetworkRequest |
18 from PyQt4.QtWebKit import QWebSettings, QWebDatabase, QWebSecurityOrigin, QWebPage |
19 from PyQt4.QtWebKit import QWebSettings, QWebDatabase, QWebSecurityOrigin, QWebPage |
19 from PyQt4.QtHelp import QHelpEngine, QHelpEngineCore, QHelpSearchQuery |
20 from PyQt4.QtHelp import QHelpEngine, QHelpEngineCore, QHelpSearchQuery |
20 |
21 |
21 from .SearchWidget import SearchWidget |
22 from .SearchWidget import SearchWidget |
22 from .HelpTocWidget import HelpTocWidget |
23 from .HelpTocWidget import HelpTocWidget |
53 from .SiteInfo.SiteInfoDialog import SiteInfoDialog |
54 from .SiteInfo.SiteInfoDialog import SiteInfoDialog |
54 from .Sync.SyncManager import SyncManager |
55 from .Sync.SyncManager import SyncManager |
55 from .SpeedDial.SpeedDial import SpeedDial |
56 from .SpeedDial.SpeedDial import SpeedDial |
56 from .PersonalInformationManager.PersonalInformationManager import \ |
57 from .PersonalInformationManager.PersonalInformationManager import \ |
57 PersonalInformationManager |
58 PersonalInformationManager |
|
59 from .GreaseMonkey.GreaseMonkeyManager import GreaseMonkeyManager |
58 |
60 |
59 from .data import icons_rc # __IGNORE_WARNING__ |
61 from .data import icons_rc # __IGNORE_WARNING__ |
60 from .data import html_rc # __IGNORE_WARNING__ |
62 from .data import html_rc # __IGNORE_WARNING__ |
61 from .data import javascript_rc # __IGNORE_WARNING__ |
63 from .data import javascript_rc # __IGNORE_WARNING__ |
62 |
64 |
103 _feedsManager = None |
105 _feedsManager = None |
104 _userAgentsManager = None |
106 _userAgentsManager = None |
105 _syncManager = None |
107 _syncManager = None |
106 _speedDial = None |
108 _speedDial = None |
107 _personalInformationManager = None |
109 _personalInformationManager = None |
|
110 _greaseMonkeyManager = None |
108 |
111 |
109 def __init__(self, home, path, parent, name, fromEric=False, |
112 def __init__(self, home, path, parent, name, fromEric=False, |
110 initShortcutsOnly=False, searchWord=None): |
113 initShortcutsOnly=False, searchWord=None): |
111 """ |
114 """ |
112 Constructor |
115 Constructor |
997 if not self.initShortcutsOnly: |
1000 if not self.initShortcutsOnly: |
998 self.personalDataAct.triggered[()].connect( |
1001 self.personalDataAct.triggered[()].connect( |
999 self.__showPersonalInformationDialog) |
1002 self.__showPersonalInformationDialog) |
1000 self.__actions.append(self.personalDataAct) |
1003 self.__actions.append(self.personalDataAct) |
1001 |
1004 |
|
1005 self.greaseMonkeyAct = E5Action(self.trUtf8('GreaseMonkey Scripts'), |
|
1006 UI.PixmapCache.getIcon("greaseMonkey.png"), |
|
1007 self.trUtf8('GreaseMonkey Scripts...'), |
|
1008 0, 0, |
|
1009 self, 'help_greasemonkey') |
|
1010 self.greaseMonkeyAct.setStatusTip(self.trUtf8( |
|
1011 'Configure the GreaseMonkey Scripts')) |
|
1012 self.greaseMonkeyAct.setWhatsThis(self.trUtf8( |
|
1013 """<b>GreaseMonkey Scripts...</b>""" |
|
1014 """<p>Opens a dialog to configure the available GreaseMonkey Scripts.</p>""" |
|
1015 )) |
|
1016 if not self.initShortcutsOnly: |
|
1017 self.greaseMonkeyAct.triggered[()].connect( |
|
1018 self.__showGreaseMonkeyConfigDialog) |
|
1019 self.__actions.append(self.greaseMonkeyAct) |
|
1020 |
1002 self.syncTocAct = E5Action(self.trUtf8('Sync with Table of Contents'), |
1021 self.syncTocAct = E5Action(self.trUtf8('Sync with Table of Contents'), |
1003 UI.PixmapCache.getIcon("syncToc.png"), |
1022 UI.PixmapCache.getIcon("syncToc.png"), |
1004 self.trUtf8('Sync with Table of Contents'), |
1023 self.trUtf8('Sync with Table of Contents'), |
1005 0, 0, self, 'help_sync_toc') |
1024 0, 0, self, 'help_sync_toc') |
1006 self.syncTocAct.setStatusTip(self.trUtf8( |
1025 self.syncTocAct.setStatusTip(self.trUtf8( |
1386 menu.addAction(self.prefAct) |
1405 menu.addAction(self.prefAct) |
1387 menu.addAction(self.acceptedLanguagesAct) |
1406 menu.addAction(self.acceptedLanguagesAct) |
1388 menu.addAction(self.cookiesAct) |
1407 menu.addAction(self.cookiesAct) |
1389 menu.addAction(self.offlineStorageAct) |
1408 menu.addAction(self.offlineStorageAct) |
1390 menu.addAction(self.personalDataAct) |
1409 menu.addAction(self.personalDataAct) |
|
1410 menu.addAction(self.greaseMonkeyAct) |
1391 menu.addSeparator() |
1411 menu.addSeparator() |
1392 menu.addAction(self.searchEnginesAct) |
1412 menu.addAction(self.searchEnginesAct) |
1393 menu.addSeparator() |
1413 menu.addSeparator() |
1394 menu.addAction(self.passwordsAct) |
1414 menu.addAction(self.passwordsAct) |
1395 if SSL_AVAILABLE: |
1415 if SSL_AVAILABLE: |
1495 settingstb.addAction(self.prefAct) |
1515 settingstb.addAction(self.prefAct) |
1496 settingstb.addAction(self.acceptedLanguagesAct) |
1516 settingstb.addAction(self.acceptedLanguagesAct) |
1497 settingstb.addAction(self.cookiesAct) |
1517 settingstb.addAction(self.cookiesAct) |
1498 settingstb.addAction(self.offlineStorageAct) |
1518 settingstb.addAction(self.offlineStorageAct) |
1499 settingstb.addAction(self.personalDataAct) |
1519 settingstb.addAction(self.personalDataAct) |
|
1520 settingstb.addAction(self.greaseMonkeyAct) |
1500 |
1521 |
1501 toolstb = self.addToolBar(self.trUtf8("Tools")) |
1522 toolstb = self.addToolBar(self.trUtf8("Tools")) |
1502 toolstb.setObjectName("ToolsToolBar") |
1523 toolstb.setObjectName("ToolsToolBar") |
1503 toolstb.setIconSize(UI.Config.ToolBarIconSize) |
1524 toolstb.setIconSize(UI.Config.ToolBarIconSize) |
1504 toolstb.addAction(self.feedsManagerAct) |
1525 toolstb.addAction(self.feedsManagerAct) |
2262 """ |
2283 """ |
2263 Private slot to handle the selection of a link in the TOC window. |
2284 Private slot to handle the selection of a link in the TOC window. |
2264 |
2285 |
2265 @param url URL to be shown (QUrl) |
2286 @param url URL to be shown (QUrl) |
2266 """ |
2287 """ |
2267 self.currentBrowser().setSource(url) |
2288 req = QNetworkRequest(url) |
|
2289 req.setRawHeader("X-Eric5-UserLoadAction", b"1") |
|
2290 self.currentBrowser().setSource( |
|
2291 None, (req, QNetworkAccessManager.GetOperation, b"")) |
2268 |
2292 |
2269 def __linksActivated(self, links, keyword): |
2293 def __linksActivated(self, links, keyword): |
2270 """ |
2294 """ |
2271 Private slot to select a topic to be shown. |
2295 Private slot to select a topic to be shown. |
2272 |
2296 |
2654 """ |
2678 """ |
2655 Private slot to show the Personal Information configuration dialog. |
2679 Private slot to show the Personal Information configuration dialog. |
2656 """ |
2680 """ |
2657 self.personalInformationManager().showConfigurationDialog() |
2681 self.personalInformationManager().showConfigurationDialog() |
2658 |
2682 |
|
2683 def __showGreaseMonkeyConfigDialog(self): |
|
2684 """ |
|
2685 Private slot to show the GreaseMonkey scripts configuration dialog. |
|
2686 """ |
|
2687 self.greaseMonkeyManager().showConfigurationDialog() |
|
2688 |
2659 def __showNetworkMonitor(self): |
2689 def __showNetworkMonitor(self): |
2660 """ |
2690 """ |
2661 Private slot to show the network monitor dialog. |
2691 Private slot to show the network monitor dialog. |
2662 """ |
2692 """ |
2663 monitor = E5NetworkMonitor.instance(self.networkAccessManager()) |
2693 monitor = E5NetworkMonitor.instance(self.networkAccessManager()) |
2765 in a new tab. |
2795 in a new tab. |
2766 |
2796 |
2767 @param url url to be opened (QUrl) |
2797 @param url url to be opened (QUrl) |
2768 @param title title of the bookmark (string) |
2798 @param title title of the bookmark (string) |
2769 """ |
2799 """ |
2770 self.newTab(url) |
2800 req = QNetworkRequest(url) |
|
2801 req.setRawHeader("X-Eric5-UserLoadAction", b"1") |
|
2802 self.newTab(None, (req, QNetworkAccessManager.GetOperation, b"")) |
2771 |
2803 |
2772 @classmethod |
2804 @classmethod |
2773 def historyManager(cls): |
2805 def historyManager(cls): |
2774 """ |
2806 """ |
2775 Class method to get a reference to the history manager. |
2807 Class method to get a reference to the history manager. |
2826 """ |
2858 """ |
2827 if cls._personalInformationManager is None: |
2859 if cls._personalInformationManager is None: |
2828 cls._personalInformationManager = PersonalInformationManager() |
2860 cls._personalInformationManager = PersonalInformationManager() |
2829 |
2861 |
2830 return cls._personalInformationManager |
2862 return cls._personalInformationManager |
|
2863 |
|
2864 @classmethod |
|
2865 def greaseMonkeyManager(cls): |
|
2866 """ |
|
2867 Class method to get a reference to the GreaseMonkey manager. |
|
2868 |
|
2869 @return reference to the GreaseMonkey manager (GreaseMonkeyManager) |
|
2870 """ |
|
2871 if cls._greaseMonkeyManager is None: |
|
2872 cls._greaseMonkeyManager = GreaseMonkeyManager() |
|
2873 |
|
2874 return cls._greaseMonkeyManager |
2831 |
2875 |
2832 @classmethod |
2876 @classmethod |
2833 def mainWindow(cls): |
2877 def mainWindow(cls): |
2834 """ |
2878 """ |
2835 Class method to get a reference to the main window. |
2879 Class method to get a reference to the main window. |