♻ Implement login dialog through UiPlugin

Otherwise alternative UIs might still be wide open, and caching and such
was also really painful to solve before.

The LoginUI Plugin is pretty much just a distilled ForceLogin plugin.

Also declared it as hidden so it won't show up/be manageable by the
plugin manager.
This commit is contained in:
Gina Häußge committed 2020-02-25 15:33:42 +01:00
1 parent 38c09153ac
commit a75c641c18
11 files changed
+364 -56

No files matched your search

+30
View File
@@ -130,6 +130,14 @@ class PluginInfo(object):
Bundled plugins will automatically be assumed to be compatible.
"""
attr_hidden = '__plugin_hidden__'
"""
Module attribute from which to determine if the plugin's hidden or not.
Only evaluated for bundled plugins, in order to hide them from the Plugin Manager
and similar places.
"""
attr_hooks = '__plugin_hooks__'
""" Module attribute from which to retrieve the plugin's provided hooks. """
@@ -444,6 +452,18 @@ class PluginInfo(object):
default=">=2.7,<3",
incl_metadata=True)
@property
def hidden(self):
"""
Hidden flag.
Returns:
bool: Whether the plugin should be flagged as hidden or not
"""
return self._get_instance_attribute(self.__class__.attr_hidden,
default=False,
incl_metadata=True)
@property
def hooks(self):
"""
@@ -600,6 +620,16 @@ class PluginInfo(object):
result[key] = a.value.args[0].s
break
for key in (self.__class__.attr_hidden,):
for a in reversed(assignments):
targets = extract_target_ids(a)
if key in targets:
if isinstance(a.value, ast.Name) and a.value.id in ("True", "False"):
result[key] = bool(a.value.id)
break
except SyntaxError:
self._logger.exception("Invalid syntax in {} for plugin {}".format(path, self.key))
self.invalid_syntax = True