2092: Problems when no database is open. Partial fix. Fix tags menu when
there is no database and stop accessing database for tags filter dropdown when there is no database.
This commit is contained in:
parent
721cfa1a1c
commit
2886583689
@ -209,6 +209,7 @@ class SidebarFilter(DbGUIElement):
|
||||
Called when the tag list needs to be rebuilt.
|
||||
"""
|
||||
self.__tag_list = []
|
||||
if self.dbstate.db is not None and self.dbstate.db.is_open():
|
||||
for handle in self.dbstate.db.get_tag_handles(sort_handles=True):
|
||||
tag = self.dbstate.db.get_tag_from_handle(handle)
|
||||
# for python3 this returns a byte object, so conversion needed
|
||||
|
@ -113,6 +113,7 @@ class Tags(DbGUIElement):
|
||||
self.__tag_list = []
|
||||
|
||||
dbstate.connect('database-changed', self._db_changed)
|
||||
dbstate.connect('no-database', self.tag_disable)
|
||||
|
||||
self._build_tag_menu()
|
||||
|
||||
@ -128,6 +129,7 @@ class Tags(DbGUIElement):
|
||||
"""
|
||||
Remove the UI and action groups for the tag menu.
|
||||
"""
|
||||
if self.tag_id is not None:
|
||||
self.uistate.uimanager.remove_ui(self.tag_id)
|
||||
self.uistate.uimanager.remove_action_group(self.tag_action)
|
||||
self.uistate.uimanager.ensure_update()
|
||||
@ -181,6 +183,7 @@ class Tags(DbGUIElement):
|
||||
Called when the tag list needs to be rebuilt.
|
||||
"""
|
||||
self.__tag_list = []
|
||||
if self.db is not None and self.db.is_open():
|
||||
for handle in self.db.get_tag_handles(sort_handles=True):
|
||||
tag = self.db.get_tag_from_handle(handle)
|
||||
self.__tag_list.append((tag.get_name(), tag.get_handle()))
|
||||
@ -203,7 +206,7 @@ class Tags(DbGUIElement):
|
||||
"""
|
||||
actions = []
|
||||
|
||||
if self.db is None:
|
||||
if self.db is None or not self.db.is_open():
|
||||
self.tag_ui = ''
|
||||
self.tag_action = ActionGroup(name='Tag')
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user