diff options
author | Gina Häußge <gina@octoprint.org> | 2021-07-26 12:39:44 +0300 |
---|---|---|
committer | Gina Häußge <gina@octoprint.org> | 2021-07-26 12:39:44 +0300 |
commit | cc60f457f8b8b1d2a152e9c308498216f02c559c (patch) | |
tree | 21710ee81b670539d79016e67fd1c60ca3662586 /docs | |
parent | 037519eebd5a4011a65fee21f939cfe45fb7d499 (diff) | |
parent | 19388fc11f6fb62b8840d51ded7498c7b0028e49 (diff) |
Merge branch 'master' into maintenance
Diffstat (limited to 'docs')
-rw-r--r-- | docs/api/datamodel.rst | 64 | ||||
-rw-r--r-- | docs/development/environment.rst | 99 | ||||
-rw-r--r-- | docs/features/gcode_scripts.rst | 3 |
3 files changed, 165 insertions, 1 deletions
diff --git a/docs/api/datamodel.rst b/docs/api/datamodel.rst index 514631c74..24a10f904 100644 --- a/docs/api/datamodel.rst +++ b/docs/api/datamodel.rst @@ -365,6 +365,14 @@ Files - 0..1 - :ref:`GCODE analysis information <sec-api-datamodel-files-gcodeanalysis>` - Information from the analysis of the GCODE file, if available. Left out in abridged version. + * - ``prints`` + - 0..1 + - :ref:`Print history information <sec-api-datamodel-files-prints>` + - Information about previous prints of the file. Left out if the file has never been printed. + * - ``statistics`` + - 0..1 + - :ref:`Print statistics information <sec-api-datamodel-files-stats>` + - Statistics about the file, based on the previous print times. Left out if the file has never been printed. .. _sec-api-datamodel-files-fileabridged: @@ -506,6 +514,62 @@ References - The model from which this file was generated (e.g. an STL, currently not used). Never present for folders. +.. _sec-api-datamodel-files-prints: + +Print History +------------- + +.. list-table:: + :widths: 15 5 10 30 + :header-rows: 1 + + * - Name + - Multiplicity + - Type + - Description + * - ``success`` + - 1 + - Number + - Number of successful prints + * - ``failure`` + - 1 + - Number + - Number of failed prints + * - ``last.date`` + - 1 + - Unix Timestamp + - Last date this file was printed + * - ``last.printTime`` + - 1 + - Float + - Last print time in seconds + * - ``last.success`` + - 1 + - Boolean + - Whether the last print was a success or not + +.. _sec-api-datamodel-files-stats: + +Print Statistics +---------------- + +.. list-table:: + :widths: 15 5 10 30 + :header-rows: 1 + + * - Name + - Multiplicity + - Type + - Description + * - ``averagePrintTime`` + - 1 + - Object + - Object that maps printer profile names to the last print time of the file, in seconds + * - ``lastPrintTime`` + - 1 + - Object + - Object that maps printer profile names to the average print time of the file, in seconds + .. _sec-api-datamodel-access: Access control diff --git a/docs/development/environment.rst b/docs/development/environment.rst index 851bb5aec..47379244c 100644 --- a/docs/development/environment.rst +++ b/docs/development/environment.rst @@ -387,3 +387,102 @@ Otherwise go through Settings. Make sure you are running a PyCharm version of 2016.1 or later, or manually fix `a debugger bug contained in earlier versions <https://youtrack.jetbrains.com/issue/PY-18365>`_ or plugin management will not work in your developer install when running OctoPrint from PyCharm in debug mode. + +Visual Studio Code (vscode) +--------------------------- + + - Install Visual Studio Code from `code.visualstudio.com <https://code.visualstudio.com/Download>`_ + - Open folder select OctoPrint checkout folder (e.g. ``~/devel/OctoPrint`` or ``C:\Devel\OctoPrint``) + + - Create a directory ``.vscode`` if not already present in the root of the project + + - Create the following files inside the ``.vscode`` directory + + settings.json + .. code-block:: json + + { + "python.defaultInterpreterPath": "venv3/bin/python", + "python.formatting.provider": "black", + "python.formatting.blackArgs": [ + "--config", + "black.toml" + ], + "editor.formatOnSave": true, + "python.sortImports.args": [ + "--profile=black", + ], + "[python]": { + "editor.codeActionsOnSave": { + "source.organizeImports": true + } + }, + "python.linting.pylintEnabled": false, + "python.linting.flake8Enabled": true, + "python.linting.enabled": true + } + + tasks.json + .. code-block:: json + + { + "version": "2.0.0", + "tasks": [ + { + "label": "clean build artifacts", + "type": "shell", + "command": "python ./setup.py clean" + }, + { + "label": "build docs", + "type": "shell", + "command": "sphinx-build -b html ./docs ./docs/_build" + } + ] + } + + + launch.json + .. code-block:: json + + { + "version": "0.2.0", + "configurations": [ + { + "name": "OctoPrint", + "type": "python", + "request": "launch", + "module": "octoprint", + "args": [ + "serve", + "--debug" + ], + "cwd": "${workspaceFolder}/src", + "preLaunchTask": "clean build artifacts" + } + ] + } + + In the terminal install the python extension by running this command: + + .. code-block:: bash + + code --install-extension ms-python.python + + In vscode terminal, or with venv active install code formatter black and linter flake8 by running: + + .. code-block:: bash + + python -m pip install -U black flake8 flake8-bugbear + + Summary of vscode config: + + * Pressing ``F5`` will now start OctoPrint in debug mode + + * Your terminal inside vscode uses the virtual python environment + + * Saving a file will run an auto formatter and import sort + + * ``Ctrl+Shift+B`` can be used to run the ``build docs`` task to rebuild the documentation + + diff --git a/docs/features/gcode_scripts.rst b/docs/features/gcode_scripts.rst index d836d3fad..a15cc7f79 100644 --- a/docs/features/gcode_scripts.rst +++ b/docs/features/gcode_scripts.rst @@ -70,7 +70,8 @@ Context All GCODE scripts have access to the following template variables through the template context: * ``printer_profile``: The currently selected :ref:`Printer Profile <sec-modules-printer-profile>`, including - information such as the extruder count, the build volume size, the filament diameter etc. + information such as the extruder count, the build volume size, the filament diameter etc. The individual properties + follow the common data model for :ref:`printer profiles <sec-api-printerprofiles-datamodel-profile>`. * ``last_position``: Last position reported by the printer via `M114` (might be unset if no `M114` was sent so far!). Consists of ``x``, ``y``, ``z`` and ``e`` coordinates as received by the printer and tracked values for ``f`` and current tool ``t`` taken from commands sent through OctoPrint. All of these coordinates might be ``None`` if no |