Revert bugs #8785 and #9700

Expanding tree selectors by default caused performance issues.
The expanded person selector also made it more difficult to
select a specific person in some circumstances.

GEPS 041 has been created to discuss a better selector design.
This commit is contained in:
Nick Hall 2017-05-15 17:02:06 +01:00
parent db3655d156
commit 647a3b226a
2 changed files with 15 additions and 8 deletions

View File

@ -155,7 +155,7 @@ class CitationEmbedList(EmbeddedList, DbGUIElement):
def share_button_clicked(self, obj):
SelectCitation = SelectorFactory('Citation')
sel = SelectCitation(self.dbstate, self.uistate, self.track, expand=False)
sel = SelectCitation(self.dbstate, self.uistate, self.track)
object = sel.run()
LOG.debug("selected object: %s" % object)
# the object returned should either be a Source or a Citation

View File

@ -53,14 +53,13 @@ class BaseSelector(ManagedWindow):
IMAGE = 2
def __init__(self, dbstate, uistate, track=[], filter=None, skip=set(),
show_search_bar = True, default=None, expand=True):
show_search_bar = True, default=None):
"""Set up the dialog with the dbstate and uistate, track of parent
windows for ManagedWindow, initial filter for the model, skip with
set of handles to skip in the view, and search_bar to show the
SearchBar at the top or not.
"""
self.filter = (2, filter, False)
self.expand = expand
# Set window title, some selectors may set self.title in their __init__
if not hasattr(self, 'title'):
@ -133,6 +132,18 @@ class BaseSelector(ManagedWindow):
"""
iter_ = self.model.get_iter_from_handle(handle)
if iter_:
if not (self.model.get_flags() & Gtk.TreeModelFlags.LIST_ONLY):
# Expand tree
parent_iter = self.model.iter_parent(iter_)
if parent_iter:
parent_path = self.model.get_path(parent_iter)
if parent_path:
parent_path_list = parent_path.get_indices()
for i in range(len(parent_path_list)):
expand_path = Gtk.TreePath(
tuple([x for x in parent_path_list[:i+1]]))
self.tree.expand_row(expand_path, False)
# Select active object
path = self.model.get_path(iter_)
self.selection.unselect_all()
@ -294,10 +305,6 @@ class BaseSelector(ManagedWindow):
self.setupcols = False
if self.expand:
if not (self.model.get_flags() & Gtk.TreeModelFlags.LIST_ONLY):
self.tree.expand_all()
def column_clicked(self, obj, data):
if self.sort_col != data:
self.sortorder = Gtk.SortType.ASCENDING