Apparently the "big yellow box" hinting the contribution guidelines
vanished some time ago and got replaced by a teeny tiny link to the
right under "Helpful resources". Ah well.
For now the following commands are supported:
* @pause: Pauses the print
* @resume: Resumes the print
* @cancel or @abort: Cancels the print
As discussed in #2414. Also implements #324.
We can't easily upgrade to 0.3.0 right now due to backwards incompatible
changes in that version (some methods became properties). So for now
we simply backport the fix in question through a monkey patch.
Fixes#2296
We always read everything from the serial that is currently available in
our rx buffer but only return the first line in that. While that
increases our memory consumption slightly, it should hopefully not cause
issues and should greatly reduce the risk of buffer overflows making us
lose or receive corrupt data.
Possible solution for #2370 and #2454
* next command could be queued even if job was already on hold due to
a check missing
* context manager was too limiting, could lead to race conditions
where the job_on_hold flag wasn't set in time when moved to a
handler thread, introducing a dedicated set_job_on_hold method
for that solves this (at the downside of requiring more care from
plugin developers utilizing this)
Fixes#2467
Strongly depends on the firmware:
* 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.
As discussed in #2317 this option was confusing and frustrating too many
people. Instead of an actual capture we'll now just do the same as for
z-based timelapses and use the last image repeatedly.
No, using the live webstream and capturing real time image is NOT an
option and not going to happen here, see the discussion in #2317 on this
as well.
Attempt to narrow down on #1951.
To be on the safe side, the use of frozendict here can be disabled by
settings devel.useFrozenDictForPrinterState to False in the config.
If firmware doesn't send an ok immediately after a resend request, we
will now be able to detect this (if enabled to do so) by starting a
timer that will simulate an ok after .5s if none has been received.
This should help with issues like prusa3d/Prusa-Firmware#331 where an ok
is only missing sometimes and not always, making the existing workaround
of always simulating an ok after a resend cause additional problems.
We so far switched immediately to "Operational" state, even while the M400/M114
combo and/or any post switch scripts were still being executed. That was confusing
and as witnessed in #2321 and also #2449 also could cause issues.
By parsing the main plugin file into a Python AST we can still extract
the control property values (as long as they are simple string
assignments or calls to gettext with a string argument) without having
to execute them in any way.
We want to avoid disabled plugins interfering with our application
in any way at all.
Hence disabled plugins are now treated the same way as blacklisted ones.
The system will only create a dummy entry for them and not import them
at all. As a consequence, a restart of the platform will be necessary
for disabling plugins that were disabled.
The Plugin Manager has been adjusted accordingly.
Note that by no longer even importing the base file, plugin name,
version, description and other such metadata defined through control
properties won't be accessible.
Closes#2442
Can be used to do some stuff while printing while ensuring that the file
won't continue to be streamed. Should be used sparingly and only for
very limited reasons since it can severely affect print results.
Commands injected/extended/rewritten through one of the phase hooks or
sent by a plugin through self._printer.commands will also be tagged with
"plugin:<plugin identifier>", allowing other code to detect these tags
and handle such commands differently.
That will be interesting for plugins that need to differentiate between
commands originating from the printed file vs the user vs the system vs
other plugins.
* migrate several actually serial & protocol related settings from
feature settings to serial settings
* migrate terminal auto uppercase blacklist from serial settings to
feature settings
* restructure the serial settings dialog
* adjust docs accordingly
If a printer supports auto reporting the temperature but doesn't also
support sending "wait" if the command buffer runs dry, it can happen
that a lost "ok" never gets detected properly because no timeout is ever
triggered (the printer is in fact sending data after all), but we should
actually try to get comms running again.
Introducing a custom ok timeout solves this. We reset this every time we
see an "ok", "wait" or "busy", but if we run into it while printing we
perform the same steps as if we hadn't received any data at all from the
printer over the duration of the currently active communication timeout
value (whether to choose "communication" or "communicationBusy" here
depends on whether we also detected support of the busy protocol or
not).
If the printer supports the busy protocol (which we should automatically
notice by it using it on the first blocking heatup or otherwise blocking
operation), it's safe reduce the communication timeout to a way way
lower value since the busy protocol should guarantee a heartbeat from
the printer at known intervals and so timeouts really should only happen
if something gets lost on the way.
We also set the interval on the printer to our configured busy timeout
minus 1s so we can be sure that we should always see a busy line from
the printer before we run into our own timeout. We do this via M113.
Starting with pip 7.x pip runs into an issue if a software package
formerly installed as a Python egg (= zip file stored in site-packages,
referenced through easy-install.pth, e.g. through a stand alone "python
setup.py install") is to be updated to a newer version.
The issue arises since the egg is still on the python path after the
replacement has taken place, and pip tries to read from it without error
handling for the fact that this file is now not longer existing. The
source of the problem appears to be with both the bundled as well as the
stock versions of pkg_resources and pip's usage of them to perform its
management duties. It's currently unclear if the problem is a bug or a
feature, even though it strongly looks like the first one.
In any case, during tests it was found that this problem can be worked
around by simply performing a second "pip install" with same parameters
right after the failed first one.
This patch detects this scenario based on the logged error message and
performs the second install if deemed necessary.
This is a preparational step to allow upgrade of the pyserial dependency
(and other dependencies currently installed as eggs as part of
OctoPrint's former "python setup.py install" installation procedure)
with OctoPrint 1.3.8, to finalize the fix for #2333.
This is causing issues on update thanks to the PySerial installation
logging an error if the former version was installed through
dependency resolution during OctoPrint's python setup.py install run
(which is most likely the case for pretty much all live installations
out there).
Update (and hence activation of fix for #2333) postponed until a
solution for this issue is found.
This reverts commit 77989d2a76.
Only done if the methods needed for that exist and are callable though
(to prevent issues with custom serial port implementations provided
through hooks, or operating systems that don't have support for
cancel_read/cancel_write in PySerial.
Fixes#2333 (at least as far as we'll ever be able to fix it)
This allows pythonic API clients to pass boolean values in:
requests.get('/api/printer', params={'history': True})
Previously this didn't work, as Octoprint doesn't see True as a boolean, it gets a sting. So it never matches True, it only matches "True".
Easy to test:
curl -H "X-Api-Key: x" http://octopi.local/api/printer?history=true | grep history
curl -H "X-Api-Key: x" http://octopi.local/api/printer?history=True | grep history
This is my suggestion on how to handle basic authentication for users
mananaged by OctoPrint's UserManager.
In my opinion OctoPrint should not be doing Basic Authentication on its
own. The commen case is that it runs on some slow hardware which its not
able to handle stupid bots trying out thousands of passwords in short
time. Also you want to protect it as much as possible from the outside
to ensure that the basd internet can't break your 72h print after 71
hours by brute-forcing passwords.
So I'm introducing an
accessControl: trustBasicAuthentication
config option. If enabled, it will take the user name from the
Authorization header, check if the user exists and is enabled - and if
so, just login the user.
If we set method to pip in 1.3.6 and then roll back to 1.3.5 we will
need to a manual config.yaml update otherwise or we will no longer be
able to update.
Be removing the force parameter and using the actual default settings
instead of current ones, we don't do that anymore.
Make sure to set the actual effective offsets as provided by the comm
layer (which merges incoming single offset adjustments) instead of only
setting the input, effectively nuking return of offsets set prior.
Closes#2268
Didn't match Marlin's "checksum mismatch", only Repetier's "checksum
error". Since the error handler checks against
recoverable_communication_errors before
resend_request_communication_errors, we can just switch back to the more
broader check against "checksum" for the latter.
We could also have added an explicit check for "checksum mismatch"
instead but since we used to check for "checksum" and we don't know what
other varieties for this specific error might be out there in the
thousands of firmware variants (who needs consistency when they can
have a free for all?), we'll err on the side of caution instead.
Fixes#2262
It's no longer reliable since the Github archive export we'll now
usually use for upgrading does weird things when a tag is available on
more than one branch and we don't want our current stable version to
be reported as "rc/devel" just because that tag is available there too.
A full blown version number should be definitive enough considering that
if it's not a tag it will also contain the commit hash.
We don't need to define them in the firmware AND in OctoPrint. If they
are already set in firmware we'll otherwise get wonky issues in the
GCODE viewer or when slicing.
Closes#2229
As discussed in #2200.
For this to work we've introduced sub-bundles per plugin for the JS
assets. CSS and LESS on the other hand are basically handled as before.
We use a custom bundle class here since it's apparently not possible to
keep a sub bundle from inheriting the parent's filters, thus not
allowing us something like
packed_plugins [js_plugin_delimiter_bundler]
packed_plugin_a [js_delimiter_bundler]
packed_plugin_b [js_delimiter_bundler]
...
The individiual bundles per plugin would inherit
js_plugin_delimiter_bundler and we'd get a double wrapper - not helpful.
Instead we now have a modified JsPluginBundle that overwrites
Bundle._merge_and_apply to further wrap the returned hunk.
Since we only ever handle one requirement here, the parse_requirements
generator (which btw needs a next m() is not the best choice.
Also extracted install command cleanup into class method and added tests
for that.
cc @markwal
No guarantees however that transporting anything BUT gcode via the usual
M28/M29 interface will even remotely work. Note that it most likely
won't work if the transferred file contains an M29 (= end transfer),
just like with transferred GCODE files.
Also note that stuff like config files or some such that might be
transferred might contain lines that are too large to fit into the
buffer of the printer. This is really just to enable plugins to maybe do
some nifty stuff, no official support of streaming arbitrary files to
the printer's SD (for that we'd need WAY more firmware support first).
See jneilliii/OctoPrint-SmoothiewareConfig#1
We so far assumed that a resend request would follow that. Alas, it
won't and we'll simply get stuck due to a missing ack from the printer.
So let's simulate that here to keep things flowing.
Fixes#2226
* we now don't send the triggered resend/comm errors out of band but
instead as a response to the next received actual line - that
prevents us from getting out of sync
* new trigger_missing_lineno debug function to trigger a missing line
number error _without_ a resend request for testing fix for #2226
Instead of hardcoding a list of supported mixins, we now instead define
a base class (or a list thereof) from which mixins might inherit and use
inspection to determine the set of mixins each plugin implementation
implements. Not only will that reduce the risk of forgetting to add a
new mixin to the whitelist, but it will also allow mixins defined by
plugins.
As seen in https://groups.google.com/forum/#!msg/octoprint/DyXdqhR0U7c/kKMUsMmIBgAJ
a broken entry_points.txt in some arbitrary Python package installed in
the same python envrionment as OctoPrint can make our whole plugin
detection fail and hence interrupt regular server startup.
This adds better protection against such cases.
If snapshot url and/or ffmpeg path are not set, the timelapse cannot
work regardless of what type has been configured.
So if the current configuration still contains a timelapse type other
than "off" but snapshot url or ffmpeg path are unset, force a disabled
timelapse.
Fixes#2206
* Add comment with source file to JsDelimiterBundler and
JsPluginDelimiterBundler
* Include source file name in JsPluginDelimiterBundler catch
block and use log.error instead of console.error
At least unless we've selected git based tracking over release tracking.
This should greatly reduce the likelihood of not being able to update
due to some git repository corruption issues, as has happened to some
people in the past.
If either the full code or just the main code are blacklisted, only
upper case the code. Otherwise also upper case the parameter list.
In any case push originally entered command to history, not the
modified one.
Added new config setting: auto uppercase blacklist that is configurable
in the advanced option of the serial tab, with M117 included in the
default settings of the blacklist. Changed the sendCommand method in the
TerminalViewModel to auto uppercase the entire gcode command except when
gcode is in the blacklist. Updated documentation to include the default
auto uppercase blacklist command M117.
Resolves: #1026
(cherry picked from commit dbf7af1)
We didn't reset the capability flag and also didn't resend M155. Now we
do at least the latter if we detected that the printer supports
temperature auto reporting earlier.
A centralized plugin blacklist read from plugins.octoprint.org on server
start now allows us to stop plugins from being loaded that are known to
cause severe issues with OctoPrint's regular operation.
Blacklist entries can be restricted for specific plugin versions &
OctoPrint versions, allowing for very granular control of any kind of
blocking.
Additionally users may disable blacklist processing in general (an
opt-in wizard and a new section in the settings have been added) and
at server start via the new --ignore-blacklist parameter available for
"octoprint serve" and "octoprint daemon".
If a plugin is blacklisted, OctoPrint will not even import the
plugin module in question (if only a plugin key is specified OR a key
and a version and the plugin's version is already known during import
time, which is the case for plugins loaded from entry points) or at the
very least stop the plugin from being enabled (if a plugin key and a
version is specified and the plugin's version is only known after
loading, which is the case for plugins loaded from directories).
Sets server.startOnceInSafeMode flag to true. Probably easier for a lot
of people than editing a config file or running OctoPrint manually from
command line, in case the built-in "Restart in safe mode" system command
is not an option.
We so far only protected the binding process itself against errors
triggered inside view models. Now we are also more resilient against
issues arising in view model callbacks like onBeforeBinding,
onBoundTo and onAfterBinding as well as exceptions during plugin
instantiation itself.
Triggered by jneilliii/OctoPrint-TPLinkSmartplug#19 which was also
reported on OctoPrint's tracker as #2168, #2170 and #2171 and on OctoPi
as guysoft/OctoPi#427.
There are too many printers out there with crappy electronics that are
just waiting to go up in smoke, and people keep leaving those alone
because "they are monitoring them via OctoPrint, so nothing can happen".
So let's add a safety warning, in the hopes that will bring at least
some people to their senses or at the very least force them into making
the conscious decision to blow all warnings into the wind.
Firefox doesn't trigger dragleave if the mouse leaves the browser
window to another window on top during an active drag. That leaves
OctoPrint stuck with the drag-n-drop overlay.
Adding a timeout for dragover for only Firefox that clears the overlay
solves this issue.
Solves #2166
We also reflect that in the Cura profile import dialog by checking and
disabling modification of the corresponding checkbox if no profiles are
yet available.
Plot area was wrongly sized due to (invisible) X axis tick labels.
We now initialize an empty plot to min/max timestamps of "now" to
circumvent this. Additionally plot was not properly initialized on
initial load of page due to onAfterTabChange not firing for the first
tab.
Also added a bit for tick labels.
Wasn't properly revalidating when an already registered slicer switched
between unconfigured and configured.
Also adjusted data format version tracking on files and slicing API to
match.
We might add fields to things like file entries (e.g. "display") and in
such cases want to refetch the list even if the files itself didn't
change, to make sure those new fields are available to the clients.
See https://github.com/foosel/OctoPrint/issues/2111#issuecomment-337164940
Increased scrollbar width of file list and plugin repository list to
10px (from 5px). Fixed scroll bar hiding itself on initialization due to
alwaysVisible not properly persisting the initial binding.
Enhance knockout binding syntax for slimScrolledForeach: slimscroll
initialization parameters may now be provided during data binding via
the additional slimscroll property accepted as part of the extended
foreach syntax, e.g.
slimScrolledForEach: {data: ..., slimscroll: {alwaysVisible: true, ...}}
Implements #2111
Files (and folders) are still slugified to ASCII for storage on disk,
but now the original filename is stored alongside in metadata.yaml
and used for display in the file list and print status.
The slicing dialog also inherits that display name for use as base
for the suggested GCODE name.
Internally, everything still depends completely on the slugified
ASCII version.
This implements #2094
This would normally not fly at all but we give it a pass here since we
only use that module for auto detection anyhow (and probably not for
much longer since that approach is simply too error prone).
Adapted from
https://github.com/foosel/OctoPrint/issues/2138#issuecomment-334117910
by @dtynan.
Solves #2138 until I come up with something better
If the filename contained a [] pair, the file would not match the glob
pattern used for selecting for deletion.
Backporting the glob.escape function from Python 3.4 and using it here
should fix that. We only use our own ported version if glob.escape
doesn't exist - that should reduce redundant code once we become Python
3 compatible.
If the temperature graph was not on the first tab, the plot would be
initialized without being visible, causing some sizing issues and
alignment issues with the Y axis ticks.
Forcing the plot to only get initialized once visible solves these
problems.
Fixes#2147
That way people clicking too fast on login before the view models are
bound won't be able to make the form submit username and password as GET
parameter to the base URL.
Closes#2108
Otherwise we might run into trouble if we have an OctoPrint instance
running on / and /octoprint2 for example - the browser will send
cookies for both instances to the /octoprint2 instance and whatever
gets processed last will overwrite the value before in Tornado's cookie
processing. This of course will nuke the login session in case of the /
cookie being sent or processed last.
Appending the path/script root to the cookie name solves this, similar
to how we circumvented an identical problem caused by browsers not
distinguishing between ports for cookies.
Solves an issue reported by @mgrl in #2095
That should solve any weird import issues we have when
running gcodeInterpreter.py directly (and hence putting
octoprint.util as first entry into the python path,
causing potential issues with imported modules such as
yaml to catch the octoprint.util.platform module instead
of the actual python platform module).
See reported problem with that by @CapnBry in #2095
Using the win32 API it's possible to prevent the intermediary server
socket from inheriting itself to subprocesses. So let's use that here.
Another bit of the solution for #2090.
There's now a dedicated button for that.
This should get around issues like #2056. Also increased size
of API key display field (where possible). Fixes#2055
Allows preprocessing/sanitizing temperatures as received from the
printer.
Workaround for printers that occasionally report garbage temperature
data, e.g. #2050
Any processes inheriting the open port descriptor of that server will
cause the actual server startup to fail due to the port still being
claimed.
We can't fully prevent this under Windows thanks to fnctl not being
available and win32api being a PITA, and also close_fds on Popen not
being allowed if we also need to redirect stdout/stderr/stdin for a
process. So let's hope hardening against this problem when running
under *nix, adding a bit fat warning to never start a subprocess
during the intermediary's runtime and also moving the only actual
process we so far DID start (analysis backlog processing) to after
Tornado is running will suffice.
Fixes#2035
We were only adding one byte for "\n". That ignored that our regex
could also match "\r\n" or "\r\r" or something like that.
Our split regex now only matches one "\r" or "\n". Empty lines we'll
simply ignore anyhow so no real harm done.
Also, we no longer strip the comments in this step - leave that to
the worker running in its own thread. Not only should that speed
things up a bit, it will also allow us to better debug the worker in
the future.
We were just testing if z_heights[z] was truthy. If the layer index was
set but 0 that wasn't properly detected and let to overwriting our
layer information. Instead check explicitly against undefined.
Closes#2017
* remove some more "fa" classes where they didn't belong
* use "fa-toggle-(on|off)" instead of circles where they were used
to signify toggle actions
* fix SD card icon being too high
Another follow-up to #1915
So far we only supported \n and \r\n, leading to problems with MM
GCODE files generated by Slic3r Prusa Edition which apparently
produces \r line endings for some reason.
Closes#1996
Clicking terminal output (excluding highlighting) will set focus to terminal command
Change fancy functionality style from muted to warning so that it stands out more
We won't support this after all, it's too much of a headache with
regards to the sending queue. Pausing takes longer, cancelling takes
longer, resends get more complicated and so on.
Command expansion in the queuing phase needs to suffice.
E.g. in case of a disconnected thermistor, or when it is really
really cold. Make sure our parsing doesn't get confuse by this and
thinks that
ok T:150.0/210.0 T0:-55.7/0 T1:150.0/210.0
is actually only T and T1 being reported by the firmware, causing
stuff to be wrongly canonicalized thanks to T/T1 being Smoothie's way
of reporting dual extruder setups.
Fixes#2007
Introduced a custom send queue type that actually contains two queues,
one for resends, one for regular lines. A flag indicates whether
lines should be returned from both or only resends. That way we
ensure that as soon as we have an active resend request we ignore
what was already in the queue and only send the lines we need to resend.
Also: PrependQueue => PrependableQueue
Less tracking of offsets and also more similar to how
firmware does this.
We rewrite our current position on tool change to current position
plus tool offset instead of applying it for every single
position change.
We fetch settings once explicitly after passive login but before
completed startup. Without this patch we fetched them again after
onUserLoggedIn got fired (if it got fired by the passive login)
during startup. That's not necessary because we did the passive login
before our initial settings fetch, so IF that already logged us in,
our settings fetch already was done with us logged in as well and
the onUserLoggedIn later only tells us what we already knew.
We still had some concurrent requests triggered through onStartup that
managed to overtake the passive login (and hence nuke the session
data on the client). This should now really not be possible any longer.
Also created a sequence diagram of the new process and linked it from
a lengthy comment.
It caused issues with our line number tracking in the browser
developer tools and I don't see any way to avoid this considering
that we can't adjust the arguments supplied to console.log without in
fact wrapping it :/
Under specific circumstances it could happen that the passive login
response was overtaken by a response from an earlier still
unauthenticated request which would then effectively overwrite the
session cookie immediately and hence cause the browser to use its
login session against the server, but without displaying that to the
user. See #1881 for what is probably an issue caused by exactly this
kind of scenario.
Additionally a couple of requests needed to be done a second time
after login, just moments after having done them for an anonymous
user. See #1572 for a request to change this behaviour.
This patch changes the startup order of the web interface like this:
1. connect to the websocket, postpone any events triggered by
this (e.g. "fromHistoryData") until 3
2. perform a passive login, postpone any events triggered by this
(e.g. "onUserLoggedIn", "onUserLoggedOut") until 4
3. trigger postponed events from 1
4. trigger "onStartup" (triggers postponed events from 2)
5. fetch settings
6. bind view models etc
A connection close of the websocket will disable event processing on the
socket until it is marked as initialized again by the passive login
processing, which will also be triggered immediately on server connect.
That way under normal circumstances nothing should ever get triggered
in the registered view models that might generated requests to the
server API until a passive login has been done, a server session
initialized and if necessary a user properly authenticated.
They might be nozzle priming routines which are not actually part of
the model proper and hence it doesn't make sense trying to keep them
visible when zooming in on the model, or allowing them to offset the
model center.
Now also detects capabilities reported by (extended) M115 output and
if AUTOREPORT_TEMP is available enables it with the configured
autoreport interval and disables active polling.
Implements #1679
See #1942
This does NOT fix the root cause of `_default.profile` becoming an
empty file (apparently during migration from config.yaml?), however
since this particular situation was impossible to reproduce so far this
workaround for the consequences will have to suffice for now since we
want a hotfix as fast as possible for 1.3.3.
* fa-circle-blank does not exist, replaced with fa-circle-o (see also
report in #1928)
* fa-trash-o instead of fa-trash (same look and feel)
* fa-check instead of fa-check-circle (same look and feel)
* fixed toggleContent binding to also be able to toggle fa icons
* fix deletion spinner in file list (was still using old icon-
classes which of course weren't there anymore and hence not
toggleable)
* icons-ul => fa-ul
* remove superfluous fa class from some places
Follow-up to #1915.
Instead of disabling capturing of postroll by default (which we actually
don't want and doing so was a mistake thanks to misremembering the
meaning of the variable in question), we now properly reset the
default value for that check box (which wasn't properly set only due to
a very stupid typo).
That fixes up the relative URLs to the font files and should make updates down the line
a thing of a quick copy and paste (plus allow some more sophisticated dependency
management down the road as well).
Also renamed fonts folder for FontAwesome 3.2.1 from font to fonts, for more
consistency.
Otherwise we will block ourselves, waiting for the restart command to
complete which it only can when we are no longer there.
Should reduce restart times on update significantly.
Downside is that we no longer can wait for the return code of the
call. However, that should be caught by our UI handler timing out for
the restart and showing an error prompting the user to restart
manually.
By default G90/G91 define relativeMode, M82/M83 define relativeE. The
extruder coordinate will be viewed as relative when either
relativeMode or relativeE are set. This mirrors the implementation in
Marlin (current and legacy forks) as well as Repetier.
SmoothieWare's implementation resets the relative mode of the
extruder on a G90/G91. To still accomodate this different
implementation a new settings has been added under Settings >
Feature: "G90/G91 overrides relative extruder mode". Checking this
switches to the alternative interpretation for future gcode analysis
and visualization.
The only difference between the two of them is that the following
segment of GCODE:
M83
G90
will have the extruder still set to relative on Marlin and
Repetier but set to absolute on Smoothieware.
Please note that the setting in all likelihood will be moved to
the printer profile in the future, since it makes more sense to have
it on a per printer basis. It's not part of the set of features
available for auto detection since it's required for GCODE analysis
and hence needs to be known even outside of a connection to the
printer.
Implements #1818
An aspect ratio of 16:9 is assumed, with other ratios showing black
letterbox borders as required.
During loading a text "Webcam loading..." is displayed in the webcam
space. On loading error, the (broken) image is hidden and an error
text is displayed instead.
Solves #478
Otherwise we might run into a rare race condition where the M110 sent
on start of a SD card upload gets prepared for sending after the
source file is already opened. That would then lead to the M110 not
getting processed anymore by OctoPrint and hence the line number
counter not resetting accordingly, leading to one line number
mismatch after the next from the firmware.
Testing if our "isPrinting" flag is ALSO set to true here ensures
that we'll only stop processing commands internally once the state
has actually switched to printing, which only happens after the
firmware responds to the M28 sent after the M110.
Fixes#1882 and probably also the issue encountered by @amd989 in
#1762 (which looks like exactly the same problem)
Disable button when a test is already active. Also have spinner
defined centrally and only made visible on active test.
Should hopefully give better feedback to impatient users ;)
Solves #1897
* Use click data-bind for submit button instead of manual click
binding
* Keep metadata synchronized (otherwise changing identifier, name,
description, overwrite or default flag after adding a file does
absolutely nothing)
* Disable submit button and fields when no file is selected.
* Disable submit button (and show spinned) when request is in
progress.
Related to #1893
This fixes#1893.
Also, only bind click to the "Confirm" button once instead of binding
and unbinding it for each file. Binding it just once seems cleaner.
(cherry picked from commit 83d1921)
If double the speed needed for output during print/fancy terminal
functionality is detected, re-enable that after a timeout of 5s.
Decrease of speed cancels the timeout again. That should prevent wild
toggling.
Should solve #1862
Some users get confused by having to use the blue "Print" button in
the state panel for consecutive prints of the same model, let's solve
this once and for all.
Move the AutoScroll function to an animation frame to prevent layout thrashing and to keep it in sync with fastForEach
Remove the <br> tag from the terminal and use display: block; on span tags to prevent increasing DOM nodes and faster processing of the terminal
On call of the lazyload plugin, all matched img elements will be
checked if they have a data-src attribute. If so, their src attribute
will be replaced with the contents of the data-src attribute
(effectively loading the image) and the data-src attribute will be
removed (so that multiple calls don't call multiple processing).
* Don't restrict the list of compatibility values to check against
to only those we have mapped, also support unmapped more exotic
ones.
* Allow 1:1 check against sys.platform values (with startswith).
Combined with the above that allows very granular compatibility
modelling ("freebsd11", "freebsd12") if required.
* Instead of only whitelisting ("linux", "freebsd") now also black
listing is possible ("!windows").
A detected os must match all provided whitelist elements (if the
whitelist is empty that is considered always the case) and none of
the backlist elements (if the blacklist is empty that is also
considered always the case).
See the included unit tests for examples of how this works.
Apparently python setup.py develop tries to re-install all scripts
provided by plugins (maybe only under Windows?). Since that includes
OctoPrint's own executable, things will explode with an access denied
error there. Switching over to pip install -e . fixes that, and also
is more conform with the install approach the plugin will take in
production anyhow.
So far using the "... from URL" or "... from an uploaded archive"
mechanism for installing a plugin would fail without further
information if the plugin to be installed was already installed.
The plugin manager will now detect this situation by parsing the
corresponding message from the pip output and trigger a reinstall
instantly.
A message about this will be logged to octoprint.log and the install
output.
Additionally the error handling for installation errors has been
slightly improved (install output no longer says "Done!" but "Error!"
with the reason as provided by the server) and the "could not install
plugin from URL unknown" issue should also be solved.
Evaluates json data file as e.g. published on
plugins.octoprint.org/notices.json and displays notices for plugins
installed and matching (optional) version lists.
* Extended plugin metadata by new property, only evaluated for bundled
plugins.
* Adjusted plugin manager to evaluate new metadata and add
confirmation dialog with details when attempting to disable such
a plugin.
* Added combined OctoBlog feed, replacing news + spotlight (+
octoprintonair), added corresponding config migration
* Subscribe to all registered feeds by default
* Added config button to announcement reader
* Added note how to edit announcement subscriptions to notifications
* Auto-hide announcements on logout
* Order channels server-side based on new order config setting
Old default behaviour of showing logged in users the update
notification stays default, but can now be disabled via the software
update plugin settings.
Additionally added the ignore button to the notification for users as
well (and made ignore entry in local storage user specific to still
show notification to other logged in users), plus a small hint that
in order to apply updates an admin is needed. Additionally now hiding
the notification on log out.
Closes#1739
Also introduced a new helper, a progress modal that can be used for
providing feedback about things such as bulk delete operations in the
background.
See #748 and discussion in #1807
It now resides in a file on disk and can be deleted. If the profile
configured as default is not available (e.g. due to having been
manually deleted, or on first start), the default profile as defined
in the profile manager will be written as _default and that will be
used/set as default.
On first start after this change gets applied, OctoPrint will migrate
the old "default overlay" residing in config.yaml to a file on disk
and delete the old entries in config.yaml.
Solves core reason of #1734
Addition of a notification under the save button when there are unsaved
changes, and a notice under the save as default checkbox when unticked,
that changes are only temporary.
Also move the "interval" box up the top to position it underneath the
timelapse type dropdown list, and change the text to be a bit more
descriptive.
(cherry picked from commit 381a016)
System wide API key now offers a generate button like the user
API keys. Setting the API key directly to a value via the settings API
endpoint is now no longer possible, which should prevent setting it
accidentally thanks to the browser prefilling things where it shouldn't.
No delete button is offered for the system wide API key since it will
get automatically regenerated on server start if not set, so
regeneration is the only functionality here that makes sense.
If no API key is set in the user settings, the "delete" button is now
disabled. If a key is already set and a new one is to be generated, a
confirmation dialog makes sure this is really what the user wants. Same
for deleting an existing API key.
Both the system wide API key and the user specific API keys will now
only display a QRCode if there's actually a value for the key.
Might confuse users to see that marked up like an error when it's
perfectly normal for some kinds of installs simply because the
specific build folders never were created in the first place.
Force --all on stock clean command unless --orig is specified, in
which case "python setup.py clean" behaves like the stock clean
command. Additionally there are now --noeggs to skip egg deletion and
--nopyc to skip pyc deletion.
Might have been an external reset of the printer we didn't otherwise
detect, and unless we reset the line numbers we'll now be off and run
into resend requests.
Solves #1676
* UserSettings: crashed if overwrite an existing key with primitive value by same key with complex value. Also reduced number of calls to user.get_setting()
* Updated tests
(cherry picked from commit b75b53d)
On reload of the user settings a new user object was created but not
updated on the associated session user(s). That let to session user
(s) still referring to the old user instances with the only partially
updated user settings.
Behaviour changed such that on a reload of the users from file
(including user settings) all registered session users will now get
their reference updated as well.
Also made modelling of user id to session id a bit less redundant.
Former implementation tested for z-hop rising flank and anything that
is falling. That however causes issues with z-hop directly followed
by layer change (diff is not z-hop size but negative, image hence not
captured).
Instead of testing for positive flank == z-hop and any negative flank,
we now test for absolute value == z-hop.
Solves #1777
Cache was not invalidated on change of:
* snapshot URL presence
* system menu entry presence
* gcode viewer enabled/disabled
* changes in access control availability
Refactored cache setup to add enable_timelapse, enable_gcodeviewer
and enable_accesscontrol to ETag calculation, removed system menu
check. Template filtering will now be done based on the values of
these flags at render time, not before.
See also #1776 for a related ticket.
* Use only icons for settings and system entries
* Limit length of login entry to 100px
* Limit length of instance name to 250px
* Removed "OctoPrint" text if instance name is set
See discussion in #1741
* leading and trailing null bytes will now be stripped
* while connecting, a "wait" will also trigger switch to connected
state - relevant when connecting without reset and initial "ok" for
M110 gets mangled
* extended virtual printer by new options to test the above:
* mangled "ok" can now be injected via "preparedOks" setting and
prepare_ok DEBUG command
* simulated reset lines on beginning ("start" etc) now only sent
if new setting "simulateReset" is true
Should fix#1770
Extracted methods to check if modification of a file is possible and
to determine if a specific file is currently select to take care of
denying upload and re-selecting file after upload.
Refactored watched folder handler to use the same methods and mirror
behaviour of file upload via API.
Should solve #1760
* Endless recursion on file delete as reported in #1738
* Broken implementation of .move
* Broken definition of .pathForEntry, .entryForPath,
.pathForElement and .elementByPath
API endpoints that were not decorated with restricted_access so far did
not properly create a user session for cookie-less requests with an API
key only.
That meant that flask.current_user stayed an anonymous user, even with
the global admin API key. In case of /api/settings that meant that even
with the global admin API key it was not possible to read settings that
are admin-only (like the API key for example) or user-only.
This has now been rectified by moving the session creation into a
different before_request handler that is registered globally on all API
endpoints, meaning that an API key will now always lead to a user
session to be created, regardless of the requirements of the API
endpoint in question. Additionally the CORS handling was extracted
as well as the API key presence enforcement.
BlueprintPlugins will now also get the CORS and session-from-API-Key
treatment if they do not declare their endpoints as restricted.
Might solve the API key "n/a" issue filed in #1751, but since the cause
of that isn't identified yet that's not sure.
Don't allow overwriting of "octoprint" config through plugins, don't
allow overwriting of already registered configs unless id to register
matches plugin identifier (in which case the already registered config
was probably a case of a copy-paste-error from another plugin).
We now have a global OctoPrintClient, which is the class from which
all clients are derived, and a global OctoPrint, which is a single
instance already setup and ready to use in case we only need one.
It would be cleaner to have clients create that singular instance
themselves, but we need to maintain backward compatibility for now
with how we established the client to work with the 1.3.0 release.
New clients can be create with
client = new OctoPrintClient({ /* options */ });
Alternatively the options can be left out and set at a later point:
client = new OctoPrintClient();
/* ... */
client.options = { /* options */ };
Individual client components register themselves with OctoPrintClient
via OctoPrintClient.registerComponent(name, component) from the
component JS files. Just like before their instances are then
available in the individual client instances under "<client>.<name>",
e.g. "OctoPrint.files".
Plugin components register themselves with OctoPrintClient via
OctoPrintClient.registerPluginComponent(name, component) from the
component JS files. Just like before their instances are then
available in the individual client instances under "<client>.plugins
.<name>", e.g. "OctoPrint.plugins.softwareupdate".
This should make it possible to create dashboard pages utilizing the
JS client that monitor the status of multiple OctoPrint instances,
without workarounds such as having to swap out the options globally
before each request.
See #1681 for the corresponding discussion.
Support multi-extruder setups that share a single nozzle and heater,
like the E3D Cyclops, Diamon hotend or probably the upcoming Prusa Mk2
multi-extruder upgrade.
The Control tab will still allow tool switching and extruding for
the configured extruders, the Temperature tab will only display
one hotend temperature though.
Printer profiles have been extended by a new option
extruder.sharedNozzle that defaults to False. Extruder offsets are
not displayed in the profile editor if that setting is checked and
reset to (0,0).
When the sending of the first line of a file to print is still taking
place while an "ok" from the firmware comes in, it's possible
that two threads will try to access the file handle in parallel. That
can lead to trouble within Python's codecs module.
Synchronizing all access to the handle should do the trick.
So far the plugin selected the gcode script corresponding to the number of
extruders configured in the printer profile. After a close look into the
implementation in Cura itself, prompted by #1708, it turns out that this is
in fact wrong.
Cura selects the gcode script to use based on the maximum of the number of
extruders needed for printing the models in the scene and the minimum number
of extruders needed for generating support (if support extruder is "both" or "first"
or there is only one extruder, that's 1, if it's "second" and there is more than one
extruder, it's 2).
This commit changes the plugin's implementation to mirror this implementation.
The difference to Cura is that we have the number of extruders needed for the
models in the scene hard coded to 1 since we only support STL right now which
can never contain more than one object. If we ever decide to support merging of
multiple STLs into one single multi-extruder print or other model files like AMF
or OBJ from OctoPrint's slicer support, we need to change this.
Affected print_temperature and filament_diameter placeholders.
E.g. `print_temperature2` was wrongly attempting to fetch `print_temperatures[2]`
instead of `print_temperatures[1]` (0-based-indexing!)
Partially fixes#1708
* Fix priority queue sorting (sorts ascending, not descending!)
* Abort low priority jobs when a high priority job comes in
* Utilize queue for tracking aborted jobs too
* Abort analysis for items that are to be deleted/moved (also
fixes issue under Windows where it was impossible to delete
a file for which the analysis was still running).
* move hidden login form to the left to hide overlayed
Lastpass context buttons
* do dropdown toggling for login form manually to
not only ignore clicks into form but also into overlayed
Lastpass context buttons for closing the dropdown again;
do close dropdown for included a and button elements
though
* Added/changed mappings of profile to engine settings to
match Cura Legacy mapping:
* perimeterBeforeInfill: taken from perimeter_before_infill (new,
fixes#1693)
* skinSpeed: taken from solidarea_speed (new)
* raftAirGapLayer0: sum of raft_airgap and raft_airgap_all
* raftAirGap: taken from raft_airgap_all (new)
* raftFanSpeed: changed to 0
* raftSurfaceThickness: taken from raft_surface_thickness (new)
* raftSurfaceLinewidth & raftSurfaceLineSpacing: taken from
raft_surface_linewidth (new)
* Mach3 Gcode Flavor replaces S parameter with P parameter in
temperature commands within generated GCODE, like in Cura
Legacy
If the slicer returns values for a tool we want it in our analysis
result, even if it's zero. That way the result will be the same as
if we have our own built in gcode analyser take a look at the
file.
(cherry picked from commit 818ae92)
This fixes the issue that there were no informations about filament
usage in metadata after slicing with cura plugin. Trying to call
profile.get_float("filament_diameter") ended in en exception with
message " 'module' object has no attribute 'get_float' ". So i defined
profile before using profile and now it works.
See issue #1685
Also inserted a check to determine if filament usage is > 0 to exclude
tools with no filament usage in metadata.
(cherry picked from commit c9b38bd)
* Properly handle G0/G1 with no X, Y, Z coordinates in relative mode
instead of duplicating coordinates - should fix#1675
* Only take move commands with X, Y, Z coordinates into account for
model size calculation - this makes our internal GCODE analysis behave
like the GCODE viewer's analysis and produce the same model size. The
downside is that extrusions on the origin are no longer taken into account
for checking if a model is within bounds of the print bed, but that should
hopefully not produce any issues in the real world.
Variables defined in an outer scope can no longer be set from an inner scope (see
pallets/jinja#641). Regardless of whether that is right or wrong, we can't control if
people are using such constructs in their plugins, which versions of Jinja >= 2.9 would
now break out of the blue, regardless of OctoPrint version. That is unacceptable sadly
and requires pinning for now, until plugin authors have had a chance to adapt
accordingly.
Also see #1697.
--basedir, --config, --verbose, --safe may now come before or after
subcommands and should still be evaluated.
For the server commands (legacy, "server" and "daemon"), the same
should now hold true for the related parameters --host, --port, --debug,
--logging, --iknowwhatimdoing and also --pid (for daemon command).
While having the parameters belong to the individual commands and only
there (which is click's basic approach) is way more cleaner, too many people
were running into issues with that strict approach after all.
I just hope the somewhat hackish approach with context injection needed to
get the less strict version to work won't backfire badly in the long run.
See also #1633 and #1657
--version is a flag, not an actual parameter (wouldn't really make sense
too). I'm not sure why that isn't the default behaviour of the built-in
version_option decorator tbh.
See #1647
Two problems solved:
* Make sure to only process temperature data once we
have printer profile information on hand to evaluate
the heater data. If we don't have that yet, create a client
side backlog and process that once we have the necessary
data on hand.
* Do not use uninitialized history cutoff values - if our cutoff
value hasn't yet synced (no settings response arrived yet),
just don't perform the cutoff.
That api endpoint really is a tough nut. ETag calculation now also
takes full settings dump from settings plugins into account, because
those might be providing custom keys through custom on_settings_load
implementations, for which we will not notice any changes if we are
only looking at the effective config.
Of course, the more we put into that ETag calculation, the slower it will
be and the less sense it will make. Somewhat annoying :/
Not testing if oldRoot was actually set and contained the
key in question could cause issues if a completely new data
structure was sent to the backend that was not mirrored by
the default settings. Things like e.g. complex configuration
items in a by default empty object.
sarge's "wait_events" is unreliable. If an asynchronous
job is started but stops immediately and raises a sarge
Exception (inside the async thread), the associated
command's event will never be set event though the
process finished. So we'd wait indefinitely here.
We circumvent this by first waiting until the commands
are parsed and processed (p.commands contains
elements), then until said commands are started and then
making sure the command's process is actually set. Only
then do we actually have a background process running
that we'll be able to monitor further down, otherwise
the command immediately failed.
Removed a potential deadlock, added logging for all
raised exceptions, made _to_error more solid and
removed another potential encoding issue when
creating diffs
">=4.0.2,<4.1" will pull in 4.1b and we don't want that due to issue with
that and websocket communication due to permessage-deflate.
While we desperately need to migrate to a newer tornado, due to some
voodoo needed to get large streamed uploads and downloads to work
that is probably not completely straightforward and therefore
something for post-1.3.0-stable release.
Having that output stay on stderr and hence in shiny red looks way
too alarming considering that it's only a pip update that is not THAT
critical usually (and we don't want to do it automatically anyhow
considering how often that appears to break stuff).
If the SettingsUpdated event for whatever reason got slightly delayed and arrived AFTER
the save request was already processed, in rare situations it could happen that the
"Settings Changed" popup was triggered even though the settings had already been
successfully saved.
Modified such that we now keep track of if we already saw the SettingsUpdated event
associated with our save request and if not we ignore the next one.
To ensure that we don't get out of sync due to that when a settings update request is
sent, but no settings are actually change, we also now always trigger the SettingsUpdated
event, even in such cases. Clients can use the hashs in the payload to test if something
actually changed - if necessary.
We used to track our webcam stream URL by the global variable
CONFIG_WEBCAMURL. That's still a left over from the architecture
about four years ago and completely obsolete these days.
Additionally it causes issues now that anything rendered into
the page (as this variable value is through initscript.jinja2)
will not be changed unless the page cache is refreshed.
Taking the stream URL from the settings view model instead
solves that problem and is way cleaner anyhow.
If there are custom system menu entries for restart, reboot and/or
shutdown, they are deleted. If the corresponding server command is
not yet configured, the command from the system menu entry is
transfered.
Can be enabled either through new --safe command line
parameter or through server.startOnceInSafeMode in
config.yaml
When running in safe mode the plugin manager will
only allow to disable or uninstall third party plugins. Enabling
third party plugins or installing new plugins is disabled.
That will hopefully allow for more straightforward recovery
in case of a misbehaving plugin.
If enabled (which it is by default), OctoPrint will now send
an M115 to the printer on initial connection in order to try
to figure out what kind of firmware it is. For FIRMWARE_NAME
values containing "repetier" (case insensitive), all Repetier-
specific flags will be set on the comm layer. For FIRMWARE_NAME
values containing "reprapfirmware", all RepRapFirmware-
specific flags will be set on the comm layer.
For now no other handling will be performed.
Timing issue, "OctoPrint.job.start()" would be called at a time
when the file had not yet been selected on the server. Hence
a different approach, calculating printerAfterLoading parameter
based on existing information at the time of clicking the
load button and using the print parameter on the select
file API again, as previously.
That bounding box may have larger dimensions than the print volume
(but not smaller ones). That allows to define safe areas for which no
"exceeds print volume" messages need to be triggered.
Solves #1551
Implicit match on \n appears to be causing issues when
generating the sdist tarball under Windows. Matching against
\s+ instead works reliably. Simply including the newline in the
matched JSON string would also work fine.
Otherwise the cache of /api/settings would not be properly invalidated
on a change in either the user login state or the set of active plugins.
See also #1576
The way it was before, the function would also return itself. This isn't really a problem here, but if someone takes this function as a guide (like me) they can run into problems when iterating over the returned array, as it contains an element representing "values()" itself.
Another approach would be make use of the inspect package and replace name="values" with inspect.ismethod(name)
When setting the tracked target temperature from a sent temperature
command, the changes in tracked temperature were not propagated
from the comm layer to registered callbacks.
But since the standard printer also didn't make a copy of the mutable
dict of tool temperatures, those were in fact updated even without
propagation in the printer implementation when the values in the
comm layer got updated, whereas the bed temperature - an immutable
tupel - was not.
Two wrongs sometimes do in fact make a right. In this case that led
to target temperature changes on the tools immediately reflecting
in printer.get_current_temperatures after the command was sent,
but changes to the bed target taking until the next M105 response
to propagate.
Decoupling the data structures and adding propagation commands
to the comm layer solves this issue.
Fixes#1543
-r only allows a limited set of target framerates according to the mpeg2
standard, but -framerate allows to specify how long each frame should
be shown, giving us full control over "virtual" fps without causing errors
when the user selects a non-standard frame rate
Long lines (longer than rx buffer) could not be processed at all, leading
to a serial timeout exception thrown by the virtual printer. Adjusted
to allow for partial processing like on maintenance
That way a JS error in an external plugin won't nuke the whole UI, which IMHO
is worth the additional requests needed to load the split up files.
See #1544 for an example of such a situation.
The bug only manifests if a user had installed 1.2.16 earlier and never once hit "Save" in the
settings before attempting to update to 1.2.17. With 1.2.16 the updater script and settings for
OctoPrint's own update mechanism were changed to prefer "checkout_folder" instead of
"update_folder". In earlier versions however "update_folder" was still used. Saving settings
even once (even without any changes!) will migrate the data. But if that's not done a
KeyError will be raised when trying to retrieve "update_folder" from the check config, with
"checkout_folder" as its fallback.
Rather stupid error really.
* show special error if timelapse can't be rendered due to no frames having
been captured
* inform user during print about repeated capture errors
* do not start post roll recording if after a print no frames were captured at all
* also interpret non-ok-ish return codes from snapshot url as capture error
* documentation for CaptureFailed event
Filter toggling didn't remove the specific filter but always the last item
in the filter list. No, I don't know either why I didn't notice this earlier m(
If a content type header was present on a multipart form data part it would turn
the rewritten body into a unicode instead of a byte array, causing a later conversion
to a byte stream to not capture.
Fixed both the fact that the rewritten body would turn into unicode by making
sure the content type header was provided as byte array and fixed the byte stream
conversion to also trigger on unicode instances.
Solves #1531
To answer https://github.com/foosel/OctoPrint/issues/1048 I changed L357 to "output += gettext("Last Print Time") + ": " + formatDuration(data["prints"]["last"]["printTime"]);" as proposed by @ntoff
Only keep the cache keys, but that way we know when
we were going to cache something and then didn't
due to environmental factors, e.g. headers on request
or response.
Necessary to be able to track if the preliminary caching
has been done during startup to properly reflect that
on cached.gif
They are still useful for other clients than the core application. Renamed them to fit the
general naming on the API however:
* pathForElement is now called pathForEntry
* elementByPath is now called entryForPath
Was marking the config as dirty just when printerParameters entry existed,
which always exists - various sub entries of that are what needs to be checked
instead.
Example:
* both "session" and "session_P5000" cookies available: "session" value from "session_P5000"
* only "session" cookie available: "session" value from "session"
* only "session_P5000" cookie available: "session" value from "session_P5000"
Also added API docs regarding header encoding, incl support for RFC 5987
for filename fields in Content-Disposition headers in multipart/form-data
parts, incl. an example of an upload request with a utf-8 encoded filename.
Solves an issue with clients encoding filenames in multipart
headers in ISO-8859-1, causing an HTTP 500 response code.
This change makes ISO-8859-1 encoded headers work, sends
a 400 Bad Request instead of 500 Internal Server Error if the
request multipart headers cannot be decoded as either UTF-8
or ISO-8859-1, defines UTF-8 content type for multipart text
fields in rebuilt body and also adds support for RFC 5987 for the
multipart file upload "filename" header component.
* make sure server_port headers are properly set in reverse proxied scenarios
* overwrite request and response classes to
* always apply reverse proxy environment changes (so far missing for tornado
context)
* strip cookie name suffixes from cookie names on requests and
* be sure to set cookie name suffixes for cookie names on responses
* include script root in path used for cookies
* some minor refactoring in octoprint.server setup routines
* removed ReverseProxied class (didn't work for tornado context)
* add unit tests for the whole reverse proxy, request and response customization
(Let's be realistic here)
Introduced new "additionalNames" property on viewmodel declaration
to allow for registering alternative lookup names for a view model.
The freshly renamed FileViewModel now resolves as both "filesViewModel"
and "gcodeFilesViewModel", making the renaming backwards compatible
Documented all that stuff (and some more)
Removed unnecessary (and broken) call to event.preventDefault,
moved styles to less/css and also made sure to disable the buttons
not currently usable.
Most caching is left to the client, by utilizing ETag and Last-Modified headers.
Where it was easily achievable, an additional server side miniature cache of intermediary
results was introduced (e.g. for the files). The regular cached decorator was not used
since it targets caching full responses, and the responses in question already contained
client request specific data. Caching "one step earlier" allows better usage of the cache here.
Also introduced a dependency on the scandir module, to get a bit of a performance boost
on os.walk and os.listdir (which have been replaced with scandir.walk and scandir.listdir
respectively). See https://github.com/benhoyt/scandir#background on why that made
sense.
We can't rely on the publication date anymore with the introduction of prerelease
channels, since e.g. a current devel prerelease might have been published
earlier than the latest stable but should still be considered the latest release for
this release channel
We'll need to turn that into a separate plugin and while at it also
move away from the generalized slicing profile format.
That's more a topic for after 1.3.0 however, so for now, just
clean this up.
We might just have "eaten" a line used for triggering a pause (e.g. an M0)
and thus might not be eligible to send the next line from the streamed file
anymore.
Solves #1448
Should make sure stuff doesn't break when people perform manual
file operations on the uploads folder (e.g. uploading files
that don't match the sanitization scheme).
Should solve #1434
Probably solves the core reason that caused #1428 to be
reported in the first place, totally inaccurate early linear
approximations (when nothing better is available) making
it to the user.
It should now display "Calcuting..." until the approximation
stabilizes OR the configured max percentage or max time without
an estimate are reached.
* print progress shows percentage
* upload progress shows what it always showed, but fully centered
* GCODE viewer progress shows what it always showed, but fully centered
Seriously though, this topic is driving me nuts...
* track origin of print time left estimate
* less draconian threshold for estimation helper for all prints, not just
sd prints
* sanity check estimated/statistical total print time, if not sane force "dumb"
estimate
* force "dumb" estimate if no other estimate is available after set percentage or
print time
iteritems got removed items is to be used for python 2 and 3
compatibility , it returns a view in python 3 and must be casted to a
list if the list is needed.
bytes form builtins
using builtin function next is the compatible way between python 2 and 3
Set read timeout on serial port to a much shorter value (default 2.0s)
during a heatup. Firmware should usually send the current temperature
back every second, so if that stops we can consider the heatup to be finished
even if we don't see an ok.
That is important in cases such as SD printing, where we might see a
heatup sequence we didn't trigger ourselves, during which we shouldn't spam
the printer with commands it potentially can't process but after which we
still should take up normal communication again. In case of a heatup sequence
triggered by an SD print we won't see an ok and hence only can now through a
timeout that things are now done printer side. In such a case the user should not
get thrown a scary timeout message in their general direction either.
Solves #1409
So far the sending routine did not track the amount of bytes that were
actually sent. This is now fixed such that if the number of sent bytes
is less then the number of bytes of the whole message, the sending
rountine will continue to send the unsent parts of the message until
it succeeds (or a timeout occurs).
Also adjusted the virtual printer to imitate a real serial interface with
regards to having it return the written bytes and allowing a partial
sending (returning the number of bytes that actually were sent).
Added name and path various event print job events and
the upload event, deprecated the file property.
Had to move event triggering of the print job events to
the printer implementation, since the file manager
is not available in the comm layer. Added new callbacks
to the PrinterInterface to allow for that to be possible.
In some situations an error could be displayed otherwise since
online.gif was available, intermediary.gif wasn't anymore, but pinging
the latter timed out before the next ping of the former.
(cherry picked from commit 7809ba8)
Also user window.location.reload if URL to reload is the same as the current one,
otherwise reloading will be a no-op if a fragment is provided.
(cherry picked from commit a367902)
RepRapFirmware enumerates the gcode files starting at /gcode, it will
also interpret any relative path as being relative to that folder.
However a full absolute path will actually interpret as from the real
root of the SD card :-(
(cherry-picked from ac68570)
* Introduce Vector3D type to help with coordinate back and
forth calculations
* Fix typo in movement calculation (Y twice instead of Y and Z)
* Removed some code duplication
* UiPlugins may now disable preemptive caching
* Preemptive cache recording will also be disabled when preemptive caching
is disabled according to settings (so far only execution on startup was prevented
then)
* Preemptive cache forces configured view. E.g. if plugin "someplugin" was recorded
in the preemptive cache, a custom context now makes sure that only that this view
will be cached even if request parameters are hard to define to get routing to work
correctly for an alternative UI
"only_local" was not properly evaluated
when retrieving full settings tree for
config diffing and minimal persistance
in SettingsPlugin.
That lead to overlay settings making their
way into config.yaml.
RepRapFirmware enumerates the gcode files starting at /gcode, it will
also interpret any relative path as being relative to that folder.
However a full absolute path will actually interpret as from the real
root of the SD card :-(
Another update of the CHANGELOG after fixing a bug. Shifted release date
to tomorrow to leave more time for final tests that was now eaten up by the
last minute bug fix.
Also updated CONTRIBUTING file to explain new prerelease branch.
Events SlicingProfile(Added|Modified|Deleted). Initially thought to be necessary
to properly refresh available profiles in slicing dialog, not needed for that after
all but still left in and documented, might be useful for someone.
UI removes action buttons for them and displays a spinner
indicating that the timelapse in question is either being
recorded or being rendered at the moment.
Should prevent users from accidentally trying to render an
incomplete timelapse.
Could trigger lots of errors if an unrendered timelapse currently
being collected was deleted from a separate thread from right
under the collection thread.
Also only log errors while processing already deleted files
if debug logging is enabled.
Finally trigger MovieDone event AFTER deleting unrendered
files (otherwise just rendered timelapse might still be present
when list of timelapses is queried right after).
Should solve #1326
This should never have been a PriorityQueue, or at the very least it should
never have the data itself in a sortable structure.
Thanks to processing speed of the event queue that seldomly showed,
only in cases where two events entered the queue almost simultanously,
e.g. when starting to render a timelapse movie and immediately failing.
Should solve #1343
This fixes a simple typo in the API doc for fetching slicing profiles. The previous example had /profiles appended to it, whereas it should just be /api/slicing to fetch a list of all slicers and profiles.
* Do not trigger notifications within additional data generation,
that would trigger a LOT of notifications just on page load. Instead
adjusted to only display notification if a problematic file gets
selected for printing (and select & print gets downgraded to just
select in such a case too)
* Made some left-over english-only strings translatable
* Added Model Size display to additional data in file list (if we have
it, why not show it :))
* Slight rewording of notification.
* Fixed a merge error.
Should actually not have been limited to admins-only, that was an accident
during switching to 1.2.0 implementation.
Once #1110 is tackled, this should be something configurable based on the role
as well.
* Sponsors => Supporters
* Links to individual About dialog tabs from start page
* Slight rewording here and there
* rel="noopener noreferrer" for external links
When SD card support is disabled on the server, remove any client side
filtering to just SD files since there aren't any and there won't be UI
turn remove the filter either. Should address #1300
There could be some odd circumstances in development environments
leading to an older Click version being installed during an update restart,
so since it doesn't hurt as much to stay backwards compatible here, just
be it.
On win32 systems, Click 6.x uses win32 library functions to retrieve
the command line arguments in order to not have their encoding
destroyed. That clashes with rewriting of sys.argv like e.g. the PyCharm
debugger is doing it, causing the debugger parameters to be passed
on to the click parser.
Added a workaround that detects if sys.argv and the os specific
argument list don't have the same length and truncates the os specific
list if that is the case, in order to not pass on arguments from the os
that where already cut off from sys.argv by something else.
* was still only reading one line per 500ms, now reads
all available lines from stdout and stderr
* patch was written with too many newlines
* git reset was missing --hard parameter for forced versions
* proper unicode handling
* added git clean for code base reset
* make sure path to python executable doesn't have left-over
quotes on windows
We don't want to wait indefinitely for our send and command queues to empty, so
we don't use .join but instead a busy timeout wait routine.
Also fixed a couple of small issues found while preparing comm unit tests.
Added parameter "wait" to "close" method, defaults to True. Will have the
close method wait for all lines to be sent that are currently in the send queue.
In case of an error, no waiting will be done.
Made it necessary to correctly track task completion in the send queue, also
made that change to the command queue while at it.
Backported from devel, commit 7f2476e513
"Error:" lines can also be produced by OctoPrint itself in case of serial exceptions or
connection failures, so "the firmware reported" was misleading.
That way no M105 cascades can be triggered by the M105 polling timer (or the M27
polling timer).
Adjusted logging output to make clear which queue rejected typed entry.
Made timeout handler send M105 with type "temperature" as well to make sure
we don't suddenly have two M105 directly after each other in the send_queue,
one from the polling timer, one from the timeout handler.
Fixes#1275
put and get are now overwritten to create t-tuple out of provided item
and item_type on put, and to only return item on get.
_put and _get extract item_type and use that for managing the
lookup set.
Running comm.py with parameters port, baudrate, local file, remote file will
upload local file to remote file on the printer's sd using the provided connection
parameters.
Example:
python -m octoprint.util.comm /dev/ttyUSB0 115200 /path/to/some.gcode test.gco
No plugin support! Only regular serial connection supported.
Had to reorder message processing a bit in order to be able to
properly handle further resends in timeout situations.
Has the added benefit that "ok" now gets processed very early
and now extra state based processing is needed anymore.
Should prevent slicing result to contain bed temperature settings even if
printer has a heated bed configured unless slicing profile also contains a
temperature.
Fixes#1268
Option to log last terminal lines before a resend (defaults to off for now),
more exception logging in octoprint.log in various error cases, also log
unsolvable resend requests with requested and current line number.
Also pushed more advanced config option into an initially hidden
"Advanced Options" section, similar to other places.
(cherry picked from commit 84b343a)
"Hello" command sent to printer to trigger initial handshake can now be
configured. Commands that _always_ necessitate to be sent with checksum/
line number (e.g. M110 on Marlin) can be configured as such too.
Also fixed an issue causing the "Hello" command to not be actually enqueued
first thing on opening a connection. Seems to not have caused harm in the
wild, but was unintentional.
(cherry picked from commit 5c2ae37)
Improved connecting for some printers, destroyed it
completely for others, so this needs some more work/
thought before it's ready for prime time.
This reverts commit c82ec3d3af.
Add more comments
Fine tweak code:
- Remove vanilla Object check with jQuery (lodash gives invalid result on arrays with isObject)
- Add function check on constructor
- Generate function name on anonymous functions
M110 is now sent every second until either a connection is established or the connection
attempt times out. That should prevent connection handshakes from failing due to
some initial garbage on the line that swallows an ok.
2. Add optional viewmodel(s) by pushing an extra array or by using object.optional
3. Add format option and return dependencies as object, by default it will return an array
We currently do not have a storage configured for SD card since
that hasn't yet been ported to the storage interface. So on an
SD card fail we need to capture that error when attempting to log
the print recovery data, or there will be issues processing
the cancel properly. A bit more of error handling is a good
idea here in any case too.
Fixes#1226
In case of trying to switch to state printing with no selected file that
scenario is now caught by setting an internal manualStreaming flag.
That will stop the M105 polling until M29 is sent (through whatever
means).
Note that printing is not disabled... this is merely for testing stuff and
not encouraged to be used for actually streaming files to the printer,
use the built-in functionality for that!
We don't need user-definable pip command paths here,
that will only lead to tears when the pip command belongs
to a wrong Python environment and nothing installs as
expected.
pip 8 doesn't output ANY of the generated stdout output from
setup.py anymore. So instead of transfering the info we need about
a pip environment on stdout, we now need a temporary folder.
Yay.
This reverts commit 1e429606e1.
Commit used functionality that currently is only available in
Chrome and maybe Opera. No alternative solution could be found
that works reliably across browsers.
* persistent notification on ongoing timelapse render job (#485)
* non-colliding timelapse snapshot name generation to not delete
existing snapshots when new print starts and timelapse has not
yet been rendered, also only delete snapshots if timelapse rendered (#318)
* list of unrendered timelapses, with option to delete files
or to render timelapse
Use this carefully. An error reported by your firmware usually hints
at something being off about your printer (e.g. thermistor troubles)
or the firmware not being fully compatible to OctoPrint since
it doesn't recognize a lot of commands.
If you print with this option enabled, it will still fail if you firmware goes
into lockdown, but now it will keep trying to send data to your printer.
That might cause issues. So best not use that option, only if you absolutely
have no other way to get some misbehaving printer to work with
OctoPrint.
The client now tries to detect if it's fast enough to process the
state updates usually send every 500ms, and if not notifies the
server to throttle the rate (e.g. to 1/1s, 1/1.5s etc).
Additionally, since the terminal tab of the client turned out to
be quite CPU intense when line number calculation, filtering etc
is enabled, the terminal tab now also falls back into a bit less
fancy mode if it detects its being processed too slow and optionally
even disables logging completely during printing (where a lot
of log messages need to be processed in a minimum amount of
time).
That way the UI should stay responsive even on very low powered
clients (e.g. chromium on a Pi), while printing.
Added custom bindings files in the flask.py js list
Removed inline onclick with sliderToggle and made a custom binding
'toggleContent'
Add padding and line-height to intermediary heading for better readability
We suffer from the same problem as commands being suppressed in the
send queue here. If a non-GCODE-command we send to the printer
produces no output, our _monitor loop will wait until the next response
produced by another command. Which we won't send though since
we are stuck waiting in the _monitor loop waiting for a response. Hence
we need to manually trigger further command processing from the
send loop here in order to ensure things keep going.
Also make sure that if we have a pkg_resources version that returns
tuples we not only remove any intermediary version parts if the base
version is requested, but we also append "*final" to the tuple afterwards,
otherwise the compatibility check will fail.
That way people will not see connection failed messages while the server is
still starting up.
Served intermediary page als "pings" an image on the backend to detect if
a) the backend is still responding at all ("intermediary.gif") and b) whether the
server has fully started up ("online.gif").
If the backend stops responding for 5s, a message is output that tells the user
that something went really wrong and to please check the log file.
Once the server becomes online, the intermediary page reloads/switches to the
actual UI.
When autoscroll was disabled, terminal could run on endlessly, eating
memory until the browser crashes. Now a hard upper limit ensures
that not more than 3000 lines are ever stored in the terminal. If autoscroll
is disabled and the limit is reached, no more log lines will be added. That
ensures that the log will not scroll and the current log excerpt will stay put.
UI + assets should actually have ETag and LastModified headers and proper
IfMatch handling on the server side and hence the server should do the
right thing on its own.
That should improve performance tremendously.
Both ETag and LastModified depend on all files the template rendering
depends on. If any of the depended on files changes, both values will
change as well. That allows us to track whether our cached copy is
still current (and force a refresh if not) and also process IfMatch request
headers and reply with a 304 directly so that we do not even have to
transfer the data if nothing changed and the browser still has it.
Also now tracks timestamps of last access to a preemptively cached
resource and cleans up stuff that hasn't been accessed in a while (7 days
by default)
Introduced a @preemptively_cached decorator that for decorated views
persists the provided data in ~/.octoprint/data/preemptive_flask_cache.yaml
in a list indexed by the view's path if the data is not yet part of the list.
During initialization the server will iterate over the persisted paths and data
and for each persisted path and entry in the list initialize a temporary WSGI
environment based on the data (which is interpretated as keyword arguments
to werkzeug's EnvironmentBuilder) which will then be used to call the view
function in the correct context.
The current implementation for / and /i18n/<locale>/messages.js utilizes
that decorator to allow preemptive caching of those views (/ being probably
the most expensive one in the whole core application) utilizing request base URLs
(internal access, external access, reverse proxy with prefix url etc) that had been
encountered in the past.
Through the new config setting server.preemptiveCaching.exceptions it is
possible to define a set of base URLs to never cache. Preemptive caching can
be globally disabled by setting devel.cache.preemptive to false.
This way we create separate caches for URLs access via different schemes/prefixes/etc.
Otherwise our generated page might not work when accessing OctoPrint from external
after accessing it from internal once.
Otherwise the GCODE Viewer will get stuck "half way through" if
"sync with progress" is enabled but the tab/browser tab loses focus
during printing and only regains it after the print has finished.
This might help with #1065 if indeed is related to background tab suspending behaviours in
browsers, but is a completely blind guess at this point since I still have not been able to
reproduce that issue myself.
Backported.
(cherry picked from commit 720cdad)
While at it also adjusted highlighting so that the folder containing
the currently selected file will be highlighted if the selected file is
not within the current folder but in one of its sub folders.
This might help with #1065 if indeed is related to background tab suspending behaviours in
browsers, but is a completely blind guess at this point since I still have not been able to
reproduce that issue myself.
Having the plugin commands on the first level of --help proved to be
a bad idea since it basically kills every chance of lazy loading the (expensive)
plugin context. Using a sub command for anything plugin related allows us
to only fire up the plugin context if a plugin command is expected, saving us
some precious seconds of operation in all other cases.
For conformity reasons the dev sub commands were now restructured
similarly.
We don't actually need the pip caller, which necessitates version
detection and hence increases waiting times tremendously - a simple
command line call with the auto detected pip command for
uninstalling stuff is enough and cuts off a lot of the CLI response times.
If the python version is < 2.7.9, we try to patch urllib3 with pyopenssl
to get rid of any InsecurePlatform issues.
That only works if pyopenssl plus dependencies are installed however,
hence we also log that.
Now that the plugin manager gets initialized before the server gets even constructed, we need
to log that entry right after we've set up logging in order to post any plugin manager related
log entries after.
This change should make sure that only those settings actually make it into config.yaml
per plugin that do differ from the default settings. Up until now the full dictionary as received
e.g. from the REST API was saved, regardless whether it contained (only) default values or not.
That led to a lot of "null" entries in the config.yaml file, which for one looked horrible and also
led to problems when a plugin actually wanted to change its default values.
With this commit, two things are done. One, upon saving a configuration the default
implementation of the save routine in the settings plugin now first diffs the new data against
the defaults and only saves what is different. Two, upon server startup a cleanup method is
now called on settings plugins whose default implementation fetches the current data stored
in config.yaml, diffs that against the defaults and only writes back the diff result. If that is empty
the entry is completely deleted from config.yaml.
(cherry picked from commit d70fe32)
When doing 'git checkout <rev>' or 'git checkout <tag>' there will be no
branch info:
$ git branch
* (detached from 96fc70b)
After whitelisting '\(detached.*' we get:
$ python setup.py version
running version
got version from git {'version': '1.2.5-1-gfd73e02', 'branch': 'HEAD',
'full': 'fd73e02f4fa9f286407ad688feeeee3ebaffea60'}
Version is currently: 1.2.5-1-gfd73e02
The '-1-gfd73e02' is this commit on top of the 1.2.5 tag.
While detached checkouts should be discouraged some buildsystems (e.g.
OpenEmbedded) have no real way to avoid it, which is what this patch
fixes. Actual people doing a checkout should use a branch.
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
(cherry picked from commit 987e637)
That was a tiny detail missing in 8bef18c2a8 that
caused issues with detecting which file was currently selected on the printer's
SD card (for "do not delete that" checks on the API).
This change should make sure that only those settings actually make it into config.yaml
per plugin that do differ from the default settings. Up until now the full dictionary as received
e.g. from the REST API was saved, regardless whether it contained (only) default values or not.
That led to a lot of "null" entries in the config.yaml file, which for one looked horrible and also
led to problems when a plugin actually wanted to change its default values.
With this commit, two things are done. One, upon saving a configuration the default
implementation of the save routine in the settings plugin now first diffs the new data against
the defaults and only saves what is different. Two, upon server startup a cleanup method is
now called on settings plugins whose default implementation fetches the current data stored
in config.yaml, diffs that against the defaults and only writes back the diff result. If that is empty
the entry is completely deleted from config.yaml.
We now wait until the settings have been saved before we close the dialog.
That should hopefully reduce chances of an asynchronous "Oh no, the settings
were updated" message showing up just when finishing the dialog.
At least if necessary (added new boolean flag to the constructor of
LargeResponseHandler for that). While at it also rename UrlForwardHandler
to UrlProxyHandler (it does not forward, it proxies) and make it aware of
ETag and Expires headers.
Bit of a debate with some gcode purists. RepRapPro demands an S
parameter. Adding S255 should be backward compatible with the firmwares
that recognize M106 as full on. As with other issues, it'd be nice to
have something more to go on here than the reprap wiki and firmware
source code.
ETag values returned with download responses were cached internally within
the LargeResponseHandler class, with the file's path as key. That let to
problems once the content changed and hence the ETag value actually
becoming invalid. Since the path however stayed the same, the same ETag
value for the modified file was assumed and a 304 Not Modified response
was generated.
This patch changes the behaviour of LargeResponseHandler to use
the last modified date of the file as the ETag value and alternatively allowing
an etag generator function to be provided as constructor parameter as well
to use for calculating (or disabling) the ETag header dependant on the
situation.
Needs to be calculated differently for time based and z-triggered. Capture interval
was not taken properly into account.
(cherry picked from commit 9284ff4)
Capturing is now queue based, rendering will not start until all images have been captured,
and timed postroll does not depend on system time anymore.
Also refactored some of the names to be python naming compliant while at it.
(cherry picked from commit 4f5dc70)
This will directly offer a "Restart Now" button on the "a restart is required" notification
for plugins which cannot be directly enabled/disabled without a restart, but only if
the restart command is configured on the server.
On click a confirmation dialog will be shown.
PNotify always merges the default buttons and the ones provided. Just settings the default
to containing no buttons was no option since plugins might already depend on the so far
obligatory Cancel button being present. The helper allows to create one buttoned
notifications without touching the defaults.
In case the user site packages are not yet part of the used
working set OR the sys path and ENABLE_USER_SITE is true, the
manager will now make sure that the folder is searched for plugins
as well upon plugin reload.
This is necessary since Python will not automatically include the
user site directory upon firing up the program in case there's
nothing installed to it/it doesn't exist. If a plugin is installed
during run time with --user that will lead to it not being found,
which is undesirable. Hence run time manipulation of sys.path and
the workingset becomes necessary.
Managable currently pretty much only means "uninstallable".
Plugins are managable if their installation location is writable
and - if they are installed from an entry point and OctoPrint is
running in a virtual environment - within the bounds of the virtual
environment (because otherwise pip will not allow to uninstall).
There was a problem with software update checks configurations stored in
config.yaml for which the providing plugin was then removed, since those
check definitions then lacked their default values to be merged on whatever
was stored in config.yaml, causing incomplete check configurations as a
consequence over which the plugin tripped.
This patch fixes that in that it tracks which check config keys are provided
by plugins and only returns those as the active check configurations that
belong to plugins that are still in the system.
TODO: This is only half of the solution. Check configurations of plugins
that are being uninstalled should be removed from the config if the
user decides to remove any settings by the plugin too. We need some
adjustments in the lifecycle tracking in order to make this possible
however, so for now this must suffice to at least prevent any errors from
occuring when incomplete configs are encountered.
(cherry picked from commit 8af8b8f)
There was a problem with software update checks configurations stored in
config.yaml for which the providing plugin was then removed, since those
check definitions then lacked their default values to be merged on whatever
was stored in config.yaml, causing incomplete check configurations as a
consequence over which the plugin tripped.
This patch fixes that in that it tracks which check config keys are provided
by plugins and only returns those as the active check configurations that
belong to plugins that are still in the system.
TODO: This is only half of the solution. Check configurations of plugins
that are being uninstalled should be removed from the config if the
user decides to remove any settings by the plugin too. We need some
adjustments in the lifecycle tracking in order to make this possible
however, so for now this must suffice to at least prevent any errors from
occuring when incomplete configs are encountered.
Caused a KeyError so far, update definitions that are broken like that
will now just be ignored instead.
Closes#1057
(cherry picked from commit 2efc5c4)
Sessions could get duplicated, wrongly saved etc. The reason was not
persisting the actual user object to the internal session map (but the
LocalProxy instead). That could lead to multiple sessions being
created for one login, or the session user being set to an
anonymous user, or various other odd effects depending on timing.
(cherry picked from commit 8aeac51)
Sessions could get duplicated, wrongly saved etc. The reason was not
persisting the actual user object to the internal session map (but the
LocalProxy instead). That could lead to multiple sessions being
created for one login, or the session user being set to an
anonymous user, or various other odd effects depending on timing.
Moving from the button to the username field probably makes even more
sense and while we are at it we can also extract the element access into
proper variables.
When doing 'git checkout <rev>' or 'git checkout <tag>' there will be no
branch info:
$ git branch
* (detached from 96fc70b)
After whitelisting '\(detached.*' we get:
$ python setup.py version
running version
got version from git {'version': '1.2.5-1-gfd73e02', 'branch': 'HEAD',
'full': 'fd73e02f4fa9f286407ad688feeeee3ebaffea60'}
Version is currently: 1.2.5-1-gfd73e02
The '-1-gfd73e02' is this commit on top of the 1.2.5 tag.
While detached checkouts should be discouraged some buildsystems (e.g.
OpenEmbedded) have no real way to avoid it, which is what this patch
fixes. Actual people doing a checkout should use a branch.
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
(cherry picked from commit 987e637)
Something in the recently released psutil 3.2.0 version causes installations via
python setup.py install to fail that list psutil as requirement.
Pinning to 3.1.1 solves that problem for now.
When doing 'git checkout <rev>' or 'git checkout <tag>' there will be no
branch info:
$ git branch
* (detached from 96fc70b)
After whitelisting '\(detached.*' we get:
$ python setup.py version
running version
got version from git {'version': '1.2.5-1-gfd73e02', 'branch': 'HEAD',
'full': 'fd73e02f4fa9f286407ad688feeeee3ebaffea60'}
Version is currently: 1.2.5-1-gfd73e02
The '-1-gfd73e02' is this commit on top of the 1.2.5 tag.
While detached checkouts should be discouraged some buildsystems (e.g.
OpenEmbedded) have no real way to avoid it, which is what this patch
fixes. Actual people doing a checkout should use a branch.
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
Use new synchronized sending method and also make sure that heaters
will get disabled in case M112 is NOT understood by the firmware
before disconnecting. That's about all we can do for now.
(cherry picked from commit 5406b2b)
Closing the printer connection and then reopening (when the users clicks
connect) will create a new fresh MachineCom object so the queues will
start out empty. Plus ClearableQueue was even more tied to the Queue
implementation that the current _get/_put overrides.
(cherry picked from commit e7584cd)
* Added "total" space to "free" in file list
* Added configurable space thresholds. If free space is below "warning"
threshold, exclamation sign will be added to report. If free space is below
"critical" threshold, report will be styled bold and red.
(cherry picked from commit 097800a)
Use new synchronized sending method and also make sure that heaters
will get disabled in case M112 is NOT understood by the firmware
before disconnecting. That's about all we can do for now.
* Added "total" space to "free" in file list
* Added configurable space thresholds. If free space is below "warning"
threshold, exclamation sign will be added to report. If free space is below
"critical" threshold, report will be styled bold and red.
Within the settings/features there is now a block of radio buttons
where the user can select whether to send checksums only when printing,
always or never.
In order to maintain backward compatibility in the settings, this is stored
in two variables, alwaysSendChecksum and neverSendChecksum. If both are False,
it is assumed that checksums are sent only when printing, being this the default value.
* Allow configuration of checkout folder and version tracking type
via Plugin Configuration
* Display message to use if checkout folder is not configured or a
non-release version is running and version tracking against releases
is enabled
* Clear version cache when a change in the check configuration is
detected
* Mark check configurations for which an update is not possible with
a little exclamation mark
(cherry picked from commit 8666a28)
Also migrate for any config version < 4 (incl. None) and make sure
the other migrations may happen on top of that if necessary. Added
some comments to explain necessary migrations.
(cherry picked from commit f1075f6)
* Allow configuration of checkout folder and version tracking type
via Plugin Configuration
* Display message to use if checkout folder is not configured or a
non-release version is running and version tracking against releases
is enabled
* Clear version cache when a change in the check configuration is
detected
* Mark check configurations for which an update is not possible with
a little exclamation mark
That's where all other protocol specific settings are currently located.
Will be migrated at a later date into the printer profile instead (that
makes way more sense).
(cherry picked from commit d0f61e5)
Repetier might resend the same resend request to make sure it arrives.
This commit makes OctoPrint not react to such a repeated request and
instead ignore up to a configurable amount of repeated requests for
the same (current) line.
(cherry picked from commit 6f83695)
T-only lines were not properly parsed. Should now be fixed to
be associated to currently selected extruder. Also added unit
tests for the temperature parsing.
While at it also extracted regexes and added unit tests for command
parsing (gcode & parameters)
(cherry picked from commit f6a259f)
Even if the webcam URLs and the FFMPEG path is not yet configured. Otherwise
setting those URLs and the path will require a restart of OctoPrint to enable properly -
that's overkill.
(cherry picked from commit 1425b20)
Readline could still be stuck in a read loop, leading to an exception on Mac
when closing the connection from another thread. This should now be captured
correctly.
Fixes#1021
(cherry picked from commit c829b27)
That's where all other protocol specific settings are currently located.
Will be migrated at a later date into the printer profile instead (that
makes way more sense).
If a new config setting is set, the virtual printer will now
resend the same resend request twice to allow testing the
comm layer behaviour in OctoPrint for being able to cope with
these possible repetitions like they can happen with Repetier.
Repetier might resend the same resend request to make sure it arrives.
This commit makes OctoPrint not react to such a repeated request and
instead ignore up to a configurable amount of repeated requests for
the same (current) line.
Closing the printer connection and then reopening (when the users clicks
connect) will create a new fresh MachineCom object so the queues will
start out empty. Plus ClearableQueue was even more tied to the Queue
implementation that the current _get/_put overrides.
This will only style them in a special way and influence sorting. Plugins still need
to ensure that a step is not skipped through the use of the onWizardTabChange callback
in the view model.
T-only lines were not properly parsed. Should now be fixed to
be associated to currently selected extruder. Also added unit
tests for the temperature parsing.
While at it also extracted regexes and added unit tests for command
parsing (gcode & parameters)
Even if the webcam URLs and the FFMPEG path is not yet configured. Otherwise
setting those URLs and the path will require a restart of OctoPrint to enable properly -
that's overkill.
Also introduced wizard finish backend method and remove old
firstrun dialog remnants.
TODO: bound check won't work this way, needs to be redone
differently. Goal is to only call onWizardFinish for wizards which
are actually involved...
No need to have templates here, we do it directly from the helper methods.
That also leaves us more options regarding callbacks, classes etc.
Helper methods now take an options dictionary (but still can fallback to the
old signature) containing messages, titles, callbacks etc instead of using
positional arguments for that. Switched code over to utilize that new
calling approach.
The user will now be offered a dialog with two choices if a server side update
of the settings is detected while the user has the settings dialog opened and made
local changes: Either reload all changes, effectively overwriting any local changes,
or only set those settings changed on the server that are not also changed locally.
If after a reconnect the server side configuration has changed, we want to reload.
Using the SettingsUpdated event the clients can track the current config hash during
runtime so that no unnecessary reloads during runtime should be demanded.
Readline could still be stuck in a read loop, leading to an exception on Mac
when closing the connection from another thread. This should now be captured
correctly.
Fixes#1021
(cherry picked from commit c829b27)
Readline could still be stuck in a read loop, leading to an exception on Mac
when closing the connection from another thread. This should now be captured
correctly.
Fixes#1021
"Hello" command sent to printer to trigger initial handshake can now be
configured. Commands that _always_ necessitate to be sent with checksum/
line number (e.g. M110 on Marlin) can be configured as such too.
Also fixed an issue causing the "Hello" command to not be actually enqueued
first thing on opening a connection. Seems to not have caused harm in the
wild, but was unintentional.
The GCODE viewer settings callback was not properly called, hence the
viewer was not initialized properly.
Changed prevention of concurrent settings requests to properly handle
the situation where the registered settings callbacks might be extended
through another callback.
(cherry picked from commit 7d6462b)
The GCODE viewer settings callback was not properly called, hence the
viewer was not initialized properly.
Changed prevention of concurrent settings requests to properly handle
the situation where the registered settings callbacks might be extended
through another callback.
If re-creation of the folder fails due to an access error, perform three retries. It might
be caused by the folder being open in the file explorer. Waiting a bit before retrying
seems to do the trick.
See also #1019
(cherry picked from commit a43de42)
If re-creation of the folder fails due to an access error, perform three retries. It might
be caused by the folder being open in the file explorer. Waiting a bit before retrying
seems to do the trick.
See also #1019
* Show when settings are saving
* Show when settings are being retrieved
* Disable Send/Cancel buttons while settings are saving
* Prevent concurrent retrieval
(cherry picked from commit 88eb124)
Finally found a replacement for the word "responsive", which these
days is almost inclusively understood as "viewport adjusting"
instead of its original meaning "reacting quickly".
Thanks to the javascript world, even "reactive" isn't an option
anymore, this term has now been hijacked as well.
(cherry picked from commit 2e27b94)
Introduced three new events:
* CONNECTING - fired just before starting the connection process
* DISCONNECTING - fired just before starting the (active) disconnection
process
* PRINTER_STATE_CHANGED - fired every time the printer state changes
Also introduced new GCODE script beforePrinterDisconnected, which will
get sent just before the printer gets (actively) disconnected. Also enabled
communication object to wait for the send queue to be emptied before
closing it, in order to allow sending all lines from the disconnect script.
That should fix user settings across multiple SessionUser wrappers. User settings were
previously only copied upon initialization of the SessionUser, with no update later on,
leading to them becoming out of sync with the underlying User instance.
This commit changes SessionUser to delegate method and attribute access for anything
but its own members to delegate to the wrapped User instance instead.
On MacOS, `tempfile.mkdtemp()` doesn't necessarily return a canonical
path (it uses `/private/var` instead of `/var`, but they are the same
thing). Since the `filemanager.storage` module canonicalizes paths,
tests were erroneously failing due to prefix match failures.
Finally found a replacement for the word "responsive", which these
days is almost inclusively understood as "viewport adjusting"
instead of its original meaning "reacting quickly".
Thanks to the javascript world, even "reactive" isn't an option
anymore, this term has now been hijacked as well.
* Show when settings are saving
* Show when settings are being retrieved
* Disable Send/Cancel buttons while settings are saving
* Prevent concurrent retrieval
The class knows about which pip versions support --process-dependency-links, which
need --no-use-wheel and which are broken altogether and adds/removes these parameters
accordingly or outright reports the broken pip version.
Depending on the pip version pip might first fetch the full index of packages available
on PyPI instead of just directly processing the provided link.
Display corresponding message to user from backend to make sure they don't
think something broke.
Also migrate for any config version < 4 (incl. None) and make sure
the other migrations may happen on top of that if necessary. Added
some comments to explain necessary migrations.
Capturing is now queue based, rendering will not start until all images have been captured,
and timed postroll does not depend on system time anymore.
Also refactored some of the names to be python naming compliant while at it.
Added profile is now set as default and UI is a bit more visually pleasing.
Next step is to find some way to mark wizard completion as "please ignore"...
In case a wizard plugin needs to communicate more info with its frontend,
such as which kind of information is missing, this is now possible through
a new API endpoint that will collect such information from the plugins
and provide it to callees.
daemon flag was missing, leading to the timer staying active even when a shutdown
was triggered. Added new daemon flag to timer constructor, defaulting to true, that
fixes that behaviour.
(cherry picked from commit 48fe23b)
daemon flag was missing, leading to the timer staying active even when a shutdown
was triggered. Added new daemon flag to timer constructor, defaulting to true, that
fixes that behaviour.
Absolute positioning caused panes to sometimes not render when being
selected. Switching to static positioning again makes the dialog look a bit
weird, but that's probably still preferable to no content showing. It seems
to be a browser bug that not's present with Safari 7, more tests to pinpoint
what exactly is causing this are probably necessary, but this at least is a
functional workaround for now.
(cherry picked from commit a18cbf7)
Absolute positioning caused panes to sometimes not render when being
selected. Switching to static positioning again makes the dialog look a bit
weird, but that's probably still preferable to no content showing. It seems
to be a browser bug that not's present with Safari 7, more tests to pinpoint
what exactly is causing this are probably necessary, but this at least is a
functional workaround for now.
- Convert query term to lower case so that it is case insensitive both ways
- Knockout submit binding takes the form element as parameter and return
value determines whether the form submit occurs. See http://knockoutjs.com/documentation/submit-binding.html
(cherry picked from commit 4a2cc53)
Two changes:
* Asset existence will now be checked before they get included
in the assets to bundle by webassets, logging a warning if a
file isn't present.
* Monkey-patched webassets filter chain to not die when a file
doesn't exist, but to log an error instead and just return
an empty file instead.
(cherry picked from commit 2a5ec33)
Two changes:
* Asset existence will now be checked before they get included
in the assets to bundle by webassets, logging a warning if a
file isn't present.
* Monkey-patched webassets filter chain to not die when a file
doesn't exist, but to log an error instead and just return
an empty file instead.
- Convert query term to lower case so that it is case insensitive both ways
- Knockout submit binding takes the form element as parameter and return
value determines whether the form submit occurs. See http://knockoutjs.com/documentation/submit-binding.html
Server startup could fail if for whatever reason the timelapse settings
had lost their type value, since the dict was not merged with the
default values upon retrieval.
Some underlying file systems might not trigger change events (e.g.
mounted remote file systems). Added a feature flag to allow for
switching to a (less performant) polling method.
(cherry picked from commit f2df174)
Some underlying file systems might not trigger change events (e.g.
mounted remote file systems). Added a feature flag to allow for
switching to a (less performant) polling method.
Wraps sarge and allows asynchronous execution of commands incl. logging
to provided logging methods for stdout, stderr and command calls.
Refactored PipCaller to utilized that.
Lines taking from the asynchronous processing of stdout/stderr where
left as str, leading to encoding problems when utf8 characters showed
up in the stream and were being interpreted as ascii encoding.
(cherry picked from commit 9373be3)
When using the version cache only use the version cache if the OctoPrint
version stored within it matches the one of the currently running
instance. Otherwise we might report false positives with regards to
available updates under some circumstances.
(cherry picked from commit bb7b0cb)
Old versions of setuptools return a tuple for their
pkg_resources.parse_version method instead of a Version object with
a base_version attribute that we can use to retrieve the base version.
So some manually parsing is needed instead.
OctoPrint's version might be a prerelease version ("...dev<n>"), we
want that to still be able to pass plugin compatibility checks like the
final release version would, so always use the base version of
OctoPrint's current version for comparison during compatibility checks.
When using the version cache only use the version cache if the OctoPrint
version stored within it matches the one of the currently running
instance. Otherwise we might report false positives with regards to
available updates under some circumstances.
Should be valid zip archives/tarballs. Also use only the extension
of an uploaded plugin archive as suffix for the temporary file that's
used for installing it.
(cherry picked from commit a1ff698)
Should be valid zip archives/tarballs. Also use only the extension
of an uploaded plugin archive as suffix for the temporary file that's
used for installing it.
Plugin Manager now internally uses pkg_resources.parse_version and
pkg_resources.parse_requirements to check for version compatibility
with plugins from the repository. That will allow to directly use
the OctoPrint version string once it's PEP440 compatible.
(cherry picked from commit 8eb61a9)
Plugin Manager now internally uses pkg_resources.parse_version and
pkg_resources.parse_requirements to check for version compatibility
with plugins from the repository. That will allow to directly use
the OctoPrint version string once it's PEP440 compatible.
Both file search and plugin repository search reloaded the page when
hitting enter in the search field. This fixes that.
(cherry picked from commit 60043cc)
Local file storage implementation will now "touch" added files to set
modification date to current date, ensuring that files that are just
moved through a custom implementation of file object (e.g. through the
watched folder mechanism) will show with "now" as the upload date.
(cherry picked from commit 5f0c89c)
Local file storage implementation will now "touch" added files to set
modification date to current date, ensuring that files that are just
moved through a custom implementation of file object (e.g. through the
watched folder mechanism) will show with "now" as the upload date.
If compatibility information is provided only as a version number it's
prefixed with >= for the check (so stating a compatibility of only
1.2.0 will now make the plugin compatible to all versions that follow
too).
Alternatively the compatibility information may now contain stuff like
">=1.2,<1.3" in which case the plugin will only be shown as compatible
to OctoPrint versions 1.2 and up but not 1.3 or anything above that.
(cherry picked from commit d5692d7)
If the SD card fails to initialize with a volume.init failure, that's
not a reason to break off all diplomatic relations with the printer.
(cherry picked from commit 9caf13d)
If compatibility information is provided only as a version number it's
prefixed with >= for the check (so stating a compatibility of only
1.2.0 will now make the plugin compatible to all versions that follow
too).
Alternatively the compatibility information may now contain stuff like
">=1.2,<1.3" in which case the plugin will only be shown as compatible
to OctoPrint versions 1.2 and up but not 1.3 or anything above that.
Custom exception should be derived from Exception, not BaseException.
Not only is this specified in the python documentation, but also
tornado will be able to handle Exceptions in requests perfectly fine
and return an HTTP 500 for them, but crash hard (as in, server shut
down follows) for BaseExceptions.
(cherry picked from commit 29b047b)
Custom exception should be derived from Exception, not BaseException.
Not only is this specified in the python documentation, but also
tornado will be able to handle Exceptions in requests perfectly fine
and return an HTTP 500 for them, but crash hard (as in, server shut
down follows) for BaseExceptions.
That way plugins don't need to implement the SettingsPlugin mixin in order to access their data folder, which is now an injected property in OctoPrintPlugin. Plugin authors should still always use the getter since that will also make sure the folder actually does exist (lazy creation).
PluginSettings.get_plugin_data_folder has been marked as deprecated.
Doesn't work reliably across pip versions, and adding a special rule for each and every version also isn't fun. Plugin authors will need to use a different approach for pulling in dependencies that are not on pypi during install, e.g. extra install urls or something like that. For now, I give up here ;)
Will lookup the correct pip command to use if not provided as constructor parameter and determine the version. Implements __lt__, __le__, __gt__ and __ge__ for "less/greater than" checks against the pip version, for dynamicalle changing call parameters provided to the execute method based on availability.
Will allow adjusting software update and plugin manager plugins to only use --process-dependency-links for pip versions >= 1.5
Reduces number of requests done against (rate limited) github API, especially after consecutive server restarts. Forcing the update check still will query the API.
That's also able to cope with 0.3a and similar "non-semantic" version schemes. Semantic version comparison can still be forced by setting the compare_type in the check to "semantic". Strict equality check can be set similarly by using the value "unequal".
That's more user friendly than just blindly reloading the page. Also include installed Template- and AssetPlugins in the check whether there's a new version or not.
Caused by a wrong variable usage. Fixed the usage and added a migration
step that fixes the circular reference if it exists. Bumping configuration
version to 2.
Fixes#946
Introduced new callback for settings plugin to hook into the point after the settings have been migrated since the initialize method is not suitable for that as it might be called before other plugin implementations reachable through hooks are initialized.
Usage of super(MyClass, self) is henceforth discouraged due to dynamic reloading within OctoPrint's plugin subsystem. Refer to https://thingspython.wordpress.com/2010/09/27/another-super-wrinkle-raising-typeerror/ for details on this problem.
Action by plugin authors is needed to remove the super(...) call and substitute it with octoprint.plugin.SettingsPlugin.on_settings_save(self, data) and octoprint.plugin.SettingsPlugin.on_settings_load(self). Without these modifications, calls to plugin methods utilizing super(...) will fail after a call to the plugin managers reload_plugins method.
Closes#942
The SoftwareUpdate Plugin had a bug that caused way too much check data to be stored in the configuration, leading to plugins potentially being stuck in an "update available" loop although the update had already been applied. Now only the current version of github_commit update types is persisted, not the full check configuration.
Also introduced a configuration version and made the migration function migrate old configs to remove anything that was same as the default supplied for the "octoprint" and all plugin hook checks. That should clean things up in existing installations.
OctoPrint will take care of calling a migration function on the plugin if the plugin demands a newer configuration version than currently stored in config.yaml.
When any plugins are enabled/disabled, the client now gets a trigger to fetch a fresh list of update information from the server. This should take care of any old popups still hinting at now uninstalled plugins.
This is to make sure that they all end on a ; and hence stuff doesn't break if a file included directly after starts with a (...) construct. Of course it would be better if all bundled files are valid in that matter, however since we can't enforce that, we'll add this slight overhead to reduce the risk of stuff breaking.
See for example: http://stackoverflow.com/questions/20307462/js-cant-combine-lib-files
python-setuptools on OctoPi is quite old and trying to update in a local virtualenv apparently CAN cause problems (we had this with python-serial too a while back), so a backwards compatible solution is better here.
If plugins get enabled or disabled, the update check configuration needs to be refetched next time it's needed since there might have been changes to plugin implementing the check_info hook.
Same holds true for cache files, so there should be no problem anymore with installs where the static folder is not writable.
Also introduced two new devel config vars to disable merging and minifying of the assets, solved the empty-less-bundle problem and made sure babel knows about the jinja extension.
This should allow users to adjust the behaviour of the communication stack more granularly in case the regular settings which only consider G4, G28, G29, G30, G32 to be real long runners without output are not sufficient.
Actual test whether key is provided or not happens in before_request handler of flask app, hence the more granular processing in the decorator was unecessary since around november '14. Adjusted to only do the actual processing necessary to replicate login_required behaviour/login users if necessary.
Closes#516 (actually, that was solved since introduction of the before_request handler which took that work off the hands of the decorator, but now it's properly documented too)
Match against entry_point origins using both package name and package name plus version. If one of those matches (depends on pip version if output will include version or not), it's the plugin we are looking for.
This way we don't need to try to strip a version number from the package name as output by pip without knowing if a version number is included or not.
Some pip invocations return extra info after the Successfully installed
(like "Cleaning up..."). Also, not all packages include a version
number in their package names.
The only translation that is going to be bundled with OctoPrint for now will be .de, if at all. The reason simply being that this is the only translation I can update myself and hence guarantee a good user experience for.
setup.py now offers two new commands, babel_bundle and babel_pack, with which translations for plugins and core OctoPrint can be automatically bundled or packed as language packs once compiled. This should make sharing translations quite easy in the future.
That is the first step towards downloadable (and separately managed) translation packages, decoupled from the software's release cycle and source control. Since it will be impossible to properly maintain all languages concurrently with OctoPrint's releases, decoupling that will hopefully increase the user experience through preventing broken translations (or stalling releases due to having to wait for the translations to be updated).
Sometimes they will still get discovered by python even though their packages have since been uninstalled.
This will also lead to them being reloaded after an uninstall and a subsequent plugin reload.
Marking them as uninstalled and not handing out uninstalled plugins when collecting them solves this.
Added phase specific hooks for queuing, queued, sending and sent phases of a command ("octoprint.comm.protocol.gcode.<phase>"). Removed old queuing phase hook and declared as obsolete hook in plugin manager to prevent plugins that depend on it from being enabled.
Adding those new hooks also necessitated refactoring the whole command processing, made it more modular and added phase specific handler functions that allow handling all blocking commands centrally for example.
Since it cannot be reliably determined by the system if a hook is essential for a plugin's functionality or not, it makes more sense to just disable plugins that utilize obsolete hooks then risk running half working plugins.
This will hopefully prevent conflicting routes between multiple plugins from being registered and also ensures a more consistent behaviour compared to BlueprintPlugin mixins.
Thanks to @Salandora for bringing this up.
Hidden files (starting with .) will produce a 404. This also excludes .metadata.yaml from being downloadable. The alternative of adding all extensions defined by plugins to the regex dynamically was not chosen since that would necessitate to make plugins implementing the "octoprint.filemanager.extension_tree" hook restart needing plugins in the lifecycle management for a minimal gain in perceived security.
Solves #897
Added a setting to allow -90 degree rotation. Combined with fliph and
flipv, I think this means every one of the 8 major orientations is covered
(2^3). 0, 90, 180, 270 times 2 (mirror image in each rotation). I chose
-90 instead of 90 because that keeps the upper left corner pinned to the
same spot.
The extra ms-transforms aren't for this issue exactly but allowed me to
test my changes in ie. I've tested Chrome, Firefox and IE11. I don't
have Safari handy, but if it breaks it *should* be only when this is
enabled.
Otherwise we get import issues during build since the octoprint module depends on the dependencies already being present what they obviously can't be at the beginning of setup.
Babel related commands and the Clean command for setup.py are not reusable by plugins as well. Also added a factory method for plugin setup parameters.
The new hook allows extending the list of rules for maximum body sizes differing from the default of 100KB and can be used by plugins to allow uploads to them that exceed that file size.
Also extended the plugin manager to detect plugins that implement restart needing hooks (such as the above one) and handling those plugins the same as plugins containing implementations that inherit from octoprint.plugin.core.RestartNeedingPlugin
Have you ever noticed when developing that every time you stop and start
the server, the terminal window gets an extra duplicate line for every
reconnect attempt? Well, it's because (I think) "delete" in javascript
just removes the indicated name from the namespace, it doesn't actually
free up an object. Those zombie objects are still there and wake up (for
some transports) on reconnect. Might be different in SockJS v1 or later.
Cache clearing doesn't work reliably with location.reload(true), leading to cache induced infinite loop when disabling access control (since generated template still assumes first run dialog to be active). Disabling for now, need to find a better way to reload the page while clearing the browser's and server's cache (same issue exists for plugins needing a client side triggered reload).
Fixes#886
The server now sends the current server time with each temperature update as well as the initial temperature data, allowing the client to translate the timestamps contained in the temperature logs to its local timescale.
Followup to commit f19d0f0360 which caused a problem with large deviations between server and client time.
Cut off of the temperature graph is now not based on the number of data points any more but on the actual time of the data points. Anything older than ``n`` minutes will be cut off, with ``n`` defaulting to 30min. This value can be changed under "Temperatures" in the Settings
Closes#343
Sending "!!DEBUG:action_custom foo 1 2 3" will result in the virtual printer sending "// action:foo 1 2 3" back. Sending "!!DEBUG:action_custom bar" will result in the virtual printer sending "// action:bar" back.
If only one tool is configured, the profile dialog now won't show the offset configuration. If more than one extruder is configured offset configuration for anything but the first tool (which acts as reference for the relative offsets of the others) will be shown.
Closes#677
Instead of matching to full strings send by firmware in case of checksum or line number issues, now matches only against lower case "checksum", "line number" and "line expected". Should make it more resilient to firmware side changes of the sent messages.
jQuery bubbles all children show/hide events up to the parent so the
event gets called whenever a settings pane is chosen by the user.
Intent of the viewmodel callback was just on first show and final
dismiss.
Any unknown commands should just be piped through and not use up an acknowledgement. This
new behaviour can be overridden via the new feature flag "unknownCommandsNeedAck", which will
restore the former behaviour causing even unknown commands to use up an "ok".
Also no line numbering or checksumming will happen. Shouldn't usually be of relevance for other
firmwares, but in case of any compatibility issues introduced by this also added a new feature
flag "sendChecksumWithNonGcode" that causes even unknown commands to be sent with a
checksum if necessary.
Repetier always first sends the ok and then any command output. In case of M105, that makes the response look like from an externally triggered heatup (no ok on the same line), causing polling to stop until that falsely detected heatup is complete. Added a configuration option to disable heatup detection. The disadvantage of this is that when printing via Repetier Firmware from SD, the heatup times won't be substractable from the total print time, leading to a less accurate print time left estimation.
Closes#835
Removed old loginstate.subscribe method and migrated existing code to new mechanism.
This should allow plugins to only request their sensitive data if a user is a) logged in and has b) the necessary rights for a request. The server should still do additional auth checks, but this way no unnecessary request have to be made.
* Renamed userjson to userdata, removed original userdata (developers will live if they need to ensure their supplied userdata is valid JSON)
* Input validation for userdata parameter - a HTTP 400 response will be generated if userdata can't be parsed as JSON
* Adjusted documentation accordingly
* moved virtual printer into plugin
* made default serial factory use supplied parameters instead of directly utilizing self._port and similar
* documented new hook
f98ebaaf moved the passive_logon code to a new function from
api/__init__.py to util/flask.py. Before that move any fallthrough
would hit return NO_CONTENT, but now it returns nothing which makes
flask complain.
This hook allows the plugin to create the serial port object (or pass to
the next hook or the builtin serial port handler) which allows for
serial communication filtering or a different communication transport.
Use @foosel's code to use the same loop for hooks as well as the
builtin.
Also, modify the cura slicer to recognize the setting and avoid
adjusting the model position, just leave it in the center where it would
be on a circular platform
Having to wait for the first serial timeout before sending the first M105 even when not waiting for seeing a "start" caused unnecessary wait times for reaching the "Operational" state.
Add computed property "name" to function objects if not provided by the
browser, to avoid dropping out of main.js before it is finished.
(cherry picked from commit 68215c6)
Tracking the "ok" attached to a resend is necessary in order to make sure that it does not trigger the resend of the next line after the requested one right after, causing resend loops in some cases, e.g. "> 100", "> 101" , "< rs 100", "ok", "> 100", "< expected 100, got 101, rs 100" -- here the last error from the firmware could not be processed as "false negative" correctly (101 was already sent to the printer when it detected the error for 100, so this error just needs to be ignored) since the resend flag was already cleared due to line 100 and 101 having been enqueued, 100 in the resend handler, 101 due to the following ok. This patch fixes the latter, thus solving the problem.
Plugins may be enabled and disabled during runtime. If they are of types which allow hot loading, this will be done. Otherwise they will be marked as pending and updated after a restart. Same for installation and uninstallation.
Plugins may be loaded, unloaded, activated and deactivated. Errors while trying to load a plugin or initializing an implementation will only result in it staying deactive but registered in the system, allowing it to be further processed e.g. by a plugin manager
Can be used to always retrieve the defaults (by providing an empty config dict) or to utilize the get method with other settings than the system settings.
Multiple mixins are allowed of course. Allowing multiple implementations lead to too many problems due to plugin names for referring to the APIs of SimpleApiPlugins or the assets of AssetPlugins.
Hence __plugin_implementations__ has been deprecated in favor of __plugin_implementation__. The plugin subsystem will automatically copy the first implementation from __plugin_implementations__ to __plugin_implementation__ and log a deprecation warning.
Adjusted documentation accordingly. Also added docs for helpers.
Detected plugins are now logged in a better readable way and with additional information.
Also marked folder for bundled plugins as bundled - forgot to do that earlier.
This way user adjustments to those timeouts via the settings
will take immediate effect even while the connection to the
printer is already established.
Any T command targeting a number higher than the value specified in the settings for gcodeAnalysis.maxExtruders (defaults to 10) will be ignored and trigger a warning in the log file.
Fix for #539
(cherry picked from commit 7d5c55f)
For as long as his name is still passed along the Clacks,
Death can't have him.
-- "Going Postal", Chapter 4 Prologue
RIP Terry Pratchett
See also http://gnuterrypratchett.com/
Added a lot of documentation, more stream lining, should now work completely without having to define types but offer the same/more functionality than before. Backwards compatible too.
Preprocessing for better performancy, unit tests for preprocessing, controls don't need a type anymore (makes things way less complicated and repetitive)
Adding a line such as
OCTOPRINT_ADDITIONAL_BINDINGS.push(["gcodeFilesViewModel", "#tab_plugin_my_other_file_plugin"]);
to a plugin JS now allows the plugin to configure existing view models to bind to additional elements, not just the ones configured by the view model itself. This allows binding view models of standard components to other component types and thus "moving" components, e.g. the files dialog from the sidebar to the tab section.
config.yaml now has a new section "components" located under "appearance" which allows configuring the order and list of disabled components. Example:
appearance:
components:
order:
tab:
- control
- temperature
- gcodeviewer
- terminal
- timelapse
disabled:
sidebar:
- files
This would make the "Control" tab the first tab, followed by the usual order (plugins afterwards), and disable the Files sidebar component.
Refactored some things in octoprint.util.comm and octoprint.settings, added migration function to get users of the devel version up to date with their gcode scripts. Migration function will be removed again one week from now.
Utilizes a "TypedQueue" which tracks command types - if provided - and doesn't
add entries of the same type as another entry in the queue.
Somewhat backported from dev/commRefactoring branch
For some versions, the ok for a file delete message is not prepended
by a newline: "File Deleted:<filename>ok"
This work around will make it still detectable.
Sometimes M26 S0 does not cause a selected SD file to be
properly rewound, leading to issues when restarting the
print job. Reselecting the file (and ignoring the
resulting select event) solves this.
- renamed methods from camelCase to snake_case
- renamed callback mathods from comm module from camelCase to snake_case
- extracted and documented public interface to be used by plugins
- extracted callback interface to be implemented by subscribed callbacks to printer
- moved standard implementation to custom package
- moved time estimation classes to custom package
Should solve issues where the "Disconnected" dialog briefly appears when the connection gets interrupted only briefly, e.g. when starting a timelapse download in Firefox.
This should fix the problem where on a fresh setup it was impossible to upload slicing profiles for Cura before
the path to the binary was configured.
Also made the slicing dialog auto update available slicers when the settings are updated. The slicing button
in the file list is now only active if a slicer is available. The slicing dialog will only show upon upload of
an STL file if a slicer is available.
Closes#795
Use
pip install -e .[develop]
to prime your environment for development, this will install all requirements both for running as well as for development tasks (such as running unit tests or compiling the documentation) and register OctoPrint as an editable python package as well.
OctoPrint got confused by prepended / in files on printer's SD cards
located within folders.
New handling makes comm always use absolute path names for SD card
file names (even those in the root), printer converts between
this representation and the storage interface compatible version
of file and folder names being stated relative to the root (so
no leading /)
Added wrappers to ensure existing plugins being able to work, although them using the old camel case method names now causes a deprecation warning being logged
* Disabling autoscrolling now also stops cutting of the log while it's enabled, effectively preventing log lines from being modified at all
* Applying filters displays "[...]" where lines where removed
* Added a link to scroll to the end of the terminal log (useful for when autoscroll is disabled)
* Added a link to select all current contents of the terminal log for easy copy-pasting
* Added a display of how many lines are displayed, how many are filtered and how many are available in total
Closes#735
This allows horizontal placement of buttons. Custom controls in rows can have specified two new attributes: width which is the width of their container in the bootstrap 12-slot grid, and offset to specify offsets to the former control on the row.
Might be a good solution for people affected by #166, #470, #490 until commRefactoring branch is ready for prime time. No solution for #553 since that needs proper queueing and blocking command detection.
Controls may now contain a new property "javascript" which may be either a javascript function to be called when the control is executed, or a string to be eval'd when the control is executed. If it is a function, it will be called with the config of the custom control as single parameter "data". If it is a string it will be eval'd within a function context providing the custom control configuration as variable data.
Additionally controls may contain a new property "enabled", which may also be either a javascript function or a string to be eval'd. The custom control config will be available to the enabled code as described above. The code is expected to return true if the component should be enabled or false if not.
Up until now OctoPrint would not include anything for plugins which didn't provide LESS files but CSS files when in LESS mode (and vice versa). This is not rectified to make development a bit easier and less restrictive - if a plugin author doesn't want to use LESS but just plain CSS, that's now fine too.
Should catch any exceptions thrown by the plugin, log them and only hand them off if the caller requested to be informed about such things. This way if something goes wrong with a StartupPlugin there should be no problem anymore to still get the server up and running.
Starting commands asynchronously now necessitates a call to Pipeline.wait_events in order to be able to access the started Command instances. Not waiting causes the list of commands to be not fully populated and hence issues with code depending on that stuff being present.
Internal templates get handled the same way as those from plugins. Plugins may also in theory now replace existing internal templates, however for that to not cause any errors on the client side due to missing expected elements that will for now stay an undocumented feature.
Index page will now be cached for up to five minutes, unless the
request contains "_refresh" in the query or the Cache-Control header
contains no-cache
This data can still be overwritten from within the Plugin itself by setting the correponding __plugin_xyz__ variables, however it allows getting rid of some repetition if that data has already been specified in setup.py
Problems:
- timeout upon print start due to first line not being properly sent apparently
- extruder count not taken from printer profiles yet (which are not available on comm layer), hence wrong end code
Was broken after switching to new file name sanitizing with the new file management layer, still stripped everything but ascii from the filename although timelapse file names may actually contain more than that character set since the gcode file names they are based off may too.
Closes#724
This changes the semantics of setup.py slightly. '--all' needs to be
passed in order to delete everything that is deleted by previous
versions. Some additional build files may also be deleted.
get_template_vars get split into get_template_vars (for injection additional template variables only) and get_template_configs (for configuring injection of additional template). It's now possible to inject more than one of a given template type from within plugins, and template injection is more intelligent in that if a plugin's templates don't need special configuration and stick to default naming and behaviour, just declaring them inside the templates directory of the plugin will be enough to fire up everything including links to switch to tabs, sidebars etc (the plugin's name being used in such cases for link text).
Should keep rendering of timelapse from breaking if only a couple of images couldn't be captured due to whatever reason. Suggested by @midopple in #344
(cherry picked from commit bf9d5ef)
Writes updated metadata to a backup file first and then copies it atomically (at least under anything that is not windows where the operation is a bit more complicated and hence not atomic)
Associating them with the current printer profile is misleading as long as a printer profile represents both a physical printer and a type machine. In the future this association will have to be split, to allow for configuration of printers with respective machine profiles (name subject to be changed).
-added a new field in the control-section, for controlling the movement of
the printer by keypresses.
To control you printer by keypress, you have to connect to printer first.
Then click into the textfield to activate it. Now you can press the arrow
keys, to move the printhead in the X- and Y-directions, press the W or S
key for Z-direction or the number keys 1, 2, 3 or 4 for choose the
distance (0.1mm, 1mm....)
Read the following short instructions **fully** and **follow them** if you want your ticket to be taken care of and not closed again directly!
This document outlines what you need to know before **[creating tickets](#issues-tickets-however-you-may-call-them)**
or **[creating pull requests](#pull-requests)**.
- Always create **one ticket for one purpose**. So don't mix two or more feature requests, support requests, bugs etc into one ticket. If you do, your ticket will be treated as if only describing the first purpose, the others will be ignored!
- If you want to report a bug, **READ AND FOLLOW [How to file a bug report](https://github.com/foosel/OctoPrint/wiki/How-to-file-a-bug-report)!** Tickets will be automatically checked if they comply with the requirements outlined in that wiki node! Other then what's written in there (**and really EVERYTHING that is written in there!**) you don't have to do anything special with your ticket.
- If you want to post a **request** of any kind (feature request, documentation request, ...), **add [Request] to your issue's title!**
- If you need **support** with a problem of your installation (e.g. if you have problems getting the webcam to work), **add [Support] to your issue's title!**. Note that for problems like these, the [Mailinglist](https://groups.google.com/group/octoprint) or the [Google+ Community](https://plus.google.com/communities/102771308349328485741) will probably get you help faster!
- If you have a general **question**, **add [Question] to your issue's title!**. Note that for problems like these, the [Mailinglist](https://groups.google.com/group/octoprint) or the [Google+ Community](https://plus.google.com/communities/102771308349328485741) will probably get you help faster!
- If you have another reason for creating a ticket that doesn't fit any of the above categories, think hard if it might not be something better suited for the [Mailinglist](https://groups.google.com/group/octoprint) or the [Google+ Community](https://plus.google.com/communities/102771308349328485741). If you are sure it needs to be reported here, **add [Misc] to your issue's title!**
## Contents
Following these guidelines (**especially EVERYTHING mentioned in ["How to file a bug report"](https://github.com/foosel/OctoPrint/wiki/How-to-file-a-bug-report)**) is necessary so the tickets stay manageable - you are not the only one with an open issue, so please respect that you have to **play by the rules** so that your problem can be taken care of. Tickets not playing by the rules **will be closed without further investigation!**.
* [Issues, Tickets, however you may call them](#issues-tickets-however-you-may-call-them)
* [How to file a bug report](#how-to-file-a-bug-report)
* [What should I do before submitting a bug report?](#what-should-i-do-before-submitting-a-bug-report)
* [What should I include in a bug report?](#what-should-i-include-in-a-bug-report)
* [Where can I find which version and branch I'm on?](#where-can-i-find-which-version-and-branch-im-on)
* [Where can I find those log files you keep talking about?](#where-can-i-find-those-log-files-you-keep-talking-about)
* [Where can I find my browser's error console?](#where-can-i-find-my-browsers-error-console)
* [Setting up a development environment](#setting-up-a-development-environment)
* [Pull requests](#pull-requests)
* [What do the branches mean?](#what-do-the-branches-mean)
* [How OctoPrint is versioned](#how-octoprint-is-versioned)
* [History](#history)
* [Footnotes](#footnotes)
Pull Requests
-------------
## Issues, Tickets, however you may call them
1.Please create all pull requests against the `devel` branch.
2. Create **one pull request per feature/bug fix**.
3. Create a custom branch for your feature/bug fix and use that as base for your pull request. Pull requests directly against your version of `devel` will be closed.
4. In your pull request's description, state what your pull request is doing, as in, what feature does it implement, what bug does it fix.
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
(use the [search](https://github.com/foosel/OctoPrint/search?q=&ref=cmdform&type=Issues))**
to check if there already exists a report of the issue you are encountering.
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 "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
it is the same as your's, it actually behaves the same as your's. E.g. if someone gives steps
to reproduce his bug that looks like your's, reproduce the bug like that if possible,
and only add a "me too" if you actually can reproduce the same
issue. Also **provide all information** as [described below](#what-should-i-include-in-a-bug-report)
and whatever was additionally requested over the course of the ticket
even if you "only" add to an existing ticket. The more information available regarding a bug, the higher
the chances of reproducing and solving it. But "me too" on an actually unrelated ticket
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, even if only adding a "me too" to an
existing ticket**:
```
<!--
READ THE FOLLOWING FIRST:
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://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 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.
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.
Thank you!
-->
#### What were you doing?
<!--
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.
-->
#### What did you expect to happen?
#### What happened instead?
#### Did the same happen when running OctoPrint in safe mode?
<!--
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.
-->
#### Operating System running OctoPrint
<!--
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.
-->
#### Browser and version of browser, operating system running browser
<!--
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
all requested information or your ticket will be closed.
### Where can I find which version and branch I'm on?
You can find out all of them by taking a look into the lower left corner of the
OctoPrint UI:

If you don't have access to the UI you can find out that information via the
command line as well. Either `octoprint --version` or `python setup.py version`
in OctoPrint's folder will tell you the version of OctoPrint you are running
(note: if it doesn't then you are running a version older than 1.1.0,
*upgrade now*). A `git branch` in your OctoPrint installation folder will mark
the branch you are on with a little *. `git rev-parse HEAD` will tell you the
current commit.
### Where can I find those log files you keep talking about?
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?
See [How to open the Javascript Console in different browsers](https://webmasters.stackexchange.com/questions/8525/how-to-open-the-javascript-console-in-different-browsers)
## Setting up a development environment
See [the corresponding chapter in the documentation](http://docs.octoprint.org/en/master/development/index.html#setting-up-a-development-environment).
This also includes information on how to run the test suite and how to build
the documentation.
## Pull requests
1. If you want to add a new feature to OctoPrint, **please always first
consider if it wouldn't be better suited for a plugin.** As a general rule
of thumb, any feature that is only of interest to a small sub group should
be moved into a plugin. If the current plugin system doesn't allow you to
implement your feature as a plugin, create a "Brainstorming" ticket to get
the discussion going on how best to solve *this* in OctoPrint's plugin
system - maybe that's the actual PR you have been waiting for to contribute :)
2. If you plan to make **any large or otherwise disruptive changes to the
code or appearance, please open a "Brainstorming" ticket first** so
that we can determine if it's a good time for your specific pull
request. It might be that we're currently in the process of making
heavy changes to the code locations you'd target as well, or your
approach doesn't fit the general "project vision", and that would
just cause unnecessary work and frustration for everyone or
possibly get the PR rejected.
3. Create your pull request **from a custom branch** on your end (e.g.
`dev/myNewFeature`)[1].
4. Create your pull request **only against the `maintenance` or `devel` branch**:
* if it's a bug fix for a bug in the current stable version: `maintenance` branch
* otherwise: `devel` branch
5. Create **one pull request per feature/bug fix**.
6. Make sure there are **only relevant changes** included in your PR. No
changes to unrelated files, no additional files that don't belong (e.g.
commits of your full virtual environment). Make sure your PR consists
**ideally of only one commit** (use git's rebase and squash functionality).
7. Make sure you **follow the current coding style**. This means:
* Tabs instead of spaces in the Python files[2]
* Spaces instead of tabs in the JavaScript sources
* English language (code, variables, comments, ...)
* Comments where necessary: Tell *why* the code does something like it does
it, structure your code
* Following the general architecture
* If your PR needs to make changes to the Stylesheets, change the
``.less`` files from which the CSS is compiled.
* Make sure you do not add dead code (e.g. commented out left-overs
from experiments).
8. Ensure your changes **pass the existing unit tests**. PRs that break
those cannot be accepted. You can run the unit tests locally (after
[initial development environment setup with "develop" dependencies](http://docs.octoprint.org/en/master/development/index.html#setting-up-a-development-environment))
by running
```
nosetests --with-doctest
```
in the OctoPrint checkout folder. A [travis build](https://travis-ci.org/foosel/OctoPrint)
is also setup so that if the tests should fail, your PR will be marked
accordingly.
9. **Test your changes thoroughly**. That also means testing with usage
scenarios you don't normally use, e.g. if you only use access control, test
without and vice versa. If you only test with your printer, test with the
virtual printer and vice versa. State in your pull request how you tested
your changes. Ideally **add unit tests** - OctoPrint severely lacks in that
department, but we are trying to change that, so any new code already covered
with a test suite helps a lot!
10. In your pull request's description, **state what your pull request does**,
as in, what feature does it implement, what bug does it fix. The more
thoroughly you explain your intent behind the PR here, the higher the
chances it will get merged fast. There is a template provided below
that can help you here.
11. Don't forget to **add yourself to the [AUTHORS](./AUTHORS.md)
file** :)
Template to use for Pull Request descriptions:
```
#### What does this PR do and why is it necessary?
#### How was it tested? How can it be tested by the reviewer?
#### Any background context you want to provide?
#### What are the relevant tickets if any?
#### Screenshots (if appropriate)
#### Further notes
```
## What do the branches mean?
There are three main branches in OctoPrint:
* `master`: The master branch always contains the current stable release. It
is *only* updated on new releases. Will have a version number following
the scheme `<x>.<y>.<z>` (e.g. `1.2.9`) or - if it's absolutely necessary to
add a commit after release to this branch - `<x>.<y>.<z>.post<commits since x.y.z>`
(e.g. `1.2.9.post1`).
* `maintenance`: Improvements and fixes of the current release that make up
the next release go here. More or less continuously updated. You can consider
this a preview of the next release version. It should be very stable at all
times. Anything you spot in here helps tremendously with getting a rock solid
next stable release, so if you want to help out development, running the
`maintenance` branch and reporting back anything you find is a very good way
to do that. Will usually have a version number following the scheme
`<x>.<y>.<z+1>.dev<commits since increase of z>` for an OctoPrint version of `<x>.<y>.<z>`
(e.g. `1.2.10.dev12`).
* `devel`: Ongoing development of new features that will go into the next bigger
release (MINOR version number increases) will happen on this branch. Usually
kept stable, sometimes stuff can break though or lose backwards compatibility
temporarily. Can be considered the "bleeding edge". All PRs should target
*this* branch. Important improvements and fixes from PRs here are backported to
`maintenance` as needed. Will usually have a version number following the
scheme `<x>.<y+1>.0.dev<commits since increase of y>` for a current OctoPrint version
of `<x>.<y>.<z>` (e.g. `1.3.0.dev123`).
* `rc/maintenance`: This branch is reserved for future releases that have graduated from
the `maintenance` branch and are now being pushed on the "Maintenance"
pre release channel for further testing. Version number follows the scheme
`<x>.<y>.<z>rc<n>` (e.g. `1.2.9rc1`).
* `staging/maintenance`: Any preparation for potential follow-up RCs takes place here.
Version number follows the scheme `<x>.<y>.<z>rc<n+1>.dev<commits since increase of n>` (e.g.
`1.2.9rc1.dev3`) for a current Maintenance RC of `<x>.<y>.<z>rc<n>`.
* `rc/devel`: This branch is reserved for future releases that have graduated from
the `devel` branch and are now being pushed on the "Devel" pre release channel
for further testing. Version number follows the scheme `<x>.<y+1>.0rc<n>` (e.g. `1.3.0rc1`)
for a current stable OctoPrint version of `<x>.<y>.<z>`.
* `staging/devel`: Any preparation for potential follow-up Devel RCs takes place
here. Version number follows the scheme `<x>.<y>.0rc<n+1>.dev<commits since increase of n>` (e.g.
`1.3.0rc1.dev12`) for a current Devel RC of `<x>.<y>.0rc<n>`.
Additionally, from time to time you might see other branches pop up in the repository.
Those usually have one of the following prefixes:
* `fix/...`: Fixes under development that are to be merged into the `maintenance`
and `devel` branches.
* `improve/...`: Improvements under development that are to be merged into the
`maintenance` and `devel` branches.
* `dev/...` or `feature/...`: New functionality under development that is to be merged
into the `devel` branch.
There is also the `gh-pages` branch, which holds OctoPrint's web page, and a few
older development branches that are slowly being migrated or deleted.
## How OctoPrint is versioned
OctoPrint follows the [semantic versioning scheme](http://semver.org/) of **MAJOR.MINOR.PATCH**.
The **PATCH** version number is the one increasing most often due to OctoPrint's maintenance releases.
Releases that only change the patch number indicate that they contain bug fixes and small improvements
of existing functionality. Example: 1.2.8 to 1.2.9.
The **MINOR** version number increases with releases that add a lot of new functionality and
large features. Example: 1.2.x to 1.3.0.
Finally, the **MAJOR** version number increases if there are breaking API changes that concern any of the
documented interfaces (REST API, plugin interfaces, ...). So far this hasn't happened. Example: 1.x.y to 2.0.0.
OctoPrint's version numbers are automatically generated using [versioneer](https://github.com/warner/python-versioneer)
and depend on the selected git branch, nearest git tag and commits. The generated version number
should always be [PEP440](https://www.python.org/dev/peps/pep-0440/) compatible. Unless a git tag
is used for version number determination, the version number will also contain the git hash within
the local version identifier to allow for an exact determination of the active code base
(e.g. `1.2.9.dev68+g46c7a9c`). Additionally, instances with active uncommitted changes will contain
`.dirty` in the local version identifier.
## History
* 2015-01-23: More guidelines for creating pull requests, support/questions
redirected to Mailinglist/G+ community
* 2015-01-27: Added another explicit link to the FAQ
* 2015-07-07: Added step to add yourself to AUTHORS when creating a PR :)
* 2015-12-01: Heavily reworked to include examples, better structure and
all information in one document.
* 2016-02-10: Added information about branch structure and versioning.
* 2016-02-16: Added requirement to add information from template to existing
tickets as well, explained issue with "me too" red herrings.
* 2016-03-14: Some more requirements for PRs, and a PR template.
* 2016-06-08: New `prerelease` and `rc` branches explained.
* 2016-09-09: New `rc/*` branches explained.
* 2016-09-23: Some more work on "How to file a bug report" based on recent
experiences
* 2017-01-25: Fixed a typo
* 2017-03-09: Allow PRs against `maintenance` branch for bugs in stable.
* 2017-03-10: Reproduce bugs in safe mode to make sure they are really caused
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
to your PR's branch will also become part of your PR, so if you create a
PR from your version of `devel` chances are high you'll add changes to the
PR that do not belong to the PR.
* [2] - Yes, we know that this goes against PEP-8. OctoPrint started out as
a fork of Cura and hence stuck to the coding style found therein. Changing
it now would make the history and especially `git blame` completely
unusable, so for now we'll have to deal with it (this decision might be
[](https://flattr.com/submit/auto?user_id=foosel&url=https://github.com/foosel/OctoPrint&title=OctoPrint&language=&tags=github&category=software)
OctoPrint provides a responsive web interface for controlling a 3D printer (RepRap, Ultimaker, ...). It is Free Software
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](http://octoprint.org).
Its website can be found at [octoprint.org](https://octoprint.org/?utm_source=github&utm_medium=readme).
Contributing
------------
The community forum is available at [discourse.octoprint.org](https://discourse.octoprint.org/?utm_source=github&utm_medium=readme).
Please see the project's [Contribution Guidelines](https://github.com/foosel/OctoPrint/blob/master/CONTRIBUTING.md).
The FAQ can be accessed by following [faq.octoprint.org](https://faq.octoprint.org/?utm_source=github&utm_medium=readme).
Installation
------------
The documentation is located at [docs.octoprint.org](http://docs.octoprint.org).
Installation instructions for installing from source for different operating systems can be found [on the wiki](https://github.com/foosel/OctoPrint/wiki#assorted-guides).
The official plugin repository can be reached at [plugins.octoprint.org](https://plugins.octoprint.org/?utm_source=github&utm_medium=readme).
If you want to run OctoPrint on a Raspberry Pi you might want to take a look at [OctoPi](https://github.com/guysoft/OctoPi)
**OctoPrint's development wouldn't be possible without the [financial support by its community](https://octoprint.org/support-octoprint/?utm_source=github&utm_medium=readme).
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 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), 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
after all :)
For information about how to go about submitting bug reports or pull requests, please see the project's
This part of the API is still heavily in development, especially anything that has to do with temperature control.
If you happen to want to develop against it, you should drop me an email to make sure I can give you a heads-up when
something changes.
..contents::
Printer control is mostly achieved through the use of commands, issued to resources reflecting components of the
@@ -25,7 +19,8 @@ Tool
See :ref:`sec-api-printer-toolcommand`.
Bed
Bed commands allow setting the temperature and temperature offset for the printer's heated bed. Querying the
corresponding resource returns temperature information including an optional history.
corresponding resource returns temperature information including an optional history. Note that Bed commands
are only available if the currently selected printer profile has a heated bed.
See :ref:`sec-api-printer-bedcommand`.
SD card
SD commands allow initialization, refresh and release of the printer's SD card (if available). Querying the
@@ -34,6 +29,29 @@ SD card
Besides that, OctoPrint also provides a :ref:`full state report of the printer <sec-api-printer-state>`.
..note::
You might be wondering why all command responses below only return a ``204`` with an empty body instead of
the output of the just sent commands. There are two reasons for this.
OctoPrint's internal webserver is single threaded and can only handle one request at a time. This is
not a problem generally since asynchronous programming allows to just have one request which is waiting for
data from a long running backend operation to sleep while handling other requests. The internal framework
used for providing the REST API though, Flask, is based on WSGI, which is synchrounous in nature. This means
that it is impossible to wait in a non blocking wait while handling a request on the REST API. So in order to
return the response of a command sent to the printer, the single thread of the webserver would have to be blocked
by the API while the response wasn't available yet. Which in turn would mean that the whole web server would
stop responding while waiting for the printer to reply, which, depending on the command in question (e.g. homing)
can take a long while. That would be a bad idea.
The second reason is that thanks to a large number of firmwares out there having a `particular bug <https://github.com/MarlinFirmware/Marlin/commit/acc0e7527914948656ccabba35f7faedc94ef885>`_
that makes it impossible to track the output of sent commands, identifying the correct response to a given
sent command is pretty much hit-and-miss. That situation gets even worse considering that it's next to impossible
to distinguish firmware versions which have that bug from firmware versions which don't have it.
Hence OctoPrint currently doesn't offer any synchronous way of retrieving the output of responses from the printer.
If you need the printer's serial communication, you'll need to subscribe to :ref:`push updates <sec-api-push>`.
.._sec-api-printer-state:
Retrieve the current printer state
@@ -131,6 +149,8 @@ Retrieve the current printer state
"operational": true,
"paused": false,
"printing": false,
"cancelling": false,
"pausing": false,
"sdReady": true,
"error": false,
"ready": true,
@@ -161,6 +181,8 @@ Retrieve the current printer state
"operational": true,
"paused": false,
"printing": false,
"cancelling": false,
"pausing": false,
"sdReady": true,
"error": false,
"ready": true,
@@ -190,20 +212,32 @@ Issue a print head command
jog
Jogs the print head (relatively) by a defined amount in one or more axes. Additional parameters are:
*``x``: Optional. Amount to jog print head on x axis, must be a valid number corresponding to the distance to travel in mm.
*``y``: Optional. Amount to jog print head on y axis, must be a valid number corresponding to the distance to travel in mm.
*``z``: Optional. Amount to jog print head on z axis, must be a valid number corresponding to the distance to travel in mm.
*``x``: Optional. Amount/coordinate to jog print head on x axis, must be a valid number corresponding to the distance to travel in mm.
*``y``: Optional. Amount/coordinate to jog print head on y axis, must be a valid number corresponding to the distance to travel in mm.
*``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``: 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.
home
Homes the print head in all of the given axes. Additional parameters are:
*``axes``: A list of axes which to home, valid values are one or more of ``x``, ``y``, ``z``.
All of these commands may only be sent if the printer is currently operational and not printing. Otherwise a
:http:statuscode:`409` is returned.
feedrate
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%.
All of these commands except ``feedrate`` may only be sent if the printer is currently operational and not printing.
Otherwise a :http:statuscode:`409` is returned.
Upon success, a status code of :http:statuscode:`204` and an empty body is returned.
Requires user rights.
**Example Jog Request**
Jog the print head by 10mm in X, -5mm in Y and 0.02mm in Z.
@@ -246,13 +280,34 @@ Issue a print head command
HTTP/1.1204No Content
**Example feed rate request**
Set the feed rate factor to 105%.
..sourcecode::http
POST/api/printer/printheadHTTP/1.1
Host: example.com
Content-Type: application/json
X-Api-Key: abcdef...
{
"command": "feedrate",
"factor": 105
}
..sourcecode::http
HTTP/1.1204No Content
:json string command:The command to issue, either ``jog`` or ``home``.
:json number x:``jog`` command: The amount to travel on the X axis in mm.
:json number y:``jog`` command: The amount to travel on the Y axis in mm.
:json number z:``jog`` command: The amount to travel on the Z axis in mm.
:json array axes:``home`` command: The axes which to home, valid values are one or more of ``x``, ``y`` and ``z``.
:json number factor:``feedrate`` command: The factor to apply to the feed rate, percentage between 50 and 200% as integer or float.
:statuscode 204:No error
:statuscode 400:Invalid axis specified, invalid value for travel amount for a jog command or otherwise invalid
:statuscode 400:Invalid axis specified, invalid value for travel amount for a jog command or factor for feed rate or otherwise invalid
request.
:statuscode 409:If the printer is not operational or currently printing.
@@ -288,12 +343,18 @@ Issue a tool command
*``amount``: The amount of filament to extrude in mm. May be negative to retract.
flowrate
Changes the flow rate factor to apply to extrusion of the tool.
*``factor``: The new factor, percentage as integer or float (percentage divided by 100) between 75 and 125%.
All of these commands may only be sent if the printer is currently operational and -- in case of ``select`` and
``extrude`` -- not printing. Otherwise a :http:statuscode:`409` is returned.
Upon success, a status code of :http:statuscode:`204` and an empty body is returned.
Requires user rights.
**Example Target Temperature Request**
Set the target temperature for the printer's first hotend to 220°C and the printer's second extruder to 205°C.
@@ -400,14 +461,35 @@ Issue a tool command
HTTP/1.1204No Content
**Example flow rate request**
Set the flow rate factor to 95%.
..sourcecode::http
POST/api/printer/toolHTTP/1.1
Host: example.com
Content-Type: application/json
X-Api-Key: abcdef...
{
"command": "flowrate",
"factor": 95
}
..sourcecode::http
HTTP/1.1204No Content
:json string command:The command to issue, either ``target``, ``offset``, ``select`` or ``extrude``.
:json object targets:``target`` command: The target temperatures to set. Valid properties have to match the format ``tool{n}``.
:json object offsets:``offset`` command: The offset temperature to set. Valid properties have to match the format ``tool{n}``.
:json object tool:``select`` command: The tool to select, value has to match the format ``tool{n}``.
:json object amount:``extrude`` command: The amount of filament to extrude from the currently selected tool.
:json number factor:``flowrate`` command: The factor to apply to the flow rate, percentage between 75 and 125% as integer or float.
:statuscode 204:No error
:statuscode 400:If ``targets`` or ``offsets`` contains a property or ``tool`` contains a value not matching the format
``tool{n}``, the target/offset temperature or extrusion amount is not a valid number or outside of
``tool{n}``, the target/offset temperature, extrusion amount or flow rate factor is not a valid number or outside of
the supported range, or if the request is otherwise invalid.
:statuscode 409:If the printer is not operational or -- in case of ``select`` or ``extrude`` -- currently printing.
@@ -513,6 +595,11 @@ Issue a bed command
Upon success, a status code of :http:statuscode:`204` and an empty body is returned.
If no heated bed is configured for the currently selected printer profile, the resource will return
an :http:statuscode:`409`.
Requires user rights.
**Example Target Temperature Request**
Set the target temperature for the printer's heated bed to 75°C.
@@ -559,7 +646,8 @@ Issue a bed command
:statuscode 204:No error
:statuscode 400:If ``target`` or ``offset`` is not a valid number or outside of the supported range, or if the
request is otherwise invalid.
:statuscode 409:If the printer is not operational.
:statuscode 409:If the printer is not operational or the selected printer profile
does not have a heated bed.
.._sec-api-printer-bedstate:
@@ -576,6 +664,9 @@ Retrieve the current bed state
Returns a :http:statuscode:`200` with a Temperature Response in the body upon success.
If no heated bed is configured for the currently selected printer profile, the resource will return
an :http:statuscode:`409`.
..note::
If you want both tool and bed temperature information at the same time, take a look at
:ref:`Retrieve the current printer state <sec-api-printer-state>`.
@@ -624,7 +715,8 @@ Retrieve the current bed state
:query limit:If set to an integer (``n``), only the last ``n`` data points from the printer's temperature history
will be returned. Will be ignored if ``history`` is not enabled.
:statuscode 200:No error
:statuscode 409:If the printer is not operational.
:statuscode 409:If the printer is not operational or the selected printer profile
does not have a heated bed.
.._sec-api-printer-sdcommand:
@@ -639,7 +731,7 @@ Issue an SD command
init
Initializes the printer's SD card, making it available for use. This also includes an initial retrieval of the
list of files currently stored on the SD card, so after issueing that command a :ref:`retrieval of the files
list of files currently stored on the SD card, so after issuing that command a :ref:`retrieval of the files
on SD card <sec-api-fileops-retrievelocation>` will return a successful result.
..note::
@@ -657,6 +749,8 @@ Issue an SD command
Upon success, a status code of :http:statuscode:`204` and an empty body is returned.
Requires user rights.
**Example Init Request**
Initialize the SD card.
@@ -755,10 +849,67 @@ Retrieve the current SD state
:statuscode 200:No error
:statuscode 404:If SD support has been disabled in OctoPrint's config.
.._sec-api-printer-arbcommand:
Send an arbitrary command to the printer
========================================
..http:post:: /api/printer/command
Sends any command to the printer via the serial interface. Should be used with some care as some commands can interfere with
or even stop a running print job.
Expects a :ref:`Arbitrary Command Request <sec-api-printer-datamodel-arbcommand>` as the request's body.
If successful returns a :http:statuscode:`204` and an empty body.
Requires user rights.
**Example for sending a single command**
..sourcecode::http
POST/api/printer/commandHTTP/1.1
Host: example.com
Content-Type: application/json
X-Api-Key: abcdef...
{
"command": "M106"
}
..sourcecode::http
HTTP/1.1204No Content
**Example for sending multiple commands**
..sourcecode::http
POST/api/printer/commandHTTP/1.1
Host: example.com
Content-Type: application/json
X-Api-Key: abcdef...
{
"commands": [
"M18",
"M106 S0"
]
}
..sourcecode::http
HTTP/1.1204No Content
:json string command:Single command to send to the printer, mutually exclusive with ``commands``.
:json string commands:List of commands to send to the printer, mutually exclusive with ``command``.
:statuscode 204:No error
.._sec-api-printer-datamodel:
Datamodel
=========
Data model
==========
.._sec-api-printer-datamodel-fullstate:
@@ -807,7 +958,8 @@ Temperature State
* - ``bed``
- 0..1
- :ref:`Temperature Data <sec-api-datamodel-printer-tempdata>`
- Current temperature stats for the printer's heated bed. Not included if querying only tool state.
- Current temperature stats for the printer's heated bed. Not included if querying only tool state or if
the currently selected printer profile does not have a heated bed.
* - ``history``
- 0..1
- List of :ref:`Historic Temperature Datapoint <sec-api-datamodel-printer-temphistory>`
@@ -831,3 +983,36 @@ SD State
- Boolean
- Whether the SD card has been initialized (``true``) or not (``false``).
.._sec-api-printer-datamodel-arbcommand:
Arbitrary Command Request
-------------------------
..list-table::
:widths:15 5 10 30
:header-rows:1
* - Name
- Multiplicity
- Type
- Description
* - ``command``
- 0..1
- String
- Single command to send to the printer, mutually exclusive with ``commands`` and ``script``.
* - ``commands``
- 0..*
- Array of String
- Multiple commands to send to the printer (in the given order), mutually exclusive with ``command`` and ``script``.
* - ``script``
- 0..*
- String
- Name of the GCODE script template to send to the printer, mutually exclusive with ``command`` and ``commands``.
* - ``parameters``
- 0..1
- Map of key value pairs
- Key value pairs of parameters to replace in sent commands/provide to the script renderer
* - ``context``
- 0..1
- Map of key value pairs
- (only if ``script`` is set) additional template variables to provide to the script renderer
A :http:statuscode:`200` with a :ref:`List all response <sec-api-system-commands-listall>`
will be returned.
**Example**
..sourcecode::http
GET/api/system/commands/coreHTTP/1.1
Host: example.com
X-Api-Key: abcdef...
..sourcecode::http
HTTP/1.1200Ok
Content-Type: application/json
{
"core": [
{
"action": "shutdown",
"name": "Shutdown",
"command": "sudo shutdown -h now",
"confirm": "<strong>You are about to shutdown the system.</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).",
"confirm": "<strong>You are about to reboot the system.</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).",
"confirm": "<strong>You are about to restart the 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).",
Retrieves the configured system commands for the specified source.
The response will contain a list of :ref:`command definitions <sec-api-system-commands-definiton>`.
**Example**
..sourcecode::http
GET/api/system/commands/coreHTTP/1.1
Host: example.com
X-Api-Key: abcdef...
..sourcecode::http
HTTP/1.1200Ok
Content-Type: application/json
[
{
"action": "shutdown",
"name": "Shutdown",
"command": "sudo shutdown -h now",
"confirm": "<b>You are about to shutdown the system.</b></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).",
"confirm": "<b>You are about to reboot the system.</b></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).",
"confirm": "<b>You are about to restart the OctoPrint server.</b></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).",
After this has completed, you'll find your shiny new build of CuraEngine in
the `build` folder (full path for above example:
``~/CuraEngine/build/CuraEngine``).
.._sec-bundledplugins-cura-configuring:
Configuring the plugin
----------------------
The Cura plugin needs to be configured with the full path to your copy of the
CuraEngine executable that it's supposed to use. You can do this either via
the Cura plugin settings dialog or by manually configuring the path to the
executable via ``config.yaml``, example:
..code-block::yaml
plugins:
cura:
cura_engine:/path/to/CuraEngine
.._sec-bundledplugins-cura-profiles:
Using Cura Profiles
-------------------
The Cura Plugin supports importing your existing profiles for Cura **up to and
including Cura 15.04.x**. Newer Cura releases (e.g. 15.06 or 2.x) use a different
internal format that will *not* work with the current version of the Cura Plugin.
You can find downloads of Cura 15.04.x for Windows, Mac and Linux `on Ultimaker's download page <https://ultimaker.com/en/products/cura-software/list>`_.
In order to export a slicing profile from the Cura desktop UI, open it,
set up your profile, then click on "File" and there on "Save Profile". You can
import the .ini-file this creates via the "Import Profile" button in the
Cura Settings within OctoPrint.
.._sec-bundledplugins-cura-sourcecode:
Source code
-----------
The source of the Cura plugin is bundled with OctoPrint and can be found in
its source repository under ``src/octoprint/plugins/cura``.
OctoPi versions 0.12.0 and later already come with pybonjour installed and ready to go,
you don't need to perform these steps there.
..note::
Currently there are no releases for pybonjour available on the Python Package Index PyPI. The latest pybonjour
release is still available in the `Google Code Archive <https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/pybonjour/pybonjour-1.1.1.tar.gz>`_.
Since that URL is hilariously long though, a shortened version is provided with https://goo.gl/SxQZ06 and
used in the installation instructions below.
In order for the Zeroconf discovery to work, the
`pybonjour package <https://pypi.python.org/pypi/pybonjour>`_ needs to be available
to the Python installation running OctoPrint.
It can be installed via ``pip``. Let's assume you installed OctoPrint manually
into some folder ``~/OctoPrint``. You executed ``python setup.py install`` within a
virtualenv in the same folder called ``venv``. In order to install ``pybonjour``
so it will be available to OctoPrint you'll need to do the following::
venv/bin/pip install https://goo.gl/SxQZ06
**Linux users:** You'll need to install an additional dependency for this to work, the
libdnssd compatibility layer for libavahi. On Debian/Ubuntu that can be achieved with::
sudo apt-get install libavahi-compat-libdnssd-dev
.._sec-bundledplugins-discovery-configuration:
Configuring the plugin
----------------------
The plugin supports the following configuration keys:
*``publicPort``: Public port number OctoPrint is reachable under,
optional, if not set the port OctoPrint itself was started under will be used
*``pathPrefix``: Path prefix OctoPrint is running under, optional, if not
set ``/`` will be used
*``useSsl``: ``true`` if OctoPrint should be called via HTTPS, ``false`` otherwise
*``httpUsername``: HTTP Basic Auth username OctoPrint is reachable with, optional
*``httpPassword``: HTTP Basic Auth password OctoPrint is reachable with, optional
*``upnpUuid``: uPNP UUID used for SSDP service announcements, usually you will
not have to touch this, will be autogenerated if not set
*``zeroConf``: A list of additional services to announce via ZeroConf, optional,
see below.
*``model``:
*``name``: Name of the device model OctoPrint is running on, optional
*``description``: Description of the device model OctoPrint is running on,
optional, used only for SSDP
*``number``: Model number of the device OctoPrint is running on, optional,
used only for SSDP
*``url``: URL with further details about the device OctoPrint is running on,
optional, used only for SSDP
*``serial``: Serial number of the device OctoPrint is running on, optional,
used only for SSDP
*``vendor``: Vendor of the device OctoPrint is running on, optional
*``vendorUrl``: URL with further details about the vendor of the device
OctoPrint is running on, optional, used only for SSDP
***OctoPrint version tracking**: Whether you want to track OctoPrint *releases* or every *commit*. Usually you want to
select "Release" here which is also the default, unless you are a developer.
***OctoPrint Release Channel** (if tracking releases): The release channel of OctoPrint to track for updates. If you only want stable versions,
select "Stable" here which is also the default. "Maintenance RCs" will also allow you to update to maintenance release
candidates, "Devel RCs" will also allow you to update to development release candidates. If in doubt, leave it at
"Stable". `Read more about Release Channels here <https://github.com/foosel/OctoPrint/wiki/Using-Release-Channels>`_.
***OctoPrint checkout folder** (if tracking git commits): This must be the path to OctoPrint's git checkout folder
(``/home/pi/OctoPrint`` for OctoPi or `manual installs following the Raspberry Pi setup guide <https://github.com/foosel/OctoPrint/wiki/Setup-on-a-Raspberry-Pi-running-Raspbian>`_).
Note that since OctoPrint 1.3.6 you will no longer need to set this to be able to update to releases, only if you
want to be able to update against some bleeding edge git branch.
***Version cache TTL**: The "time to live" of the cache OctoPrint will use to temporarily persist the version information
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 corresponding section in config.yaml <sec-bundledplugins-softwareupdate-configuration>`.
That restart commands for OctoPrint and the whole server can be configured under Settings > Server.
.._sec-bundledplugins-softwareupdate-cli:
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 possible to check for updates via ``octoprint plugins softwareupdate:check``
and to apply available updates via ``octoprint plugins softwareupdate:update``. Please see the corresponding
OctoPrint includes, by default, a virtual printer plugin. This plugin allows you to debug OctoPrint's serial
communication without connecting to an actual printer. Furthermore, it is possible to create certain edge conditions
that may be hard to reproduce with a real printer.
.._sec-development-virtual-printer-enable:
Enabling the virtual printer
----------------------------
The virtual printer is enabled by editing OctoPrint's config.yaml file. Details on the configuration file can
be found in the full :ref:`config.yaml documentation <sec-configuration-config_yaml>`.
The steps to take are as follows:
* Find config.yaml in the OctoPrint settings folder. Usually in ``~/.octoprint`` on Linux, in ``%APPDATA%/OctoPrint`` on Windows and in ``~/Library/Application Support/OctoPrint`` on MacOS.
* Add or extend the ``devel`` section with:
..code-block::yaml
devel:
virtualPrinter:
enabled:true
* Restart OctoPrint.
* In the connection panel, a new option will appear in the Serial Port dropdown labeled ``VIRTUAL``.
* Select this option and click ``connect``.
* The virtual printer is now active.
.._sec-development-virtual-printer-config:
Virtual printer configuration options
-------------------------------------
The config.yaml file has many configuration options for the virtual printer that allow you to fine-tune its behavior.
Please see the relevant :ref:`config.yaml section <sec-configuration-config_yaml-devel>` for the full details.
.._sec-development-virtual-printer-log:
Log file
--------
Once activated, the virtual printer will log all serial communication in the ``plugin_virtual_printer_serial.log`` file
that can be found in the OctoPrint settings folder.
.._sec-development-virtual-printer-debug:
Debug commands
--------------
You can simulate certain conditions and communications through the terminal tab in OctoPrint's interface.
All commands start with ``!!DEBUG:`` and are followed by the command you want to execute. For instance, sending
``!!DEBUG:action_disconnect`` will disconnect the printer. Sending ``!!DEBUG`` without command will show a help
message with all the available commands.
Action Triggers
...............
``action_pause``
Sends a "// action:pause" action trigger to the host.
``action_resume``
Sends a "// action:resume" action trigger to the host.
``action_disconnect``
Sends a "// action:disconnect" action trigger to the host.
``action_custom <action>[ <parameters>]``
Sends a custom "// action:<action> <parameters>" action trigger to the host.
Communication Errors
....................
``dont_answer``
Will not acknowledge the next command.
``go_awol``
Will completely stop replying.
``trigger_resend_lineno``
Triggers a resend error with a line number mismatch
``trigger_resend_checksum``
Triggers a resend error with a checksum mismatch
``drop_connection``
Drops the serial connection
``prepare_ok <broken ok>``
Will cause <broken ok> to be enqueued for use, will be used instead of actual "ok"
Reply Timing / Sleeping
.......................
``sleep <int:seconds>``
Sleep <seconds> s
``sleep_after <str:command> <int:seconds>``
Sleeps <seconds> s after each execution of <command>
``sleep_after_next <str:command> <int:seconds>``
Sleeps <seconds> s after execution of next <command>
Uploads a ``file`` to ``url`` using a ``multipart/form-data````POST`` request.
``file`` should be either of
* a jQuery element pointing at a file input of the page of which the first
`File instance <https://developer.mozilla.org/en-US/docs/Web/API/File>`_ will be used,
* a string usable as selector to address a file input of the page of which the first
`File instance <https://developer.mozilla.org/en-US/docs/Web/API/File>`_ will be used or
* a `File instance <https://developer.mozilla.org/en-US/docs/Web/API/File>`_
If ``filename`` is provided, the file upload data will contain its value as file name for the
upload, otherwise the ``name`` property from the `File instance <https://developer.mozilla.org/en-US/docs/Web/API/File>`_.
The function will return a `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ which will also be
notified on the upload progress with an object containing the following properties:
loaded
The number of bytes already uploaded
total
The total number of bytes to upload
This can be used to populate progress bars or other types of progress visualization.
It is important to note that contrary to all the other request methods in this module, ``OctoPrint.upload``
is implemented using ``XMLHttpRequest`` directly instead of relying on jQuery's ``ajax`` function. It still
tries to replicate its behaviour on the returned `jQuery Promise <http://api.jquery.com/Types/#Promise>`_
however, meaning that the ``resolve`` and ``reject`` methods will be called with ``(data, textStatus, request)``
and ``(request, textStatus, error)`` parameters respectively.
Additional form elements for the POSTed form can be supplied through the ``additional`` parameters.
This should be an object of key/value pairs that are set as field name and value on the `FormData <https://developer.mozilla.org/en/docs/Web/API/FormData>`_
object that will be used in the request.
**Example:**
Uploading a file to ``some/path`` on the blueprint of plugin ``myplugin``, from a file input element,
updating a label with the current upload progress.
:param object additional:Additional parameters for the test command
:param object opts:Additional options for the request
:returns Promise:A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
..seealso::
:ref:`Util API <sec-api-util>`
Documentation of the underlying util API.
Loaded 100 of 581 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.