eric6/WebBrowser/FeaturePermissions/FeaturePermissionsDialog.py

Tue, 10 Sep 2019 19:30:07 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Tue, 10 Sep 2019 19:30:07 +0200
changeset 7229
53054eb5b15a
parent 7179
912bc70b5b01
child 7268
a28338eaf694
permissions
-rw-r--r--

Removed obsolete "from __future__ import ..." statements.

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

eric ide

mercurial