diff --git a/RELEASE-NOTES.md b/CHANGELOG.md similarity index 84% rename from RELEASE-NOTES.md rename to CHANGELOG.md index 70661a537..2d9c17314 100644 --- a/RELEASE-NOTES.md +++ b/CHANGELOG.md @@ -1,30 +1,47 @@ -# OctoPrint Release Notes +# OctoPrint Changelog -## 1.2.0 (In Development) +## 1.2.0 (Unreleased) ### New Features * Added internationalization of UI. Translations of OctoPrint are being crowd sourced via [Transifex](https://www.transifex.com/projects/p/octoprint/). The following translations are already available with more in the works: + - Dutch (nl) - German (de) - French (fr) - Hebrew (he) + - Norwegian (no) - Romanian (ro) * New file list: Pagination is gone, no more (mobile incompatible) pop overs, instead scrollable and with instant search +* You can now define a folder (default: `~/.octoprint/watched`) to be watched for newly added GCODE (or -- if slicing + support is enabled -- STL) files to automatically add. +* OctoPrint now has a [plugin system](http://docs.octoprint.org/en/devel/plugins/index.html) which allows extending its + core functionality. ### Improvements * Logging is now configurable via config file * Added last print time to additional GCODE file information +* Better error handling for capture issues during timelapse creation & more robust handling of missing images during + timelapse creation +* Start counting the layers at 1 instead of 0 in the GCODE viewer +* Upgraded [Font Awesome](https://fortawesome.github.io/Font-Awesome/) to version 3.2.1 +* Better error reporting for timelapse rendering and system commands +* Supports ### Bug Fixes * [#435](https://github.com/foosel/OctoPrint/issues/435) - Always interpret negative duration (e.g. for print time left) as 0 +## 1.1.1 (Unreleased) -## 1.1.0 +### Bug Fixes + +* [#580](https://github.com/foosel/OctoPrint/issues/580) - Properly unset job data when instructed so by callers + +## 1.1.0 (2014-09-03) ### New Features @@ -52,7 +69,9 @@ * Support for circular beds in the GCODE viewer ([#407](https://github.com/foosel/OctoPrint/pull/407)) * The dimensions of the print bed can now be configured via the Settings ([#396](https://github.com/foosel/OctoPrint/pull/396)) * Target temperature reporting format of Repetier Firmware is now supported as well ([360](https://github.com/foosel/OctoPrint/issues/360)) -* Version tracking now based on git tagging and [versioneer](https://github.com/warner/python-versioneer/). +* Version tracking now based on git tagging and [versioneer](https://github.com/warner/python-versioneer/). Version number, + git commit and branch get reported in the format `--g ( branch)`, + e.g. `1.2.0-dev-172-ga48b5de (devel branch)`. * Made "Center viewport on model" and "Zoom in on model" in the GCODE viewer automatically deselect and de-apply if viewport gets manipulated by the user ([#398](https://github.com/foosel/OctoPrint/issues/398)) * GCODE viewer now interprets inverted axes for printer control and mirrors print bed accordingly ([#431](https://github.com/foosel/OctoPrint/issues/431)) @@ -92,6 +111,6 @@ ([Commits](https://github.com/foosel/OctoPrint/compare/1.0.0...1.1.0)) -## 1.0.0 +## 1.0.0 (2014-06-22) First release with new versioning scheme. \ No newline at end of file diff --git a/docs/index.rst b/docs/index.rst index 774c6da13..3375a90cb 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -18,4 +18,5 @@ Contents api/index.rst events/index.rst + plugins/index.rst diff --git a/docs/plugins/index.rst b/docs/plugins/index.rst new file mode 100644 index 000000000..c71261c20 --- /dev/null +++ b/docs/plugins/index.rst @@ -0,0 +1,61 @@ +.. _sec-plugins: + +##################### +Plugins Documentation +##################### + +.. contents:: + +Starting with OctoPrint 1.2.0, there's now a plugin system in place which allows to individually +extend OctoPrint's functionality. + +Right now plugins can be used to extend OctoPrint's settings dialog, to execute specific tasks on server startup and +shutdown or to provide custom (API) endpoints with special functionality. More plugin types are planned for the future. + +.. _sec-plugins-installation: + +Installing Plugins +================== + +Plugins can be installed either by unpacking them into one of the configured plugin folders (regularly those are +``/plugins`` and ``~/.octoprint/plugins`` or by installing them as regular python modules via ``pip``. +Please refer to the documentation of the plugin for installations instructions. + +The latter is the more common case since all currently published plugins not bundled with OctoPrint can and should be installed +this way. + +For a plugin available on the Python Package Index (PyPi), the process is as simple as issuing a + +.. code-block:: bash + + pip install + +For plugins not available on PyPi, you'll have to give ``pip`` an URL from which to install the package (e.g. the URL to +a ZIP file of the current master branch of a Github repository hosting a plugin, or even a ``git+https`` URL), example: + +.. code-block:: bash + + pip install https://github.com/OctoPrint/OctoPrint-Growl/archive/master.zip + +See `the pip install documentation `_ for what URL +types are possible. + +.. _sec-plugins-available: + +Available Plugins +================= + +Currently there's no such thing as a centralized plugin repository for available plugins. + +Plugins may be found in the lists provided in `the OctoPrint wiki `_ +and on the `OctoPrint organization Github page `_. + +.. _sec-plugins-developing: + +Developing Plugins +================== + +.. todo:: + + A section on how to develop plugins yourself, including a tutorial creating an exemplatory plugin as well as + a documentation of the plugin API, will be added in the near future. diff --git a/requirements.txt b/requirements.txt index 62301f0ec..121234d55 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,3 +10,4 @@ pyserial netaddr watchdog sarge +netifaces diff --git a/setup.py b/setup.py index 97888129b..d6b6cb4ba 100644 --- a/setup.py +++ b/setup.py @@ -220,7 +220,7 @@ def params(): packages = find_packages(where="src") package_dir = {"octoprint": "src/octoprint"} - package_data = {"octoprint": package_data_dirs('src/octoprint', ['static', 'templates'])} + package_data = {"octoprint": package_data_dirs('src/octoprint', ['static', 'templates', 'plugins'])} include_package_data = True zip_safe = False diff --git a/src/octoprint/events.py b/src/octoprint/events.py index 36ea6dd9b..4a3d2023e 100644 --- a/src/octoprint/events.py +++ b/src/octoprint/events.py @@ -1,21 +1,28 @@ # coding=utf-8 +from __future__ import (print_function, absolute_import) -__author__ = "Lars Norpchen" -__author__ = "Gina Häußge " +__author__ = "Gina Häußge , Lars Norpchen" __license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html' +__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License" import datetime import logging import subprocess import Queue import threading +import collections from octoprint.settings import settings +import octoprint.plugin # singleton _instance = None +def all_events(): + return [name for name in Events.__dict__ if not name.startswith("__")] + + class Events(object): # application startup STARTUP = "Startup" @@ -87,7 +94,7 @@ class EventManager(object): """ def __init__(self): - self._registeredListeners = {} + self._registeredListeners = collections.defaultdict(list) self._logger = logging.getLogger(__name__) self._queue = Queue.PriorityQueue() @@ -99,9 +106,7 @@ class EventManager(object): while True: (event, payload) = self._queue.get(True) - eventListeners = self._registeredListeners.get(event, None) - if eventListeners is None: - return + eventListeners = self._registeredListeners[event] self._logger.debug("Firing event: %s (Payload: %r)" % (event, payload)) for listener in eventListeners: @@ -111,6 +116,10 @@ class EventManager(object): except: self._logger.exception("Got an exception while sending event %s (Payload: %r) to %s" % (event, payload, listener)) + octoprint.plugin.call_plugin(octoprint.plugin.types.EventHandlerPlugin, + "on_event", + args=[event, payload]) + def fire(self, event, payload=None): """ Fire an event to anyone subscribed to it @@ -122,8 +131,6 @@ class EventManager(object): payload being a payload object specific to the event. """ - if not event in self._registeredListeners.keys(): - return self._queue.put((event, payload), 0) def subscribe(self, event, callback): @@ -131,9 +138,6 @@ class EventManager(object): Subscribe a listener to an event -- pass in the event name (as a string) and the callback object """ - if not event in self._registeredListeners.keys(): - self._registeredListeners[event] = [] - if callback in self._registeredListeners[event]: # callback is already subscribed to the event return @@ -146,10 +150,6 @@ class EventManager(object): Unsubscribe a listener from an event -- pass in the event name (as string) and the callback object """ - if not event in self._registeredListeners: - # no callback registered for callback, just return - return - if not callback in self._registeredListeners[event]: # callback not subscribed to event, just return return @@ -293,7 +293,7 @@ class CommandTrigger(GenericEventListener): def _executeGcodeCommand(self, command): commands = [command] if isinstance(command, (list, tuple, set)): - self._logger.debug("Executing GCode commands: %r" % command) + self.logger.debug("Executing GCode commands: %r" % command) commands = list(command) else: self._logger.debug("Executing GCode command: %s" % command) diff --git a/src/octoprint/plugin/__init__.py b/src/octoprint/plugin/__init__.py new file mode 100644 index 000000000..6278b2a1e --- /dev/null +++ b/src/octoprint/plugin/__init__.py @@ -0,0 +1,121 @@ +# coding=utf-8 +from __future__ import absolute_import + +__author__ = "Gina Häußge " +__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html' +__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License" + +import os + +from octoprint.settings import settings +from octoprint.plugin.core import (PluginInfo, PluginManager, Plugin) +from octoprint.plugin.types import * + +# singleton +_instance = None + +def plugin_manager(init=False, plugin_folders=None, plugin_types=None, plugin_entry_points=None): + global _instance + if _instance is None: + if init: + if plugin_folders is None: + plugin_folders = (settings().getBaseFolder("plugins"), os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "plugins"))) + if plugin_types is None: + plugin_types = [StartupPlugin, + ShutdownPlugin, + TemplatePlugin, + SettingsPlugin, + SimpleApiPlugin, + AssetPlugin, + BlueprintPlugin, + EventHandlerPlugin] + if plugin_entry_points is None: + plugin_entry_points = "octoprint.plugin" + + _instance = PluginManager(plugin_folders, plugin_types, plugin_entry_points) + else: + raise ValueError("Plugin Manager not initialized yet") + return _instance + + +def plugin_settings(plugin_key, defaults=None): + return PluginSettings(settings(), plugin_key, defaults=defaults) + + +def call_plugin(types, method, args=None, kwargs=None, callback=None): + if not isinstance(types, (list, tuple)): + types = [types] + if args is None: + args = [] + if kwargs is None: + kwargs = dict() + + plugins = plugin_manager().get_implementations(*types) + for name, plugin in plugins.items(): + if hasattr(plugin, method): + result = getattr(plugin, method)(*args, **kwargs) + if callback: + callback(name, plugin, result) + + +class PluginSettings(object): + def __init__(self, settings, plugin_key, defaults=None): + self.settings = settings + self.plugin_key = plugin_key + + if defaults is None: + defaults = dict() + self.defaults = dict(plugins=dict()) + self.defaults["plugins"][plugin_key] = defaults + + def prefix_path(path): + return ['plugins', self.plugin_key] + path + + def prefix_path_in_args(args, index=0): + result = [] + if index == 0: + result.append(prefix_path(args[0])) + result.extend(args[1:]) + else: + args_before = args[:index - 1] + args_after = args[index + 1:] + result.extend(args_before) + result.append(prefix_path(args[index])) + result.extend(args_after) + return result + + def add_defaults_to_kwargs(kwargs): + kwargs.update(dict(defaults=self.defaults)) + return kwargs + + self.access_methods = { + 'get': (lambda args: prefix_path_in_args(args), lambda kwargs: add_defaults_to_kwargs(kwargs)), + 'getInt': (lambda args,: prefix_path_in_args(args), lambda kwargs: add_defaults_to_kwargs(kwargs)), + 'getFloat': (lambda args,: prefix_path_in_args(args), lambda kwargs: add_defaults_to_kwargs(kwargs)), + 'getBoolean': (lambda args,: prefix_path_in_args(args), lambda kwargs: add_defaults_to_kwargs(kwargs)), + 'set': (lambda args: prefix_path_in_args(args), lambda kwargs: add_defaults_to_kwargs(kwargs)), + 'setInt': (lambda args: prefix_path_in_args(args), lambda kwargs: add_defaults_to_kwargs(kwargs)), + 'setFloat': (lambda args: prefix_path_in_args(args), lambda kwargs: add_defaults_to_kwargs(kwargs)), + 'setBoolean': (lambda args: prefix_path_in_args(args), lambda kwargs: add_defaults_to_kwargs(kwargs)) + } + + def globalGet(self, path): + return self.settings.get(path) + + def globalGetInt(self, path): + return self.settings.getInt(path) + + def globalGetFloat(self, path): + return self.settings.getFloat(path) + + def globalGetBoolean(self, path): + return self.settings.getBoolean(path) + + def __getattr__(self, item): + if item in self.access_methods and hasattr(self.settings, item) and callable(getattr(self.settings, item)): + orig_item = getattr(self.settings, item) + args_mapper, kwargs_mapper = self.access_methods[item] + + return lambda *args, **kwargs: orig_item(*args_mapper(args), **kwargs_mapper(kwargs)) + else: + return getattr(self.settings, item) diff --git a/src/octoprint/plugin/core.py b/src/octoprint/plugin/core.py new file mode 100644 index 000000000..627e9eee5 --- /dev/null +++ b/src/octoprint/plugin/core.py @@ -0,0 +1,268 @@ +# coding=utf-8 +from __future__ import absolute_import + +__author__ = "Gina Häußge " +__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html' +__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License" + + +import os +import imp +from collections import defaultdict +import logging + + +class PluginInfo(object): + + attr_name = '__plugin_name__' + + attr_description = '__plugin_description__' + + attr_version = '__plugin_version__' + + attr_hooks = '__plugin_hooks__' + + attr_implementations = '__plugin_implementations__' + + attr_helpers = '__plugin_helpers__' + + attr_check = '__plugin_check__' + + attr_init = '__plugin_init__' + + def __init__(self, key, location, instance, version=None): + self.key = key + self.location = location + self.instance = instance + + self._version = version + + def __str__(self): + return "{name} ({version})".format(name=self.name, version=self.version if self.version else "unknown") + + def get_hook(self, hook): + if not hook in self.hooks: + return None + return self.hooks[hook] + + def get_implementations(self, *types): + result = set() + for implementation in self.implementations: + matches_all = True + for type in types: + if not isinstance(implementation, type): + matches_all = False + if matches_all: + result.add(implementation) + return result + + @property + def name(self): + return self._get_instance_attribute(self.__class__.attr_name, default=None) + + @property + def description(self): + return self._get_instance_attribute(self.__class__.attr_description, default=None) + + @property + def version(self): + return self._version if self._version is not None else self._get_instance_attribute(self.__class__.attr_version, default=None) + + @property + def hooks(self): + return self._get_instance_attribute(self.__class__.attr_hooks, default={}) + + @property + def implementations(self): + return self._get_instance_attribute(self.__class__.attr_implementations, default=[]) + + @property + def helpers(self): + return self._get_instance_attribute(self.__class__.attr_helpers, default={}) + + @property + def check(self): + return self._get_instance_attribute(self.__class__.attr_check, default=lambda: True) + + @property + def init(self): + return self._get_instance_attribute(self.__class__.attr_init, default=lambda: True) + + def _get_instance_attribute(self, attr, default=None): + if not hasattr(self.instance, attr): + return default + return getattr(self.instance, attr) + + +class PluginManager(object): + + def __init__(self, plugin_folders, plugin_types, plugin_entry_points, plugin_disabled_list=None): + self.logger = logging.getLogger(__name__) + + if plugin_disabled_list is None: + plugin_disabled_list = [] + + self.plugin_folders = plugin_folders + self.plugin_types = plugin_types + self.plugin_entry_points = plugin_entry_points + self.plugin_disabled_list = plugin_disabled_list + + self.plugins = dict() + self.plugin_hooks = defaultdict(list) + self.plugin_implementations = defaultdict(list) + + self.reload_plugins() + + def _find_plugins(self): + plugins = dict() + if self.plugin_folders: + self._add_plugins_from_folders(self.plugin_folders, plugins) + if self.plugin_entry_points: + self._add_plugins_from_entry_points(self.plugin_entry_points, plugins) + return plugins + + def _add_plugins_from_folders(self, folders, plugins): + for folder in folders: + if not os.path.exists(folder): + self.logger.warn("Plugin folder {folder} could not be found, skipping it".format(folder=folder)) + continue + + entries = os.listdir(folder) + for entry in entries: + path = os.path.join(folder, entry) + if os.path.isdir(path) and os.path.isfile(os.path.join(path, "__init__.py")): + key = entry + elif os.path.isfile(path) and entry.endswith(".py"): + key = entry[:-3] # strip off the .py extension + else: + continue + + if self._is_plugin_disabled(key): + # plugin is disabled, ignore it + continue + + if key in plugins: + # plugin is already defined, ignore it + continue + + plugin = self._load_plugin_from_module(key, folder=folder) + if plugin: + plugins[key] = plugin + + return plugins + + def _add_plugins_from_entry_points(self, groups, plugins): + import pkg_resources + + if not isinstance(groups, (list, tuple)): + groups = [groups] + + for group in groups: + for entry_point in pkg_resources.iter_entry_points(group=group, name=None): + key = entry_point.name + module_name = entry_point.module_name + version = entry_point.dist.version + + if self._is_plugin_disabled(key): + # plugin is disabled, ignore it + continue + + if key in plugins: + # plugin is already defined, ignore it + continue + + plugin = self._load_plugin_from_module(key, module_name=module_name, version=version) + if plugin: + plugins[key] = plugin + + return plugins + + def _load_plugin_from_module(self, key, folder=None, module_name=None, version=None): + # TODO error handling + if folder: + module = imp.find_module(key, [folder]) + elif module_name: + module = imp.find_module(module_name) + else: + return None + + plugin = self._load_plugin(key, *module, version=version) + if plugin: + if plugin.check(): + return plugin + else: + self.logger.warn("Plugin \"{plugin}\" did not pass check, disabling it".format(plugin=str(plugin))) + return None + + + def _load_plugin(self, key, f, filename, description, version=None): + try: + instance = imp.load_module(key, f, filename, description) + return PluginInfo(key, filename, instance, version=version) + except: + self.logger.exception("Error loading plugin {key}, disabling it".format(key=key)) + return None + + def _is_plugin_disabled(self, key): + return key in self.plugin_disabled_list or key.endswith('disabled') + + def reload_plugins(self): + self.logger.info("Loading plugins from {folders} and installed plugin packages...".format(folders=", ".join(self.plugin_folders))) + self.plugins = self._find_plugins() + + for name, plugin in self.plugins.items(): + # initialize the plugin + plugin.init() + + # evaluate registered hooks + for hook, callback in plugin.hooks.items(): + self.plugin_hooks[hook].append((name, callback)) + + # evaluate registered implementations + for plugin_type in self.plugin_types: + implementations = plugin.get_implementations(plugin_type) + self.plugin_implementations[plugin_type] += ( (name, implementation) for implementation in implementations ) + + if len(self.plugins) <= 0: + self.logger.info("No plugins found") + else: + self.logger.info("Found {count} plugin(s): {plugins}".format(count=len(self.plugins), plugins=", ".join(map(lambda x: str(x), self.plugins.values())))) + + def get_plugin(self, name): + if not name in self.plugins: + return None + return self.plugins[name].instance + + def get_hooks(self, hook): + if not hook in self.plugin_hooks: + return [] + return {hook[0]: hook[1] for hook in self.plugin_hooks[hook]} + + def get_implementations(self, *types): + result = None + + for t in types: + implementations = self.plugin_implementations[t] + if result is None: + result = set(implementations) + else: + result = result.intersection(implementations) + + if result is None: + return set() + return {impl[0]: impl[1] for impl in result} + + def get_helpers(self, name, *helpers): + if not name in self.plugins: + return None + plugin = self.plugins[name] + + all_helpers = plugin.helpers + if len(helpers): + return dict((k, v) for (k, v) in all_helpers.items() if k in helpers) + else: + return all_helpers + + +class Plugin(object): + pass diff --git a/src/octoprint/plugin/types.py b/src/octoprint/plugin/types.py new file mode 100644 index 000000000..f14039167 --- /dev/null +++ b/src/octoprint/plugin/types.py @@ -0,0 +1,69 @@ +# coding=utf-8 +from __future__ import absolute_import + +__author__ = "Gina Häußge " +__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html' +__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License" + + +from .core import Plugin + + +class StartupPlugin(Plugin): + def on_startup(self, host, port): + pass + + def on_after_startup(self): + pass + + +class ShutdownPlugin(Plugin): + def on_shutdown(self): + pass + + +class AssetPlugin(Plugin): + def get_asset_folder(self): + return None + + def get_assets(self): + return [] + + +class TemplatePlugin(Plugin): + def get_template_vars(self): + return dict() + + def get_template_folder(self): + return None + + +class SimpleApiPlugin(Plugin): + def get_api_commands(self): + return None + + def on_api_command(self, command, data): + return None + + def on_api_get(self, request): + return None + + +class BlueprintPlugin(Plugin): + def get_blueprint(self): + return None + + +class SettingsPlugin(Plugin): + def on_settings_load(self): + return None + + def on_settings_save(self, data): + pass + + +class EventHandlerPlugin(Plugin): + def on_event(self, event, payload): + pass + + diff --git a/src/octoprint/plugins/discovery/__init__.py b/src/octoprint/plugins/discovery/__init__.py new file mode 100644 index 000000000..1268efe25 --- /dev/null +++ b/src/octoprint/plugins/discovery/__init__.py @@ -0,0 +1,690 @@ +# coding=utf-8 +from __future__ import absolute_import + +__author__ = "Gina Häußge " +__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html' +__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License" + +""" +The SSDP/UPNP implementations has been largely inspired by https://gist.github.com/schlamar/2428250 +""" + +import logging +import os +import flask + +import octoprint.plugin +import octoprint.util + +try: + import pybonjour +except: + pybonjour = False + + +__plugin_name__ = "Discovery" +__plugin_version__ = "0.1" +__plugin_description__ = "Makes the OctoPrint instance discoverable via Bonjour/Avahi/Zeroconf and uPnP" + +def __plugin_init__(): + if not pybonjour: + # no pybonjour available, we can't use that + logging.getLogger("octoprint.plugins." + __name__).info("pybonjour is not installed, Zeroconf Discovery won't be available") + + discovery_plugin = DiscoveryPlugin() + + global __plugin_implementations__ + __plugin_implementations__ = [discovery_plugin] + + global __plugin_helpers__ + __plugin_helpers__ = dict( + ssdp_browse=discovery_plugin.ssdp_browse + ) + if pybonjour: + __plugin_helpers__.update(dict( + zeroconf_browse=discovery_plugin.zeroconf_browse, + zeroconf_register=discovery_plugin.zeroconf_register, + zeroconf_unregister=discovery_plugin.zeroconf_unregister + )) + + +default_settings = { + "publicHost": None, + "publicPort": None, + "pathPrefix": None, + "httpUsername": None, + "httpPassword": None, + "upnpUuid": None, + "zeroConf": [], + "model": { + "name": None, + "description": None, + "number": None, + "url": None, + "serial": None, + "vendor": None, + "vendorUrl": None + } +} +s = octoprint.plugin.plugin_settings("discovery", defaults=default_settings) + +def get_uuid(): + upnpUuid = s.get(["upnpUuid"]) + if upnpUuid is None: + import uuid + upnpUuid = str(uuid.uuid4()) + s.set(["upnpUuid"], upnpUuid) + s.save() + return upnpUuid +UUID = get_uuid() +del get_uuid + + +def get_instance_name(): + name = s.globalGet(["appearance", "name"]) + if name: + return "OctoPrint instance \"{}\"".format(name) + else: + import socket + return "OctoPrint instance on {}".format(socket.gethostname()) + + +#~~ custom blueprint for providing discovery.xml + +blueprint = flask.Blueprint("plugin.discovery", __name__, template_folder=os.path.join(os.path.dirname(os.path.realpath(__file__)), "templates")) + +@blueprint.route("/discovery.xml") +def discovery(): + logging.getLogger("octoprint.plugins." + __name__).debug("Rendering discovery.xml") + + modelName = s.get(["model", "name"]) + if not modelName: + import octoprint.server + modelName = octoprint.server.DISPLAY_VERSION + + vendor = s.get(["model", "vendor"]) + vendorUrl = s.get(["model", "vendorUrl"]) + if not vendor: + vendor = "The OctoPrint Project" + vendorUrl = "http://www.octoprint.org/" + + response = flask.make_response(flask.render_template("discovery.jinja2", + friendlyName=get_instance_name(), + manufacturer=vendor, + manufacturerUrl=vendorUrl, + modelName=modelName, + modelDescription=s.get(["model", "description"]), + modelNumber=s.get(["model", "number"]), + modelUrl=s.get(["model", "url"]), + serialNumber=s.get(["model", "serial"]), + uuid=UUID, + presentationUrl=flask.url_for("index", _external=True))) + response.headers['Content-Type'] = 'application/xml' + return response + + +class DiscoveryPlugin(octoprint.plugin.StartupPlugin, + octoprint.plugin.ShutdownPlugin, + octoprint.plugin.BlueprintPlugin): + + ssdp_multicast_addr = "239.255.255.250" + + ssdp_multicast_port = 1900 + + def __init__(self): + self.logger = logging.getLogger("octoprint.plugins." + __name__) + + self.host = None + self.port = None + + # zeroconf + self._sd_refs = dict() + self._cnames = dict() + + # upnp/ssdp + self._ssdp_monitor_active = False + self._ssdp_monitor_thread = None + self._ssdp_notify_timeout = 10 + self._ssdp_last_notify = 0 + + ##~~ BlueprintPlugin API -- used for providing the SSDP device descriptor XML + + def get_blueprint(self): + return blueprint + + ##~~ StartupPlugin API -- used for registering OctoPrint's Zeroconf and SSDP services upon application startup + + def on_startup(self, host, port): + public_host = s.get(["publicHost"]) + if public_host: + host = public_host + public_port = s.get(["publicPort"]) + if public_port: + port = public_port + + self.host = host + self.port = port + + # Zeroconf + self.zeroconf_register("_http._tcp", get_instance_name(), txt_record=self._create_http_txt_record_dict()) + self.zeroconf_register("_octoprint._tcp", get_instance_name(), txt_record=self._create_octoprint_txt_record_dict()) + for zeroconf in s.get(["zeroConf"]): + if "service" in zeroconf: + self.zeroconf_register( + zeroconf["service"], + zeroconf["name"] if "name" in zeroconf else get_instance_name(), + port=zeroconf["port"] if "port" in zeroconf else None, + txt_record=zeroconf["txtRecord"] if "txtRecord" in zeroconf else None + ) + + # SSDP + self._ssdp_register() + + ##~~ ShutdownPlugin API -- used for unregistering OctoPrint's Zeroconf and SSDP service upon application shutdown + + def on_shutdown(self): + for key in self._sd_refs: + reg_type, port = key + self.zeroconf_unregister(reg_type, port) + + self._ssdp_unregister() + + ##~~ helpers + + # ZeroConf + + def zeroconf_register(self, reg_type, name=None, port=None, txt_record=None): + """ + Registers a new service with Zeroconf/Bonjour/Avahi. + + :param reg_type: type of service to register, e.g. "_gntp._tcp" + :param name: displayable name of the service, if not given defaults to the OctoPrint instance name + :param port: port to register for the service, if not given defaults to OctoPrint's (public) port + :param txt_record: optional txt record to attach to the service, dictionary of key-value-pairs + """ + + if not pybonjour: + return + + if not name: + name = get_instance_name() + if not port: + port = self.port + + params = dict( + name=name, + regtype=reg_type, + port=port + ) + if txt_record: + params["txtRecord"] = pybonjour.TXTRecord(txt_record) + + key = (reg_type, port) + self._sd_refs[key] = pybonjour.DNSServiceRegister(**params) + self.logger.info("Registered {name} for {reg_type}".format(**locals())) + + def zeroconf_unregister(self, reg_type, port=None): + """ + Unregisteres a previously registered Zeroconf/Bonjour/Avahi service identified by service and port. + + :param reg_type: the type of the service to be unregistered + :param port: the port of the service to be unregistered, defaults to OctoPrint's (public) port if not given + :return: + """ + + if not pybonjour: + return + + if not port: + port = self.port + + key = (reg_type, port) + if not key in self._sd_refs: + return + + sd_ref = self._sd_refs[key] + try: + sd_ref.close() + self.logger.debug("Unregistered {reg_type} on port {port}".format(reg_type=reg_type, port=port)) + except: + self.logger.exception("Could not unregister {reg_type} on port {port}".format(reg_type=reg_type, port=port)) + + def zeroconf_browse(self, service_type, block=True, callback=None, browse_timeout=5, resolve_timeout=5): + """ + Browses for services on the local network providing the specified service type. Can be used either blocking or + non-blocking. + + The non-blocking version (default behaviour) will not return until the lookup has completed and + return all results that were found. + + For non-blocking version, set `block` to `False` and provide a `callback` to be called once the lookup completes. + If no callback is provided in non-blocking mode, a ValueError will be raised. + + The results are provided as a list of discovered services, with each service being described by a dictionary + with the following keys: + + * `name`: display name of the service + * `host`: host name of the service + * `post`: port the service is listening on + * `txt_record`: TXT record of the service as a dictionary, exact contents depend on the service + + Callbacks will be called with that list as the single parameter supplied to them. Thus, the following is an + example for a valid callback: + + def browse_callback(results): + for result in results: + print "Name: {name}, Host: {host}, Port: {port}, TXT: {txt_record!r}".format(**result) + + :param service_type: the service type to browse for + :param block: whether to block, defaults to True + :param callback: callback to call once lookup has completed, must be set when `block` is set to `False` + :param browse_timeout: timeout for browsing operation + :param resolve_timeout: timeout for resolving operations for discovered records + :return: if `block` is `True` a list of the discovered services, an empty list otherwise (results will then be + supplied to the callback instead) + """ + + if not pybonjour: + return None + + import threading + import select + + if not block and not callback: + raise ValueError("Non-blocking mode but no callback given") + + result = [] + result_available = threading.Event() + result_available.clear() + + resolved = [] + + def resolve_callback(sd_ref, flags, interface_index, error_code, fullname, hosttarget, port, txt_record): + if error_code == pybonjour.kDNSServiceErr_NoError: + txt_record_dict = None + if txt_record: + record = pybonjour.TXTRecord.parse(txt_record) + txt_record_dict = dict() + for key, value in record: + txt_record_dict[key] = value + + name = fullname[:fullname.find(service_type) - 1].replace("\\032", " ") + host = hosttarget[:-1] + + self.logger.debug("Resolved a result for Zeroconf resolution of {service_type}: {name} @ {host}".format(service_type=service_type, name=name, host=host)) + result.append(dict( + name=name, + host=host, + port=port, + txt_record=txt_record_dict + )) + resolved.append(True) + + def browse_callback(sd_ref, flags, interface_index, error_code, service_name, regtype, reply_domain): + if error_code != pybonjour.kDNSServiceErr_NoError: + return + + if not (flags & pybonjour.kDNSServiceFlagsAdd): + return + + self.logger.debug("Got a browsing result for Zeroconf resolution of {service_type}, resolving...".format(service_type=service_type)) + resolve_ref = pybonjour.DNSServiceResolve(0, interface_index, service_name, regtype, reply_domain, resolve_callback) + + try: + while not resolved: + ready = select.select([resolve_ref], [], [], resolve_timeout) + if resolve_ref not in ready[0]: + break + + pybonjour.DNSServiceProcessResult(resolve_ref) + else: + resolved.pop() + finally: + resolve_ref.close() + + self.logger.debug("Browsing Zeroconf for {service_type}".format(service_type=service_type)) + + def browse(): + sd_ref = pybonjour.DNSServiceBrowse(regtype=service_type, callBack=browse_callback) + try: + while True: + ready = select.select([sd_ref], [], [], browse_timeout) + + if not ready[0]: + break + + if sd_ref in ready[0]: + pybonjour.DNSServiceProcessResult(sd_ref) + finally: + sd_ref.close() + + if callback: + callback(result) + result_available.set() + + browse_thread = threading.Thread(target=browse) + browse_thread.daemon = True + browse_thread.start() + + if block: + result_available.wait() + return result + else: + return [] + + # SSDP/UPNP + + def ssdp_browse(self, query, block=True, callback=None, timeout=1, retries=5): + """ + Browses for UPNP services matching the supplied query. Can be used either blocking or + non-blocking. + + The non-blocking version (default behaviour) will not return until the lookup has completed and + return all results that were found. + + For non-blocking version, set `block` to `False` and provide a `callback` to be called once the lookup completes. + If no callback is provided in non-blocking mode, a ValueError will be raised. + + The results are provided as a list of discovered locations of device descriptor files. + + Callbacks will be called with that list as the single parameter supplied to them. Thus, the following is an + example for a valid callback: + + def browse_callback(results): + for result in results: + print "Location: {}".format(result) + + :param query: the SSDP query to send, e.g. "upnp:rootdevice" to search for all devices + :param block: whether to block, defaults to True + :param callback: callback to call in non-blocking mode when lookup has finished, must be set if block is False + :param timeout: timeout in seconds to wait for replies to the M-SEARCH query per interface, defaults to 1 + :param retries: number of retries to perform the lookup on all interfaces, defaults to 5 + :return: if `block` is `True` a list of the discovered devices, an empty list otherwise (results will then be + supplied to the callback instead) + """ + + import threading + + import httplib + import io + class Response(httplib.HTTPResponse): + def __init__(self, response_text): + self.fp = io.BytesIO(response_text) + self.debuglevel = 0 + self.strict = 0 + self.msg = None + self._method = None + self.begin() + + result = [] + result_available = threading.Event() + result_available.clear() + + def browse(): + import socket + + socket.setdefaulttimeout(timeout) + + search_message = "".join([ + "M-SEARCH * HTTP/1.1\r\n", + "ST: {query}\r\n", + "MX: 3\r\n", + "MAN: \"ssdp:discovery\"\r\n", + "HOST: {mcast_addr}:{mcast_port}\r\n\r\n" + ]) + + for _ in xrange(retries): + for addr in octoprint.util.interface_addresses(): + try: + sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP) + sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) + sock.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, 2) + sock.bind((addr, 0)) + + message = search_message.format(query=query, + mcast_addr=self.__class__.ssdp_multicast_addr, + mcast_port=self.__class__.ssdp_multicast_port) + for _ in xrange(2): + sock.sendto(message, (self.__class__.ssdp_multicast_addr, self.__class__.ssdp_multicast_port)) + + try: + data = sock.recv(1024) + except socket.timeout: + pass + else: + response = Response(data) + + result.append(response.getheader("Location")) + except: + pass + + if callback: + callback(result) + result_available.set() + + browse_thread = threading.Thread(target=browse) + browse_thread.daemon = True + browse_thread.start() + + if block: + result_available.wait() + return result + else: + return [] + + ##~~ internals + + # Zeroconf + + def _create_http_txt_record_dict(self): + """ + Creates a TXT record for the _http._tcp Zeroconf service supplied by this OctoPrint instance. + + Defines the keys for _http._tcp as defined in http://www.dns-sd.org/txtrecords.html + + :return: a dictionary containing the defined key-value-pairs, ready to be turned into a TXT record + """ + + # determine path entry + path = "/" + if s.get(["pathPrefix"]): + path = s.get(["pathPrefix"]) + else: + prefix = s.globalGet(["server", "reverseProxy", "prefixFallback"]) + if prefix: + path = prefix + + # fetch username and password (if set) + username = s.get(["httpUsername"]) + password = s.get(["httpPassword"]) + + entries = dict( + path=path + ) + + if username and password: + entries.update(dict(u=username, p=password)) + + return entries + + def _create_octoprint_txt_record_dict(self): + """ + Creates a TXT record for the _octoprint._tcp Zeroconf service supplied by this OctoPrint instance. + + The following keys are defined: + + * `path`: path prefix to actual OctoPrint instance, inherited from _http._tcp + * `u`: username if HTTP Basic Auth is used, optional, inherited from _http._tcp + * `p`: password if HTTP Basic Auth is used, optional, inherited from _http._tcp + * `version`: OctoPrint software version + * `api`: OctoPrint API version + * `model`: Model of the device that is running OctoPrint + * `vendor`: Vendor of the device that is running OctoPrint + + :return: a dictionary containing the defined key-value-pairs, ready to be turned into a TXT record + """ + + entries = self._create_http_txt_record_dict() + + import octoprint.server + import octoprint.server.api + + entries.update(dict( + version=octoprint.server.VERSION, + api=octoprint.server.api.VERSION, + )) + + modelName = s.get(["model", "name"]) + if modelName: + entries.update(dict(model=modelName)) + vendor = s.get(["model", "vendor"]) + if vendor: + entries.update(dict(vendor=vendor)) + + return entries + + # SSDP/UPNP + + def _ssdp_register(self): + """ + Registers the OctoPrint instance as basic service with a presentation URL pointing to the web interface + """ + + import threading + + self._ssdp_monitor_active = True + + self._ssdp_monitor_thread = threading.Thread(target=self._ssdp_monitor, kwargs=dict(timeout=self._ssdp_notify_timeout)) + self._ssdp_monitor_thread.daemon = True + self._ssdp_monitor_thread.start() + + def _ssdp_unregister(self): + """ + Unregisters the OctoPrint instance again + """ + + self._ssdp_monitor_active = False + if self.host and self.port: + for _ in xrange(2): + self._ssdp_notify(alive=False) + + def _ssdp_notify(self, alive=True): + """ + Sends an SSDP notify message across the connected networks. + + :param alive: True to send an "ssdp:alive" message, False to send an "ssdp:byebye" message + """ + + import socket + import time + + if alive and self._ssdp_last_notify + self._ssdp_notify_timeout > time.time(): + # we just sent an alive, no need to send another one now + return + + if alive and not self._ssdp_monitor_active: + # the monitor already shut down, alive messages don't make sense anymore as byebye will shortly follow + return + + for addr in octoprint.util.interface_addresses(): + try: + sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP) + sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) + sock.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, 2) + sock.bind((addr, 0)) + + location = "http://{addr}:{port}/plugin/discovery/discovery.xml".format(addr=addr, port=self.port) + + self.logger.debug("Sending NOTIFY {} via {}".format("alive" if alive else "byebye", addr)) + notify_message = "".join([ + "NOTIFY * HTTP/1.1\r\n", + "Server: Python/2.7\r\n", + "Cache-Control: max-age=900\r\n", + "Location: {location}\r\n", + "NTS: {nts}\r\n", + "NT: upnp:rootdevice\r\n", + "USN: uuid:{uuid}::upnp:rootdevice\r\n", + "HOST: {mcast_addr}:{mcast_port}\r\n\r\n" + ]) + message = notify_message.format(uuid=UUID, + location=location, + nts="ssdp:alive" if alive else "ssdp:byebye", + mcast_addr=self.__class__.ssdp_multicast_addr, + mcast_port=self.__class__.ssdp_multicast_port) + for _ in xrange(2): + # send twice, stuff might get lost, it's only UDP + sock.sendto(message, (self.__class__.ssdp_multicast_addr, self.__class__.ssdp_multicast_port)) + except: + pass + + self._ssdp_last_notify = time.time() + + def _ssdp_monitor(self, timeout=5): + """ + Monitor thread that listens on the multicast address for M-SEARCH requests and answers them if they are relevant + + :param timeout: timeout after which to stop waiting for M-SEARCHs for a short while in order to put out an + alive message + """ + + from BaseHTTPServer import BaseHTTPRequestHandler + from StringIO import StringIO + import socket + + socket.setdefaulttimeout(timeout) + + location_message = "".join([ + "HTTP/1.1 200 OK\r\n", + "ST: upnp:rootdevice\r\n", + "USN: uuid:{uuid}::upnp:rootdevice\r\n", + "Location: {location}\r\n", + "Cache-Control: max-age=60\r\n\r\n" + ]) + + class Request(BaseHTTPRequestHandler): + + def __init__(self, request_text): + self.rfile = StringIO(request_text) + self.raw_requestline = self.rfile.readline() + self.error_code = self.error_message = None + self.parse_request() + + def send_error(self, code, message=None): + self.error_code = code + self.error_message = message + + sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP) + sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) + sock.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, 2) + sock.bind(('', self.__class__.ssdp_multicast_port)) + + sock.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, socket.inet_aton(self.__class__.ssdp_multicast_addr) + socket.inet_aton('0.0.0.0')) + + self.logger.info("Registered {} for SSDP".format(get_instance_name())) + + self._ssdp_notify(alive=True) + + try: + while (self._ssdp_monitor_active): + try: + data, address = sock.recvfrom(4096) + request = Request(data) + if not request.error_code and request.command == "M-SEARCH" and request.path == "*" and (request.headers["ST"] == "upnp:rootdevice" or request.headers["ST"] == "ssdp:all") and request.headers["MAN"] == '"ssdp:discover"': + interface_address = octoprint.util.address_for_client(*address) + if not interface_address: + self.logger.warn("Can't determine address to user for client {}, not sending a M-SEARCH reply".format(address)) + continue + message = location_message.format(uuid=UUID, location="http://{host}:{port}/plugin/discovery/discovery.xml".format(host=interface_address, port=self.port)) + sock.sendto(message, address) + self.logger.debug("Sent M-SEARCH reply for {path} and {st} to {address!r}".format(path=request.path, st=request.headers["ST"], address=address)) + except socket.timeout: + pass + finally: + self._ssdp_notify(alive=True) + finally: + try: + sock.close() + except: + pass + + diff --git a/src/octoprint/plugins/discovery/templates/discovery.jinja2 b/src/octoprint/plugins/discovery/templates/discovery.jinja2 new file mode 100644 index 000000000..413c84f7a --- /dev/null +++ b/src/octoprint/plugins/discovery/templates/discovery.jinja2 @@ -0,0 +1,22 @@ + + + + 1 + 0 + + + urn:schemas-upnp-org:device:Basic:1 + {{ friendlyName }} + {{ manufacturer }} + {% if manufacturerUrl %}{{ manufacturerUrl }}{% endif %} + {{ modelName }} + {% if modelDescription %}{{ modelDescription }}{% endif %} + {% if modelNumber %}{{ modelNumber }}{% endif %} + {% if modelUrl %}{{ modelUrl }}{% endif %} + {% if serialNumber %}{{ serialNumber }}{% endif %} + uuid:{{ uuid }} + + + {{ presentationUrl }} + + \ No newline at end of file diff --git a/src/octoprint/printer.py b/src/octoprint/printer.py index 8067d32bd..7129424d7 100644 --- a/src/octoprint/printer.py +++ b/src/octoprint/printer.py @@ -503,6 +503,17 @@ class Printer(): } else: self._selectedFile = None + self._stateMonitor.setJobData({ + "file": { + "name": None, + "origin": None, + "size": None, + "date": None + }, + "estimatedPrintTime": None, + "filament": None, + }) + return estimatedPrintTime = None lastPrintTime = None diff --git a/src/octoprint/server/__init__.py b/src/octoprint/server/__init__.py index 00099ab82..914bb0ee5 100644 --- a/src/octoprint/server/__init__.py +++ b/src/octoprint/server/__init__.py @@ -7,7 +7,7 @@ __copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms import uuid from sockjs.tornado import SockJSRouter -from flask import Flask, render_template, send_from_directory, g, request +from flask import Flask, render_template, send_from_directory, g, request, make_response from flask.ext.login import LoginManager from flask.ext.principal import Principal, Permission, RoleNeed, identity_loaded, UserNeed from flask.ext.babel import Babel @@ -17,6 +17,7 @@ from watchdog.observers import Observer import os import logging import logging.config +import atexit SUCCESS = {} NO_CONTENT = ("", 204) @@ -30,6 +31,7 @@ gcodeManager = None userManager = None eventManager = None loginManager = None +pluginManager = None principals = Principal(app) admin_permission = Permission(RoleNeed("admin")) @@ -41,6 +43,7 @@ from octoprint.settings import settings import octoprint.gcodefiles as gcodefiles import octoprint.users as users import octoprint.events as events +import octoprint.plugin import octoprint.timelapse import octoprint._version import octoprint.util @@ -88,6 +91,16 @@ def get_locale(): @app.route("/") def index(): + settings_plugins = pluginManager.get_implementations(octoprint.plugin.TemplatePlugin, octoprint.plugin.SettingsPlugin) + settings_plugin_template_vars = dict() + for name, implementation in settings_plugins.items(): + settings_plugin_template_vars[name] = implementation.get_template_vars() + + asset_plugins = pluginManager.get_implementations(octoprint.plugin.AssetPlugin) + asset_plugin_urls = dict() + for name, implementation in asset_plugins.items(): + asset_plugin_urls[name] = implementation.get_assets() + return render_template( "index.jinja2", webcamStream=settings().get(["webcam", "stream"]), @@ -104,7 +117,9 @@ def index(): stylesheet=settings().get(["devel", "stylesheet"]), gcodeMobileThreshold=settings().get(["gcodeViewer", "mobileSizeThreshold"]), gcodeThreshold=settings().get(["gcodeViewer", "sizeThreshold"]), - uiApiKey=UI_API_KEY + uiApiKey=UI_API_KEY, + settingsPlugins=settings_plugin_template_vars, + assetPlugins=asset_plugin_urls ) @@ -113,6 +128,20 @@ def robotsTxt(): return send_from_directory(app.static_folder, "robots.txt") +@app.route("/plugin_assets//") +def plugin_assets(name, filename): + asset_plugins = pluginManager.get_implementations(octoprint.plugin.AssetPlugin) + + if not name in asset_plugins: + return make_response("Asset not found", 404) + asset_plugin = asset_plugins[name] + asset_folder = asset_plugin.get_asset_folder() + if asset_folder is None: + return make_response("Asset not found", 404) + + return send_from_directory(asset_folder, filename) + + @identity_loaded.connect_via(app) def on_identity_loaded(sender, identity): user = load_user(identity.id) @@ -155,6 +184,7 @@ class Server(): global userManager global eventManager global loginManager + global pluginManager global debug from tornado.ioloop import IOLoop @@ -174,6 +204,23 @@ class Server(): eventManager = events.eventManager() gcodeManager = gcodefiles.GcodeManager() printer = Printer(gcodeManager) + pluginManager = octoprint.plugin.plugin_manager(init=True) + + # configure additional template folders for jinja2 + template_plugins = pluginManager.get_implementations(octoprint.plugin.TemplatePlugin) + additional_template_folders = [] + for plugin in template_plugins.values(): + folder = plugin.get_template_folder() + if folder is not None: + additional_template_folders.append(plugin.get_template_folder()) + + import jinja2 + jinja_loader = jinja2.ChoiceLoader([ + app.jinja_loader, + jinja2.FileSystemLoader(additional_template_folders) + ]) + app.jinja_loader = jinja_loader + del jinja2 # configure timelapse octoprint.timelapse.configureTimelapse() @@ -213,13 +260,18 @@ class Server(): if self._port is None: self._port = settings().getInt(["server", "port"]) - logger.info("Listening on http://%s:%d" % (self._host, self._port)) app.debug = self._debug from octoprint.server.api import api + # register API blueprint app.register_blueprint(api, url_prefix="/api") + # also register any blueprints defined in BlueprintPlugins + octoprint.plugin.call_plugin(octoprint.plugin.types.BlueprintPlugin, + "get_blueprint", + callback=lambda name, _, blueprint: app.register_blueprint(blueprint, url_prefix="/plugin/{name}".format(name=name))) + self._router = SockJSRouter(self._createSocketConnection, "/sockjs") upload_suffixes = dict(name=settings().get(["server", "uploads", "nameSuffix"]), path=settings().get(["server", "uploads", "pathSuffix"])) @@ -249,16 +301,45 @@ class Server(): observer.schedule(util.watchdog.UploadCleanupWatchdogHandler(gcodeManager), settings().getBaseFolder("uploads")) observer.start() - try: - IOLoop.instance().start() - except KeyboardInterrupt: + ioloop = IOLoop.instance() + + # run our startup plugins + octoprint.plugin.call_plugin(octoprint.plugin.StartupPlugin, + "on_startup", + args=(self._host, self._port)) + + # prepare our after startup function + def on_after_startup(): + logger.info("Listening on http://%s:%d" % (self._host, self._port)) + + # now this is somewhat ugly, but the issue is the following: startup plugins might want to do things for + # which they need the server to be already alive (e.g. for being able to resolve urls, such as favicons + # or service xmls or the like). While they are working though the ioloop would block. Therefore we'll + # create a single use thread in which to perform our after-startup-tasks, start that and hand back + # control to the ioloop + def work(): + octoprint.plugin.call_plugin(octoprint.plugin.StartupPlugin, + "on_after_startup") + import threading + threading.Thread(target=work).start() + ioloop.add_callback(on_after_startup) + + # prepare our shutdown function + def on_shutdown(): logger.info("Goodbye!") + observer.stop() + observer.join() + octoprint.plugin.call_plugin(octoprint.plugin.ShutdownPlugin, + "on_shutdown") + atexit.register(on_shutdown) + + try: + ioloop.start() + except KeyboardInterrupt: + pass except: logger.fatal("Now that is embarrassing... Something really really went wrong here. Please report this including the stacktrace below in OctoPrint's bugtracker. Thanks!") logger.exception("Stacktrace follows:") - finally: - observer.stop() - observer.join() def _createSocketConnection(self, session): global printer, gcodeManager, userManager, eventManager diff --git a/src/octoprint/server/api/__init__.py b/src/octoprint/server/api/__init__.py index ab60eb440..a8c98cad7 100644 --- a/src/octoprint/server/api/__init__.py +++ b/src/octoprint/server/api/__init__.py @@ -16,6 +16,7 @@ from flask.ext.principal import Identity, identity_changed, AnonymousIdentity import octoprint.util as util import octoprint.users import octoprint.server +import octoprint.plugin from octoprint.server import admin_permission, NO_CONTENT, UI_API_KEY from octoprint.settings import settings as s, valid_boolean_trues from octoprint.server.util import get_api_key, get_user_for_apikey @@ -107,6 +108,44 @@ def afterApiRequests(resp): return resp +#~~ data from plugins + +@api.route("/plugin/", methods=["GET"]) +def pluginData(name): + api_plugins = octoprint.plugin.plugin_manager().get_implementations(octoprint.plugin.SimpleApiPlugin) + if not name in api_plugins: + return make_response("Not found", 404) + + api_plugin = api_plugins[name] + response = api_plugin.on_api_get(request) + + if response is not None: + return response + return NO_CONTENT + +#~~ commands for plugins + +@api.route("/plugin/", methods=["POST"]) +@restricted_access +def pluginCommand(name): + api_plugins = octoprint.plugin.plugin_manager().get_implementations(octoprint.plugin.SimpleApiPlugin) + if not name in api_plugins: + return make_response("Not found", 404) + + api_plugin = api_plugins[name] + valid_commands = api_plugin.get_api_commands() + if valid_commands is None: + return make_response("Method not allowed", 405) + + command, data, response = util.getJsonCommandFromRequest(request, valid_commands) + if response is not None: + return response + + response = api_plugin.on_api_command(command, data) + if response is not None: + return response + return NO_CONTENT + #~~ first run setup diff --git a/src/octoprint/server/api/settings.py b/src/octoprint/server/api/settings.py index bcfc21682..63ed8eb08 100644 --- a/src/octoprint/server/api/settings.py +++ b/src/octoprint/server/api/settings.py @@ -16,6 +16,8 @@ from octoprint.server import admin_permission from octoprint.server.api import api from octoprint.server.util.flask import restricted_access +import octoprint.plugin + #~~ settings @@ -29,7 +31,7 @@ def getSettings(): connectionOptions = getConnectionOptions() - return jsonify({ + data = { "api": { "enabled": s.getBoolean(["api", "enabled"]), "key": s.get(["api", "key"]), @@ -102,7 +104,21 @@ def getSettings(): "path": s.get(["cura", "path"]), "config": s.get(["cura", "config"]) } - }) + } + + def process_plugin_result(name, plugin, result): + if result: + if not "plugins" in data: + data["plugins"] = dict() + if "__enabled" in result: + del result["__enabled"] + data["plugins"][name] = result + + octoprint.plugin.call_plugin(octoprint.plugin.SettingsPlugin, + "on_settings_load", + callback=process_plugin_result) + + return jsonify(data) @api.route("/settings", methods=["POST"]) @@ -204,6 +220,12 @@ def setSettings(): enabled = cura.get("enabled") s.setBoolean(["cura", "enabled"], enabled) + if "plugins" in data: + for name, plugin in octoprint.plugin.plugin_manager().get_implementations(octoprint.plugin.SettingsPlugin).items(): + if name in data["plugins"]: + plugin.on_settings_save(data["plugins"][name]) + + s.save() return getSettings() diff --git a/src/octoprint/server/util/sockjs.py b/src/octoprint/server/util/sockjs.py index 8f4a49a95..a39b565f1 100644 --- a/src/octoprint/server/util/sockjs.py +++ b/src/octoprint/server/util/sockjs.py @@ -15,10 +15,6 @@ from octoprint.events import Events class PrinterStateConnection(sockjs.tornado.SockJSConnection): - EVENTS = [Events.UPDATED_FILES, Events.METADATA_ANALYSIS_FINISHED, Events.MOVIE_RENDERING, Events.MOVIE_DONE, - Events.MOVIE_FAILED, Events.SLICING_STARTED, Events.SLICING_DONE, Events.SLICING_FAILED, - Events.TRANSFER_STARTED, Events.TRANSFER_DONE] - def __init__(self, printer, gcodeManager, userManager, eventManager, session): sockjs.tornado.SockJSConnection.__init__(self, session) @@ -54,7 +50,7 @@ class PrinterStateConnection(sockjs.tornado.SockJSConnection): octoprint.timelapse.registerCallback(self) self._eventManager.fire(Events.CLIENT_OPENED, {"remoteAddress": remoteAddress}) - for event in PrinterStateConnection.EVENTS: + for event in octoprint.events.all_events(): self._eventManager.subscribe(event, self._onEvent) octoprint.timelapse.notifyCallbacks(octoprint.timelapse.current) @@ -66,7 +62,7 @@ class PrinterStateConnection(sockjs.tornado.SockJSConnection): octoprint.timelapse.unregisterCallback(self) self._eventManager.fire(Events.CLIENT_CLOSED) - for event in PrinterStateConnection.EVENTS: + for event in octoprint.events.all_events(): self._eventManager.unsubscribe(event, self._onEvent) def on_message(self, message): diff --git a/src/octoprint/server/util/tornado.py b/src/octoprint/server/util/tornado.py index 735489d12..b88fe27e8 100644 --- a/src/octoprint/server/util/tornado.py +++ b/src/octoprint/server/util/tornado.py @@ -710,7 +710,7 @@ class LargeResponseHandler(tornado.web.StaticFileHandler): CHUNK_SIZE = 16 * 1024 def initialize(self, path, default_filename=None, as_attachment=False, access_validation=None): - tornado.web.StaticFileHandler.initialize(self, path, default_filename) + tornado.web.StaticFileHandler.initialize(self, os.path.abspath(path), default_filename) self._as_attachment = as_attachment self._access_validation = access_validation diff --git a/src/octoprint/settings.py b/src/octoprint/settings.py index 9893d4406..75aff7d5c 100644 --- a/src/octoprint/settings.py +++ b/src/octoprint/settings.py @@ -110,7 +110,8 @@ default_settings = { "timelapse_tmp": None, "logs": None, "virtualSd": None, - "watched": None + "watched": None, + "plugins": None }, "temperature": { "profiles": @@ -171,6 +172,7 @@ default_settings = { { "name": "Suppress M105 requests/responses", "regex": "(Send: M105)|(Recv: ok T\d*:)" }, { "name": "Suppress M27 requests/responses", "regex": "(Send: M27)|(Recv: SD printing byte)" } ], + "plugins": {}, "devel": { "stylesheet": "css", "virtualPrinter": { @@ -244,11 +246,89 @@ class Settings(object): if not self._config: return - dirty = False - for migrate in (self._migrate_event_config, self._migrate_reverse_proxy_config): - dirty = migrate() or dirty - if dirty: + if "events" in self._config.keys() and ("gcodeCommandTrigger" in self._config["events"] or "systemCommandTrigger" in self._config["events"]): + self._logger.info("Migrating config (event subscriptions)...") + + # migrate event hooks to new format + placeholderRe = re.compile("%\((.*?)\)s") + + eventNameReplacements = { + "ClientOpen": "ClientOpened", + "TransferStart": "TransferStarted" + } + payloadDataReplacements = { + "Upload": {"data": "{file}", "filename": "{file}"}, + "Connected": {"data": "{port} at {baudrate} baud"}, + "FileSelected": {"data": "{file}", "filename": "{file}"}, + "TransferStarted": {"data": "{remote}", "filename": "{remote}"}, + "TransferDone": {"data": "{remote}", "filename": "{remote}"}, + "ZChange": {"data": "{new}"}, + "CaptureStart": {"data": "{file}"}, + "CaptureDone": {"data": "{file}"}, + "MovieDone": {"data": "{movie}", "filename": "{gcode}"}, + "Error": {"data": "{error}"}, + "PrintStarted": {"data": "{file}", "filename": "{file}"}, + "PrintDone": {"data": "{file}", "filename": "{file}"}, + } + + def migrateEventHook(event, command): + # migrate placeholders + command = placeholderRe.sub("{__\\1}", command) + + # migrate event names + if event in eventNameReplacements: + event = eventNameReplacements["event"] + + # migrate payloads to more specific placeholders + if event in payloadDataReplacements: + for key in payloadDataReplacements[event]: + command = command.replace("{__%s}" % key, payloadDataReplacements[event][key]) + + # return processed tuple + return event, command + + disableSystemCommands = False + if "systemCommandTrigger" in self._config["events"] and "enabled" in self._config["events"]["systemCommandTrigger"]: + disableSystemCommands = not self._config["events"]["systemCommandTrigger"]["enabled"] + + disableGcodeCommands = False + if "gcodeCommandTrigger" in self._config["events"] and "enabled" in self._config["events"]["gcodeCommandTrigger"]: + disableGcodeCommands = not self._config["events"]["gcodeCommandTrigger"]["enabled"] + + disableAllCommands = disableSystemCommands and disableGcodeCommands + newEvents = { + "enabled": not disableAllCommands, + "subscriptions": [] + } + + if "systemCommandTrigger" in self._config["events"] and "subscriptions" in self._config["events"]["systemCommandTrigger"]: + for trigger in self._config["events"]["systemCommandTrigger"]["subscriptions"]: + if not ("event" in trigger and "command" in trigger): + continue + + newTrigger = {"type": "system"} + if disableSystemCommands and not disableAllCommands: + newTrigger["enabled"] = False + + newTrigger["event"], newTrigger["command"] = migrateEventHook(trigger["event"], trigger["command"]) + newEvents["subscriptions"].append(newTrigger) + + if "gcodeCommandTrigger" in self._config["events"] and "subscriptions" in self._config["events"]["gcodeCommandTrigger"]: + for trigger in self._config["events"]["gcodeCommandTrigger"]["subscriptions"]: + if not ("event" in trigger and "command" in trigger): + continue + + newTrigger = {"type": "gcode"} + if disableGcodeCommands and not disableAllCommands: + newTrigger["enabled"] = False + + newTrigger["event"], newTrigger["command"] = migrateEventHook(trigger["event"], trigger["command"]) + newTrigger["command"] = newTrigger["command"].split(",") + newEvents["subscriptions"].append(newTrigger) + + self._config["events"] = newEvents self.save(force=True) + self._logger.info("Migrated %d event subscriptions to new format and structure" % len(newEvents["subscriptions"])) def _migrate_reverse_proxy_config(self): if "server" in self._config.keys() and ("baseUrl" in self._config["server"] or "scheme" in self._config["server"]): @@ -371,12 +451,13 @@ class Settings(object): #~~ getter - def get(self, path, asdict=False): + def get(self, path, asdict=False, defaults=None): if len(path) == 0: return None config = self._config - defaults = default_settings + if defaults is None: + defaults = default_settings while len(path) > 1: key = path.pop(0) @@ -420,8 +501,8 @@ class Settings(object): else: return results - def getInt(self, path): - value = self.get(path) + def getInt(self, path, defaults=None): + value = self.get(path, defaults=defaults) if value is None: return None @@ -431,8 +512,8 @@ class Settings(object): self._logger.warn("Could not convert %r to a valid integer when getting option %r" % (value, path)) return None - def getFloat(self, path): - value = self.get(path) + def getFloat(self, path, defaults=None): + value = self.get(path, defaults=defaults) if value is None: return None @@ -442,8 +523,8 @@ class Settings(object): self._logger.warn("Could not convert %r to a valid integer when getting option %r" % (value, path)) return None - def getBoolean(self, path): - value = self.get(path) + def getBoolean(self, path, defaults=None): + value = self.get(path, defaults=defaults) if value is None: return None if isinstance(value, bool): @@ -517,12 +598,13 @@ class Settings(object): #~~ setter - def set(self, path, value, force=False): + def set(self, path, value, force=False, defaults=None): if len(path) == 0: return config = self._config - defaults = default_settings + if defaults is None: + defaults = default_settings while len(path) > 1: key = path.pop(0) @@ -547,9 +629,9 @@ class Settings(object): config[key] = value self._dirty = True - def setInt(self, path, value, force=False): + def setInt(self, path, value, force=False, defaults=None): if value is None: - self.set(path, None, force) + self.set(path, None, force=force, defaults=defaults) return try: @@ -560,9 +642,9 @@ class Settings(object): self.set(path, intValue, force) - def setFloat(self, path, value, force=False): + def setFloat(self, path, value, force=False, defaults=None): if value is None: - self.set(path, None, force) + self.set(path, None, force=force, defaults=defaults) return try: @@ -573,13 +655,13 @@ class Settings(object): self.set(path, floatValue, force) - def setBoolean(self, path, value, force=False): + def setBoolean(self, path, value, force=False, defaults=None): if value is None or isinstance(value, bool): - self.set(path, value, force) + self.set(path, value, force=force, defaults=defaults) elif value.lower() in valid_boolean_trues: - self.set(path, True, force) + self.set(path, True, force=force, defaults=defaults) else: - self.set(path, False, force) + self.set(path, False, force=force, defaults=defaults) def setBaseFolder(self, type, path, force=False): if type not in default_settings["folder"].keys(): diff --git a/src/octoprint/static/js/app/dataupdater.js b/src/octoprint/static/js/app/dataupdater.js index e6db9b239..d1a1206c5 100644 --- a/src/octoprint/static/js/app/dataupdater.js +++ b/src/octoprint/static/js/app/dataupdater.js @@ -1,16 +1,7 @@ -function DataUpdater(loginStateViewModel, connectionViewModel, printerStateViewModel, temperatureViewModel, controlViewModel, terminalViewModel, gcodeFilesViewModel, timelapseViewModel, gcodeViewModel, logViewModel) { +function DataUpdater(allViewModels) { var self = this; - self.loginStateViewModel = loginStateViewModel; - self.connectionViewModel = connectionViewModel; - self.printerStateViewModel = printerStateViewModel; - self.temperatureViewModel = temperatureViewModel; - self.controlViewModel = controlViewModel; - self.terminalViewModel = terminalViewModel; - self.gcodeFilesViewModel = gcodeFilesViewModel; - self.timelapseViewModel = timelapseViewModel; - self.gcodeViewModel = gcodeViewModel; - self.logViewModel = logViewModel; + self.allViewModels = allViewModels; self._socket = undefined; self._autoReconnecting = false; @@ -40,9 +31,28 @@ function DataUpdater(loginStateViewModel, connectionViewModel, printerStateViewM }; self._onclose = function() { - $("#offline_overlay_message").html(gettext("The server appears to be offline, at least I'm not getting any response from it. I'll try to reconnect automatically over the next couple of minutes, however you are welcome to try a manual reconnect anytime using the button below.")); - if (!$("#offline_overlay").is(":visible")) - $("#offline_overlay").show(); + var handled = false; + _.each(self.allViewModels, function(viewModel) { + if (handled == true) { + return; + } + + if (viewModel.hasOwnProperty("onServerDisconnect")) { + if (!viewModel.onServerDisconnect()) { + handled = true; + } + } + }); + + if (handled) { + return; + } + + showOfflineOverlay( + gettext("Server is offline"), + gettext("The server appears to be offline, at least I'm not getting any response from it. I'll try to reconnect automatically over the next couple of minutes, however you are welcome to try a manual reconnect anytime using the button below."), + self.reconnect + ); if (self._autoReconnectTrial < self._autoReconnectTimeouts.length) { var timeout = self._autoReconnectTimeouts[self._autoReconnectTrial]; @@ -55,11 +65,33 @@ function DataUpdater(loginStateViewModel, connectionViewModel, printerStateViewM }; self._onreconnectfailed = function() { + var handled = false; + _.each(self.allViewModels, function(viewModel) { + if (handled == true) { + return; + } + + if (viewModel.hasOwnProperty("onServerDisconnect")) { + if (!viewModel.onServerDisconnect()) { + handled = true; + } + } + }); + + if (handled) { + return; + } + + $("#offline_overlay_title").text(gettext("Server is offline")); $("#offline_overlay_message").html(gettext("The server appears to be offline, at least I'm not getting any response from it. I could not reconnect automatically, but you may try a manual reconnect using the button below.")); }; self._onmessage = function(e) { for (var prop in e.data) { + if (!e.data.hasOwnProperty(prop)) { + continue; + } + var data = e.data[prop]; switch (prop) { @@ -75,13 +107,12 @@ function DataUpdater(loginStateViewModel, connectionViewModel, printerStateViewM $("span.version").text(DISPLAY_VERSION); if ($("#offline_overlay").is(":visible")) { - $("#offline_overlay").hide(); - self.logViewModel.requestData(); - self.timelapseViewModel.requestData(); - $("#webcam_image").attr("src", CONFIG_WEBCAM_STREAM + "?" + new Date().getTime()); - self.loginStateViewModel.requestData(); - self.gcodeFilesViewModel.requestData(); - self.gcodeViewModel.reset(); + hideOfflineOverlay(); + _.each(self.allViewModels, function(viewModel) { + if (viewModel.hasOwnProperty("onDataUpdaterReconnect")) { + viewModel.onDataUpdaterReconnect(); + } + }); if ($('#tabs li[class="active"] a').attr("href") == "#control") { $("#webcam_image").attr("src", CONFIG_WEBCAM_STREAM + "?" + new Date().getTime()); @@ -91,25 +122,19 @@ function DataUpdater(loginStateViewModel, connectionViewModel, printerStateViewM break; } case "history": { - self.connectionViewModel.fromHistoryData(data); - self.printerStateViewModel.fromHistoryData(data); - self.temperatureViewModel.fromHistoryData(data); - self.controlViewModel.fromHistoryData(data); - self.terminalViewModel.fromHistoryData(data); - self.timelapseViewModel.fromHistoryData(data); - self.gcodeViewModel.fromHistoryData(data); - self.gcodeFilesViewModel.fromCurrentData(data); + _.each(self.allViewModels, function(viewModel) { + if (viewModel.hasOwnProperty("fromHistoryData")) { + viewModel.fromHistoryData(data); + } + }); break; } case "current": { - self.connectionViewModel.fromCurrentData(data); - self.printerStateViewModel.fromCurrentData(data); - self.temperatureViewModel.fromCurrentData(data); - self.controlViewModel.fromCurrentData(data); - self.terminalViewModel.fromCurrentData(data); - self.timelapseViewModel.fromCurrentData(data); - self.gcodeViewModel.fromCurrentData(data); - self.gcodeFilesViewModel.fromCurrentData(data); + _.each(self.allViewModels, function(viewModel) { + if (viewModel.hasOwnProperty("fromCurrentData")) { + viewModel.fromCurrentData(data); + } + }); break; } case "event": { @@ -120,8 +145,18 @@ function DataUpdater(loginStateViewModel, connectionViewModel, printerStateViewM var gcodeUploadProgress = $("#gcode_upload_progress"); var gcodeUploadProgressBar = $(".bar", gcodeUploadProgress); - if ((type == "UpdatedFiles" && payload.type == "gcode") || type == "MetadataAnalysisFinished") { - gcodeFilesViewModel.requestData(); + if (type == "UpdatedFiles") { + _.each(self.allViewModels, function(viewModel) { + if (viewModel.hasOwnProperty("onUpdatedFiles")) { + viewModel.onUpdatedFiles(payload); + } + }); + } else if (type == "MetadataAnalysisFinished") { + _.each(self.allViewModels, function(viewModel) { + if (viewModel.hasOwnProperty("onMetadataAnalysisFinished")) { + viewModel.onMetadataAnalysisFinished(payload); + } + }); } else if (type == "MovieRendering") { new PNotify({title: gettext("Rendering timelapse"), text: _.sprintf(gettext("Now rendering timelapse %(movie_basename)s"), payload)}); } else if (type == "MovieDone") { @@ -162,11 +197,19 @@ function DataUpdater(loginStateViewModel, connectionViewModel, printerStateViewM break; } case "feedbackCommandOutput": { - self.controlViewModel.fromFeedbackCommandData(data); + _.each(self.allViewModels, function(viewModel) { + if (viewModel.hasOwnProperty("fromFeedbackCommandData")) { + viewModel.fromFeedbackCommandData(data); + } + }); break; } case "timelapse": { - self.printerStateViewModel.fromTimelapseData(data); + _.each(self.allViewModels, function(viewModel) { + if (viewModel.hasOwnProperty("fromTimelapseData")) { + viewModel.fromTimelapseData(data); + } + }); break; } } diff --git a/src/octoprint/static/js/app/helpers.js b/src/octoprint/static/js/app/helpers.js index 7ef138c7e..a67ad4073 100644 --- a/src/octoprint/static/js/app/helpers.js +++ b/src/octoprint/static/js/app/helpers.js @@ -11,7 +11,7 @@ function ItemListHelper(listType, supportedSorting, supportedFilters, defaultSor self.searchFunction = undefined; self.allItems = []; -0 + self.items = ko.observableArray([]); self.pageSize = ko.observable(filesPerPage); self.currentPage = ko.observable(0); @@ -359,3 +359,42 @@ function pnotifyAdditionalInfo(inner) { + '
' + inner + '
' + ''; } + +function ping(url, callback) { + var img = new Image(); + var calledBack = false; + + img.onload = function() { + callback(true); + calledBack = true; + }; + img.onerror = function() { + if (!calledBack) { + callback(true); + calledBack = true; + } + }; + img.src = url; + setTimeout(function() { + if (!calledBack) { + callback(false); + calledBack = true; + } + }, 1500); +} + +function showOfflineOverlay(title, message, reconnectCallback) { + if (title == undefined) { + title = gettext("Server is offline"); + } + + $("#offline_overlay_title").text(title); + $("#offline_overlay_message").html(message); + $("#offline_overlay_reconnect").click(reconnectCallback); + if (!$("#offline_overlay").is(":visible")) + $("#offline_overlay").show(); +} + +function hideOfflineOverlay() { + $("#offline_overlay").hide(); +} diff --git a/src/octoprint/static/js/app/main.js b/src/octoprint/static/js/app/main.js index d76a2080d..21e604461 100644 --- a/src/octoprint/static/js/app/main.js +++ b/src/octoprint/static/js/app/main.js @@ -25,6 +25,46 @@ $(function() { gettext("Transfering file to SD") ]; + PNotify.prototype.options.styling = "bootstrap2"; + + // work around a stupid iOS6 bug where ajax requests get cached and only work once, as described at + // http://stackoverflow.com/questions/12506897/is-safari-on-ios-6-caching-ajax-results + $.ajaxSetup({ + type: 'POST', + headers: { "cache-control": "no-cache" } + }); + + // send the current UI API key with any request + $.ajaxSetup({ + headers: {"X-Api-Key": UI_API_KEY} + }); + + //~~ Show settings - to ensure centered + var settingsDialog = $('#settings_dialog'); + settingsDialog.on('show', function() { + _.each(allViewModels, function(viewModel) { + if (viewModel.hasOwnProperty("onSettingsShown")) { + viewModel.onSettingsShown(); + } + }); + }); + settingsDialog.on('hidden', function() { + _.each(allViewModels, function(viewModel) { + if (viewModel.hasOwnProperty("onSettingsHidden")) { + viewModel.onSettingsHidden(); + } + }); + }); + $('#navbar_show_settings').click(function() { + settingsDialog.modal() + .css({ + width: 'auto', + 'margin-left': function() { return -($(this).width() /2); } + }); + + return false; + }); + //~~ Initialize view models var loginStateViewModel = new LoginStateViewModel(); var usersViewModel = new UsersViewModel(loginStateViewModel); @@ -41,42 +81,46 @@ $(function() { var navigationViewModel = new NavigationViewModel(loginStateViewModel, appearanceViewModel, settingsViewModel, usersViewModel); var logViewModel = new LogViewModel(loginStateViewModel); - var dataUpdater = new DataUpdater( - loginStateViewModel, - connectionViewModel, - printerStateViewModel, - temperatureViewModel, - controlViewModel, - terminalViewModel, - gcodeFilesViewModel, - timelapseViewModel, - gcodeViewModel, - logViewModel - ); + var viewModelMap = { + loginStateViewModel: loginStateViewModel, + usersViewModel: usersViewModel, + settingsViewModel: settingsViewModel, + connectionViewModel: connectionViewModel, + timelapseViewModel: timelapseViewModel, + printerStateViewModel: printerStateViewModel, + appearanceViewModel: appearanceViewModel, + temperatureViewModel: temperatureViewModel, + controlViewModel: controlViewModel, + terminalViewModel: terminalViewModel, + gcodeFilesViewModel: gcodeFilesViewModel, + gcodeViewModel: gcodeViewModel, + navigationViewModel: navigationViewModel, + logViewModel: logViewModel + }; - PNotify.prototype.options.styling = "bootstrap2"; + var allViewModels = _.values(viewModelMap); - // work around a stupid iOS6 bug where ajax requests get cached and only work once, as described at - // http://stackoverflow.com/questions/12506897/is-safari-on-ios-6-caching-ajax-results - $.ajaxSetup({ - type: 'POST', - headers: { "cache-control": "no-cache" } + var additionalViewModels = []; + _.each(ADDITIONAL_VIEWMODELS, function(viewModel) { + var viewModelClass = viewModel[0]; + var viewModelParameters = viewModel[1]; + var viewModelBindTarget = viewModel[2]; + + var constructorParameters = []; + _.each(viewModelParameters, function(parameter) { + if (_.has(viewModelMap, parameter)) { + constructorParameters.push(viewModelMap[parameter]); + } else { + constructorParameters.push(undefined); + } + }); + + var viewModelInstance = new viewModelClass(constructorParameters); + additionalViewModels.push([viewModelInstance, viewModelBindTarget]); + allViewModels.push(viewModelInstance); }); - // send the current UI API key with any request - $.ajaxSetup({ - headers: {"X-Api-Key": UI_API_KEY} - }); - - //~~ Show settings - to ensure centered - $('#navbar_show_settings').click(function() { - $('#settings_dialog').modal() - .css({ - width: 'auto', - 'margin-left': function() { return -($(this).width() /2); } - }); - return false; - }); + var dataUpdater = new DataUpdater(allViewModels); //~~ Temperature @@ -287,9 +331,6 @@ $(function() { }, 100); }); - //~~ Offline overlay - $("#offline_overlay_reconnect").click(function() {dataUpdater.reconnect()}); - //~~ Underscore setup _.mixin(_.str.exports()); @@ -331,37 +372,62 @@ $(function() { } }; - ko.applyBindings(connectionViewModel, document.getElementById("connection_accordion")); - ko.applyBindings(printerStateViewModel, document.getElementById("state_accordion")); - ko.applyBindings(gcodeFilesViewModel, document.getElementById("files_accordion")); - ko.applyBindings(temperatureViewModel, document.getElementById("temp")); - ko.applyBindings(controlViewModel, document.getElementById("control")); - ko.applyBindings(terminalViewModel, document.getElementById("term")); - var gcode = document.getElementById("gcode"); - if (gcode) { - gcodeViewModel.initialize(); - ko.applyBindings(gcodeViewModel, gcode); - } - ko.applyBindings(settingsViewModel, document.getElementById("settings_dialog")); - ko.applyBindings(navigationViewModel, document.getElementById("navbar")); - ko.applyBindings(appearanceViewModel, document.getElementsByTagName("head")[0]); - ko.applyBindings(printerStateViewModel, document.getElementById("drop_overlay")); - ko.applyBindings(logViewModel, document.getElementById("logs")); + ko.bindingHandlers.invisible = { + init: function(element, valueAccessor, allBindings, viewModel, bindingContext) { + if (!valueAccessor()) return; + ko.bindingHandlers.style.update(element, function() { + return { visibility: 'hidden' }; + }) + } + }; - var timelapseElement = document.getElementById("timelapse"); - if (timelapseElement) { - ko.applyBindings(timelapseViewModel, timelapseElement); - } + settingsViewModel.requestData(function() { + ko.applyBindings(settingsViewModel, document.getElementById("settings_dialog")); + + ko.applyBindings(connectionViewModel, document.getElementById("connection_accordion")); + ko.applyBindings(printerStateViewModel, document.getElementById("state_accordion")); + ko.applyBindings(gcodeFilesViewModel, document.getElementById("files_accordion")); + ko.applyBindings(temperatureViewModel, document.getElementById("temp")); + ko.applyBindings(controlViewModel, document.getElementById("control")); + ko.applyBindings(terminalViewModel, document.getElementById("term")); + var gcode = document.getElementById("gcode"); + if (gcode) { + gcodeViewModel.initialize(); + ko.applyBindings(gcodeViewModel, gcode); + } + //ko.applyBindings(settingsViewModel, document.getElementById("settings_dialog")); + ko.applyBindings(navigationViewModel, document.getElementById("navbar")); + ko.applyBindings(appearanceViewModel, document.getElementsByTagName("head")[0]); + ko.applyBindings(printerStateViewModel, document.getElementById("drop_overlay")); + ko.applyBindings(logViewModel, document.getElementById("logs")); + + var timelapseElement = document.getElementById("timelapse"); + if (timelapseElement) { + ko.applyBindings(timelapseViewModel, timelapseElement); + } + + // apply bindings and signal startup + _.each(additionalViewModels, function(additionalViewModel) { + if (additionalViewModel[0].hasOwnProperty("onBeforeBinding")) { + additionalViewModel[0].onBeforeBinding(); + } + + // model instance, target container + ko.applyBindings(additionalViewModel[0], additionalViewModel[1]); + + if (additionalViewModel[0].hasOwnProperty("onAfterBinding")) { + additionalViewModel[0].onAfterBinding(); + } + }); + }); //~~ startup commands - loginStateViewModel.requestData(); - connectionViewModel.requestData(); - controlViewModel.requestData(); - gcodeFilesViewModel.requestData(); - timelapseViewModel.requestData(); - settingsViewModel.requestData(); - logViewModel.requestData(); + _.each(allViewModels, function(viewModel) { + if (viewModel.hasOwnProperty("onStartup")) { + viewModel.onStartup(); + } + }); loginStateViewModel.subscribe(function(change, data) { if ("login" == change) { diff --git a/src/octoprint/static/js/app/viewmodels/connection.js b/src/octoprint/static/js/app/viewmodels/connection.js index be2f26957..424501280 100644 --- a/src/octoprint/static/js/app/viewmodels/connection.js +++ b/src/octoprint/static/js/app/viewmodels/connection.js @@ -120,4 +120,8 @@ function ConnectionViewModel(loginStateViewModel, settingsViewModel) { }) } } + + self.onStartup = function() { + self.requestData(); + }; } diff --git a/src/octoprint/static/js/app/viewmodels/control.js b/src/octoprint/static/js/app/viewmodels/control.js index 0b0b826e6..5770d8451 100644 --- a/src/octoprint/static/js/app/viewmodels/control.js +++ b/src/octoprint/static/js/app/viewmodels/control.js @@ -236,6 +236,9 @@ function ControlViewModel(loginStateViewModel, settingsViewModel) { default: return "customControls_emptyTemplate"; } - } + }; + self.onStartup = function() { + self.requestData(); + }; } diff --git a/src/octoprint/static/js/app/viewmodels/files.js b/src/octoprint/static/js/app/viewmodels/files.js index ab224de2f..ed28e9c72 100644 --- a/src/octoprint/static/js/app/viewmodels/files.js +++ b/src/octoprint/static/js/app/viewmodels/files.js @@ -304,5 +304,22 @@ function GcodeFilesViewModel(printerStateViewModel, loginStateViewModel) { } }; + self.onDataUpdaterReconnect = function() { + self.requestData(); + }; + + self.onStartup = function() { + self.requestData(); + }; + + self.onUpdatedFiles = function(payload) { + if (payload.type == "gcode") { + self.requestData(); + } + }; + + self.onMetadataAnalysisFinished = function(payload) { + self.requestData(); + } } diff --git a/src/octoprint/static/js/app/viewmodels/gcode.js b/src/octoprint/static/js/app/viewmodels/gcode.js index 96c19ca13..b7396d326 100644 --- a/src/octoprint/static/js/app/viewmodels/gcode.js +++ b/src/octoprint/static/js/app/viewmodels/gcode.js @@ -332,7 +332,7 @@ function GcodeViewModel(loginStateViewModel, settingsViewModel) { } output.push(gettext("Estimated print time") + ": " + formatDuration(model.printTime)); output.push(gettext("Estimated layer height") + ": " + model.layerHeight.toFixed(2) + gettext("mm")); - output.push(gettext("Layer count") + ": " + model.layersPrinted.toFixed(0) + " " + gettext(printed) + ", " + model.layersTotal.toFixed(0) + " " + gettext("visited")); + output.push(gettext("Layer count") + ": " + model.layersPrinted.toFixed(0) + " " + gettext("printed") + ", " + model.layersTotal.toFixed(0) + " " + gettext("visited")); self.ui_modelInfo(output.join("
")); @@ -405,4 +405,8 @@ function GcodeViewModel(loginStateViewModel, settingsViewModel) { GCODE.ui.changeSelectedCommands(self.layerSlider.slider("getValue"), tuple[0], tuple[1]); }; + self.onDataUpdaterReconnect = function() { + self.reset(); + } + } diff --git a/src/octoprint/static/js/app/viewmodels/log.js b/src/octoprint/static/js/app/viewmodels/log.js index 4f407303c..59d52a5cb 100644 --- a/src/octoprint/static/js/app/viewmodels/log.js +++ b/src/octoprint/static/js/app/viewmodels/log.js @@ -49,7 +49,7 @@ function LogViewModel(loginStateViewModel) { return; self.listHelper.updateItems(files); - } + }; self.removeFile = function(filename) { $.ajax({ @@ -58,5 +58,13 @@ function LogViewModel(loginStateViewModel) { dataType: "json", success: self.requestData }); - } + }; + + self.onDataUpdaterReconnect = function() { + self.requestData(); + }; + + self.onStartup = function() { + self.requestData(); + }; } diff --git a/src/octoprint/static/js/app/viewmodels/loginstate.js b/src/octoprint/static/js/app/viewmodels/loginstate.js index dab4ad440..2b7c83155 100644 --- a/src/octoprint/static/js/app/viewmodels/loginstate.js +++ b/src/octoprint/static/js/app/viewmodels/loginstate.js @@ -29,7 +29,7 @@ function LoginStateViewModel() { data: {"passive": true}, success: self.fromResponse }) - } + }; self.fromResponse = function(response) { if (response && response.name) { @@ -85,5 +85,13 @@ function LoginStateViewModel() { self.fromResponse(response); } }) - } + }; + + self.onDataUpdaterReconnect = function() { + self.requestData(); + }; + + self.onStartup = function() { + self.requestData(); + }; } diff --git a/src/octoprint/static/js/app/viewmodels/settings.js b/src/octoprint/static/js/app/viewmodels/settings.js index 4411f14d0..909be6196 100644 --- a/src/octoprint/static/js/app/viewmodels/settings.js +++ b/src/octoprint/static/js/app/viewmodels/settings.js @@ -19,8 +19,9 @@ function SettingsViewModel(loginStateViewModel, usersViewModel) { {key: "green", name: gettext("green")}, {key: "blue", name: gettext("blue")}, {key: "violet", name: gettext("violet")}, - {key: "black", name: gettext("black")}, + {key: "black", name: gettext("black")} ]); + self.appearance_colorName = function(color) { switch (color) { case "red": @@ -166,6 +167,8 @@ function SettingsViewModel(loginStateViewModel, usersViewModel) { self.terminalFilters = ko.observableArray([]); + self.settings = undefined; + self.addTemperatureProfile = function() { self.temperature_profiles.push({name: "New", extruder:0, bed:0}); }; @@ -220,6 +223,12 @@ function SettingsViewModel(loginStateViewModel, usersViewModel) { }; self.fromResponse = function(response) { + if (self.settings === undefined) { + self.settings = ko.mapping.fromJS(response); + } else { + ko.mapping.fromJS(response, self.settings); + } + self.api_enabled(response.api.enabled); self.api_key(response.api.key); self.api_allowCrossOrigin(response.api.allowCrossOrigin); @@ -284,7 +293,9 @@ function SettingsViewModel(loginStateViewModel, usersViewModel) { }; self.saveData = function() { - var data = { + var data = ko.mapping.toJS(self.settings); + + data = _.extend(data, { "api" : { "enabled": self.api_enabled(), "key": self.api_key(), @@ -354,7 +365,7 @@ function SettingsViewModel(loginStateViewModel, usersViewModel) { "config": self.cura_config() }, "terminalFilters": self.terminalFilters() - }; + }); $.ajax({ url: API_BASEURL + "settings", @@ -367,6 +378,6 @@ function SettingsViewModel(loginStateViewModel, usersViewModel) { $("#settings_dialog").modal("hide"); } }); - } + }; } diff --git a/src/octoprint/static/js/app/viewmodels/timelapse.js b/src/octoprint/static/js/app/viewmodels/timelapse.js index 15a78da13..27b9b9951 100644 --- a/src/octoprint/static/js/app/viewmodels/timelapse.js +++ b/src/octoprint/static/js/app/viewmodels/timelapse.js @@ -94,15 +94,15 @@ function TimelapseViewModel(loginStateViewModel) { self.persist(false); self.isDirty(false); - } + }; self.fromCurrentData = function(data) { self._processStateData(data.state); - } + }; self.fromHistoryData = function(data) { self._processStateData(data.state); - } + }; self._processStateData = function(data) { self.isErrorOrClosed(data.flags.closedOrError); @@ -112,7 +112,7 @@ function TimelapseViewModel(loginStateViewModel) { self.isError(data.flags.error); self.isReady(data.flags.ready); self.isLoading(data.flags.loading); - } + }; self.removeFile = function(filename) { $.ajax({ @@ -121,25 +121,33 @@ function TimelapseViewModel(loginStateViewModel) { dataType: "json", success: self.requestData }); - } + }; self.save = function(data, event) { - var data = { + var payload = { "type": self.timelapseType(), "postRoll": self.timelapsePostRoll(), "save": self.persist() - } + }; if (self.timelapseType() == "timed") { - data["interval"] = self.timelapseTimedInterval(); + payload["interval"] = self.timelapseTimedInterval(); } $.ajax({ url: API_BASEURL + "timelapse", type: "POST", dataType: "json", - data: data, + data: payload, success: self.fromResponse }); - } + }; + + self.onDataUpdaterReconnect = function() { + self.requestData(); + }; + + self.onStartup = function() { + self.requestData(); + }; } diff --git a/src/octoprint/static/js/i18n/nl.js b/src/octoprint/static/js/i18n/nl.js new file mode 100644 index 000000000..85dcfaa22 --- /dev/null +++ b/src/octoprint/static/js/i18n/nl.js @@ -0,0 +1 @@ +window.BABEL_TO_LOAD_nl = {"locale": "nl", "domain": "messages", "plural_expr": "(n != 1)", "messages": {"": "Project-Id-Version: OctoPrint\nReport-Msgid-Bugs-To: i18n@octoprint.org\nPOT-Creation-Date: 2014-08-28 15:52+0200\nPO-Revision-Date: 2014-09-01 20:11+0000\nLast-Translator: leon.bek \nLanguage-Team: Dutch (http://www.transifex.com/projects/p/octoprint/language/nl/)\nPlural-Forms: nplurals=2; plural=(n != 1)\nMIME-Version: 1.0\nContent-Type: text/plain; charset=utf-8\nContent-Transfer-Encoding: 8bit\nGenerated-By: Babel 1.3\n", "Print Time Left": "Resterende print tijd", "Proceed": "Verder", "Timelapse Temp Folder": "Tijdelijke timelapse map", "Title": "Titel", "Only show files stored locally": "Laat alleen lokale bestanden zien", "yellow": "geel", "Path to Cura": "Lokatie van Cura", "Action": "Actie", "Passwords do not match": "Wachtwoorden komen niet overeen", "Sort by name": "Sorteer op naam", "Save connection settings": "Verbindings instellingen opslaan", "Rendering timelapse": "Renderen van timelapse", "Cura": "Cura", "Files": "Bestanden", "Bed Size": "Platform grootte", "Always assume SD card is present": "Neem aan dat SD kaart altijd aanwezig is", "Load and Print": "Laad en print", "Sending file to SD": "Verstuur bestand naar SD", "Number of Extruders": "Aantal Extruders", "black": "zwart", "Last Printed": "Laats geprint", "Sourcecode": "Broncode", "Estimated layer height": "Geschatte laag hooge", "You are now logged out": "Je bent nu uitgelogd", "Uploaded": "Geupload", "Opening serial port": "Openen van seri\u00eble poort", "New timelapse %(movie_basename)s is done rendering.": "Nieuwe timelapse %(movie_basename)s is gereed", "Invert control": "Bedieining spiegelen", "Webcam": "Webcam", "Remember me": "Onthoud me", "Enable GCode Visualizer": "Schakel GCode Visualizer in", "The server appears to be offline, at least I'm not getting any response from it. I'll try to reconnect automatically over the next couple of minutes, however you are welcome to try a manual reconnect anytime using the button below.": "De server lijkt offline te zijn, dat wil zeggen dat ik er geen reactie van krijg. Ik zal proberen om gedurende een paar minuten opnieuw te verbinden. Maar je bent op elk moment vrij om handmatig proberen te verbinden met onderstaande knop.", "Rendering failed": "Renderen mislukt", "Upload Folder": "Lokatie voor Uploads", "descending": "Aflopend", "X": "X", "Add user": "Gebruiker toevoegen", "GCODE commands in layer": "GCODE commando's in laag", "Estimated print time": "Geschatte print tijd", "Serial Connection": "Seri\u00eble verbinding", "Control": "Controle", "Password": "Wachtwoord", "Also show next layer": "Laat ook volgende laag zien", "Print Time": "Print tijd", "Sort by file size": "Sorteer op bestands grootte", "Machine State": "Machine status", "default": "Standaard", "API": "API", "Printing from SD": "Printen vanaf SD", "Terminal filters": "Terminal filters", "Change password for user \"%(user)s\"": "Verander wachtwoord voor gebruiker \"%(user)s\"", "Enable Temperature Graph": "Schakel temperatuur grafiek in", "Delete user": "Gebruiker verwijderen", "Confirm Password": "Bevestig wachtwoord", "Disconnect": "Verbreken", "Slicing done": "Slicing klaar", "Initialize SD card": "Formateer SD kaart", "System": "Systeem", "Send": "Verstuur", "State": "Status", "Version": "Versie", "YYYY-MM-DD HH:mm": "DD-MM-YYYY HH:mm", "Attempt to reconnect": "Probeer opnieuw te verbinden", "Streaming done": "Streaming klaar", "violet": "violet", "Print": "Print", "Layer count": "Aantal lagen", "OctoPrint Settings": "OctoPrint instellingen", "Are you sure?": "Weet je het zeker?", "blue": "blauw", "Printer": "Printer", "Tool": "Gereedschap", "Settings": "Instellingen", "Path to FFMPEG": "Lokatie van FFMPEG", "Upload to SD": "Uploaden naar SD", "The command \"%(command)s\" could not be executed.": "Het commando \"%(command)s\" kon niet uitgevoerd worden.", "Printed": "Geprint", "Layer number": "Laag nummer", "Sync with job progress": "Synchroniseer met taak voortgang", "Circular": "Cirkelvormig", "Total filament used": "Totaal gebruikte filament", "red": "rood", "Save as default": "Stel in als standaard", "Slicing ...": "Slicing ...", "Last Print Time": "Laatste print tijd", "Target": "Doel", "Streaming ...": "Streaming ...", "Logout successful": "Uitloggen succesvol", "Now rendering timelapse %(movie_basename)s": "Aan het renderen van timelapse %(movie_basename)s", "Documentation": "Documentatie", "%(hour)02d:%(minute)02d:%(second)02d": "%(hour)02d:%(minute)02d:%(second)02d", "Upload": "Upload", "ascending": "Oplopend", "Model size": "Model grootte", "Temperatures": "Temperaturen", "visited": "bezocht", "Timed": "Getimed", "Edit user \"%(user)s\"": "Bewerk gebruiker \"%(user)s\"", "Snapshot URL": "Snapshot URL", "Release SD card": "Geef SD kaart vrij", "Server is offline": "Server is offline", "Log communication to serial.log (might negatively impact performance)": "Log communicatie naar serial.log (kan negetief zijn voor de prestaties)", "Sort by upload date": "Sorteer op upload datum", "Change Password": "Verander wachtwoord", "Logs": "Logs", "Hotend": "Hotend", "Show retracts": "Laat retracts zien", "Keep Access Control Enabled": "Laat toegangscontrole ingeschakeld", "Upload locally": "Lokaal uploaden", "Select Tool...": "Selecteer gereedschap...", "Paused": "Gepauzeerd", "Continue": "Voortzetten", "Radius": "Straal", "The command \"%(command)s\" executed successfully": "Het commando \"%(command)s\" is succesvol uitgevoerd", "Features": "Functies", "Download": "Download", "GCode Viewer": "GCode kijker", "Also show previous layer": "Laat ook de vorige laag zien", "Enable OctoPrint watermark in timelapse movies": "Schakel OctoPrint watermerk in bij timelapse films", "Repetier": "Repetier", "Login successful": "Inloggen succesvol", "Finished Timelapses": "Complete timelapsen", "Rendering of timelapse %(movie_basename)s failedwith return code %(returncode)s": "Renderen van timelapse %(movie_basename)s mislukt met foutcode %(returncode)s", "Pause": "Pauze", "Temperature": "Temperatuur", "Enable slicing via Cura": "Schakel slicen via Cura in", "Access Control": "Toegangs controle", "Analyzing...": "Analyseren...", "just now": "zojuist", "Operational": "Operationeel", "Send a checksum with every command": "Stuur een checksum met elk commando", "Autodetection timeout": "Auto detectie timed-out", "Connecting": "Verbinden", "Free": "Vrij", "Closed": "Gesloten", "Refresh SD files": "Ververs SD bestandslijst", "Flip webcam vertically": "Spiegel webcam verticaal", "Path to Cura config": "Map voor Cura config", "Filament": "Filament", "Could not slice %(stl)s to %(gcode)s: %(reason)s": "Kon %(stl)s niet slicen naar %(gcode)s: %(reason)s", "Baudrate": "Baudrate", "Detecting baudrate": "Baudrate detecteren", "Date": "Datum", "Streamed %(local)s to %(remote)s on SD, took %(time).2f seconds": "Streamen van %(local)s naar %(remote)s op SD, duurde %(time).2f seconden", "Show moves": "Laat bewegingen zien", "Motors off": "Motoren uit", "Detecting serial port": "Detecteren van seri\u00eble poort", "New Password": "Nieuw wachtwoord", "Logout": "Uitloggen", "Offset": "Offset", "Analyzed": "Geanalyseerd", "Auto-connect on server startup": "Automatisch herverbinden bij opstarten van server", "Printer Parameters": "Printer Parameters", "E": "E", "Restart": "Herstarten", "Search...": "Zoek...", "Slicing failed": "Slicing mislukt", "Actual": "Huidig", "Active": "Aktief", "Creation date": "Cre\u00eber datum", "Hint: You can also drag and drop files on this page to upload them.": "Hint: Je kunt ook bestanden naar deze pagina slepen en loslaten om ze te uploaden.", "Interval": "Interval", "N/A": "N/B", "Bed": "Bed", "Auto-connect to printer on server start": "Automatisch verbinden met printer bij starten server", "orange": "oranje", "Connection": "Verbinding", "Error": "Fout", "On Z Change": "Bij hoogte verandering", "Timelapse post roll (in rendered seconds)": "Timelapse naloop (in gerenderde seconden)", "Z": "Z", "Are you sure you want to proceed?": "Weet je zeker dat je verder wilt gaan?", "If you disable Access Control and your OctoPrint installation is accessible from the internet, your printer will be accessible by everyone - that also includes the bad guys!": "Als je toegangs-controle uitschakelt en je OctoPrint installatie is toegangkelijk vanaf het internet, dan zal je printer toegankelijk zijn voor iedereen - dat zijn dus ook de slechte jongens!", "Load": "Laden", "Set": "Stel", "The server appears to be offline, at least I'm not getting any response from it. I could not reconnect automatically, but you may try a manual reconnect using the button below.": "De server lijkt offline te zijn, dat wil zeggen dat ik er geen reactie van krijg. Ik kon niet automatisch opnieuw verbinden. Je kunt proberen handmatig proberen te verbinden met onderstaande knop.", "Zoom in on model": "Zoom in op model", "mm": "mm", "Saving ...": "Opslaan ...", "RegExp": "Reguliere Expressie", "Watched Folder": "Bekeken map", "General": "Algemeen", "Temperature timeout": "Temperatuur timed-out", "Color": "Kleur", "Fans on": "Ventilators aan", "Swallow the first \"ok\" after a resend response": "Eerste \"ok\" negeren na opnieuw verzonden reactie", "Enable SD support": "Schakel SD ondersteuning in", "Connect": "Verbindt", "Cancel": "Anuleren", "sec": "sec", "Warning": "Waarschuwing", "Loading...": "Laden...", "Current API Key": "Huidige API sleutel", "Size": "Grootte", "Communication timeout": "Communicatie timed-out", "Modification date": "Datum aangepast", "Change password": "Verander wachtwoord", "This will restart the print job from the beginning.": "Dit zal de print taak herstarten vanaf het begin.", "Stream URL": "Stream URL", "Sort by": "Sorteer op", "Login failed": "Inloggen mislukt", "Abort": "Afbreken", "Confirm": "Bevestig", "Repeat Password": "Wachtwoord herhalen", "Terminal": "Terminal", "Autoscroll": "Automatisch scrollen", "Print time for layer": "Print tijd voor laag", "Disable Access Control": "Toegangscontrole uitschakelen", "Configure Access Control": "Toegangscontrole configureren", "Timelapse Configuration": "Timelapse configuratie", "Retract": "Retract", "Timelapse bitrate": "Timelapse bitrate", "Offline": "Offline", "API Key": "API sleutel", "Homepage": "Thuispagina", "Estimated Print Time": "Geschatte print tijd", "Folders": "Mappen", "Bugs and Requests": "Bugs en Verzoeken", "Save": "Opslaan", "Default extrusion length": "Standaard extrusion lengte", "min": "min", "Support TargetExtr%%n/TargetBed target temperature format": "Support TargetExtr%%n/TargetBed target temperature format", "Connection timeout": "Verbinding timed-out", "Save config": "Bewaar configuratie", "Center viewport on model": "Centreer scherm op model", "User unknown or wrong password": "Gebruiker onbekend of verkeerd wachtwoord", "Allow Cross Origin Resource Sharing (CORS)": "Sta Cross Origin Resource Sharing (CORS) toe", "Appearance": "Uiterlijk", "Enable": "Ingeschakeld", "Uploading ...": "Uploading ...", "Logs Folder": "Logboek map", "

\n Please read the following, it is very important for your printer's health!\n

\n

\n OctoPrint by default now ships with Access Control enabled, meaning you won't be able to do anything with the\n printer unless you login first as a configured user. This is to prevent strangers - possibly with\n malicious intent - to gain access to your printer via the internet or another untrustworthy network\n and using it in such a way that it is damaged or worse (i.e. causes a fire).\n

\n

\n It looks like you haven't configured access control yet. Please set up an username and password for the\n initial administrator account who will have full access to both the printer and OctoPrint's settings, then click\n on \"Keep Access Control Enabled\":\n

": "

\nLees alstublieft dit bericht, het is belangrijk voor de gezondheid van je printer!!\n

\n

\nOctoPrint heeft nu standaard toegangscontrole ingeschakeld. Dit betekent dat je niets kunt doen met de printer,\n tenzij je bent inlogd met een geconfigureerde gebruiker. Dit is om te voorkomen dat vreemdelingen\n - met mogelijk kwade bedoelingen - toegang krijgen tot je printer via het internet of een ander onvertrouwd netwerk.\nEn het zo gebruikt dat het beschadigd of erger (d.w.z. een brand veroorzaakt).\n

\n

\nHet lijkt erop dat je toegangscontrole nog niet ingeschakeld hebt. Stel alsjeblieft\n een gebruikersnaam en wachtwoord in voor het eerste\n administrator account dat volledige toegang zal hebben tot de printer en OctoPrint's instellingen.\nKlik dan op \"Hou toegangscontrole ingeschakeld\":\n

", "Hide successfully printed files": "Verberg succesvolle geprinte bestanden", "Username": "Gebruikersnaam", "Off": "Uit", "Name": "Naam", "Extruder Offsets": "Extruder Offsets", "Approx. Total Print Time": "Geschat. totale print tijd", "Admin": "Admin", "

\n Note: In case that your OctoPrint installation is only accessible from within a trustworthy network and you don't\n need Access Control for other reasons, you may alternatively disable Access Control. You should only\n do this if you are absolutely certain that only people you know and trust will be able to connect to it.\n

\n

\n Do NOT underestimate the risk of an unsecured access from the internet to your printer!\n

": "

\nMemo: In het geval dat je OctoPrint installatie alleen toegankelijk is vanaf een vertrouwd netwerk en je hebt toegangscontrole niet nodig voor andere redenen, kun je eventueel toegangscontrole uitschakelen. Je zou dit alleen moeten doen als je er absoluut zeker van bent dat alleen mensen die je kent en vertrouwd er verbinding mee kunnen maken.\n

\n

\nOnderschat het risico van onbeveiligde toegang vanaf het internet naar je printer niet!!\n

", "Timelapse": "Timelapse", "Remove": "Verwijderen", "Reload": "Herladen", "Printing": "Printen", "Only show files stored on SD": "Laat alleen bestanden op SD zien", "Y": "Y", "Fans off": "Ventilators uit", "Login": "Inloggen", "Timelapse ready": "Timelapse klaar", "Timelapse Mode": "Timelapse modues", "Timelapse Folder": "Lokatie voor timelapse", "Extruder": "Extruder", "Could not upload the file. Make sure that it is a GCODE file and has the extension \".gcode\" or \".gco\" or that it is an STL file with the extension \".stl\" and slicing support is enabled and configured.": "Kon het bestand niet uploaden. Zorg ervoor dat het bestand een GCODE bestand is en de extensie \".gcode\" of \".gco\" heeft, of dat het een STL bestand is met de extensie \".stl\" en ondersteuning voor slicen is aangezet en geconfigureerd.", "SD status timeout": "SD status timeout", "SD not initialized": "SD niet ge\u00efnitialiseerd", "Update User": "Update gebruiker", "off": "uit", "Serial Port": "Seri\u00eble poort", "Flip webcam horizontally": "Spiegel webcam Horizontaal", "Wait for start on connect": "Wacht voor start bij het verbinden", "Transfering file to SD": "Verstuur bestand naar SD", "OctoPrint": "OctoPrint", "Layer height": "Laag hoogte", "Sliced %(stl)s to %(gcode)s, took %(time).2f seconds": "Slicen van %(stl)s naar %(gcode)s, duurde %(time).2f seconden", "Extrude": "Extrude", "green": "groen", "File": "Bestand", "You are now logged in as \"%(username)s\"": "Je bent nu ingelogd als \"%(username)s\"", "Axis": "Assen", "Filament used by layer": "Filament gebruikt bij laag"}} ; \ No newline at end of file diff --git a/src/octoprint/static/js/i18n/no.js b/src/octoprint/static/js/i18n/no.js new file mode 100644 index 000000000..a5a85f41d --- /dev/null +++ b/src/octoprint/static/js/i18n/no.js @@ -0,0 +1 @@ +window.BABEL_TO_LOAD_no = {"locale": "nb_NO", "domain": "messages", "plural_expr": "(n != 1)", "messages": {"": "Project-Id-Version: OctoPrint\nReport-Msgid-Bugs-To: i18n@octoprint.org\nPOT-Creation-Date: 2014-08-28 15:52+0200\nPO-Revision-Date: 2014-09-03 16:07+0000\nLast-Translator: lobster2b \nLanguage-Team: Norwegian (http://www.transifex.com/projects/p/octoprint/language/no/)\nPlural-Forms: nplurals=2; plural=(n != 1)\nMIME-Version: 1.0\nContent-Type: text/plain; charset=utf-8\nContent-Transfer-Encoding: 8bit\nGenerated-By: Babel 1.3\n", "Print Time Left": "Gjenst\u00e5ende utskriftstid", "Proceed": "Fortsett", "Timelapse Temp Folder": "Timelapse midlertidig mappe", "Title": "Tittel", "Only show files stored locally": "Bare vis filer lagret lokalt", "yellow": "gul", "Path to Cura": "Sti til Cura", "Action": "Handling", "Passwords do not match": "Passordet er ikke likt", "Sort by name": "Sorter ved navn", "Save connection settings": "Lagre tilkoblingsinnstillinger", "Rendering timelapse": "Sammensetter timelapse", "Cura": "Cura", "Files": "Filer", "Bed Size": "Plattformst\u00f8rrelse", "Always assume SD card is present": "Alltid anta at minnekort er p\u00e5 plass", "Load and Print": "Last og skriv ut", "Sending file to SD": "Sender fil til minnekort", "Number of Extruders": "Antall dyser", "black": "svart", "Last Printed": "Sist utskrevet", "Sourcecode": "Kildekode", "Estimated layer height": "Estimert lagh\u00f8yde", "You are now logged out": "Du er n\u00e5 logget ut", "Uploaded": "Opplastet", "Opening serial port": "\u00c5pner serialport", "New timelapse %(movie_basename)s is done rendering.": "Ny timelapse for %(movie_basename)s er ferdig sammensatt", "Invert control": "Inverter kontroller", "Webcam": "Nettkamera", "Remember me": "Husk meg", "Enable GCode Visualizer": "Aktiver GCode framviser", "The server appears to be offline, at least I'm not getting any response from it. I'll try to reconnect automatically over the next couple of minutes, however you are welcome to try a manual reconnect anytime using the button below.": "Serveren er tilsynelatende frakoblet, i det minste f\u00e5r jeg ikke noen respons fra den. Jeg pr\u00f8ver \u00e5 koble til automatisk over de neste minuttene, du kan pr\u00f8ve en manuell oppkobling n\u00e5r du \u00f8nsker det ved \u00e5 bruke knappen nedenfor.", "Rendering failed": "Sammensetting feilet", "Upload Folder": "Opplastningsmappe", "descending": "synkende", "X": "X", "Add user": "Legg til bruker", "GCODE commands in layer": "GCODE kommandoer i lag", "Estimated print time": "Beregnet printtid", "Serial Connection": "Seriell kontakt", "Control": "Kontroll", "Password": "Passord", "Also show next layer": "Ogs\u00e5 vis neste lag", "Print Time": "Utskriftstid", "Sort by file size": "Sorter filer etter st\u00f8rrelse", "Machine State": "Maskintilstand", "default": "standard", "API": "API", "Printing from SD": "Utskrift fra minnekort", "Terminal filters": "Terminal filtre", "Change password for user \"%(user)s\"": "Endre passord for bruker \"%(user)s\"", "Enable Temperature Graph": "Aktiver temperaturgraf", "Delete user": "Slett bruker", "Confirm Password": "Bekreft passord", "Disconnect": "Koble fra", "Slicing done": "Slicing ferdig", "Initialize SD card": "Start minnekortet", "System": "System", "Send": "Send", "State": "Tilstand", "Version": "Versjon", "YYYY-MM-DD HH:mm": "YYYY-MM-DD HH:mm", "Attempt to reconnect": "Fors\u00f8k \u00e5 koble til p\u00e5 nytt", "Streaming done": "Streaming ferdig", "violet": "fiolett", "Print": "Utskriv", "Layer count": "Antall lag", "OctoPrint Settings": "OctoPrint innstillinger", "Are you sure?": "Er du sikker?", "blue": "bl\u00e5", "Printer": "Printer", "Tool": "Verkt\u00f8y", "Settings": "Innstillinger", "Path to FFMPEG": "Sti til FFMPEG", "Upload to SD": "Last opp til minnekort", "The command \"%(command)s\" could not be executed.": "Kommando \"%(command)s\" mislykkes", "Printed": "Utskrevet", "Layer number": "Lag nummer", "Sync with job progress": "Synkroniser med jobbprogresjon", "Circular": "Sirkul\u00e6r", "Total filament used": "Totalt tr\u00e5dforbruk", "red": "r\u00f8d", "Save as default": "Lagre som standard", "Slicing ...": "Slicing ...", "Last Print Time": "Siste utskriftstid", "Target": "M\u00e5l", "Streaming ...": "Streaming ...", "Logout successful": "Logg ut vellykket", "Now rendering timelapse %(movie_basename)s": "Sammensetter timelapse %(movie_basename)s", "Documentation": "Dokumentasjon", "%(hour)02d:%(minute)02d:%(second)02d": "%(hour)02d:%(minute)02d:%(second)02d", "Upload": "Last opp", "ascending": "stigende", "Model size": "Modellst\u00f8rrelse", "Temperatures": "Temperaturer", "visited": "bes\u00f8kt", "Timed": "Tidtakes", "Edit user \"%(user)s\"": "Endre bruker \"%(user)s\"", "Snapshot URL": "Hurtigbilde URL", "Release SD card": "L\u00f8s ut minnekort", "Server is offline": "Server er frakoblet", "Log communication to serial.log (might negatively impact performance)": "Skriv logg til serial.log (kan redusere ytelsen)", "Sort by upload date": "Sorter ved opplastningsdato", "Change Password": "Endre passord", "Logs": "Logger", "Hotend": "Dyse", "Show retracts": "Vis tilbaketrekninger", "Keep Access Control Enabled": "Behold adgangskontroll aktivert", "Upload locally": "Last opp lokalt", "Select Tool...": "Velg verkt\u00f8y", "Paused": "Pause", "Continue": "Fortsett", "Radius": "Radius", "The command \"%(command)s\" executed successfully": "Kommando \"%(command)s\" vellykket", "Features": "Funksjoner", "Download": "Last ned", "GCode Viewer": "GCode framviser", "Also show previous layer": "Ogs\u00e5 vis forrige lag", "Enable OctoPrint watermark in timelapse movies": "Aktiver OctoPrint vannmerke i timelapsefilmer", "Repetier": "Repeter", "Login successful": "Logg inn vellykket", "Finished Timelapses": "Ferdig timelapser", "Rendering of timelapse %(movie_basename)s failedwith return code %(returncode)s": "Sammensetting av timelapse %(movie_basename)s feilet med feilkode %(returncode)s", "Pause": "Pause", "Temperature": "Temperatur", "Enable slicing via Cura": "Aktiver slicing via Cura", "Access Control": "Adgangskontroll", "Analyzing...": "Analyserer...", "just now": "Akkurat no", "Operational": "Operativ", "Send a checksum with every command": "Send en kontrollsum med alle kommandoer", "Autodetection timeout": "Automatisk detekteringstidsavbrudd", "Connecting": "Kobler til", "Free": "Ledig", "Closed": "Lukket", "Refresh SD files": "Oppdater minnekort", "Flip webcam vertically": "Vertikal invertere webcam", "Path to Cura config": "Sti til Curakonfigurasjon", "Filament": "Tr\u00e5d", "Could not slice %(stl)s to %(gcode)s: %(reason)s": "Feilet \u00e5 slice %(stl)s til %(gcode)s: %(reason)s", "Baudrate": "Datemengde", "Detecting baudrate": "Finner seriell hastighet", "Date": "Dato", "Streamed %(local)s to %(remote)s on SD, took %(time).2f seconds": "Streamed %(local)s il %(remote)s p\u00e5 minnekort, took %(time).2f sekunder", "Show moves": "Vis forflyttninger", "Motors off": "Motorer av", "Detecting serial port": "Finner serialport", "New Password": "Nytt passord", "Logout": "Logg ut", "Offset": "Avvik", "Analyzed": "Analysert", "Auto-connect on server startup": "Koble til automatisk ved oppstart", "Printer Parameters": "Printer parametere", "E": "E", "Restart": "Omstart", "Search...": "S\u00f8k...", "Slicing failed": "Slicing feilet", "Actual": "Faktisk", "Active": "Aktiv", "Creation date": "Opprettelsesdato", "Hint: You can also drag and drop files on this page to upload them.": "Tips: Du kan ogs\u00e5 dra og slippe filer p\u00e5 denne siden for \u00e5 laste de opp", "Interval": "Interval", "N/A": "N/A", "Bed": "Bord", "Auto-connect to printer on server start": "Koble til printer automatisk ved oppstart", "orange": "orange", "Connection": "Tilkobling", "Error": "Feil", "On Z Change": "P\u00e5 Z endring", "Timelapse post roll (in rendered seconds)": "Timelapse etter opptak (i sekunder)", "Z": "Z", "Are you sure you want to proceed?": "Er du sikker du vil fortsette?", "If you disable Access Control and your OctoPrint installation is accessible from the internet, your printer will be accessible by everyone - that also includes the bad guys!": "Hvis du sl\u00e5r av adgangskontroll og din OctoPrint innstallasjon er tilgjengelig fra internett, din printer vil bli tilgjengelig for alle - inkluderer ogs\u00e5 dei med u\u00e6rlige intensjoner", "Load": "Last", "Set": "Velg", "The server appears to be offline, at least I'm not getting any response from it. I could not reconnect automatically, but you may try a manual reconnect using the button below.": "Serveren er tilsynelatende frakoblet, i det minste f\u00e5r jeg ikke noen respons fra den. Jeg kan ikke koble til den automatisk, du kan pr\u00f8ve en manuell oppkobling n\u00e5r du \u00f8nsker det ved \u00e5 bruke knappen nedenfor.", "Zoom in on model": "Zoom inn p\u00e5 modell", "mm": "mm", "Saving ...": "Lagrer ...", "RegExp": "RegExp", "Watched Folder": "Kontrollert mappe", "General": "Generell", "Temperature timeout": "Temperatur tidsavbrudd", "Color": "Farge", "Fans on": "Vifter p\u00e5", "Swallow the first \"ok\" after a resend response": "Svelg unna f\u00f8rste \"ok\" etter omsendt svar", "Enable SD support": "Aktiver st\u00f8tte for minnekort", "Connect": "Koble til", "Cancel": "Avbryt", "sec": "sek", "Warning": "Advarsel", "Loading...": "Laster...", "Current API Key": "N\u00e5v\u00e6rende API n\u00f8kkel", "Size": "St\u00f8rrelse", "Communication timeout": "Kommunikasjon tidsavbrudd", "Modification date": "Endret dato", "Change password": "Endre passord", "This will restart the print job from the beginning.": "Dette vil starte utskriftsjobbene fra starten", "Stream URL": "Stream URL", "Sort by": "Sorter etter", "Login failed": "Logg inn misslykkes", "Abort": "Avbryt", "Confirm": "Bekreft", "Repeat Password": "Gjenta passord", "Terminal": "Terminal", "Autoscroll": "Autoscroll", "Print time for layer": "Printtid for lag", "Disable Access Control": "Deaktiver adgangskontroll", "Configure Access Control": "Konfigurer adgangskontroll", "Timelapse Configuration": "Timelapse konfigurasjon", "Retract": "Tilbaketrekking", "Timelapse bitrate": "Timelapse bitrate", "Offline": "Frakoblet", "API Key": "API n\u00f8kkel", "Homepage": "Hjemmeside", "Estimated Print Time": "Bergenet utskriftstid", "Folders": "Mapper", "Bugs and Requests": "Feilrapportering og \u00f8nsker", "Save": "Lagre", "Default extrusion length": "Standard extrusion lengde ", "min": "min", "Support TargetExtr%%n/TargetBed target temperature format": "St\u00f8tte TargetExtr%%n/TargetBed m\u00e5l pemperatur format", "Connection timeout": "Oppkoblingstidsavbrudd", "Save config": "Lagre konfigurasjon", "Center viewport on model": "Sentrer bilde p\u00e5 modell", "User unknown or wrong password": "Bruker ukjent eller feil passord", "Allow Cross Origin Resource Sharing (CORS)": "Tillat Cross Origin Resource Sharing (CORS)", "Appearance": "Utseende", "Enable": "Aktiver", "Uploading ...": "Laster opp ...", "Logs Folder": "Loggmappe", "

\n Please read the following, it is very important for your printer's health!\n

\n

\n OctoPrint by default now ships with Access Control enabled, meaning you won't be able to do anything with the\n printer unless you login first as a configured user. This is to prevent strangers - possibly with\n malicious intent - to gain access to your printer via the internet or another untrustworthy network\n and using it in such a way that it is damaged or worse (i.e. causes a fire).\n

\n

\n It looks like you haven't configured access control yet. Please set up an username and password for the\n initial administrator account who will have full access to both the printer and OctoPrint's settings, then click\n on \"Keep Access Control Enabled\":\n

": "

\nVennligst les f\u00f8lgende, det er veldig viktig for din printers helse!!\n

\n

\nOctoPrint kommer originalt med adgangskontroll aktivert, som betyr at du ikke f\u00e5r gjort noe med\nprinteren med mindre du logger inn med en konfigurert bruker. Dette er for \u00e5 forhindre ukjente - med potensielt\nu\u00e6rlige intensjoner - fra \u00e5 f\u00e5 tilgang til din printer via Internett eller et usikret nettverk\nog bruker den i en slik m\u00e5te at skade oppst\u00e5r eller verre (f.eks for\u00e5rsaker en brann).\n

\n

\nDu har ikke konfigurert adgangskontrollen enda. Vennligst sett et brukernavn og passord for den\nf\u00f8rste administratorkontoen som vil ha full adgang til b\u00e5de skriveren og OctoPrint innstillinger, klikk deretter p\u00e5\n\"Behold adgangskontroll aktivert\":\n

", "Hide successfully printed files": "Skjul vellykkede utskriftsfiler", "Username": "Brukernavn", "Off": "Av", "Name": "Navn", "Extruder Offsets": "Extruder avvik", "Approx. Total Print Time": "Beregnet total utskriftstid", "Admin": "Admin", "

\n Note: In case that your OctoPrint installation is only accessible from within a trustworthy network and you don't\n need Access Control for other reasons, you may alternatively disable Access Control. You should only\n do this if you are absolutely certain that only people you know and trust will be able to connect to it.\n

\n

\n Do NOT underestimate the risk of an unsecured access from the internet to your printer!\n

": "

\nNoter: Hvis din OctoPrint installasjon er p\u00e5 et nettverk som du er helt sikker p\u00e5 at det er kun du eller folk du stoler p\u00e5 og du ikke \u00f8nsker adgangskontroll av en eller annen grunn,\nkan du deaktivere adgangskontrollen. Du burde kun\ngj\u00f8re dette vist du er helt sikker p\u00e5 at det er bare folk du kjenner og stoler p\u00e5 som vil koble til printeren.\n

\n

\nIKKE undervurder faren ved en usikret adgang fra Internett til din printer!\n

", "Timelapse": "Timelapse", "Remove": "Fjern", "Reload": "Last p\u00e5 nytt", "Printing": "Skriver ut", "Only show files stored on SD": "Bare vis filer lagret p\u00e5 minnekortet", "Y": "Y", "Fans off": "Vifter av", "Login": "Logg inn", "Timelapse ready": "Timelapse klar", "Timelapse Mode": "Timelapse modus", "Timelapse Folder": "Timelapse mappe", "Extruder": "Extruder", "Could not upload the file. Make sure that it is a GCODE file and has the extension \".gcode\" or \".gco\" or that it is an STL file with the extension \".stl\" and slicing support is enabled and configured.": "Klarte ikke \u00e5 laste opp filen, S\u00f8rg for at det er en GCODE fil med filtype \".gcode\" eller \".gco\" eller det er en STL fil med filtype \".stl\" og at slicing er aktivert og konfigurert.", "SD status timeout": "Minnekort tidsavbrudd", "SD not initialized": "Minnekort er ikke startet", "Update User": "Oppdater bruker", "off": "Av", "Serial Port": "Seriellport", "Flip webcam horizontally": "Horisontal invertere webcam", "Wait for start on connect": "Vent for start p\u00e5 tilkobling", "Transfering file to SD": "Overf\u00f8rer til minnekort", "OctoPrint": "OctoPrint", "Layer height": "Lag h\u00f8yde", "Sliced %(stl)s to %(gcode)s, took %(time).2f seconds": "Sliced %(stl)s til %(gcode)s, tok %(time).2f sekunder", "Extrude": "Extrude", "green": "gr\u00f8nn", "File": "Fil", "You are now logged in as \"%(username)s\"": "Du er no logget inn som \"%(username)s\"", "Axis": "Akse", "Filament used by layer": "Tr\u00e5d brukt i laget"}} ; \ No newline at end of file diff --git a/src/octoprint/static/js/lib/knockout.mapping-latest.js b/src/octoprint/static/js/lib/knockout.mapping-latest.js new file mode 100644 index 000000000..8d1d51260 --- /dev/null +++ b/src/octoprint/static/js/lib/knockout.mapping-latest.js @@ -0,0 +1,22 @@ +/// Knockout Mapping plugin v2.4.1 +/// (c) 2013 Steven Sanderson, Roy Jacobs - http://knockoutjs.com/ +/// License: MIT (http://www.opensource.org/licenses/mit-license.php) +(function(e){"function"===typeof require&&"object"===typeof exports&&"object"===typeof module?e(require("knockout"),exports):"function"===typeof define&&define.amd?define(["knockout","exports"],e):e(ko,ko.mapping={})})(function(e,f){function y(b,c){var a,d;for(d in c)if(c.hasOwnProperty(d)&&c[d])if(a=f.getType(b[d]),d&&b[d]&&"array"!==a&&"string"!==a)y(b[d],c[d]);else if("array"===f.getType(b[d])&&"array"===f.getType(c[d])){a=b;for(var e=d,l=b[d],n=c[d],t={},g=l.length-1;0<=g;--g)t[l[g]]=l[g];for(g= +n.length-1;0<=g;--g)t[n[g]]=n[g];l=[];n=void 0;for(n in t)l.push(t[n]);a[e]=l}else b[d]=c[d]}function E(b,c){var a={};y(a,b);y(a,c);return a}function z(b,c){for(var a=E({},b),e=L.length-1;0<=e;e--){var f=L[e];a[f]&&(a[""]instanceof Object||(a[""]={}),a[""][f]=a[f],delete a[f])}c&&(a.ignore=h(c.ignore,a.ignore),a.include=h(c.include,a.include),a.copy=h(c.copy,a.copy),a.observe=h(c.observe,a.observe));a.ignore=h(a.ignore,j.ignore);a.include=h(a.include,j.include);a.copy=h(a.copy,j.copy);a.observe=h(a.observe, +j.observe);a.mappedProperties=a.mappedProperties||{};a.copiedProperties=a.copiedProperties||{};return a}function h(b,c){"array"!==f.getType(b)&&(b="undefined"===f.getType(b)?[]:[b]);"array"!==f.getType(c)&&(c="undefined"===f.getType(c)?[]:[c]);return e.utils.arrayGetDistinctValues(b.concat(c))}function F(b,c,a,d,k,l,n){var t="array"===f.getType(e.utils.unwrapObservable(c));l=l||"";if(f.isMapped(b)){var g=e.utils.unwrapObservable(b)[p];a=E(g,a)}var j=n||k,h=function(){return a[d]&&a[d].create instanceof +Function},x=function(b){var f=G,g=e.dependentObservable;e.dependentObservable=function(a,b,c){c=c||{};a&&"object"==typeof a&&(c=a);var d=c.deferEvaluation,M=!1;c.deferEvaluation=!0;a=new H(a,b,c);if(!d){var g=a,d=e.dependentObservable;e.dependentObservable=H;a=e.isWriteableObservable(g);e.dependentObservable=d;d=H({read:function(){M||(e.utils.arrayRemoveItem(f,g),M=!0);return g.apply(g,arguments)},write:a&&function(a){return g(a)},deferEvaluation:!0});d.__DO=g;a=d;f.push(a)}return a};e.dependentObservable.fn= +H.fn;e.computed=e.dependentObservable;b=e.utils.unwrapObservable(k)instanceof Array?a[d].create({data:b||c,parent:j,skip:N}):a[d].create({data:b||c,parent:j});e.dependentObservable=g;e.computed=e.dependentObservable;return b},u=function(){return a[d]&&a[d].update instanceof Function},v=function(b,f){var g={data:f||c,parent:j,target:e.utils.unwrapObservable(b)};e.isWriteableObservable(b)&&(g.observable=b);return a[d].update(g)};if(n=I.get(c))return n;d=d||"";if(t){var t=[],s=!1,m=function(a){return a}; +a[d]&&a[d].key&&(m=a[d].key,s=!0);e.isObservable(b)||(b=e.observableArray([]),b.mappedRemove=function(a){var c="function"==typeof a?a:function(b){return b===m(a)};return b.remove(function(a){return c(m(a))})},b.mappedRemoveAll=function(a){var c=C(a,m);return b.remove(function(a){return-1!=e.utils.arrayIndexOf(c,m(a))})},b.mappedDestroy=function(a){var c="function"==typeof a?a:function(b){return b===m(a)};return b.destroy(function(a){return c(m(a))})},b.mappedDestroyAll=function(a){var c=C(a,m);return b.destroy(function(a){return-1!= +e.utils.arrayIndexOf(c,m(a))})},b.mappedIndexOf=function(a){var c=C(b(),m);a=m(a);return e.utils.arrayIndexOf(c,a)},b.mappedGet=function(a){return b()[b.mappedIndexOf(a)]},b.mappedCreate=function(a){if(-1!==b.mappedIndexOf(a))throw Error("There already is an object with the key that you specified.");var c=h()?x(a):a;u()&&(a=v(c,a),e.isWriteableObservable(c)?c(a):c=a);b.push(c);return c});n=C(e.utils.unwrapObservable(b),m).sort();g=C(c,m);s&&g.sort();s=e.utils.compareArrays(n,g);n={};var J,A=e.utils.unwrapObservable(c), +y={},z=!0,g=0;for(J=A.length;g
-

{{ _('Server is offline') }}

+

{{ _('Server is offline') }}

{{ _('Attempt to reconnect') }} diff --git a/src/octoprint/templates/index.jinja2 b/src/octoprint/templates/index.jinja2 index 74178c152..58aa506b9 100644 --- a/src/octoprint/templates/index.jinja2 +++ b/src/octoprint/templates/index.jinja2 @@ -13,11 +13,32 @@ + {% if stylesheet == "less" %} + + + {% for name, assets in assetPlugins.items() %} + {% if "less" in assets %} + {% for asset in assets["less"] %} + + {% endfor %} + {% endif %} + {% endfor %} + + {% else %} + + {% for name, assets in assetPlugins.items() %} + {% if "css" in assets %} + {% for asset in assets["css"] %} + + {% endfor %} + {% endif %} + {% endfor %} + {% endif %} @@ -609,6 +632,7 @@ + @@ -647,6 +671,16 @@ + + {% for name, assets in assetPlugins.items() %} + {% if "js" in assets %} + {% for asset in assets["js"] %} + + {% endfor %} + {% endif %} + {% endfor %} + + diff --git a/src/octoprint/templates/settings.jinja2 b/src/octoprint/templates/settings.jinja2 index b4c9ab2db..fee807432 100644 --- a/src/octoprint/templates/settings.jinja2 +++ b/src/octoprint/templates/settings.jinja2 @@ -21,6 +21,14 @@

  • {{ _('Folders') }}
  • {{ _('Appearance') }}
  • {{ _('Logs') }}
  • + {% if settingsPlugins %} + + {% for plugin_name, vars in settingsPlugins.items() %} + {% if vars._settings_menu_entry %} +
  • {{ vars._settings_menu_entry }}
  • + {% endif %} + {% endfor %} + {% endif %}
    @@ -621,6 +629,12 @@
    {% endif %} + {% for plugin_name, vars in settingsPlugins.items() %} +
    + {% include plugin_name+"_settings_dialog.jinja2" ignore missing %} +
    + {% endfor %} +

    {{ _('Logs') }}

    diff --git a/src/octoprint/translations/nl/LC_MESSAGES/messages.mo b/src/octoprint/translations/nl/LC_MESSAGES/messages.mo new file mode 100644 index 000000000..740e973ef Binary files /dev/null and b/src/octoprint/translations/nl/LC_MESSAGES/messages.mo differ diff --git a/src/octoprint/translations/nl/LC_MESSAGES/messages.po b/src/octoprint/translations/nl/LC_MESSAGES/messages.po new file mode 100644 index 000000000..c4b0c679b --- /dev/null +++ b/src/octoprint/translations/nl/LC_MESSAGES/messages.po @@ -0,0 +1,1242 @@ +# Translations template for OctoPrint. +# Copyright (C) 2014 The OctoPrint Project +# This file is distributed under the same license as the OctoPrint project. +# +# Translators: +# leon.bek , 2014 +msgid "" +msgstr "" +"Project-Id-Version: OctoPrint\n" +"Report-Msgid-Bugs-To: i18n@octoprint.org\n" +"POT-Creation-Date: 2014-08-28 15:52+0200\n" +"PO-Revision-Date: 2014-09-01 20:11+0000\n" +"Last-Translator: leon.bek \n" +"Language-Team: Dutch (http://www.transifex.com/projects/p/octoprint/language/nl/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 1.3\n" +"Language: nl\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: src/octoprint/static/js/app/dataupdater.js:43 +msgid "" +"The server appears to be offline, at least I'm not getting any response from" +" it. I'll try to reconnect automatically over the next couple of " +"minutes, however you are welcome to try a manual reconnect anytime " +"using the button below." +msgstr "De server lijkt offline te zijn, dat wil zeggen dat ik er geen reactie van krijg. Ik zal proberen om gedurende een paar minuten opnieuw te verbinden. Maar je bent op elk moment vrij om handmatig proberen te verbinden met onderstaande knop." + +#: src/octoprint/static/js/app/dataupdater.js:58 +msgid "" +"The server appears to be offline, at least I'm not getting any response from" +" it. I could not reconnect automatically, but you may try a" +" manual reconnect using the button below." +msgstr "De server lijkt offline te zijn, dat wil zeggen dat ik er geen reactie van krijg. Ik kon niet automatisch opnieuw verbinden. Je kunt proberen handmatig proberen te verbinden met onderstaande knop." + +#: src/octoprint/static/js/app/dataupdater.js:126 +msgid "Rendering timelapse" +msgstr "Renderen van timelapse" + +#: src/octoprint/static/js/app/dataupdater.js:126 +#, python-format +msgid "Now rendering timelapse %(movie_basename)s" +msgstr "Aan het renderen van timelapse %(movie_basename)s" + +#: src/octoprint/static/js/app/dataupdater.js:128 +msgid "Timelapse ready" +msgstr "Timelapse klaar" + +#: src/octoprint/static/js/app/dataupdater.js:128 +#, python-format +msgid "New timelapse %(movie_basename)s is done rendering." +msgstr "Nieuwe timelapse %(movie_basename)s is gereed" + +#: src/octoprint/static/js/app/dataupdater.js:131 +#, python-format +msgid "" +"Rendering of timelapse %(movie_basename)s failedwith return code " +"%(returncode)s" +msgstr "Renderen van timelapse %(movie_basename)s mislukt met foutcode %(returncode)s" + +#: src/octoprint/static/js/app/dataupdater.js:133 +msgid "Rendering failed" +msgstr "Renderen mislukt" + +#: src/octoprint/static/js/app/dataupdater.js:137 +msgid "Slicing ..." +msgstr "Slicing ..." + +#: src/octoprint/static/js/app/dataupdater.js:142 +msgid "Slicing done" +msgstr "Slicing klaar" + +#: src/octoprint/static/js/app/dataupdater.js:142 +#, python-format +msgid "Sliced %(stl)s to %(gcode)s, took %(time).2f seconds" +msgstr "Slicen van %(stl)s naar %(gcode)s, duurde %(time).2f seconden" + +#: src/octoprint/static/js/app/dataupdater.js:149 +#, python-format +msgid "Could not slice %(stl)s to %(gcode)s: %(reason)s" +msgstr "Kon %(stl)s niet slicen naar %(gcode)s: %(reason)s" + +#: src/octoprint/static/js/app/dataupdater.js:150 +msgid "Slicing failed" +msgstr "Slicing mislukt" + +#: src/octoprint/static/js/app/dataupdater.js:154 +msgid "Streaming ..." +msgstr "Streaming ..." + +#: src/octoprint/static/js/app/dataupdater.js:159 +msgid "Streaming done" +msgstr "Streaming klaar" + +#: src/octoprint/static/js/app/dataupdater.js:159 +#, python-format +msgid "Streamed %(local)s to %(remote)s on SD, took %(time).2f seconds" +msgstr "Streamen van %(local)s naar %(remote)s op SD, duurde %(time).2f seconden" + +#: src/octoprint/static/js/app/helpers.js:337 +#, python-format +msgid "%(hour)02d:%(minute)02d:%(second)02d" +msgstr "%(hour)02d:%(minute)02d:%(second)02d" + +#: src/octoprint/static/js/app/helpers.js:342 +msgid "YYYY-MM-DD HH:mm" +msgstr "DD-MM-YYYY HH:mm" + +#: src/octoprint/static/js/app/helpers.js:360 +#: src/octoprint/static/js/app/helpers.js:365 +msgid "off" +msgstr "uit" + +#: src/octoprint/static/js/app/main.js:17 +msgid "Offline" +msgstr "Offline" + +#: src/octoprint/static/js/app/main.js:18 +msgid "Opening serial port" +msgstr "Openen van seriële poort" + +#: src/octoprint/static/js/app/main.js:19 +msgid "Detecting serial port" +msgstr "Detecteren van seriële poort" + +#: src/octoprint/static/js/app/main.js:20 +msgid "Detecting baudrate" +msgstr "Baudrate detecteren" + +#: src/octoprint/static/js/app/main.js:21 +msgid "Connecting" +msgstr "Verbinden" + +#: src/octoprint/static/js/app/main.js:22 +msgid "Operational" +msgstr "Operationeel" + +#: src/octoprint/static/js/app/main.js:23 +msgid "Printing from SD" +msgstr "Printen vanaf SD" + +#: src/octoprint/static/js/app/main.js:24 +msgid "Sending file to SD" +msgstr "Verstuur bestand naar SD" + +#: src/octoprint/static/js/app/main.js:25 +msgid "Printing" +msgstr "Printen" + +#: src/octoprint/static/js/app/main.js:26 +msgid "Paused" +msgstr "Gepauzeerd" + +#: src/octoprint/static/js/app/main.js:27 +msgid "Closed" +msgstr "Gesloten" + +#: src/octoprint/static/js/app/main.js:28 +msgid "Transfering file to SD" +msgstr "Verstuur bestand naar SD" + +#: src/octoprint/static/js/app/main.js:132 +msgid "" +"Could not upload the file. Make sure that it is a GCODE file and has the " +"extension \".gcode\" or \".gco\" or that it is an STL file with the " +"extension \".stl\" and slicing support is enabled and configured." +msgstr "Kon het bestand niet uploaden. Zorg ervoor dat het bestand een GCODE bestand is en de extensie \".gcode\" of \".gco\" heeft, of dat het een STL bestand is met de extensie \".stl\" en ondersteuning voor slicen is aangezet en geconfigureerd." + +#: src/octoprint/static/js/app/main.js:148 +msgid "Uploading ..." +msgstr "Uploading ..." + +#: src/octoprint/static/js/app/main.js:151 +msgid "Saving ..." +msgstr "Opslaan ..." + +#: src/octoprint/static/js/app/viewmodels/appearance.js:9 +#: src/octoprint/static/js/app/viewmodels/appearance.js:11 +#: src/octoprint/static/js/app/viewmodels/appearance.js:16 +#: src/octoprint/static/js/app/viewmodels/appearance.js:18 +msgid "OctoPrint" +msgstr "OctoPrint" + +#: src/octoprint/static/js/app/viewmodels/connection.js:24 +#: src/octoprint/templates/index.jinja2:117 +msgid "Connect" +msgstr "Verbindt" + +#: src/octoprint/static/js/app/viewmodels/connection.js:26 +msgid "Disconnect" +msgstr "Verbreken" + +#: src/octoprint/static/js/app/viewmodels/control.js:38 +#: src/octoprint/static/js/app/viewmodels/files.js:286 +#: src/octoprint/static/js/app/viewmodels/gcode.js:332 +#: src/octoprint/static/js/app/viewmodels/gcode.js:363 +#: src/octoprint/static/js/app/viewmodels/printerstate.js:137 +#: src/octoprint/static/js/app/viewmodels/temperature.js:56 +msgid "Tool" +msgstr "Gereedschap" + +#: src/octoprint/static/js/app/viewmodels/control.js:45 +#: src/octoprint/static/js/app/viewmodels/temperature.js:68 +msgid "Hotend" +msgstr "Hotend" + +#: src/octoprint/static/js/app/viewmodels/files.js:281 +#: src/octoprint/static/js/app/viewmodels/files.js:286 +msgid "Filament" +msgstr "Filament" + +#: src/octoprint/static/js/app/viewmodels/files.js:290 +msgid "Estimated Print Time" +msgstr "Geschatte print tijd" + +#: src/octoprint/static/js/app/viewmodels/files.js:293 +msgid "Last Printed" +msgstr "Laats geprint" + +#: src/octoprint/static/js/app/viewmodels/files.js:295 +msgid "Last Print Time" +msgstr "Laatste print tijd" + +#: src/octoprint/static/js/app/viewmodels/firstrun.js:37 +msgid "" +"If you disable Access Control and your OctoPrint " +"installation is accessible from the internet, your printer will be " +"accessible by everyone - that also includes the bad guys!" +msgstr "Als je toegangs-controle uitschakelt en je OctoPrint installatie is toegangkelijk vanaf het internet, dan zal je printer toegankelijk zijn voor iedereen - dat zijn dus ook de slechte jongens!" + +#: src/octoprint/static/js/app/viewmodels/gcode.js:13 +msgid "Loading..." +msgstr "Laden..." + +#: src/octoprint/static/js/app/viewmodels/gcode.js:17 +msgid "Analyzing..." +msgstr "Analyseren..." + +#: src/octoprint/static/js/app/viewmodels/gcode.js:21 +msgid "Analyzed" +msgstr "Geanalyseerd" + +#: src/octoprint/static/js/app/viewmodels/gcode.js:327 +msgid "Model size" +msgstr "Model grootte" + +#: src/octoprint/static/js/app/viewmodels/gcode.js:329 +#: src/octoprint/static/js/app/viewmodels/gcode.js:332 +msgid "Total filament used" +msgstr "Totaal gebruikte filament" + +#: src/octoprint/static/js/app/viewmodels/gcode.js:329 +#: src/octoprint/static/js/app/viewmodels/gcode.js:332 +#: src/octoprint/static/js/app/viewmodels/gcode.js:336 +msgid "mm" +msgstr "mm" + +#: src/octoprint/static/js/app/viewmodels/gcode.js:335 +msgid "Estimated print time" +msgstr "Geschatte print tijd" + +#: src/octoprint/static/js/app/viewmodels/gcode.js:336 +msgid "Estimated layer height" +msgstr "Geschatte laag hooge" + +#: src/octoprint/static/js/app/viewmodels/gcode.js:337 +msgid "Layer count" +msgstr "Aantal lagen" + +#: src/octoprint/static/js/app/viewmodels/gcode.js:337 +msgid "visited" +msgstr "bezocht" + +#: src/octoprint/static/js/app/viewmodels/gcode.js:356 +msgid "Layer number" +msgstr "Laag nummer" + +#: src/octoprint/static/js/app/viewmodels/gcode.js:357 +msgid "Layer height" +msgstr "Laag hoogte" + +#: src/octoprint/static/js/app/viewmodels/gcode.js:358 +msgid "GCODE commands in layer" +msgstr "GCODE commando's in laag" + +#: src/octoprint/static/js/app/viewmodels/gcode.js:360 +#: src/octoprint/static/js/app/viewmodels/gcode.js:363 +msgid "Filament used by layer" +msgstr "Filament gebruikt bij laag" + +#: src/octoprint/static/js/app/viewmodels/gcode.js:366 +msgid "Print time for layer" +msgstr "Print tijd voor laag" + +#: src/octoprint/static/js/app/viewmodels/loginstate.js:15 +#: src/octoprint/templates/index.jinja2:74 +#: src/octoprint/templates/index.jinja2:85 +msgid "Login" +msgstr "Inloggen" + +#: src/octoprint/static/js/app/viewmodels/loginstate.js:70 +msgid "Login successful" +msgstr "Inloggen succesvol" + +#: src/octoprint/static/js/app/viewmodels/loginstate.js:70 +#, python-format +msgid "You are now logged in as \"%(username)s\"" +msgstr "Je bent nu ingelogd als \"%(username)s\"" + +#: src/octoprint/static/js/app/viewmodels/loginstate.js:74 +msgid "Login failed" +msgstr "Inloggen mislukt" + +#: src/octoprint/static/js/app/viewmodels/loginstate.js:74 +msgid "User unknown or wrong password" +msgstr "Gebruiker onbekend of verkeerd wachtwoord" + +#: src/octoprint/static/js/app/viewmodels/loginstate.js:84 +msgid "Logout successful" +msgstr "Uitloggen succesvol" + +#: src/octoprint/static/js/app/viewmodels/loginstate.js:84 +msgid "You are now logged out" +msgstr "Je bent nu uitgelogd" + +#: src/octoprint/static/js/app/viewmodels/navigation.js:17 +#, python-format +msgid "The command \"%(command)s\" executed successfully" +msgstr "Het commando \"%(command)s\" is succesvol uitgevoerd" + +#: src/octoprint/static/js/app/viewmodels/navigation.js:20 +#, python-format +msgid "The command \"%(command)s\" could not be executed." +msgstr "Het commando \"%(command)s\" kon niet uitgevoerd worden." + +#: src/octoprint/static/js/app/viewmodels/navigation.js:22 +msgid "Error" +msgstr "Fout" + +#: src/octoprint/static/js/app/viewmodels/printerstate.js:66 +msgid "Continue" +msgstr "Voortzetten" + +#: src/octoprint/static/js/app/viewmodels/printerstate.js:68 +#: src/octoprint/templates/index.jinja2:144 +msgid "Pause" +msgstr "Pauze" + +#: src/octoprint/static/js/app/viewmodels/printerstate.js:79 +#: src/octoprint/templates/index.jinja2:524 +msgid "On Z Change" +msgstr "Bij hoogte verandering" + +#: src/octoprint/static/js/app/viewmodels/printerstate.js:81 +#: src/octoprint/templates/index.jinja2:525 +msgid "Timed" +msgstr "Getimed" + +#: src/octoprint/static/js/app/viewmodels/printerstate.js:81 +#: src/octoprint/templates/index.jinja2:531 +#: src/octoprint/templates/index.jinja2:538 +msgid "sec" +msgstr "sec" + +#: src/octoprint/static/js/app/viewmodels/printerstate.js:166 +msgid "This will restart the print job from the beginning." +msgstr "Dit zal de print taak herstarten vanaf het begin." + +#: src/octoprint/static/js/app/viewmodels/settings.js:15 +#: src/octoprint/static/js/app/viewmodels/settings.js:41 +msgid "default" +msgstr "Standaard" + +#: src/octoprint/static/js/app/viewmodels/settings.js:16 +#: src/octoprint/static/js/app/viewmodels/settings.js:27 +msgid "red" +msgstr "rood" + +#: src/octoprint/static/js/app/viewmodels/settings.js:17 +#: src/octoprint/static/js/app/viewmodels/settings.js:29 +msgid "orange" +msgstr "oranje" + +#: src/octoprint/static/js/app/viewmodels/settings.js:18 +#: src/octoprint/static/js/app/viewmodels/settings.js:31 +msgid "yellow" +msgstr "geel" + +#: src/octoprint/static/js/app/viewmodels/settings.js:19 +#: src/octoprint/static/js/app/viewmodels/settings.js:33 +msgid "green" +msgstr "groen" + +#: src/octoprint/static/js/app/viewmodels/settings.js:20 +#: src/octoprint/static/js/app/viewmodels/settings.js:35 +msgid "blue" +msgstr "blauw" + +#: src/octoprint/static/js/app/viewmodels/settings.js:21 +#: src/octoprint/static/js/app/viewmodels/settings.js:37 +msgid "violet" +msgstr "violet" + +#: src/octoprint/static/js/app/viewmodels/settings.js:22 +#: src/octoprint/static/js/app/viewmodels/settings.js:39 +msgid "black" +msgstr "zwart" + +#: src/octoprint/static/js/app/viewmodels/temperature.js:22 +#: src/octoprint/static/js/app/viewmodels/temperature.js:74 +#: src/octoprint/templates/settings.jinja2:347 +msgid "Bed" +msgstr "Bed" + +#: src/octoprint/static/js/app/viewmodels/temperature.js:110 +msgid "just now" +msgstr "zojuist" + +#: src/octoprint/static/js/app/viewmodels/temperature.js:112 +msgid "min" +msgstr "min" + +#: src/octoprint/static/js/app/viewmodels/temperature.js:252 +#: src/octoprint/templates/index.jinja2:262 +msgid "Actual" +msgstr "Huidig" + +#: src/octoprint/static/js/app/viewmodels/temperature.js:257 +#: src/octoprint/templates/index.jinja2:263 +msgid "Target" +msgstr "Doel" + +#: src/octoprint/templates/dialogs.jinja2:6 +msgid "Server is offline" +msgstr "Server is offline" + +#: src/octoprint/templates/dialogs.jinja2:9 +msgid "Attempt to reconnect" +msgstr "Probeer opnieuw te verbinden" + +#: src/octoprint/templates/dialogs.jinja2:20 +msgid "Upload locally" +msgstr "Lokaal uploaden" + +#: src/octoprint/templates/dialogs.jinja2:22 +#: src/octoprint/templates/index.jinja2:218 +msgid "Upload to SD" +msgstr "Uploaden naar SD" + +#: src/octoprint/templates/dialogs.jinja2:22 +msgid "SD not initialized" +msgstr "SD niet geïnitialiseerd" + +#: src/octoprint/templates/dialogs.jinja2:25 +#: src/octoprint/templates/index.jinja2:213 +#: src/octoprint/templates/index.jinja2:224 +msgid "Upload" +msgstr "Upload" + +#: src/octoprint/templates/dialogs.jinja2:34 +msgid "Are you sure?" +msgstr "Weet je het zeker?" + +#: src/octoprint/templates/dialogs.jinja2:38 +msgid "Are you sure you want to proceed?" +msgstr "Weet je zeker dat je verder wilt gaan?" + +#: src/octoprint/templates/dialogs.jinja2:41 +#: src/octoprint/templates/index.jinja2:145 +#: src/octoprint/templates/settings.jinja2:676 +msgid "Cancel" +msgstr "Anuleren" + +#: src/octoprint/templates/dialogs.jinja2:42 +msgid "Proceed" +msgstr "Verder" + +#: src/octoprint/templates/dialogs.jinja2:48 +msgid "Configure Access Control" +msgstr "Toegangscontrole configureren" + +#: src/octoprint/templates/dialogs.jinja2:51 +msgid "" +"

    \n" +" Please read the following, it is very important for your printer's health!\n" +"

    \n" +"

    \n" +" OctoPrint by default now ships with Access Control enabled, meaning you won't be able to do anything with the\n" +" printer unless you login first as a configured user. This is to prevent strangers - possibly with\n" +" malicious intent - to gain access to your printer via the internet or another untrustworthy network\n" +" and using it in such a way that it is damaged or worse (i.e. causes a fire).\n" +"

    \n" +"

    \n" +" It looks like you haven't configured access control yet. Please set up an username and password for the\n" +" initial administrator account who will have full access to both the printer and OctoPrint's settings, then click\n" +" on \"Keep Access Control Enabled\":\n" +"

    " +msgstr "

    \nLees alstublieft dit bericht, het is belangrijk voor de gezondheid van je printer!!\n

    \n

    \nOctoPrint heeft nu standaard toegangscontrole ingeschakeld. Dit betekent dat je niets kunt doen met de printer,\n tenzij je bent inlogd met een geconfigureerde gebruiker. Dit is om te voorkomen dat vreemdelingen\n - met mogelijk kwade bedoelingen - toegang krijgen tot je printer via het internet of een ander onvertrouwd netwerk.\nEn het zo gebruikt dat het beschadigd of erger (d.w.z. een brand veroorzaakt).\n

    \n

    \nHet lijkt erop dat je toegangscontrole nog niet ingeschakeld hebt. Stel alsjeblieft\n een gebruikersnaam en wachtwoord in voor het eerste\n administrator account dat volledige toegang zal hebben tot de printer en OctoPrint's instellingen.\nKlik dan op \"Hou toegangscontrole ingeschakeld\":\n

    " + +#: src/octoprint/templates/dialogs.jinja2:67 +#: src/octoprint/templates/index.jinja2:78 +#: src/octoprint/templates/index.jinja2:79 +#: src/octoprint/templates/settings.jinja2:510 +msgid "Username" +msgstr "Gebruikersnaam" + +#: src/octoprint/templates/dialogs.jinja2:73 +#: src/octoprint/templates/index.jinja2:80 +#: src/octoprint/templates/index.jinja2:81 +#: src/octoprint/templates/settings.jinja2:516 +msgid "Password" +msgstr "Wachtwoord" + +#: src/octoprint/templates/dialogs.jinja2:79 +msgid "Confirm Password" +msgstr "Bevestig wachtwoord" + +#: src/octoprint/templates/dialogs.jinja2:82 +#: src/octoprint/templates/settings.jinja2:525 +#: src/octoprint/templates/settings.jinja2:596 +msgid "Passwords do not match" +msgstr "Wachtwoorden komen niet overeen" + +#: src/octoprint/templates/dialogs.jinja2:86 +msgid "" +"

    \n" +" Note: In case that your OctoPrint installation is only accessible from within a trustworthy network and you don't\n" +" need Access Control for other reasons, you may alternatively disable Access Control. You should only\n" +" do this if you are absolutely certain that only people you know and trust will be able to connect to it.\n" +"

    \n" +"

    \n" +" Do NOT underestimate the risk of an unsecured access from the internet to your printer!\n" +"

    " +msgstr "

    \nMemo: In het geval dat je OctoPrint installatie alleen toegankelijk is vanaf een vertrouwd netwerk en je hebt toegangscontrole niet nodig voor andere redenen, kun je eventueel toegangscontrole uitschakelen. Je zou dit alleen moeten doen als je er absoluut zeker van bent dat alleen mensen die je kent en vertrouwd er verbinding mee kunnen maken.\n

    \n

    \nOnderschat het risico van onbeveiligde toegang vanaf het internet naar je printer niet!!\n

    " + +#: src/octoprint/templates/dialogs.jinja2:96 +msgid "Disable Access Control" +msgstr "Toegangscontrole uitschakelen" + +#: src/octoprint/templates/dialogs.jinja2:97 +msgid "Keep Access Control Enabled" +msgstr "Laat toegangscontrole ingeschakeld" + +#: src/octoprint/templates/index.jinja2:57 +msgid "Settings" +msgstr "Instellingen" + +#: src/octoprint/templates/index.jinja2:63 +msgid "System" +msgstr "Systeem" + +#: src/octoprint/templates/index.jinja2:83 +msgid "Remember me" +msgstr "Onthoud me" + +#: src/octoprint/templates/index.jinja2:88 +msgid "Change Password" +msgstr "Verander wachtwoord" + +#: src/octoprint/templates/index.jinja2:89 +msgid "Logout" +msgstr "Uitloggen" + +#: src/octoprint/templates/index.jinja2:103 +msgid "Connection" +msgstr "Verbinding" + +#: src/octoprint/templates/index.jinja2:107 +#: src/octoprint/templates/settings.jinja2:30 +msgid "Serial Port" +msgstr "Seriële poort" + +#: src/octoprint/templates/index.jinja2:109 +#: src/octoprint/templates/settings.jinja2:36 +msgid "Baudrate" +msgstr "Baudrate" + +#: src/octoprint/templates/index.jinja2:112 +msgid "Save connection settings" +msgstr "Verbindings instellingen opslaan" + +#: src/octoprint/templates/index.jinja2:115 +msgid "Auto-connect on server startup" +msgstr "Automatisch herverbinden bij opstarten van server" + +#: src/octoprint/templates/index.jinja2:123 +msgid "State" +msgstr "Status" + +#: src/octoprint/templates/index.jinja2:127 +msgid "Machine State" +msgstr "Machine status" + +#: src/octoprint/templates/index.jinja2:128 +msgid "File" +msgstr "Bestand" + +#: src/octoprint/templates/index.jinja2:129 +#: src/octoprint/templates/index.jinja2:247 +msgid "Timelapse" +msgstr "Timelapse" + +#: src/octoprint/templates/index.jinja2:133 +msgid "Approx. Total Print Time" +msgstr "Geschat. totale print tijd" + +#: src/octoprint/templates/index.jinja2:134 +msgid "Print Time" +msgstr "Print tijd" + +#: src/octoprint/templates/index.jinja2:135 +msgid "Print Time Left" +msgstr "Resterende print tijd" + +#: src/octoprint/templates/index.jinja2:136 +msgid "Printed" +msgstr "Geprint" + +#: src/octoprint/templates/index.jinja2:143 +msgid "Restart" +msgstr "Herstarten" + +#: src/octoprint/templates/index.jinja2:143 +msgid "Print" +msgstr "Print" + +#: src/octoprint/templates/index.jinja2:152 +msgid "Files" +msgstr "Bestanden" + +#: src/octoprint/templates/index.jinja2:159 +msgid "Sort by name" +msgstr "Sorteer op naam" + +#: src/octoprint/templates/index.jinja2:159 +#: src/octoprint/templates/index.jinja2:556 +#: src/octoprint/templates/settings.jinja2:630 +msgid "ascending" +msgstr "Oplopend" + +#: src/octoprint/templates/index.jinja2:160 +msgid "Sort by upload date" +msgstr "Sorteer op upload datum" + +#: src/octoprint/templates/index.jinja2:160 +#: src/octoprint/templates/index.jinja2:161 +#: src/octoprint/templates/index.jinja2:556 +#: src/octoprint/templates/settings.jinja2:630 +msgid "descending" +msgstr "Aflopend" + +#: src/octoprint/templates/index.jinja2:161 +msgid "Sort by file size" +msgstr "Sorteer op bestands grootte" + +#: src/octoprint/templates/index.jinja2:164 +msgid "Only show files stored locally" +msgstr "Laat alleen lokale bestanden zien" + +#: src/octoprint/templates/index.jinja2:165 +msgid "Only show files stored on SD" +msgstr "Laat alleen bestanden op SD zien" + +#: src/octoprint/templates/index.jinja2:168 +msgid "Hide successfully printed files" +msgstr "Verberg succesvolle geprinte bestanden" + +#: src/octoprint/templates/index.jinja2:178 +msgid "Initialize SD card" +msgstr "Formateer SD kaart" + +#: src/octoprint/templates/index.jinja2:179 +msgid "Refresh SD files" +msgstr "Ververs SD bestandslijst" + +#: src/octoprint/templates/index.jinja2:180 +msgid "Release SD card" +msgstr "Geef SD kaart vrij" + +#: src/octoprint/templates/index.jinja2:188 +msgid "Search..." +msgstr "Zoek..." + +#: src/octoprint/templates/index.jinja2:193 +msgid "Uploaded" +msgstr "Geupload" + +#: src/octoprint/templates/index.jinja2:194 +#: src/octoprint/templates/index.jinja2:556 +#: src/octoprint/templates/index.jinja2:562 +#: src/octoprint/templates/settings.jinja2:630 +#: src/octoprint/templates/settings.jinja2:637 +msgid "Size" +msgstr "Grootte" + +#: src/octoprint/templates/index.jinja2:198 +msgid "Download" +msgstr "Download" + +#: src/octoprint/templates/index.jinja2:199 +msgid "Remove" +msgstr "Verwijderen" + +#: src/octoprint/templates/index.jinja2:200 +msgid "Load" +msgstr "Laden" + +#: src/octoprint/templates/index.jinja2:201 +msgid "Load and Print" +msgstr "Laad en print" + +#: src/octoprint/templates/index.jinja2:206 +msgid "Free" +msgstr "Vrij" + +#: src/octoprint/templates/index.jinja2:233 +msgid "Hint: You can also drag and drop files on this page to upload them." +msgstr "Hint: Je kunt ook bestanden naar deze pagina slepen en loslaten om ze te uploaden." + +#: src/octoprint/templates/index.jinja2:243 +msgid "Temperature" +msgstr "Temperatuur" + +#: src/octoprint/templates/index.jinja2:244 +msgid "Control" +msgstr "Controle" + +#: src/octoprint/templates/index.jinja2:245 +msgid "GCode Viewer" +msgstr "GCode kijker" + +#: src/octoprint/templates/index.jinja2:246 +msgid "Terminal" +msgstr "Terminal" + +#: src/octoprint/templates/index.jinja2:264 +msgid "Offset" +msgstr "Offset" + +#: src/octoprint/templates/index.jinja2:280 +#: src/octoprint/templates/index.jinja2:302 +msgid "Set" +msgstr "Stel" + +#: src/octoprint/templates/index.jinja2:292 +#: src/octoprint/templates/index.jinja2:523 +msgid "Off" +msgstr "Uit" + +#: src/octoprint/templates/index.jinja2:360 +msgid "Select Tool..." +msgstr "Selecteer gereedschap..." + +#: src/octoprint/templates/index.jinja2:371 +msgid "Extrude" +msgstr "Extrude" + +#: src/octoprint/templates/index.jinja2:372 +msgid "Retract" +msgstr "Retract" + +#: src/octoprint/templates/index.jinja2:377 +msgid "General" +msgstr "Algemeen" + +#: src/octoprint/templates/index.jinja2:379 +msgid "Motors off" +msgstr "Motoren uit" + +#: src/octoprint/templates/index.jinja2:380 +msgid "Fans on" +msgstr "Ventilators aan" + +#: src/octoprint/templates/index.jinja2:381 +msgid "Fans off" +msgstr "Ventilators uit" + +#: src/octoprint/templates/index.jinja2:445 +msgid "Sync with job progress" +msgstr "Synchroniseer met taak voortgang" + +#: src/octoprint/templates/index.jinja2:450 +msgid "Center viewport on model" +msgstr "Centreer scherm op model" + +#: src/octoprint/templates/index.jinja2:453 +msgid "Zoom in on model" +msgstr "Zoom in op model" + +#: src/octoprint/templates/index.jinja2:459 +msgid "Show moves" +msgstr "Laat bewegingen zien" + +#: src/octoprint/templates/index.jinja2:462 +msgid "Show retracts" +msgstr "Laat retracts zien" + +#: src/octoprint/templates/index.jinja2:468 +msgid "Also show previous layer" +msgstr "Laat ook de vorige laag zien" + +#: src/octoprint/templates/index.jinja2:471 +msgid "Also show next layer" +msgstr "Laat ook volgende laag zien" + +#: src/octoprint/templates/index.jinja2:476 +msgid "Reload" +msgstr "Herladen" + +#: src/octoprint/templates/index.jinja2:503 +msgid "Autoscroll" +msgstr "Automatisch scrollen" + +#: src/octoprint/templates/index.jinja2:513 +msgid "Send" +msgstr "Verstuur" + +#: src/octoprint/templates/index.jinja2:519 +msgid "Timelapse Configuration" +msgstr "Timelapse configuratie" + +#: src/octoprint/templates/index.jinja2:521 +msgid "Timelapse Mode" +msgstr "Timelapse modues" + +#: src/octoprint/templates/index.jinja2:528 +msgid "Timelapse post roll (in rendered seconds)" +msgstr "Timelapse naloop (in gerenderde seconden)" + +#: src/octoprint/templates/index.jinja2:535 +msgid "Interval" +msgstr "Interval" + +#: src/octoprint/templates/index.jinja2:544 +msgid "Save as default" +msgstr "Stel in als standaard" + +#: src/octoprint/templates/index.jinja2:549 +msgid "Save config" +msgstr "Bewaar configuratie" + +#: src/octoprint/templates/index.jinja2:553 +msgid "Finished Timelapses" +msgstr "Complete timelapsen" + +#: src/octoprint/templates/index.jinja2:556 +#: src/octoprint/templates/settings.jinja2:630 +msgid "Sort by" +msgstr "Sorteer op" + +#: src/octoprint/templates/index.jinja2:556 +#: src/octoprint/templates/index.jinja2:561 +#: src/octoprint/templates/settings.jinja2:377 +#: src/octoprint/templates/settings.jinja2:469 +#: src/octoprint/templates/settings.jinja2:630 +#: src/octoprint/templates/settings.jinja2:636 +msgid "Name" +msgstr "Naam" + +#: src/octoprint/templates/index.jinja2:556 +msgid "Creation date" +msgstr "Creëer datum" + +#: src/octoprint/templates/index.jinja2:563 +#: src/octoprint/templates/settings.jinja2:472 +#: src/octoprint/templates/settings.jinja2:639 +msgid "Action" +msgstr "Actie" + +#: src/octoprint/templates/index.jinja2:592 +msgid "Version" +msgstr "Versie" + +#: src/octoprint/templates/index.jinja2:595 +msgid "Homepage" +msgstr "Thuispagina" + +#: src/octoprint/templates/index.jinja2:596 +msgid "Sourcecode" +msgstr "Broncode" + +#: src/octoprint/templates/index.jinja2:597 +msgid "Documentation" +msgstr "Documentatie" + +#: src/octoprint/templates/index.jinja2:598 +msgid "Bugs and Requests" +msgstr "Bugs en Verzoeken" + +#: src/octoprint/templates/settings.jinja2:4 +msgid "OctoPrint Settings" +msgstr "OctoPrint instellingen" + +#: src/octoprint/templates/settings.jinja2:9 +msgid "Printer" +msgstr "Printer" + +#: src/octoprint/templates/settings.jinja2:10 +msgid "Serial Connection" +msgstr "Seriële verbinding" + +#: src/octoprint/templates/settings.jinja2:11 +msgid "Printer Parameters" +msgstr "Printer Parameters" + +#: src/octoprint/templates/settings.jinja2:12 +msgid "Temperatures" +msgstr "Temperaturen" + +#: src/octoprint/templates/settings.jinja2:13 +msgid "Terminal filters" +msgstr "Terminal filters" + +#: src/octoprint/templates/settings.jinja2:14 +#: src/octoprint/templates/settings.jinja2:15 +msgid "Features" +msgstr "Functies" + +#: src/octoprint/templates/settings.jinja2:16 +msgid "Webcam" +msgstr "Webcam" + +#: src/octoprint/templates/settings.jinja2:17 +msgid "Cura" +msgstr "Cura" + +#: src/octoprint/templates/settings.jinja2:18 +msgid "Access Control" +msgstr "Toegangs controle" + +#: src/octoprint/templates/settings.jinja2:19 +msgid "API" +msgstr "API" + +#: src/octoprint/templates/settings.jinja2:21 +msgid "Folders" +msgstr "Mappen" + +#: src/octoprint/templates/settings.jinja2:22 +msgid "Appearance" +msgstr "Uiterlijk" + +#: src/octoprint/templates/settings.jinja2:23 +#: src/octoprint/templates/settings.jinja2:626 +msgid "Logs" +msgstr "Logs" + +#: src/octoprint/templates/settings.jinja2:44 +msgid "Auto-connect to printer on server start" +msgstr "Automatisch verbinden met printer bij starten server" + +#: src/octoprint/templates/settings.jinja2:49 +msgid "Communication timeout" +msgstr "Communicatie timed-out" + +#: src/octoprint/templates/settings.jinja2:58 +msgid "Temperature timeout" +msgstr "Temperatuur timed-out" + +#: src/octoprint/templates/settings.jinja2:67 +msgid "SD status timeout" +msgstr "SD status timeout" + +#: src/octoprint/templates/settings.jinja2:76 +msgid "Connection timeout" +msgstr "Verbinding timed-out" + +#: src/octoprint/templates/settings.jinja2:85 +msgid "Autodetection timeout" +msgstr "Auto detectie timed-out" + +#: src/octoprint/templates/settings.jinja2:96 +msgid "Log communication to serial.log (might negatively impact performance)" +msgstr "Log communicatie naar serial.log (kan negetief zijn voor de prestaties)" + +#: src/octoprint/templates/settings.jinja2:96 +msgid "Warning" +msgstr "Waarschuwing" + +#: src/octoprint/templates/settings.jinja2:105 +msgid "Axis" +msgstr "Assen" + +#: src/octoprint/templates/settings.jinja2:107 +#: src/octoprint/templates/settings.jinja2:176 +msgid "X" +msgstr "X" + +#: src/octoprint/templates/settings.jinja2:113 +#: src/octoprint/templates/settings.jinja2:123 +#: src/octoprint/templates/settings.jinja2:133 +msgid "Invert control" +msgstr "Bedieining spiegelen" + +#: src/octoprint/templates/settings.jinja2:117 +#: src/octoprint/templates/settings.jinja2:181 +msgid "Y" +msgstr "Y" + +#: src/octoprint/templates/settings.jinja2:127 +msgid "Z" +msgstr "Z" + +#: src/octoprint/templates/settings.jinja2:137 +msgid "E" +msgstr "E" + +#: src/octoprint/templates/settings.jinja2:145 +msgid "Default extrusion length" +msgstr "Standaard extrusion lengte" + +#: src/octoprint/templates/settings.jinja2:151 +msgid "Number of Extruders" +msgstr "Aantal Extruders" + +#: src/octoprint/templates/settings.jinja2:157 +msgid "Extruder Offsets" +msgstr "Extruder Offsets" + +#: src/octoprint/templates/settings.jinja2:174 +msgid "Bed Size" +msgstr "Platform grootte" + +#: src/octoprint/templates/settings.jinja2:188 +msgid "Radius" +msgstr "Straal" + +#: src/octoprint/templates/settings.jinja2:196 +msgid "Circular" +msgstr "Cirkelvormig" + +#: src/octoprint/templates/settings.jinja2:205 +msgid "Stream URL" +msgstr "Stream URL" + +#: src/octoprint/templates/settings.jinja2:211 +msgid "Snapshot URL" +msgstr "Snapshot URL" + +#: src/octoprint/templates/settings.jinja2:217 +msgid "Path to FFMPEG" +msgstr "Lokatie van FFMPEG" + +#: src/octoprint/templates/settings.jinja2:223 +msgid "Timelapse bitrate" +msgstr "Timelapse bitrate" + +#: src/octoprint/templates/settings.jinja2:231 +msgid "Enable OctoPrint watermark in timelapse movies" +msgstr "Schakel OctoPrint watermerk in bij timelapse films" + +#: src/octoprint/templates/settings.jinja2:238 +msgid "Flip webcam horizontally" +msgstr "Spiegel webcam Horizontaal" + +#: src/octoprint/templates/settings.jinja2:243 +msgid "Flip webcam vertically" +msgstr "Spiegel webcam verticaal" + +#: src/octoprint/templates/settings.jinja2:254 +msgid "Enable Temperature Graph" +msgstr "Schakel temperatuur grafiek in" + +#: src/octoprint/templates/settings.jinja2:261 +msgid "Enable GCode Visualizer" +msgstr "Schakel GCode Visualizer in" + +#: src/octoprint/templates/settings.jinja2:268 +msgid "Enable SD support" +msgstr "Schakel SD ondersteuning in" + +#: src/octoprint/templates/settings.jinja2:275 +msgid "Always assume SD card is present" +msgstr "Neem aan dat SD kaart altijd aanwezig is" + +#: src/octoprint/templates/settings.jinja2:275 +#: src/octoprint/templates/settings.jinja2:289 +#: src/octoprint/templates/settings.jinja2:296 +msgid "Repetier" +msgstr "Repetier" + +#: src/octoprint/templates/settings.jinja2:282 +msgid "Wait for start on connect" +msgstr "Wacht voor start bij het verbinden" + +#: src/octoprint/templates/settings.jinja2:289 +msgid "Send a checksum with every command" +msgstr "Stuur een checksum met elk commando" + +#: src/octoprint/templates/settings.jinja2:296 +#, python-format +msgid "" +"Support TargetExtr%%n/TargetBed target temperature" +" format" +msgstr "Support TargetExtr%%n/TargetBed target temperature format" + +#: src/octoprint/templates/settings.jinja2:303 +msgid "Swallow the first \"ok\" after a resend response" +msgstr "Eerste \"ok\" negeren na opnieuw verzonden reactie" + +#: src/octoprint/templates/settings.jinja2:312 +msgid "Upload Folder" +msgstr "Lokatie voor Uploads" + +#: src/octoprint/templates/settings.jinja2:318 +msgid "Timelapse Folder" +msgstr "Lokatie voor timelapse" + +#: src/octoprint/templates/settings.jinja2:324 +msgid "Timelapse Temp Folder" +msgstr "Tijdelijke timelapse map" + +#: src/octoprint/templates/settings.jinja2:330 +msgid "Logs Folder" +msgstr "Logboek map" + +#: src/octoprint/templates/settings.jinja2:336 +msgid "Watched Folder" +msgstr "Bekeken map" + +#: src/octoprint/templates/settings.jinja2:346 +msgid "Extruder" +msgstr "Extruder" + +#: src/octoprint/templates/settings.jinja2:378 +msgid "RegExp" +msgstr "Reguliere Expressie" + +#: src/octoprint/templates/settings.jinja2:403 +msgid "Title" +msgstr "Titel" + +#: src/octoprint/templates/settings.jinja2:409 +msgid "Color" +msgstr "Kleur" + +#: src/octoprint/templates/settings.jinja2:420 +msgid "Enable slicing via Cura" +msgstr "Schakel slicen via Cura in" + +#: src/octoprint/templates/settings.jinja2:426 +msgid "Path to Cura" +msgstr "Lokatie van Cura" + +#: src/octoprint/templates/settings.jinja2:432 +msgid "Path to Cura config" +msgstr "Map voor Cura config" + +#: src/octoprint/templates/settings.jinja2:444 +msgid "Enable" +msgstr "Ingeschakeld" + +#: src/octoprint/templates/settings.jinja2:451 +#, python-format +msgid "Allow Cross Origin Resource Sharing (CORS)" +msgstr "Sta Cross Origin Resource Sharing (CORS) toe" + +#: src/octoprint/templates/settings.jinja2:456 +#: src/octoprint/templates/settings.jinja2:477 +msgid "API Key" +msgstr "API sleutel" + +#: src/octoprint/templates/settings.jinja2:470 +#: src/octoprint/templates/settings.jinja2:531 +#: src/octoprint/templates/settings.jinja2:560 +msgid "Active" +msgstr "Aktief" + +#: src/octoprint/templates/settings.jinja2:471 +#: src/octoprint/templates/settings.jinja2:538 +#: src/octoprint/templates/settings.jinja2:567 +msgid "Admin" +msgstr "Admin" + +#: src/octoprint/templates/settings.jinja2:481 +msgid "Update User" +msgstr "Update gebruiker" + +#: src/octoprint/templates/settings.jinja2:481 +msgid "Change password" +msgstr "Verander wachtwoord" + +#: src/octoprint/templates/settings.jinja2:481 +msgid "Delete user" +msgstr "Gebruiker verwijderen" + +#: src/octoprint/templates/settings.jinja2:498 +#: src/octoprint/templates/settings.jinja2:505 +msgid "Add user" +msgstr "Gebruiker toevoegen" + +#: src/octoprint/templates/settings.jinja2:522 +#: src/octoprint/templates/settings.jinja2:593 +msgid "Repeat Password" +msgstr "Wachtwoord herhalen" + +#: src/octoprint/templates/settings.jinja2:545 +#: src/octoprint/templates/settings.jinja2:574 +#: src/octoprint/templates/settings.jinja2:616 +msgid "Abort" +msgstr "Afbreken" + +#: src/octoprint/templates/settings.jinja2:546 +#: src/octoprint/templates/settings.jinja2:575 +#: src/octoprint/templates/settings.jinja2:617 +msgid "Confirm" +msgstr "Bevestig" + +#: src/octoprint/templates/settings.jinja2:553 +#, python-format +msgid "Edit user \"%(user)s\"" +msgstr "Bewerk gebruiker \"%(user)s\"" + +#: src/octoprint/templates/settings.jinja2:582 +#, python-format +msgid "Change password for user \"%(user)s\"" +msgstr "Verander wachtwoord voor gebruiker \"%(user)s\"" + +#: src/octoprint/templates/settings.jinja2:587 +msgid "New Password" +msgstr "Nieuw wachtwoord" + +#: src/octoprint/templates/settings.jinja2:602 +msgid "Current API Key" +msgstr "Huidige API sleutel" + +#: src/octoprint/templates/settings.jinja2:605 +msgid "N/A" +msgstr "N/B" + +#: src/octoprint/templates/settings.jinja2:630 +msgid "Modification date" +msgstr "Datum aangepast" + +#: src/octoprint/templates/settings.jinja2:638 +msgid "Date" +msgstr "Datum" + +#: src/octoprint/templates/settings.jinja2:677 +msgid "Save" +msgstr "Opslaan" diff --git a/src/octoprint/translations/no/LC_MESSAGES/messages.mo b/src/octoprint/translations/no/LC_MESSAGES/messages.mo new file mode 100644 index 000000000..64693b142 Binary files /dev/null and b/src/octoprint/translations/no/LC_MESSAGES/messages.mo differ diff --git a/src/octoprint/translations/no/LC_MESSAGES/messages.po b/src/octoprint/translations/no/LC_MESSAGES/messages.po new file mode 100644 index 000000000..c17c15bf0 --- /dev/null +++ b/src/octoprint/translations/no/LC_MESSAGES/messages.po @@ -0,0 +1,1243 @@ +# Translations template for OctoPrint. +# Copyright (C) 2014 The OctoPrint Project +# This file is distributed under the same license as the OctoPrint project. +# +# Translators: +# lobster2b , 2014 +# zelluz , 2014 +msgid "" +msgstr "" +"Project-Id-Version: OctoPrint\n" +"Report-Msgid-Bugs-To: i18n@octoprint.org\n" +"POT-Creation-Date: 2014-08-28 15:52+0200\n" +"PO-Revision-Date: 2014-09-03 16:07+0000\n" +"Last-Translator: lobster2b \n" +"Language-Team: Norwegian (http://www.transifex.com/projects/p/octoprint/language/no/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 1.3\n" +"Language: no\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: src/octoprint/static/js/app/dataupdater.js:43 +msgid "" +"The server appears to be offline, at least I'm not getting any response from" +" it. I'll try to reconnect automatically over the next couple of " +"minutes, however you are welcome to try a manual reconnect anytime " +"using the button below." +msgstr "Serveren er tilsynelatende frakoblet, i det minste får jeg ikke noen respons fra den. Jeg prøver å koble til automatisk over de neste minuttene, du kan prøve en manuell oppkobling når du ønsker det ved å bruke knappen nedenfor." + +#: src/octoprint/static/js/app/dataupdater.js:58 +msgid "" +"The server appears to be offline, at least I'm not getting any response from" +" it. I could not reconnect automatically, but you may try a" +" manual reconnect using the button below." +msgstr "Serveren er tilsynelatende frakoblet, i det minste får jeg ikke noen respons fra den. Jeg kan ikke koble til den automatisk, du kan prøve en manuell oppkobling når du ønsker det ved å bruke knappen nedenfor." + +#: src/octoprint/static/js/app/dataupdater.js:126 +msgid "Rendering timelapse" +msgstr "Sammensetter timelapse" + +#: src/octoprint/static/js/app/dataupdater.js:126 +#, python-format +msgid "Now rendering timelapse %(movie_basename)s" +msgstr "Sammensetter timelapse %(movie_basename)s" + +#: src/octoprint/static/js/app/dataupdater.js:128 +msgid "Timelapse ready" +msgstr "Timelapse klar" + +#: src/octoprint/static/js/app/dataupdater.js:128 +#, python-format +msgid "New timelapse %(movie_basename)s is done rendering." +msgstr "Ny timelapse for %(movie_basename)s er ferdig sammensatt" + +#: src/octoprint/static/js/app/dataupdater.js:131 +#, python-format +msgid "" +"Rendering of timelapse %(movie_basename)s failedwith return code " +"%(returncode)s" +msgstr "Sammensetting av timelapse %(movie_basename)s feilet med feilkode %(returncode)s" + +#: src/octoprint/static/js/app/dataupdater.js:133 +msgid "Rendering failed" +msgstr "Sammensetting feilet" + +#: src/octoprint/static/js/app/dataupdater.js:137 +msgid "Slicing ..." +msgstr "Slicing ..." + +#: src/octoprint/static/js/app/dataupdater.js:142 +msgid "Slicing done" +msgstr "Slicing ferdig" + +#: src/octoprint/static/js/app/dataupdater.js:142 +#, python-format +msgid "Sliced %(stl)s to %(gcode)s, took %(time).2f seconds" +msgstr "Sliced %(stl)s til %(gcode)s, tok %(time).2f sekunder" + +#: src/octoprint/static/js/app/dataupdater.js:149 +#, python-format +msgid "Could not slice %(stl)s to %(gcode)s: %(reason)s" +msgstr "Feilet å slice %(stl)s til %(gcode)s: %(reason)s" + +#: src/octoprint/static/js/app/dataupdater.js:150 +msgid "Slicing failed" +msgstr "Slicing feilet" + +#: src/octoprint/static/js/app/dataupdater.js:154 +msgid "Streaming ..." +msgstr "Streaming ..." + +#: src/octoprint/static/js/app/dataupdater.js:159 +msgid "Streaming done" +msgstr "Streaming ferdig" + +#: src/octoprint/static/js/app/dataupdater.js:159 +#, python-format +msgid "Streamed %(local)s to %(remote)s on SD, took %(time).2f seconds" +msgstr "Streamed %(local)s il %(remote)s på minnekort, took %(time).2f sekunder" + +#: src/octoprint/static/js/app/helpers.js:337 +#, python-format +msgid "%(hour)02d:%(minute)02d:%(second)02d" +msgstr "%(hour)02d:%(minute)02d:%(second)02d" + +#: src/octoprint/static/js/app/helpers.js:342 +msgid "YYYY-MM-DD HH:mm" +msgstr "YYYY-MM-DD HH:mm" + +#: src/octoprint/static/js/app/helpers.js:360 +#: src/octoprint/static/js/app/helpers.js:365 +msgid "off" +msgstr "Av" + +#: src/octoprint/static/js/app/main.js:17 +msgid "Offline" +msgstr "Frakoblet" + +#: src/octoprint/static/js/app/main.js:18 +msgid "Opening serial port" +msgstr "Åpner serialport" + +#: src/octoprint/static/js/app/main.js:19 +msgid "Detecting serial port" +msgstr "Finner serialport" + +#: src/octoprint/static/js/app/main.js:20 +msgid "Detecting baudrate" +msgstr "Finner seriell hastighet" + +#: src/octoprint/static/js/app/main.js:21 +msgid "Connecting" +msgstr "Kobler til" + +#: src/octoprint/static/js/app/main.js:22 +msgid "Operational" +msgstr "Operativ" + +#: src/octoprint/static/js/app/main.js:23 +msgid "Printing from SD" +msgstr "Utskrift fra minnekort" + +#: src/octoprint/static/js/app/main.js:24 +msgid "Sending file to SD" +msgstr "Sender fil til minnekort" + +#: src/octoprint/static/js/app/main.js:25 +msgid "Printing" +msgstr "Skriver ut" + +#: src/octoprint/static/js/app/main.js:26 +msgid "Paused" +msgstr "Pause" + +#: src/octoprint/static/js/app/main.js:27 +msgid "Closed" +msgstr "Lukket" + +#: src/octoprint/static/js/app/main.js:28 +msgid "Transfering file to SD" +msgstr "Overfører til minnekort" + +#: src/octoprint/static/js/app/main.js:132 +msgid "" +"Could not upload the file. Make sure that it is a GCODE file and has the " +"extension \".gcode\" or \".gco\" or that it is an STL file with the " +"extension \".stl\" and slicing support is enabled and configured." +msgstr "Klarte ikke å laste opp filen, Sørg for at det er en GCODE fil med filtype \".gcode\" eller \".gco\" eller det er en STL fil med filtype \".stl\" og at slicing er aktivert og konfigurert." + +#: src/octoprint/static/js/app/main.js:148 +msgid "Uploading ..." +msgstr "Laster opp ..." + +#: src/octoprint/static/js/app/main.js:151 +msgid "Saving ..." +msgstr "Lagrer ..." + +#: src/octoprint/static/js/app/viewmodels/appearance.js:9 +#: src/octoprint/static/js/app/viewmodels/appearance.js:11 +#: src/octoprint/static/js/app/viewmodels/appearance.js:16 +#: src/octoprint/static/js/app/viewmodels/appearance.js:18 +msgid "OctoPrint" +msgstr "OctoPrint" + +#: src/octoprint/static/js/app/viewmodels/connection.js:24 +#: src/octoprint/templates/index.jinja2:117 +msgid "Connect" +msgstr "Koble til" + +#: src/octoprint/static/js/app/viewmodels/connection.js:26 +msgid "Disconnect" +msgstr "Koble fra" + +#: src/octoprint/static/js/app/viewmodels/control.js:38 +#: src/octoprint/static/js/app/viewmodels/files.js:286 +#: src/octoprint/static/js/app/viewmodels/gcode.js:332 +#: src/octoprint/static/js/app/viewmodels/gcode.js:363 +#: src/octoprint/static/js/app/viewmodels/printerstate.js:137 +#: src/octoprint/static/js/app/viewmodels/temperature.js:56 +msgid "Tool" +msgstr "Verktøy" + +#: src/octoprint/static/js/app/viewmodels/control.js:45 +#: src/octoprint/static/js/app/viewmodels/temperature.js:68 +msgid "Hotend" +msgstr "Dyse" + +#: src/octoprint/static/js/app/viewmodels/files.js:281 +#: src/octoprint/static/js/app/viewmodels/files.js:286 +msgid "Filament" +msgstr "Tråd" + +#: src/octoprint/static/js/app/viewmodels/files.js:290 +msgid "Estimated Print Time" +msgstr "Bergenet utskriftstid" + +#: src/octoprint/static/js/app/viewmodels/files.js:293 +msgid "Last Printed" +msgstr "Sist utskrevet" + +#: src/octoprint/static/js/app/viewmodels/files.js:295 +msgid "Last Print Time" +msgstr "Siste utskriftstid" + +#: src/octoprint/static/js/app/viewmodels/firstrun.js:37 +msgid "" +"If you disable Access Control and your OctoPrint " +"installation is accessible from the internet, your printer will be " +"accessible by everyone - that also includes the bad guys!" +msgstr "Hvis du slår av adgangskontroll og din OctoPrint innstallasjon er tilgjengelig fra internett, din printer vil bli tilgjengelig for alle - inkluderer også dei med uærlige intensjoner" + +#: src/octoprint/static/js/app/viewmodels/gcode.js:13 +msgid "Loading..." +msgstr "Laster..." + +#: src/octoprint/static/js/app/viewmodels/gcode.js:17 +msgid "Analyzing..." +msgstr "Analyserer..." + +#: src/octoprint/static/js/app/viewmodels/gcode.js:21 +msgid "Analyzed" +msgstr "Analysert" + +#: src/octoprint/static/js/app/viewmodels/gcode.js:327 +msgid "Model size" +msgstr "Modellstørrelse" + +#: src/octoprint/static/js/app/viewmodels/gcode.js:329 +#: src/octoprint/static/js/app/viewmodels/gcode.js:332 +msgid "Total filament used" +msgstr "Totalt trådforbruk" + +#: src/octoprint/static/js/app/viewmodels/gcode.js:329 +#: src/octoprint/static/js/app/viewmodels/gcode.js:332 +#: src/octoprint/static/js/app/viewmodels/gcode.js:336 +msgid "mm" +msgstr "mm" + +#: src/octoprint/static/js/app/viewmodels/gcode.js:335 +msgid "Estimated print time" +msgstr "Beregnet printtid" + +#: src/octoprint/static/js/app/viewmodels/gcode.js:336 +msgid "Estimated layer height" +msgstr "Estimert laghøyde" + +#: src/octoprint/static/js/app/viewmodels/gcode.js:337 +msgid "Layer count" +msgstr "Antall lag" + +#: src/octoprint/static/js/app/viewmodels/gcode.js:337 +msgid "visited" +msgstr "besøkt" + +#: src/octoprint/static/js/app/viewmodels/gcode.js:356 +msgid "Layer number" +msgstr "Lag nummer" + +#: src/octoprint/static/js/app/viewmodels/gcode.js:357 +msgid "Layer height" +msgstr "Lag høyde" + +#: src/octoprint/static/js/app/viewmodels/gcode.js:358 +msgid "GCODE commands in layer" +msgstr "GCODE kommandoer i lag" + +#: src/octoprint/static/js/app/viewmodels/gcode.js:360 +#: src/octoprint/static/js/app/viewmodels/gcode.js:363 +msgid "Filament used by layer" +msgstr "Tråd brukt i laget" + +#: src/octoprint/static/js/app/viewmodels/gcode.js:366 +msgid "Print time for layer" +msgstr "Printtid for lag" + +#: src/octoprint/static/js/app/viewmodels/loginstate.js:15 +#: src/octoprint/templates/index.jinja2:74 +#: src/octoprint/templates/index.jinja2:85 +msgid "Login" +msgstr "Logg inn" + +#: src/octoprint/static/js/app/viewmodels/loginstate.js:70 +msgid "Login successful" +msgstr "Logg inn vellykket" + +#: src/octoprint/static/js/app/viewmodels/loginstate.js:70 +#, python-format +msgid "You are now logged in as \"%(username)s\"" +msgstr "Du er no logget inn som \"%(username)s\"" + +#: src/octoprint/static/js/app/viewmodels/loginstate.js:74 +msgid "Login failed" +msgstr "Logg inn misslykkes" + +#: src/octoprint/static/js/app/viewmodels/loginstate.js:74 +msgid "User unknown or wrong password" +msgstr "Bruker ukjent eller feil passord" + +#: src/octoprint/static/js/app/viewmodels/loginstate.js:84 +msgid "Logout successful" +msgstr "Logg ut vellykket" + +#: src/octoprint/static/js/app/viewmodels/loginstate.js:84 +msgid "You are now logged out" +msgstr "Du er nå logget ut" + +#: src/octoprint/static/js/app/viewmodels/navigation.js:17 +#, python-format +msgid "The command \"%(command)s\" executed successfully" +msgstr "Kommando \"%(command)s\" vellykket" + +#: src/octoprint/static/js/app/viewmodels/navigation.js:20 +#, python-format +msgid "The command \"%(command)s\" could not be executed." +msgstr "Kommando \"%(command)s\" mislykkes" + +#: src/octoprint/static/js/app/viewmodels/navigation.js:22 +msgid "Error" +msgstr "Feil" + +#: src/octoprint/static/js/app/viewmodels/printerstate.js:66 +msgid "Continue" +msgstr "Fortsett" + +#: src/octoprint/static/js/app/viewmodels/printerstate.js:68 +#: src/octoprint/templates/index.jinja2:144 +msgid "Pause" +msgstr "Pause" + +#: src/octoprint/static/js/app/viewmodels/printerstate.js:79 +#: src/octoprint/templates/index.jinja2:524 +msgid "On Z Change" +msgstr "På Z endring" + +#: src/octoprint/static/js/app/viewmodels/printerstate.js:81 +#: src/octoprint/templates/index.jinja2:525 +msgid "Timed" +msgstr "Tidtakes" + +#: src/octoprint/static/js/app/viewmodels/printerstate.js:81 +#: src/octoprint/templates/index.jinja2:531 +#: src/octoprint/templates/index.jinja2:538 +msgid "sec" +msgstr "sek" + +#: src/octoprint/static/js/app/viewmodels/printerstate.js:166 +msgid "This will restart the print job from the beginning." +msgstr "Dette vil starte utskriftsjobbene fra starten" + +#: src/octoprint/static/js/app/viewmodels/settings.js:15 +#: src/octoprint/static/js/app/viewmodels/settings.js:41 +msgid "default" +msgstr "standard" + +#: src/octoprint/static/js/app/viewmodels/settings.js:16 +#: src/octoprint/static/js/app/viewmodels/settings.js:27 +msgid "red" +msgstr "rød" + +#: src/octoprint/static/js/app/viewmodels/settings.js:17 +#: src/octoprint/static/js/app/viewmodels/settings.js:29 +msgid "orange" +msgstr "orange" + +#: src/octoprint/static/js/app/viewmodels/settings.js:18 +#: src/octoprint/static/js/app/viewmodels/settings.js:31 +msgid "yellow" +msgstr "gul" + +#: src/octoprint/static/js/app/viewmodels/settings.js:19 +#: src/octoprint/static/js/app/viewmodels/settings.js:33 +msgid "green" +msgstr "grønn" + +#: src/octoprint/static/js/app/viewmodels/settings.js:20 +#: src/octoprint/static/js/app/viewmodels/settings.js:35 +msgid "blue" +msgstr "blå" + +#: src/octoprint/static/js/app/viewmodels/settings.js:21 +#: src/octoprint/static/js/app/viewmodels/settings.js:37 +msgid "violet" +msgstr "fiolett" + +#: src/octoprint/static/js/app/viewmodels/settings.js:22 +#: src/octoprint/static/js/app/viewmodels/settings.js:39 +msgid "black" +msgstr "svart" + +#: src/octoprint/static/js/app/viewmodels/temperature.js:22 +#: src/octoprint/static/js/app/viewmodels/temperature.js:74 +#: src/octoprint/templates/settings.jinja2:347 +msgid "Bed" +msgstr "Bord" + +#: src/octoprint/static/js/app/viewmodels/temperature.js:110 +msgid "just now" +msgstr "Akkurat no" + +#: src/octoprint/static/js/app/viewmodels/temperature.js:112 +msgid "min" +msgstr "min" + +#: src/octoprint/static/js/app/viewmodels/temperature.js:252 +#: src/octoprint/templates/index.jinja2:262 +msgid "Actual" +msgstr "Faktisk" + +#: src/octoprint/static/js/app/viewmodels/temperature.js:257 +#: src/octoprint/templates/index.jinja2:263 +msgid "Target" +msgstr "Mål" + +#: src/octoprint/templates/dialogs.jinja2:6 +msgid "Server is offline" +msgstr "Server er frakoblet" + +#: src/octoprint/templates/dialogs.jinja2:9 +msgid "Attempt to reconnect" +msgstr "Forsøk å koble til på nytt" + +#: src/octoprint/templates/dialogs.jinja2:20 +msgid "Upload locally" +msgstr "Last opp lokalt" + +#: src/octoprint/templates/dialogs.jinja2:22 +#: src/octoprint/templates/index.jinja2:218 +msgid "Upload to SD" +msgstr "Last opp til minnekort" + +#: src/octoprint/templates/dialogs.jinja2:22 +msgid "SD not initialized" +msgstr "Minnekort er ikke startet" + +#: src/octoprint/templates/dialogs.jinja2:25 +#: src/octoprint/templates/index.jinja2:213 +#: src/octoprint/templates/index.jinja2:224 +msgid "Upload" +msgstr "Last opp" + +#: src/octoprint/templates/dialogs.jinja2:34 +msgid "Are you sure?" +msgstr "Er du sikker?" + +#: src/octoprint/templates/dialogs.jinja2:38 +msgid "Are you sure you want to proceed?" +msgstr "Er du sikker du vil fortsette?" + +#: src/octoprint/templates/dialogs.jinja2:41 +#: src/octoprint/templates/index.jinja2:145 +#: src/octoprint/templates/settings.jinja2:676 +msgid "Cancel" +msgstr "Avbryt" + +#: src/octoprint/templates/dialogs.jinja2:42 +msgid "Proceed" +msgstr "Fortsett" + +#: src/octoprint/templates/dialogs.jinja2:48 +msgid "Configure Access Control" +msgstr "Konfigurer adgangskontroll" + +#: src/octoprint/templates/dialogs.jinja2:51 +msgid "" +"

    \n" +" Please read the following, it is very important for your printer's health!\n" +"

    \n" +"

    \n" +" OctoPrint by default now ships with Access Control enabled, meaning you won't be able to do anything with the\n" +" printer unless you login first as a configured user. This is to prevent strangers - possibly with\n" +" malicious intent - to gain access to your printer via the internet or another untrustworthy network\n" +" and using it in such a way that it is damaged or worse (i.e. causes a fire).\n" +"

    \n" +"

    \n" +" It looks like you haven't configured access control yet. Please set up an username and password for the\n" +" initial administrator account who will have full access to both the printer and OctoPrint's settings, then click\n" +" on \"Keep Access Control Enabled\":\n" +"

    " +msgstr "

    \nVennligst les følgende, det er veldig viktig for din printers helse!!\n

    \n

    \nOctoPrint kommer originalt med adgangskontroll aktivert, som betyr at du ikke får gjort noe med\nprinteren med mindre du logger inn med en konfigurert bruker. Dette er for å forhindre ukjente - med potensielt\nuærlige intensjoner - fra å få tilgang til din printer via Internett eller et usikret nettverk\nog bruker den i en slik måte at skade oppstår eller verre (f.eks forårsaker en brann).\n

    \n

    \nDu har ikke konfigurert adgangskontrollen enda. Vennligst sett et brukernavn og passord for den\nførste administratorkontoen som vil ha full adgang til både skriveren og OctoPrint innstillinger, klikk deretter på\n\"Behold adgangskontroll aktivert\":\n

    " + +#: src/octoprint/templates/dialogs.jinja2:67 +#: src/octoprint/templates/index.jinja2:78 +#: src/octoprint/templates/index.jinja2:79 +#: src/octoprint/templates/settings.jinja2:510 +msgid "Username" +msgstr "Brukernavn" + +#: src/octoprint/templates/dialogs.jinja2:73 +#: src/octoprint/templates/index.jinja2:80 +#: src/octoprint/templates/index.jinja2:81 +#: src/octoprint/templates/settings.jinja2:516 +msgid "Password" +msgstr "Passord" + +#: src/octoprint/templates/dialogs.jinja2:79 +msgid "Confirm Password" +msgstr "Bekreft passord" + +#: src/octoprint/templates/dialogs.jinja2:82 +#: src/octoprint/templates/settings.jinja2:525 +#: src/octoprint/templates/settings.jinja2:596 +msgid "Passwords do not match" +msgstr "Passordet er ikke likt" + +#: src/octoprint/templates/dialogs.jinja2:86 +msgid "" +"

    \n" +" Note: In case that your OctoPrint installation is only accessible from within a trustworthy network and you don't\n" +" need Access Control for other reasons, you may alternatively disable Access Control. You should only\n" +" do this if you are absolutely certain that only people you know and trust will be able to connect to it.\n" +"

    \n" +"

    \n" +" Do NOT underestimate the risk of an unsecured access from the internet to your printer!\n" +"

    " +msgstr "

    \nNoter: Hvis din OctoPrint installasjon er på et nettverk som du er helt sikker på at det er kun du eller folk du stoler på og du ikke ønsker adgangskontroll av en eller annen grunn,\nkan du deaktivere adgangskontrollen. Du burde kun\ngjøre dette vist du er helt sikker på at det er bare folk du kjenner og stoler på som vil koble til printeren.\n

    \n

    \nIKKE undervurder faren ved en usikret adgang fra Internett til din printer!\n

    " + +#: src/octoprint/templates/dialogs.jinja2:96 +msgid "Disable Access Control" +msgstr "Deaktiver adgangskontroll" + +#: src/octoprint/templates/dialogs.jinja2:97 +msgid "Keep Access Control Enabled" +msgstr "Behold adgangskontroll aktivert" + +#: src/octoprint/templates/index.jinja2:57 +msgid "Settings" +msgstr "Innstillinger" + +#: src/octoprint/templates/index.jinja2:63 +msgid "System" +msgstr "System" + +#: src/octoprint/templates/index.jinja2:83 +msgid "Remember me" +msgstr "Husk meg" + +#: src/octoprint/templates/index.jinja2:88 +msgid "Change Password" +msgstr "Endre passord" + +#: src/octoprint/templates/index.jinja2:89 +msgid "Logout" +msgstr "Logg ut" + +#: src/octoprint/templates/index.jinja2:103 +msgid "Connection" +msgstr "Tilkobling" + +#: src/octoprint/templates/index.jinja2:107 +#: src/octoprint/templates/settings.jinja2:30 +msgid "Serial Port" +msgstr "Seriellport" + +#: src/octoprint/templates/index.jinja2:109 +#: src/octoprint/templates/settings.jinja2:36 +msgid "Baudrate" +msgstr "Datemengde" + +#: src/octoprint/templates/index.jinja2:112 +msgid "Save connection settings" +msgstr "Lagre tilkoblingsinnstillinger" + +#: src/octoprint/templates/index.jinja2:115 +msgid "Auto-connect on server startup" +msgstr "Koble til automatisk ved oppstart" + +#: src/octoprint/templates/index.jinja2:123 +msgid "State" +msgstr "Tilstand" + +#: src/octoprint/templates/index.jinja2:127 +msgid "Machine State" +msgstr "Maskintilstand" + +#: src/octoprint/templates/index.jinja2:128 +msgid "File" +msgstr "Fil" + +#: src/octoprint/templates/index.jinja2:129 +#: src/octoprint/templates/index.jinja2:247 +msgid "Timelapse" +msgstr "Timelapse" + +#: src/octoprint/templates/index.jinja2:133 +msgid "Approx. Total Print Time" +msgstr "Beregnet total utskriftstid" + +#: src/octoprint/templates/index.jinja2:134 +msgid "Print Time" +msgstr "Utskriftstid" + +#: src/octoprint/templates/index.jinja2:135 +msgid "Print Time Left" +msgstr "Gjenstående utskriftstid" + +#: src/octoprint/templates/index.jinja2:136 +msgid "Printed" +msgstr "Utskrevet" + +#: src/octoprint/templates/index.jinja2:143 +msgid "Restart" +msgstr "Omstart" + +#: src/octoprint/templates/index.jinja2:143 +msgid "Print" +msgstr "Utskriv" + +#: src/octoprint/templates/index.jinja2:152 +msgid "Files" +msgstr "Filer" + +#: src/octoprint/templates/index.jinja2:159 +msgid "Sort by name" +msgstr "Sorter ved navn" + +#: src/octoprint/templates/index.jinja2:159 +#: src/octoprint/templates/index.jinja2:556 +#: src/octoprint/templates/settings.jinja2:630 +msgid "ascending" +msgstr "stigende" + +#: src/octoprint/templates/index.jinja2:160 +msgid "Sort by upload date" +msgstr "Sorter ved opplastningsdato" + +#: src/octoprint/templates/index.jinja2:160 +#: src/octoprint/templates/index.jinja2:161 +#: src/octoprint/templates/index.jinja2:556 +#: src/octoprint/templates/settings.jinja2:630 +msgid "descending" +msgstr "synkende" + +#: src/octoprint/templates/index.jinja2:161 +msgid "Sort by file size" +msgstr "Sorter filer etter størrelse" + +#: src/octoprint/templates/index.jinja2:164 +msgid "Only show files stored locally" +msgstr "Bare vis filer lagret lokalt" + +#: src/octoprint/templates/index.jinja2:165 +msgid "Only show files stored on SD" +msgstr "Bare vis filer lagret på minnekortet" + +#: src/octoprint/templates/index.jinja2:168 +msgid "Hide successfully printed files" +msgstr "Skjul vellykkede utskriftsfiler" + +#: src/octoprint/templates/index.jinja2:178 +msgid "Initialize SD card" +msgstr "Start minnekortet" + +#: src/octoprint/templates/index.jinja2:179 +msgid "Refresh SD files" +msgstr "Oppdater minnekort" + +#: src/octoprint/templates/index.jinja2:180 +msgid "Release SD card" +msgstr "Løs ut minnekort" + +#: src/octoprint/templates/index.jinja2:188 +msgid "Search..." +msgstr "Søk..." + +#: src/octoprint/templates/index.jinja2:193 +msgid "Uploaded" +msgstr "Opplastet" + +#: src/octoprint/templates/index.jinja2:194 +#: src/octoprint/templates/index.jinja2:556 +#: src/octoprint/templates/index.jinja2:562 +#: src/octoprint/templates/settings.jinja2:630 +#: src/octoprint/templates/settings.jinja2:637 +msgid "Size" +msgstr "Størrelse" + +#: src/octoprint/templates/index.jinja2:198 +msgid "Download" +msgstr "Last ned" + +#: src/octoprint/templates/index.jinja2:199 +msgid "Remove" +msgstr "Fjern" + +#: src/octoprint/templates/index.jinja2:200 +msgid "Load" +msgstr "Last" + +#: src/octoprint/templates/index.jinja2:201 +msgid "Load and Print" +msgstr "Last og skriv ut" + +#: src/octoprint/templates/index.jinja2:206 +msgid "Free" +msgstr "Ledig" + +#: src/octoprint/templates/index.jinja2:233 +msgid "Hint: You can also drag and drop files on this page to upload them." +msgstr "Tips: Du kan også dra og slippe filer på denne siden for å laste de opp" + +#: src/octoprint/templates/index.jinja2:243 +msgid "Temperature" +msgstr "Temperatur" + +#: src/octoprint/templates/index.jinja2:244 +msgid "Control" +msgstr "Kontroll" + +#: src/octoprint/templates/index.jinja2:245 +msgid "GCode Viewer" +msgstr "GCode framviser" + +#: src/octoprint/templates/index.jinja2:246 +msgid "Terminal" +msgstr "Terminal" + +#: src/octoprint/templates/index.jinja2:264 +msgid "Offset" +msgstr "Avvik" + +#: src/octoprint/templates/index.jinja2:280 +#: src/octoprint/templates/index.jinja2:302 +msgid "Set" +msgstr "Velg" + +#: src/octoprint/templates/index.jinja2:292 +#: src/octoprint/templates/index.jinja2:523 +msgid "Off" +msgstr "Av" + +#: src/octoprint/templates/index.jinja2:360 +msgid "Select Tool..." +msgstr "Velg verktøy" + +#: src/octoprint/templates/index.jinja2:371 +msgid "Extrude" +msgstr "Extrude" + +#: src/octoprint/templates/index.jinja2:372 +msgid "Retract" +msgstr "Tilbaketrekking" + +#: src/octoprint/templates/index.jinja2:377 +msgid "General" +msgstr "Generell" + +#: src/octoprint/templates/index.jinja2:379 +msgid "Motors off" +msgstr "Motorer av" + +#: src/octoprint/templates/index.jinja2:380 +msgid "Fans on" +msgstr "Vifter på" + +#: src/octoprint/templates/index.jinja2:381 +msgid "Fans off" +msgstr "Vifter av" + +#: src/octoprint/templates/index.jinja2:445 +msgid "Sync with job progress" +msgstr "Synkroniser med jobbprogresjon" + +#: src/octoprint/templates/index.jinja2:450 +msgid "Center viewport on model" +msgstr "Sentrer bilde på modell" + +#: src/octoprint/templates/index.jinja2:453 +msgid "Zoom in on model" +msgstr "Zoom inn på modell" + +#: src/octoprint/templates/index.jinja2:459 +msgid "Show moves" +msgstr "Vis forflyttninger" + +#: src/octoprint/templates/index.jinja2:462 +msgid "Show retracts" +msgstr "Vis tilbaketrekninger" + +#: src/octoprint/templates/index.jinja2:468 +msgid "Also show previous layer" +msgstr "Også vis forrige lag" + +#: src/octoprint/templates/index.jinja2:471 +msgid "Also show next layer" +msgstr "Også vis neste lag" + +#: src/octoprint/templates/index.jinja2:476 +msgid "Reload" +msgstr "Last på nytt" + +#: src/octoprint/templates/index.jinja2:503 +msgid "Autoscroll" +msgstr "Autoscroll" + +#: src/octoprint/templates/index.jinja2:513 +msgid "Send" +msgstr "Send" + +#: src/octoprint/templates/index.jinja2:519 +msgid "Timelapse Configuration" +msgstr "Timelapse konfigurasjon" + +#: src/octoprint/templates/index.jinja2:521 +msgid "Timelapse Mode" +msgstr "Timelapse modus" + +#: src/octoprint/templates/index.jinja2:528 +msgid "Timelapse post roll (in rendered seconds)" +msgstr "Timelapse etter opptak (i sekunder)" + +#: src/octoprint/templates/index.jinja2:535 +msgid "Interval" +msgstr "Interval" + +#: src/octoprint/templates/index.jinja2:544 +msgid "Save as default" +msgstr "Lagre som standard" + +#: src/octoprint/templates/index.jinja2:549 +msgid "Save config" +msgstr "Lagre konfigurasjon" + +#: src/octoprint/templates/index.jinja2:553 +msgid "Finished Timelapses" +msgstr "Ferdig timelapser" + +#: src/octoprint/templates/index.jinja2:556 +#: src/octoprint/templates/settings.jinja2:630 +msgid "Sort by" +msgstr "Sorter etter" + +#: src/octoprint/templates/index.jinja2:556 +#: src/octoprint/templates/index.jinja2:561 +#: src/octoprint/templates/settings.jinja2:377 +#: src/octoprint/templates/settings.jinja2:469 +#: src/octoprint/templates/settings.jinja2:630 +#: src/octoprint/templates/settings.jinja2:636 +msgid "Name" +msgstr "Navn" + +#: src/octoprint/templates/index.jinja2:556 +msgid "Creation date" +msgstr "Opprettelsesdato" + +#: src/octoprint/templates/index.jinja2:563 +#: src/octoprint/templates/settings.jinja2:472 +#: src/octoprint/templates/settings.jinja2:639 +msgid "Action" +msgstr "Handling" + +#: src/octoprint/templates/index.jinja2:592 +msgid "Version" +msgstr "Versjon" + +#: src/octoprint/templates/index.jinja2:595 +msgid "Homepage" +msgstr "Hjemmeside" + +#: src/octoprint/templates/index.jinja2:596 +msgid "Sourcecode" +msgstr "Kildekode" + +#: src/octoprint/templates/index.jinja2:597 +msgid "Documentation" +msgstr "Dokumentasjon" + +#: src/octoprint/templates/index.jinja2:598 +msgid "Bugs and Requests" +msgstr "Feilrapportering og ønsker" + +#: src/octoprint/templates/settings.jinja2:4 +msgid "OctoPrint Settings" +msgstr "OctoPrint innstillinger" + +#: src/octoprint/templates/settings.jinja2:9 +msgid "Printer" +msgstr "Printer" + +#: src/octoprint/templates/settings.jinja2:10 +msgid "Serial Connection" +msgstr "Seriell kontakt" + +#: src/octoprint/templates/settings.jinja2:11 +msgid "Printer Parameters" +msgstr "Printer parametere" + +#: src/octoprint/templates/settings.jinja2:12 +msgid "Temperatures" +msgstr "Temperaturer" + +#: src/octoprint/templates/settings.jinja2:13 +msgid "Terminal filters" +msgstr "Terminal filtre" + +#: src/octoprint/templates/settings.jinja2:14 +#: src/octoprint/templates/settings.jinja2:15 +msgid "Features" +msgstr "Funksjoner" + +#: src/octoprint/templates/settings.jinja2:16 +msgid "Webcam" +msgstr "Nettkamera" + +#: src/octoprint/templates/settings.jinja2:17 +msgid "Cura" +msgstr "Cura" + +#: src/octoprint/templates/settings.jinja2:18 +msgid "Access Control" +msgstr "Adgangskontroll" + +#: src/octoprint/templates/settings.jinja2:19 +msgid "API" +msgstr "API" + +#: src/octoprint/templates/settings.jinja2:21 +msgid "Folders" +msgstr "Mapper" + +#: src/octoprint/templates/settings.jinja2:22 +msgid "Appearance" +msgstr "Utseende" + +#: src/octoprint/templates/settings.jinja2:23 +#: src/octoprint/templates/settings.jinja2:626 +msgid "Logs" +msgstr "Logger" + +#: src/octoprint/templates/settings.jinja2:44 +msgid "Auto-connect to printer on server start" +msgstr "Koble til printer automatisk ved oppstart" + +#: src/octoprint/templates/settings.jinja2:49 +msgid "Communication timeout" +msgstr "Kommunikasjon tidsavbrudd" + +#: src/octoprint/templates/settings.jinja2:58 +msgid "Temperature timeout" +msgstr "Temperatur tidsavbrudd" + +#: src/octoprint/templates/settings.jinja2:67 +msgid "SD status timeout" +msgstr "Minnekort tidsavbrudd" + +#: src/octoprint/templates/settings.jinja2:76 +msgid "Connection timeout" +msgstr "Oppkoblingstidsavbrudd" + +#: src/octoprint/templates/settings.jinja2:85 +msgid "Autodetection timeout" +msgstr "Automatisk detekteringstidsavbrudd" + +#: src/octoprint/templates/settings.jinja2:96 +msgid "Log communication to serial.log (might negatively impact performance)" +msgstr "Skriv logg til serial.log (kan redusere ytelsen)" + +#: src/octoprint/templates/settings.jinja2:96 +msgid "Warning" +msgstr "Advarsel" + +#: src/octoprint/templates/settings.jinja2:105 +msgid "Axis" +msgstr "Akse" + +#: src/octoprint/templates/settings.jinja2:107 +#: src/octoprint/templates/settings.jinja2:176 +msgid "X" +msgstr "X" + +#: src/octoprint/templates/settings.jinja2:113 +#: src/octoprint/templates/settings.jinja2:123 +#: src/octoprint/templates/settings.jinja2:133 +msgid "Invert control" +msgstr "Inverter kontroller" + +#: src/octoprint/templates/settings.jinja2:117 +#: src/octoprint/templates/settings.jinja2:181 +msgid "Y" +msgstr "Y" + +#: src/octoprint/templates/settings.jinja2:127 +msgid "Z" +msgstr "Z" + +#: src/octoprint/templates/settings.jinja2:137 +msgid "E" +msgstr "E" + +#: src/octoprint/templates/settings.jinja2:145 +msgid "Default extrusion length" +msgstr "Standard extrusion lengde " + +#: src/octoprint/templates/settings.jinja2:151 +msgid "Number of Extruders" +msgstr "Antall dyser" + +#: src/octoprint/templates/settings.jinja2:157 +msgid "Extruder Offsets" +msgstr "Extruder avvik" + +#: src/octoprint/templates/settings.jinja2:174 +msgid "Bed Size" +msgstr "Plattformstørrelse" + +#: src/octoprint/templates/settings.jinja2:188 +msgid "Radius" +msgstr "Radius" + +#: src/octoprint/templates/settings.jinja2:196 +msgid "Circular" +msgstr "Sirkulær" + +#: src/octoprint/templates/settings.jinja2:205 +msgid "Stream URL" +msgstr "Stream URL" + +#: src/octoprint/templates/settings.jinja2:211 +msgid "Snapshot URL" +msgstr "Hurtigbilde URL" + +#: src/octoprint/templates/settings.jinja2:217 +msgid "Path to FFMPEG" +msgstr "Sti til FFMPEG" + +#: src/octoprint/templates/settings.jinja2:223 +msgid "Timelapse bitrate" +msgstr "Timelapse bitrate" + +#: src/octoprint/templates/settings.jinja2:231 +msgid "Enable OctoPrint watermark in timelapse movies" +msgstr "Aktiver OctoPrint vannmerke i timelapsefilmer" + +#: src/octoprint/templates/settings.jinja2:238 +msgid "Flip webcam horizontally" +msgstr "Horisontal invertere webcam" + +#: src/octoprint/templates/settings.jinja2:243 +msgid "Flip webcam vertically" +msgstr "Vertikal invertere webcam" + +#: src/octoprint/templates/settings.jinja2:254 +msgid "Enable Temperature Graph" +msgstr "Aktiver temperaturgraf" + +#: src/octoprint/templates/settings.jinja2:261 +msgid "Enable GCode Visualizer" +msgstr "Aktiver GCode framviser" + +#: src/octoprint/templates/settings.jinja2:268 +msgid "Enable SD support" +msgstr "Aktiver støtte for minnekort" + +#: src/octoprint/templates/settings.jinja2:275 +msgid "Always assume SD card is present" +msgstr "Alltid anta at minnekort er på plass" + +#: src/octoprint/templates/settings.jinja2:275 +#: src/octoprint/templates/settings.jinja2:289 +#: src/octoprint/templates/settings.jinja2:296 +msgid "Repetier" +msgstr "Repeter" + +#: src/octoprint/templates/settings.jinja2:282 +msgid "Wait for start on connect" +msgstr "Vent for start på tilkobling" + +#: src/octoprint/templates/settings.jinja2:289 +msgid "Send a checksum with every command" +msgstr "Send en kontrollsum med alle kommandoer" + +#: src/octoprint/templates/settings.jinja2:296 +#, python-format +msgid "" +"Support TargetExtr%%n/TargetBed target temperature" +" format" +msgstr "Støtte TargetExtr%%n/TargetBed mål pemperatur format" + +#: src/octoprint/templates/settings.jinja2:303 +msgid "Swallow the first \"ok\" after a resend response" +msgstr "Svelg unna første \"ok\" etter omsendt svar" + +#: src/octoprint/templates/settings.jinja2:312 +msgid "Upload Folder" +msgstr "Opplastningsmappe" + +#: src/octoprint/templates/settings.jinja2:318 +msgid "Timelapse Folder" +msgstr "Timelapse mappe" + +#: src/octoprint/templates/settings.jinja2:324 +msgid "Timelapse Temp Folder" +msgstr "Timelapse midlertidig mappe" + +#: src/octoprint/templates/settings.jinja2:330 +msgid "Logs Folder" +msgstr "Loggmappe" + +#: src/octoprint/templates/settings.jinja2:336 +msgid "Watched Folder" +msgstr "Kontrollert mappe" + +#: src/octoprint/templates/settings.jinja2:346 +msgid "Extruder" +msgstr "Extruder" + +#: src/octoprint/templates/settings.jinja2:378 +msgid "RegExp" +msgstr "RegExp" + +#: src/octoprint/templates/settings.jinja2:403 +msgid "Title" +msgstr "Tittel" + +#: src/octoprint/templates/settings.jinja2:409 +msgid "Color" +msgstr "Farge" + +#: src/octoprint/templates/settings.jinja2:420 +msgid "Enable slicing via Cura" +msgstr "Aktiver slicing via Cura" + +#: src/octoprint/templates/settings.jinja2:426 +msgid "Path to Cura" +msgstr "Sti til Cura" + +#: src/octoprint/templates/settings.jinja2:432 +msgid "Path to Cura config" +msgstr "Sti til Curakonfigurasjon" + +#: src/octoprint/templates/settings.jinja2:444 +msgid "Enable" +msgstr "Aktiver" + +#: src/octoprint/templates/settings.jinja2:451 +#, python-format +msgid "Allow Cross Origin Resource Sharing (CORS)" +msgstr "Tillat Cross Origin Resource Sharing (CORS)" + +#: src/octoprint/templates/settings.jinja2:456 +#: src/octoprint/templates/settings.jinja2:477 +msgid "API Key" +msgstr "API nøkkel" + +#: src/octoprint/templates/settings.jinja2:470 +#: src/octoprint/templates/settings.jinja2:531 +#: src/octoprint/templates/settings.jinja2:560 +msgid "Active" +msgstr "Aktiv" + +#: src/octoprint/templates/settings.jinja2:471 +#: src/octoprint/templates/settings.jinja2:538 +#: src/octoprint/templates/settings.jinja2:567 +msgid "Admin" +msgstr "Admin" + +#: src/octoprint/templates/settings.jinja2:481 +msgid "Update User" +msgstr "Oppdater bruker" + +#: src/octoprint/templates/settings.jinja2:481 +msgid "Change password" +msgstr "Endre passord" + +#: src/octoprint/templates/settings.jinja2:481 +msgid "Delete user" +msgstr "Slett bruker" + +#: src/octoprint/templates/settings.jinja2:498 +#: src/octoprint/templates/settings.jinja2:505 +msgid "Add user" +msgstr "Legg til bruker" + +#: src/octoprint/templates/settings.jinja2:522 +#: src/octoprint/templates/settings.jinja2:593 +msgid "Repeat Password" +msgstr "Gjenta passord" + +#: src/octoprint/templates/settings.jinja2:545 +#: src/octoprint/templates/settings.jinja2:574 +#: src/octoprint/templates/settings.jinja2:616 +msgid "Abort" +msgstr "Avbryt" + +#: src/octoprint/templates/settings.jinja2:546 +#: src/octoprint/templates/settings.jinja2:575 +#: src/octoprint/templates/settings.jinja2:617 +msgid "Confirm" +msgstr "Bekreft" + +#: src/octoprint/templates/settings.jinja2:553 +#, python-format +msgid "Edit user \"%(user)s\"" +msgstr "Endre bruker \"%(user)s\"" + +#: src/octoprint/templates/settings.jinja2:582 +#, python-format +msgid "Change password for user \"%(user)s\"" +msgstr "Endre passord for bruker \"%(user)s\"" + +#: src/octoprint/templates/settings.jinja2:587 +msgid "New Password" +msgstr "Nytt passord" + +#: src/octoprint/templates/settings.jinja2:602 +msgid "Current API Key" +msgstr "Nåværende API nøkkel" + +#: src/octoprint/templates/settings.jinja2:605 +msgid "N/A" +msgstr "N/A" + +#: src/octoprint/templates/settings.jinja2:630 +msgid "Modification date" +msgstr "Endret dato" + +#: src/octoprint/templates/settings.jinja2:638 +msgid "Date" +msgstr "Dato" + +#: src/octoprint/templates/settings.jinja2:677 +msgid "Save" +msgstr "Lagre" diff --git a/src/octoprint/util/__init__.py b/src/octoprint/util/__init__.py index d889ddcef..e5f4e4b69 100644 --- a/src/octoprint/util/__init__.py +++ b/src/octoprint/util/__init__.py @@ -252,3 +252,32 @@ def dict_merge(a, b): class Object(object): pass + +def interface_addresses(family=None): + import netifaces + if not family: + family = netifaces.AF_INET + + for interface in netifaces.interfaces(): + try: + ifaddresses = netifaces.ifaddresses(interface) + except: + continue + if family in ifaddresses: + for ifaddress in ifaddresses[family]: + if not ifaddress["addr"].startswith("169.254."): + yield ifaddress["addr"] + +def address_for_client(host, port): + import socket + + for address in interface_addresses(): + try: + sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + sock.bind((address, 0)) + sock.connect((host, port)) + return address + except Exception as e: + pass + + diff --git a/src/octoprint/util/comm.py b/src/octoprint/util/comm.py index bf118e3f3..e20877543 100644 --- a/src/octoprint/util/comm.py +++ b/src/octoprint/util/comm.py @@ -13,6 +13,7 @@ import threading import Queue as queue import logging import serial +import octoprint.plugin from collections import deque @@ -151,6 +152,10 @@ class MachineCom(object): self._resendDelta = None self._lastLines = deque([], 50) + # hooks + self._pluginManager = octoprint.plugin.plugin_manager() + self._gcode_hooks = self._pluginManager.get_hooks("octoprint.comm.protocol.gcode") + # SD status data self._sdAvailable = False self._sdFileList = False @@ -1074,6 +1079,10 @@ class MachineCom(object): return if not self.isStreaming(): + for hook in self._gcode_hooks: + hook_cmd = self._gcode_hooks[hook](self, cmd) + if hook_cmd and isinstance(hook_cmd, basestring): + cmd = hook_cmd gcode = self._regex_command.search(cmd) if gcode: gcode = gcode.group(1) diff --git a/tests/test_plugin_core.py b/tests/test_plugin_core.py new file mode 100644 index 000000000..1d436940b --- /dev/null +++ b/tests/test_plugin_core.py @@ -0,0 +1,69 @@ +import unittest + +import octoprint.plugin +import octoprint.plugin.core + + +class PluginTestCase(unittest.TestCase): + + def setUp(self): + import logging + logging.basicConfig(level=logging.DEBUG) + + # TODO mock pkg_resources to return some defined entry_points + + import os + plugin_folders = [os.path.join(os.path.dirname(os.path.realpath(__file__)), "test_plugins")] + plugin_types = [octoprint.plugin.SettingsPlugin, octoprint.plugin.StartupPlugin] + plugin_entry_points = None + self.plugin_manager = octoprint.plugin.core.PluginManager(plugin_folders, plugin_types, plugin_entry_points) + + def test_plugin_loading(self): + self.assertEquals(4, len(self.plugin_manager.plugins)) + self.assertEquals(1, len(self.plugin_manager.plugin_hooks)) + self.assertEquals(2, len(self.plugin_manager.plugin_implementations)) + + self.assertTrue("octoprint.core.startup" in self.plugin_manager.plugin_hooks) + self.assertEquals(1, len(self.plugin_manager.plugin_hooks["octoprint.core.startup"])) + + self.assertTrue(octoprint.plugin.StartupPlugin in self.plugin_manager.plugin_implementations) + self.assertEquals(2, len(self.plugin_manager.plugin_implementations[octoprint.plugin.StartupPlugin])) + + self.assertTrue(octoprint.plugin.SettingsPlugin in self.plugin_manager.plugin_implementations) + self.assertEquals(2, len(self.plugin_manager.plugin_implementations[octoprint.plugin.SettingsPlugin])) + + def test_get_plugin(self): + plugin = self.plugin_manager.get_plugin("hook_plugin") + self.assertIsNotNone(plugin) + self.assertEquals("Hook Plugin", plugin.__plugin_name__) + + plugin = self.plugin_manager.get_plugin("mixed_plugin") + self.assertIsNotNone(plugin) + self.assertEquals("Mixed Plugin", plugin.__plugin_name__) + + plugin = self.plugin_manager.get_plugin("unknown_plugin") + self.assertIsNone(plugin) + + def test_get_hooks(self): + hooks = self.plugin_manager.get_hooks("octoprint.core.startup") + self.assertEquals(1, len(hooks)) + self.assertTrue("hook_plugin" in hooks) + self.assertEquals("success", hooks["hook_plugin"]()) + + hooks = self.plugin_manager.get_hooks("octoprint.printing.print") + self.assertEquals(0, len(hooks)) + + def test_get_implementation(self): + implementations = self.plugin_manager.get_implementations(octoprint.plugin.StartupPlugin) + self.assertEquals(2, len(implementations)) + self.assertTrue('startup_plugin' in implementations) + self.assertTrue('mixed_plugin' in implementations) + + implementations = self.plugin_manager.get_implementations(octoprint.plugin.SettingsPlugin) + self.assertEquals(2, len(implementations)) + self.assertTrue('settings_plugin' in implementations) + self.assertTrue('mixed_plugin' in implementations) + + implementations = self.plugin_manager.get_implementations(octoprint.plugin.StartupPlugin, octoprint.plugin.SettingsPlugin) + self.assertEquals(1, len(implementations)) + self.assertTrue('mixed_plugin' in implementations) diff --git a/tests/test_plugins/hook_plugin.py b/tests/test_plugins/hook_plugin.py new file mode 100644 index 000000000..03b1057f9 --- /dev/null +++ b/tests/test_plugins/hook_plugin.py @@ -0,0 +1,10 @@ +from __future__ import absolute_import + + +def hook_startup(): + return "success" + + +__plugin_name__ = "Hook Plugin" +__plugin_description__ = "Test hook plugin" +__plugin_hooks__ = {'octoprint.core.startup': hook_startup} \ No newline at end of file diff --git a/tests/test_plugins/mixed_plugin/__init__.py b/tests/test_plugins/mixed_plugin/__init__.py new file mode 100644 index 000000000..c8c8996ac --- /dev/null +++ b/tests/test_plugins/mixed_plugin/__init__.py @@ -0,0 +1,17 @@ +# coding=utf-8 +from __future__ import absolute_import + +__author__ = "Gina Häußge " +__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html' +__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License" + +import octoprint.plugin + + +class TestMixedPlugin(octoprint.plugin.StartupPlugin, octoprint.plugin.SettingsPlugin): + pass + + +__plugin_name__ = "Mixed Plugin" +__plugin_description__ = "Test mixed plugin" +__plugin_implementations__ = (TestMixedPlugin(),) \ No newline at end of file diff --git a/tests/test_plugins/settings_plugin.py b/tests/test_plugins/settings_plugin.py new file mode 100644 index 000000000..01fb6524d --- /dev/null +++ b/tests/test_plugins/settings_plugin.py @@ -0,0 +1,12 @@ +from __future__ import absolute_import + +import octoprint.plugin + + +class TestSettingsPlugin(octoprint.plugin.SettingsPlugin): + pass + + +__plugin_name__ = "Settings Plugin" +__plugin_description__ = "Test settings plugin" +__plugin_implementations__ = (TestSettingsPlugin(),) \ No newline at end of file diff --git a/tests/test_plugins/startup_plugin.py b/tests/test_plugins/startup_plugin.py new file mode 100644 index 000000000..7c3202b5a --- /dev/null +++ b/tests/test_plugins/startup_plugin.py @@ -0,0 +1,12 @@ +from __future__ import absolute_import + +import octoprint.plugin + + +class TestStartupPlugin(octoprint.plugin.StartupPlugin): + pass + + +__plugin_name__ = "Startup Plugin" +__plugin_description__ = "Test startup plugin" +__plugin_implementations__ = (TestStartupPlugin(),) \ No newline at end of file