eric6/WebBrowser/FeaturePermissions/FeaturePermissionsDialog.py

Thu, 29 Aug 2019 19:02:14 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Thu, 29 Aug 2019 19:02:14 +0200
changeset 7179
912bc70b5b01
parent 6942
2602857055c5
child 7229
53054eb5b15a
permissions
-rw-r--r--

WebBrowser: added support for the QWebEnginePage.Notifications as Qt 5.13.0.

4356
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
6645
ad476851d7e0 Updated copyright for 2019.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6084
diff changeset
3 # Copyright (c) 2015 - 2019 Detlev Offenbach <detlev@die-offenbachs.de>
4356
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing the feature permission dialog.
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10 from __future__ import unicode_literals
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12 from PyQt5.QtCore import pyqtSlot, Qt
4742
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
13 from PyQt5.QtWidgets import QDialog, QTreeWidgetItem, QTreeWidget, \
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
14 QAbstractItemView
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
15 from PyQt5.QtWebEngineWidgets import QWebEnginePage
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
16
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
17 import UI.PixmapCache
4356
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 from .Ui_FeaturePermissionsDialog import Ui_FeaturePermissionsDialog
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 class FeaturePermissionsDialog(QDialog, Ui_FeaturePermissionsDialog):
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 """
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 Class implementing the feature permission dialog.
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 """
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 def __init__(self, featurePermissions, parent=None):
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 """
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 Constructor
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 @param featurePermissions dictionary with remembered feature
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 permissions
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 @type dict of dict of list
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 @param parent reference to the parent widget
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 @type QWidget
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 """
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 super(FeaturePermissionsDialog, self).__init__(parent)
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 self.setupUi(self)
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38
4742
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
39 # add the various lists
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
40
7179
912bc70b5b01 WebBrowser: added support for the QWebEnginePage.Notifications as Qt 5.13.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
41 if hasattr(QWebEnginePage, "Notifications"):
912bc70b5b01 WebBrowser: added support for the QWebEnginePage.Notifications as Qt 5.13.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
42 # this was re-added in Qt 5.13.0
912bc70b5b01 WebBrowser: added support for the QWebEnginePage.Notifications as Qt 5.13.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
43 self.notifList = QTreeWidget()
912bc70b5b01 WebBrowser: added support for the QWebEnginePage.Notifications as Qt 5.13.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
44 self.notifList.setAlternatingRowColors(True)
912bc70b5b01 WebBrowser: added support for the QWebEnginePage.Notifications as Qt 5.13.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
45 self.notifList.setSelectionMode(
912bc70b5b01 WebBrowser: added support for the QWebEnginePage.Notifications as Qt 5.13.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
46 QAbstractItemView.ExtendedSelection)
912bc70b5b01 WebBrowser: added support for the QWebEnginePage.Notifications as Qt 5.13.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
47 self.notifList.setRootIsDecorated(False)
912bc70b5b01 WebBrowser: added support for the QWebEnginePage.Notifications as Qt 5.13.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
48 self.notifList.setItemsExpandable(False)
912bc70b5b01 WebBrowser: added support for the QWebEnginePage.Notifications as Qt 5.13.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
49 self.notifList.setAllColumnsShowFocus(True)
912bc70b5b01 WebBrowser: added support for the QWebEnginePage.Notifications as Qt 5.13.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
50 self.notifList.setObjectName("notifList")
912bc70b5b01 WebBrowser: added support for the QWebEnginePage.Notifications as Qt 5.13.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
51 self.notifList.setSortingEnabled(True)
912bc70b5b01 WebBrowser: added support for the QWebEnginePage.Notifications as Qt 5.13.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
52 self.notifList.headerItem().setText(0, self.tr("Host"))
912bc70b5b01 WebBrowser: added support for the QWebEnginePage.Notifications as Qt 5.13.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
53 self.notifList.headerItem().setText(1, self.tr("Permission"))
912bc70b5b01 WebBrowser: added support for the QWebEnginePage.Notifications as Qt 5.13.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
54 self.tabWidget.addTab(
912bc70b5b01 WebBrowser: added support for the QWebEnginePage.Notifications as Qt 5.13.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
55 self.notifList,
912bc70b5b01 WebBrowser: added support for the QWebEnginePage.Notifications as Qt 5.13.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
56 UI.PixmapCache.getIcon("notification.png"),
912bc70b5b01 WebBrowser: added support for the QWebEnginePage.Notifications as Qt 5.13.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
57 self.tr("Notifications"))
912bc70b5b01 WebBrowser: added support for the QWebEnginePage.Notifications as Qt 5.13.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
58
4742
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
59 self.geoList = QTreeWidget()
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
60 self.geoList.setAlternatingRowColors(True)
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
61 self.geoList.setSelectionMode(QAbstractItemView.ExtendedSelection)
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
62 self.geoList.setRootIsDecorated(False)
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
63 self.geoList.setItemsExpandable(False)
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
64 self.geoList.setAllColumnsShowFocus(True)
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
65 self.geoList.setObjectName("geoList")
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
66 self.geoList.setSortingEnabled(True)
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
67 self.geoList.headerItem().setText(0, self.tr("Host"))
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
68 self.geoList.headerItem().setText(1, self.tr("Permission"))
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
69 self.tabWidget.addTab(
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
70 self.geoList,
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
71 UI.PixmapCache.getIcon("geolocation.png"),
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
72 self.tr("Geolocation"))
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
73
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
74 self.micList = QTreeWidget()
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
75 self.micList.setAlternatingRowColors(True)
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
76 self.micList.setSelectionMode(QAbstractItemView.ExtendedSelection)
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
77 self.micList.setRootIsDecorated(False)
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
78 self.micList.setItemsExpandable(False)
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
79 self.micList.setAllColumnsShowFocus(True)
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
80 self.micList.setObjectName("micList")
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
81 self.micList.setSortingEnabled(True)
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
82 self.micList.headerItem().setText(0, self.tr("Host"))
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
83 self.micList.headerItem().setText(1, self.tr("Permission"))
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
84 self.tabWidget.addTab(
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
85 self.micList,
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
86 UI.PixmapCache.getIcon("audiocapture.png"),
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
87 self.tr("Microphone"))
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
88
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
89 self.camList = QTreeWidget()
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
90 self.camList.setAlternatingRowColors(True)
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
91 self.camList.setSelectionMode(QAbstractItemView.ExtendedSelection)
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
92 self.camList.setRootIsDecorated(False)
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
93 self.camList.setItemsExpandable(False)
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
94 self.camList.setAllColumnsShowFocus(True)
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
95 self.camList.setObjectName("camList")
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
96 self.camList.setSortingEnabled(True)
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
97 self.camList.headerItem().setText(0, self.tr("Host"))
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
98 self.camList.headerItem().setText(1, self.tr("Permission"))
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
99 self.tabWidget.addTab(
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
100 self.camList,
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
101 UI.PixmapCache.getIcon("camera.png"),
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
102 self.tr("Camera"))
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
103
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
104 self.micCamList = QTreeWidget()
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
105 self.micCamList.setAlternatingRowColors(True)
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
106 self.micCamList.setSelectionMode(QAbstractItemView.ExtendedSelection)
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
107 self.micCamList.setRootIsDecorated(False)
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
108 self.micCamList.setItemsExpandable(False)
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
109 self.micCamList.setAllColumnsShowFocus(True)
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
110 self.micCamList.setObjectName("micCamList")
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
111 self.micCamList.setSortingEnabled(True)
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
112 self.micCamList.headerItem().setText(0, self.tr("Host"))
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
113 self.micCamList.headerItem().setText(1, self.tr("Permission"))
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
114 self.tabWidget.addTab(
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
115 self.micCamList,
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
116 UI.PixmapCache.getIcon("audio-video.png"),
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
117 self.tr("Microphone && Camera"))
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
118
4904
ea8f13f76d26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4742
diff changeset
119 self.mouseLockList = QTreeWidget()
ea8f13f76d26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4742
diff changeset
120 self.mouseLockList.setAlternatingRowColors(True)
4917
682750cc7bd5 Corrected some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4904
diff changeset
121 self.mouseLockList.setSelectionMode(
682750cc7bd5 Corrected some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4904
diff changeset
122 QAbstractItemView.ExtendedSelection)
4904
ea8f13f76d26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4742
diff changeset
123 self.mouseLockList.setRootIsDecorated(False)
ea8f13f76d26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4742
diff changeset
124 self.mouseLockList.setItemsExpandable(False)
ea8f13f76d26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4742
diff changeset
125 self.mouseLockList.setAllColumnsShowFocus(True)
ea8f13f76d26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4742
diff changeset
126 self.mouseLockList.setObjectName("mouseLockList")
ea8f13f76d26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4742
diff changeset
127 self.mouseLockList.setSortingEnabled(True)
ea8f13f76d26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4742
diff changeset
128 self.mouseLockList.headerItem().setText(0, self.tr("Host"))
ea8f13f76d26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4742
diff changeset
129 self.mouseLockList.headerItem().setText(1, self.tr("Permission"))
ea8f13f76d26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4742
diff changeset
130 self.tabWidget.addTab(
ea8f13f76d26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4742
diff changeset
131 self.mouseLockList,
ea8f13f76d26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4742
diff changeset
132 UI.PixmapCache.getIcon("mouse.png"),
ea8f13f76d26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4742
diff changeset
133 self.tr("Mouse Lock"))
ea8f13f76d26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4742
diff changeset
134
6084
c6f3f66bf7aa Added support for HTML5 "Desktop Video Capture" and "Desktop Audio and Video Capture" as of Qt 5.10.0/PyQt 5.10.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
135 if hasattr(QWebEnginePage, "DesktopVideoCapture"):
c6f3f66bf7aa Added support for HTML5 "Desktop Video Capture" and "Desktop Audio and Video Capture" as of Qt 5.10.0/PyQt 5.10.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
136 # these are shown as of Qt 5.10.0/PyQt 5.10.0
c6f3f66bf7aa Added support for HTML5 "Desktop Video Capture" and "Desktop Audio and Video Capture" as of Qt 5.10.0/PyQt 5.10.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
137 self.deskVidList = QTreeWidget()
c6f3f66bf7aa Added support for HTML5 "Desktop Video Capture" and "Desktop Audio and Video Capture" as of Qt 5.10.0/PyQt 5.10.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
138 self.deskVidList.setAlternatingRowColors(True)
c6f3f66bf7aa Added support for HTML5 "Desktop Video Capture" and "Desktop Audio and Video Capture" as of Qt 5.10.0/PyQt 5.10.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
139 self.deskVidList.setSelectionMode(
c6f3f66bf7aa Added support for HTML5 "Desktop Video Capture" and "Desktop Audio and Video Capture" as of Qt 5.10.0/PyQt 5.10.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
140 QAbstractItemView.ExtendedSelection)
c6f3f66bf7aa Added support for HTML5 "Desktop Video Capture" and "Desktop Audio and Video Capture" as of Qt 5.10.0/PyQt 5.10.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
141 self.deskVidList.setRootIsDecorated(False)
c6f3f66bf7aa Added support for HTML5 "Desktop Video Capture" and "Desktop Audio and Video Capture" as of Qt 5.10.0/PyQt 5.10.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
142 self.deskVidList.setItemsExpandable(False)
c6f3f66bf7aa Added support for HTML5 "Desktop Video Capture" and "Desktop Audio and Video Capture" as of Qt 5.10.0/PyQt 5.10.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
143 self.deskVidList.setAllColumnsShowFocus(True)
c6f3f66bf7aa Added support for HTML5 "Desktop Video Capture" and "Desktop Audio and Video Capture" as of Qt 5.10.0/PyQt 5.10.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
144 self.deskVidList.setObjectName("deskVidList")
c6f3f66bf7aa Added support for HTML5 "Desktop Video Capture" and "Desktop Audio and Video Capture" as of Qt 5.10.0/PyQt 5.10.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
145 self.deskVidList.setSortingEnabled(True)
c6f3f66bf7aa Added support for HTML5 "Desktop Video Capture" and "Desktop Audio and Video Capture" as of Qt 5.10.0/PyQt 5.10.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
146 self.deskVidList.headerItem().setText(0, self.tr("Host"))
c6f3f66bf7aa Added support for HTML5 "Desktop Video Capture" and "Desktop Audio and Video Capture" as of Qt 5.10.0/PyQt 5.10.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
147 self.deskVidList.headerItem().setText(1, self.tr("Permission"))
c6f3f66bf7aa Added support for HTML5 "Desktop Video Capture" and "Desktop Audio and Video Capture" as of Qt 5.10.0/PyQt 5.10.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
148 self.tabWidget.addTab(
c6f3f66bf7aa Added support for HTML5 "Desktop Video Capture" and "Desktop Audio and Video Capture" as of Qt 5.10.0/PyQt 5.10.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
149 self.deskVidList,
c6f3f66bf7aa Added support for HTML5 "Desktop Video Capture" and "Desktop Audio and Video Capture" as of Qt 5.10.0/PyQt 5.10.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
150 UI.PixmapCache.getIcon("desktopVideoCapture.png"),
c6f3f66bf7aa Added support for HTML5 "Desktop Video Capture" and "Desktop Audio and Video Capture" as of Qt 5.10.0/PyQt 5.10.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
151 self.tr("Desktop Video"))
c6f3f66bf7aa Added support for HTML5 "Desktop Video Capture" and "Desktop Audio and Video Capture" as of Qt 5.10.0/PyQt 5.10.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
152
c6f3f66bf7aa Added support for HTML5 "Desktop Video Capture" and "Desktop Audio and Video Capture" as of Qt 5.10.0/PyQt 5.10.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
153 self.deskAudVidList = QTreeWidget()
c6f3f66bf7aa Added support for HTML5 "Desktop Video Capture" and "Desktop Audio and Video Capture" as of Qt 5.10.0/PyQt 5.10.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
154 self.deskAudVidList.setAlternatingRowColors(True)
c6f3f66bf7aa Added support for HTML5 "Desktop Video Capture" and "Desktop Audio and Video Capture" as of Qt 5.10.0/PyQt 5.10.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
155 self.deskAudVidList.setSelectionMode(
c6f3f66bf7aa Added support for HTML5 "Desktop Video Capture" and "Desktop Audio and Video Capture" as of Qt 5.10.0/PyQt 5.10.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
156 QAbstractItemView.ExtendedSelection)
c6f3f66bf7aa Added support for HTML5 "Desktop Video Capture" and "Desktop Audio and Video Capture" as of Qt 5.10.0/PyQt 5.10.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
157 self.deskAudVidList.setRootIsDecorated(False)
c6f3f66bf7aa Added support for HTML5 "Desktop Video Capture" and "Desktop Audio and Video Capture" as of Qt 5.10.0/PyQt 5.10.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
158 self.deskAudVidList.setItemsExpandable(False)
c6f3f66bf7aa Added support for HTML5 "Desktop Video Capture" and "Desktop Audio and Video Capture" as of Qt 5.10.0/PyQt 5.10.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
159 self.deskAudVidList.setAllColumnsShowFocus(True)
c6f3f66bf7aa Added support for HTML5 "Desktop Video Capture" and "Desktop Audio and Video Capture" as of Qt 5.10.0/PyQt 5.10.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
160 self.deskAudVidList.setObjectName("deskAudVidList")
c6f3f66bf7aa Added support for HTML5 "Desktop Video Capture" and "Desktop Audio and Video Capture" as of Qt 5.10.0/PyQt 5.10.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
161 self.deskAudVidList.setSortingEnabled(True)
c6f3f66bf7aa Added support for HTML5 "Desktop Video Capture" and "Desktop Audio and Video Capture" as of Qt 5.10.0/PyQt 5.10.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
162 self.deskAudVidList.headerItem().setText(0, self.tr("Host"))
c6f3f66bf7aa Added support for HTML5 "Desktop Video Capture" and "Desktop Audio and Video Capture" as of Qt 5.10.0/PyQt 5.10.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
163 self.deskAudVidList.headerItem().setText(1, self.tr("Permission"))
c6f3f66bf7aa Added support for HTML5 "Desktop Video Capture" and "Desktop Audio and Video Capture" as of Qt 5.10.0/PyQt 5.10.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
164 self.tabWidget.addTab(
c6f3f66bf7aa Added support for HTML5 "Desktop Video Capture" and "Desktop Audio and Video Capture" as of Qt 5.10.0/PyQt 5.10.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
165 self.deskAudVidList,
c6f3f66bf7aa Added support for HTML5 "Desktop Video Capture" and "Desktop Audio and Video Capture" as of Qt 5.10.0/PyQt 5.10.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
166 UI.PixmapCache.getIcon("desktopAudioVideoCapture.png"),
c6f3f66bf7aa Added support for HTML5 "Desktop Video Capture" and "Desktop Audio and Video Capture" as of Qt 5.10.0/PyQt 5.10.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
167 self.tr("Desktop Audio && Video"))
c6f3f66bf7aa Added support for HTML5 "Desktop Video Capture" and "Desktop Audio and Video Capture" as of Qt 5.10.0/PyQt 5.10.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
168
7179
912bc70b5b01 WebBrowser: added support for the QWebEnginePage.Notifications as Qt 5.13.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
169 if hasattr(QWebEnginePage, "Notifications"):
912bc70b5b01 WebBrowser: added support for the QWebEnginePage.Notifications as Qt 5.13.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
170 self.setTabOrder(self.tabWidget, self.notifList)
912bc70b5b01 WebBrowser: added support for the QWebEnginePage.Notifications as Qt 5.13.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
171 self.setTabOrder(self.notifList, self.geoList)
912bc70b5b01 WebBrowser: added support for the QWebEnginePage.Notifications as Qt 5.13.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
172 else:
912bc70b5b01 WebBrowser: added support for the QWebEnginePage.Notifications as Qt 5.13.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
173 self.setTabOrder(self.tabWidget, self.geoList)
4742
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
174 self.setTabOrder(self.geoList, self.micList)
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
175 self.setTabOrder(self.micList, self.camList)
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
176 self.setTabOrder(self.camList, self.micCamList)
4904
ea8f13f76d26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4742
diff changeset
177 self.setTabOrder(self.micCamList, self.mouseLockList)
6084
c6f3f66bf7aa Added support for HTML5 "Desktop Video Capture" and "Desktop Audio and Video Capture" as of Qt 5.10.0/PyQt 5.10.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
178 if hasattr(QWebEnginePage, "DesktopVideoCapture"):
c6f3f66bf7aa Added support for HTML5 "Desktop Video Capture" and "Desktop Audio and Video Capture" as of Qt 5.10.0/PyQt 5.10.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
179 self.setTabOrder(self.mouseLockList, self.deskVidList)
c6f3f66bf7aa Added support for HTML5 "Desktop Video Capture" and "Desktop Audio and Video Capture" as of Qt 5.10.0/PyQt 5.10.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
180 self.setTabOrder(self.deskVidList, self.deskAudVidList)
c6f3f66bf7aa Added support for HTML5 "Desktop Video Capture" and "Desktop Audio and Video Capture" as of Qt 5.10.0/PyQt 5.10.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
181 self.setTabOrder(self.deskAudVidList, self.removeButton)
c6f3f66bf7aa Added support for HTML5 "Desktop Video Capture" and "Desktop Audio and Video Capture" as of Qt 5.10.0/PyQt 5.10.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
182 else:
c6f3f66bf7aa Added support for HTML5 "Desktop Video Capture" and "Desktop Audio and Video Capture" as of Qt 5.10.0/PyQt 5.10.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
183 self.setTabOrder(self.mouseLockList, self.removeButton)
4742
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
184 self.setTabOrder(self.removeButton, self.removeAllButton)
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
185
4356
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
186 self.__permissionStrings = {
4742
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
187 QWebEnginePage.PermissionGrantedByUser: self.tr("Allow"),
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
188 QWebEnginePage.PermissionDeniedByUser: self.tr("Deny"),
4356
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
189 }
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
190
4742
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
191 self.__permissionsLists = {
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
192 QWebEnginePage.Geolocation: self.geoList,
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
193 QWebEnginePage.MediaAudioCapture: self.micList,
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
194 QWebEnginePage.MediaVideoCapture: self.camList,
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
195 QWebEnginePage.MediaAudioVideoCapture: self.micCamList,
4904
ea8f13f76d26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4742
diff changeset
196 QWebEnginePage.MouseLock: self.mouseLockList,
4742
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
197 }
6084
c6f3f66bf7aa Added support for HTML5 "Desktop Video Capture" and "Desktop Audio and Video Capture" as of Qt 5.10.0/PyQt 5.10.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
198 if hasattr(QWebEnginePage, "DesktopVideoCapture"):
c6f3f66bf7aa Added support for HTML5 "Desktop Video Capture" and "Desktop Audio and Video Capture" as of Qt 5.10.0/PyQt 5.10.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
199 self.__permissionsLists.update({
c6f3f66bf7aa Added support for HTML5 "Desktop Video Capture" and "Desktop Audio and Video Capture" as of Qt 5.10.0/PyQt 5.10.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
200 QWebEnginePage.DesktopVideoCapture: self.deskVidList,
c6f3f66bf7aa Added support for HTML5 "Desktop Video Capture" and "Desktop Audio and Video Capture" as of Qt 5.10.0/PyQt 5.10.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
201 QWebEnginePage.DesktopAudioVideoCapture: self.deskAudVidList,
c6f3f66bf7aa Added support for HTML5 "Desktop Video Capture" and "Desktop Audio and Video Capture" as of Qt 5.10.0/PyQt 5.10.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
202 })
7179
912bc70b5b01 WebBrowser: added support for the QWebEnginePage.Notifications as Qt 5.13.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
203 if hasattr(QWebEnginePage, "Notifications"):
912bc70b5b01 WebBrowser: added support for the QWebEnginePage.Notifications as Qt 5.13.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
204 self.__permissionsLists[QWebEnginePage.Notifications] = \
912bc70b5b01 WebBrowser: added support for the QWebEnginePage.Notifications as Qt 5.13.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
205 self.notifList
4356
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
206
4742
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
207 for feature, permissionsList in self.__permissionsLists.items():
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
208 for permission in featurePermissions[feature]:
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
209 for host in featurePermissions[feature][permission]:
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
210 itm = QTreeWidgetItem(
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
211 permissionsList,
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
212 [host, self.__permissionStrings[permission]])
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
213 itm.setData(0, Qt.UserRole, permission)
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
214
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
215 self.__previousCurrent = -1
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
216 self.tabWidget.currentChanged.connect(self.__currentTabChanged)
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
217 self.tabWidget.setCurrentIndex(0)
4356
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
218
4742
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
219 @pyqtSlot(int)
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
220 def __currentTabChanged(self, index):
4356
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
221 """
4742
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
222 Private slot handling changes of the selected tab.
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
223
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
224 @param index index of the current tab
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
225 @type int
4356
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
226 """
4742
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
227 if self.__previousCurrent >= 0:
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
228 previousList = self.tabWidget.widget(self.__previousCurrent)
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
229 previousList.itemSelectionChanged.disconnect(
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
230 self.__itemSelectionChanged)
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
231
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
232 self.__updateButtons()
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
233
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
234 currentList = self.tabWidget.currentWidget()
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
235 currentList.itemSelectionChanged.connect(self.__itemSelectionChanged)
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
236 self.__previousCurrent = index
4356
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
237
4742
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
238 def __updateButtons(self):
4356
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
239 """
4742
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
240 Private method to update the buttons.
4356
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
241 """
4742
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
242 currentList = self.tabWidget.currentWidget()
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
243 self.removeAllButton.setEnabled(
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
244 currentList.topLevelItemCount() > 0)
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
245 self.removeButton.setEnabled(
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
246 len(currentList.selectedItems()) > 0)
4356
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
247
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
248 @pyqtSlot()
4742
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
249 def __itemSelectionChanged(self):
4356
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
250 """
4742
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
251 Private slot handling changes in the current list of selected items.
4356
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
252 """
4742
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
253 self.__updateButtons()
4356
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
254
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
255 @pyqtSlot()
4742
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
256 def on_removeButton_clicked(self):
4356
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
257 """
4742
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
258 Private slot to remove selected entries.
4356
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
259 """
4742
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
260 currentList = self.tabWidget.currentWidget()
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
261 for itm in currentList.selectedItems():
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
262 row = currentList.indexOfTopLevelItem(itm)
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
263 itm = currentList.takeTopLevelItem(row)
4356
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
264 del itm
4742
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
265 self.__updateButtons()
4356
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
266
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
267 @pyqtSlot()
4742
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
268 def on_removeAllButton_clicked(self):
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
269 """
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
270 Private slot to remove all entries.
4356
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
271 """
4742
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
272 currentList = self.tabWidget.currentWidget()
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
273 while currentList.topLevelItemCount() > 0:
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
274 itm = currentList.takeTopLevelItem(0) # __IGNORE_WARNING__
4356
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
275 del itm
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
276 self.__updateGeoButtons()
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
277
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
278 def getData(self):
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
279 """
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
280 Public method to retrieve the dialog contents.
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
281
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
282 @return new feature permission settings
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
283 @rtype dict of dict of list
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
284 """
4742
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
285 featurePermissions = {}
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
286 for feature, permissionsList in self.__permissionsLists.items():
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
287 featurePermissions[feature] = {
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
288 QWebEnginePage.PermissionGrantedByUser: [],
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
289 QWebEnginePage.PermissionDeniedByUser: [],
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
290 }
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
291 for row in range(permissionsList.topLevelItemCount()):
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
292 itm = permissionsList.topLevelItem(row)
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
293 host = itm.text(0)
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
294 permission = itm.data(0, Qt.UserRole)
f9d1090f6ab9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
295 featurePermissions[feature][permission].append(host)
4356
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
296
975993ebd7fb Finished implementing the HTML5 feature permission manager and associated dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
297 return featurePermissions

eric ide

mercurial