1 parent
f050b4e5cb
commit
e0b888b2d0
20 files changed
+1045
-10
No files matched your search
@@ -113,7 +113,20 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
|
||||
|
||||
def get_template_configs(self):
|
||||
return [
|
||||
dict(type="settings", name=gettext("Plugin Manager"), template="pluginmanager_settings.jinja2", custom_bindings=True)
|
||||
dict(type="settings", name=gettext("Plugin Manager"), template="pluginmanager_settings.jinja2", custom_bindings=True),
|
||||
dict(type="about", name=gettext("Plugin Licenses"), template="pluginmanager_about.jinja2")
|
||||
]
|
||||
|
||||
def get_template_vars(self):
|
||||
plugins = sorted(self._get_plugins(), key=lambda x: x["name"].lower())
|
||||
return dict(
|
||||
all=plugins,
|
||||
thirdparty=filter(lambda p: not p["bundled"], plugins)
|
||||
)
|
||||
|
||||
def get_template_types(self, template_sorting, template_rules, *args, **kwargs):
|
||||
return [
|
||||
("about_thirdparty", dict(), dict(template=lambda x: x + "_about_thirdparty.jinja2"))
|
||||
]
|
||||
|
||||
##~~ BlueprintPlugin
|
||||
@@ -633,6 +646,18 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
|
||||
octoprint_version = pkg_resources.parse_version(octoprint_version.base_version)
|
||||
return octoprint_version
|
||||
|
||||
def _get_plugins(self):
|
||||
plugins = self._plugin_manager.plugins
|
||||
|
||||
hidden = self._settings.get(["hidden"])
|
||||
result = []
|
||||
for name, plugin in plugins.items():
|
||||
if name in hidden:
|
||||
continue
|
||||
result.append(self._to_external_representation(plugin))
|
||||
|
||||
return result
|
||||
|
||||
def _to_external_representation(self, plugin):
|
||||
return dict(
|
||||
key=plugin.key,
|
||||
@@ -663,5 +688,6 @@ def __plugin_load__():
|
||||
|
||||
global __plugin_hooks__
|
||||
__plugin_hooks__ = {
|
||||
"octoprint.server.http.bodysize": __plugin_implementation__.increase_upload_bodysize
|
||||
"octoprint.server.http.bodysize": __plugin_implementation__.increase_upload_bodysize,
|
||||
"octoprint.ui.web.templatetypes": __plugin_implementation__.get_template_types
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<h3>Plugin Licenses</h3>
|
||||
|
||||
<ul>
|
||||
{% for plugin in plugin_pluginmanager_thirdparty %}
|
||||
<li><a href="{{ plugin.url }}">{{ plugin.name }}</a>: {{ plugin.license }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
{% if templates.plugin_pluginmanager_about_thirdparty.order %}
|
||||
<h3>Licenses of Plugin Dependencies</h3>
|
||||
|
||||
{% for key in templates.plugin_pluginmanager_about_thirdparty.order %}
|
||||
{% set heading, config = templates.plugin_pluginmanager_about_thirdparty.entries[key] %}
|
||||
<h4>{{ heading }}</h4>
|
||||
|
||||
{% include config.template ignore missing %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
Reference in new issue
Block a user