summaryrefslogtreecommitdiffstats
path: root/lib.py
diff options
context:
space:
mode:
authorJan Pokorný <jpokorny@redhat.com>2013-05-14 15:44:47 +0200
committerJan Pokorný <jpokorny@redhat.com>2013-05-14 15:44:47 +0200
commitd9eba446f2d6d99a71e7edfb4537c4ca2f7e450c (patch)
tree477707b9fbfb6db5745146d86aa3bb7cc9b96be3 /lib.py
parentd99f4dddee46788719055bfbb88e5888148efccc (diff)
downloadcluster-overview-d9eba446f2d6d99a71e7edfb4537c4ca2f7e450c.tar.gz
cluster-overview-d9eba446f2d6d99a71e7edfb4537c4ca2f7e450c.tar.xz
cluster-overview-d9eba446f2d6d99a71e7edfb4537c4ca2f7e450c.zip
lib.py: tune the code + enabling item will enable its ancestors
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
Diffstat (limited to 'lib.py')
-rw-r--r--lib.py26
1 files changed, 16 insertions, 10 deletions
diff --git a/lib.py b/lib.py
index b4fd12a..56f6fbf 100644
--- a/lib.py
+++ b/lib.py
@@ -312,28 +312,34 @@ def xdot_graph(*args, **kwargs):
label = widget.get_label()
bl = self._kwargs.setdefault('blacklist', [])
change = False
- if widget.active and globals()[label] in bl:
- bl.remove(globals()[label])
+ cls = globals()[label]
+ if widget.active and cls in bl:
+ bl.remove(cls)
+ bs = bases(cls)
+ bs.remove(cls)
+ for item in filter(lambda x: isinstance(x, gtk.CheckMenuItem)
+ and globals()[x.get_label()] in bs,
+ widget.get_parent().get_children()):
+ if not item.get_active():
+ item.set_active(True)
change = True
- elif not widget.active and label not in bl:
- bl.append(globals()[label])
+ elif not widget.active and cls not in bl:
+ bl.append(cls)
change = True
if change:
self.set_dotcode(
gen_graph(*self._args, **self._kwargs).to_string())
def on_clean_all(self, widget):
- for item in widget.get_parent().get_children():
- if not isinstance(item, gtk.CheckMenuItem):
- continue
+ for item in filter(lambda x: isinstance(x, gtk.CheckMenuItem),
+ widget.get_parent().get_children()):
item.set_active(False)
item.set_active(True)
item.activate()
def on_set_all(self, widget):
- for item in widget.get_parent().get_children():
- if not isinstance(item, gtk.CheckMenuItem):
- continue
+ for item in filter(lambda x: isinstance(x, gtk.CheckMenuItem),
+ widget.get_parent().get_children()):
item.set_active(True)
item.set_active(False)
item.activate()