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:
parent
05f04093af
commit
80779a35fa
@ -154,7 +154,7 @@ class CitationEmbedList(EmbeddedList, DbGUIElement):
|
|||||||
def share_button_clicked(self, obj):
|
def share_button_clicked(self, obj):
|
||||||
SelectCitation = SelectorFactory('Citation')
|
SelectCitation = SelectorFactory('Citation')
|
||||||
|
|
||||||
sel = SelectCitation(self.dbstate, self.uistate, self.track, expand=False)
|
sel = SelectCitation(self.dbstate, self.uistate, self.track)
|
||||||
object = sel.run()
|
object = sel.run()
|
||||||
LOG.debug("selected object: %s" % object)
|
LOG.debug("selected object: %s" % object)
|
||||||
# the object returned should either be a Source or a Citation
|
# the object returned should either be a Source or a Citation
|
||||||
|
@ -53,14 +53,13 @@ class BaseSelector(ManagedWindow):
|
|||||||
IMAGE = 2
|
IMAGE = 2
|
||||||
|
|
||||||
def __init__(self, dbstate, uistate, track=[], filter=None, skip=set(),
|
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
|
"""Set up the dialog with the dbstate and uistate, track of parent
|
||||||
windows for ManagedWindow, initial filter for the model, skip with
|
windows for ManagedWindow, initial filter for the model, skip with
|
||||||
set of handles to skip in the view, and search_bar to show the
|
set of handles to skip in the view, and search_bar to show the
|
||||||
SearchBar at the top or not.
|
SearchBar at the top or not.
|
||||||
"""
|
"""
|
||||||
self.filter = (2, filter, False)
|
self.filter = (2, filter, False)
|
||||||
self.expand = expand
|
|
||||||
|
|
||||||
# Set window title, some selectors may set self.title in their __init__
|
# Set window title, some selectors may set self.title in their __init__
|
||||||
if not hasattr(self, 'title'):
|
if not hasattr(self, 'title'):
|
||||||
@ -133,6 +132,18 @@ class BaseSelector(ManagedWindow):
|
|||||||
"""
|
"""
|
||||||
iter_ = self.model.get_iter_from_handle(handle)
|
iter_ = self.model.get_iter_from_handle(handle)
|
||||||
if iter_:
|
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
|
# Select active object
|
||||||
path = self.model.get_path(iter_)
|
path = self.model.get_path(iter_)
|
||||||
self.selection.unselect_all()
|
self.selection.unselect_all()
|
||||||
@ -287,11 +298,7 @@ class BaseSelector(ManagedWindow):
|
|||||||
self.tree.set_search_column(search_col)
|
self.tree.set_search_column(search_col)
|
||||||
|
|
||||||
self.setupcols = False
|
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):
|
def column_clicked(self, obj, data):
|
||||||
if self.sort_col != data:
|
if self.sort_col != data:
|
||||||
self.sortorder = Gtk.SortType.ASCENDING
|
self.sortorder = Gtk.SortType.ASCENDING
|
||||||
|
Loading…
Reference in New Issue
Block a user