Improve docstrings

This commit is contained in:
Oliver 2021-12-30 23:06:28 +11:00
parent 04820c894b
commit be3bb05edd

View File

@ -11,7 +11,7 @@ class GlobalSettingsMixin:
"""
Mixin that enables global settings for the plugin
"""
class MixinMeta:
MIXIN_NAME = 'Settings'
@ -22,28 +22,30 @@ class GlobalSettingsMixin:
def setup_globalsettings(self):
"""
setup global settings for this plugin
Setup global settings for this plugin
"""
return getattr(self, 'SETTINGS', None)
@property
def has_globalsettings(self):
"""
does this plugin use custom global settings
Does this plugin use custom global settings
"""
return bool(self.globalsettings)
@property
def globalsettingspatterns(self):
"""
get patterns for InvenTreeSetting defintion
Get patterns for InvenTreeSetting defintion
"""
if self.has_globalsettings:
return {f'PLUGIN_{self.slug.upper()}_{key}': value for key, value in self.globalsettings.items()}
return None
def _globalsetting_name(self, key):
"""get global name of setting"""
"""
Get global name of setting
"""
return f'PLUGIN_{self.slug.upper()}_{key}'
def get_globalsetting(self, key):
@ -62,9 +64,11 @@ class GlobalSettingsMixin:
class UrlsMixin:
"""Mixin that enables urls for the plugin"""
"""
Mixin that enables custom URLs for the plugin
"""
class MixinMeta:
"""meta options for this mixin"""
MIXIN_NAME = 'URLs'
def __init__(self):
@ -110,7 +114,10 @@ class UrlsMixin:
class NavigationMixin:
"""Mixin that enables adding navigation links with the plugin"""
"""
Mixin that enables custom navigation links with the plugin
"""
NAVIGATION_TAB_NAME = None
NAVIGATION_TAB_ICON = "fas fa-question"
@ -157,7 +164,10 @@ class NavigationMixin:
class AppMixin:
"""Mixin that enables full django app functions for a plugin"""
"""
Mixin that enables full django app functions for a plugin
"""
class MixinMeta:
"""meta options for this mixin"""
MIXIN_NAME = 'App registration'