eric6/WebBrowser/FeaturePermissions/FeaturePermissionBar.py

changeset 8240
93b8a353c4bf
parent 8218
7c09585bd960
child 8243
cc717c2ae956
equal deleted inserted replaced
8239:59a9a658618c 8240:93b8a353c4bf
4 # 4 #
5 5
6 """ 6 """
7 Module implementing the feature permission bar widget. 7 Module implementing the feature permission bar widget.
8 """ 8 """
9
10 import contextlib
9 11
10 from PyQt5.QtCore import pyqtSlot, QUrl 12 from PyQt5.QtCore import pyqtSlot, QUrl
11 from PyQt5.QtWidgets import QLabel, QHBoxLayout, QPushButton 13 from PyQt5.QtWidgets import QLabel, QHBoxLayout, QPushButton
12 from PyQt5.QtWebEngineWidgets import QWebEnginePage 14 from PyQt5.QtWebEngineWidgets import QWebEnginePage
13 15
118 self.__layout.addWidget(self.__rememberButton) 120 self.__layout.addWidget(self.__rememberButton)
119 self.__layout.addWidget(self.__allowButton) 121 self.__layout.addWidget(self.__allowButton)
120 self.__layout.addWidget(self.__denyButton) 122 self.__layout.addWidget(self.__denyButton)
121 self.__layout.addWidget(self.__discardButton) 123 self.__layout.addWidget(self.__discardButton)
122 124
123 try: 125 with contextlib.suppress(KeyError):
124 self.__iconLabel.setPixmap(UI.PixmapCache.getPixmap( 126 self.__iconLabel.setPixmap(UI.PixmapCache.getPixmap(
125 self.__permissionFeatureIconNames[self.__feature])) 127 self.__permissionFeatureIconNames[self.__feature]))
126 except KeyError:
127 pass
128 128
129 try: 129 try:
130 self.__messageLabel.setText( 130 self.__messageLabel.setText(
131 self.__permissionFeatureTexts[self.__feature].format( 131 self.__permissionFeatureTexts[self.__feature].format(
132 self.__origin.host())) 132 self.__origin.host()))

eric ide

mercurial