1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-18 18:07:37 +03:00

plug.py: Further docstring fixes

This commit is contained in:
Athanasius 2022-12-03 14:05:59 +00:00
parent 413b2f06f8
commit 3247fb805c
No known key found for this signature in database
GPG Key ID: 772697E181BB2767

17
plug.py
View File

@ -62,7 +62,7 @@ class Plugin(object):
PLUGINS_not_py3.append(self) PLUGINS_not_py3.append(self)
else: else:
logger.error(f'plugin {name} has no plugin_start3() function') logger.error(f'plugin {name} has no plugin_start3() function')
except Exception as e: except Exception:
logger.exception(f': Failed for Plugin "{name}"') logger.exception(f': Failed for Plugin "{name}"')
raise raise
else: else:
@ -70,7 +70,8 @@ class Plugin(object):
def _get_func(self, funcname): def _get_func(self, funcname):
""" """
Get a function from a plugin Get a function from a plugin.
:param funcname: :param funcname:
:returns: The function, or None if it isn't implemented. :returns: The function, or None if it isn't implemented.
""" """
@ -79,6 +80,7 @@ class Plugin(object):
def get_app(self, parent): def get_app(self, parent):
""" """
If the plugin provides mainwindow content create and return it. If the plugin provides mainwindow content create and return it.
:param parent: the parent frame for this entry. :param parent: the parent frame for this entry.
:returns: None, a tk Widget, or a pair of tk.Widgets :returns: None, a tk Widget, or a pair of tk.Widgets
""" """
@ -88,14 +90,23 @@ class Plugin(object):
appitem = plugin_app(parent) appitem = plugin_app(parent)
if appitem is None: if appitem is None:
return None return None
elif isinstance(appitem, tuple): elif isinstance(appitem, tuple):
if len(appitem) != 2 or not isinstance(appitem[0], tk.Widget) or not isinstance(appitem[1], tk.Widget): if (
len(appitem) != 2
or not isinstance(appitem[0], tk.Widget)
or not isinstance(appitem[1], tk.Widget)
):
raise AssertionError raise AssertionError
elif not isinstance(appitem, tk.Widget): elif not isinstance(appitem, tk.Widget):
raise AssertionError raise AssertionError
return appitem return appitem
except Exception as e: except Exception as e:
logger.exception(f'Failed for Plugin "{self.name}"') logger.exception(f'Failed for Plugin "{self.name}"')
return None return None
def get_prefs(self, parent, cmdr, is_beta): def get_prefs(self, parent, cmdr, is_beta):