Merge branch 'maintenance' into devel
# Conflicts: # src/octoprint/server/__init__.py # src/octoprint/server/util/__init__.py # src/octoprint/server/util/flask.py # src/octoprint/users.py
This commit is contained in:
commit
047b9f544a
105 files changed
+5491
-3389
No files matched your search
+54
-34
@@ -1,29 +1,25 @@
|
||||
<!--
|
||||
READ THE FOLLOWING FIRST:
|
||||
|
||||
If not already done, please read the "guidelines for contributing"
|
||||
aka the Contribution Guidelines that are linked ^-- just up there
|
||||
in the big yellow box.
|
||||
If not already done, please read the the Contribution Guidelines that
|
||||
are linked to the right under "Helpful resources" > "Contributing".
|
||||
|
||||
Also read the FAQ: https://github.com/foosel/OctoPrint/wiki/FAQ.
|
||||
Also read the FAQ: https://faq.octoprint.org
|
||||
|
||||
This is a bug and feature tracker, please only use it to report bugs
|
||||
or request features within OctoPrint (not OctoPi, not any OctoPrint
|
||||
plugins and not unofficial OctoPrint versions).
|
||||
|
||||
Do not seek support here ("I need help with ...", "I have a
|
||||
question ..."), that belongs on the mailing list or the G+ community
|
||||
(both linked in the "guidelines for contributing" linked above, read
|
||||
them!), NOT here.
|
||||
question ..."), that belongs on the community forum at
|
||||
discourse.octoprint.org, NOT here.
|
||||
|
||||
Mark requests with a "[Request]" prefix in the title please. For bug
|
||||
reports fully fill out the bug reporting template (if you don't know
|
||||
where to find some information - it's all described in the Contribution
|
||||
Guidelines linked up there in the big yellow box).
|
||||
|
||||
When reporting a bug do NOT delete ANY lines from the template but
|
||||
those enclosed in [ and ] - and those please DO delete, they are
|
||||
only provided for your information and removing them makes your
|
||||
ticket more readable :)
|
||||
When reporting a bug do NOT delete ANY lines from the template.
|
||||
|
||||
Make sure any bug you want to report is still present with the CURRENT
|
||||
OctoPrint version and that it does not vanish when you start OctoPrint
|
||||
@@ -31,27 +27,26 @@ in safe mode - how to do that is also explained in the Contribution
|
||||
Guidelines linked up there in the big yellow box.
|
||||
|
||||
Thank you!
|
||||
|
||||
(Before submitting your ticket, please delete this text up to and
|
||||
including the line too - it's only here for you, we already know it
|
||||
by heart ;))
|
||||
|
||||
----
|
||||
-->
|
||||
|
||||
#### What were you doing?
|
||||
|
||||
[Please be as specific as possible here. The maintainers will need to
|
||||
<!--
|
||||
Please be as specific as possible here. The maintainers will need to
|
||||
reproduce your issue in order to fix it and that is not possible if they
|
||||
don't know what you did to get it to happen in the first place.
|
||||
|
||||
Ideally provide exact steps to follow in order to reproduce your problem:
|
||||
-->
|
||||
|
||||
1. ...
|
||||
2. ...
|
||||
3. ...
|
||||
|
||||
<!--
|
||||
If you encountered a problem with specific files of any sorts, make sure
|
||||
to also include a link to a file with which to reproduce the problem.]
|
||||
to also include a link to a file with which to reproduce the problem.
|
||||
-->
|
||||
|
||||
#### What did you expect to happen?
|
||||
|
||||
@@ -59,50 +54,75 @@ to also include a link to a file with which to reproduce the problem.]
|
||||
|
||||
#### Did the same happen when running OctoPrint in safe mode?
|
||||
|
||||
[Try to reproduce your problem in safe mode. You can find information
|
||||
on how to enable safe mode in the Contribution Guidelines.]
|
||||
<!--
|
||||
Test if you can reproduce your problem in safe mode. You can find information
|
||||
on how to enable safe mode in the Contribution Guidelines.
|
||||
|
||||
If you can't reproduce in safe mode, this is a bug with one of your
|
||||
installed third party plugins. Don't open a ticket here!
|
||||
|
||||
If you can't test this in safe mode, state why.
|
||||
-->
|
||||
|
||||
#### Version of OctoPrint
|
||||
|
||||
[Can be found in the lower left corner of the web interface. ALWAYS INCLUDE.]
|
||||
<!--
|
||||
Can be found in the lower left corner of the web interface. ALWAYS INCLUDE.
|
||||
-->
|
||||
|
||||
#### Operating System running OctoPrint
|
||||
|
||||
[OctoPi, Linux, Windows, MacOS, something else? With version please.
|
||||
OctoPi's version can be found in /etc/octopi_version]
|
||||
<!--
|
||||
OctoPi, Linux, Windows, MacOS, something else? With version please.
|
||||
OctoPi's version can be found in /etc/octopi_version or in the lower left
|
||||
corner of the web interface.
|
||||
-->
|
||||
|
||||
#### Printer model & used firmware incl. version
|
||||
|
||||
[If applicable, always include if unsure.]
|
||||
<!--
|
||||
If applicable, always include if unsure.
|
||||
-->
|
||||
|
||||
#### Browser and Version of Browser, Operating System running Browser
|
||||
#### Browser and version of browser, operating system running browser
|
||||
|
||||
[If applicable, always include if unsure.]
|
||||
<!--
|
||||
If applicable, always include if unsure.
|
||||
-->
|
||||
|
||||
#### Link to octoprint.log
|
||||
|
||||
[On gist.github.com or pastebin.com. ALWAYS INCLUDE and never truncate.
|
||||
The Contribution Guidelines tell you where to find that.]
|
||||
<!--
|
||||
On gist.github.com or pastebin.com. ALWAYS INCLUDE and never truncate.
|
||||
|
||||
The Contribution Guidelines tell you where to find that.
|
||||
-->
|
||||
|
||||
#### Link to contents of terminal tab or serial.log
|
||||
|
||||
[On gist.github.com or pastebin.com. If applicable, always include if unsure or
|
||||
<!--
|
||||
On gist.github.com or pastebin.com. If applicable, always include if unsure or
|
||||
reporting communication issues. Never truncate.
|
||||
|
||||
serial.log is usually not written due to performance reasons and must be
|
||||
enabled explicitly. Provide at the very least the FULL contents of your
|
||||
terminal tab at the time of the bug occurrence, even if you do not have
|
||||
a serial.log (which the Contribution Guidelines tell you where to find).]
|
||||
a serial.log (which the Contribution Guidelines tell you where to find).
|
||||
-->
|
||||
|
||||
#### Link to contents of Javascript console in the browser
|
||||
|
||||
[On gist.github.com or pastebin.com or alternatively a screenshot. If applicable -
|
||||
<!--
|
||||
On gist.github.com or pastebin.com or alternatively a screenshot. If applicable -
|
||||
always include if unsure or reporting UI issues.
|
||||
|
||||
The Contribution Guidelines tell you where to find that.]
|
||||
The Contribution Guidelines tell you where to find that.
|
||||
-->
|
||||
|
||||
#### Screenshot(s)/video(s) showing the problem:
|
||||
|
||||
[If applicable. Always include if unsure or reporting UI issues.]
|
||||
<!--
|
||||
If applicable. Always include if unsure or reporting UI issues.
|
||||
-->
|
||||
|
||||
I have read the FAQ.
|
||||
@@ -1,3 +1,4 @@
|
||||
<!--
|
||||
Thank you for your interest into contributing to OctoPrint, it's
|
||||
highly appreciated!
|
||||
|
||||
@@ -7,6 +8,7 @@ as well that contains important information.
|
||||
|
||||
As a summary, please make sure you have ticked all points on this
|
||||
checklist:
|
||||
-->
|
||||
|
||||
* [ ] Your changes are not possible to do through a plugin and relevant
|
||||
to a large audience (ideally all users of OctoPrint)
|
||||
@@ -16,12 +18,13 @@ checklist:
|
||||
Brainstorming ticket
|
||||
* [ ] Your PR targets OctoPrint's devel branch, or maintenance if it's
|
||||
a bug fix for an issue present in the current stable version (no PRs
|
||||
against master or anything else)
|
||||
against master or anything else please)
|
||||
* [ ] Your PR was opened from a custom branch on your repository
|
||||
(no PRs from your version of master, maintenance or devel please),
|
||||
e.g. dev/my_new_feature
|
||||
e.g. dev/my_new_feature or fix/my_bugfix
|
||||
* [ ] Your PR only contains relevant changes: no unrelated files,
|
||||
no dead code, ideally only one commit - rebase your PR if necessary!
|
||||
no dead code, ideally only one commit - rebase and squash your PR
|
||||
if necessary!
|
||||
* [ ] Your changes follow the existing coding style
|
||||
* [ ] If your changes include style sheets: You have modified the
|
||||
.less source files, not the .css files (those are generated with
|
||||
@@ -32,11 +35,10 @@ checklist:
|
||||
nothing broke
|
||||
* [ ] You have added yourself to the AUTHORS.md file :)
|
||||
|
||||
Feel free to delete all this help text, then describe
|
||||
your PR further. You may use the template provided below to do that.
|
||||
The more details the better!
|
||||
|
||||
----
|
||||
<!--
|
||||
Describe your PR further using the template provided below. The more
|
||||
details the better!
|
||||
-->
|
||||
|
||||
#### What does this PR do and why is it necessary?
|
||||
|
||||
|
||||
+9
-8
@@ -7,8 +7,9 @@
|
||||
# The file is processed from top to bottom, the first matching line wins. If <tag> or <reference commit> are left out,
|
||||
# the lookup table does not apply to the matched branches
|
||||
|
||||
# master and rc shall not use the lookup table, only tags
|
||||
# master, meta, rc and prerelease shall not use the lookup table, only tags
|
||||
master
|
||||
meta/.*
|
||||
rc/.*
|
||||
prerelease
|
||||
|
||||
@@ -16,16 +17,16 @@ prerelease
|
||||
HEAD
|
||||
\(detached.*
|
||||
|
||||
# maintenance is currently the branch for preparation of maintenance release 1.3.7
|
||||
# maintenance is currently the branch for preparation of maintenance release 1.3.8
|
||||
# so are any fix/... and improve/... branches
|
||||
maintenance 1.3.7 99e1c3ac007a0eee9d6f908e598c6b029f3ae40c pep440-dev
|
||||
fix/.* 1.3.7 99e1c3ac007a0eee9d6f908e598c6b029f3ae40c pep440-dev
|
||||
improve/.* 1.3.7 99e1c3ac007a0eee9d6f908e598c6b029f3ae40c pep440-dev
|
||||
maintenance 1.3.8 da2c9632ea54fd1b3c8ae34f8f26bab29dbaf3c6 pep440-dev
|
||||
fix/.* 1.3.8 da2c9632ea54fd1b3c8ae34f8f26bab29dbaf3c6 pep440-dev
|
||||
improve/.* 1.3.8 da2c9632ea54fd1b3c8ae34f8f26bab29dbaf3c6 pep440-dev
|
||||
|
||||
# staging/maintenance is currently the branch for preparation of 1.3.6rc4
|
||||
# staging/maintenance is currently the branch for preparation of 1.3.7rc2
|
||||
# so is regressionfix/...
|
||||
staging/maintenance 1.3.6rc4 a8747f7e36a03ff2449b62cdf68b8a26a6fa61b3 pep440-dev
|
||||
regressionfix/.* 1.3.6rc4 a8747f7e36a03ff2449b62cdf68b8a26a6fa61b3 pep440-dev
|
||||
staging/maintenance 1.3.7rc2 da2c9632ea54fd1b3c8ae34f8f26bab29dbaf3c6 pep440-dev
|
||||
regressionfix/.* 1.3.7rc2 da2c9632ea54fd1b3c8ae34f8f26bab29dbaf3c6 pep440-dev
|
||||
|
||||
# every other branch is a development branch and thus gets resolved to 1.4.0-dev for now
|
||||
.* 1.4.0 7f5d03d0549bcbd26f40e7e4a3297ea5204fb1cc pep440-dev
|
||||
+78
-3
@@ -1,5 +1,80 @@
|
||||
# OctoPrint Changelog
|
||||
|
||||
## 1.3.7rc1 (2018-03-19)
|
||||
|
||||
### Improvements
|
||||
|
||||
* [#324](https://github.com/foosel/OctoPrint/issues/324) & [#2414](https://github.com/foosel/OctoPrint/issues/2414) - Native support for the following [@ commands](http://docs.octoprint.org/en/maintenance/features/atcommands.html): `@pause` (pauses the print), `@resume` (resumes the print), `@cancel` or `@abort` (cancels the print). More commands can be added through the plugin hooks [`octoprint.comm.protocol.atcommand.*`](http://docs.octoprint.org/en/maintenance/plugins/hooks.html#octoprint-comm-protocol-atcommand-phase).
|
||||
* [#2208](https://github.com/foosel/OctoPrint/issues/2208) - New plugin hook [`octoprint.comm.protocol.gcode.error`](http://docs.octoprint.org/en/maintenance/plugins/hooks.html#octoprint-comm-protocol-gcode-error) to allow plugins to override OctoPrint's handling of `Error:`/`!!` messages reported by the firmware. Can be used to "downgrade" errors that aren't actually fatal errors that make the printer halt.
|
||||
* [#2213](https://github.com/foosel/OctoPrint/issues/2213) - Made sure to prevent accidental configuration of a temperature cutoff value less than 1min for the temperature graph.
|
||||
* [#2250](https://github.com/foosel/OctoPrint/pull/2250) - Added [`octoprint.util.ResettableTimer`](http://docs.octoprint.org/en/maintenance/modules/util.html#octoprint.util.ResettableTimer) helper class.
|
||||
* [#2287](https://github.com/foosel/OctoPrint/issues/2287) - Added confirmation for attempting to disconnect during an ongoing print. See also [#2466](https://github.com/foosel/OctoPrint/pull/2466).
|
||||
* [#2302](https://github.com/foosel/OctoPrint/issues/2302) - Detect invalid tools as reported by firmware and blacklist them for `T` commands.
|
||||
* [#2317](https://github.com/foosel/OctoPrint/issues/2317) - Removed capturing of post roll images for time based timelapses, was causing too much confusion and surprise.
|
||||
* [#2335](https://github.com/foosel/OctoPrint/issues/2335) - First throw at detecting if a print from the printer's SD was started outside of OctoPrint via the printer's control panel. Requires some specific requirements to be fulfilled by the printer's firmware to function properly:
|
||||
* Firmware must send a "File opened: ..." message on start of the print
|
||||
* Firmware must respond to an immediately sent `M27` with `SD printing byte <current>/<total>`
|
||||
* Firmware must stay responsive during ongoing print to allow for regular M27 polls (or push those automatically) or M25 to pause/cancel the print through OctoPrint.
|
||||
* [#2362](https://github.com/foosel/OctoPrint/issues/2362) - Added option to configure timelapse snapshot timeout.
|
||||
* [#2367](https://github.com/foosel/OctoPrint/issues/2367) - Added support for `//action:cancel` action command.
|
||||
* [#2378](https://github.com/foosel/OctoPrint/issues/2378) - Made GCODE viewer gracefully handle GCODE subcodes.
|
||||
* [#2385](https://github.com/foosel/OctoPrint/pull/2385) - Made valid boolean trues check case insensitive.
|
||||
* [#2304](https://github.com/foosel/OctoPrint/pull/2304) & [#2405](https://github.com/foosel/OctoPrint/pull/2405) - Added support to trust Basic Authentication headers for user login. Currently requires [manual configuration through `config.yaml`](http://docs.octoprint.org/en/maintenance/configuration/config_yaml.html#access-control), see the `accessControl.trustBasicAuthentication` and `accessControl.checkBasicAuthenticationPassword` settings.
|
||||
* [#2338](https://github.com/foosel/OctoPrint/pull/2338) - Allowed plugins to define GCODE script variables using the `octoprint.comm.protocol.scripts` hook.
|
||||
* [#2406](https://github.com/foosel/OctoPrint/pull/2406) - Extracted log management into its own bundled plugin and allow fine tuning of log levels.
|
||||
* [#2409](https://github.com/foosel/OctoPrint/pull/2409) - Added `m4v` and `mkv` to the list of accepted timelapse extensions.
|
||||
* [#2444](https://github.com/foosel/OctoPrint/pull/2444) - Support additional CSS classes on custom control buttons.
|
||||
* [#2448](https://github.com/foosel/OctoPrint/issues/2448) - Also detect plugins in `~/.octoprint/plugins` that are provided as bytecode `pyc` instead of source `py` files.
|
||||
* [#2455](https://github.com/foosel/OctoPrint/issues/2455) - Added option to configure SSL validation for snapshot URL.
|
||||
* Support `M114` response format of RepRapFirmware (uses `X:... Y:... Z:... E0:... E1:...` instead of
|
||||
`X:... Y:... Z:... E:...`)
|
||||
* Added refresh button to connection panel for easy refresh of the available ports to connect to without having to reload the whole page.
|
||||
* Increased upper bound of PySerial dependency from 2.7 to 3.4. See also [#2333](https://github.com/foosel/OctoPrint/issues/2333).
|
||||
* Switch to lower communication timeouts if support of the `busy` protocol by the firmware is detected.
|
||||
* Refactored serial settings dialog, now has sub tabs and more explanations.
|
||||
* Allow to disable support for certain firmware capabilities, even if reported as supported by the firmware: `busy` protocol, temperature auto reporting, SD status auto reporting
|
||||
* Attached tags to GCODE commands moving through the comm layer and allowed plugins to access and extend these tags through the GCODE hooks. Makes it possible for plugins to detect the origin of a command (streamed file vs. GCODE script vs. user input vs. plugin), the point where it entered the system and so on. Also added a new logger `octoprint.util.comm.command_phases` that if set to `DEBUG` will log the lifecycle of commands through the comm layer including tags to `octoprint.log`. See also [the docs here](http://docs.octoprint.org/en/maintenance/plugins/hooks.html#octoprint-comm-protocol-gcode-phase).
|
||||
* Added new [`job_on_hold`](http://docs.octoprint.org/en/maintenance/modules/printer.html#octoprint.printer.PrinterInterface.job_on_hold) and [`set_job_on_hold`](http://docs.octoprint.org/en/maintenance/modules/printer.html#octoprint.printer.PrinterInterface.set_job_on_hold) methods on the printer instance, allowing plugins to quickly stall the streaming of a queue. This should be used sparingly - abuse will have significant negative effects on the print job. Read the docs if you plan to utilize this.
|
||||
* Support extraction of plugin metadata even from disabled and blacklisted plugins through the AST of the module.
|
||||
* Better logging of printer callback errors and utilization of `frozendict` for internal printer state propagation in an attempt to narrow down on [#1951](https://github.com/foosel/OctoPrint/issues/1951). Should `frozendict` cause issues it can be disabled through the settings in `config.yaml`, just set `devel.useFrozenDictForPrinterState` to `false`
|
||||
* Log comm state changes to `octoprint.log`.
|
||||
* Added a regular server heartbeat to the log (every 15min).
|
||||
* Support SD status auto report by the firmware.
|
||||
* Added `Not SD printing` to default "SD status" terminal filters.
|
||||
* Added custom `readline` implementation for the serial port. Instead of relying on PySerial's `readline` that depending on the installed version might only read from the port one byte at the time, we now wait for one byte and then read everything available into a persistent buffer which then is used to fetch lines from.
|
||||
* Ensure that `callViewModelIf` doesn't try to call null or uncallable `method`s.
|
||||
* Added links to the new [Community Forum](https://discourse.octoprint.org) and the new location of the [FAQ](https://faq.octoprint.org).
|
||||
* Improved pip utility logging, `LocalPipHelper` wasn't producing output, making it hard to debug such non writable install directories.
|
||||
* Added a new bundled plugin "Printer Safety Check" that will try to identify printer/printer firmware with known safety issues such as missing thermal runaway protection.
|
||||
* Plugin Manager: Reduce notification spam. See also [#2260](https://github.com/foosel/OctoPrint/issues/2260).
|
||||
* Software Update Plugin: Better detection if an update is already running.
|
||||
* Software Update Plugin: Refer to `plugin_softwareupdate_console.log` on update errors in log and notification.
|
||||
|
||||
### Bugfixes
|
||||
|
||||
* [#2294](https://github.com/foosel/OctoPrint/issues/2294) - Improved resilience against errors during gathering the file list (e.g. permission errors)
|
||||
* [#2296](https://github.com/foosel/OctoPrint/issues/2296) - Fixed `X-Forwarded-For` handling in Flask Login through monkey patched backport.
|
||||
* [#2297](https://github.com/foosel/OctoPrint/issues/2297) - Return `403` instead of `401` on missing/insufficient credentials.
|
||||
* [#2311](https://github.com/foosel/OctoPrint/issues/2311) - Fixed server not auto connecting on startup if port is set to `AUTO` (see also [#2311](https://github.com/foosel/OctoPrint/pull/2337)).
|
||||
* [#2316](https://github.com/foosel/OctoPrint/issues/2316) - Check for valid queue entry in file analysis queue before trying to dequeue, fix for a HTTP `500` on upload of a file not supported for analysis.
|
||||
* [#2321](https://github.com/foosel/OctoPrint/issues/2321) & [#2449](https://github.com/foosel/OctoPrint/issues/2449) - Fixed wrong queuing order of cancel script & first line from printed file on quick start-cancel-start scenarios by introducing a two new states "Cancelling" and "Pausing".
|
||||
* [#2324](https://github.com/foosel/OctoPrint/pull/2324) - Fixed 500 error when
|
||||
* [#2333](https://github.com/foosel/OctoPrint/issues/2333) (Part 1/3) - Workaround for an update problem caused by interaction of `pip` with dependencies formerly installed as eggs through `python setup.py install`.
|
||||
* [#2333](https://github.com/foosel/OctoPrint/issues/2333) (Part 2/3) - If supported by the underlying PySerial version, cancel all reads and writes on disconnect if possible for a faster connection release. Part 3 (forcing an upgrade of PySerial to 3.4 so this should work in more cases) will in OctoPrint 1.3.8.
|
||||
* [#2364](https://github.com/foosel/OctoPrint/issues/2364) - Fixed firmware error reporting in case of cancelling a print due to a firmware error.
|
||||
* [#2368](https://github.com/foosel/OctoPrint/issues/2368) - Fixed for incorrect handling of unicode filenames in cura slicer profiles
|
||||
* [#2371](https://github.com/foosel/OctoPrint/issues/2371) - Removed "just now"/"gerade eben" label from temperature graph to work around a graph resize issue caused by that.
|
||||
* [#2392](https://github.com/foosel/OctoPrint/issues/2392) - Fixed "Copy all" on terminal tab only working the first time.
|
||||
* [#2406](https://github.com/foosel/OctoPrint/pull/2406) - Fixed `showTab` JS function of about dialog.
|
||||
* [#2426](https://github.com/foosel/OctoPrint/issues/2426) - Made resend logging to `octoprint.log` unicode safe
|
||||
* [#2442](https://github.com/foosel/OctoPrint/issues/2442) - Don't even import disabled plugins, use a dummy entry for them just like for backlisted plugins. More resilience against misbehaving plugins.
|
||||
* [#2461](https://github.com/foosel/OctoPrint/issues/2461) - Fixed OctoPrint not properly disconnecting in case of a firmware error.
|
||||
* Announcement Plugin: Fixed a missing line break in case of more than three announcements in a notification.
|
||||
* Docs: Documentation for printer profile related bits and pieces
|
||||
* Docs: Various fixes of typos and grammar.
|
||||
|
||||
([Commits](https://github.com/foosel/OctoPrint/compare/1.3.6...1.3.7rc1))
|
||||
|
||||
## 1.3.6 (2017-12-12)
|
||||
|
||||
### Note for upgraders and plugin authors: Change in the bundling of JS assets can lead to issues in plugins
|
||||
@@ -118,9 +193,9 @@ You can find out more about the change, how to know if a plugin is even affected
|
||||
|
||||
* [Commits](https://github.com/foosel/OctoPrint/compare/1.3.5...1.3.6)
|
||||
* Release Candidates:
|
||||
* [1.3.5rc1](https://github.com/foosel/OctoPrint/releases/tag/1.3.6rc1)
|
||||
* [1.3.5rc2](https://github.com/foosel/OctoPrint/releases/tag/1.3.6rc2)
|
||||
* [1.3.5rc3](https://github.com/foosel/OctoPrint/releases/tag/1.3.6rc3)
|
||||
* [1.3.6rc1](https://github.com/foosel/OctoPrint/releases/tag/1.3.6rc1)
|
||||
* [1.3.6rc2](https://github.com/foosel/OctoPrint/releases/tag/1.3.6rc2)
|
||||
* [1.3.6rc3](https://github.com/foosel/OctoPrint/releases/tag/1.3.6rc3)
|
||||
* A special **Thank you!** to everyone who reported back on these release candidates this time: [andrivet](https://github.com/andrivet), [b-morgan](https://github.com/b-morgan), [bjarchi](https://github.com/bjarchi), [chippypilot](https://github.com/chippypilot), [ChrisHeerschap](https://github.com/ChrisHeerschap), [cosmith71](https://github.com/cosmith71), [Crowlord](https://github.com/Crowlord), [ctgreybeard](https://github.com/ctgreybeard), [fiveangle](https://github.com/fiveangle), [goeland86](https://github.com/goeland86), [jbjones27](https://github.com/jbjones27), [jneilliii](https://github.com/jneilliii), [JohnOCFII](https://github.com/JohnOCFII), [Kunsi](https://github.com/Kunsi), [Lordxv](https://github.com/Lordxv), [malnvenshorn](https://github.com/malnvenshorn), [mcp5500](https://github.com/mcp5500), [ntoff](https://github.com/ntoff), [ripp2003](https://github.com/ripp2003) and [schorsch3000](https://github.com/schorsch3000)
|
||||
|
||||
## 1.3.5 (2017-10-16)
|
||||
|
||||
+141
-103
@@ -21,45 +21,41 @@ or **[creating pull requests](#pull-requests)**.
|
||||
|
||||
## Issues, Tickets, however you may call them
|
||||
|
||||
Please read the following short instructions fully and follow them. You can
|
||||
Please read the following instructions fully and follow them. You can
|
||||
help the project tremendously this way: not only do you help the maintainers
|
||||
to **address problems in a timely manner** but also keep it possible for them
|
||||
to **fix bugs, add new and improve on existing functionality** instead of doing
|
||||
nothing but ticket management.
|
||||
|
||||

|
||||

|
||||
|
||||
- **[Read the FAQ](https://github.com/foosel/OctoPrint/wiki/FAQ)**
|
||||
- **[Read the FAQ](https://faq.octoprint.org)**
|
||||
- If you want to report a **bug**, [read "How to file a bug report" below](#how-to-file-a-bug-report)
|
||||
and *[use the provided template](#what-should-i-include-in-a-ticket)*.
|
||||
You do not need to do anything else with your ticket.
|
||||
- If you want to post a **feature request** or a **documentation request**, add `[Request]`
|
||||
to your issue's title (e.g. `[Request] Awesome new feature`). A question on how to run/change/setup
|
||||
something is **not** what qualifies as a request here, use the
|
||||
[Mailinglist](https://groups.google.com/group/octoprint) or the
|
||||
[Google+ Community](https://plus.google.com/communities/102771308349328485741) for
|
||||
[community forum at discourse.octoprint.org](https://discourse.octoprint.org) for
|
||||
such support issues.
|
||||
- If you are a **developer** that wants to brainstorm a pull request or possible
|
||||
changes to the plugin system, add [Brainstorming] to your issue's title (e.g.
|
||||
`[Brainstorming] New plugin hook for doing some cool stuff`).
|
||||
- If you need **support**, have a **question** or some **other reason** that
|
||||
doesn't fit any of the above categories, the issue tracker is not the right place.
|
||||
Consult the [Mailinglist](https://groups.google.com/group/octoprint) or the
|
||||
[Google+ Community](https://plus.google.com/communities/102771308349328485741) instead.
|
||||
Consult the [community forum at discourse.octoprint.org](https://discourse.octoprint.org) instead.
|
||||
|
||||
No matter what kind of ticket you create, never mix two or more "ticket reasons"
|
||||
into one ticket: One ticket per bug, request, brainstorming thread please.
|
||||
|
||||
----
|
||||
|
||||
**Note**: A bot is in place that monitors new tickets, automatically
|
||||
categorizes them and checks new bug reports for usage of the provided template.
|
||||
That bot will only bother you if you open a ticket that appears to be a bug (no
|
||||
`[Request]` or `[Brainstorming]` in the title) without the template, and it
|
||||
will do that only to ensure that all information needed to solve the issue is
|
||||
available for the maintainers to directly start tackling that problem.
|
||||
|
||||
----
|
||||
> 👉 **Note**
|
||||
>
|
||||
> A bot is in place that monitors new tickets, automatically
|
||||
> categorizes them and checks new bug reports for usage of the provided template.
|
||||
> That bot will only bother you if you open a ticket that appears to be a bug (no
|
||||
> `[Request]` or `[Brainstorming]` in the title) without the complete template, and it
|
||||
> will do that only to ensure that all information needed to solve the issue is
|
||||
> available for the maintainers to directly start tackling that problem.
|
||||
|
||||
## How to file a bug report
|
||||
|
||||
@@ -72,22 +68,25 @@ following section *completely* and also follow the instructions in the
|
||||
|
||||
### What should I do before submitting a bug report?
|
||||
|
||||
1. **Make sure you are at the right location**. This is the Github repository
|
||||
1. **Make sure you are at the right location**. This is the bug tracker
|
||||
of the official version of OctoPrint, which is the 3D print server and
|
||||
corresponding web interface itself.
|
||||
|
||||
**This is not the Github respository of OctoPi**, which is the preconfigured
|
||||
|
||||
**OctoPrint doesn't manage your network connection or your webcam nor
|
||||
can it fix your printer not getting detected as a serial interface** -
|
||||
if you have any kinds of problems with that, get in touch on the
|
||||
[community forum](https://discourse.octoprint.org).
|
||||
|
||||
**This is not the bug tracker of OctoPi**, which is the preconfigured
|
||||
Raspberry Pi image including OctoPrint among other things - that one can be found
|
||||
[here](https://github.com/guysoft/OctoPi). Please note that while we do have
|
||||
some entries regarding OctoPi in the FAQ, any bugs should be reported in the
|
||||
[proper bug tracker](https://github.com/guysoft/OctoPi/issues) which - again -
|
||||
is not here.
|
||||
[here](https://github.com/guysoft/OctoPi). If you have any kind of specific
|
||||
issue with how the OctoPi system is setup, go there please.
|
||||
|
||||
**This is also not the Github repository of any OctoPrint Plugins you
|
||||
**This is also not the bug tracker of any OctoPrint Plugins you
|
||||
might have installed**. Report any issues with those in their corresponding
|
||||
bug tracker (probably linked to from the plugin's homepage).
|
||||
|
||||
Finally, **this is also not the right issue tracker if you are running a
|
||||
Finally, **this is also not the right bug tracker if you are running a
|
||||
forked version of OctoPrint**. Seek help for such unofficial versions from
|
||||
the people maintaining them instead.
|
||||
|
||||
@@ -101,7 +100,7 @@ following section *completely* and also follow the instructions in the
|
||||
more about safe mode in the [docs](http://docs.octoprint.org/en/master/features/safemode.html).
|
||||
|
||||
You might also want to try the current development version of OctoPrint
|
||||
(if you aren't already). Refer to the [FAQ](https://github.com/foosel/OctoPrint/wiki/FAQ)
|
||||
(if you aren't already). Refer to the [FAQ](https://faq.octoprint.org)
|
||||
for information on how to do this.
|
||||
|
||||
3. The problem still exists? Then please **look through the
|
||||
@@ -111,8 +110,8 @@ following section *completely* and also follow the instructions in the
|
||||
Sorting through duplicates of the same issue sometimes causes more work than
|
||||
fixing it. Take the time to filter through possible duplicates and be really
|
||||
sure that your problem definitely is a new one. Try more than one search query
|
||||
(e.g. do not only search for "webcam" if you happen to run into an issue
|
||||
with your webcam, also search for "timelapse" etc). Do not only read the subject lines
|
||||
(e.g. do not only search for "timelapse" if you happen to run into an issue
|
||||
with your webcam, also search for "recording" etc). Do not only read the subject lines
|
||||
of tickets that look like they might be related, but also read the ticket itself!
|
||||
|
||||
**Very important:** Please make absolutely sure that if you find a bug that looks like
|
||||
@@ -126,84 +125,149 @@ following section *completely* and also follow the instructions in the
|
||||
makes it more difficult due to on top of having to figure out the original problem
|
||||
there's now also a [red herring](https://en.wikipedia.org/wiki/Red_herring) interfering - so please be
|
||||
very diligent here!
|
||||
|
||||
|
||||
If in doubt about any of the above - get in touch on the [community forum](https://discourse.octoprint.org)
|
||||
instead of opening a ticket here. If you are actually running into a bug, we'll figure it out together
|
||||
there.
|
||||
|
||||
### What should I include in a bug report?
|
||||
|
||||
First of all make sure your use **a descriptive title**. "It doesn't work"
|
||||
and similar unspecific complaints are NOT descriptive titles.
|
||||
|
||||
**Always use the following template** (please remove what's within `[...]`, that's
|
||||
only provided here as some additional information for you), **even if only adding a
|
||||
"me too" to an existing ticket**:
|
||||
**Always use the following template, even if only adding a "me too" to an
|
||||
existing ticket**:
|
||||
|
||||
#### What were you doing?
|
||||
```
|
||||
<!--
|
||||
READ THE FOLLOWING FIRST:
|
||||
|
||||
[Please be as specific as possible here. The maintainers will need to
|
||||
reproduce your issue in order to fix it and that is not possible if they
|
||||
don't know what you did to get it to happen in the first place.
|
||||
If not already done, please read the the Contribution Guidelines that
|
||||
are linked to the right under "Helpful resources" > "Contributing".
|
||||
|
||||
Ideally provide exact steps to follow in order to reproduce your problem:
|
||||
Also read the FAQ: https://faq.octoprint.org
|
||||
|
||||
1. ...
|
||||
2. ...
|
||||
3. ...
|
||||
This is a bug and feature tracker, please only use it to report bugs
|
||||
or request features within OctoPrint (not OctoPi, not any OctoPrint
|
||||
plugins and not unofficial OctoPrint versions).
|
||||
|
||||
If you encountered a problem with specific files of any sorts, make sure
|
||||
to also include a link to a file with which to reproduce the problem.]
|
||||
Do not seek support here ("I need help with ...", "I have a
|
||||
question ..."), that belongs on the community forum at
|
||||
discourse.octoprint.org, NOT here.
|
||||
|
||||
#### What did you expect to happen?
|
||||
Mark requests with a "[Request]" prefix in the title please. For bug
|
||||
reports fully fill out the bug reporting template (if you don't know
|
||||
where to find some information - it's all described in the Contribution
|
||||
Guidelines linked up there in the big yellow box).
|
||||
|
||||
#### What happened instead?
|
||||
When reporting a bug do NOT delete ANY lines from the template.
|
||||
|
||||
#### Did the same happen when running OctoPrint in safe mode?
|
||||
Make sure any bug you want to report is still present with the CURRENT
|
||||
OctoPrint version and that it does not vanish when you start OctoPrint
|
||||
in safe mode - how to do that is also explained in the Contribution
|
||||
Guidelines linked up there in the big yellow box.
|
||||
|
||||
[Try to reproduce your problem in safe mode. You can find information
|
||||
on how to enable safe mode in the Contribution Guidelines.]
|
||||
Thank you!
|
||||
-->
|
||||
|
||||
#### Version of OctoPrint
|
||||
#### What were you doing?
|
||||
|
||||
[Can be found in the lower left corner of the web interface. ALWAYS INCLUDE.]
|
||||
<!--
|
||||
Please be as specific as possible here. The maintainers will need to
|
||||
reproduce your issue in order to fix it and that is not possible if they
|
||||
don't know what you did to get it to happen in the first place.
|
||||
|
||||
#### Operating System running OctoPrint
|
||||
Ideally provide exact steps to follow in order to reproduce your problem:
|
||||
-->
|
||||
|
||||
[OctoPi, Linux, Windows, MacOS, something else? With version please,
|
||||
OctoPi's version can be found in /etc/octopi_version]
|
||||
1. ...
|
||||
2. ...
|
||||
3. ...
|
||||
|
||||
#### Printer model & used firmware incl. version
|
||||
<!--
|
||||
If you encountered a problem with specific files of any sorts, make sure
|
||||
to also include a link to a file with which to reproduce the problem.
|
||||
-->
|
||||
|
||||
[If applicable, always include if unsure.]
|
||||
#### What did you expect to happen?
|
||||
|
||||
#### Browser and Version of Browser, Operating System running Browser
|
||||
#### What happened instead?
|
||||
|
||||
[If applicable, always include if unsure.]
|
||||
#### Did the same happen when running OctoPrint in safe mode?
|
||||
|
||||
#### Link to octoprint.log
|
||||
<!--
|
||||
Test if you can reproduce your problem in safe mode. You can find information
|
||||
on how to enable safe mode in the Contribution Guidelines.
|
||||
|
||||
[On gist.github.com or pastebin.com. ALWAYS INCLUDE and never truncate.
|
||||
The Contribution Guidelines tell you where to find that.]
|
||||
If you can't reproduce in safe mode, this is a bug with one of your
|
||||
installed third party plugins. Don't open a ticket here!
|
||||
|
||||
#### Link to contents of terminal tab or serial.log
|
||||
If you can't test this in safe mode, state why.
|
||||
-->
|
||||
|
||||
[On gist.github.com or pastebin.com. If applicable, always include if unsure or
|
||||
reporting communication issues. Never truncate.
|
||||
#### Version of OctoPrint
|
||||
|
||||
serial.log is usually not written due to performance reasons and must be
|
||||
enabled explicitly. Provide at the very least the FULL contents of your
|
||||
terminal tab at the time of the bug occurrence, even if you do not have
|
||||
a serial.log.]
|
||||
<!--
|
||||
Can be found in the lower left corner of the web interface. ALWAYS INCLUDE.
|
||||
-->
|
||||
|
||||
#### Link to contents of Javascript console in the browser
|
||||
#### Operating System running OctoPrint
|
||||
|
||||
[On gist.github.com or pastebin.com or alternatively a screenshot. If applicable -
|
||||
always include if unsure or reporting UI issues.
|
||||
<!--
|
||||
OctoPi, Linux, Windows, MacOS, something else? With version please.
|
||||
OctoPi's version can be found in /etc/octopi_version or in the lower left
|
||||
corner of the web interface.
|
||||
-->
|
||||
|
||||
The Contribution Guidelines tell you where to find that.]
|
||||
#### Printer model & used firmware incl. version
|
||||
|
||||
#### Screenshot(s)/video(s) showing the problem:
|
||||
<!--
|
||||
If applicable, always include if unsure.
|
||||
-->
|
||||
|
||||
[If applicable. Always include if unsure or reporting UI issues.]
|
||||
#### Browser and version of browser, operating system running browser
|
||||
|
||||
I have read the FAQ.
|
||||
<!--
|
||||
If applicable, always include if unsure.
|
||||
-->
|
||||
|
||||
#### Link to octoprint.log
|
||||
|
||||
<!--
|
||||
On gist.github.com or pastebin.com. ALWAYS INCLUDE and never truncate.
|
||||
|
||||
The Contribution Guidelines tell you where to find that.
|
||||
-->
|
||||
|
||||
#### Link to contents of terminal tab or serial.log
|
||||
|
||||
<!--
|
||||
On gist.github.com or pastebin.com. If applicable, always include if unsure or
|
||||
reporting communication issues. Never truncate.
|
||||
|
||||
serial.log is usually not written due to performance reasons and must be
|
||||
enabled explicitly. Provide at the very least the FULL contents of your
|
||||
terminal tab at the time of the bug occurrence, even if you do not have
|
||||
a serial.log (which the Contribution Guidelines tell you where to find).
|
||||
-->
|
||||
|
||||
#### Link to contents of Javascript console in the browser
|
||||
|
||||
<!--
|
||||
On gist.github.com or pastebin.com or alternatively a screenshot. If applicable -
|
||||
always include if unsure or reporting UI issues.
|
||||
|
||||
The Contribution Guidelines tell you where to find that.
|
||||
-->
|
||||
|
||||
#### Screenshot(s)/video(s) showing the problem:
|
||||
|
||||
<!--
|
||||
If applicable. Always include if unsure or reporting UI issues.
|
||||
-->
|
||||
|
||||
I have read the FAQ.
|
||||
```
|
||||
|
||||
Copy-paste this template **completely** (or use the version that gets pre-filled
|
||||
into the "new issue" form). Do not skip any lines or the bot *will* complain! Provide
|
||||
@@ -226,35 +290,7 @@ current commit.
|
||||
|
||||
### Where can I find those log files you keep talking about?
|
||||
|
||||
OctoPrint by default provides two log outputs, a third one can be enabled if
|
||||
more information is needed.
|
||||
|
||||
One is contained in the **"Terminal" tab** within OctoPrint's UI and is a log
|
||||
of the last 300 lines of communication with the printer. Please copy-paste
|
||||
this *completely* somewhere (disable auto scroll to make copying the contents easier) -
|
||||
e.g. http://pastebin.com or http://gist.github.com - and include a link in
|
||||
your bug report.
|
||||
|
||||
There is also **OctoPrint's application log file** or in short `octoprint.log`,
|
||||
which is by default located at `~/.octoprint/logs/octoprint.log` on Linux,
|
||||
`%APPDATA%\OctoPrint\logs\octoprint.log` on Windows and
|
||||
`~/Library/Application Support/OctoPrint/logs/octoprint.log` on MacOS. You can
|
||||
also access it directly through OctoPrint via Settings > Logs. Please
|
||||
copy-paste this *completely* to pastebin or gist as well and include a link in your bug
|
||||
report.
|
||||
|
||||
It might happen that you are asked to provide a more **thorough log of the
|
||||
communication with the printer** if you haven't already done so, the `serial.log`.
|
||||
This is not written by default due to performance reasons, but you can enable
|
||||
it in the settings dialog. After enabling that log, please reproduce the problem
|
||||
again (connect to the printer, do whatever triggers it), then copy-paste
|
||||
`~/.octoprint/logs/serial.log` (Windows: `%APPDATA%\OctoPrint\logs\serial.log`,
|
||||
MacOS: `~/Library/Application Support/OctoPrint/logs/serial.log`) to pastebin
|
||||
or gist and include the link in the bug report.
|
||||
|
||||
You might also be asked to provide a log with an increased log level. You can
|
||||
find information on how to do just that in the
|
||||
[docs](http://docs.octoprint.org/en/master/configuration/logging_yaml.html).
|
||||
Please refer to [this FAQ entry](https://discourse.octoprint.org/t/where-can-i-find-octoprints-log-files/299).
|
||||
|
||||
### Where can I find my browser's error console?
|
||||
|
||||
@@ -445,6 +481,8 @@ the local version identifier to allow for an exact determination of the active c
|
||||
by OctoPrint itself and not a misbehaving plugin.
|
||||
* 2017-03-27: Added safe mode section to ticket template.
|
||||
* 2017-11-22: Added note on how to run the unit tests
|
||||
* 2018-03-15: Link to new community forum and some clarifications re bug
|
||||
reporting
|
||||
|
||||
## Footnotes
|
||||
* [1] - If you are wondering why, the problem is that anything that you add
|
||||
|
||||
@@ -7,6 +7,10 @@ and released under the [GNU Affero General Public License V3](http://www.gnu.org
|
||||
|
||||
Its website can be found at [octoprint.org](https://octoprint.org/?utm_source=github&utm_medium=readme).
|
||||
|
||||
The community forum is available at [discourse.octoprint.org](https://discourse.octoprint.org/?utm_source=github&utm_medium=readme).
|
||||
|
||||
The FAQ can be accessed by following [faq.octoprint.org](https://faq.octoprint.org/?utm_source=github&utm_medium=readme).
|
||||
|
||||
The documentation is located at [docs.octoprint.org](http://docs.octoprint.org).
|
||||
|
||||
The official plugin repository can be reached at [plugins.octoprint.org](https://plugins.octoprint.org/?utm_source=github&utm_medium=readme).
|
||||
@@ -19,17 +23,17 @@ If you enjoy OctoPrint, please consider becoming a regular supporter!**
|
||||
You are currently looking at the source code repository of OctoPrint. If you already installed it
|
||||
(e.g. by using the Raspberry Pi targeted distribution [OctoPi](https://github.com/guysoft/OctoPi)) and only
|
||||
want to find out how to use it, [the documentation](http://docs.octoprint.org/) and [the public wiki](https://github.com/foosel/OctoPrint/wiki)
|
||||
might be of more interest for you. You might also want to subscribe to [the mailing list](https://groups.google.com/group/octoprint)
|
||||
or the [G+ Community](https://plus.google.com/communities/102771308349328485741) where there are other active users who might be
|
||||
might be of more interest for you. You might also want to subscribe to join
|
||||
[the community forum at discourse.octoprint.org](https://discourse.octoprint.org) where there are other active users who might be
|
||||
able to help you with any questions you might have.
|
||||
|
||||
## Contributing
|
||||
|
||||
Contributions of all kinds are welcome, not only in the form of code but also with regards to the
|
||||
[official documentation](http://docs.octoprint.org/) or [the public wiki](https://github.com/foosel/OctoPrint/wiki), support
|
||||
of other users in the [bug tracker](https://github.com/foosel/OctoPrint/issues),
|
||||
[the Mailinglist](https://groups.google.com/group/octoprint) or
|
||||
[the G+ Community](https://plus.google.com/communities/102771308349328485741) and also [financially](https://octoprint.org/support-octoprint/?utm_source=github&utm_medium=readme).
|
||||
[official documentation](http://docs.octoprint.org/) or [the public wiki](https://github.com/foosel/OctoPrint/wiki), debugging help
|
||||
in the [bug tracker](https://github.com/foosel/OctoPrint/issues), support of other users on
|
||||
[the community forum at discourse.octoprint.org](https://discourse.octoprint.org)
|
||||
and also [financially](https://octoprint.org/support-octoprint/?utm_source=github&utm_medium=readme).
|
||||
|
||||
If you think something is bad about OctoPrint or its documentation the way it is, please help
|
||||
in any way to make it better instead of just complaining about it -- this is an Open Source Project
|
||||
@@ -54,23 +58,20 @@ you already have Python 2.7, pip and virtualenv set up on your system:
|
||||
1. Checkout OctoPrint: `git clone https://github.com/foosel/OctoPrint.git`
|
||||
2. Change into the OctoPrint folder: `cd OctoPrint`
|
||||
3. Create a user-owned virtual environment therein: `virtualenv venv`
|
||||
4. Install OctoPrint *into that virtual environment*: `./venv/bin/python setup.py install`
|
||||
4. Install OctoPrint *into that virtual environment*: `./venv/bin/pip install .`
|
||||
|
||||
You may then start the OctoPrint server via `/path/to/OctoPrint/venv/bin/octoprint`, see [Usage](#usage)
|
||||
for details.
|
||||
|
||||
After installation, please make sure you follow the first-run wizard and set up
|
||||
access control as necessary. If you want to not only be notified about new
|
||||
releases, but also be able to automatically upgrade to them from within
|
||||
OctoPrint, take a look [at the documentation of the Software Update Plugin](https://github.com/foosel/OctoPrint/wiki/Plugin:-Software-Update#making-octoprint-updateable-on-existing-installations)
|
||||
and at its settings.
|
||||
access control as necessary.
|
||||
|
||||
## Dependencies
|
||||
|
||||
OctoPrint depends on a few python modules to do its job. Those are automatically installed when installing
|
||||
OctoPrint via `setup.py`:
|
||||
OctoPrint via `pip`:
|
||||
|
||||
python setup.py install
|
||||
pip install .
|
||||
|
||||
You should do this every time after pulling from the repository, since the dependencies may have changed.
|
||||
|
||||
@@ -78,9 +79,9 @@ OctoPrint currently only supports Python 2.7.
|
||||
|
||||
## Usage
|
||||
|
||||
Running the `setup.py` script via
|
||||
Running the pip install via
|
||||
|
||||
python setup.py install
|
||||
pip install .
|
||||
|
||||
installs the `octoprint` script in your Python installation's scripts folder
|
||||
(which, depending on whether you installed OctoPrint globally or into a virtual env, will be in your `PATH` or not). The
|
||||
|
||||
+6
-10
@@ -11,12 +11,10 @@ thanks to everyone who contributed!
|
||||
* Andrew Moorby
|
||||
* Arnljot Arntsen
|
||||
* BEEVERYCREATIVE
|
||||
* Boris Hussein
|
||||
* Brad Jackson
|
||||
* Brian E. Tyler
|
||||
* Christian Petropolis
|
||||
* COLLE+McVOY
|
||||
* CreativeTools
|
||||
* D Brian Kimmel
|
||||
* DeltaMaker 3D Printers
|
||||
* E3D BigBox
|
||||
@@ -24,19 +22,18 @@ thanks to everyone who contributed!
|
||||
* F. Kunsmann
|
||||
* Frank Sander
|
||||
* Gary Deen
|
||||
* Gary N McKinney
|
||||
* George Robles
|
||||
* günter weber
|
||||
* James Seigel
|
||||
* Jason Lawrence
|
||||
* Jeff Moe
|
||||
* Jefferson Hunt
|
||||
* Jeremiah Avery
|
||||
* Josh Daniels
|
||||
* Kaile Riser
|
||||
* Kale Stedman
|
||||
* Kazuhiro Ogura
|
||||
* Kodama Inc.
|
||||
* Makespace Madrid
|
||||
* Marcus Ackermann
|
||||
* Mark Walker
|
||||
* Martin Beattie
|
||||
* Michael Aumock
|
||||
* Miles Flavel
|
||||
* mitchell hirsch
|
||||
@@ -44,8 +41,8 @@ thanks to everyone who contributed!
|
||||
* Noe Ruiz
|
||||
* Patrick McGinnis
|
||||
* Peter Schmehl
|
||||
* PRINT3Dforum.com
|
||||
* Randy C. Will
|
||||
* Robert Gusek
|
||||
* Roger Strolz
|
||||
* Roy Cortes
|
||||
* Samer Najia
|
||||
@@ -55,7 +52,6 @@ thanks to everyone who contributed!
|
||||
* Sven Mueller
|
||||
* Symbiotic Devices
|
||||
* Thomas Hatley
|
||||
* Timeshell.ca
|
||||
* Trent Shumay
|
||||
|
||||
and 1062 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel)!
|
||||
and 1188 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel)!
|
||||
@@ -44,6 +44,14 @@ Printer State
|
||||
- 1
|
||||
- Boolean
|
||||
- ``true`` if the printer is currently printing, ``false`` otherwise
|
||||
* - ``flags.pausing``
|
||||
- 1
|
||||
- Boolean
|
||||
- ``true`` if the printer is currently printing and in the process of pausing, ``false`` otherwise
|
||||
* - ``flags.cancelling``
|
||||
- 1
|
||||
- Boolean
|
||||
- ``true`` if the printer is currently printing and in the process of pausing, ``false`` otherwise
|
||||
* - ``flags.sdReady``
|
||||
- 1
|
||||
- Boolean
|
||||
|
||||
@@ -12,7 +12,7 @@ Authorization
|
||||
=============
|
||||
|
||||
OctoPrint's API expects an API key to be supplied with each request. This API key can be either the globally
|
||||
configured one, a user specific one if "Access Control" is enabled or an ref:`App Session Key <sec-api-apps-sessionkey>`.
|
||||
configured one, a user specific one if "Access Control" is enabled or an :ref:`App Session Key <sec-api-apps-sessionkey>`.
|
||||
Users are able to generate and revoke their custom API key via the "Change password" dialog.
|
||||
|
||||
The API key must be supplied in the custom HTTP header ``X-Api-Key``, e.g.
|
||||
@@ -65,7 +65,7 @@ Please be advised that clients should use the header field variant if at all pos
|
||||
Content Type
|
||||
============
|
||||
|
||||
If not otherwise stated OctoPrint's API expects request bodies and issues response bodies as ``Content-Type: application/json``.
|
||||
If not otherwise stated, OctoPrint's API expects request bodies and issues response bodies as ``Content-Type: application/json``.
|
||||
|
||||
.. _sec-api-general-encoding:
|
||||
|
||||
|
||||
@@ -149,6 +149,8 @@ Retrieve the current printer state
|
||||
"operational": true,
|
||||
"paused": false,
|
||||
"printing": false,
|
||||
"cancelling": false,
|
||||
"pausing": false,
|
||||
"sdReady": true,
|
||||
"error": false,
|
||||
"ready": true,
|
||||
@@ -179,6 +181,8 @@ Retrieve the current printer state
|
||||
"operational": true,
|
||||
"paused": false,
|
||||
"printing": false,
|
||||
"cancelling": false,
|
||||
"pausing": false,
|
||||
"sdReady": true,
|
||||
"error": false,
|
||||
"ready": true,
|
||||
@@ -213,7 +217,7 @@ Issue a print head command
|
||||
* ``z``: Optional. Amount/coordinate to jog print head on z axis, must be a valid number corresponding to the distance to travel in mm.
|
||||
* ``absolute``: Optional. Boolean value specifying whether to move relative to current position (provided
|
||||
axes values are relative amounts) or to absolute position (provided axes values are coordinates)
|
||||
* ``speed``: Optiona. Speed at which to move. If not provided, minimum speed for all selected axes from printer
|
||||
* ``speed``: Optional. Speed at which to move. If not provided, minimum speed for all selected axes from printer
|
||||
profile will be used. If provided but ``false``, no speed parameter will be appended to the command. Otherwise
|
||||
interpreted as an integer signifying the speed in mm/s, to append to the command.
|
||||
|
||||
@@ -223,7 +227,7 @@ Issue a print head command
|
||||
* ``axes``: A list of axes which to home, valid values are one or more of ``x``, ``y``, ``z``.
|
||||
|
||||
feedrate
|
||||
Changes the feedrate factor to apply to the movement's of the axes.
|
||||
Changes the feedrate factor to apply to the movements of the axes.
|
||||
|
||||
* ``factor``: The new factor, percentage as integer or float (percentage divided by 100) between 50 and 200%.
|
||||
|
||||
|
||||
+1
-1
@@ -139,7 +139,7 @@ Execute a registered system command
|
||||
|
||||
.. http:post:: /api/system/commands/(string:source)/(string:action)
|
||||
|
||||
Execute the system command ``action`` on defined in ``source``.
|
||||
Execute the system command ``action`` defined in ``source``.
|
||||
|
||||
**Example**
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ Rendered timelapse
|
||||
* - ``date``
|
||||
- 1
|
||||
- string
|
||||
- Formatted timestamp of the the timelapse creation date
|
||||
- Formatted timestamp of the timelapse creation date
|
||||
* - ``url``
|
||||
- 1
|
||||
- string
|
||||
@@ -162,7 +162,7 @@ Unrendered timelapse
|
||||
* - ``date``
|
||||
- 1
|
||||
- string
|
||||
- Formatted timestamp of the the timelapse job creation date
|
||||
- Formatted timestamp of the timelapse job creation date
|
||||
* - ``recording``
|
||||
- 1
|
||||
- bool
|
||||
|
||||
+4
-2
@@ -38,13 +38,15 @@ Test paths or URLs
|
||||
.. _sec-api-util-test-url:
|
||||
|
||||
url
|
||||
Tests whether a provided url responds. Request method and expected status codes can
|
||||
Tests whether a provided URL responds. Request method and expected status codes can
|
||||
optionally be specified as well. Supported parameters are:
|
||||
|
||||
* ``url``: The url to test. Mandatory.
|
||||
* ``url``: The URL to test. Mandatory.
|
||||
* ``method``: The request method to use for the test. Optional, defaults to ``HEAD``.
|
||||
* ``timeout``: A timeout for the request, in seconds. If no reply from the tested URL has been
|
||||
received within this time frame, the check will be considered a failure. Optional, defaults to 3 seconds.
|
||||
* ``validSsl``: Whether to validate the SSL connection if the ``url`` happens to be an HTTPS URL or not. Optional,
|
||||
defaults to ``True``.
|
||||
* ``status``: The status code(s) or named status range(s) to test for. Can be either a single
|
||||
value or a list of either HTTP status codes or any of the following named status ranges:
|
||||
|
||||
|
||||
@@ -11,4 +11,5 @@ Bundled Plugins
|
||||
discovery.rst
|
||||
logging.rst
|
||||
pluginmanager.rst
|
||||
printer_safety_check.rst
|
||||
softwareupdate.rst
|
||||
@@ -198,7 +198,7 @@ JS Client Library
|
||||
|
||||
.. note::
|
||||
|
||||
All methods here require that the used API token or a the existing browser session
|
||||
All methods here require that the used API token or the existing browser session
|
||||
has admin rights.
|
||||
|
||||
.. js:function:: OctoPrintClient.plugins.logging.listLogs(opts)
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
.. _sec-bundledplugins-printer_safety_check:
|
||||
|
||||
Printer Safety Check
|
||||
====================
|
||||
|
||||
The Printer Safety Check plugin comes bundled with OctoPrint starting with version 1.3.7.
|
||||
|
||||
It tries to identify printers or rather printer firmwares with known safety issues, such as
|
||||
disabled thermal runaway protection, and displays a warning box to logged in users on
|
||||
such identification.
|
||||
|
||||
.. _fig-bundledplugins-printer_safety_check-example:
|
||||
.. figure:: ../images/bundledplugins-printer_safety_check-example.png
|
||||
:align: center
|
||||
:alt: Printer Safety Check warning example
|
||||
|
||||
An example of a warning generated by the Printer Safety Check
|
||||
|
||||
Currently the following firmwares produce this warning:
|
||||
|
||||
* Anet A8 stock firmware
|
||||
|
||||
If you know of further printers/printer firmwares that need to be added here, please
|
||||
`get in touch on the forum and provide their response to an M115 <https://faq.octoprint.org/warning-firmware-unsafe>`_.
|
||||
|
||||
.. seealso::
|
||||
|
||||
`Entry on the "unsafe firmware" warning in OctoPrint's FAQ <https://faq.octoprint.org/warning-firmware-unsafe>`_
|
||||
|
||||
.. note::
|
||||
|
||||
Feel free to disable the plugin in OctoPrint's Plugin Manager if you feel like it is unnecessary. Be advised though
|
||||
that even if your printer might be running totally fine with a known unsafe configuration, that might change
|
||||
unexpectedly and with `catastrophic <https://www.thissmarthouse.net/dont-burn-your-house-down-3d-printing-a-cautionary-tale/>`_
|
||||
`results <https://www.reddit.com/r/3Dprinting/comments/6cekgk/house_fire_thanks_to_cheap_printer_from_china/>`_.
|
||||
|
||||
.. _sec-bundledplugins-printer_safety_check-source:
|
||||
|
||||
Source Code
|
||||
-----------
|
||||
|
||||
The source of the Printer Safety Check plugin is bundled with OctoPrint and can be
|
||||
found in its source repository under ``src/octoprint/plugins/printer_safety_check``.
|
||||
@@ -46,7 +46,7 @@ There you can adjust the following settings:
|
||||
for the various components registered with the plugin, so that they don't have to be queried from the internet every time
|
||||
you load the page. Defaults to 24h, you usually shouldn't need to change that value.
|
||||
|
||||
More settings are available by :ref:`editing the correspondi.. _section in config.yaml <sec-bundledplugins-softwareupdate-configuration>`.
|
||||
More settings are available by :ref:`editing the corresponding section in config.yaml <sec-bundledplugins-softwareupdate-configuration>`.
|
||||
|
||||
That restart commands for OctoPrint and the whole server can be configured under Settings > Server.
|
||||
|
||||
@@ -56,9 +56,9 @@ Command line usage
|
||||
------------------
|
||||
|
||||
The functionality of the Software Update Plugin is also available on OctoPrint's command line interface under the
|
||||
``plugins`` sub command. It's is possible to check for updates via ``octoprint plugins softwareupdate:check``
|
||||
and to apply available updates via ``octoprint plugins softwareupdate:update``. Please the corresponding
|
||||
``--help`` pages on details:
|
||||
``plugins`` sub command. It's possible to check for updates via ``octoprint plugins softwareupdate:check``
|
||||
and to apply available updates via ``octoprint plugins softwareupdate:update``. Please see the corresponding
|
||||
``--help`` pages for details:
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
@@ -126,7 +126,7 @@ Configuring the Plugin
|
||||
checks:
|
||||
# "octoprint" is reserved for OctoPrint
|
||||
octoprint:
|
||||
# this defines an version check that will check against releases
|
||||
# this defines a version check that will check against releases
|
||||
# published on OctoPrint's Github repository and pip as update method
|
||||
# against the release archives on Github - this is the default
|
||||
type: github_release
|
||||
@@ -135,7 +135,7 @@ Configuring the Plugin
|
||||
method: pip
|
||||
pip: 'https://github.com/foosel/OctoPrint/archive/{target_version}.zip'
|
||||
|
||||
# further checks may be define here
|
||||
# further checks may be defined here
|
||||
|
||||
# pip command, if another one than the automatically detected one should be
|
||||
# used - should normally NOT be necessary and hence set
|
||||
@@ -209,7 +209,7 @@ Version checks
|
||||
:ref:`hook <sec-bundledplugins-softwareupdate-hooks>`. Additional config
|
||||
parameters:
|
||||
|
||||
* ``python_checker``: (mandatory) A python callable which returns version
|
||||
* ``python_checker``: (mandatory) A Python callable which returns version
|
||||
information and whether the current version is up-to-date or not, see
|
||||
below for details.
|
||||
|
||||
@@ -241,8 +241,11 @@ Update methods
|
||||
``update_folder`` setting or if the ``git_commit`` check is used its
|
||||
``checkout_folder`` setting.
|
||||
* ``python_updater``: Can only be specified by plugins through the
|
||||
:ref:`hook <sec-bundledplugins-softwareupdate-hooks>`. A python callable
|
||||
:ref:`hook <sec-bundledplugins-softwareupdate-hooks>`. A Python callable
|
||||
which performs the update, see below for details.
|
||||
* ``sleep_a_bit``: Does nothing but block for a configurable ``duration`` and log
|
||||
a countdown in the meantime. Useful for debugging software update mechanisms
|
||||
during development.
|
||||
|
||||
.. note::
|
||||
|
||||
|
||||
@@ -1107,7 +1107,7 @@ OctoPrint is running is allowed to do this without password entry:
|
||||
command: sudo shutdown -h now
|
||||
confirm: You are about to shutdown the system.
|
||||
|
||||
You can also add an divider by setting action to divider like this:
|
||||
You can also add a divider by setting action to divider like this:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
|
||||
+12
-2
@@ -265,7 +265,7 @@ MetadataAnalysisFinished
|
||||
* ``name``: the file's name
|
||||
* ``path``: the file's path within its storage location
|
||||
* ``origin``: the file's origin storage location
|
||||
* ``result``: the analysis result -- this is a python object currently only available for internal use
|
||||
* ``result``: the analysis result -- this is a Python object currently only available for internal use
|
||||
|
||||
.. deprecated:: 1.3.0
|
||||
|
||||
@@ -363,8 +363,18 @@ PrintDone
|
||||
|
||||
Still available for reasons of backwards compatibility. Will be removed with 1.4.0.
|
||||
|
||||
PrintCancelling
|
||||
The print is about to be cancelled.
|
||||
|
||||
Payload:
|
||||
|
||||
* ``name``: the file's name
|
||||
* ``path``: the file's path within its storage location
|
||||
* ``origin``: the origin storage location of the file, either ``local`` or ``sdcard``
|
||||
* ``firmwareError``: the firmware error that caused cancelling the print job, if any
|
||||
|
||||
PrintCancelled
|
||||
The print has been cancelled via the cancel button.
|
||||
The print has been cancelled.
|
||||
|
||||
Payload:
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ Rerunning the wizard
|
||||
--------------------
|
||||
|
||||
In case Access Control was disabled in the configuration wizard, it is
|
||||
possibly to re-run it by editing ``config.yaml`` [#f1]_ and setting ``firstRun``
|
||||
possible to re-run it by editing ``config.yaml`` [#f1]_ and setting ``firstRun``
|
||||
in the ``server`` section and ``enabled`` in the ``accessControl`` section to
|
||||
``true``:
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
.. _sec-features-atcommands:
|
||||
|
||||
@ Commands
|
||||
==========
|
||||
|
||||
@ commands (also known as host commands elsewhere) are special commands you may include in GCODE files streamed
|
||||
through OctoPrint to your printer or send as part of GCODE scripts, through the Terminal Tab, the API or plugins.
|
||||
Contrary to other commands they will never be sent to the printer but instead trigger functions inside OctoPrint.
|
||||
|
||||
They are always of the form ``@<command>[ <parameters>]``, e.g. ``@pause`` or ``@custom_command with some parameters``.
|
||||
|
||||
Out of the box OctoPrint supports handling of these commands starting with version 1.3.7:
|
||||
|
||||
@cancel
|
||||
OctoPrint will cancel the current print job like if the "Cancel" button had been clicked. This command doesn't
|
||||
take any parameters.
|
||||
|
||||
@abort
|
||||
Same as ``cancel``.
|
||||
|
||||
@pause
|
||||
OctoPrint will pause the current print job just like if the "Pause" button had been clicked. This command doesn't
|
||||
take any parameters.
|
||||
|
||||
@resume
|
||||
OctoPrint will resume the current print job just like if the "Resume" button had been clicked. This command doesn't
|
||||
take any parameters.
|
||||
|
||||
Support for additional commands may be added by plugins by implementing a handler for one of the
|
||||
:ref:`octoprint.comm.protocol.atcommand <sec-plugins-hook-comm-protocol-atcommand-phase>` hooks.
|
||||
@@ -166,6 +166,10 @@ Controls
|
||||
clicked. This allows to override the direct sending of the command or commands to the printer with more
|
||||
sophisticated behaviour. The JavaScript snippet is ``eval``'d and processed in a context where the control
|
||||
it is part of is provided as local variable ``data`` and the ``ControlViewModel`` is available as ``self``.
|
||||
* - ``additionalClasses``
|
||||
- (Optional) Additional classes to apply to the button of a ``command``, ``commands``, ``script`` or ``javascript``
|
||||
control, other than the default ``btn``. Can be used to visually style the button, e.g. set to ``btn-danger`` to
|
||||
turn the button red.
|
||||
* - ``enabled``
|
||||
- (Optional) A JavaScript snippet returning either ``true`` or ``false`` determining whether the control
|
||||
should be enabled or not. This allow to override the default logic for this (disabled if printer is offline
|
||||
|
||||
@@ -66,7 +66,7 @@ Context
|
||||
|
||||
All GCODE scripts have access to the following template variables through the template context:
|
||||
|
||||
* ``printer_profile``: The currently selected Printer Profile, including
|
||||
* ``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.
|
||||
* ``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
|
||||
|
||||
@@ -15,5 +15,6 @@ Features
|
||||
custom_controls.rst
|
||||
gcode_scripts.rst
|
||||
action_commands.rst
|
||||
atcommands.rst
|
||||
plugins.rst
|
||||
safemode.rst
|
||||
@@ -46,7 +46,7 @@ Manual Installation
|
||||
|
||||
If you don't want or can't use the Plugin Manager, plugins may also be installed manually either by copying and
|
||||
unpacking them into one of the configured plugin folders (regularly those are ``<octoprint source root>/plugins`` and
|
||||
``<octoprint config folder>/plugins`` [#f1]_ or by installing them as regular python modules via ``pip`` [#f2]_.
|
||||
``<octoprint config folder>/plugins`` [#f1]_ or by installing them as regular Python modules via ``pip`` [#f2]_.
|
||||
|
||||
For a plugin available on the Python Package Index (PyPi), the process is as simple as issuing a
|
||||
|
||||
|
||||
+18
-3
@@ -6,9 +6,24 @@ Welcome to OctoPrint's documentation!
|
||||
:alt: The OctoPrint Logo
|
||||
:align: right
|
||||
|
||||
This documentation is still in the process of being migrated from
|
||||
`OctoPrint's wiki <https://github.com/foosel/OctoPrint/wiki>`_, so also take
|
||||
a look there!
|
||||
OctoPrint provides a snappy web interface for controlling consumer 3D printers. It is Free Software
|
||||
and released under the `GNU Affero General Public License V3 <http://www.gnu.org/licenses/agpl.html>`_.
|
||||
|
||||
Its website can be found at `octoprint.org <https://octoprint.org/>`_.
|
||||
|
||||
The community forum is available at `discourse.octoprint.org <https://discourse.octoprint.org/>`_.
|
||||
|
||||
The FAQ can be accessed by following `faq.octoprint.org <https://faq.octoprint.org/>`_.
|
||||
|
||||
The official plugin repository can be reached at `plugins.octoprint.org <https://plugins.octoprint.org/>`_.
|
||||
|
||||
OctoPrint's development wouldn't be possible without the `financial support by its community <https://octoprint.org/support-octoprint/>`_.
|
||||
If you enjoy OctoPrint, please consider becoming a regular supporter!
|
||||
|
||||
.. note::
|
||||
|
||||
This documentation currently focuses primarily on developers and less on end users. If you are interested in
|
||||
helping to change this, please get in touch `on the forum <https://discourse.octoprint.org/>`_!
|
||||
|
||||
Contents
|
||||
========
|
||||
|
||||
@@ -32,7 +32,7 @@ correct URL prefix:
|
||||
-->
|
||||
<script type="text/javascript" src="{{ url_for("static", filename="js/app/client/<component>.js") }}"></script>
|
||||
|
||||
Regardless of which way you use to include the library, you'll also need to make sure you included JQuery and lodash,
|
||||
Regardless of which way you use to include the library, you'll also need to make sure you included jQuery and lodash,
|
||||
because the library depends on those to be available (as ``$`` and ``_``). You can embed those like this:
|
||||
|
||||
.. code-block:: html+jinja
|
||||
@@ -45,7 +45,7 @@ number of components, make sure to at the very least include that one to be able
|
||||
|
||||
When you import the client library as described above, a global variable ``OctoPrint`` will become available, which is
|
||||
a prepared instance of the ``OctoPrintClient`` class the library assembles from registered components. You can directly
|
||||
used that singular ``OctoPrint`` instance if you only need to talk to one OctoPrint server:
|
||||
use that singular ``OctoPrint`` instance if you only need to talk to one OctoPrint server:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
|
||||
.. js:function:: OctoPrintClient.job.resume(opts)
|
||||
|
||||
Resumes the current job if it's currently pause, does nothing if it's running.
|
||||
Resumes the current job if it's currently paused, does nothing if it's running.
|
||||
|
||||
See :ref:`Issue a job command <sec-api-jobs-command>` for details.
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
.. note::
|
||||
|
||||
All methods here require that the used API token or a the existing browser session
|
||||
All methods here require that the used API token or the existing browser session
|
||||
has admin rights.
|
||||
|
||||
.. js:function:: OctoPrintClient.languages.list(opts)
|
||||
|
||||
@@ -174,7 +174,7 @@
|
||||
|
||||
Sets the given temperature on the printer's heated bed (if available).
|
||||
|
||||
``target`` is expected to be a the target temperature as a float value.
|
||||
``target`` is expected to be the target temperature as a float value.
|
||||
|
||||
**Example:**
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
.. note::
|
||||
|
||||
All methods here require that the used API token or a the existing browser session
|
||||
All methods here require that the used API token or the existing browser session
|
||||
has admin rights.
|
||||
|
||||
.. js:function:: OctoPrintClient.system.getCommands(opts)
|
||||
@@ -35,4 +35,4 @@
|
||||
.. seealso::
|
||||
|
||||
:ref:`System API <sec-api-system>`
|
||||
Documentation of the underlying system API
|
||||
Documentation of the underlying system API.
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
.. js:function:: OctoPrintClient.timelapse.list(opts)
|
||||
|
||||
Get the lists of rendered and unrendered timelapses. The returned promis
|
||||
Get the lists of rendered and unrendered timelapses. The returned promise
|
||||
will be resolved with an object containing the properties ``rendered``
|
||||
which will have the list of rendered timelapses, and ``unrendered`` which
|
||||
will have the list of unrendered timelapses.
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
.. note::
|
||||
|
||||
Most methods here require that the used API token or a the existing browser session
|
||||
Most methods here require that the used API token or the existing browser session
|
||||
has admin rights *or* corresponds to the user to be modified. Some methods
|
||||
definitely require admin rights.
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
.. note::
|
||||
|
||||
All methods here require that the used API token or a the existing browser session
|
||||
All methods here require that the used API token or the existing browser session
|
||||
has admin rights.
|
||||
|
||||
.. js:function:: OctoPrintClient.util.test(command, parameters, opts)
|
||||
@@ -206,4 +206,4 @@
|
||||
.. seealso::
|
||||
|
||||
:ref:`Util API <sec-api-util>`
|
||||
Documentation of the underlying util API
|
||||
Documentation of the underlying util API.
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
.. note::
|
||||
|
||||
All methods here require that the used API token or a the existing browser session
|
||||
All methods here require that the used API token or the existing browser session
|
||||
has admin rights.
|
||||
|
||||
.. js:function:: OctoPrintClient.wizard.get(opts)
|
||||
|
||||
@@ -4,3 +4,10 @@ octoprint.printer
|
||||
-----------------
|
||||
|
||||
.. automodule:: octoprint.printer
|
||||
|
||||
.. _sec-modules-printer-profile:
|
||||
|
||||
octoprint.printer.profile
|
||||
-------------------------
|
||||
|
||||
.. automodule:: octoprint.printer.profile
|
||||
@@ -23,9 +23,9 @@ Lifecycle
|
||||
|
||||
There are three sources of installed plugins that OctoPrint will check during start up:
|
||||
|
||||
* it's own ``octoprint/plugins`` folder (this is where the bundled plugins reside),
|
||||
* its own ``octoprint/plugins`` folder (this is where the bundled plugins reside),
|
||||
* the ``plugins`` folder in its configuration directory (e.g. ``~/.octoprint/plugins`` on Linux),
|
||||
* any python packages registered for the entry point ``octoprint.plugin``.
|
||||
* any Python packages registered for the entry point ``octoprint.plugin``.
|
||||
|
||||
Each plugin that OctoPrint finds it will first load, then enable. On enabling a plugin, OctoPrint will
|
||||
register its declared :ref:`hook handlers <sec-plugins-hooks>` and :ref:`helpers <sec-plugins-helpers>`, apply
|
||||
@@ -36,7 +36,7 @@ any :ref:`settings overlays <sec-plugins-controlproperties-plugin_settings_overl
|
||||
On disabling a plugin, its hook handlers, helpers, mixin implementations and settings overlays will be de-registered again.
|
||||
|
||||
Some plugin types require a reload of the frontend or a restart of OctoPrint for enabling/disabling them. You
|
||||
can recognized such plugins by their implementations implementing :class:`~octoprint.plugin.ReloadNeedingPlugin` or
|
||||
can recognize such plugins by their implementations implementing :class:`~octoprint.plugin.ReloadNeedingPlugin` or
|
||||
:class:`~octoprint.plugin.RestartNeedingPlugin` or providing handlers for one of the hooks marked correspondingly.
|
||||
|
||||
.. image:: ../images/plugins_lifecycle.png
|
||||
|
||||
@@ -134,7 +134,7 @@ as a simple python file following the naming convention ``<plugin identifier>.py
|
||||
``~/.octoprint/plugins`` folder. You already know how that works. But let's say you have more than just a simple plugin
|
||||
that can be done in one file. Distributing multiple files and getting your users to install them in the right way
|
||||
so that OctoPrint will be able to actually find and load them is certainly not impossible, but we want to do it in the
|
||||
best way possible, meaning we want to make our plugin a fully installable python module that your users will be able to
|
||||
best way possible, meaning we want to make our plugin a fully installable Python module that your users will be able to
|
||||
install directly via `OctoPrint's built-in Plugin Manager <https://github.com/foosel/OctoPrint/wiki/Plugin:-Plugin-Manager>`_
|
||||
or alternatively manually utilizing Python's standard package manager ``pip`` directly.
|
||||
|
||||
@@ -282,7 +282,7 @@ of information now defined twice:
|
||||
plugin_version = "1.0.0"
|
||||
plugin_description = "A quick \"Hello World\" example plugin for OctoPrint"
|
||||
|
||||
The nice thing about our plugin now being a proper python package is that OctoPrint can and will access the metadata defined
|
||||
The nice thing about our plugin now being a proper Python package is that OctoPrint can and will access the metadata defined
|
||||
within ``setup.py``! So, we don't really need to define all this data twice. Remove ``__plugin_name__``, ``__plugin_version__``
|
||||
and ``__plugin_description__`` from ``__init__.py``:
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ system. They are registered with the OctoPrint plugin system through the use of
|
||||
|
||||
An example for providing some helper functions to the system can be found in the
|
||||
`Discovery Plugin <https://github.com/foosel/OctoPrint/wiki/Plugin:-Discovery>`_,
|
||||
which provides it's SSDP browsing and Zeroconf browsing and publishing functions as helper methods.
|
||||
which provides its SSDP browsing and Zeroconf browsing and publishing functions as helper methods.
|
||||
|
||||
.. code-block:: python
|
||||
:linenos:
|
||||
|
||||
+75
-6
@@ -408,6 +408,45 @@ octoprint.comm.protocol.action
|
||||
:param str action: The parsed out action command, so for a ``line`` like ``// action:some_command`` this will be
|
||||
``some_command``
|
||||
|
||||
.. _sec-plugins-hook-comm-protocol-atcommand-phase:
|
||||
|
||||
octoprint.comm.protocol.atcommand.<phase>
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
This describes actually two hooks:
|
||||
|
||||
* ``octoprint.comm.protocol.atcommand.queuing``
|
||||
* ``octoprint.comm.protocol.atcommand.sending``
|
||||
|
||||
.. py:function:: protocol_atcommandphase_hook(comm_instance, phase, command, parameters, tags=None, *args, **kwargs)
|
||||
|
||||
Trigger on :ref:`@ commands <sec-features-atcommands>` as they progress through the ``queuing`` and ``sending``
|
||||
phases of the comm layer. See :ref:`the gcode phase hook <sec-plugins-hook-comm-protocol-gcode-phase>` for a
|
||||
detailed description of each of these phases.
|
||||
|
||||
Hook handlers may use this to react to arbitrary :ref:`@ commands <sec-features-atcommands>` included in GCODE files
|
||||
streamed to the printer or sent as part of GCODE scripts, through the API or plugins.
|
||||
|
||||
Please note that these hooks do not allow to rewrite, suppress or expand @ commands, they are merely callbacks to
|
||||
trigger the *actual execution* of whatever functionality lies behind a given @ command, similar to
|
||||
:ref:`the action command hook <sec-plugins-hook-comm-protocol-action>`.
|
||||
|
||||
**Example**
|
||||
|
||||
Pause the print on ``@wait`` (this mirrors the implementation of the built-in ``@pause`` command, just with a
|
||||
different name).
|
||||
|
||||
.. onlineinclude:: https://raw.githubusercontent.com/OctoPrint/Plugin-Examples/master/custom_atcommand.py
|
||||
:linenos:
|
||||
:tab-width: 4
|
||||
:caption: `custom_action_command.py <https://github.com/OctoPrint/Plugin-Examples/blob/master/custom_atcommand.py>`__
|
||||
|
||||
:param object comm_instance: The :class:`~octoprint.util.comm.MachineCom` instance which triggered the hook.
|
||||
:param str phase: The current phase in the command progression, either ``queuing`` or ``sending``. Will always
|
||||
match the ``<phase>`` of the hook.
|
||||
:param str cmd: The @ command without the leading @
|
||||
:param str parameters: Any parameters provided to the @ command. If none were provided this will be an empty string.
|
||||
|
||||
.. _sec-plugins-hook-comm-protocol-gcode-phase:
|
||||
|
||||
octoprint.comm.protocol.gcode.<phase>
|
||||
@@ -558,7 +597,7 @@ This describes actually four hooks:
|
||||
:param str gcode: Parsed GCODE command, e.g. ``G0`` or ``M110``, may also be None if no known command could be parsed
|
||||
:param str subcode: Parsed subcode of the GCODE command, e.g. ``1`` for ``M80.1``. Will be None if no subcode was provided
|
||||
or no command could be parsed.
|
||||
:param set tags: Tags attached to the command
|
||||
:param tags: Tags attached to the command
|
||||
:return: None, 1-tuple, 2-tuple or string, see the description above for details.
|
||||
|
||||
.. _sec-plugins-hook-comm-protocol-gcode-received:
|
||||
@@ -569,7 +608,7 @@ octoprint.comm.protocol.gcode.received
|
||||
.. py:function:: gcode_received_hook(comm_instance, line, *args, **kwargs)
|
||||
|
||||
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
|
||||
version of it. If 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 explicitly from the handler.
|
||||
|
||||
@@ -587,6 +626,36 @@ octoprint.comm.protocol.gcode.received
|
||||
:return: The received line or in any case, a modified version of it.
|
||||
:rtype: str
|
||||
|
||||
.. _sec-plugins-hook-comm-protocol-gcode-error:
|
||||
|
||||
octoprint.comm.protocol.gcode.error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. py:function:: gcode_error_hook(comm_instance, error_message, *args, **kwargs)
|
||||
|
||||
Get the messages of any errors messages sent by the printer, with the leading ``Error:`` or ``!!`` already
|
||||
stripped. Handlers should return True if they handled that error internally and it should not be processed by
|
||||
the system further. Normal processing of these kinds of errors - depending on the configuration of error
|
||||
handling - involves canceling the ongoing print and possibly also disconnecting.
|
||||
|
||||
Plugins might utilize this hook to handle errors generated by the printer that are recoverable in one way or
|
||||
the other and should not trigger the normal handling that assumes the worst.
|
||||
|
||||
**Example:**
|
||||
|
||||
Looks for error messages containing "fan error" or "bed missing" (ignoring case) and marks them as handled by the
|
||||
plugin.
|
||||
|
||||
.. onlineinclude:: https://raw.githubusercontent.com/OctoPrint/Plugin-Examples/master/comm_error_handler_test.py
|
||||
:linenos:
|
||||
:tab-width: 4
|
||||
:caption: `comm_error_handler_test.py <https://github.com/OctoPrint/Plugin-Examples/blob/master/comm_error_handler_test.py>`_
|
||||
|
||||
:param MachineCom comm_instance: The :class:`~octoprint.util.comm.MachineCom` instance which triggered the hook.
|
||||
:param str error_message: The error message received from the printer.
|
||||
:return: True if the error was handled in the plugin and should not be processed further, False (or None) otherwise.
|
||||
:rtype: bool
|
||||
|
||||
.. _sec-plugins-hook-comm-protocol-scripts:
|
||||
|
||||
octoprint.comm.protocol.scripts
|
||||
@@ -782,7 +851,7 @@ octoprint.filemanager.preprocessor
|
||||
|
||||
``file_object`` will be a subclass of :class:`~octoprint.filemanager.util.AbstractFileWrapper`. Handlers may
|
||||
access the raw data of the file via :func:`~octoprint.filemanager.util.AbstractFileWrapper.stream`, e.g.
|
||||
to wrap it further. Handlers which do not wish to handle the `file_object`
|
||||
to wrap it further. Handlers which do not wish to handle the `file_object` should just return it untouched.
|
||||
|
||||
**Example**
|
||||
|
||||
@@ -827,7 +896,7 @@ octoprint.printer.factory
|
||||
|
||||
If the factory returns anything but ``None``, it will be assigned to the global ``printer`` instance.
|
||||
|
||||
If no of the registered factories return a printer instance, the default :class:`~octoprint.printer.standard.Printer`
|
||||
If none of the registered factories return a printer instance, the default :class:`~octoprint.printer.standard.Printer`
|
||||
class will be instantiated.
|
||||
|
||||
:param dict components: System components to use for printer instance initialization
|
||||
@@ -929,7 +998,7 @@ octoprint.server.http.routes
|
||||
that allows delivery of the requested resource as attachment and access validation through an optional callback.
|
||||
:class:`~octoprint.server.util.tornado.UrlForwardHandler`
|
||||
`tornado.web.RequestHandler <http://tornado.readthedocs.org/en/branch4.0/web.html#request-handlers>`_ that proxies
|
||||
requests to a preconfigured url and returns the response.
|
||||
requests to a preconfigured URL and returns the response.
|
||||
|
||||
:param list server_routes: read-only list of the currently configured server routes
|
||||
:return: a list of 3-tuples with additional routes as defined above
|
||||
@@ -1072,7 +1141,7 @@ octoprint.users.factory
|
||||
|
||||
If the factory returns anything but ``None``, it will be assigned to the global ``userManager`` instance.
|
||||
|
||||
If no of the registered factories return a user manager instance, the class referenced by the ``config.yaml``
|
||||
If none of the registered factories return a user manager instance, the class referenced by the ``config.yaml``
|
||||
entry ``accessControl.userManager`` will be initialized if possible, otherwise a stock
|
||||
:class:`~octoprint.users.FilebasedUserManager` will be instantiated, linked to the default user storage
|
||||
file ``~/.octoprint/users.yaml``.
|
||||
|
||||
@@ -51,7 +51,7 @@ An overview of these properties follows.
|
||||
.. seealso::
|
||||
|
||||
:class:`~octoprint.plugin.core.Plugin` and :class:`~octoprint.plugin.types.OctoPrintPlugin`
|
||||
Class documentation also containing the properties shared among all mixing implementations.
|
||||
Class documentation also containing the properties shared among all mixin implementations.
|
||||
|
||||
:ref:`Available Mixins <sec-plugins-mixins-available>`
|
||||
Some mixin types trigger the injection of additional properties.
|
||||
|
||||
@@ -153,7 +153,7 @@ An overview of these properties can be found in the section :ref:`Injected Prope
|
||||
.. seealso::
|
||||
|
||||
:class:`~octoprint.plugin.core.Plugin` and :class:`~octoprint.plugin.types.OctoPrintPlugin`
|
||||
Class documentation also containing the properties shared among all mixing implementations.
|
||||
Class documentation also containing the properties shared among all mixin implementations.
|
||||
|
||||
.. _sec-plugins-mixins-available:
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ gcodeFilesViewModel
|
||||
logViewModel
|
||||
View model for the logfile settings dialog.
|
||||
loginStateViewModel
|
||||
View model for the current loginstate of the user, very interesting for plugins that need to
|
||||
View model for the current login state of the user, very interesting for plugins that need to
|
||||
evaluate the current login state or information about the current user, e.g. associated roles.
|
||||
navigationViewModel
|
||||
View model for the navigation bar.
|
||||
@@ -168,7 +168,7 @@ OctoPrint's web application will call several callbacks on all registered view m
|
||||
Those are listed below:
|
||||
|
||||
onStartup()
|
||||
Called when the first initialization has been done: All view models are constructed and hence their dependencies
|
||||
Called when the first initialization has been done. All view models are constructed and hence their dependencies
|
||||
resolved, no bindings have been done yet.
|
||||
|
||||
onBeforeBinding()
|
||||
@@ -210,7 +210,7 @@ onDataUpdaterPluginMessage(plugin, message)
|
||||
Called when a plugin message is pushed from the server with the identifier of the calling plugin as first
|
||||
and the actual message as the second parameter. Note that the latter might be a full fledged object, depending
|
||||
on the plugin sending the message. You can use this method to asynchronously push data from your plugin's server
|
||||
component to it's frontend component.
|
||||
component to its frontend component.
|
||||
|
||||
onUserLoggedIn(user)
|
||||
Called when a user gets logged into the web app, either passively (upon initial load of the page due to a valid
|
||||
|
||||
@@ -49,7 +49,8 @@ INSTALL_REQUIRES = [
|
||||
"wrapt>=1.10.10,<1.11",
|
||||
"futures>=3.1.1,<3.2",
|
||||
"emoji>=0.4.5,<0.5",
|
||||
"monotonic>=1.3,<1.4"
|
||||
"monotonic>=1.3,<1.4",
|
||||
"frozendict>=1.2,<1.3"
|
||||
]
|
||||
|
||||
if sys.platform == "darwin":
|
||||
|
||||
@@ -322,12 +322,9 @@ def init_pluginsystem(settings, safe_mode=False, ignore_blacklist=True, connecti
|
||||
plugin_validators = []
|
||||
if safe_mode:
|
||||
def validator(phase, plugin_info):
|
||||
if phase == "after_load":
|
||||
if phase in ("before_import", "before_load", "before_enable"):
|
||||
setattr(plugin_info, "safe_mode_victim", not plugin_info.bundled)
|
||||
setattr(plugin_info, "safe_mode_enabled", False)
|
||||
elif phase == "before_enable":
|
||||
if not plugin_info.bundled:
|
||||
setattr(plugin_info, "safe_mode_enabled", True)
|
||||
return False
|
||||
return True
|
||||
plugin_validators.append(validator)
|
||||
@@ -440,7 +437,7 @@ def get_plugin_blacklist(settings, connectivity_checker=None):
|
||||
result.append((entry["plugin"], version))
|
||||
else:
|
||||
logger.debug("Blacklisted plugin: {}".format(entry["plugin"]))
|
||||
result.append(entry["key"])
|
||||
result.append(entry["plugin"])
|
||||
|
||||
return result
|
||||
|
||||
|
||||
@@ -305,7 +305,6 @@ def git_parse_lookup_file(path):
|
||||
if not os.path.exists(path):
|
||||
return []
|
||||
|
||||
import re
|
||||
lookup = []
|
||||
with open(path, "r") as f:
|
||||
for line in f:
|
||||
|
||||
@@ -6,7 +6,7 @@ Originally from http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
import sys, os, time, signal, io
|
||||
import sys, os, time, signal
|
||||
|
||||
class Daemon:
|
||||
"""
|
||||
|
||||
@@ -69,6 +69,7 @@ class Events(object):
|
||||
PRINT_STARTED = "PrintStarted"
|
||||
PRINT_DONE = "PrintDone"
|
||||
PRINT_FAILED = "PrintFailed"
|
||||
PRINT_CANCELLING = "PrintCancelling"
|
||||
PRINT_CANCELLED = "PrintCancelled"
|
||||
PRINT_PAUSED = "PrintPaused"
|
||||
PRINT_RESUMED = "PrintResumed"
|
||||
@@ -87,6 +88,7 @@ class Events(object):
|
||||
EJECT = "Eject"
|
||||
E_STOP = "EStop"
|
||||
POSITION_UPDATE = "PositionUpdate"
|
||||
FIRMWARE_DATA = "FirmwareData"
|
||||
TOOL_CHANGE = "ToolChange"
|
||||
REGISTERED_MESSAGE_RECEIVED = "RegisteredMessageReceived"
|
||||
|
||||
|
||||
+155
-50
@@ -137,13 +137,14 @@ class PluginInfo(object):
|
||||
attr_disable = '__plugin_disable__'
|
||||
""" Module attribute which to call when disabling the plugin. """
|
||||
|
||||
def __init__(self, key, location, instance, name=None, version=None, description=None, author=None, url=None, license=None):
|
||||
def __init__(self, key, location, instance, name=None, version=None, description=None, author=None, url=None, license=None, parsed_metadata=None):
|
||||
self.key = key
|
||||
self.location = location
|
||||
self.instance = instance
|
||||
self.origin = None
|
||||
self.enabled = True
|
||||
self.blacklisted = False
|
||||
self.forced_disabled = False
|
||||
self.bundled = False
|
||||
self.loaded = False
|
||||
self.managable = True
|
||||
@@ -156,10 +157,17 @@ class PluginInfo(object):
|
||||
self._url = url
|
||||
self._license = license
|
||||
|
||||
self._logger = logging.getLogger(__name__)
|
||||
|
||||
self._cached_parsed_metadata = parsed_metadata
|
||||
|
||||
def validate(self, phase, additional_validators=None):
|
||||
result = True
|
||||
|
||||
if phase == "before_load":
|
||||
if phase == "before_import":
|
||||
result = not self.forced_disabled and not self.blacklisted and result
|
||||
|
||||
elif phase == "before_load":
|
||||
# if the plugin still uses __plugin_init__, log a deprecation warning and move it to __plugin_load__
|
||||
if hasattr(self.instance, self.__class__.attr_init):
|
||||
if not hasattr(self.instance, self.__class__.attr_load):
|
||||
@@ -193,7 +201,7 @@ class PluginInfo(object):
|
||||
|
||||
if additional_validators is not None:
|
||||
for validator in additional_validators:
|
||||
result = result and validator(phase, self)
|
||||
result = validator(phase, self) and result
|
||||
|
||||
return result
|
||||
|
||||
@@ -288,7 +296,9 @@ class PluginInfo(object):
|
||||
Returns:
|
||||
str: Name of the plugin, fallback is the plugin's identifier.
|
||||
"""
|
||||
return self._get_instance_attribute(self.__class__.attr_name, defaults=(self._name, self.key))
|
||||
return self._get_instance_attribute(self.__class__.attr_name,
|
||||
defaults=(self._name, self.key),
|
||||
incl_metadata=True)
|
||||
|
||||
@property
|
||||
def description(self):
|
||||
@@ -300,7 +310,9 @@ class PluginInfo(object):
|
||||
Returns:
|
||||
str or None: Description of the plugin.
|
||||
"""
|
||||
return self._get_instance_attribute(self.__class__.attr_description, default=self._description)
|
||||
return self._get_instance_attribute(self.__class__.attr_description,
|
||||
default=self._description,
|
||||
incl_metadata=True)
|
||||
|
||||
@property
|
||||
def disabling_discouraged(self):
|
||||
@@ -324,7 +336,9 @@ class PluginInfo(object):
|
||||
Returns:
|
||||
str or None: Version of the plugin.
|
||||
"""
|
||||
return self._version if self._version is not None else self._get_instance_attribute(self.__class__.attr_version, default=self._version)
|
||||
return self._version if self._version is not None else self._get_instance_attribute(self.__class__.attr_version,
|
||||
default=self._version,
|
||||
incl_metadata=True)
|
||||
|
||||
@property
|
||||
def author(self):
|
||||
@@ -335,7 +349,9 @@ class PluginInfo(object):
|
||||
Returns:
|
||||
str or None: Author of the plugin.
|
||||
"""
|
||||
return self._get_instance_attribute(self.__class__.attr_author, default=self._author)
|
||||
return self._get_instance_attribute(self.__class__.attr_author,
|
||||
default=self._author,
|
||||
incl_metadata=True)
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
@@ -346,7 +362,9 @@ class PluginInfo(object):
|
||||
Returns:
|
||||
str or None: Website URL for the plugin.
|
||||
"""
|
||||
return self._get_instance_attribute(self.__class__.attr_url, default=self._url)
|
||||
return self._get_instance_attribute(self.__class__.attr_url,
|
||||
default=self._url,
|
||||
incl_metadata=True)
|
||||
|
||||
@property
|
||||
def license(self):
|
||||
@@ -357,7 +375,9 @@ class PluginInfo(object):
|
||||
Returns:
|
||||
str or None: License of the plugin.
|
||||
"""
|
||||
return self._get_instance_attribute(self.__class__.attr_license, default=self._license)
|
||||
return self._get_instance_attribute(self.__class__.attr_license,
|
||||
default=self._license,
|
||||
incl_metadata=True)
|
||||
|
||||
@property
|
||||
def hooks(self):
|
||||
@@ -448,15 +468,79 @@ class PluginInfo(object):
|
||||
"""
|
||||
return self._get_instance_attribute(self.__class__.attr_disable, default=lambda: True)
|
||||
|
||||
def _get_instance_attribute(self, attr, default=None, defaults=None):
|
||||
def _get_instance_attribute(self, attr, default=None, defaults=None, incl_metadata=False):
|
||||
if self.instance is None or not hasattr(self.instance, attr):
|
||||
if defaults is not None:
|
||||
if incl_metadata and attr in self.parsed_metadata:
|
||||
return self.parsed_metadata[attr]
|
||||
|
||||
elif defaults is not None:
|
||||
for value in defaults:
|
||||
if callable(value):
|
||||
value = value()
|
||||
if value is not None:
|
||||
return value
|
||||
|
||||
return default
|
||||
|
||||
return getattr(self.instance, attr)
|
||||
|
||||
@property
|
||||
def parsed_metadata(self):
|
||||
if self._cached_parsed_metadata is None:
|
||||
self._cached_parsed_metadata = self._parse_metadata()
|
||||
return self._cached_parsed_metadata
|
||||
|
||||
def _parse_metadata(self):
|
||||
result = dict()
|
||||
|
||||
path = self.location
|
||||
if not path:
|
||||
return result
|
||||
|
||||
if os.path.isdir(path):
|
||||
path = os.path.join(self.location, "__init__.py")
|
||||
|
||||
if not os.path.isfile(path):
|
||||
return result
|
||||
|
||||
if not path.endswith(".py"):
|
||||
# we only support parsing plain text source files
|
||||
return result
|
||||
|
||||
self._logger.debug("Parsing plugin metadata for {} from AST of {}".format(self.key, path))
|
||||
|
||||
try:
|
||||
import ast
|
||||
|
||||
with open(path, "rb") as f:
|
||||
root = ast.parse(f.read())
|
||||
|
||||
assignments = filter(lambda x: isinstance(x, ast.Assign) and x.targets,
|
||||
root.body)
|
||||
|
||||
def extract_target_ids(node):
|
||||
return map(lambda x: x.id,
|
||||
filter(lambda x: isinstance(x, ast.Name), node.targets))
|
||||
|
||||
for key in (self.__class__.attr_name, self.__class__.attr_version, self.__class__.attr_author,
|
||||
self.__class__.attr_description, self.__class__.attr_url, self.__class__.attr_license):
|
||||
for a in reversed(assignments):
|
||||
targets = extract_target_ids(a)
|
||||
if key in targets:
|
||||
if isinstance(a.value, ast.Str):
|
||||
result[key] = a.value.s
|
||||
|
||||
elif isinstance(a.value, ast.Call) and hasattr(a.value, "func") \
|
||||
and a.value.func.id == "gettext" and a.value.args \
|
||||
and isinstance(a.value.args[0], ast.Str):
|
||||
result[key] = a.value.args[0].s
|
||||
|
||||
break
|
||||
except:
|
||||
pass
|
||||
|
||||
return result
|
||||
|
||||
|
||||
class PluginManager(object):
|
||||
"""
|
||||
@@ -587,29 +671,37 @@ class PluginManager(object):
|
||||
|
||||
for entry in scandir(folder):
|
||||
try:
|
||||
if entry.is_dir() and os.path.isfile(os.path.join(entry.path, "__init__.py")):
|
||||
key = entry.name
|
||||
elif entry.is_file() and entry.name.endswith(".py"):
|
||||
key = entry.name[:-3] # strip off the .py extension
|
||||
if key.startswith("__"):
|
||||
# might be an __init__.py in our plugins folder, or something else we don't want
|
||||
# to handle
|
||||
if entry.is_dir():
|
||||
init_py = os.path.join(entry.path, "__init__.py")
|
||||
init_pyc = os.path.join(entry.path, "__init__.pyc")
|
||||
|
||||
if not os.path.isfile(init_py) and not os.path.isfile(init_pyc):
|
||||
# neither does exist, we ignore this
|
||||
continue
|
||||
|
||||
key = entry.name
|
||||
|
||||
elif entry.is_file():
|
||||
key, ext = os.path.splitext(entry.name)
|
||||
if ext not in (".py", ".pyc") or key.startswith("__"):
|
||||
# neither py nor pyc, or starts with __ (like __init__), we ignore this
|
||||
continue
|
||||
|
||||
else:
|
||||
# whatever this is, we ignore it
|
||||
continue
|
||||
|
||||
if key in existing or key in result or (ignored_uninstalled and key in self.marked_plugins["uninstalled"]):
|
||||
# plugin is already defined, ignore it
|
||||
continue
|
||||
|
||||
plugin = self._import_plugin_from_module(key, folder=folder)
|
||||
bundled = flagged_readonly
|
||||
|
||||
plugin = self._import_plugin_from_module(key, folder=folder, bundled=bundled)
|
||||
if plugin:
|
||||
plugin.origin = FolderOrigin("folder", folder)
|
||||
plugin.managable = not flagged_readonly and not actual_readonly
|
||||
plugin.bundled = flagged_readonly
|
||||
|
||||
plugin.enabled = False
|
||||
|
||||
result[key] = plugin
|
||||
except:
|
||||
self.logger.exception("Error processing folder entry {!r} from folder {}".format(entry, folder))
|
||||
@@ -676,6 +768,7 @@ class PluginManager(object):
|
||||
plugin = self._import_plugin_from_module(key, **kwargs)
|
||||
if plugin:
|
||||
plugin.origin = EntryPointOrigin("entry_point", group, module_name, package_name, version)
|
||||
plugin.enabled = False
|
||||
|
||||
# plugin is manageable if its location is writable and OctoPrint
|
||||
# is either not running from a virtual env or the plugin is
|
||||
@@ -685,19 +778,19 @@ class PluginManager(object):
|
||||
plugin.managable = os.access(plugin.location, os.W_OK) \
|
||||
and (not self._python_virtual_env
|
||||
or is_sub_path_of(plugin.location, self._python_prefix)
|
||||
or is_editable_install(self._python_install_dir,
|
||||
package_name,
|
||||
module_name,
|
||||
plugin.location))
|
||||
or is_editable_install(self._python_install_dir,
|
||||
package_name,
|
||||
module_name,
|
||||
plugin.location))
|
||||
|
||||
plugin.enabled = False
|
||||
result[key] = plugin
|
||||
except:
|
||||
self.logger.exception("Error processing entry point {!r} for group {}".format(entry_point, group))
|
||||
|
||||
return result
|
||||
|
||||
def _import_plugin_from_module(self, key, folder=None, module_name=None, name=None, version=None, summary=None, author=None, url=None, license=None):
|
||||
def _import_plugin_from_module(self, key, folder=None, module_name=None, name=None, version=None, summary=None,
|
||||
author=None, url=None, license=None, bundled=False):
|
||||
# TODO error handling
|
||||
try:
|
||||
if folder:
|
||||
@@ -710,14 +803,41 @@ class PluginManager(object):
|
||||
self.logger.warn("Could not locate plugin {key}".format(key=key))
|
||||
return None
|
||||
|
||||
if self._is_plugin_blacklisted(key) or (version is not None and self._is_plugin_version_blacklisted(key, version)):
|
||||
plugin = PluginInfo(key, module[1], None, name=name, version=version, description=summary, author=author, url=url, license=license)
|
||||
# Create a simple dummy entry first ...
|
||||
plugin = PluginInfo(key, module[1], None, name=name, version=version, description=summary, author=author,
|
||||
url=url, license=license)
|
||||
plugin.bundled = bundled
|
||||
|
||||
if self._is_plugin_disabled(key):
|
||||
self.logger.info("Plugin {} is disabled.".format(plugin))
|
||||
plugin.forced_disabled = True
|
||||
|
||||
if self._is_plugin_blacklisted(key) or (plugin.version is not None and self._is_plugin_version_blacklisted(key, plugin.version)):
|
||||
self.logger.warn("Plugin {} is blacklisted.".format(plugin))
|
||||
plugin.blacklisted = True
|
||||
self.logger.warn("Plugin {} is blacklisted. Not importing it, only registering a dummy entry.".format(plugin))
|
||||
|
||||
if not plugin.validate("before_import", additional_validators=self.plugin_validators):
|
||||
return plugin
|
||||
|
||||
plugin = self._import_plugin(key, *module, name=name, version=version, summary=summary, author=author, url=url, license=license)
|
||||
if plugin is None:
|
||||
# ... then create and return the real one
|
||||
return self._import_plugin(key, *module,
|
||||
name=name, version=version, summary=summary, author=author, url=url,
|
||||
license=license, bundled=bundled, parsed_metadata=plugin.parsed_metadata)
|
||||
|
||||
def _import_plugin(self, key, f, filename, description, name=None, version=None, summary=None, author=None, url=None, license=None, bundled=False, parsed_metadata=None):
|
||||
try:
|
||||
instance = imp.load_module(key, f, filename, description)
|
||||
plugin = PluginInfo(key, filename, instance,
|
||||
name=name,
|
||||
version=version,
|
||||
description=summary,
|
||||
author=author,
|
||||
url=url,
|
||||
license=license,
|
||||
parsed_metadata=parsed_metadata)
|
||||
plugin.bundled = bundled
|
||||
except:
|
||||
self.logger.exception("Error loading plugin {key}".format(key=key))
|
||||
return None
|
||||
|
||||
if plugin.check():
|
||||
@@ -726,15 +846,6 @@ class PluginManager(object):
|
||||
self.logger.warn("Plugin \"{plugin}\" did not pass check".format(plugin=str(plugin)))
|
||||
return None
|
||||
|
||||
|
||||
def _import_plugin(self, key, f, filename, description, name=None, version=None, summary=None, author=None, url=None, license=None):
|
||||
try:
|
||||
instance = imp.load_module(key, f, filename, description)
|
||||
return PluginInfo(key, filename, instance, name=name, version=version, description=summary, author=author, url=url, license=license)
|
||||
except:
|
||||
self.logger.exception("Error loading plugin {key}".format(key=key))
|
||||
return None
|
||||
|
||||
def _is_plugin_disabled(self, key):
|
||||
return key in self.plugin_disabled_list or key.endswith('disabled')
|
||||
|
||||
@@ -765,7 +876,7 @@ class PluginManager(object):
|
||||
# 1st pass: loading the plugins
|
||||
for name, plugin in plugins.items():
|
||||
try:
|
||||
if not plugin.blacklisted:
|
||||
if not plugin.blacklisted and not plugin.forced_disabled:
|
||||
self.load_plugin(name, plugin, startup=startup, initialize_implementation=initialize_implementations)
|
||||
except PluginNeedsRestart:
|
||||
pass
|
||||
@@ -779,7 +890,7 @@ class PluginManager(object):
|
||||
# 2nd pass: enabling those plugins that need enabling
|
||||
for name, plugin in plugins.items():
|
||||
try:
|
||||
if plugin.loaded and not self._is_plugin_disabled(name):
|
||||
if plugin.loaded and not plugin.forced_disabled:
|
||||
if plugin.blacklisted:
|
||||
self.logger.warn("Plugin {} is blacklisted. Not enabling it.".format(plugin))
|
||||
continue
|
||||
@@ -836,14 +947,8 @@ class PluginManager(object):
|
||||
plugin.load()
|
||||
plugin.validate("after_load", additional_validators=self.plugin_validators)
|
||||
self.on_plugin_loaded(name, plugin)
|
||||
|
||||
plugin.loaded = True
|
||||
|
||||
# we might only now have a version, so check again if we are blacklisted
|
||||
if not plugin.blacklisted and plugin.version and self._is_plugin_version_blacklisted(plugin.key,
|
||||
plugin.version):
|
||||
plugin.blacklisted = True
|
||||
|
||||
self.logger.debug("Loaded plugin {name}: {plugin}".format(**locals()))
|
||||
except PluginLifecycleException as e:
|
||||
raise e
|
||||
|
||||
@@ -1861,6 +1861,47 @@ class SlicerPlugin(OctoPrintPlugin):
|
||||
destination_extensions=["gco", "gcode", "g"]
|
||||
)
|
||||
|
||||
def get_slicer_profiles(self, profile_path):
|
||||
"""
|
||||
Fetch all :class:`~octoprint.slicing.SlicingProfile` stored for this slicer.
|
||||
|
||||
For compatibility reasons with existing slicing plugins this method defaults to returning profiles parsed from
|
||||
.profile files in the plugin's ``profile_path``, utilizing the :func:`SlicingPlugin.get_slicer_profile` method
|
||||
of the plugin implementation.
|
||||
|
||||
Arguments:
|
||||
profile_path (str): The base folder where OctoPrint stores this slicer plugin's profiles
|
||||
"""
|
||||
|
||||
try:
|
||||
from os import scandir
|
||||
except ImportError:
|
||||
from scandir import scandir
|
||||
|
||||
import octoprint.util
|
||||
|
||||
profiles = dict()
|
||||
for entry in scandir(profile_path):
|
||||
if not entry.name.endswith(".profile") or octoprint.util.is_hidden_path(entry.name):
|
||||
# we are only interested in profiles and no hidden files
|
||||
continue
|
||||
|
||||
profile_name = entry.name[:-len(".profile")]
|
||||
profiles[profile_name] = self.get_slicer_profile(entry.path)
|
||||
return profiles
|
||||
|
||||
# noinspection PyMethodMayBeStatic
|
||||
def get_slicer_profiles_lastmodified(self, profile_path):
|
||||
import os
|
||||
try:
|
||||
from os import scandir
|
||||
except ImportError:
|
||||
from scandir import scandir
|
||||
|
||||
lms = [os.stat(profile_path).st_mtime]
|
||||
lms += [os.stat(entry.path).st_mtime for entry in scandir(profile_path) if entry.name.endswith(".profile")]
|
||||
return max(lms)
|
||||
|
||||
# noinspection PyMethodMayBeStatic
|
||||
def get_slicer_default_profile(self):
|
||||
"""
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
table td.settings_logs_name,table th.settings_logs_name{text-overflow:ellipsis;text-align:left}table td.settings_logs_size,table th.settings_logs_size{text-align:right;width:70px}table td.settings_logs_date,table th.settings_logs_date{text-align:left;width:130px}table td.settings_logs_action,table th.settings_logs_action{width:70px;text-align:center;white-space:nowrap}table td.settings_logs_action a,table th.settings_logs_action a{text-decoration:none;color:#000}table td.settings_logs_action a.disabled,table th.settings_logs_action a.disabled{color:#ccc;cursor:default}
|
||||
@@ -561,13 +561,14 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
|
||||
if plugin.key == "pluginmanager":
|
||||
return make_response("Can't enable/disable Plugin Manager", 400)
|
||||
|
||||
pending = ((command == "disable" and plugin.key in self._pending_enable) or (command == "enable" and plugin.key in self._pending_disable))
|
||||
safe_mode_victim = getattr(plugin, "safe_mode_victim", False)
|
||||
|
||||
needs_restart = self._plugin_manager.is_restart_needing_plugin(plugin)
|
||||
needs_refresh = plugin.implementation and isinstance(plugin.implementation, octoprint.plugin.ReloadNeedingPlugin)
|
||||
needs_reconnect = self._plugin_manager.has_any_of_hooks(plugin, self._reconnect_hooks) and self._printer.is_operational()
|
||||
|
||||
pending = ((command == "disable" and plugin.key in self._pending_enable) or (command == "enable" and plugin.key in self._pending_disable))
|
||||
safe_mode_victim = getattr(plugin, "safe_mode_victim", False)
|
||||
needs_restart_api = (needs_restart or safe_mode_victim) and not pending
|
||||
needs_restart_api = (needs_restart or safe_mode_victim or plugin.forced_disabled) and not pending
|
||||
needs_refresh_api = needs_refresh and not pending
|
||||
needs_reconnect_api = needs_reconnect and not pending
|
||||
|
||||
@@ -677,12 +678,12 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
|
||||
self._settings.global_set(["plugins", "_disabled"], disabled_list)
|
||||
self._settings.save(force=True)
|
||||
|
||||
if not needs_restart and not getattr(plugin, "safe_mode_victim", False):
|
||||
if not needs_restart and not plugin.forced_disabled and not getattr(plugin, "safe_mode_victim", False):
|
||||
self._plugin_manager.enable_plugin(plugin.key)
|
||||
else:
|
||||
if plugin.key in self._pending_disable:
|
||||
self._pending_disable.remove(plugin.key)
|
||||
elif (not plugin.enabled and not getattr(plugin, "safe_mode_enabled", False)) and plugin.key not in self._pending_enable:
|
||||
elif not plugin.enabled and plugin.key not in self._pending_enable:
|
||||
self._pending_enable.add(plugin.key)
|
||||
|
||||
def _mark_plugin_disabled(self, plugin, needs_restart=False):
|
||||
@@ -692,12 +693,12 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
|
||||
self._settings.global_set(["plugins", "_disabled"], disabled_list)
|
||||
self._settings.save(force=True)
|
||||
|
||||
if not needs_restart and not getattr(plugin, "safe_mode_victim", False):
|
||||
if not needs_restart and not plugin.forced_disabled and not getattr(plugin, "safe_mode_victim", False):
|
||||
self._plugin_manager.disable_plugin(plugin.key)
|
||||
else:
|
||||
if plugin.key in self._pending_enable:
|
||||
self._pending_enable.remove(plugin.key)
|
||||
elif (plugin.enabled or getattr(plugin, "safe_mode_enabled", False)) and plugin.key not in self._pending_disable:
|
||||
elif (plugin.enabled or plugin.forced_disabled or getattr(plugin, "safe_mode_victim", False)) and plugin.key not in self._pending_disable:
|
||||
self._pending_disable.add(plugin.key)
|
||||
|
||||
def _fetch_all_data(self, async=False):
|
||||
@@ -920,10 +921,10 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
|
||||
managable=plugin.managable,
|
||||
enabled=plugin.enabled,
|
||||
blacklisted=plugin.blacklisted,
|
||||
forced_disabled=plugin.forced_disabled,
|
||||
safe_mode_victim=getattr(plugin, "safe_mode_victim", False),
|
||||
safe_mode_enabled=getattr(plugin, "safe_mode_enabled", False),
|
||||
pending_enable=(not plugin.enabled and not getattr(plugin, "safe_mode_enabled", False) and plugin.key in self._pending_enable),
|
||||
pending_disable=((plugin.enabled or getattr(plugin, "safe_mode_enabled", False)) and plugin.key in self._pending_disable),
|
||||
pending_enable=(not plugin.enabled and not getattr(plugin, "safe_mode_victim", False) and plugin.key in self._pending_enable),
|
||||
pending_disable=((plugin.enabled or getattr(plugin, "safe_mode_victim", False)) and plugin.key in self._pending_disable),
|
||||
pending_install=(self._plugin_manager.is_plugin_marked(plugin.key, "installed")),
|
||||
pending_uninstall=(self._plugin_manager.is_plugin_marked(plugin.key, "uninstalled")),
|
||||
origin=plugin.origin.type,
|
||||
|
||||
@@ -205,6 +205,16 @@ $(function() {
|
||||
self.hiddenNoticeNotifications = {};
|
||||
self.noticeCount = ko.observable(0);
|
||||
|
||||
self.notification = undefined;
|
||||
self.logContents = {
|
||||
steps: [],
|
||||
action: {
|
||||
reload: false,
|
||||
refresh: false,
|
||||
reconnect: false
|
||||
}
|
||||
};
|
||||
|
||||
self.noticeCountText = ko.pureComputed(function() {
|
||||
var count = self.noticeCount();
|
||||
if (count == 0) {
|
||||
@@ -222,7 +232,7 @@ $(function() {
|
||||
|
||||
self.enableToggle = function(data) {
|
||||
var command = self._getToggleCommand(data);
|
||||
var not_safemode_victim = !data.safe_mode_victim || data.safe_mode_enabled;
|
||||
var not_safemode_victim = !data.safe_mode_victim;
|
||||
var not_blacklisted = !data.blacklisted;
|
||||
return self.enableManagement() && (command == "disable" || (not_safemode_victim && not_blacklisted)) && data.key != 'pluginmanager';
|
||||
};
|
||||
@@ -462,7 +472,7 @@ $(function() {
|
||||
};
|
||||
|
||||
if (self._getToggleCommand(data) == "enable") {
|
||||
if (data.safe_mode_victim && !data.safe_mode_enabled) return;
|
||||
if (data.safe_mode_victim) return;
|
||||
OctoPrint.plugins.pluginmanager.enable(data.key)
|
||||
.done(onSuccess)
|
||||
.fail(onError);
|
||||
@@ -701,133 +711,138 @@ $(function() {
|
||||
return self.isCompatible(data) ? (self.installed(data) ? gettext("Reinstall") : gettext("Install")) : (data.disabled ? gettext("Disabled") : gettext("Incompatible"));
|
||||
};
|
||||
|
||||
self._displayNotification = function(response, action, titleSuccess, textSuccess, textRestart, textReload, textReconnect, titleError, textError) {
|
||||
var notification;
|
||||
self._displayPluginManagementNotification = function(response, action, plugin) {
|
||||
self.logContents.action.restart = self.logContents.action.restart || response.needs_restart;
|
||||
self.logContents.action.refresh = self.logContents.action.refresh || response.needs_refresh;
|
||||
self.logContents.action_reconnect = self.logContents.action.reconnect || response.needs_reconnect;
|
||||
self.logContents.steps.push({action: action, plugin: plugin, result: response.result});
|
||||
|
||||
var beforeClose = function(notification) {
|
||||
self.notifications = _.without(self.notifications, notification);
|
||||
};
|
||||
var title = gettext("Plugin management log");
|
||||
var text = "<p><ul>";
|
||||
|
||||
if (response.result) {
|
||||
if (action == "install" && response.plugin && response.plugin.blacklisted) {
|
||||
notification = new PNotify({
|
||||
title: titleSuccess,
|
||||
text: textSuccess,
|
||||
type: "warning",
|
||||
callbacks: {
|
||||
before_close: beforeClose
|
||||
},
|
||||
hide: false
|
||||
})
|
||||
} else if (response.needs_restart) {
|
||||
var options = {
|
||||
title: titleSuccess,
|
||||
text: textRestart,
|
||||
buttons: {
|
||||
closer: true,
|
||||
sticker: false
|
||||
},
|
||||
callbacks: {
|
||||
before_close: beforeClose
|
||||
},
|
||||
hide: false
|
||||
};
|
||||
|
||||
var restartClicked = false;
|
||||
if (self.restartCommandSpec) {
|
||||
options.confirm = {
|
||||
confirm: true,
|
||||
buttons: [{
|
||||
text: gettext("Restart now"),
|
||||
click: function (notice) {
|
||||
if (restartClicked) return;
|
||||
restartClicked = true;
|
||||
showConfirmationDialog({
|
||||
message: gettext("<strong>This will restart your OctoPrint server.</strong></p><p>This action may disrupt any ongoing print jobs (depending on your printer's controller and general setup that might also apply to prints run directly from your printer's internal storage)."),
|
||||
onproceed: function() {
|
||||
OctoPrint.system.executeCommand("core", "restart")
|
||||
.done(function() {
|
||||
notice.remove();
|
||||
new PNotify({
|
||||
title: gettext("Restart in progress"),
|
||||
text: gettext("The server is now being restarted in the background")
|
||||
})
|
||||
})
|
||||
.fail(function() {
|
||||
new PNotify({
|
||||
title: gettext("Something went wrong"),
|
||||
text: gettext("Trying to restart the server produced an error, please check octoprint.log for details. You'll have to restart manually.")
|
||||
})
|
||||
});
|
||||
},
|
||||
onclose: function() {
|
||||
restartClicked = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}]
|
||||
}
|
||||
}
|
||||
|
||||
notification = PNotify.singleButtonNotify(options);
|
||||
} else if (response.needs_refresh) {
|
||||
var refreshClicked = false;
|
||||
notification = PNotify.singleButtonNotify({
|
||||
title: titleSuccess,
|
||||
text: textReload,
|
||||
confirm: {
|
||||
confirm: true,
|
||||
buttons: [{
|
||||
text: gettext("Reload now"),
|
||||
click: function () {
|
||||
if (refreshClicked) return;
|
||||
refreshClicked = true;
|
||||
location.reload(true);
|
||||
}
|
||||
}]
|
||||
},
|
||||
buttons: {
|
||||
closer: true,
|
||||
sticker: false
|
||||
},
|
||||
callbacks: {
|
||||
before_close: beforeClose
|
||||
},
|
||||
hide: false
|
||||
})
|
||||
} else if (response.needs_reconnect) {
|
||||
notification = new PNotify({
|
||||
title: titleSuccess,
|
||||
text: textReconnect,
|
||||
callbacks: {
|
||||
before_close: beforeClose
|
||||
},
|
||||
hide: false
|
||||
})
|
||||
var steps = self.logContents.steps;
|
||||
if (steps.length > 5) {
|
||||
var count = steps.length - 5;
|
||||
var line;
|
||||
if (count > 1) {
|
||||
line = gettext("%(count)d earlier actions...");
|
||||
} else {
|
||||
notification = new PNotify({
|
||||
title: titleSuccess,
|
||||
text: textSuccess,
|
||||
type: "success",
|
||||
callbacks: {
|
||||
before_close: beforeClose
|
||||
},
|
||||
hide: false
|
||||
})
|
||||
line = gettext("%(count)d earlier action");
|
||||
}
|
||||
} else {
|
||||
notification = new PNotify({
|
||||
title: titleError,
|
||||
text: textError,
|
||||
type: "error",
|
||||
callbacks: {
|
||||
before_close: beforeClose
|
||||
},
|
||||
hide: false
|
||||
});
|
||||
text += "<li><em>" + _.sprintf(line, {count: count}) + "</em></li>";
|
||||
steps = steps.slice(steps.length - 5);
|
||||
}
|
||||
|
||||
self.notifications.push(notification);
|
||||
_.each(steps, function(step) {
|
||||
var line = undefined;
|
||||
|
||||
switch (step.action) {
|
||||
case "install": {
|
||||
line = gettext("Install <em>%(plugin)s</em>: %(result)s");
|
||||
break;
|
||||
}
|
||||
case "uninstall": {
|
||||
line = gettext("Uninstall <em>%(plugin)s</em>: %(result)s");
|
||||
break;
|
||||
}
|
||||
case "enable": {
|
||||
line = gettext("Enable <em>%(plugin)s</em>: %(result)s");
|
||||
break;
|
||||
}
|
||||
case "disable": {
|
||||
line = gettext("Disable <em>%(plugin)s</em>: %(result)s");
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
text += "<li>"
|
||||
+ _.sprintf(line, {plugin: step.plugin, result: step.result ? "<i class=\"fa fa-check\"></i>" : "<i class=\"fa fa-remove\"></i>"})
|
||||
+ "</li>";
|
||||
});
|
||||
text += "</ul></p>";
|
||||
|
||||
var confirm = undefined;
|
||||
var type = "success";
|
||||
if (self.logContents.action.restart) {
|
||||
text += "<p>" + gettext("A restart is needed for the changes to take effect.") + "</p>";
|
||||
type = "warning";
|
||||
|
||||
if (self.restartCommandSpec) {
|
||||
var restartClicked = false;
|
||||
confirm = {
|
||||
confirm: true,
|
||||
buttons: [{
|
||||
text: gettext("Restart now"),
|
||||
click: function (notice) {
|
||||
if (restartClicked) return;
|
||||
restartClicked = true;
|
||||
showConfirmationDialog({
|
||||
message: gettext("<strong>This will restart your OctoPrint server.</strong></p><p>This action may disrupt any ongoing print jobs (depending on your printer's controller and general setup that might also apply to prints run directly from your printer's internal storage)."),
|
||||
onproceed: function() {
|
||||
OctoPrint.system.executeCommand("core", "restart")
|
||||
.done(function() {
|
||||
notice.remove();
|
||||
new PNotify({
|
||||
title: gettext("Restart in progress"),
|
||||
text: gettext("The server is now being restarted in the background")
|
||||
})
|
||||
})
|
||||
.fail(function() {
|
||||
new PNotify({
|
||||
title: gettext("Something went wrong"),
|
||||
text: gettext("Trying to restart the server produced an error, please check octoprint.log for details. You'll have to restart manually.")
|
||||
})
|
||||
});
|
||||
},
|
||||
onclose: function() {
|
||||
restartClicked = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}]
|
||||
}
|
||||
}
|
||||
} else if (self.logContents.action.refresh) {
|
||||
text += "<p>" + gettext("A refresh is needed for the changes to take effect.") + "</p>";
|
||||
type = "warning";
|
||||
|
||||
var refreshClicked = false;
|
||||
confirm = {
|
||||
confirm: true,
|
||||
buttons: [{
|
||||
text: gettext("Reload now"),
|
||||
click: function () {
|
||||
if (refreshClicked) return;
|
||||
refreshClicked = true;
|
||||
location.reload(true);
|
||||
}
|
||||
}]
|
||||
}
|
||||
} else if (self.logContents.action_reconnect) {
|
||||
text += "<p>" + gettext("A reconnect to the printer is needed for the changes to take effect.") + "</p>";
|
||||
type = "warning";
|
||||
}
|
||||
|
||||
var options = {
|
||||
title: title,
|
||||
text: text,
|
||||
type: type
|
||||
};
|
||||
|
||||
if (self.logNotification !== undefined) {
|
||||
self.logNotification.remove();
|
||||
}
|
||||
|
||||
if (confirm !== undefined) {
|
||||
options.confirm = confirm;
|
||||
options.hide = false;
|
||||
self.logNotification = PNotify.singleButtonNotify(options);
|
||||
} else {
|
||||
self.logNotification = new PNotify(options);
|
||||
}
|
||||
};
|
||||
|
||||
self._markWorking = function(title, line) {
|
||||
@@ -857,7 +872,8 @@ $(function() {
|
||||
};
|
||||
|
||||
self._getToggleCommand = function(data) {
|
||||
var disable = (data.enabled || data.pending_enable || (data.safe_mode_victim && data.safe_mode_enabled)) && !data.pending_disable;
|
||||
var disable = (data.enabled || (data.safe_mode_victim && !data.forced_disabled) || data.pending_enable)
|
||||
&& !data.pending_disable;
|
||||
return disable ? "disable" : "enable";
|
||||
};
|
||||
|
||||
@@ -873,7 +889,7 @@ $(function() {
|
||||
if (command == "enable") {
|
||||
if (data.blacklisted) {
|
||||
return gettext("Blacklisted");
|
||||
} else if (data.safe_mode_victim && !data.safe_mode_enabled) {
|
||||
} else if (data.safe_mode_victim) {
|
||||
return gettext("Disabled due to active safe mode");
|
||||
} else {
|
||||
return gettext("Enable Plugin");
|
||||
@@ -1067,14 +1083,26 @@ $(function() {
|
||||
};
|
||||
|
||||
self.onUserLoggedOut = function() {
|
||||
self._closeAllNotifications();
|
||||
self._resetNotifications();
|
||||
};
|
||||
|
||||
self.onEventConnectivityChanged = function(payload) {
|
||||
self.requestData({eval_notices: true});
|
||||
};
|
||||
|
||||
self._resetNotifications = function() {
|
||||
self._closeAllNotifications();
|
||||
self.logContents.action.restart
|
||||
= self.logContents.action.reload
|
||||
= self.logContents.action.reconnect
|
||||
= false;
|
||||
self.logContents.steps = [];
|
||||
};
|
||||
|
||||
self._closeAllNotifications = function() {
|
||||
if (self.logNotification) {
|
||||
self.logNotification.remove();
|
||||
}
|
||||
if (self.notifications) {
|
||||
_.each(self.notifications, function(notification) {
|
||||
notification.remove();
|
||||
@@ -1083,7 +1111,7 @@ $(function() {
|
||||
};
|
||||
|
||||
self.onServerDisconnect = function() {
|
||||
self._closeAllNotifications();
|
||||
self._resetNotifications();
|
||||
return true;
|
||||
};
|
||||
|
||||
@@ -1094,7 +1122,7 @@ $(function() {
|
||||
};
|
||||
|
||||
self.onDataUpdaterPluginMessage = function(plugin, data) {
|
||||
if (plugin != "pluginmanager") {
|
||||
if (plugin !== "pluginmanager") {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1108,157 +1136,21 @@ $(function() {
|
||||
|
||||
var messageType = data.type;
|
||||
|
||||
if (messageType == "loglines" && self.working()) {
|
||||
if (messageType === "loglines" && self.working()) {
|
||||
_.each(data.loglines, function(line) {
|
||||
self.loglines.push(self._preprocessLine(line));
|
||||
});
|
||||
self._scrollWorkingOutputToEnd();
|
||||
} else if (messageType == "result") {
|
||||
var titleSuccess, textSuccess, textRestart, textReload, textReconnect, titleError, textError;
|
||||
} else if (messageType === "result") {
|
||||
var action = data.action;
|
||||
|
||||
var name = "Unknown";
|
||||
if (action == "install") {
|
||||
var unknown = false;
|
||||
|
||||
if (data.hasOwnProperty("plugin")) {
|
||||
if (data.plugin == "unknown") {
|
||||
unknown = true;
|
||||
} else {
|
||||
name = data.plugin.name;
|
||||
}
|
||||
}
|
||||
|
||||
if (unknown) {
|
||||
titleSuccess = _.sprintf(gettext("Plugin installed"));
|
||||
textSuccess = gettext("A plugin was installed successfully, however it was impossible to detect which one. Please Restart OctoPrint to make sure everything will be registered properly");
|
||||
textRestart = textSuccess;
|
||||
textReload = textSuccess;
|
||||
textReconnect = textSuccess;
|
||||
} else if (data.plugin && data.plugin.blacklisted) {
|
||||
if (data.was_reinstalled) {
|
||||
titleSuccess = _.sprintf(gettext("Plugin \"%(name)s\" reinstalled"), {name: name});
|
||||
textSuccess = gettext("The plugin was reinstalled successfully, however it is blacklisted and therefore won't be loaded.");
|
||||
} else {
|
||||
titleSuccess = _.sprintf(gettext("Plugin \"%(name)s\" installed"), {name: name});
|
||||
textSuccess = gettext("The plugin was installed successfully, however it is blacklisted and therefore won't be loaded.");
|
||||
}
|
||||
textRestart = textSuccess;
|
||||
textReload = textSuccess;
|
||||
textReconnect = textSuccess;
|
||||
} else if (data.was_reinstalled) {
|
||||
titleSuccess = _.sprintf(gettext("Plugin \"%(name)s\" reinstalled"), {name: name});
|
||||
textSuccess = gettext("The plugin was reinstalled successfully");
|
||||
textRestart = gettext("The plugin was reinstalled successfully, however a restart of OctoPrint is needed for that to take effect.");
|
||||
textReload = gettext("The plugin was reinstalled successfully, however a reload of the page is needed for that to take effect.");
|
||||
textReconnect = gettext("The plugin was reinstalled successfully, however a reconnect to the printer is needed for that to take effect.");
|
||||
} else {
|
||||
titleSuccess = _.sprintf(gettext("Plugin \"%(name)s\" installed"), {name: name});
|
||||
textSuccess = gettext("The plugin was installed successfully");
|
||||
textRestart = gettext("The plugin was installed successfully, however a restart of OctoPrint is needed for that to take effect.");
|
||||
textReload = gettext("The plugin was installed successfully, however a reload of the page is needed for that to take effect.");
|
||||
textReconnect = gettext("The plugin was installed successfully, however a reconnect to the printer is needed for that to take effect.");
|
||||
}
|
||||
|
||||
titleError = gettext("Something went wrong");
|
||||
var source = "unknown";
|
||||
if (data.hasOwnProperty("source")) {
|
||||
source = data.source;
|
||||
}
|
||||
var sourceType = "unknown";
|
||||
if (data.hasOwnProperty("source_type")) {
|
||||
sourceType = data.source_type;
|
||||
}
|
||||
|
||||
if (data.hasOwnProperty("reason")) {
|
||||
if (data.was_reinstalled) {
|
||||
if (sourceType == "path") {
|
||||
textError = _.sprintf(gettext("Reinstalling the plugin from file failed: %(reason)s"), {reason: data.reason});
|
||||
} else {
|
||||
textError = _.sprintf(gettext("Reinstalling the plugin from \"%(source)s\" failed: %(reason)s"), {reason: data.reason, source: source});
|
||||
}
|
||||
} else {
|
||||
if (sourceType == "path") {
|
||||
textError = _.sprintf(gettext("Installing the plugin from file failed: %(reason)s"), {reason: data.reason});
|
||||
} else {
|
||||
textError = _.sprintf(gettext("Installing the plugin from \"%(source)s\" failed: %(reason)s"), {reason: data.reason, source: source});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (data.was_reinstalled) {
|
||||
if (sourceType == "path") {
|
||||
textError = gettext("Reinstalling the plugin from file failed, please see the log for details.");
|
||||
} else {
|
||||
textError = _.sprintf(gettext("Reinstalling the plugin from \"%(source)s\" failed, please see the log for details."), {source: source});
|
||||
}
|
||||
} else {
|
||||
if (sourceType == "path") {
|
||||
textError = gettext("Installing the plugin from file failed, please see the log for details.");
|
||||
} else {
|
||||
textError = _.sprintf(gettext("Installing the plugin from \"%(source)s\" failed, please see the log for details."), {source: source});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else if (action == "uninstall") {
|
||||
if (data.hasOwnProperty("plugin")) {
|
||||
if (data.hasOwnProperty("plugin")) {
|
||||
if (data.plugin !== "unknown") {
|
||||
name = data.plugin.name;
|
||||
}
|
||||
|
||||
titleSuccess = _.sprintf(gettext("Plugin \"%(name)s\" uninstalled"), {name: name});
|
||||
textSuccess = gettext("The plugin was uninstalled successfully");
|
||||
textRestart = gettext("The plugin was uninstalled successfully, however a restart of OctoPrint is needed for that to take effect.");
|
||||
textReload = gettext("The plugin was uninstalled successfully, however a reload of the page is needed for that to take effect.");
|
||||
textReconnect = gettext("The plugin was uninstalled successfully, however a reconnect to the printer is needed for that to take effect.");
|
||||
|
||||
titleError = gettext("Something went wrong");
|
||||
if (data.hasOwnProperty("reason")) {
|
||||
textError = _.sprintf(gettext("Uninstalling the plugin failed: %(reason)s"), {reason: data.reason});
|
||||
} else {
|
||||
textError = gettext("Uninstalling the plugin failed, please see the log for details.");
|
||||
}
|
||||
|
||||
} else if (action == "enable") {
|
||||
if (data.hasOwnProperty("plugin")) {
|
||||
name = data.plugin.name;
|
||||
}
|
||||
|
||||
titleSuccess = _.sprintf(gettext("Plugin \"%(name)s\" enabled"), {name: name});
|
||||
textSuccess = gettext("The plugin was enabled successfully.");
|
||||
textRestart = gettext("The plugin was enabled successfully, however a restart of OctoPrint is needed for that to take effect.");
|
||||
textReload = gettext("The plugin was enabled successfully, however a reload of the page is needed for that to take effect.");
|
||||
textReconnect = gettext("The plugin was enabled successfully, however a reconnect to the printer is needed for that to take effect.");
|
||||
|
||||
titleError = gettext("Something went wrong");
|
||||
if (data.hasOwnProperty("reason")) {
|
||||
textError = _.sprintf(gettext("Toggling the plugin failed: %(reason)s"), {reason: data.reason});
|
||||
} else {
|
||||
textError = gettext("Toggling the plugin failed, please see the log for details.");
|
||||
}
|
||||
|
||||
} else if (action == "disable") {
|
||||
if (data.hasOwnProperty("plugin")) {
|
||||
name = data.plugin.name;
|
||||
}
|
||||
|
||||
titleSuccess = _.sprintf(gettext("Plugin \"%(name)s\" disabled"), {name: name});
|
||||
textSuccess = gettext("The plugin was disabled successfully.");
|
||||
textRestart = gettext("The plugin was disabled successfully, however a restart of OctoPrint is needed for that to take effect.");
|
||||
textReload = gettext("The plugin was disabled successfully, however a reload of the page is needed for that to take effect.");
|
||||
textReconnect = gettext("The plugin was disabled successfully, however a reconnect to the printer is needed for that to take effect.");
|
||||
|
||||
titleError = gettext("Something went wrong");
|
||||
if (data.hasOwnProperty("reason")) {
|
||||
textError = _.sprintf(gettext("Toggling the plugin failed: %(reason)s"), {reason: data.reason});
|
||||
} else {
|
||||
textError = gettext("Toggling the plugin failed, please see the log for details.");
|
||||
}
|
||||
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
self._displayNotification(data, action, titleSuccess, textSuccess, textRestart, textReload, textReconnect, titleError, textError);
|
||||
self._displayPluginManagementNotification(data, action, name);
|
||||
self.requestData();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
# coding=utf-8
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
|
||||
__copyright__ = "Copyright (C) 2018 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
import octoprint.plugin
|
||||
|
||||
from octoprint.events import Events
|
||||
from octoprint.server import user_permission
|
||||
|
||||
import flask
|
||||
from flask_babel import gettext
|
||||
|
||||
import textwrap
|
||||
|
||||
TERMINAL_SAFETY_WARNING = """
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
{message}
|
||||
|
||||
Learn more at https://faq.octoprint.org/warning-{warning_type}
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
"""
|
||||
|
||||
SAFETY_CHECKS = {
|
||||
"firmware-unsafe": (lambda name, data: name and name.lower().startswith("anet_a8_"),)
|
||||
}
|
||||
|
||||
class PrinterSafetyCheckPlugin(octoprint.plugin.AssetPlugin,
|
||||
octoprint.plugin.EventHandlerPlugin,
|
||||
octoprint.plugin.SimpleApiPlugin,
|
||||
octoprint.plugin.TemplatePlugin):
|
||||
|
||||
# noinspection PyMissingConstructor
|
||||
def __init__(self):
|
||||
self._warnings = dict()
|
||||
|
||||
##~~ TemplatePlugin API
|
||||
|
||||
def get_template_configs(self):
|
||||
return [
|
||||
dict(type="sidebar",
|
||||
name=gettext("Printer Safety Warning"),
|
||||
data_bind="visible: printerState.isOperational() && loginState.isAdmin() && warnings().length > 0",
|
||||
icon="exclamation-triangle",
|
||||
styles_wrapper=["display: none"])
|
||||
]
|
||||
|
||||
##~~ AssetPlugin API
|
||||
|
||||
def get_assets(self):
|
||||
return dict(js=("js/printer_safety_check.js",),
|
||||
css=("css/printer_safety_check.css",),
|
||||
less=("less/printer_safety_check.less",))
|
||||
|
||||
##~~ EventHandlerPlugin API
|
||||
|
||||
def on_event(self, event, payload):
|
||||
if event == Events.FIRMWARE_DATA:
|
||||
self._analyze_firmware_data(payload.get("name"), payload.get("data"))
|
||||
elif event == Events.DISCONNECTED:
|
||||
self._reset_warnings()
|
||||
|
||||
##~~ SimpleApiPlugin API
|
||||
|
||||
def on_api_get(self, request):
|
||||
if not user_permission.can():
|
||||
return flask.make_response("Insufficient rights", 403)
|
||||
return flask.jsonify(self._warnings)
|
||||
|
||||
##~~ Helpers
|
||||
|
||||
def _analyze_firmware_data(self, name, data):
|
||||
changes = False
|
||||
|
||||
for warning_type, checks in SAFETY_CHECKS.items():
|
||||
if any(x(name, data) for x in checks):
|
||||
message = u"Your printer's firmware is known to lack mandatory safety features (e.g. " \
|
||||
u"thermal runaway protection). This is a fire risk."
|
||||
self._log_to_terminal(TERMINAL_SAFETY_WARNING.format(message="\n".join(textwrap.wrap(message, 75)),
|
||||
warning_type=warning_type))
|
||||
self._warnings[warning_type] = message
|
||||
changes = True
|
||||
|
||||
if changes:
|
||||
self._ping_clients()
|
||||
|
||||
def _reset_warnings(self):
|
||||
self._warnings.clear()
|
||||
self._ping_clients()
|
||||
|
||||
def _log_to_terminal(self, message):
|
||||
if self._printer:
|
||||
lines = message.split("\n")
|
||||
self._printer.log_lines(*lines)
|
||||
|
||||
def _ping_clients(self):
|
||||
self._plugin_manager.send_plugin_message(self._identifier, dict(type="update"))
|
||||
|
||||
__plugin_name__ = "Printer Safety Check"
|
||||
__plugin_author__ = "Gina Häußge"
|
||||
__plugin_url__ = "http://docs.octoprint.org/en/master/bundledplugins/printer_safety_check.html"
|
||||
__plugin_description__ = "Checks for unsafe printers/printer firmwares"
|
||||
__plugin_disabling_discouraged__ = gettext("Without this plugin OctoPrint will no longer be able to "
|
||||
"check if the printer it is connected to has a known safety"
|
||||
"issue and inform you about that fact.")
|
||||
__plugin_license__ = "AGPLv3"
|
||||
__plugin_implementation__ = PrinterSafetyCheckPlugin()
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
#sidebar_plugin_printer_safety_check_wrapper{border:1px solid #b94a48}#sidebar_plugin_printer_safety_check_wrapper .accordion-heading{background-color:#b94a48;font-weight:700;color:#fff}#sidebar_plugin_printer_safety_check_wrapper .accordion-heading .icon-black,#sidebar_plugin_printer_safety_check_wrapper .accordion-heading a,#sidebar_plugin_printer_safety_check_wrapper .accordion-heading a:active,#sidebar_plugin_printer_safety_check_wrapper .accordion-heading a:hover,#sidebar_plugin_printer_safety_check_wrapper .accordion-heading a:visited{color:#fff}
|
||||
@@ -0,0 +1,78 @@
|
||||
(function (global, factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define(["OctoPrintClient"], factory);
|
||||
} else {
|
||||
factory(global.OctoPrintClient);
|
||||
}
|
||||
})(this, function(OctoPrintClient) {
|
||||
var OctoPrintPrinterSafetyCheckClient = function(base) {
|
||||
this.base = base;
|
||||
};
|
||||
|
||||
OctoPrintPrinterSafetyCheckClient.prototype.get = function(opts) {
|
||||
return this.base.get(this.base.getSimpleApiUrl("printer_safety_check"), opts);
|
||||
};
|
||||
|
||||
OctoPrintClient.registerPluginComponent("printer_safety_check", OctoPrintPrinterSafetyCheckClient);
|
||||
return OctoPrintPrinterSafetyCheckClient;
|
||||
});
|
||||
|
||||
$(function() {
|
||||
function PrinterSafetyCheckViewModel(parameters) {
|
||||
var self = this;
|
||||
|
||||
self.loginState = parameters[0];
|
||||
self.printerState = parameters[1];
|
||||
|
||||
self.warnings = ko.observableArray([]);
|
||||
|
||||
self.requestData = function() {
|
||||
if (!self.loginState.isUser()) {
|
||||
self.warnings([]);
|
||||
return;
|
||||
}
|
||||
|
||||
OctoPrint.plugins.printer_safety_check.get()
|
||||
.done(self.fromResponse)
|
||||
.fail(function() {
|
||||
self.warnings([]);
|
||||
});
|
||||
};
|
||||
|
||||
self.fromResponse = function(data) {
|
||||
var warnings = [];
|
||||
_.each(data, function(message, warning_type) {
|
||||
warnings.push({type: warning_type, message: message});
|
||||
});
|
||||
self.warnings(warnings);
|
||||
};
|
||||
|
||||
self.onStartup = function() {
|
||||
self.requestData();
|
||||
};
|
||||
|
||||
self.onUserLoggedIn = function() {
|
||||
self.requestData();
|
||||
};
|
||||
|
||||
self.onUserLoggedOut = function() {
|
||||
self.requestData();
|
||||
};
|
||||
|
||||
self.onDataUpdaterPluginMessage = function(plugin, data) {
|
||||
if (plugin !== "printer_safety_check") return;
|
||||
if (!data.hasOwnProperty("type")) return;
|
||||
|
||||
if (data.type === "update") {
|
||||
self.requestData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OCTOPRINT_VIEWMODELS.push({
|
||||
construct: PrinterSafetyCheckViewModel,
|
||||
dependencies: ["loginStateViewModel", "printerStateViewModel"],
|
||||
elements: ["#sidebar_plugin_printer_safety_check_wrapper"]
|
||||
});
|
||||
});
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
#sidebar_plugin_printer_safety_check_wrapper {
|
||||
border: 1px solid #b94a48;
|
||||
|
||||
.accordion-heading {
|
||||
background-color: #b94a48;
|
||||
font-weight: bold;
|
||||
color: #fff;
|
||||
a, a:hover, a:visited, a:active {
|
||||
color: #fff;
|
||||
}
|
||||
.icon-black {
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
<p><strong>{{ _('Warning!') }}</strong></p>
|
||||
<!-- ko foreach: warnings -->
|
||||
<p class="printer_safety_warning">
|
||||
<span data-bind="text: message"></span><br>
|
||||
<a target="_blank" rel="noreferrer noopener" data-bind="attr: {href: 'https://faq.octoprint.org/warning-' + type}">{{ _('Learn more...') }}</a>
|
||||
</p>
|
||||
<!-- /ko -->
|
||||
@@ -42,7 +42,7 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin,
|
||||
|
||||
COMMIT_TRACKING_TYPES = ("github_commit", "bitbucket_commit")
|
||||
|
||||
DATA_FORMAT_VERSION = "v2"
|
||||
DATA_FORMAT_VERSION = "v3"
|
||||
|
||||
# noinspection PyMissingConstructor
|
||||
def __init__(self):
|
||||
@@ -484,7 +484,7 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin,
|
||||
def view():
|
||||
try:
|
||||
information, update_available, update_possible = self.get_current_versions(check_targets=check_targets, force=force)
|
||||
return flask.jsonify(dict(status="updatePossible" if update_available and update_possible else "updateAvailable" if update_available else "current",
|
||||
return flask.jsonify(dict(status="inProgress" if self._update_in_progress else "updatePossible" if update_available and update_possible else "updateAvailable" if update_available else "current",
|
||||
information=information,
|
||||
timestamp=self._version_cache_timestamp))
|
||||
except exceptions.ConfigurationInvalid as e:
|
||||
@@ -515,6 +515,7 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin,
|
||||
hash.update(",".join(targets))
|
||||
hash.update(str(self._version_cache_timestamp))
|
||||
hash.update(str(self._connectivity_checker.online))
|
||||
hash.update(str(self._update_in_progress))
|
||||
hash.update(self.DATA_FORMAT_VERSION)
|
||||
return hash.hexdigest()
|
||||
|
||||
@@ -921,7 +922,7 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin,
|
||||
self._send_client_message("update_failed", dict(target=target, version=target_version, name=populated_check["displayName"], reason="No internet connection"))
|
||||
|
||||
except Exception as e:
|
||||
self._logger.exception("Update of %s can not be performed" % target)
|
||||
self._logger.exception("Update of %s can not be performed, please also check plugin_softwareupdate_console.log for possible causes of this" % target)
|
||||
if not "ignorable" in populated_check or not populated_check["ignorable"]:
|
||||
target_error = True
|
||||
|
||||
@@ -1115,7 +1116,8 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin,
|
||||
|
||||
mapping = dict(update_script=updaters.update_script,
|
||||
pip=updaters.pip,
|
||||
python_updater=updaters.python_updater)
|
||||
python_updater=updaters.python_updater,
|
||||
sleep_a_bit=updaters.sleep_a_bit)
|
||||
|
||||
method = self._get_update_method(target, check, valid_methods=mapping.keys())
|
||||
return mapping[method]
|
||||
|
||||
@@ -303,6 +303,11 @@ $(function() {
|
||||
var octoprint = data.information["octoprint"];
|
||||
self.octoprintReleasedVersion(!octoprint || octoprint.released_version);
|
||||
|
||||
if (data.status === "inProgress") {
|
||||
self._markWorking(gettext("Updating..."), gettext("Updating, please wait."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!self.loginState.isAdmin() && !self.settings.settings.plugins.softwareupdate.notify_users()) return;
|
||||
|
||||
if (data.status === "updateAvailable" || data.status === "updatePossible") {
|
||||
@@ -664,23 +669,33 @@ $(function() {
|
||||
var title = undefined;
|
||||
var text = undefined;
|
||||
|
||||
switch(messageType) {
|
||||
// make sure we are marked as working if we get any of the in-progress messages
|
||||
case "loglines":
|
||||
case "updating":
|
||||
case "restarting":
|
||||
case "restart_manually":
|
||||
case "restart_failed":
|
||||
case "success":
|
||||
case "error": {
|
||||
if (!self.working()) {
|
||||
self._markWorking(gettext("Updating..."), gettext("Updating, please wait."));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch (messageType) {
|
||||
case "loglines": {
|
||||
if (self.working()) {
|
||||
_.each(messageData.loglines, function(line) {
|
||||
self.loglines.push(self._preprocessLine(line));
|
||||
});
|
||||
self._scrollWorkingOutputToEnd();
|
||||
}
|
||||
_.each(messageData.loglines, function(line) {
|
||||
self.loglines.push(self._preprocessLine(line));
|
||||
});
|
||||
self._scrollWorkingOutputToEnd();
|
||||
break;
|
||||
}
|
||||
case "updating": {
|
||||
console.log(JSON.stringify(messageData));
|
||||
|
||||
if (!self.working()) {
|
||||
self._markWorking(gettext("Updating..."), gettext("Updating, please wait."));
|
||||
}
|
||||
|
||||
text = _.sprintf(gettext("Now updating %(name)s to %(version)s"), {name: messageData.name, version: messageData.version});
|
||||
self.loglines.push({line: "", stream: "separator"});
|
||||
self.loglines.push({line: _.repeat("+", text.length), stream: "separator"});
|
||||
@@ -800,7 +815,7 @@ $(function() {
|
||||
}
|
||||
case "error": {
|
||||
title = gettext("Update failed!");
|
||||
text = gettext("The update did not finish successfully. Please consult octoprint.log and plugin_softwareupdate_console.log for details.");
|
||||
text = gettext("The update did not finish successfully. Please consult <code>octoprint.log</code> and <code>plugin_softwareupdate_console.log</code> for details.");
|
||||
self._showPopup({
|
||||
title: title,
|
||||
text: text,
|
||||
|
||||
@@ -5,4 +5,4 @@ __author__ = "Gina Häußge <osd@foosel.net>"
|
||||
__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 . import pip, python_updater, update_script
|
||||
from . import pip, python_updater, update_script, sleep_a_bit
|
||||
@@ -0,0 +1,23 @@
|
||||
# coding=utf-8
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
|
||||
__copyright__ = "Copyright (C) 2018 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
|
||||
import monotonic
|
||||
import time
|
||||
|
||||
def can_perform_update(target, check, online=True):
|
||||
return True
|
||||
|
||||
|
||||
def perform_update(target, check, target_version, log_cb=None, online=True):
|
||||
duration = check.get("duration", 30)
|
||||
|
||||
now = monotonic.monotonic()
|
||||
end = now + duration
|
||||
while now < end:
|
||||
log_cb(["{}s left...".format(end - now)], prefix=">", stream="output")
|
||||
time.sleep(5)
|
||||
now = monotonic.monotonic()
|
||||
@@ -119,15 +119,17 @@ class VirtualPrinter(object):
|
||||
self._echoOnM117 = settings().getBoolean(["devel", "virtualPrinter", "echoOnM117"])
|
||||
|
||||
self._brokenM29 = settings().getBoolean(["devel", "virtualPrinter", "brokenM29"])
|
||||
self._brokenResend = settings().getBoolean(["devel", "virtualPrinter", "brokenResend"])
|
||||
|
||||
self._m115FormatString = settings().get(["devel", "virtualPrinter", "m115FormatString"])
|
||||
self._firmwareName = settings().get(["devel", "virtualPrinter", "firmwareName"])
|
||||
|
||||
self._okFormatString = settings().get(["devel", "virtualPrinter", "okFormatString"])
|
||||
|
||||
self._capabilities = settings().get(["devel", "virtualPrinter", "capabilities"])
|
||||
self._capabilities = settings().get(["devel", "virtualPrinter", "capabilities"], merged=True)
|
||||
|
||||
self._temperature_reporter = None
|
||||
self._sdstatus_reporter = None
|
||||
|
||||
self.currentLine = 0
|
||||
self.lastN = 0
|
||||
@@ -353,9 +355,11 @@ class VirtualPrinter(object):
|
||||
|
||||
def _gcode_T(self, code, data):
|
||||
t = int(code)
|
||||
if 0 <= t <= self.extruderCount:
|
||||
if 0 <= t < self.extruderCount:
|
||||
self.currentExtruder = t
|
||||
self._send("Active Extruder: %d" % self.currentExtruder)
|
||||
else:
|
||||
self._send("echo:T{} Invalid extruder ".format(t))
|
||||
|
||||
def _gcode_F(self, code, data):
|
||||
if self._supportF:
|
||||
@@ -411,8 +415,23 @@ class VirtualPrinter(object):
|
||||
self._setSdPos(pos)
|
||||
|
||||
def _gcode_M27(self, data):
|
||||
if self._sdCardReady:
|
||||
self._reportSdStatus()
|
||||
def report():
|
||||
if self._sdCardReady:
|
||||
self._reportSdStatus()
|
||||
|
||||
match = re.search("S([0-9]+)", data)
|
||||
if match:
|
||||
interval = int(match.group(1))
|
||||
if self._sdstatus_reporter is not None:
|
||||
self._sdstatus_reporter.cancel()
|
||||
|
||||
if interval > 0:
|
||||
self._sdstatus_reporter = RepeatedTimer(interval, report)
|
||||
self._sdstatus_reporter.start()
|
||||
else:
|
||||
self._sdstatus_reporter = None
|
||||
|
||||
report()
|
||||
|
||||
def _gcode_M28(self, data):
|
||||
if self._sdCardReady:
|
||||
@@ -581,7 +600,8 @@ class VirtualPrinter(object):
|
||||
|
||||
def request_resend():
|
||||
self._send("Resend:%d" % expected)
|
||||
self._sendOk()
|
||||
if not self._brokenResend:
|
||||
self._sendOk()
|
||||
|
||||
if settings().getBoolean(["devel", "virtualPrinter", "repetierStyleResends"]):
|
||||
request_resend()
|
||||
|
||||
@@ -134,6 +134,39 @@ class PrinterInterface(object):
|
||||
"""
|
||||
raise NotImplementedError()
|
||||
|
||||
def set_job_on_hold(self, value, blocking=True, *args, **kwargs):
|
||||
"""
|
||||
Setter for finer control over putting jobs on hold. Set to ``True`` to ensure that no commands from the file
|
||||
being printed are continued to be sent to the printer. Set to ``False`` to resume. Note that this will only
|
||||
work for local files, NOT SD files.
|
||||
|
||||
Make absolutely sure that if you set this flag, you will always also unset it again. If you don't, the job will
|
||||
be stuck forever.
|
||||
|
||||
Example:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
if printer.set_job_on_hold(True):
|
||||
try:
|
||||
park_printhead()
|
||||
take_snapshot()
|
||||
send_printhead_back()
|
||||
finally:
|
||||
printer.set_job_on_hold(False)
|
||||
|
||||
Just like :func:`~octoprint.printer.PrinterInterface.job_on_hold` this should be used sparingly and only for
|
||||
very specific situations. If you abuse this, you WILL cause print quality issues!
|
||||
|
||||
Args:
|
||||
value (bool): The value to set
|
||||
blocking (bool): Whether to block while attempting to set the value (default) or not
|
||||
|
||||
Returns:
|
||||
(bool) Whether the value could be set successfully (True) or a timeout was encountered (False)
|
||||
"""
|
||||
raise NotImplementedError()
|
||||
|
||||
def fake_ack(self, *args, **kwargs):
|
||||
"""
|
||||
Fakes an acknowledgment for the communication layer. If the communication between OctoPrint and the printer
|
||||
@@ -397,6 +430,14 @@ class PrinterInterface(object):
|
||||
"""
|
||||
raise NotImplementedError()
|
||||
|
||||
def log_lines(self, *lines):
|
||||
"""
|
||||
Logs the provided lines to the printer log and serial.log
|
||||
Args:
|
||||
*lines: the lines to log
|
||||
"""
|
||||
pass
|
||||
|
||||
def get_state_string(self, *args, **kwargs):
|
||||
"""
|
||||
Returns:
|
||||
@@ -486,6 +527,20 @@ class PrinterInterface(object):
|
||||
"""
|
||||
raise NotImplementedError()
|
||||
|
||||
def is_cancelling(self, *args, **kwargs):
|
||||
"""
|
||||
Returns:
|
||||
(boolean) Whether the printer is currently cancelling a print.
|
||||
"""
|
||||
raise NotImplementedError()
|
||||
|
||||
def is_pausing(self, *args, **kwargs):
|
||||
"""
|
||||
Returns:
|
||||
(boolean) Whether the printer is currently pausing a print.
|
||||
"""
|
||||
raise NotImplementedError()
|
||||
|
||||
def is_paused(self, *args, **kwargs):
|
||||
"""
|
||||
Returns:
|
||||
|
||||
+160
-125
@@ -1,4 +1,142 @@
|
||||
# coding=utf-8
|
||||
"""
|
||||
This module contains printer profile related code.
|
||||
|
||||
A printer profile is a ``dict`` of the following structure:
|
||||
|
||||
.. list-table::
|
||||
:widths: 15 5 30
|
||||
:header-rows: 1
|
||||
|
||||
* - Name
|
||||
- Type
|
||||
- Description
|
||||
* - ``id``
|
||||
- ``string``
|
||||
- Internal id of the printer profile
|
||||
* - ``name``
|
||||
- ``string``
|
||||
- Human readable name of the printer profile
|
||||
* - ``model``
|
||||
- ``string``
|
||||
- Printer model
|
||||
* - ``color``
|
||||
- ``string``
|
||||
- Color to associate with the printer profile
|
||||
* - ``volume``
|
||||
- ``dict``
|
||||
- Information about the print volume
|
||||
* - ``volume.width``
|
||||
- ``float``
|
||||
- Width of the print volume (X axis)
|
||||
* - ``volume.depth``
|
||||
- ``float``
|
||||
- Depth of the print volume (Y axis)
|
||||
* - ``volume.height``
|
||||
- ``float``
|
||||
- Height of the print volume (Z axis)
|
||||
* - ``volume.formFactor``
|
||||
- ``string``
|
||||
- Form factor of the print bed, either ``rectangular`` or ``circular``
|
||||
* - ``volume.origin``
|
||||
- ``string``
|
||||
- Location of gcode origin in the print volume, either ``lowerleft`` or ``center``
|
||||
* - ``volume.custom_box``
|
||||
- ``dict`` or ``False``
|
||||
- Custom boundary box overriding the default bounding box based on the provided width, depth, height and origin.
|
||||
If ``False``, the default boundary box will be used.
|
||||
* - ``volume.custom_box.x_min``
|
||||
- ``float``
|
||||
- Minimum valid X coordinate
|
||||
* - ``volume.custom_box.y_min``
|
||||
- ``float``
|
||||
- Minimum valid Y coordinate
|
||||
* - ``volume.custom_box.z_min``
|
||||
- ``float``
|
||||
- Minimum valid Z coordinate
|
||||
* - ``volume.custom_box.x_max``
|
||||
- ``float``
|
||||
- Maximum valid X coordinate
|
||||
* - ``volume.custom_box.y_max``
|
||||
- ``float``
|
||||
- Maximum valid Y coordinate
|
||||
* - ``volume.custom_box.z_max``
|
||||
- ``float``
|
||||
- Maximum valid Z coordinate
|
||||
* - ``heatedBed``
|
||||
- ``bool``
|
||||
- Whether the printer has a heated bed (``True``) or not (``False``)
|
||||
* - ``extruder``
|
||||
- ``dict``
|
||||
- Information about the printer's extruders
|
||||
* - ``extruder.count``
|
||||
- ``int``
|
||||
- How many extruders the printer has (default 1)
|
||||
* - ``extruder.offsets``
|
||||
- ``list`` of ``tuple``
|
||||
- Extruder offsets relative to first extruder, list of (x, y) tuples, first is always (0,0)
|
||||
* - ``extruder.nozzleDiameter``
|
||||
- ``float``
|
||||
- Diameter of the printer nozzle(s)
|
||||
* - ``extruder.sharedNozzle``
|
||||
- ``boolean``
|
||||
- Whether there's only one nozzle shared among all extruders (true) or one nozzle per extruder (false).
|
||||
* - ``axes``
|
||||
- ``dict``
|
||||
- Information about the printer axes
|
||||
* - ``axes.x``
|
||||
- ``dict``
|
||||
- Information about the printer's X axis
|
||||
* - ``axes.x.speed``
|
||||
- ``float``
|
||||
- Speed of the X axis in mm/s
|
||||
* - ``axes.x.inverted``
|
||||
- ``bool``
|
||||
- Whether a positive value change moves the nozzle away from the print bed's origin (False, default) or towards it (True)
|
||||
* - ``axes.y``
|
||||
- ``dict``
|
||||
- Information about the printer's Y axis
|
||||
* - ``axes.y.speed``
|
||||
- ``float``
|
||||
- Speed of the Y axis in mm/s
|
||||
* - ``axes.y.inverted``
|
||||
- ``bool``
|
||||
- Whether a positive value change moves the nozzle away from the print bed's origin (False, default) or towards it (True)
|
||||
* - ``axes.z``
|
||||
- ``dict``
|
||||
- Information about the printer's Z axis
|
||||
* - ``axes.z.speed``
|
||||
- ``float``
|
||||
- Speed of the Z axis in mm/s
|
||||
* - ``axes.z.inverted``
|
||||
- ``bool``
|
||||
- Whether a positive value change moves the nozzle away from the print bed (False, default) or towards it (True)
|
||||
* - ``axes.e``
|
||||
- ``dict``
|
||||
- Information about the printer's E axis
|
||||
* - ``axes.e.speed``
|
||||
- ``float``
|
||||
- Speed of the E axis in mm/s
|
||||
* - ``axes.e.inverted``
|
||||
- ``bool``
|
||||
- Whether a positive value change extrudes (False, default) or retracts (True) filament
|
||||
|
||||
.. autoclass:: PrinterProfileManager
|
||||
:members:
|
||||
|
||||
.. autoclass:: BedFormFactor
|
||||
:members:
|
||||
|
||||
.. autoclass:: BedOrigin
|
||||
:members:
|
||||
|
||||
.. autoclass:: SaveError
|
||||
|
||||
.. autoclass:: CouldNotOverwriteError
|
||||
|
||||
.. autoclass:: InvalidProfileError
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
__author__ = "Gina Häußge <osd@foosel.net>"
|
||||
@@ -20,25 +158,41 @@ from octoprint.settings import settings
|
||||
from octoprint.util import dict_merge, dict_sanitize, dict_contains_keys, is_hidden_path
|
||||
|
||||
class SaveError(Exception):
|
||||
"""Saving a profile failed"""
|
||||
pass
|
||||
|
||||
class CouldNotOverwriteError(SaveError):
|
||||
"""Overwriting of a profile not allowed"""
|
||||
pass
|
||||
|
||||
class InvalidProfileError(Exception):
|
||||
"""Profile invalid"""
|
||||
pass
|
||||
|
||||
class BedTypes(object):
|
||||
class BedFormFactor(object):
|
||||
"""Valid values for bed form factor"""
|
||||
|
||||
RECTANGULAR = "rectangular"
|
||||
"""Rectangular bed"""
|
||||
|
||||
CIRCULAR = "circular"
|
||||
"""Circular bed"""
|
||||
|
||||
@classmethod
|
||||
def values(cls):
|
||||
return [getattr(cls, name) for name in cls.__dict__ if not (name.startswith("__") or name == "values")]
|
||||
|
||||
BedTypes = BedFormFactor
|
||||
"""Deprecated name of :class:`BedFormFactors`"""
|
||||
|
||||
class BedOrigin(object):
|
||||
"""Valid values for bed origin"""
|
||||
|
||||
LOWERLEFT = "lowerleft"
|
||||
"""Origin at lower left corner of the bed when looking from the top"""
|
||||
|
||||
CENTER = "center"
|
||||
"""Origin at the center of the bed when looking from top"""
|
||||
|
||||
@classmethod
|
||||
def values(cls):
|
||||
@@ -48,125 +202,6 @@ class PrinterProfileManager(object):
|
||||
"""
|
||||
Manager for printer profiles. Offers methods to select the globally used printer profile and to list, add, remove,
|
||||
load and save printer profiles.
|
||||
|
||||
A printer profile is a ``dict`` of the following structure:
|
||||
|
||||
.. list-table::
|
||||
:widths: 15 5 10 30
|
||||
:header-rows: 1
|
||||
|
||||
* - Name
|
||||
- Type
|
||||
- Description
|
||||
* - ``id``
|
||||
- ``string``
|
||||
- Internal id of the printer profile
|
||||
* - ``name``
|
||||
- ``string``
|
||||
- Human readable name of the printer profile
|
||||
* - ``model``
|
||||
- ``string``
|
||||
- Printer model
|
||||
* - ``color``
|
||||
- ``string``
|
||||
- Color to associate with the printer profile
|
||||
* - ``volume``
|
||||
- ``dict``
|
||||
- Information about the print volume
|
||||
* - ``volume.width``
|
||||
- ``float``
|
||||
- Width of the print volume (X axis)
|
||||
* - ``volume.depth``
|
||||
- ``float``
|
||||
- Depth of the print volume (Y axis)
|
||||
* - ``volume.height``
|
||||
- ``float``
|
||||
- Height of the print volume (Z axis)
|
||||
* - ``volume.formFactor``
|
||||
- ``string``
|
||||
- Form factor of the print bed, either ``rectangular`` or ``circular``
|
||||
* - ``volume.origin``
|
||||
- ``string``
|
||||
- Location of gcode origin in the print volume, either ``lowerleft`` or ``center``
|
||||
* - ``volume.custom_box``
|
||||
- ``dict`` or ``False``
|
||||
- Custom boundary box overriding the default bounding box based on the provided width, depth, height and origin.
|
||||
If ``False``, the default boundary box will be used.
|
||||
* - ``volume.custom_box.x_min``
|
||||
- ``float``
|
||||
- Minimum valid X coordinate
|
||||
* - ``volume.custom_box.y_min``
|
||||
- ``float``
|
||||
- Minimum valid Y coordinate
|
||||
* - ``volume.custom_box.z_min``
|
||||
- ``float``
|
||||
- Minimum valid Z coordinate
|
||||
* - ``volume.custom_box.x_max``
|
||||
- ``float``
|
||||
- Maximum valid X coordinate
|
||||
* - ``volume.custom_box.y_max``
|
||||
- ``float``
|
||||
- Maximum valid Y coordinate
|
||||
* - ``volume.custom_box.z_max``
|
||||
- ``float``
|
||||
- Maximum valid Z coordinate
|
||||
* - ``heatedBed``
|
||||
- ``bool``
|
||||
- Whether the printer has a heated bed (``True``) or not (``False``)
|
||||
* - ``extruder``
|
||||
- ``dict``
|
||||
- Information about the printer's extruders
|
||||
* - ``extruder.count``
|
||||
- ``int``
|
||||
- How many extruders the printer has (default 1)
|
||||
* - ``extruder.offsets``
|
||||
- ``list`` of ``tuple``s
|
||||
- Extruder offsets relative to first extruder, list of (x, y) tuples, first is always (0,0)
|
||||
* - ``extruder.nozzleDiameter``
|
||||
- ``float``
|
||||
- Diameter of the printer nozzle(s)
|
||||
* - ``extruder.sharedNozzle``
|
||||
- ``boolean``
|
||||
- Whether there's only one nozzle shared among all extruders (true) or one nozzle per extruder (false).
|
||||
* - ``axes``
|
||||
- ``dict``
|
||||
- Information about the printer axes
|
||||
* - ``axes.x``
|
||||
- ``dict``
|
||||
- Information about the printer's X axis
|
||||
* - ``axes.x.speed``
|
||||
- ``float``
|
||||
- Speed of the X axis in mm/s
|
||||
* - ``axes.x.inverted``
|
||||
- ``bool``
|
||||
- Whether a positive value change moves the nozzle away from the print bed's origin (False, default) or towards it (True)
|
||||
* - ``axes.y``
|
||||
- ``dict``
|
||||
- Information about the printer's Y axis
|
||||
* - ``axes.y.speed``
|
||||
- ``float``
|
||||
- Speed of the Y axis in mm/s
|
||||
* - ``axes.y.inverted``
|
||||
- ``bool``
|
||||
- Whether a positive value change moves the nozzle away from the print bed's origin (False, default) or towards it (True)
|
||||
* - ``axes.z``
|
||||
- ``dict``
|
||||
- Information about the printer's Z axis
|
||||
* - ``axes.z.speed``
|
||||
- ``float``
|
||||
- Speed of the Z axis in mm/s
|
||||
* - ``axes.z.inverted``
|
||||
- ``bool``
|
||||
- Whether a positive value change moves the nozzle away from the print bed (False, default) or towards it (True)
|
||||
* - ``axes.e``
|
||||
- ``dict``
|
||||
- Information about the printer's E axis
|
||||
* - ``axes.e.speed``
|
||||
- ``float``
|
||||
- Speed of the E axis in mm/s
|
||||
* - ``axes.e.inverted``
|
||||
- ``bool``
|
||||
- Whether a positive value change extrudes (False, default) or retracts (True) filament
|
||||
"""
|
||||
|
||||
default = dict(
|
||||
@@ -178,7 +213,7 @@ class PrinterProfileManager(object):
|
||||
width = 200,
|
||||
depth = 200,
|
||||
height = 200,
|
||||
formFactor = BedTypes.RECTANGULAR,
|
||||
formFactor = BedFormFactor.RECTANGULAR,
|
||||
origin = BedOrigin.LOWERLEFT,
|
||||
custom_box = False
|
||||
),
|
||||
@@ -459,7 +494,7 @@ class PrinterProfileManager(object):
|
||||
modified = False
|
||||
|
||||
if "volume" in profile and "formFactor" in profile["volume"] and not "origin" in profile["volume"]:
|
||||
profile["volume"]["origin"] = BedOrigin.CENTER if profile["volume"]["formFactor"] == BedTypes.CIRCULAR else BedOrigin.LOWERLEFT
|
||||
profile["volume"]["origin"] = BedOrigin.CENTER if profile["volume"]["formFactor"] == BedFormFactor.CIRCULAR else BedOrigin.LOWERLEFT
|
||||
modified = True
|
||||
|
||||
if "volume" in profile and not "custom_box" in profile["volume"]:
|
||||
@@ -520,7 +555,7 @@ class PrinterProfileManager(object):
|
||||
return False
|
||||
|
||||
# validate form factor
|
||||
if not profile["volume"]["formFactor"] in BedTypes.values():
|
||||
if not profile["volume"]["formFactor"] in BedFormFactor.values():
|
||||
self._logger.warn("Profile has invalid value volume.formFactor: {formFactor}".format(formFactor=profile["volume"]["formFactor"]))
|
||||
return False
|
||||
|
||||
@@ -530,11 +565,11 @@ class PrinterProfileManager(object):
|
||||
return False
|
||||
|
||||
# ensure origin and form factor combination is legal
|
||||
if profile["volume"]["formFactor"] == BedTypes.CIRCULAR and not profile["volume"]["origin"] == BedOrigin.CENTER:
|
||||
if profile["volume"]["formFactor"] == BedFormFactor.CIRCULAR and not profile["volume"]["origin"] == BedOrigin.CENTER:
|
||||
profile["volume"]["origin"] = BedOrigin.CENTER
|
||||
|
||||
# force width and depth of volume to be identical for circular beds, with width being the reference
|
||||
if profile["volume"]["formFactor"] == BedTypes.CIRCULAR:
|
||||
if profile["volume"]["formFactor"] == BedFormFactor.CIRCULAR:
|
||||
profile["volume"]["depth"] = profile["volume"]["width"]
|
||||
|
||||
# if we have a custom bounding box, validate it
|
||||
|
||||
@@ -17,6 +17,8 @@ import time
|
||||
|
||||
from past.builtins import basestring
|
||||
|
||||
from frozendict import frozendict
|
||||
|
||||
from octoprint import util as util
|
||||
from octoprint.events import eventManager, Events
|
||||
from octoprint.filemanager import FileDestinations, NoSuchStorage, valid_file_type
|
||||
@@ -40,6 +42,8 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
|
||||
self._logger = logging.getLogger(__name__)
|
||||
|
||||
self._dict = frozendict if settings().getBoolean(["devel", "useFrozenDictForPrinterState"]) else dict
|
||||
|
||||
self._analysisQueue = analysisQueue
|
||||
self._fileManager = fileManager
|
||||
self._printerProfileManager = printerProfileManager
|
||||
@@ -100,25 +104,23 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
on_get_progress=self._updateProgressDataCallback
|
||||
)
|
||||
self._stateMonitor.reset(
|
||||
state={"text": self.get_state_string(), "flags": self._getStateFlags()},
|
||||
job_data={
|
||||
"file": {
|
||||
"name": None,
|
||||
"path": None,
|
||||
"size": None,
|
||||
"origin": None,
|
||||
"date": None
|
||||
},
|
||||
"estimatedPrintTime": None,
|
||||
"lastPrintTime": None,
|
||||
"filament": {
|
||||
"length": None,
|
||||
"volume": None
|
||||
}
|
||||
},
|
||||
progress={"completion": None, "filepos": None, "printTime": None, "printTimeLeft": None},
|
||||
state=self._dict(text=self.get_state_string(), flags=self._getStateFlags()),
|
||||
job_data=self._dict(file=self._dict(name=None,
|
||||
path=None,
|
||||
size=None,
|
||||
origin=None,
|
||||
date=None),
|
||||
estimatedPrintTime=None,
|
||||
lastPrintTime=None,
|
||||
filament=self._dict(length=None,
|
||||
volume=None)),
|
||||
progress=self._dict(completion=None,
|
||||
filepos=None,
|
||||
printTime=None,
|
||||
printTimeLeft=None,
|
||||
printTimeOrigin=None),
|
||||
current_z=None,
|
||||
offsets=dict()
|
||||
offsets=self._dict()
|
||||
)
|
||||
|
||||
eventManager().subscribe(Events.METADATA_ANALYSIS_FINISHED, self._on_event_MetadataAnalysisFinished)
|
||||
@@ -139,23 +141,31 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
|
||||
def _sendAddTemperatureCallbacks(self, data):
|
||||
for callback in self._callbacks:
|
||||
try: callback.on_printer_add_temperature(data)
|
||||
except: self._logger.exception("Exception while adding temperature data point")
|
||||
try:
|
||||
callback.on_printer_add_temperature(data)
|
||||
except:
|
||||
self._logger.exception(u"Exception while adding temperature data point to callback {}".format(callback))
|
||||
|
||||
def _sendAddLogCallbacks(self, data):
|
||||
for callback in self._callbacks:
|
||||
try: callback.on_printer_add_log(data)
|
||||
except: self._logger.exception("Exception while adding communication log entry")
|
||||
try:
|
||||
callback.on_printer_add_log(data)
|
||||
except:
|
||||
self._logger.exception(u"Exception while adding communication log entry to callback {}".format(callback))
|
||||
|
||||
def _sendAddMessageCallbacks(self, data):
|
||||
for callback in self._callbacks:
|
||||
try: callback.on_printer_add_message(data)
|
||||
except: self._logger.exception("Exception while adding printer message")
|
||||
try:
|
||||
callback.on_printer_add_message(data)
|
||||
except:
|
||||
self._logger.exception(u"Exception while adding printer message to callback {}".format(callback))
|
||||
|
||||
def _sendCurrentDataCallbacks(self, data):
|
||||
for callback in self._callbacks:
|
||||
try: callback.on_printer_send_current_data(copy.deepcopy(data))
|
||||
except: self._logger.exception("Exception while pushing current data")
|
||||
try:
|
||||
callback.on_printer_send_current_data(copy.deepcopy(data))
|
||||
except:
|
||||
self._logger.exception(u"Exception while pushing current data to callback {}".format(callback))
|
||||
|
||||
#~~ callback from metadata analysis event
|
||||
|
||||
@@ -233,10 +243,15 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
return self._comm.getTransport()
|
||||
getTransport = util.deprecated("getTransport has been renamed to get_transport", since="1.2.0-dev-590", includedoc="Replaced by :func:`get_transport`")
|
||||
|
||||
def job_on_hold(self, blocking=None, *args, **kwargs):
|
||||
def job_on_hold(self, blocking=True, *args, **kwargs):
|
||||
if self._comm is None:
|
||||
raise RuntimeError("No connection to the printer")
|
||||
return self._comm.job_on_hold(blocking=blocking)
|
||||
return self._comm.job_put_on_hold(blocking=blocking)
|
||||
|
||||
def set_job_on_hold(self, value, blocking=True, *args, **kwargs):
|
||||
if self._comm is None:
|
||||
raise RuntimeError("No connection to the printer")
|
||||
return self._comm.set_job_on_hold(value, blocking=blocking)
|
||||
|
||||
def fake_ack(self, *args, **kwargs):
|
||||
if self._comm is None:
|
||||
@@ -516,6 +531,12 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
# for further processing
|
||||
self._comm.cancelPrint(tags=kwargs.get("tags", set()) | {"trigger:printer.cancel_print"})
|
||||
|
||||
def log_lines(self, *lines):
|
||||
serial_logger = logging.getLogger("SERIAL")
|
||||
self.on_comm_log("\n".join(lines))
|
||||
for line in lines:
|
||||
serial_logger.debug(line)
|
||||
|
||||
def get_state_string(self, state=None, *args, **kwargs):
|
||||
if self._comm is None:
|
||||
return "Offline"
|
||||
@@ -578,6 +599,12 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
def is_printing(self, *args, **kwargs):
|
||||
return self._comm is not None and self._comm.isPrinting()
|
||||
|
||||
def is_cancelling(self, *args, **kwargs):
|
||||
return self._comm is not None and self._comm.isCancelling()
|
||||
|
||||
def is_pausing(self, *args, **kwargs):
|
||||
return self._comm is not None and self._comm.isPausing()
|
||||
|
||||
def is_paused(self, *args, **kwargs):
|
||||
return self._comm is not None and self._comm.isPaused()
|
||||
|
||||
@@ -668,7 +695,7 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
state_string = self.get_state_string()
|
||||
|
||||
self._state = state
|
||||
self._stateMonitor.set_state({"text": state_string, "flags": self._getStateFlags()})
|
||||
self._stateMonitor.set_state(self._dict(text=state_string, flags=self._getStateFlags()))
|
||||
|
||||
payload = dict(
|
||||
state_id=self.get_state_id(self._state),
|
||||
@@ -698,11 +725,12 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
|
||||
return result
|
||||
|
||||
def _updateProgressData(self, completion=None, filepos=None, printTime=None, printTimeLeft=None):
|
||||
self._stateMonitor.set_progress(dict(completion=int(completion * 100) if completion is not None else None,
|
||||
filepos=filepos,
|
||||
printTime=int(printTime) if printTime is not None else None,
|
||||
printTimeLeft=int(printTimeLeft) if printTimeLeft is not None else None))
|
||||
def _updateProgressData(self, completion=None, filepos=None, printTime=None, printTimeLeft=None, printTimeLeftOrigin=None):
|
||||
self._stateMonitor.set_progress(self._dict(completion=int(completion * 100) if completion is not None else None,
|
||||
filepos=filepos,
|
||||
printTime=int(printTime) if printTime is not None else None,
|
||||
printTimeLeft=int(printTimeLeft) if printTimeLeft is not None else None,
|
||||
printTimeLeftOrigin=printTimeLeftOrigin))
|
||||
|
||||
def _updateProgressDataCallback(self):
|
||||
if self._comm is None:
|
||||
@@ -732,11 +760,11 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
self._lastProgressReport = progress_int
|
||||
self._reportPrintProgressToPlugins(progress_int)
|
||||
|
||||
return dict(completion=progress * 100 if progress is not None else None,
|
||||
filepos=filepos,
|
||||
printTime=int(printTime) if printTime is not None else None,
|
||||
printTimeLeft=int(printTimeLeft) if printTimeLeft is not None else None,
|
||||
printTimeLeftOrigin=printTimeLeftOrigin)
|
||||
return self._dict(completion=progress * 100 if progress is not None else None,
|
||||
filepos=filepos,
|
||||
printTime=int(printTime) if printTime is not None else None,
|
||||
printTimeLeft=int(printTimeLeft) if printTimeLeft is not None else None,
|
||||
printTimeLeftOrigin=printTimeLeftOrigin)
|
||||
|
||||
def _estimatePrintTimeLeft(self, progress, printTime, cleanedPrintTime, statisticalTotalPrintTime, statisticalTotalPrintTimeType):
|
||||
"""
|
||||
@@ -858,28 +886,18 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
if tools is None:
|
||||
tools = dict()
|
||||
|
||||
currentTimeUtc = int(time.time())
|
||||
|
||||
data = {
|
||||
"time": currentTimeUtc
|
||||
}
|
||||
data = dict(time=int(time.time()))
|
||||
for tool in tools.keys():
|
||||
data["tool%d" % tool] = {
|
||||
"actual": tools[tool][0],
|
||||
"target": tools[tool][1]
|
||||
}
|
||||
data["tool%d" % tool] = self._dict(actual=tools[tool][0], target=tools[tool][1])
|
||||
if bed is not None and isinstance(bed, tuple):
|
||||
data["bed"] = {
|
||||
"actual": bed[0],
|
||||
"target": bed[1]
|
||||
}
|
||||
data["bed"] = self._dict(actual=bed[0], target=bed[1])
|
||||
|
||||
self._temps.append(data)
|
||||
|
||||
self._temp = tools
|
||||
self._bedTemp = bed
|
||||
|
||||
self._stateMonitor.add_temperature(data)
|
||||
self._stateMonitor.add_temperature(self._dict(**data))
|
||||
|
||||
def _validateJob(self, filename, sd):
|
||||
if not valid_file_type(filename, type="machinecode"):
|
||||
@@ -915,20 +933,16 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
}
|
||||
else:
|
||||
self._selectedFile = None
|
||||
self._stateMonitor.set_job_data({
|
||||
"file": {
|
||||
"name": None,
|
||||
"path": None,
|
||||
"display": None,
|
||||
"origin": None,
|
||||
"size": None,
|
||||
"date": None
|
||||
},
|
||||
"estimatedPrintTime": None,
|
||||
"averagePrintTime": None,
|
||||
"lastPrintTime": None,
|
||||
"filament": None,
|
||||
})
|
||||
self._stateMonitor.set_job_data(self._dict(file=self._dict(name=None,
|
||||
path=None,
|
||||
display=None,
|
||||
origin=None,
|
||||
size=None,
|
||||
date=None),
|
||||
estimatedPrintTime=None,
|
||||
averagePrintTime=None,
|
||||
lastPrintTime=None,
|
||||
filament=None))
|
||||
return
|
||||
|
||||
estimatedPrintTime = None
|
||||
@@ -970,20 +984,16 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
self._selectedFile["estimatedPrintTime"] = estimatedPrintTime
|
||||
self._selectedFile["estimatedPrintTimeType"] = "analysis"
|
||||
|
||||
self._stateMonitor.set_job_data({
|
||||
"file": {
|
||||
"name": name_in_storage,
|
||||
"path": path_in_storage,
|
||||
"display": display_name,
|
||||
"origin": FileDestinations.SDCARD if sd else FileDestinations.LOCAL,
|
||||
"size": filesize,
|
||||
"date": date
|
||||
},
|
||||
"estimatedPrintTime": estimatedPrintTime,
|
||||
"averagePrintTime": averagePrintTime,
|
||||
"lastPrintTime": lastPrintTime,
|
||||
"filament": filament,
|
||||
})
|
||||
self._stateMonitor.set_job_data(self._dict(file=self._dict(name=name_in_storage,
|
||||
path=path_in_storage,
|
||||
display=display_name,
|
||||
origin=FileDestinations.SDCARD if sd else FileDestinations.LOCAL,
|
||||
size=filesize,
|
||||
date=date),
|
||||
estimatedPrintTime=estimatedPrintTime,
|
||||
averagePrintTime=averagePrintTime,
|
||||
lastPrintTime=lastPrintTime,
|
||||
filament=filament))
|
||||
|
||||
def _sendInitialStateUpdate(self, callback):
|
||||
try:
|
||||
@@ -998,15 +1008,15 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
self._logger.exception("Error while trying to send initial state update")
|
||||
|
||||
def _getStateFlags(self):
|
||||
return {
|
||||
"operational": self.is_operational(),
|
||||
"printing": self.is_printing(),
|
||||
"closedOrError": self.is_closed_or_error(),
|
||||
"error": self.is_error(),
|
||||
"paused": self.is_paused(),
|
||||
"ready": self.is_ready(),
|
||||
"sdReady": self.is_sd_ready()
|
||||
}
|
||||
return self._dict(operational=self.is_operational(),
|
||||
printing=self.is_printing(),
|
||||
cancelling=self.is_cancelling(),
|
||||
pausing=self.is_pausing(),
|
||||
closedOrError=self.is_closed_or_error(),
|
||||
error=self.is_error(),
|
||||
paused=self.is_paused(),
|
||||
ready=self.is_ready(),
|
||||
sdReady=self.is_sd_ready())
|
||||
|
||||
#~~ comm.MachineComPrintCallback implementation
|
||||
|
||||
@@ -1096,7 +1106,7 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
self._setCurrentZ(newZ)
|
||||
|
||||
def on_comm_sd_state_change(self, sdReady):
|
||||
self._stateMonitor.set_state({"text": self.get_state_string(), "flags": self._getStateFlags()})
|
||||
self._stateMonitor.set_state(self._dict(text=self.get_state_string(), flags=self._getStateFlags()))
|
||||
|
||||
def on_comm_sd_files(self, files):
|
||||
eventManager().fire(Events.UPDATED_FILES, {"type": "gcode"})
|
||||
@@ -1111,7 +1121,7 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
eventManager().fire(Events.FILE_DESELECTED)
|
||||
|
||||
self._setJobData(full_path, size, sd)
|
||||
self._stateMonitor.set_state({"text": self.get_state_string(), "flags": self._getStateFlags()})
|
||||
self._stateMonitor.set_state(self._dict(text=self.get_state_string(), flags=self._getStateFlags()))
|
||||
|
||||
if self._printAfterSelect:
|
||||
self._printAfterSelect = False
|
||||
@@ -1135,7 +1145,7 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
filepos=payload["size"],
|
||||
printTime=payload["time"],
|
||||
printTimeLeft=0)
|
||||
self._stateMonitor.set_state({"text": self.get_state_string(), "flags": self._getStateFlags()})
|
||||
self._stateMonitor.set_state(self._dict(text=self.get_state_string(), flags=self._getStateFlags()))
|
||||
|
||||
eventManager().fire(Events.PRINT_DONE, payload)
|
||||
self.script("afterPrintDone",
|
||||
@@ -1156,13 +1166,20 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
|
||||
else:
|
||||
self._updateProgressData()
|
||||
self._stateMonitor.set_state({"text": self.get_state_string(), "flags": self._getStateFlags()})
|
||||
self._stateMonitor.set_state(self._dict(text=self.get_state_string(), flags=self._getStateFlags()))
|
||||
|
||||
|
||||
def on_comm_print_job_failed(self):
|
||||
payload = self._payload_for_print_job_event()
|
||||
eventManager().fire(Events.PRINT_FAILED, payload)
|
||||
|
||||
def on_comm_print_job_cancelling(self, firmware_error=None):
|
||||
payload = self._payload_for_print_job_event()
|
||||
if payload:
|
||||
if firmware_error:
|
||||
payload["firmwareError"] = firmware_error
|
||||
eventManager().fire(Events.PRINT_CANCELLING, payload)
|
||||
|
||||
def on_comm_print_job_cancelled(self):
|
||||
self._setCurrentZ(None)
|
||||
self._updateProgressData()
|
||||
@@ -1210,7 +1227,7 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
|
||||
self._setJobData(filename, filesize, True)
|
||||
self._updateProgressData(completion=0.0, filepos=0, printTime=0)
|
||||
self._stateMonitor.set_state({"text": self.get_state_string(), "flags": self._getStateFlags()})
|
||||
self._stateMonitor.set_state(self._dict(text=self.get_state_string(), flags=self._getStateFlags()))
|
||||
|
||||
def on_comm_file_transfer_done(self, filename, failed=False):
|
||||
self._sdStreaming = False
|
||||
@@ -1227,7 +1244,7 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
self._setCurrentZ(None)
|
||||
self._setJobData(None, None, None)
|
||||
self._updateProgressData()
|
||||
self._stateMonitor.set_state({"text": self.get_state_string(), "flags": self._getStateFlags()})
|
||||
self._stateMonitor.set_state(self._dict(text=self.get_state_string(), flags=self._getStateFlags()))
|
||||
|
||||
def on_comm_file_transfer_failed(self, filename):
|
||||
self.on_comm_file_transfer_done(filename, failed=True)
|
||||
|
||||
@@ -218,6 +218,7 @@ class Server(object):
|
||||
safe_mode = self._safe_mode
|
||||
|
||||
self._logger = logging.getLogger(__name__)
|
||||
self._setup_heartbeat_logging()
|
||||
pluginManager = self._plugin_manager
|
||||
|
||||
# monkey patch some stuff
|
||||
@@ -449,18 +450,6 @@ class Server(object):
|
||||
# setup jinja2
|
||||
self._setup_jinja2()
|
||||
|
||||
# make sure plugin lifecycle events relevant for jinja2 are taken care of
|
||||
def template_enabled(name, plugin):
|
||||
if plugin.implementation is None or not isinstance(plugin.implementation, octoprint.plugin.TemplatePlugin):
|
||||
return
|
||||
self._register_additional_template_plugin(plugin.implementation)
|
||||
def template_disabled(name, plugin):
|
||||
if plugin.implementation is None or not isinstance(plugin.implementation, octoprint.plugin.TemplatePlugin):
|
||||
return
|
||||
self._unregister_additional_template_plugin(plugin.implementation)
|
||||
pluginLifecycleManager.add_callback("enabled", template_enabled)
|
||||
pluginLifecycleManager.add_callback("disabled", template_disabled)
|
||||
|
||||
# setup assets
|
||||
self._setup_assets()
|
||||
|
||||
@@ -472,20 +461,8 @@ class Server(object):
|
||||
if self._debug:
|
||||
events.DebugEventListener()
|
||||
|
||||
loginManager = LoginManager()
|
||||
loginManager.session_protection = "strong"
|
||||
loginManager.user_callback = load_user
|
||||
loginManager.anonymous_user = users.AnonymousUser # TODO: remove in 1.5.0
|
||||
loginManager.unauthorized_callback = unauthorized_user
|
||||
|
||||
# login users authenticated by basic auth
|
||||
if self._settings.get(["accessControl", "trustBasicAuthentication"]):
|
||||
loginManager.request_callback = load_user_from_request
|
||||
|
||||
if not userManager.enabled:
|
||||
loginManager.anonymous_user = users.DummyUser
|
||||
principals.identity_loaders.appendleft(users.dummy_identity_loader)
|
||||
loginManager.init_app(app, add_context_processor=False)
|
||||
# setup login manager
|
||||
self._setup_login_manager()
|
||||
|
||||
# register API blueprint
|
||||
self._setup_blueprints()
|
||||
@@ -550,7 +527,8 @@ class Server(object):
|
||||
download_handler_kwargs,
|
||||
no_hidden_files_validator,
|
||||
additional_mime_types)),
|
||||
(r"/downloads/logs/([^/]*)", util.tornado.LargeResponseHandler, joined_dict(dict(path=self._settings.getBaseFolder("logs")),
|
||||
(r"/downloads/logs/([^/]*)", util.tornado.LargeResponseHandler, joined_dict(dict(path=self._settings.getBaseFolder("logs"),
|
||||
mime_type_guesser=lambda *args, **kwargs: "text/plain"),
|
||||
download_handler_kwargs,
|
||||
admin_validator)),
|
||||
# camera snapshot
|
||||
@@ -792,16 +770,28 @@ class Server(object):
|
||||
|
||||
return Locale.parse(request.accept_languages.best_match(LANGUAGES))
|
||||
|
||||
def _setup_app(self, app):
|
||||
from octoprint.server.util.flask import ReverseProxiedEnvironment, OctoPrintFlaskRequest, OctoPrintFlaskResponse, deprecate_flaskext
|
||||
def _setup_heartbeat_logging(self):
|
||||
logger = logging.getLogger(__name__ + ".heartbeat")
|
||||
|
||||
deprecate_flaskext() # TODO: remove in OctoPrint 1.5.0
|
||||
def log_heartbeat():
|
||||
logger.info("Server heartbeat <3")
|
||||
|
||||
interval = settings().getFloat(["server", "heartbeat"])
|
||||
logger.info("Starting server heartbeat, {}s interval".format(interval))
|
||||
|
||||
timer = octoprint.util.RepeatedTimer(interval, log_heartbeat)
|
||||
timer.start()
|
||||
|
||||
def _setup_app(self, app):
|
||||
from octoprint.server.util.flask import ReverseProxiedEnvironment, OctoPrintFlaskRequest, OctoPrintFlaskResponse, OctoPrintJsonEncoder
|
||||
|
||||
s = settings()
|
||||
|
||||
app.debug = self._debug
|
||||
app.config["TEMPLATES_AUTO_RELOAD"] = True
|
||||
|
||||
app.json_encoder = OctoPrintJsonEncoder
|
||||
|
||||
secret_key = s.get(["server", "secretKey"])
|
||||
if not secret_key:
|
||||
import string
|
||||
@@ -942,6 +932,18 @@ class Server(object):
|
||||
|
||||
self._register_template_plugins()
|
||||
|
||||
# make sure plugin lifecycle events relevant for jinja2 are taken care of
|
||||
def template_enabled(name, plugin):
|
||||
if plugin.implementation is None or not isinstance(plugin.implementation, octoprint.plugin.TemplatePlugin):
|
||||
return
|
||||
self._register_additional_template_plugin(plugin.implementation)
|
||||
def template_disabled(name, plugin):
|
||||
if plugin.implementation is None or not isinstance(plugin.implementation, octoprint.plugin.TemplatePlugin):
|
||||
return
|
||||
self._unregister_additional_template_plugin(plugin.implementation)
|
||||
pluginLifecycleManager.add_callback("enabled", template_enabled)
|
||||
pluginLifecycleManager.add_callback("disabled", template_disabled)
|
||||
|
||||
def _execute_preemptive_flask_caching(self, preemptive_cache):
|
||||
from werkzeug.test import EnvironBuilder
|
||||
import time
|
||||
@@ -1436,6 +1438,24 @@ class Server(object):
|
||||
assets.register("less_plugins", less_plugins_bundle)
|
||||
assets.register("less_app", less_app_bundle)
|
||||
|
||||
def _setup_login_manager(self):
|
||||
util.flask.fix_flask_login_remote_address()
|
||||
|
||||
loginManager = LoginManager()
|
||||
loginManager.session_protection = "strong"
|
||||
loginManager.user_callback = load_user
|
||||
loginManager.anonymous_user = users.AnonymousUser # TODO: remove in 1.5.0
|
||||
loginManager.unauthorized_callback = unauthorized_user
|
||||
|
||||
# login users authenticated by basic auth
|
||||
if self._settings.get(["accessControl", "trustBasicAuthentication"]):
|
||||
loginManager.request_callback = load_user_from_request
|
||||
|
||||
if not userManager.enabled:
|
||||
loginManager.anonymous_user = users.DummyUser
|
||||
principals.identity_loaders.appendleft(users.dummy_identity_loader)
|
||||
loginManager.init_app(app, add_context_processor=False)
|
||||
|
||||
def _start_intermediary_server(self):
|
||||
import BaseHTTPServer
|
||||
import SimpleHTTPServer
|
||||
|
||||
@@ -340,6 +340,7 @@ def utilTestPath():
|
||||
url = data["url"]
|
||||
method = data.get("method", "HEAD")
|
||||
timeout = 3.0
|
||||
valid_ssl = True
|
||||
check_status = [status_ranges["normal"]]
|
||||
|
||||
if "timeout" in data:
|
||||
@@ -348,6 +349,9 @@ def utilTestPath():
|
||||
except:
|
||||
return make_response("{!r} is not a valid value for timeout (must be int or float)".format(data["timeout"]), 400)
|
||||
|
||||
if "validSsl" in data:
|
||||
valid_ssl = data["validSsl"] in valid_boolean_trues
|
||||
|
||||
if "status" in data:
|
||||
request_status = data["status"]
|
||||
if not isinstance(request_status, list):
|
||||
@@ -366,7 +370,7 @@ def utilTestPath():
|
||||
check_status.append([code])
|
||||
|
||||
try:
|
||||
response = requests.request(method=method, url=url, timeout=timeout)
|
||||
response = requests.request(method=method, url=url, timeout=timeout, verify=valid_ssl)
|
||||
status = response.status_code
|
||||
except:
|
||||
status = 0
|
||||
|
||||
@@ -101,6 +101,8 @@ def getSettings():
|
||||
"streamRatio": s.get(["webcam", "streamRatio"]),
|
||||
"streamTimeout": s.getInt(["webcam", "streamTimeout"]),
|
||||
"snapshotUrl": s.get(["webcam", "snapshot"]),
|
||||
"snapshotTimeout": s.getInt(["webcam", "snapshotTimeout"]),
|
||||
"snapshotSslValidation": s.getBoolean(["webcam", "snapshotSslValidation"]),
|
||||
"ffmpegPath": s.get(["webcam", "ffmpeg"]),
|
||||
"bitrate": s.get(["webcam", "bitrate"]),
|
||||
"ffmpegThreads": s.get(["webcam", "ffmpegThreads"]),
|
||||
@@ -137,6 +139,7 @@ def getSettings():
|
||||
"timeoutTemperatureTargetSet": s.getFloat(["serial", "timeout", "temperatureTargetSet"]),
|
||||
"timeoutTemperatureAutoreport": s.getFloat(["serial", "timeout", "temperatureAutoreport"]),
|
||||
"timeoutSdStatus": s.getFloat(["serial", "timeout", "sdStatus"]),
|
||||
"timeoutSdStatusAutoreport": s.getFloat(["serial", "timeout", "sdStatusAutoreport"]),
|
||||
"log": s.getBoolean(["serial", "log"]),
|
||||
"additionalPorts": s.get(["serial", "additionalPorts"]),
|
||||
"additionalBaudrates": s.get(["serial", "additionalBaudrates"]),
|
||||
@@ -148,7 +151,7 @@ def getSettings():
|
||||
"triggerOkForM29": s.getBoolean(["serial", "triggerOkForM29"]),
|
||||
"logPositionOnPause": s.getBoolean(["serial", "logPositionOnPause"]),
|
||||
"logPositionOnCancel": s.getBoolean(["serial", "logPositionOnCancel"]),
|
||||
"supportResendsWithoutOk": s.getBoolean(["serial", "supportResendsWithoutOk"]),
|
||||
"supportResendsWithoutOk": s.get(["serial", "supportResendsWithoutOk"]),
|
||||
"waitForStart": s.getBoolean(["serial", "waitForStartOnConnect"]),
|
||||
"alwaysSendChecksum": s.getBoolean(["serial", "alwaysSendChecksum"]),
|
||||
"neverSendChecksum": s.getBoolean(["serial", "neverSendChecksum"]),
|
||||
@@ -164,6 +167,7 @@ def getSettings():
|
||||
"maxTimeoutsPrinting": s.getInt(["serial", "maxCommunicationTimeouts", "printing"]),
|
||||
"maxTimeoutsLong": s.getInt(["serial", "maxCommunicationTimeouts", "long"]),
|
||||
"capAutoreportTemp": s.getBoolean(["serial", "capabilities", "autoreport_temp"]),
|
||||
"capAutoreportSdStatus": s.getBoolean(["serial", "capabilities", "autoreport_sdstatus"]),
|
||||
"capBusyProtocol": s.getBoolean(["serial", "capabilities", "busy_protocol"])
|
||||
},
|
||||
"folder": {
|
||||
@@ -335,6 +339,8 @@ def _saveSettings(data):
|
||||
if "streamRatio" in data["webcam"] and data["webcam"]["streamRatio"] in ("16:9", "4:3"): s.set(["webcam", "streamRatio"], data["webcam"]["streamRatio"])
|
||||
if "streamTimeout" in data["webcam"]: s.setInt(["webcam", "streamTimeout"], data["webcam"]["streamTimeout"])
|
||||
if "snapshotUrl" in data["webcam"]: s.set(["webcam", "snapshot"], data["webcam"]["snapshotUrl"])
|
||||
if "snapshotTimeout" in data["webcam"]: s.setInt(["webcam", "snapshotTimeout"], data["webcam"]["snapshotTimeout"])
|
||||
if "snapshotSslValidation" in data["webcam"]: s.setBoolean(["webcam", "snapshotSslValidation"], data["webcam"]["snapshotSslValidation"])
|
||||
if "ffmpegPath" in data["webcam"]: s.set(["webcam", "ffmpeg"], data["webcam"]["ffmpegPath"])
|
||||
if "bitrate" in data["webcam"]: s.set(["webcam", "bitrate"], data["webcam"]["bitrate"])
|
||||
if "ffmpegThreads" in data["webcam"]: s.setInt(["webcam", "ffmpegThreads"], data["webcam"]["ffmpegThreads"])
|
||||
@@ -369,6 +375,7 @@ def _saveSettings(data):
|
||||
if "timeoutTemperatureTargetSet" in data["serial"]: s.setFloat(["serial", "timeout", "temperatureTargetSet"], data["serial"]["timeoutTemperatureTargetSet"])
|
||||
if "timeoutTemperatureAutoreport" in data["serial"]: s.setFloat(["serial", "timeout", "temperatureAutoreport"], data["serial"]["timeoutTemperatureAutoreport"])
|
||||
if "timeoutSdStatus" in data["serial"]: s.setFloat(["serial", "timeout", "sdStatus"], data["serial"]["timeoutSdStatus"])
|
||||
if "timeoutSdStatusAutoreport" in data["serial"]: s.setFloat(["serial", "timeout", "sdStatusAutoreport"], data["serial"]["timeoutSdStatusAutoreport"])
|
||||
if "additionalPorts" in data["serial"] and isinstance(data["serial"]["additionalPorts"], (list, tuple)): s.set(["serial", "additionalPorts"], data["serial"]["additionalPorts"])
|
||||
if "additionalBaudrates" in data["serial"] and isinstance(data["serial"]["additionalBaudrates"], (list, tuple)): s.set(["serial", "additionalBaudrates"], data["serial"]["additionalBaudrates"])
|
||||
if "longRunningCommands" in data["serial"] and isinstance(data["serial"]["longRunningCommands"], (list, tuple)): s.set(["serial", "longRunningCommands"], data["serial"]["longRunningCommands"])
|
||||
@@ -377,7 +384,10 @@ def _saveSettings(data):
|
||||
if "ignoreErrorsFromFirmware" in data["serial"]: s.setBoolean(["serial", "ignoreErrorsFromFirmware"], data["serial"]["ignoreErrorsFromFirmware"])
|
||||
if "disconnectOnErrors" in data["serial"]: s.setBoolean(["serial", "disconnectOnErrors"], data["serial"]["disconnectOnErrors"])
|
||||
if "triggerOkForM29" in data["serial"]: s.setBoolean(["serial", "triggerOkForM29"], data["serial"]["triggerOkForM29"])
|
||||
if "supportResendsWithoutOk" in data["serial"]: s.setBoolean(["serial", "supportResendsWithoutOk"], data["serial"]["supportResendsWithoutOk"])
|
||||
if "supportResendsWithoutOk" in data["serial"]:
|
||||
value = data["serial"]["supportResendsWithoutOk"]
|
||||
if value in ("always", "detect", "never"):
|
||||
s.set(["serial", "supportResendsWithoutOk"], value)
|
||||
if "waitForStart" in data["serial"]: s.setBoolean(["serial", "waitForStartOnConnect"], data["serial"]["waitForStart"])
|
||||
if "alwaysSendChecksum" in data["serial"]: s.setBoolean(["serial", "alwaysSendChecksum"], data["serial"]["alwaysSendChecksum"])
|
||||
if "neverSendChecksum" in data["serial"]: s.setBoolean(["serial", "neverSendChecksum"], data["serial"]["neverSendChecksum"])
|
||||
@@ -395,6 +405,7 @@ def _saveSettings(data):
|
||||
if "maxTimeoutsPrinting" in data["serial"]: s.setInt(["serial", "maxCommunicationTimeouts", "printing"], data["serial"]["maxTimeoutsPrinting"])
|
||||
if "maxTimeoutsLong" in data["serial"]: s.setInt(["serial", "maxCommunicationTimeouts", "long"], data["serial"]["maxTimeoutsLong"])
|
||||
if "capAutoreportTemp" in data["serial"]: s.setBoolean(["serial", "capabilities", "autoreport_temp"], data["serial"]["capAutoreportTemp"])
|
||||
if "capAutoreportSdStatus" in data["serial"]: s.setBoolean(["serial", "capabilities", "autoreport_sdstatus"], data["serial"]["capAutoreportSdStatus"])
|
||||
if "capBusyProtocol" in data["serial"]: s.setBoolean(["serial", "capabilities", "busy_protocol"], data["serial"]["capBusyProtocol"])
|
||||
|
||||
oldLog = s.getBoolean(["serial", "log"])
|
||||
|
||||
@@ -43,8 +43,7 @@ def _config_for_timelapse(timelapse):
|
||||
return dict(type="timed",
|
||||
postRoll=timelapse.post_roll,
|
||||
fps=timelapse.fps,
|
||||
interval=timelapse.interval,
|
||||
capturePostRoll=timelapse.capture_post_roll)
|
||||
interval=timelapse.interval)
|
||||
else:
|
||||
return dict(type="off")
|
||||
|
||||
@@ -216,14 +215,6 @@ def setTimelapseConfig():
|
||||
else:
|
||||
return make_response("Invalid value for interval: %d" % interval, 400)
|
||||
|
||||
if "capturePostRoll" in data:
|
||||
try:
|
||||
capturePostRoll = bool(data["capturePostRoll"])
|
||||
except ValueError:
|
||||
return make_response("Invalid value for capturePostRoll: %r" % data["capturePostRoll"], 400)
|
||||
else:
|
||||
config["options"]["capturePostRoll"] = capturePostRoll
|
||||
|
||||
if "retractionZHop" in data:
|
||||
try:
|
||||
retractionZHop = float(data["retractionZHop"])
|
||||
|
||||
@@ -18,7 +18,6 @@ from octoprint.plugin import plugin_manager
|
||||
import flask as _flask
|
||||
import flask_login
|
||||
import flask_principal
|
||||
|
||||
import logging
|
||||
|
||||
from . import flask
|
||||
|
||||
@@ -8,6 +8,7 @@ __copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms
|
||||
|
||||
import tornado.web
|
||||
import flask
|
||||
import flask.json
|
||||
import flask_login
|
||||
import flask_principal
|
||||
import flask_assets
|
||||
@@ -29,6 +30,7 @@ import octoprint.users
|
||||
import octoprint.plugin
|
||||
|
||||
from octoprint.util import DefaultOrderedDict
|
||||
from octoprint.util.json import JsonEncoding
|
||||
|
||||
from werkzeug.contrib.cache import BaseCache
|
||||
|
||||
@@ -234,26 +236,19 @@ def fix_webassets_filtertool():
|
||||
|
||||
FilterTool._wrap_cache = fixed_wrap_cache
|
||||
|
||||
# TODO: Remove compatibility layer in OctoPrint 1.5.0
|
||||
def deprecate_flaskext():
|
||||
import flask
|
||||
import importlib
|
||||
def fix_flask_login_remote_address():
|
||||
def fixed_get_remote_addr():
|
||||
"""Backported from https://github.com/maxcountryman/flask-login/pull/217"""
|
||||
|
||||
class FlaskExtDeprecator(object):
|
||||
from flask import request
|
||||
address = request.headers.get('X-Forwarded-For', request.remote_addr)
|
||||
if address is not None:
|
||||
# An 'X-Forwarded-For' header includes a comma separated list of the
|
||||
# addresses, the first address being the actual remote address.
|
||||
address = address.encode('utf-8').split(b',')[0].strip()
|
||||
return address
|
||||
|
||||
def __getattr__(self, item):
|
||||
old_name = "flask.ext.{}".format(item)
|
||||
new_name = "flask_{}".format(item)
|
||||
module = importlib.import_module(new_name)
|
||||
|
||||
from warnings import warn
|
||||
message = "The {old} import is deprecated in Flask versions >= 0.11, which OctoPrint now uses. " + \
|
||||
"Import {new} instead. This compatibility layer will be removed in OctoPrint 1.5.0."
|
||||
warn(DeprecationWarning(message.format(old=old_name, new=new_name)), stacklevel=2)
|
||||
|
||||
return module
|
||||
|
||||
flask.ext = FlaskExtDeprecator()
|
||||
flask_login._get_remote_addr = fixed_get_remote_addr
|
||||
|
||||
#~~ WSGI environment wrapper for reverse proxying
|
||||
|
||||
@@ -512,7 +507,8 @@ def passive_login():
|
||||
user = flask_login.current_user
|
||||
|
||||
if user is not None and not user.is_anonymous and user.is_active:
|
||||
flask_principal.identity_changed.send(flask.current_app._get_current_object(), identity=flask_principal.Identity(user.get_id()))
|
||||
flask_principal.identity_changed.send(flask.current_app._get_current_object(),
|
||||
identity=flask_principal.Identity(user.get_id()))
|
||||
if hasattr(user, "session"):
|
||||
flask.session["usersession.id"] = user.session
|
||||
flask.g.user = user
|
||||
@@ -535,7 +531,8 @@ def passive_login():
|
||||
flask.session["usersession.id"] = user.session
|
||||
flask.g.user = user
|
||||
flask_login.login_user(user)
|
||||
flask_principal.identity_changed.send(flask.current_app._get_current_object(), identity=flask_principal.Identity(user.get_id()))
|
||||
flask_principal.identity_changed.send(flask.current_app._get_current_object(),
|
||||
identity=flask_principal.Identity(user.get_id()))
|
||||
return flask.jsonify(user.asDict())
|
||||
except:
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -1419,3 +1416,9 @@ def collect_plugin_assets(enable_gcodeviewer=True, preferred_stylesheet="css"):
|
||||
break
|
||||
|
||||
return assets
|
||||
|
||||
##~~ JSON encoding
|
||||
|
||||
class OctoPrintJsonEncoder(flask.json.JSONEncoder):
|
||||
def default(self, obj):
|
||||
return JsonEncoding.encode(obj)
|
||||
@@ -9,6 +9,8 @@ import logging
|
||||
import threading
|
||||
import sockjs.tornado
|
||||
import sockjs.tornado.session
|
||||
import sockjs.tornado.proto
|
||||
import sockjs.tornado.util
|
||||
import time
|
||||
|
||||
import octoprint.timelapse
|
||||
@@ -18,9 +20,13 @@ import octoprint.plugin
|
||||
|
||||
from octoprint.events import Events
|
||||
from octoprint.settings import settings
|
||||
from octoprint.util.json import JsonEncoding
|
||||
|
||||
import octoprint.printer
|
||||
|
||||
import wrapt
|
||||
import json
|
||||
|
||||
|
||||
class ThreadSafeSession(sockjs.tornado.session.Session):
|
||||
def __init__(self, conn, server, session_id, expiry=None):
|
||||
@@ -50,8 +56,26 @@ class ThreadSafeSession(sockjs.tornado.session.Session):
|
||||
return result
|
||||
|
||||
|
||||
class JsonEncodingSessionWrapper(wrapt.ObjectProxy):
|
||||
|
||||
def send_message(self, msg, stats=True, binary=False):
|
||||
"""Send or queue outgoing message
|
||||
|
||||
`msg`
|
||||
Message to send
|
||||
`stats`
|
||||
If set to True, will update statistics after operation completes
|
||||
"""
|
||||
self.send_jsonified(json.dumps(sockjs.tornado.util.bytes_to_str(msg),
|
||||
separators=(',', ':'),
|
||||
default=JsonEncoding.encode),
|
||||
stats)
|
||||
|
||||
|
||||
class PrinterStateConnection(sockjs.tornado.SockJSConnection, octoprint.printer.PrinterCallback):
|
||||
def __init__(self, printer, fileManager, analysisQueue, userManager, eventManager, pluginManager, session):
|
||||
session = JsonEncodingSessionWrapper(session)
|
||||
|
||||
sockjs.tornado.SockJSConnection.__init__(self, session)
|
||||
|
||||
self._logger = logging.getLogger(__name__)
|
||||
@@ -82,6 +106,12 @@ class PrinterStateConnection(sockjs.tornado.SockJSConnection, octoprint.printer.
|
||||
return forwardedFor.split(",")[0]
|
||||
return info.ip
|
||||
|
||||
def __str__(self):
|
||||
if self._remoteAddress:
|
||||
return "{!r} connected to {}".format(self, self._remoteAddress)
|
||||
else:
|
||||
return "Unconnected {!r}".format(self)
|
||||
|
||||
def on_open(self, info):
|
||||
self._remoteAddress = self._getRemoteAddress(info)
|
||||
self._logger.info("New connection from client: %s" % self._remoteAddress)
|
||||
@@ -132,7 +162,6 @@ class PrinterStateConnection(sockjs.tornado.SockJSConnection, octoprint.printer.
|
||||
self._emit("event", {"type": Events.MOVIE_RENDERING, "payload": octoprint.timelapse.current_render_job})
|
||||
|
||||
def on_close(self):
|
||||
self._logger.info("Client connection closed: %s" % self._remoteAddress)
|
||||
self._printer.unregister_callback(self)
|
||||
self._fileManager.unregister_slicingprogress_callback(self)
|
||||
octoprint.timelapse.unregister_callback(self)
|
||||
@@ -142,6 +171,9 @@ class PrinterStateConnection(sockjs.tornado.SockJSConnection, octoprint.printer.
|
||||
for event in octoprint.events.all_events():
|
||||
self._eventManager.unsubscribe(event, self._onEvent)
|
||||
|
||||
self._logger.info("Client connection closed: %s" % self._remoteAddress)
|
||||
self._remoteAddress = None
|
||||
|
||||
def on_message(self, message):
|
||||
try:
|
||||
import json
|
||||
|
||||
@@ -98,7 +98,9 @@ default_settings = {
|
||||
"temperature": 5,
|
||||
"temperatureTargetSet": 2,
|
||||
"temperatureAutoreport": 2,
|
||||
"sdStatus": 1
|
||||
"sdStatus": 1,
|
||||
"sdStatusAutoreport": 1,
|
||||
"resendOk": .5
|
||||
},
|
||||
"maxCommunicationTimeouts": {
|
||||
"idle": 2,
|
||||
@@ -114,7 +116,7 @@ default_settings = {
|
||||
"disconnectOnErrors": True,
|
||||
"ignoreErrorsFromFirmware": False,
|
||||
"logResends": True,
|
||||
"supportResendsWithoutOk": False,
|
||||
"supportResendsWithoutOk": "detect",
|
||||
"logPositionOnPause": True,
|
||||
"logPositionOnCancel": True,
|
||||
"waitForStartOnConnect": False,
|
||||
@@ -136,6 +138,7 @@ default_settings = {
|
||||
|
||||
"capabilities": {
|
||||
"autoreport_temp": True,
|
||||
"autoreport_sdstatus": True,
|
||||
"busy_protocol": True
|
||||
},
|
||||
|
||||
@@ -149,6 +152,7 @@ default_settings = {
|
||||
"startOnceInSafeMode": False,
|
||||
"seenWizards": {},
|
||||
"secretKey": None,
|
||||
"heartbeat": 15 * 60, # 15 min
|
||||
"reverseProxy": {
|
||||
"prefixHeader": None,
|
||||
"schemeHeader": None,
|
||||
@@ -197,6 +201,8 @@ default_settings = {
|
||||
"streamRatio": "16:9",
|
||||
"streamTimeout": 5,
|
||||
"snapshot": None,
|
||||
"snapshotTimeout": 5,
|
||||
"snapshotSslValidation": True,
|
||||
"ffmpeg": None,
|
||||
"ffmpegThreads": 1,
|
||||
"bitrate": "5000k",
|
||||
@@ -274,7 +280,7 @@ default_settings = {
|
||||
"components": {
|
||||
"order": {
|
||||
"navbar": ["settings", "systemmenu", "plugin_announcements", "login"],
|
||||
"sidebar": ["connection", "state", "files"],
|
||||
"sidebar": ["plugin_printer_safety_check", "connection", "state", "files"],
|
||||
"tab": ["temperature", "control", "gcodeviewer", "terminal", "timelapse"],
|
||||
"settings": [
|
||||
"section_printer", "serial", "printerprofiles", "temperatures", "terminalfilters", "gcodescripts",
|
||||
@@ -328,7 +334,7 @@ default_settings = {
|
||||
},
|
||||
"terminalFilters": [
|
||||
{ "name": "Suppress temperature messages", "regex": "(Send: (N\d+\s+)?M105)|(Recv:\s+(ok\s+)?(B|T\d*):)" },
|
||||
{ "name": "Suppress SD status messages", "regex": "(Send: (N\d+\s+)?M27)|(Recv: SD printing byte)" },
|
||||
{ "name": "Suppress SD status messages", "regex": "(Send: (N\d+\s+)?M27)|(Recv: SD printing byte)|(Recv: Not SD printing)" },
|
||||
{ "name": "Suppress wait responses", "regex": "Recv: wait"}
|
||||
],
|
||||
"plugins": {
|
||||
@@ -362,6 +368,7 @@ default_settings = {
|
||||
"bundle": True,
|
||||
"clean_on_startup": True
|
||||
},
|
||||
"useFrozenDictForPrinterState": True,
|
||||
"virtualPrinter": {
|
||||
"enabled": False,
|
||||
"okAfterResend": False,
|
||||
@@ -385,6 +392,7 @@ default_settings = {
|
||||
"supportM112": True,
|
||||
"echoOnM117": True,
|
||||
"brokenM29": True,
|
||||
"brokenResend": False,
|
||||
"supportF": False,
|
||||
"firmwareName": "Virtual Marlin 1.0",
|
||||
"sharedNozzle": False,
|
||||
@@ -397,7 +405,8 @@ default_settings = {
|
||||
"m115FormatString": "FIRMWARE_NAME: {firmware_name} PROTOCOL_VERSION:1.0",
|
||||
"m115ReportCapabilities": False,
|
||||
"capabilities": {
|
||||
"AUTOREPORT_TEMP": True
|
||||
"AUTOREPORT_TEMP": True,
|
||||
"AUTOREPORT_SD_STATUS": True
|
||||
},
|
||||
"ambientTemperature": 21.3,
|
||||
"errors": {
|
||||
@@ -909,7 +918,8 @@ class Settings(object):
|
||||
self._migrate_printer_parameters,
|
||||
self._migrate_gcode_scripts,
|
||||
self._migrate_core_system_commands,
|
||||
self._migrate_serial_features
|
||||
self._migrate_serial_features,
|
||||
self._migrate_resend_without_ok
|
||||
)
|
||||
|
||||
for migrate in migrators:
|
||||
@@ -1216,6 +1226,22 @@ class Settings(object):
|
||||
|
||||
return changed
|
||||
|
||||
def _migrate_resend_without_ok(self, config):
|
||||
"""
|
||||
Migrates supportResendsWithoutOk flag from boolean to ("always", "detect", "never") value range.
|
||||
|
||||
True gets migrated to "always", False to "detect" (which is the new default).
|
||||
"""
|
||||
if "serial" in config and "supportResendsWithoutOk" in config["serial"] \
|
||||
and config["serial"]["supportResendsWithoutOk"] not in ("always", "detect", "never"):
|
||||
value = config["serial"]["supportResendsWithoutOk"]
|
||||
if value:
|
||||
config["serial"]["supportResendsWithoutOk"] = "always"
|
||||
else:
|
||||
config["serial"]["supportResendsWithoutOk"] = "detect"
|
||||
return True
|
||||
return False
|
||||
|
||||
def backup(self, suffix, path=None):
|
||||
import shutil
|
||||
|
||||
|
||||
@@ -377,9 +377,9 @@ class SlicingManager(object):
|
||||
|
||||
If it's a :class:`dict`, a new :class:`SlicingProfile` instance will be created with the supplied meta data and
|
||||
the profile data as the :attr:`~SlicingProfile.data` attribute.
|
||||
|
||||
|
||||
.. note::
|
||||
|
||||
|
||||
If the profile is the first profile to be saved for the slicer, it will automatically be marked as default.
|
||||
|
||||
Arguments:
|
||||
@@ -432,7 +432,7 @@ class SlicingManager(object):
|
||||
profile=name)
|
||||
event = octoprint.events.Events.SLICING_PROFILE_MODIFIED if is_overwrite else octoprint.events.Events.SLICING_PROFILE_ADDED
|
||||
octoprint.events.eventManager().fire(event, payload)
|
||||
|
||||
|
||||
if first_profile:
|
||||
# enforce the first profile we add for this slicer is set as default
|
||||
self.set_default_profile(slicer, name)
|
||||
@@ -557,16 +557,8 @@ class SlicingManager(object):
|
||||
if require_configured and not slicer in self.configured_slicers:
|
||||
raise SlicerNotConfigured(slicer)
|
||||
|
||||
profiles = dict()
|
||||
slicer_profile_path = self.get_slicer_profile_path(slicer)
|
||||
for entry in scandir(slicer_profile_path):
|
||||
if not entry.name.endswith(".profile") or octoprint.util.is_hidden_path(entry.name):
|
||||
# we are only interested in profiles and no hidden files
|
||||
continue
|
||||
|
||||
profile_name = entry.name[:-len(".profile")]
|
||||
profiles[profile_name] = self._load_profile_from_path(slicer, entry.path, require_configured=require_configured)
|
||||
return profiles
|
||||
return self.get_slicer(slicer).get_slicer_profiles(slicer_profile_path)
|
||||
|
||||
def profiles_last_modified(self, slicer):
|
||||
"""
|
||||
@@ -583,9 +575,7 @@ class SlicingManager(object):
|
||||
raise UnknownSlicer(slicer)
|
||||
|
||||
slicer_profile_path = self.get_slicer_profile_path(slicer)
|
||||
lms = [os.stat(slicer_profile_path).st_mtime]
|
||||
lms += [os.stat(entry.path).st_mtime for entry in scandir(slicer_profile_path) if entry.name.endswith(".profile")]
|
||||
return max(lms)
|
||||
return self.get_slicer(slicer).get_slicer_profiles_lastmodified(slicer_profile_path)
|
||||
|
||||
def get_slicer_profile_path(self, slicer):
|
||||
"""
|
||||
|
||||
@@ -1 +1 @@
|
||||
.btn{display:inline-block;*display:inline;*zoom:1;padding:4px 12px;margin-bottom:0;font-size:14px;line-height:20px;text-align:center;vertical-align:middle;cursor:pointer;color:#333;text-shadow:0 1px 1px rgba(255,255,255,.75);background-color:#f5f5f5;background-image:-moz-linear-gradient(top,#fff,#e6e6e6);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#e6e6e6));background-image:-webkit-linear-gradient(top,#fff,#e6e6e6);background-image:-o-linear-gradient(top,#fff,#e6e6e6);background-image:linear-gradient(to bottom,#fff,#e6e6e6);background-repeat:repeat-x;*background-color:#e6e6e6;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);border:1px solid #ccc;*border:0;border-bottom-color:#b3b3b3;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;*margin-left:.3em;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05)}.btn.active,.btn.disabled,.btn:active,.btn:focus,.btn:hover,.btn[disabled]{color:#333;background-color:#e6e6e6;*background-color:#d9d9d9}.btn.active,.btn:active{background-color:#ccc \9}.btn:first-child{*margin-left:0}.btn:focus,.btn:hover{color:#333;text-decoration:none;background-position:0 -15px;-webkit-transition:background-position .1s linear;-moz-transition:background-position .1s linear;-o-transition:background-position .1s linear;transition:background-position .1s linear}.btn:focus{outline:#333 dotted thin;outline:-webkit-focus-ring-color auto 5px;outline-offset:-2px}.btn.active,.btn:active{background-image:none;outline:0;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05)}.btn.disabled,.btn[disabled]{cursor:default;background-image:none;opacity:.65;filter:alpha(opacity=65);-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.btn-large{padding:11px 19px;font-size:17.5px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px}.btn-large [class*=" icon-"],.btn-large [class^=icon-]{margin-top:4px}.btn-small{padding:2px 10px;font-size:11.9px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.btn-small [class*=" icon-"],.btn-small [class^=icon-]{margin-top:0}.btn-mini [class*=" icon-"],.btn-mini [class^=icon-]{margin-top:-1px}.btn-mini{padding:0 6px;font-size:10.5px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.btn-block{display:block;width:100%;padding-left:0;padding-right:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.btn-block+.btn-block{margin-top:5px}input[type=submit].btn-block,input[type=reset].btn-block,input[type=button].btn-block{width:100%}.btn-primary{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#006dcc;background-image:-moz-linear-gradient(top,#08c,#04c);background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#04c));background-image:-webkit-linear-gradient(top,#08c,#04c);background-image:-o-linear-gradient(top,#08c,#04c);background-image:linear-gradient(to bottom,#08c,#04c);background-repeat:repeat-x;border-color:#04c #04c #002a80;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#04c;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-primary.active,.btn-primary.disabled,.btn-primary:active,.btn-primary:focus,.btn-primary:hover,.btn-primary[disabled]{color:#fff;background-color:#04c;*background-color:#003bb3}.btn-primary.active,.btn-primary:active{background-color:#039 \9}.btn-warning{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#faa732;background-image:-moz-linear-gradient(top,#fbb450,#f89406);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fbb450),to(#f89406));background-image:-webkit-linear-gradient(top,#fbb450,#f89406);background-image:-o-linear-gradient(top,#fbb450,#f89406);background-image:linear-gradient(to bottom,#fbb450,#f89406);background-repeat:repeat-x;border-color:#f89406 #f89406 #ad6704;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#f89406;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-warning.active,.btn-warning.disabled,.btn-warning:active,.btn-warning:focus,.btn-warning:hover,.btn-warning[disabled]{color:#fff;background-color:#f89406;*background-color:#df8505}.btn-warning.active,.btn-warning:active{background-color:#c67605 \9}.btn-danger{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#da4f49;background-image:-moz-linear-gradient(top,#ee5f5b,#bd362f);background-image:-webkit-gradient(linear,0 0,0 100%,from(#ee5f5b),to(#bd362f));background-image:-webkit-linear-gradient(top,#ee5f5b,#bd362f);background-image:-o-linear-gradient(top,#ee5f5b,#bd362f);background-image:linear-gradient(to bottom,#ee5f5b,#bd362f);background-repeaLine truncated
|
||||
.btn{display:inline-block;*display:inline;*zoom:1;padding:4px 12px;margin-bottom:0;font-size:14px;line-height:20px;text-align:center;vertical-align:middle;cursor:pointer;color:#333;text-shadow:0 1px 1px rgba(255,255,255,.75);background-color:#f5f5f5;background-image:-moz-linear-gradient(top,#fff,#e6e6e6);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#e6e6e6));background-image:-webkit-linear-gradient(top,#fff,#e6e6e6);background-image:-o-linear-gradient(top,#fff,#e6e6e6);background-image:linear-gradient(to bottom,#fff,#e6e6e6);background-repeat:repeat-x;*background-color:#e6e6e6;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);border:1px solid #ccc;*border:0;border-bottom-color:#b3b3b3;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;*margin-left:.3em;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05)}.btn.active,.btn.disabled,.btn:active,.btn:focus,.btn:hover,.btn[disabled]{color:#333;background-color:#e6e6e6;*background-color:#d9d9d9}.btn.active,.btn:active{background-color:#ccc \9}.btn:first-child{*margin-left:0}.btn:focus,.btn:hover{color:#333;text-decoration:none;background-position:0 -15px;-webkit-transition:background-position .1s linear;-moz-transition:background-position .1s linear;-o-transition:background-position .1s linear;transition:background-position .1s linear}.btn:focus{outline:#333 dotted thin;outline:-webkit-focus-ring-color auto 5px;outline-offset:-2px}.btn.active,.btn:active{background-image:none;outline:0;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05)}.btn.disabled,.btn[disabled]{cursor:default;background-image:none;opacity:.65;filter:alpha(opacity=65);-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.btn-large{padding:11px 19px;font-size:17.5px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px}.btn-large [class*=" icon-"],.btn-large [class^=icon-]{margin-top:4px}.btn-small{padding:2px 10px;font-size:11.9px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.btn-small [class*=" icon-"],.btn-small [class^=icon-]{margin-top:0}.btn-mini [class*=" icon-"],.btn-mini [class^=icon-]{margin-top:-1px}.btn-mini{padding:0 6px;font-size:10.5px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.btn-block{display:block;width:100%;padding-left:0;padding-right:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.btn-block+.btn-block{margin-top:5px}input[type=submit].btn-block,input[type=reset].btn-block,input[type=button].btn-block{width:100%}.btn-primary{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#006dcc;background-image:-moz-linear-gradient(top,#08c,#04c);background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#04c));background-image:-webkit-linear-gradient(top,#08c,#04c);background-image:-o-linear-gradient(top,#08c,#04c);background-image:linear-gradient(to bottom,#08c,#04c);background-repeat:repeat-x;border-color:#04c #04c #002a80;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#04c;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-primary.active,.btn-primary.disabled,.btn-primary:active,.btn-primary:focus,.btn-primary:hover,.btn-primary[disabled]{color:#fff;background-color:#04c;*background-color:#003bb3}.btn-primary.active,.btn-primary:active{background-color:#039 \9}.btn-warning{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#faa732;background-image:-moz-linear-gradient(top,#fbb450,#f89406);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fbb450),to(#f89406));background-image:-webkit-linear-gradient(top,#fbb450,#f89406);background-image:-o-linear-gradient(top,#fbb450,#f89406);background-image:linear-gradient(to bottom,#fbb450,#f89406);background-repeat:repeat-x;border-color:#f89406 #f89406 #ad6704;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#f89406;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-warning.active,.btn-warning.disabled,.btn-warning:active,.btn-warning:focus,.btn-warning:hover,.btn-warning[disabled]{color:#fff;background-color:#f89406;*background-color:#df8505}.btn-warning.active,.btn-warning:active{background-color:#c67605 \9}.btn-danger{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#da4f49;background-image:-moz-linear-gradient(top,#ee5f5b,#bd362f);background-image:-webkit-gradient(linear,0 0,0 100%,from(#ee5f5b),to(#bd362f));background-image:-webkit-linear-gradient(top,#ee5f5b,#bd362f);background-image:-o-linear-gradient(top,#ee5f5b,#bd362f);background-image:linear-gradient(to bottom,#ee5f5b,#bd362f);background-repeaLine truncated
|
||||
@@ -335,7 +335,7 @@ var doParse = function () {
|
||||
|
||||
var log = false;
|
||||
|
||||
if (/^(?:G0|G1|G2|G3)\s/i.test(line)) {
|
||||
if (/^(?:G0|G1|G2|G3)(\.\d+)?\s/i.test(line)) {
|
||||
args = line.split(/\s/);
|
||||
|
||||
for (j = 0; j < args.length; j++) {
|
||||
@@ -426,25 +426,25 @@ var doParse = function () {
|
||||
addToModel = true;
|
||||
move = true;
|
||||
}
|
||||
} else if (/^(?:M82)/i.test(line)) {
|
||||
} else if (/^(?:M82)(\.\d+)?/i.test(line)) {
|
||||
relativeE = false;
|
||||
} else if (/^(?:G91)/i.test(line)) {
|
||||
} else if (/^(?:G91)(\.\d+)?/i.test(line)) {
|
||||
relativeMode = true;
|
||||
if (g90InfluencesExtruder) {
|
||||
relativeE = true;
|
||||
}
|
||||
} else if (/^(?:G90)/i.test(line)) {
|
||||
} else if (/^(?:G90)(\.\d+)?/i.test(line)) {
|
||||
relativeMode = false;
|
||||
if (g90InfluencesExtruder) {
|
||||
relativeE = false;
|
||||
}
|
||||
} else if (/^(?:M83)/i.test(line)) {
|
||||
} else if (/^(?:M83)(\.\d+)?/i.test(line)) {
|
||||
relativeE = true;
|
||||
} else if (/^(?:M101)/i.test(line)) {
|
||||
} else if (/^(?:M101)(\.\d+)?/i.test(line)) {
|
||||
dcExtrude = true;
|
||||
} else if (/^(?:M103)/i.test(line)) {
|
||||
} else if (/^(?:M103)(\.\d+)?/i.test(line)) {
|
||||
dcExtrude = false;
|
||||
} else if (/^(?:G92)/i.test(line)) {
|
||||
} else if (/^(?:G92)(\.\d+)?/i.test(line)) {
|
||||
args = line.split(/\s/);
|
||||
|
||||
for (j = 0; j < args.length; j++) {
|
||||
@@ -494,7 +494,7 @@ var doParse = function () {
|
||||
move = false;
|
||||
}
|
||||
|
||||
} else if (/^(?:G28)/i.test(line)) {
|
||||
} else if (/^(?:G28)(\.\d+)?/i.test(line)) {
|
||||
args = line.split(/\s/);
|
||||
|
||||
if (args.length === 1) {
|
||||
|
||||
@@ -225,28 +225,63 @@ function DataUpdater(allViewModels, connectCallback, disconnectCallback) {
|
||||
|
||||
log.debug("Got event " + type + " with payload: " + JSON.stringify(payload));
|
||||
|
||||
if (type == "PrintCancelled") {
|
||||
if (payload.firmwareError) {
|
||||
new PNotify({
|
||||
title: gettext("Unhandled communication error"),
|
||||
text: _.sprintf(gettext("There was an unhandled error while talking to the printer. Due to that the ongoing print job was cancelled. Error: %(firmwareError)s"), payload),
|
||||
type: "error",
|
||||
hide: false
|
||||
});
|
||||
if (type === "PrintCancelling" && payload.firmwareError) {
|
||||
new PNotify({
|
||||
title: gettext("Error reported by printer"),
|
||||
text: _.sprintf(gettext("Your printer's firmware reported an error. Due to that the ongoing print job will be cancelled. Reported error: %(firmwareError)s"), payload),
|
||||
type: "error",
|
||||
hide: false
|
||||
});
|
||||
} else if (type === "Error" && payload.error) {
|
||||
var title = undefined,
|
||||
text = undefined;
|
||||
|
||||
switch (payload.reason) {
|
||||
case "firmware": {
|
||||
title = gettext("Error reported by printer");
|
||||
text = _.sprintf(gettext("Your printer's firmware reported an error. Due to that OctoPrint will disconnect. Reported error: %(error)s"), payload);
|
||||
break;
|
||||
}
|
||||
case "resend":
|
||||
case "timeout": {
|
||||
title = gettext("Communication error");
|
||||
text = gettext("There was a communication error while talking to your printer. Please consult the terminal output and octoprint.log for details. Error: %(error)s", payload);
|
||||
break;
|
||||
}
|
||||
case "connection": {
|
||||
title = gettext("Error connecting to printer");
|
||||
text = gettext("There was an error while trying to connect to your printer. Error: %(error)s", payload);
|
||||
break;
|
||||
}
|
||||
case "start_print": {
|
||||
title = gettext("Error starting a print");
|
||||
text = gettext("There was an error while trying to start a print job. Error: %(error)s", payload);
|
||||
break;
|
||||
}
|
||||
case "autodetect_port":
|
||||
case "autodetect_baudrate": {
|
||||
// ignore
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
title = gettext("Unknown error");
|
||||
text = gettext("There was an unknown error while talking to your printer. Please consult the terminal output and octoprint.log for details. Error: %(error)s", payload);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (type == "Error") {
|
||||
if (payload.error && payload.error.indexOf("autodetect") == -1) { // ignore "failed to autodetect"
|
||||
|
||||
if (title && text) {
|
||||
new PNotify({
|
||||
title: gettext("Unhandled communication error"),
|
||||
text: _.sprintf(gettext("There was an unhandled error while talking to the printer. Due to that OctoPrint disconnected. Error: %(error)s"), payload),
|
||||
title: title,
|
||||
text: text,
|
||||
type: "error",
|
||||
hide: false
|
||||
});
|
||||
}
|
||||
} else if (type == "PrinterReset") {
|
||||
} else if (type === "PrinterReset") {
|
||||
new PNotify({
|
||||
title: gettext("Printer reset detected"),
|
||||
text: gettext("It looks like the printer was reset while a connection was active. If this was intentional you may safely ignore this message. Otherwise you should investigate why your printer reset itself, since this will interrupt prints and also file transfers to your printer's SD."),
|
||||
text: gettext("It looks like your printer reset while a connection was active. If this was intentional you may safely ignore this message. Otherwise you should investigate why your printer reset itself, since this will interrupt prints and also file transfers to your printer's SD."),
|
||||
hide: false
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1051,7 +1051,7 @@ function callViewModelIf(viewModel, method, condition, callback, raiseErrors) {
|
||||
condition = function() { return true; };
|
||||
}
|
||||
|
||||
if (!viewModel.hasOwnProperty(method) || !condition(viewModel, method)) return;
|
||||
if (!viewModel.hasOwnProperty(method) || !_.isFunction(viewModel[method]) || !condition(viewModel, method)) return;
|
||||
|
||||
var parameters = undefined;
|
||||
if (!_.isFunction(callback)) {
|
||||
|
||||
@@ -46,6 +46,8 @@ $(function() {
|
||||
|
||||
self.previousIsOperational = undefined;
|
||||
|
||||
self.refreshVisible = ko.observable(true);
|
||||
|
||||
self.requestData = function() {
|
||||
OctoPrint.connection.getSettings()
|
||||
.done(self.fromResponse);
|
||||
@@ -125,12 +127,39 @@ $(function() {
|
||||
self.settings.printerProfiles.requestData();
|
||||
});
|
||||
} else {
|
||||
self.requestData();
|
||||
OctoPrint.connection.disconnect();
|
||||
if (!self.isPrinting() && !self.isPaused()) {
|
||||
self.requestData();
|
||||
OctoPrint.connection.disconnect();
|
||||
} else {
|
||||
showConfirmationDialog({
|
||||
title: gettext("Are you sure?"),
|
||||
message: gettext("<p><strong>You are about to disconnect from the printer while a print "
|
||||
+ "is in progress.</strong></p>"
|
||||
+ "<p>Disconnecting while a print is in progress will prevent OctoPrint from "
|
||||
+ "completing the print. If you're printing from an SD card attached directly "
|
||||
+ "to the printer, any attempt to restart OctoPrint or reconnect to the printer "
|
||||
+ "could interrupt the print.<p>"),
|
||||
question: gettext("Are you sure you want to disconnect from the printer?"),
|
||||
cancel: gettext("Stay Connected"),
|
||||
proceed: gettext("Disconnect"),
|
||||
onproceed: function() {
|
||||
self.requestData();
|
||||
OctoPrint.connection.disconnect();
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
self.onStartup = function() {
|
||||
var connectionTab = $("#connection");
|
||||
connectionTab.on("show", function() {
|
||||
self.refreshVisible(true);
|
||||
});
|
||||
connectionTab.on("hide", function() {
|
||||
self.refreshVisible(false);
|
||||
});
|
||||
|
||||
self.requestData();
|
||||
};
|
||||
|
||||
|
||||
@@ -226,6 +226,10 @@ $(function() {
|
||||
}
|
||||
}
|
||||
|
||||
if (!control.hasOwnProperty("additionalClasses")) {
|
||||
control.additionalClasses = "";
|
||||
}
|
||||
|
||||
control.processed = true;
|
||||
return control;
|
||||
};
|
||||
|
||||
@@ -9,6 +9,8 @@ $(function() {
|
||||
self.isErrorOrClosed = ko.observable(undefined);
|
||||
self.isOperational = ko.observable(undefined);
|
||||
self.isPrinting = ko.observable(undefined);
|
||||
self.isCancelling = ko.observable(undefined);
|
||||
self.isPausing = ko.observable(undefined);
|
||||
self.isPaused = ko.observable(undefined);
|
||||
self.isError = ko.observable(undefined);
|
||||
self.isReady = ko.observable(undefined);
|
||||
@@ -16,13 +18,13 @@ $(function() {
|
||||
self.isSdReady = ko.observable(undefined);
|
||||
|
||||
self.enablePrint = ko.pureComputed(function() {
|
||||
return self.isOperational() && self.isReady() && !self.isPrinting() && self.loginState.isUser() && self.filename() != undefined;
|
||||
return self.isOperational() && self.isReady() && !self.isPrinting() && !self.isCancelling() && !self.isPausing() && self.loginState.isUser() && self.filename() != undefined;
|
||||
});
|
||||
self.enablePause = ko.pureComputed(function() {
|
||||
return self.isOperational() && (self.isPrinting() || self.isPaused()) && self.loginState.isUser();
|
||||
return self.isOperational() && (self.isPrinting() || self.isPaused()) && !self.isCancelling() && !self.isPausing() && self.loginState.isUser();
|
||||
});
|
||||
self.enableCancel = ko.pureComputed(function() {
|
||||
return self.isOperational() && (self.isPrinting() || self.isPaused()) && self.loginState.isUser();
|
||||
return self.isOperational() && (self.isPrinting() || self.isPaused()) && !self.isCancelling() && !self.isPausing() && self.loginState.isUser();
|
||||
});
|
||||
|
||||
self.filename = ko.observable(undefined);
|
||||
@@ -193,6 +195,8 @@ $(function() {
|
||||
self.isOperational(data.flags.operational);
|
||||
self.isPaused(data.flags.paused);
|
||||
self.isPrinting(data.flags.printing);
|
||||
self.isCancelling(data.flags.cancelling);
|
||||
self.isPausing(data.flags.pausing);
|
||||
self.isError(data.flags.error);
|
||||
self.isReady(data.flags.ready);
|
||||
self.isSdReady(data.flags.sdReady);
|
||||
|
||||
@@ -120,6 +120,8 @@ $(function() {
|
||||
self.webcam_streamRatio = ko.observable(undefined);
|
||||
self.webcam_streamTimeout = ko.observable(undefined);
|
||||
self.webcam_snapshotUrl = ko.observable(undefined);
|
||||
self.webcam_snapshotTimeout = ko.observable(undefined);
|
||||
self.webcam_snapshotSslValidation = ko.observable(undefined);
|
||||
self.webcam_ffmpegPath = ko.observable(undefined);
|
||||
self.webcam_bitrate = ko.observable(undefined);
|
||||
self.webcam_ffmpegThreads = ko.observable(undefined);
|
||||
@@ -156,14 +158,14 @@ $(function() {
|
||||
self.serial_timeoutTemperatureTargetSet = ko.observable(undefined);
|
||||
self.serial_timeoutTemperatureAutoreport = ko.observable(undefined);
|
||||
self.serial_timeoutSdStatus = ko.observable(undefined);
|
||||
self.serial_timeoutSdStatusAutoreport = ko.observable(undefined);
|
||||
self.serial_log = ko.observable(undefined);
|
||||
self.serial_additionalPorts = ko.observable(undefined);
|
||||
self.serial_additionalBaudrates = ko.observable(undefined);
|
||||
self.serial_longRunningCommands = ko.observable(undefined);
|
||||
self.serial_checksumRequiringCommands = ko.observable(undefined);
|
||||
self.serial_helloCommand = ko.observable(undefined);
|
||||
self.serial_ignoreErrorsFromFirmware = ko.observable(undefined);
|
||||
self.serial_disconnectOnErrors = ko.observable(undefined);
|
||||
self.serial_serialErrorBehaviour = ko.observable("cancel");
|
||||
self.serial_triggerOkForM29 = ko.observable(undefined);
|
||||
self.serial_waitForStart = ko.observable(undefined);
|
||||
self.serial_sendChecksum = ko.observable("print");
|
||||
@@ -182,6 +184,7 @@ $(function() {
|
||||
self.serial_maxTimeoutsPrinting = ko.observable(undefined);
|
||||
self.serial_maxTimeoutsLong = ko.observable(undefined);
|
||||
self.serial_capAutoreportTemp = ko.observable(undefined);
|
||||
self.serial_capAutoreportSdStatus = ko.observable(undefined);
|
||||
self.serial_capBusyProtocol = ko.observable(undefined);
|
||||
|
||||
self.folder_uploads = ko.observable(undefined);
|
||||
@@ -323,7 +326,12 @@ $(function() {
|
||||
var errorTitle = gettext("Snapshot test failed");
|
||||
|
||||
self.testWebcamSnapshotUrlBusy(true);
|
||||
OctoPrint.util.testUrl(self.webcam_snapshotUrl(), {method: "GET", response: "bytes"})
|
||||
OctoPrint.util.testUrl(self.webcam_snapshotUrl(), {
|
||||
method: "GET",
|
||||
response: "bytes",
|
||||
timeout: self.webcam_snapshotTimeout(),
|
||||
validSsl: self.webcam_snapshotSslValidation()
|
||||
})
|
||||
.done(function(response) {
|
||||
if (!response.result) {
|
||||
showMessageDialog({
|
||||
@@ -694,8 +702,10 @@ $(function() {
|
||||
longRunningCommands: function() { return splitTextToArray(self.serial_longRunningCommands(), ",", true) },
|
||||
checksumRequiringCommands: function() { return splitTextToArray(self.serial_checksumRequiringCommands(), ",", true) },
|
||||
externalHeatupDetection: function() { return !self.serial_disableExternalHeatupDetection()},
|
||||
alwaysSendChecksum: function() { return self.serial_sendChecksum() == "always"},
|
||||
neverSendChecksum: function() { return self.serial_sendChecksum() == "never"}
|
||||
alwaysSendChecksum: function() { return self.serial_sendChecksum() === "always"},
|
||||
neverSendChecksum: function() { return self.serial_sendChecksum() === "never"},
|
||||
ignoreErrorsFromFirmware: function() { return self.serial_serialErrorBehaviour() === "ignore"},
|
||||
disconnectOnErrors: function() { return self.serial_serialErrorBehaviour() === "disconnect" }
|
||||
},
|
||||
scripts: {
|
||||
gcode: function() {
|
||||
@@ -812,7 +822,9 @@ $(function() {
|
||||
checksumRequiringCommands: function(value) { self.serial_checksumRequiringCommands(value.join(", "))},
|
||||
externalHeatupDetection: function(value) { self.serial_disableExternalHeatupDetection(!value) },
|
||||
alwaysSendChecksum: function(value) { if (value) { self.serial_sendChecksum("always")}},
|
||||
neverSendChecksum: function(value) { if (value) { self.serial_sendChecksum("never")}}
|
||||
neverSendChecksum: function(value) { if (value) { self.serial_sendChecksum("never")}},
|
||||
ignoreErrorsFromFirmware: function(value) { if (value) {self.serial_serialErrorBehaviour("ignore")}},
|
||||
disconnectOnErrors: function(value) { if (value) {self.serial_serialErrorBehaviour("disconnect")}}
|
||||
},
|
||||
terminalFilters: function(value) { self.terminalFilters($.extend(true, [], value)) },
|
||||
temperature: {
|
||||
|
||||
@@ -11,7 +11,6 @@ $(function() {
|
||||
self.defaultInterval = 10;
|
||||
self.defaultRetractionZHop = 0;
|
||||
self.defaultMinDelay = 5.0;
|
||||
self.defaultCapturePostRoll = true;
|
||||
|
||||
self.timelapseType = ko.observable(undefined);
|
||||
self.timelapseTimedInterval = ko.observable(self.defaultInterval);
|
||||
@@ -19,7 +18,6 @@ $(function() {
|
||||
self.timelapseFps = ko.observable(self.defaultFps);
|
||||
self.timelapseRetractionZHop = ko.observable(self.defaultRetractionZHop);
|
||||
self.timelapseMinDelay = ko.observable(self.defaultMinDelay);
|
||||
self.timelapseCapturePostRoll = ko.observable(self.defaultCapturePostRoll);
|
||||
|
||||
self.serverConfig = ko.observable();
|
||||
|
||||
@@ -76,9 +74,6 @@ $(function() {
|
||||
self.timelapseMinDelay.subscribe(function() {
|
||||
self.isDirty(true);
|
||||
});
|
||||
self.timelapseCapturePostRoll.subscribe(function() {
|
||||
self.isDirty(true);
|
||||
});
|
||||
self.persist.subscribe(function() {
|
||||
self.isDirty(true);
|
||||
});
|
||||
@@ -176,12 +171,6 @@ $(function() {
|
||||
self.timelapseTimedInterval(self.defaultInterval);
|
||||
}
|
||||
|
||||
if (config.type === "timed" && config.capturePostRoll !== undefined){
|
||||
self.timelapseCapturePostRoll(config.capturePostRoll);
|
||||
} else {
|
||||
self.timelapseCapturePostRoll(self.defaultCapturePostRoll);
|
||||
}
|
||||
|
||||
if (config.type === "zchange" && config.retractionZHop !== undefined && config.retractionZHop > 0) {
|
||||
self.timelapseRetractionZHop(config.retractionZHop);
|
||||
} else {
|
||||
@@ -386,7 +375,6 @@ $(function() {
|
||||
|
||||
if (self.timelapseType() === "timed") {
|
||||
payload["interval"] = self.timelapseTimedInterval();
|
||||
payload["capturePostRoll"] = self.timelapseCapturePostRoll();
|
||||
}
|
||||
|
||||
if (self.timelapseType() === "zchange") {
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
|
||||
<ul>
|
||||
<li>Website: <a href="https://octoprint.org" target="_blank" rel="noreferrer noopener">octoprint.org</a></li>
|
||||
<li>Community Forum: <a href="https://discourse.octoprint.org" target="_blank" rel="noreferrer noopener">discourse.octoprint.org</a></li>
|
||||
<li>FAQ: <a href="https://faq.octoprint.org" target="_blank" rel="noreferrer noopener">faq.octoprint.org</a></li>
|
||||
<li>Source Code: <a href="https://github.com/foosel/OctoPrint" target="_blank" rel="noreferrer noopener">github.com/foosel/OctoPrint</a></li>
|
||||
<li>Documentation: <a href="http://docs.octoprint.org" target="_blank" rel="noreferrer noopener">docs.octoprint.org</a></li>
|
||||
</ul>
|
||||
|
||||
@@ -87,7 +87,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group" title="{{ _('Interval in which to poll for the SD printing status information from the printer while printing') }}">
|
||||
<label class="control-label" for="settings-serialTimeoutSdStatus">{{ _('SD status interval') }}</label>
|
||||
<label class="control-label" for="settings-serialTimeoutSdStatus">{{ _('SD status interval (polling)') }}</label>
|
||||
<div class="controls">
|
||||
<div class="input-append">
|
||||
<input type="number" step="any" min="0" class="input-mini text-right" data-bind="value: serial_timeoutSdStatus" id="settings-serialTimeoutSdStatus">
|
||||
@@ -95,6 +95,16 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group" title="{{ _('SD status interval to request from autoreport capable firmwares. A value of 0 disables autoreporting by the firmware and forces polling.') }}">
|
||||
<label class="control-label" for="settings-serialTimeoutSdStatus">{{ _('SD status interval (autoreport)') }}</label>
|
||||
<div class="controls">
|
||||
<div class="input-append">
|
||||
<input type="number" step="any" min="0" class="input-mini text-right" data-bind="value: serial_timeoutSdStatusAutoreport" id="settings-serialTimeoutSdStatusAutoreport">
|
||||
<span class="add-on">s</span>
|
||||
</div>
|
||||
<span class="help-inline">{{ _('Autoreport interval to request from firmware')}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset id="settings_serial_timeouts_timeouts">
|
||||
<legend>{{ _('Timeouts') }}</legend>
|
||||
@@ -243,6 +253,13 @@
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: serial_capAutoreportSdStatus" id="settings-serialCapAutoreportSdStatus"> {{ _('Support sd status autoreporting by firmware, if detected') }}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
@@ -250,17 +267,28 @@
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: serial_triggerOkForM29" id="settings-serialTriggerOkForM29"> {{ _('Simulate <code>ok</code> for <code>M29</code>') }}
|
||||
<span class="help-block">{{ _('Most Marlin forks that were derived from Marlin versions < v1.1.0 do not send an acknowledging <code>ok</code> for a <code>M29</code>. Check this if you run into communication stalls following streaming of a file to your printer\'s SD.') }}</span>
|
||||
</label>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: serial_triggerOkForM29" id="settings-serialTriggerOkForM29"> {{ _('Simulate <code>ok</code> for <code>M29</code>') }}
|
||||
<span class="help-block">{{ _('Most Marlin forks that were derived from Marlin versions < v1.1.0 do not send an acknowledging <code>ok</code> for a <code>M29</code>. Check this if you run into communication stalls following streaming of a file to your printer\'s SD.') }}</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: serial_supportResendsWithoutOk" id="settings-serialSupportResendsWithoutOk"> {{ _('Simulate <code>ok</code> for resend requests') }}
|
||||
<span class="help-block">{{ _('Some Marlin forks do not send an acknowledging <code>ok</code> with their resend requests. Check this if you run into communication stalls following resend requests due to that.') }}</span>
|
||||
</label>
|
||||
<div class="control-group">
|
||||
<label class="control-label"> {{ _('Simulate <code>ok</code> for resend requests') }}</label>
|
||||
<div class="controls">
|
||||
<label class="radio">
|
||||
<input type="radio" name="resendWithoutOkGroup" value="detect" data-bind="checked: serial_supportResendsWithoutOk" id="settings-serialSupportResendsWithoutOkDetect"> {{ _('If detected as necessary') }}
|
||||
</label>
|
||||
<label class="radio">
|
||||
<input type="radio" name="resendWithoutOkGroup" value="always" data-bind="checked: serial_supportResendsWithoutOk" id="settings-serialSupportResendsWithoutOkAlways"> {{ _('Always') }}
|
||||
</label>
|
||||
<label class="radio">
|
||||
<input type="radio" name="resendWithoutOkGroup" value="never" data-bind="checked: serial_supportResendsWithoutOk" id="settings-serialSupportResendsWithoutOkNever"> {{ _('Never') }}
|
||||
</label>
|
||||
<span class="help-block">{{ _('Some Marlin forks lack an acknowledging <code>ok</code> with their resend requests. Set this to "always" or "if detected as necessary" if you run into communication stalls on resend requests.') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -307,16 +335,17 @@
|
||||
<fieldset>
|
||||
<legend>{{ _('Error handling') }}</legend>
|
||||
<div class="control-group">
|
||||
<label class="control-label">{{ _('What to do on a firmware error (<code>Error:</code> or <code>!!</code>)') }}</label>
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: serial_disconnectOnErrors" id="settings-serialDisconnectOnErrors"> {{ _('Not only cancel ongoing prints but also disconnect on unhandled errors from the firmware.') }}
|
||||
<label class="radio">
|
||||
<input type="radio" name="errorHandlingGroup" value="disconnect" data-bind="checked: serial_serialErrorBehaviour" id="settings-serialErrorBehaviourDisconnect"> {{ _('Disconnect from the printer') }}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: serial_ignoreErrorsFromFirmware" id="settings-serialIgnoreErrorsFromFirmware"> {{ _('Ignore any unhandled errors from the firmware. Only use this if your firmware sends stuff prefixed with "Error" that is not an actual error. Might mask printer issues, be careful!') }} <span class="label label-important">{{ _('Warning') }}</span>
|
||||
<label class="radio">
|
||||
<input type="radio" name="errorHandlingGroup" value="cancel" data-bind="checked: serial_serialErrorBehaviour" id="settings-serialErrorBehaviourCancel"> {{ _('Cancel any ongoing prints but stay connected to the printer') }}
|
||||
</label>
|
||||
<label class="radio">
|
||||
<input type="radio" name="errorHandlingGroup" value="ignore" data-bind="checked: serial_serialErrorBehaviour" id="settings-serialErrorBehaviourIgnore"> {{ _('Ignore') }} <span class="label label-important">{{ _('Warning') }}</span>
|
||||
<span class="help-block">{{ _('Only choose this if your firmware sends error messages that are not actual errors. Might mask printer issues, be careful!') }}</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
<div class="hide">
|
||||
{% include "snippets/settings/webcam/ffmpegBitrate.jinja2" %}
|
||||
{% include "snippets/settings/webcam/ffmpegThreads.jinja2" %}
|
||||
{% include "snippets/settings/webcam/webcamSnapshotTimeout.jinja2" %}
|
||||
{% include "snippets/settings/webcam/webcamSnapshotSslValidation.jinja2" %}
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@@ -115,10 +115,9 @@
|
||||
</ul>
|
||||
<ul id="footer_links" class="pull-right">
|
||||
<li><a href="https://octoprint.org" target="_blank" rel="noreferrer noopener"><i class="fa fa-home"></i> {{ _('Homepage') }}</a></li>
|
||||
<li><a href="https://github.com/foosel/OctoPrint/" target="_blank" rel="noreferrer noopener"><i class="fa fa-github"></i> {{ _('Source') }}</a></li>
|
||||
<li><a href="https://discourse.octoprint.org" target="_blank" rel="noreferrer noopener"><i class="fa fa-users"></i> {{ _('Forum') }}</a></li>
|
||||
<li><a href="https://faq.octoprint.org" target="_blank" rel="noreferrer noopener"><i class="fa fa-question-circle"></i> {{ _('FAQ') }}</a></li>
|
||||
<li><a href="http://docs.octoprint.org" target="_blank" rel="noreferrer noopener"><i class="fa fa-book"></i> {{ _('Docs') }}</a></li>
|
||||
<li><a href="https://github.com/foosel/OctoPrint/issues" target="_blank" rel="noreferrer noopener"><i class="fa fa-flag"></i> {{ _('Issues') }}</a></li>
|
||||
<li><a href="https://github.com/foosel/OctoPrint/wiki/FAQ" target="_blank" rel="noreferrer noopener"><i class="fa fa-question-circle"></i> {{ _('FAQ') }}</a></li>
|
||||
<li id="footer_about"><a href="javascript:void(0)" data-bind="click: show"><i class="fa fa-info-circle"></i> {{ _('About') }}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<div class="refresh-trigger accordion-heading-button btn-group">
|
||||
<div class="refresh-trigger accordion-heading-button btn-group" data-bind="visible: $root.refreshVisible">
|
||||
<a href="#" data-bind="click: function() { $root.requestData(); }" title="{{ _('Refresh connection options') }}">
|
||||
<i class="fa fa-refresh"></i>
|
||||
</a>
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: webcam_snapshotSslValidation" id="settings-webcamSnapshotSslValidation"> {{ _('Validate SSL on snapshot URL (if applicable)') }}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,9 @@
|
||||
<div class="control-group" title="{{ _('Timeout for taking a snapshot') }}">
|
||||
<label class="control-label" for="settings-webcamSnapshotTimeout">{{ _('Snapshot timeout') }}</label>
|
||||
<div class="controls">
|
||||
<div class="input-append">
|
||||
<input type="number" min="1" class="input-mini text-right" data-bind="value: webcam_snapshotTimeout" id="settings-webcamSnapshotTimeout">
|
||||
<span class="add-on">sec</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -173,6 +173,6 @@
|
||||
<label style="cursor: default" data-bind="text: output"></label>
|
||||
</script>
|
||||
<script type="text/html" id="customControls_controlTemplate_command">
|
||||
<button class="btn" data-bind="text: name, enable: $root.isCustomEnabled($data), click: function() { $root.clickCustom($data) }"></button>
|
||||
<button class="btn" data-bind="text: name, css: additionalClasses, enable: $root.isCustomEnabled($data), click: function() { $root.clickCustom($data) }"></button>
|
||||
</script>
|
||||
<!-- End of templates for custom controls -->
|
||||
@@ -56,16 +56,7 @@
|
||||
<input type="number" min="0" class="input-mini" id="webcam_timelapse_postRoll" data-bind="value: timelapsePostRoll, valueUpdate: 'afterkeydown', enable: !isPrinting() && loginState.isUser() && timelapseTypeSelected()">
|
||||
<span class="add-on">{{ _('sec') }}</span>
|
||||
</div>
|
||||
<span class="help-block">{{ _('OctoPrint will take additional pictures to add this many seconds to the end of your rendered timelapse.') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group" data-bind="visible: timelapseType() == 'timed'">
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: timelapseCapturePostRoll, valueUpdate: 'afterkeydown', enable: !isPrinting() && loginState.isUser()"> {{ _('Capture post roll images') }}
|
||||
<span class="help-block">{{ _('If this is unchecked, OctoPrint will simply repeat the last frame for the post roll instead of continuing to capture new frames.') }}</span>
|
||||
</label>
|
||||
<span class="help-block">{{ _('OctoPrint will use the final picture to add this many seconds to the end of your rendered timelapse.') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
+13
-41
@@ -30,9 +30,9 @@ import collections
|
||||
import re
|
||||
|
||||
try:
|
||||
from os import scandir, walk
|
||||
from os import scandir
|
||||
except ImportError:
|
||||
from scandir import scandir, walk
|
||||
from scandir import scandir
|
||||
|
||||
|
||||
# currently configured timelapse
|
||||
@@ -334,11 +334,7 @@ def configure_timelapse(config=None, persist=False):
|
||||
if "options" in config and "interval" in config["options"] and config["options"]["interval"] > 0:
|
||||
interval = config["options"]["interval"]
|
||||
|
||||
capture_post_roll = True
|
||||
if "options" in config and "capturePostRoll" in config["options"] and isinstance(config["options"]["capturePostRoll"], bool):
|
||||
capture_post_roll = config["options"]["capturePostRoll"]
|
||||
|
||||
current = TimedTimelapse(post_roll=postRoll, interval=interval, fps=fps, capture_post_roll=capture_post_roll)
|
||||
current = TimedTimelapse(post_roll=postRoll, interval=interval, fps=fps)
|
||||
|
||||
notify_callbacks(current)
|
||||
|
||||
@@ -368,6 +364,8 @@ class Timelapse(object):
|
||||
self._capture_dir = settings().getBaseFolder("timelapse_tmp")
|
||||
self._movie_dir = settings().getBaseFolder("timelapse")
|
||||
self._snapshot_url = settings().get(["webcam", "snapshot"])
|
||||
self._snapshot_timeout = settings().getInt(["webcam", "snapshotTimeout"])
|
||||
self._snapshot_validate_ssl = settings().getBoolean(["webcam", "snapshotSslValidation"])
|
||||
|
||||
self._fps = fps
|
||||
|
||||
@@ -595,7 +593,10 @@ class Timelapse(object):
|
||||
eventManager().fire(Events.CAPTURE_START, dict(file=filename))
|
||||
try:
|
||||
self._logger.debug("Going to capture {} from {}".format(filename, self._snapshot_url))
|
||||
r = requests.get(self._snapshot_url, stream=True, timeout=5)
|
||||
r = requests.get(self._snapshot_url,
|
||||
stream=True,
|
||||
timeout=self._snapshot_timeout,
|
||||
verify=self._snapshot_validate_ssl)
|
||||
r.raise_for_status()
|
||||
|
||||
with open (filename, "wb") as f:
|
||||
@@ -712,13 +713,11 @@ class ZTimelapse(Timelapse):
|
||||
|
||||
|
||||
class TimedTimelapse(Timelapse):
|
||||
def __init__(self, interval=1, capture_post_roll=True, post_roll=0, fps=25):
|
||||
def __init__(self, interval=1, post_roll=0, fps=25):
|
||||
Timelapse.__init__(self, post_roll=post_roll, fps=fps)
|
||||
self._interval = interval
|
||||
if self._interval < 1:
|
||||
self._interval = 1 # force minimum interval of 1s
|
||||
self._capture_post_roll = capture_post_roll
|
||||
self._postroll_captures = 0
|
||||
self._timer = None
|
||||
self._logger.debug("TimedTimelapse initialized")
|
||||
|
||||
@@ -726,16 +725,11 @@ class TimedTimelapse(Timelapse):
|
||||
def interval(self):
|
||||
return self._interval
|
||||
|
||||
@property
|
||||
def capture_post_roll(self):
|
||||
return self._capture_post_roll
|
||||
|
||||
def config_data(self):
|
||||
return {
|
||||
"type": "timed",
|
||||
"options": {
|
||||
"interval": self._interval,
|
||||
"capture_post_roll": self._capture_post_roll
|
||||
"interval": self._interval
|
||||
}
|
||||
}
|
||||
|
||||
@@ -751,40 +745,18 @@ class TimedTimelapse(Timelapse):
|
||||
on_finish=self._on_timer_finished)
|
||||
self._timer.start()
|
||||
|
||||
def on_print_done(self, event, payload):
|
||||
if self._capture_post_roll:
|
||||
self._postroll_captures = self._post_roll * self._fps
|
||||
else:
|
||||
self._postroll_captures = 0
|
||||
Timelapse.on_print_done(self, event, payload)
|
||||
|
||||
def calculate_post_roll(self):
|
||||
if self._capture_post_roll:
|
||||
return self._post_roll * self._fps * self._interval
|
||||
else:
|
||||
return Timelapse.calculate_post_roll(self)
|
||||
|
||||
def process_post_roll(self):
|
||||
if self._capture_post_roll:
|
||||
return
|
||||
|
||||
# we only use the final image as post roll if we
|
||||
# are not supposed to capture it
|
||||
# we only use the final image as post roll
|
||||
self._copying_postroll()
|
||||
self.post_roll_finished()
|
||||
|
||||
def _timer_active(self):
|
||||
return self._in_timelapse or self._postroll_captures > 0
|
||||
return self._in_timelapse
|
||||
|
||||
def _timer_task(self):
|
||||
self.capture_image()
|
||||
if self._postroll_captures > 0:
|
||||
self._postroll_captures -= 1
|
||||
|
||||
def _on_timer_finished(self):
|
||||
if self._capture_post_roll:
|
||||
self.post_roll_finished()
|
||||
|
||||
# timer is done, delete it
|
||||
self._timer = None
|
||||
|
||||
|
||||
Binary file not shown.
File diff suppressed because it is too large.
Load diff
@@ -1223,11 +1223,20 @@ class CountedEvent(object):
|
||||
def __init__(self, value=0, maximum=None, **kwargs):
|
||||
self._counter = 0
|
||||
self._max = kwargs.get("max", maximum)
|
||||
self._mutex = threading.Lock()
|
||||
self._mutex = threading.RLock()
|
||||
self._event = threading.Event()
|
||||
|
||||
self._internal_set(value)
|
||||
|
||||
@property
|
||||
def is_set(self):
|
||||
return self._event.is_set
|
||||
|
||||
@property
|
||||
def counter(self):
|
||||
with self._mutex:
|
||||
return self._counter
|
||||
|
||||
def set(self):
|
||||
with self._mutex:
|
||||
self._internal_set(self._counter + 1)
|
||||
@@ -1243,8 +1252,13 @@ class CountedEvent(object):
|
||||
self._event.wait(timeout)
|
||||
|
||||
def blocked(self):
|
||||
with self._mutex:
|
||||
return self._counter == 0
|
||||
return self.counter == 0
|
||||
|
||||
def acquire(self, blocking=1):
|
||||
return self._mutex.acquire(blocking=blocking)
|
||||
|
||||
def release(self):
|
||||
return self._mutex.release()
|
||||
|
||||
def _internal_set(self, value):
|
||||
self._counter = value
|
||||
|
||||
+575
-160
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,26 @@
|
||||
# coding=utf-8
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
|
||||
__copyright__ = "Copyright (C) 2018 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
|
||||
import collections
|
||||
import frozendict
|
||||
|
||||
class JsonEncoding(object):
|
||||
|
||||
encoders = collections.OrderedDict()
|
||||
|
||||
@classmethod
|
||||
def add_encoder(cls, type, encoder):
|
||||
cls.encoders[type] = encoder
|
||||
|
||||
@classmethod
|
||||
def encode(cls, obj):
|
||||
for type, encoder in cls.encoders.items():
|
||||
if isinstance(obj, type):
|
||||
return encoder(obj)
|
||||
raise TypeError
|
||||
|
||||
JsonEncoding.add_encoder(frozendict.frozendict, lambda obj: dict(obj))
|
||||
@@ -184,7 +184,8 @@ class PipCaller(CommandlineCaller):
|
||||
return
|
||||
|
||||
if pip_version in self.__class__.broken:
|
||||
self._logger.error("This version of pip is known to have bugs that make it incompatible with how it needs to be used by OctoPrint. Please upgrade your pip version.")
|
||||
self._logger.error("This version of pip is known to have bugs that make it incompatible with how it needs "
|
||||
"to be used by OctoPrint. Please upgrade your pip version.")
|
||||
return
|
||||
|
||||
# Now figure out if pip belongs to a virtual environment and if the
|
||||
@@ -203,7 +204,12 @@ class PipCaller(CommandlineCaller):
|
||||
|
||||
ok, pip_user, pip_virtual_env, pip_install_dir = self._check_pip_setup(pip_command)
|
||||
if not ok:
|
||||
self._logger.error("Cannot use pip")
|
||||
if pip_install_dir:
|
||||
self._logger.error("Cannot use this pip install, can't write to the install dir and also can't use "
|
||||
"--user for installing. Check your setup and the permissions on {}.".format(pip_install_dir))
|
||||
else:
|
||||
self._logger.error("Cannot use this pip install, something's wrong with the python environment. "
|
||||
"Check the lines before.")
|
||||
return
|
||||
|
||||
self._command = pip_command
|
||||
@@ -371,17 +377,19 @@ class PipCaller(CommandlineCaller):
|
||||
ok = writable or can_use_user_flag
|
||||
user_flag = not writable and can_use_user_flag
|
||||
|
||||
self._logger.info("pip installs to {}, --user flag needed => {}, "
|
||||
"virtual env => {}".format(install_dir,
|
||||
self._logger.info("pip installs to {} (writable -> {}), --user flag needed -> {}, "
|
||||
"virtual env -> {}".format(install_dir,
|
||||
"yes" if writable else "no",
|
||||
"yes" if user_flag else "no",
|
||||
"yes" if virtual_env else "no"))
|
||||
self._logger.info("==> pip ok -> {}".format("yes" if ok else "NO!"))
|
||||
|
||||
# ok, enable user flag, virtual env yes/no, installation dir
|
||||
result = ok, user_flag, virtual_env, install_dir
|
||||
_cache["setup"][pip_command_str] = result
|
||||
return result
|
||||
else:
|
||||
self._logger.debug("Could not detect desired output from testballoon install, got this instead: {!r}".format(data))
|
||||
self._logger.error("Could not detect desired output from testballoon install, got this instead: {!r}".format(data))
|
||||
return False, False, False, None
|
||||
|
||||
def _preprocess_lines(self, *lines):
|
||||
@@ -425,8 +433,18 @@ class LocalPipCaller(PipCaller):
|
||||
writable = os.access(install_dir, os.W_OK)
|
||||
|
||||
can_use_user_flag = not virtual_env and site.ENABLE_USER_SITE
|
||||
user_flag = not writable and can_use_user_flag
|
||||
|
||||
return writable or can_use_user_flag, \
|
||||
not writable and can_use_user_flag, \
|
||||
ok = writable or can_use_user_flag
|
||||
|
||||
self._logger.info("pip installs to {} (writable -> {}), --user flag needed -> {}, "
|
||||
"virtual env -> {}".format(install_dir,
|
||||
"yes" if writable else "no",
|
||||
"yes" if user_flag else "no",
|
||||
"yes" if virtual_env else "no"))
|
||||
self._logger.info("==> pip ok -> {}".format("yes" if ok else "NO!"))
|
||||
|
||||
return ok, \
|
||||
user_flag, \
|
||||
virtual_env, \
|
||||
install_dir
|
||||
Loaded 100 of 105 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user