--- a/eric6/WebBrowser/FeaturePermissions/FeaturePermissionBar.py Thu Apr 15 16:52:05 2021 +0200 +++ b/eric6/WebBrowser/FeaturePermissions/FeaturePermissionBar.py Thu Apr 15 18:11:24 2021 +0200 @@ -55,25 +55,17 @@ self.tr("{0} wants to use your microphone and camera."), QWebEnginePage.Feature.MouseLock: self.tr("{0} wants to lock your mouse."), + QWebEnginePage.Feature.DesktopVideoCapture: + self.tr("{0} wants to capture video of your screen."), + QWebEnginePage.Feature.DesktopAudioVideoCapture: + self.tr("{0} wants to capture audio and video of your" + " screen."), } - try: - # these are defined as of Qt 5.10.0/PyQt 5.10.0 - self.__permissionFeatureTexts.update({ - QWebEnginePage.Feature.DesktopVideoCapture: - self.tr("{0} wants to capture video of your screen."), - QWebEnginePage.Feature.DesktopAudioVideoCapture: - self.tr("{0} wants to capture audio and video of your" - " screen."), - }) - except AttributeError: - pass - try: + with contextlib.suppress(AttributeError): # this was re-added in Qt 5.13.0 self.__permissionFeatureTexts[ QWebEnginePage.Feature.Notifications] = self.tr( "{0} wants to use desktop notifications.") - except AttributeError: - pass self.__permissionFeatureIconNames = { QWebEnginePage.Feature.Geolocation: "geolocation", @@ -81,23 +73,15 @@ QWebEnginePage.Feature.MediaVideoCapture: "camera", QWebEnginePage.Feature.MediaAudioVideoCapture: "audio-video", QWebEnginePage.Feature.MouseLock: "mouse", + QWebEnginePage.Feature.DesktopVideoCapture: + "desktopVideoCapture", + QWebEnginePage.Feature.DesktopAudioVideoCapture: + "desktopAudioVideoCapture", } - try: - # these are defined as of Qt 5.10.0/PyQt 5.10.0 - self.__permissionFeatureIconNames.update({ - QWebEnginePage.Feature.DesktopVideoCapture: - "desktopVideoCapture", - QWebEnginePage.Feature.DesktopAudioVideoCapture: - "desktopAudioVideoCapture", - }) - except AttributeError: - pass - try: + with contextlib.suppress(AttributeError): # this was re-added in Qt 5.13.0 self.__permissionFeatureIconNames[ QWebEnginePage.Feature.Notifications] = "notification" - except AttributeError: - pass self.setAutoFillBackground(True) self.__layout = QHBoxLayout()