Move sidebar target for plugins to only middle section

This commit is contained in:
ChrisTerBeke 2017-12-05 10:56:59 +01:00
parent 5673a834bc
commit e33288b7c8
7 changed files with 67 additions and 92 deletions

View file

@ -10,7 +10,7 @@ class SidebarController:
def __init__(self, application):
self._application = application
self._sidebar_views = {}
self._sidebar_views = {"default": {}} # default is needed for the default settings sidebar
self._active_sidebar_view = None
# Register the sidebar_view plugin type so plugins can expose custom sidebar views.
@ -51,6 +51,13 @@ class SidebarController:
def getActiveSidebarView(self):
return self._active_sidebar_view
## Get the ID of the active sidebar view.
def getActiveSidebarViewId(self):
if self._active_sidebar_view:
if hasattr(self._active_sidebar_view, "getPluginId"):
return self._active_sidebar_view.getPluginId()
return "default"
## Change the active sidebar view to one of the registered views.
def setActiveSidebarView(self, sidebar_view_id: str):
if sidebar_view_id in self._sidebar_views: