Continued porting the web browser. QtWebEngine

Thu, 03 Mar 2016 20:01:20 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Thu, 03 Mar 2016 20:01:20 +0100
branch
QtWebEngine
changeset 4798
ee1a24311b03
parent 4795
6e0a26c633b2
child 4801
71bdc520f640

Continued porting the web browser.

- started implementing the configuration pages

PluginManager/PluginManager.py file | annotate | diff | comparison | revisions
Preferences/ConfigurationDialog.py file | annotate | diff | comparison | revisions
WebBrowser/WebBrowserWindow.py file | annotate | diff | comparison | revisions
--- a/PluginManager/PluginManager.py	Thu Mar 03 19:34:04 2016 +0100
+++ b/PluginManager/PluginManager.py	Thu Mar 03 20:01:20 2016 +0100
@@ -144,7 +144,11 @@
             self.__networkManager.sslErrors.connect(self.__sslErrors)
         self.__replies = []
         
-        self.__ui.onlineStateChanged.connect(self.__onlineStateChanged)
+        try:
+            self.__ui.onlineStateChanged.connect(self.__onlineStateChanged)
+        except AttributeError:
+            # it was not called from eric
+            pass
     
     def finalizeSetup(self):
         """
--- a/Preferences/ConfigurationDialog.py	Thu Mar 03 19:34:04 2016 +0100
+++ b/Preferences/ConfigurationDialog.py	Thu Mar 03 20:01:20 2016 +0100
@@ -79,6 +79,7 @@
     HelpBrowserMode = 1
     TrayStarterMode = 2
     HexEditorMode = 3
+    WebBrowserMode = 4
     
     def __init__(self, parent=None, fromEric=True, displayMode=DefaultMode,
                  expandedEntries=[]):
@@ -89,7 +90,8 @@
         @keyparam fromEric flag indicating a dialog generation from within the
             eric6 ide (boolean)
         @keyparam displayMode mode of the configuration dialog
-            (DefaultMode, HelpBrowserMode, TrayStarterMode, HexEditorMode)
+            (DefaultMode, HelpBrowserMode, TrayStarterMode, HexEditorMode,
+             WebBrowserMode)
         @exception RuntimeError raised to indicate an invalid dialog mode
         @keyparam expandedEntries list of entries to be shown expanded
             (list of strings)
@@ -99,6 +101,7 @@
             ConfigurationWidget.HelpBrowserMode,
             ConfigurationWidget.TrayStarterMode,
             ConfigurationWidget.HexEditorMode,
+            ConfigurationWidget.WebBrowserMode,
         )
         
         super(ConfigurationWidget, self).__init__(parent)
@@ -118,6 +121,7 @@
                 e5App().registerObject("PluginManager", self.pluginManager)
         
         if displayMode == ConfigurationWidget.DefaultMode:
+            # TODO: add QtWebEngine based browser config pages to default mode
             self.configItems = {
                 # key : [display string, pixmap name, dialog module name or
                 #        page creation function, parent key,
@@ -387,6 +391,34 @@
             except ImportError:
                 pass
         
+        elif displayMode == ConfigurationWidget.WebBrowserMode:
+            # TODO: Check config pages for QWebKit and add QWebEngine
+            self.configItems = {
+                # key : [display string, pixmap name, dialog module name or
+                #        page creation function, parent key,
+                #        reference to configuration page (must always be last)]
+                # The dialog module must have the module function 'create' to
+                # create the configuration page. This must have the method
+                # 'save' to save the settings.
+                "networkPage":
+                [self.tr("Network"), "preferences-network.png",
+                 "NetworkPage", None, None],
+                "printerPage":
+                [self.tr("Printer"), "preferences-printer.png",
+                 "PrinterPage", None, None],
+                "securityPage":
+                [self.tr("Security"), "preferences-security.png",
+                 "SecurityPage", None, None],
+                
+                "helpFlashCookieManagerPage":
+                [self.tr("Flash Cookie Manager"),
+                 "flashCookie16.png",
+                 "HelpFlashCookieManagerPage", None, None],
+                "helpVirusTotalPage":
+                [self.tr("VirusTotal Interface"), "virustotal.png",
+                 "HelpVirusTotalPage", None, None],
+            }
+        
         elif displayMode == ConfigurationWidget.TrayStarterMode:
             self.configItems = {
                 # key : [display string, pixmap name, dialog module name or
@@ -446,7 +478,8 @@
         
         if displayMode in [ConfigurationWidget.HelpBrowserMode,
                            ConfigurationWidget.TrayStarterMode,
-                           ConfigurationWidget.HexEditorMode]:
+                           ConfigurationWidget.HexEditorMode,
+                           ConfigurationWidget.WebBrowserMode]:
             self.configListSearch.hide()
         
         if displayMode not in [ConfigurationWidget.TrayStarterMode,
@@ -854,6 +887,7 @@
     HelpBrowserMode = ConfigurationWidget.HelpBrowserMode
     TrayStarterMode = ConfigurationWidget.TrayStarterMode
     HexEditorMode = ConfigurationWidget.HexEditorMode
+    WebBrowserMode = ConfigurationWidget.WebBrowserMode
     
     def __init__(self, parent=None, name=None, modal=False,
                  fromEric=True, displayMode=ConfigurationWidget.DefaultMode,
@@ -867,7 +901,8 @@
         @keyparam fromEric flag indicating a dialog generation from within the
             eric6 ide (boolean)
         @keyparam displayMode mode of the configuration dialog
-            (DefaultMode, HelpBrowserMode, TrayStarterMode, HexEditorMode)
+            (DefaultMode, HelpBrowserMode, TrayStarterMode, HexEditorMode,
+             WebBrowserMode)
         @keyparam expandedEntries list of entries to be shown expanded
             (list of strings)
         """
--- a/WebBrowser/WebBrowserWindow.py	Thu Mar 03 19:34:04 2016 +0100
+++ b/WebBrowser/WebBrowserWindow.py	Thu Mar 03 20:01:20 2016 +0100
@@ -1733,7 +1733,7 @@
         self.forwardAct.setEnabled(False)
         
         # now read the keyboard shortcuts for the actions
-        # TODO: change this to webBrowser
+        # TODO: shortcuts: change this to webBrowser
         Shortcuts.readShortcuts(helpViewer=self)
     
     def getActions(self):
@@ -2733,30 +2733,28 @@
                 # set value of zoom widget
                 self.__zoomWidget.setValue(cb.zoomValue())
     
-    # TODO: Preferences dialog
     def __showPreferences(self):
         """
         Private slot to set the preferences.
         """
-        # TODO: Preferences
-##        from Preferences.ConfigurationDialog import ConfigurationDialog
-##        dlg = ConfigurationDialog(
-##            self, 'Configuration', True, fromEric=self.__fromEric,
-##            displayMode=ConfigurationDialog.WebBrowserMode)
-##        dlg.preferencesChanged.connect(self.preferencesChanged)
-##        dlg.masterPasswordChanged.connect(self.masterPasswordChanged)
-##        dlg.show()
-##        if self.__lastConfigurationPageName:
-##            dlg.showConfigurationPageByName(self.__lastConfigurationPageName)
-##        else:
-##            dlg.showConfigurationPageByName("empty")
-##        dlg.exec_()
-##        QApplication.processEvents()
-##        if dlg.result() == QDialog.Accepted:
-##            dlg.setPreferences()
-##            Preferences.syncPreferences()
-##            self.preferencesChanged()
-##        self.__lastConfigurationPageName = dlg.getConfigurationPageName()
+        from Preferences.ConfigurationDialog import ConfigurationDialog
+        dlg = ConfigurationDialog(
+            self, 'Configuration', True, fromEric=self.__fromEric,
+            displayMode=ConfigurationDialog.WebBrowserMode)
+        dlg.preferencesChanged.connect(self.preferencesChanged)
+        dlg.masterPasswordChanged.connect(self.masterPasswordChanged)
+        dlg.show()
+        if self.__lastConfigurationPageName:
+            dlg.showConfigurationPageByName(self.__lastConfigurationPageName)
+        else:
+            dlg.showConfigurationPageByName("empty")
+        dlg.exec_()
+        QApplication.processEvents()
+        if dlg.result() == QDialog.Accepted:
+            dlg.setPreferences()
+            Preferences.syncPreferences()
+            self.preferencesChanged()
+        self.__lastConfigurationPageName = dlg.getConfigurationPageName()
     
     def preferencesChanged(self):
         """

eric ide

mercurial