Merge branch 'maintenance' into devel
This commit is contained in:
commit
30e962b447
31 files changed
+567
-157
No files matched your search
@@ -1062,21 +1062,30 @@ class PluginManager(object):
|
||||
return True
|
||||
|
||||
|
||||
def log_all_plugins(self, show_bundled=True, bundled_str=(" (bundled)", ""), show_location=True, location_str=" = {location}", show_enabled=True, enabled_str=(" ", "!")):
|
||||
def log_all_plugins(self, show_bundled=True, bundled_str=(" (bundled)", ""), show_location=True,
|
||||
location_str=" = {location}", show_enabled=True, enabled_str=(" ", "!"),
|
||||
only_to_handler=None):
|
||||
all_plugins = self.enabled_plugins.values() + self.disabled_plugins.values()
|
||||
|
||||
def _log(message, level=logging.INFO):
|
||||
if only_to_handler is not None:
|
||||
import octoprint.logging
|
||||
octoprint.logging.log_to_handler(self.logger, only_to_handler, level, message, [])
|
||||
else:
|
||||
self.logger.log(level, message)
|
||||
|
||||
if len(all_plugins) <= 0:
|
||||
self.logger.info("No plugins available")
|
||||
_log("No plugins available")
|
||||
else:
|
||||
self.logger.info("{count} plugin(s) registered with the system:\n{plugins}".format(count=len(all_plugins), plugins="\n".join(
|
||||
map(lambda x: "| " + x.long_str(show_bundled=show_bundled,
|
||||
bundled_strs=bundled_str,
|
||||
show_location=show_location,
|
||||
location_str=location_str,
|
||||
show_enabled=show_enabled,
|
||||
enabled_strs=enabled_str),
|
||||
sorted(self.plugins.values(), key=lambda x: str(x).lower()))
|
||||
)))
|
||||
formatted_plugins = "\n".join(map(lambda x: "| " + x.long_str(show_bundled=show_bundled,
|
||||
bundled_strs=bundled_str,
|
||||
show_location=show_location,
|
||||
location_str=location_str,
|
||||
show_enabled=show_enabled,
|
||||
enabled_strs=enabled_str),
|
||||
sorted(self.plugins.values(), key=lambda x: str(x).lower())))
|
||||
_log("{count} plugin(s) registered with the system:\n{plugins}".format(count=len(all_plugins),
|
||||
plugins=formatted_plugins))
|
||||
|
||||
def get_plugin(self, identifier, require_enabled=True):
|
||||
"""
|
||||
|
||||
@@ -746,6 +746,21 @@ class UiPlugin(OctoPrintPlugin, SortablePlugin):
|
||||
"""
|
||||
return None
|
||||
|
||||
def get_ui_additional_etag(self, default_additional):
|
||||
"""
|
||||
Allows to provide a list of additional fields to use for ETag generation.
|
||||
|
||||
By default the same list will be returned that is also used in the stock UI (and injected
|
||||
via the parameter ``default_additional``).
|
||||
|
||||
Arguments:
|
||||
default_additional (list): The list of default fields added to the ETag of the default UI
|
||||
|
||||
Returns:
|
||||
(list): A list of additional fields for the ETag generation, or None
|
||||
"""
|
||||
return default_additional
|
||||
|
||||
def get_ui_custom_lastmodified(self):
|
||||
"""
|
||||
Allows to calculate the LastModified differently than using the most recent modification
|
||||
@@ -806,6 +821,25 @@ class UiPlugin(OctoPrintPlugin, SortablePlugin):
|
||||
"""
|
||||
return False
|
||||
|
||||
def get_ui_custom_template_filter(self, default_template_filter):
|
||||
"""
|
||||
Allows to specify a custom template filter to use for filtering the template contained in the
|
||||
``render_kwargs`` provided to the templating sub system.
|
||||
|
||||
Only relevant for UiPlugins that actually utilize the stock templates of OctoPrint.
|
||||
|
||||
By default simply returns the provided ``default_template_filter``.
|
||||
|
||||
Arguments:
|
||||
default_template_filter (callable): The default template filter used by the default UI
|
||||
|
||||
Returns:
|
||||
(callable) A filter function accepting the ``template_type`` and ``template_key`` of a template
|
||||
and returning ``True`` to keep it and ``False`` to filter it out. If ``None`` is returned, no
|
||||
filtering will take place.
|
||||
"""
|
||||
return default_template_filter
|
||||
|
||||
class WizardPlugin(OctoPrintPlugin, ReloadNeedingPlugin):
|
||||
"""
|
||||
The ``WizardPlugin`` mixin allows plugins to report to OctoPrint whether
|
||||
|
||||
Reference in new issue
Block a user