53 self.tr("{0} wants to use your camera."), |
53 self.tr("{0} wants to use your camera."), |
54 QWebEnginePage.Feature.MediaAudioVideoCapture: |
54 QWebEnginePage.Feature.MediaAudioVideoCapture: |
55 self.tr("{0} wants to use your microphone and camera."), |
55 self.tr("{0} wants to use your microphone and camera."), |
56 QWebEnginePage.Feature.MouseLock: |
56 QWebEnginePage.Feature.MouseLock: |
57 self.tr("{0} wants to lock your mouse."), |
57 self.tr("{0} wants to lock your mouse."), |
|
58 QWebEnginePage.Feature.DesktopVideoCapture: |
|
59 self.tr("{0} wants to capture video of your screen."), |
|
60 QWebEnginePage.Feature.DesktopAudioVideoCapture: |
|
61 self.tr("{0} wants to capture audio and video of your" |
|
62 " screen."), |
58 } |
63 } |
59 try: |
64 with contextlib.suppress(AttributeError): |
60 # these are defined as of Qt 5.10.0/PyQt 5.10.0 |
|
61 self.__permissionFeatureTexts.update({ |
|
62 QWebEnginePage.Feature.DesktopVideoCapture: |
|
63 self.tr("{0} wants to capture video of your screen."), |
|
64 QWebEnginePage.Feature.DesktopAudioVideoCapture: |
|
65 self.tr("{0} wants to capture audio and video of your" |
|
66 " screen."), |
|
67 }) |
|
68 except AttributeError: |
|
69 pass |
|
70 try: |
|
71 # this was re-added in Qt 5.13.0 |
65 # this was re-added in Qt 5.13.0 |
72 self.__permissionFeatureTexts[ |
66 self.__permissionFeatureTexts[ |
73 QWebEnginePage.Feature.Notifications] = self.tr( |
67 QWebEnginePage.Feature.Notifications] = self.tr( |
74 "{0} wants to use desktop notifications.") |
68 "{0} wants to use desktop notifications.") |
75 except AttributeError: |
|
76 pass |
|
77 |
69 |
78 self.__permissionFeatureIconNames = { |
70 self.__permissionFeatureIconNames = { |
79 QWebEnginePage.Feature.Geolocation: "geolocation", |
71 QWebEnginePage.Feature.Geolocation: "geolocation", |
80 QWebEnginePage.Feature.MediaAudioCapture: "audiocapture", |
72 QWebEnginePage.Feature.MediaAudioCapture: "audiocapture", |
81 QWebEnginePage.Feature.MediaVideoCapture: "camera", |
73 QWebEnginePage.Feature.MediaVideoCapture: "camera", |
82 QWebEnginePage.Feature.MediaAudioVideoCapture: "audio-video", |
74 QWebEnginePage.Feature.MediaAudioVideoCapture: "audio-video", |
83 QWebEnginePage.Feature.MouseLock: "mouse", |
75 QWebEnginePage.Feature.MouseLock: "mouse", |
|
76 QWebEnginePage.Feature.DesktopVideoCapture: |
|
77 "desktopVideoCapture", |
|
78 QWebEnginePage.Feature.DesktopAudioVideoCapture: |
|
79 "desktopAudioVideoCapture", |
84 } |
80 } |
85 try: |
81 with contextlib.suppress(AttributeError): |
86 # these are defined as of Qt 5.10.0/PyQt 5.10.0 |
|
87 self.__permissionFeatureIconNames.update({ |
|
88 QWebEnginePage.Feature.DesktopVideoCapture: |
|
89 "desktopVideoCapture", |
|
90 QWebEnginePage.Feature.DesktopAudioVideoCapture: |
|
91 "desktopAudioVideoCapture", |
|
92 }) |
|
93 except AttributeError: |
|
94 pass |
|
95 try: |
|
96 # this was re-added in Qt 5.13.0 |
82 # this was re-added in Qt 5.13.0 |
97 self.__permissionFeatureIconNames[ |
83 self.__permissionFeatureIconNames[ |
98 QWebEnginePage.Feature.Notifications] = "notification" |
84 QWebEnginePage.Feature.Notifications] = "notification" |
99 except AttributeError: |
|
100 pass |
|
101 |
85 |
102 self.setAutoFillBackground(True) |
86 self.setAutoFillBackground(True) |
103 self.__layout = QHBoxLayout() |
87 self.__layout = QHBoxLayout() |
104 self.setLayout(self.__layout) |
88 self.setLayout(self.__layout) |
105 self.__layout.setContentsMargins(9, 0, 0, 0) |
89 self.__layout.setContentsMargins(9, 0, 0, 0) |