Enable expanding/collapsing filters
This commit is contained in:
parent
2b6b1a9ee7
commit
9bbc0fd8ea
|
@ -48,9 +48,9 @@ STATE_PIX = {
|
||||||
|
|
||||||
|
|
||||||
TRANSLATE = {
|
TRANSLATE = {
|
||||||
"state":"State",
|
"state": "States",
|
||||||
"tracker_host":"Tracker",
|
"tracker_host": "Trackers",
|
||||||
"label":"Label"
|
"label": "Labels"
|
||||||
}
|
}
|
||||||
|
|
||||||
FILTER_COLUMN = 5
|
FILTER_COLUMN = 5
|
||||||
|
@ -113,8 +113,9 @@ class FilterTreeView(component.Component):
|
||||||
self.label_view.append_column(column)
|
self.label_view.append_column(column)
|
||||||
|
|
||||||
#style:
|
#style:
|
||||||
self.label_view.set_show_expanders(False)
|
self.label_view.set_show_expanders(True)
|
||||||
self.label_view.set_headers_visible(False)
|
self.label_view.set_headers_visible(False)
|
||||||
|
self.label_view.set_level_indentation(-35)
|
||||||
|
|
||||||
self.label_view.set_model(self.treestore)
|
self.label_view.set_model(self.treestore)
|
||||||
self.label_view.get_selection().connect("changed", self.on_selection_changed)
|
self.label_view.get_selection().connect("changed", self.on_selection_changed)
|
||||||
|
@ -149,7 +150,6 @@ class FilterTreeView(component.Component):
|
||||||
if not cat in self.cat_nodes:
|
if not cat in self.cat_nodes:
|
||||||
self.cat_nodes[cat] = self.treestore.append(None, ["cat", cat, _t(cat), 0, None, False])
|
self.cat_nodes[cat] = self.treestore.append(None, ["cat", cat, _t(cat), 0, None, False])
|
||||||
|
|
||||||
|
|
||||||
#update rows
|
#update rows
|
||||||
visible_filters = []
|
visible_filters = []
|
||||||
for cat,filters in filter_items.iteritems():
|
for cat,filters in filter_items.iteritems():
|
||||||
|
@ -169,7 +169,6 @@ class FilterTreeView(component.Component):
|
||||||
if not f in visible_filters:
|
if not f in visible_filters:
|
||||||
self.treestore.set_value(self.filters[f], FILTER_COLUMN, False)
|
self.treestore.set_value(self.filters[f], FILTER_COLUMN, False)
|
||||||
|
|
||||||
self.label_view.expand_all()
|
|
||||||
(model, row) = self.label_view.get_selection().get_selected()
|
(model, row) = self.label_view.get_selection().get_selected()
|
||||||
if not row:
|
if not row:
|
||||||
self.select_default_filter()
|
self.select_default_filter()
|
||||||
|
@ -200,10 +199,9 @@ class FilterTreeView(component.Component):
|
||||||
count = model.get_value(row, 3)
|
count = model.get_value(row, 3)
|
||||||
pix = model.get_value(row, 4)
|
pix = model.get_value(row, 4)
|
||||||
|
|
||||||
if (label == "") and cat == "label":
|
if label == "" and cat == "label":
|
||||||
label = _("no label")
|
label = _("no label")
|
||||||
|
|
||||||
|
|
||||||
if pix:
|
if pix:
|
||||||
self.renderpix.set_property("visible", True)
|
self.renderpix.set_property("visible", True)
|
||||||
else:
|
else:
|
||||||
|
@ -289,6 +287,13 @@ class FilterTreeView(component.Component):
|
||||||
if event.button == 1:
|
if event.button == 1:
|
||||||
# Prevent selecting a category label
|
# Prevent selecting a category label
|
||||||
if cat == "cat":
|
if cat == "cat":
|
||||||
|
if self.label_view.row_expanded(path):
|
||||||
|
self.label_view.collapse_row(path)
|
||||||
|
else:
|
||||||
|
self.label_view.expand_row(path, False)
|
||||||
|
(model, row) = self.label_view.get_selection().get_selected()
|
||||||
|
if not row:
|
||||||
|
self.select_default_filter()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
elif event.button == 3:
|
elif event.button == 3:
|
||||||
|
|
Loading…
Reference in New Issue