--- a/src/eric7/WebBrowser/AdBlock/AdBlockExceptionsDialog.py Wed Jul 13 11:16:20 2022 +0200 +++ b/src/eric7/WebBrowser/AdBlock/AdBlockExceptionsDialog.py Wed Jul 13 14:55:47 2022 +0200 @@ -19,42 +19,42 @@ """ Class implementing a dialog to configure the AdBlock exceptions. """ + def __init__(self, parent=None): """ Constructor - + @param parent reference to the parent widget @type QWidget """ super().__init__(parent) self.setupUi(self) self.setWindowFlags(Qt.WindowType.Window) - - self.iconLabel.setPixmap( - UI.PixmapCache.getPixmap("adBlockPlusGreen48")) - + + self.iconLabel.setPixmap(UI.PixmapCache.getPixmap("adBlockPlusGreen48")) + self.buttonBox.setFocus() - + def load(self, hosts): """ Public slot to load the list of excepted hosts. - + @param hosts list of excepted hosts @type list of str """ self.hostList.clear() self.hostList.addItems(hosts) - + @pyqtSlot(str) def on_hostEdit_textChanged(self, txt): """ Private slot to handle changes of the host edit. - + @param txt text of the edit @type str """ self.addButton.setEnabled(bool(txt)) - + @pyqtSlot() def on_addButton_clicked(self): """ @@ -62,14 +62,14 @@ """ self.hostList.addItem(self.hostEdit.text()) self.hostEdit.clear() - + @pyqtSlot() def on_hostList_itemSelectionChanged(self): """ Private slot handling a change of the number of selected items. """ self.deleteButton.setEnabled(len(self.hostList.selectedItems()) > 0) - + @pyqtSlot() def on_deleteButton_clicked(self): """ @@ -79,7 +79,7 @@ row = self.hostList.row(itm) removedItem = self.hostList.takeItem(row) del removedItem - + def accept(self): """ Public slot handling the acceptance of the dialog. @@ -87,8 +87,9 @@ hosts = [] for row in range(self.hostList.count()): hosts.append(self.hostList.item(row).text()) - + from WebBrowser.WebBrowserWindow import WebBrowserWindow + WebBrowserWindow.adBlockManager().setExceptions(hosts) - + super().accept()