--- a/WebBrowser/AdBlock/AdBlockTreeWidget.py Thu Dec 14 19:25:34 2017 +0100 +++ b/WebBrowser/AdBlock/AdBlockTreeWidget.py Mon Dec 18 18:09:39 2017 +0100 @@ -25,8 +25,10 @@ """ Constructor - @param subscription reference to the subscription (AdBlockSubscription) - @param parent reference to the parent widget (QWidget) + @param subscription reference to the subscription + @type AdBlockSubscription + @param parent reference to the parent widget + @type QWidget """ super(AdBlockTreeWidget, self).__init__(parent) @@ -49,7 +51,8 @@ """ Public method to get a reference to the subscription. - @return reference to the subscription (AdBlockSubscription) + @return reference to the subscription + @rtype AdBlockSubscription """ return self.__subscription @@ -57,13 +60,12 @@ """ Public method to highlight the given rule. - @param rule AdBlock rule to be shown (AdBlockRule) + @param rule AdBlock rule to be shown + @type AdBlockRule """ - if rule: + if not bool(self.__topItem) and bool(rule): self.__ruleToBeSelected = rule.filter() - if not self.__topItem: - return - if self.__ruleToBeSelected: + elif self.__ruleToBeSelected: items = self.findItems(self.__ruleToBeSelected, Qt.MatchRecursive) if items: item = items[0] @@ -110,7 +112,8 @@ """ Public slot to add a new rule. - @param filterRule filter to be added (string) + @param filterRule filter to be added + @type str """ if not self.__subscription.canEditRules(): return @@ -146,7 +149,8 @@ """ Private slot to show the context menu. - @param pos position for the menu (QPoint) + @param pos position for the menu + @type QPoint """ if not self.__subscription.canEditRules(): return @@ -168,7 +172,8 @@ """ Private slot to handle the change of an item. - @param itm changed item (QTreeWidgetItem) + @param itm changed item + @type QTreeWidgetItem """ if itm is None or self.__itemChangingBlock: return @@ -219,8 +224,10 @@ """ Private method to adjust an item. - @param itm item to be adjusted (QTreeWidgetItem) - @param rule rule for the adjustment (AdBlockRule) + @param itm item to be adjusted + @type QTreeWidgetItem + @param rule rule for the adjustment + @type AdBlockRule """ if not rule.isEnabled(): font = QFont() @@ -251,7 +258,8 @@ """ Protected method handling key presses. - @param evt key press event (QKeyEvent) + @param evt key press event + @type QKeyEvent """ if evt.key() == Qt.Key_C and \ evt.modifiers() & Qt.ControlModifier: