From 1d3dfffc6752cc708ad6e455a9a424eef3b0f5e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 23 Mar 2016 10:40:36 +0100 Subject: [PATCH] Some documentation fixes --- docs/plugins/hooks.rst | 48 +++++++++++++---------------------- src/octoprint/plugin/types.py | 6 +++-- 2 files changed, 21 insertions(+), 33 deletions(-) diff --git a/docs/plugins/hooks.rst b/docs/plugins/hooks.rst index e080518c..dece126c 100644 --- a/docs/plugins/hooks.rst +++ b/docs/plugins/hooks.rst @@ -63,44 +63,30 @@ octoprint.cli.commands :tab-width: 4 :caption: `custom_cli_command.py `_ - Calling ``octoprint --help`` shows the two new commands: + Calling ``octoprint plugins --help`` shows the two new commands: .. code-block:: none - $ octoprint --help - Usage: octoprint [OPTIONS] COMMAND [ARGS]... + $ octoprint plugins --help + Usage: octoprint plugins [OPTIONS] COMMAND [ARGS]... - Options: - -b, --basedir PATH Specify the basedir to use for uploads, timelapses etc. - -c, --config PATH Specify the config file to use. - -v, --verbose Increase logging verbosity - --version Show the version and exit. - --help Show this message and exit. - - Commands: - daemon Starts, stops or restarts in daemon mode. - dev:plugin Helpers for plugin developers - plugin:custom_cli_command custom_cli_command commands - serve Starts the OctoPrint server. - - $ octoprint plugin:custom_cli_command --help - Usage: octoprint plugin:custom_cli_command [OPTIONS] COMMAND [ARGS]... - - custom_cli_command commands + Additional commands provided by plugins. Options: --help Show this message and exit. Commands: - greet Greet someone by name, the greeting can be... - random Greet someone by name with a random greeting. + custom_cli_command:greet Greet someone by name, the greeting can be... + custom_cli_command:random Greet someone by name with a random greeting. + softwareupdate:check Check for updates. + softwareupdate:update Apply updates. Each also has an individual help output: .. code-block:: none - $ octoprint plugin:custom_cli_command greet --help - Usage: octoprint plugin:custom_cli_command greet [OPTIONS] [NAME] + $ octoprint plugins custom_cli_command:greet --help + Usage: octoprint plugins custom_cli_command:greet [OPTIONS] [NAME] Greet someone by name, the greeting can be customized. @@ -108,8 +94,8 @@ octoprint.cli.commands -g, --greeting TEXT The greeting to use --help Show this message and exit. - $ octoprint plugin:custom_cli_command random --help - Usage: octoprint plugin:custom_cli_command random [OPTIONS] [NAME] + $ octoprint plugins custom_cli_command:random --help + Usage: octoprint plugins custom_cli_command:random [OPTIONS] [NAME] Greet someone by name with a random greeting. @@ -120,13 +106,13 @@ octoprint.cli.commands .. code-block:: none - $ octoprint plugin:custom_cli_command greet + $ octoprint plugins custom_cli_command:greet Hello World! - $ octoprint plugin:custom_cli_command greet --greeting "Good morning" + $ octoprint plugins custom_cli_command:greet --greeting "Good morning" Good morning World! - $ octoprint plugin:custom_cli_command random stranger + $ octoprint plugins custom_cli_command:random stranger Hola stranger! .. note:: @@ -134,7 +120,7 @@ octoprint.cli.commands If your hook handler is an instance method of a plugin mixin implementation, be aware that the hook will be called without OctoPrint initializing your implementation instance. That means that **none** of the :ref:`injected properties ` will be available and also the - :method:`~octoprint.plugin.Plugin.initialize` method will not be called. + :meth:`~octoprint.plugin.Plugin.initialize` method will not be called. Your hook handler will have access to the plugin manager as ``cli_group.plugin_manager`` and to the *global* settings as ``cli_group.settings``. You can have your handler turn the latter into a @@ -306,7 +292,7 @@ octoprint.comm.protocol.gcode.received Get the returned lines sent by the printer. Handlers should return the received line or in any case, the modified version of it. If the the handler returns None, processing will be aborted and the communication layer will get an empty string as the received line. Note that Python functions will also automatically return ``None`` if an empty - ``return`` statement is used or just nothing is returned explicitely from the handler. + ``return`` statement is used or just nothing is returned explicitly from the handler. **Example:** diff --git a/src/octoprint/plugin/types.py b/src/octoprint/plugin/types.py index 5b448a28..238b4883 100644 --- a/src/octoprint/plugin/types.py +++ b/src/octoprint/plugin/types.py @@ -640,6 +640,8 @@ class UiPlugin(OctoPrintPlugin, SortablePlugin): value. * - locales - The locales for which there are translations available. + * - supportedExtensions + - The file extensions supported for uploads. On top of that all additional template variables as provided by :meth:`~octoprint.plugin.TemplatePlugin.get_template_vars` will be contained in the dictionary as well. @@ -790,14 +792,14 @@ class WizardPlugin(OctoPrintPlugin, ReloadNeedingPlugin): data to perform its task. Returns: - dict: a dictionary containig additional data to provide to the frontend. Whatever the plugin + dict: a dictionary containing additional data to provide to the frontend. Whatever the plugin returns here will be made available on the wizard API under the plugin's identifier """ return dict() def on_wizard_finish(self, handled): """ - Called by OctoPrint whenever the user finishes a wizard session is finished. + Called by OctoPrint whenever the user finishes a wizard session. The ``handled`` parameter will indicate whether that plugin's wizard was included in the wizard dialog presented to the user (so the plugin providing