eric6/WebBrowser/AdBlock/AdBlockTreeWidget.py

changeset 7268
a28338eaf694
parent 7229
53054eb5b15a
child 7360
9190402e4505
equal deleted inserted replaced
7267:aedc309827c7 7268:a28338eaf694
8 """ 8 """
9 9
10 10
11 from PyQt5.QtCore import Qt 11 from PyQt5.QtCore import Qt
12 from PyQt5.QtGui import QFont, QColor 12 from PyQt5.QtGui import QFont, QColor
13 from PyQt5.QtWidgets import QAbstractItemView, QTreeWidgetItem, QInputDialog, \ 13 from PyQt5.QtWidgets import (
14 QLineEdit, QMenu, QApplication 14 QAbstractItemView, QTreeWidgetItem, QInputDialog, QLineEdit, QMenu,
15 QApplication
16 )
15 17
16 from E5Gui.E5TreeWidget import E5TreeWidget 18 from E5Gui.E5TreeWidget import E5TreeWidget
17 19
18 20
19 class AdBlockTreeWidget(E5TreeWidget): 21 class AdBlockTreeWidget(E5TreeWidget):
133 def removeRule(self): 135 def removeRule(self):
134 """ 136 """
135 Public slot to remove the current rule. 137 Public slot to remove the current rule.
136 """ 138 """
137 item = self.currentItem() 139 item = self.currentItem()
138 if item is None or \ 140 if (
139 not self.__subscription.canEditRules() or \ 141 item is None or
140 item == self.__topItem: 142 not self.__subscription.canEditRules() or
143 item == self.__topItem
144 ):
141 return 145 return
142 146
143 offset = item.data(0, Qt.UserRole) 147 offset = item.data(0, Qt.UserRole)
144 self.__subscription.removeRule(offset) 148 self.__subscription.removeRule(offset)
145 self.deleteItem(item) 149 self.deleteItem(item)
258 Protected method handling key presses. 262 Protected method handling key presses.
259 263
260 @param evt key press event 264 @param evt key press event
261 @type QKeyEvent 265 @type QKeyEvent
262 """ 266 """
263 if evt.key() == Qt.Key_C and \ 267 if (
264 evt.modifiers() & Qt.ControlModifier: 268 evt.key() == Qt.Key_C and
269 evt.modifiers() & Qt.ControlModifier
270 ):
265 self.__copyFilter() 271 self.__copyFilter()
266 elif evt.key() == Qt.Key_Delete: 272 elif evt.key() == Qt.Key_Delete:
267 self.removeRule() 273 self.removeRule()
268 else: 274 else:
269 super(AdBlockTreeWidget, self).keyPressEvent(evt) 275 super(AdBlockTreeWidget, self).keyPressEvent(evt)

eric ide

mercurial