mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-07 08:58:38 +00:00
Keep track of selected filter path and if necessary, select row when
expanding a filter
This commit is contained in:
parent
f252ca1775
commit
08f2d5b412
1 changed files with 9 additions and 5 deletions
|
@ -141,6 +141,8 @@ class FilterTreeView(component.Component):
|
||||||
# We set to this expand the rows on start-up
|
# We set to this expand the rows on start-up
|
||||||
self.expand_rows = True
|
self.expand_rows = True
|
||||||
|
|
||||||
|
self.selected_path = None
|
||||||
|
|
||||||
def create_model_filter(self):
|
def create_model_filter(self):
|
||||||
self.model_filter = self.treestore.filter_new()
|
self.model_filter = self.treestore.filter_new()
|
||||||
self.model_filter.set_visible_column(FILTER_COLUMN)
|
self.model_filter.set_visible_column(FILTER_COLUMN)
|
||||||
|
@ -175,8 +177,7 @@ class FilterTreeView(component.Component):
|
||||||
self.label_view.expand_all()
|
self.label_view.expand_all()
|
||||||
self.expand_rows = False
|
self.expand_rows = False
|
||||||
|
|
||||||
(model, row) = self.label_view.get_selection().get_selected()
|
if not self.selected_path:
|
||||||
if not row:
|
|
||||||
self.select_default_filter()
|
self.select_default_filter()
|
||||||
|
|
||||||
def update_row(self, cat, value , count):
|
def update_row(self, cat, value , count):
|
||||||
|
@ -254,7 +255,7 @@ class FilterTreeView(component.Component):
|
||||||
log.debug("nothing selected")
|
log.debug("nothing selected")
|
||||||
return
|
return
|
||||||
|
|
||||||
cat = model.get_value(row, 0)
|
cat = model.get_value(row, 0)
|
||||||
value = model.get_value(row, 1)
|
value = model.get_value(row, 1)
|
||||||
|
|
||||||
filter_dict = {cat: [value]}
|
filter_dict = {cat: [value]}
|
||||||
|
@ -263,6 +264,8 @@ class FilterTreeView(component.Component):
|
||||||
|
|
||||||
component.get("TorrentView").set_filter(filter_dict)
|
component.get("TorrentView").set_filter(filter_dict)
|
||||||
|
|
||||||
|
self.selected_path = model.get_path(row)
|
||||||
|
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
log.debug(e)
|
log.debug(e)
|
||||||
# paths is likely None .. so lets return None
|
# paths is likely None .. so lets return None
|
||||||
|
@ -297,9 +300,10 @@ class FilterTreeView(component.Component):
|
||||||
self.label_view.collapse_row(path)
|
self.label_view.collapse_row(path)
|
||||||
else:
|
else:
|
||||||
self.label_view.expand_row(path, False)
|
self.label_view.expand_row(path, False)
|
||||||
(model, row) = self.label_view.get_selection().get_selected()
|
if not self.selected_path:
|
||||||
if not row:
|
|
||||||
self.select_default_filter()
|
self.select_default_filter()
|
||||||
|
else:
|
||||||
|
self.label_view.get_selection().select_path(self.selected_path)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
elif event.button == 3:
|
elif event.button == 3:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue