9700: Select Place search & Source/Citation hierarchy should NOT be expanded

This commit is contained in:
SNoiraud 2016-09-16 20:37:44 +02:00
parent 5290062b24
commit e23e40a698
2 changed files with 6 additions and 4 deletions

View File

@ -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) sel = SelectCitation(self.dbstate, self.uistate, self.track, expand=False)
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

View File

@ -53,13 +53,14 @@ 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): show_search_bar = True, default=None, expand=True):
"""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'):
@ -288,8 +289,9 @@ class BaseSelector(ManagedWindow):
self.setupcols = False self.setupcols = False
if not (self.model.get_flags() & Gtk.TreeModelFlags.LIST_ONLY): if self.expand:
self.tree.expand_all() 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: