Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e5caa3d0bf | ||
|
|
a821346b07 | ||
|
|
0ac9ea518c | ||
|
|
9f80aefcc9 | ||
|
|
c1fe8f5a35 | ||
|
|
fcecb5c0f0 | ||
|
|
25005b547c | ||
|
|
dbfe7fece1 | ||
|
|
9c5d996ea2 | ||
|
|
b8e7cfb506 | ||
|
|
822f757f9d | ||
|
|
b04aff7d5e | ||
|
|
028425542f | ||
|
|
339d1df5a9 | ||
|
|
2abe67a24c | ||
|
|
47267abcd1 | ||
|
|
23f130da58 | ||
|
|
9af6b42bdd | ||
|
|
7cb910a69a | ||
|
|
c30db16085 | ||
|
|
832a0c88aa | ||
|
|
972c2823a0 | ||
|
|
f10bfa67ca | ||
|
|
fb834f81ee | ||
|
|
957ba43320 | ||
|
|
133850f61c | ||
|
|
f782cfe83f | ||
|
|
70254e910c | ||
|
|
f981cca47e | ||
|
|
0224037478 | ||
|
|
e4914b8bd3 |
No files matched your search
+3
-3
@@ -23,10 +23,10 @@ maintenance 1.3.7 99e1c3ac007a0eee9d6f908e598c6b029f3ae40c pep440-dev
|
||||
fix/.* 1.3.7 99e1c3ac007a0eee9d6f908e598c6b029f3ae40c pep440-dev
|
||||
improve/.* 1.3.7 99e1c3ac007a0eee9d6f908e598c6b029f3ae40c pep440-dev
|
||||
|
||||
# staging/maintenance is currently the branch for preparation of 1.3.6rc4
|
||||
# staging/maintenance is currently the branch for preparation of 1.3.7rc4
|
||||
# so is regressionfix/...
|
||||
staging/maintenance 1.3.6rc4 a8747f7e36a03ff2449b62cdf68b8a26a6fa61b3 pep440-dev
|
||||
regressionfix/.* 1.3.6rc4 a8747f7e36a03ff2449b62cdf68b8a26a6fa61b3 pep440-dev
|
||||
staging/maintenance 1.3.7rc4 9c5d996ea2b66a085392981a5e6e0ee341013674 pep440-dev
|
||||
regressionfix/.* 1.3.7rc4 9c5d996ea2b66a085392981a5e6e0ee341013674 pep440-dev
|
||||
|
||||
# every other branch is a development branch and thus gets resolved to 1.4.0-dev for now
|
||||
.* 1.4.0 7f5d03d0549bcbd26f40e7e4a3297ea5204fb1cc pep440-dev
|
||||
@@ -1,5 +1,40 @@
|
||||
# OctoPrint Changelog
|
||||
|
||||
## 1.3.7rc4 (2018-04-04)
|
||||
|
||||
### Bugfixes
|
||||
|
||||
* [#2536](https://github.com/foosel/OctoPrint/issues/2536) - Fix a wrong state tracking when starting an SD print through the controller, causing a disconnect due to a timeout.
|
||||
* [#2544](https://github.com/foosel/OctoPrint/issues/2544) - Fix an exception when connecting to the raw websocket at `/sockjs/websocket` (instead of `/sockjs/<server_id>/<session_id>/websocket`).
|
||||
* [#2546](https://github.com/foosel/OctoPrint/issues/2546) - Fix the `PRINT_FAILED` event getting triggered twice on print failure due to disconnect
|
||||
|
||||
([Commits](https://github.com/foosel/OctoPrint/compare/1.3.7rc3...1.3.7rc4))
|
||||
|
||||
## 1.3.7rc3 (2018-03-29)
|
||||
|
||||
### Bugfixes
|
||||
|
||||
* [#2524](https://github.com/foosel/OctoPrint/issues/2524) Ignore `wait` while job is on hold.
|
||||
|
||||
([Commits](https://github.com/foosel/OctoPrint/compare/1.3.7rc2...1.3.7rc3))
|
||||
|
||||
## 1.3.7rc2 (2018-03-23)
|
||||
|
||||
### Bugfixes
|
||||
|
||||
* [#1951](http://github.com/foosel/OctoPrint/issues/1951) - Fixed plugins being able to modify internal state data (e.g. progress, job), causing concurrent modification and resulting run time errors in the printer state processing.
|
||||
* [#2494](https://github.com/foosel/OctoPrint/issues/2494) - Fixed `undefined` values not saving in the settings.
|
||||
* [#2499](https://github.com/foosel/OctoPrint/issues/2499) - Fixed communication error notification lacking the actual error message.
|
||||
* [#2501](https://github.com/foosel/OctoPrint/issues/2501) - Fixed a bug causing log downloads to fail with an HTTP 500 error.
|
||||
* [#2506](https://github.com/foosel/OctoPrint/issues/2506) - Fixed `printer.get_current_data` and `printer.get_current_job` returning `frozendict` instead of `dict` instances, causing issues with plugins relying on being able to modify the returned data (e.g. [dattas/OctoPrint-DetailedProgress#26](https://github.com/dattas/OctoPrint-DetailedProgress/issues/26)).
|
||||
* [#2508](https://github.com/foosel/OctoPrint/issues/2508) - Fixed HTTP 500 error on `/api/slicing` in case of an unconfigured slicer.
|
||||
* Have `OctoPrintJsonEncoder` fall back to regular flask JSON encoder, otherwise we might not be able to serialize some data types we need to be able to serialize.
|
||||
* Use `pkg_resources` to determine pip version during environment check instead of `import pip; pip.__version__` since the latter causes issues with pip version 9.0.2. In the same spirit make `pip.main` approach of calling `pip` in the PipCaller the last resort during auto detection, only after trying `pip` or `pip.exe` inside the same folder as the Python executable.
|
||||
* Use `octoprint.util.monotonic_time` instead of `monotonic.monotonic` in comm layer.
|
||||
* Fixed timelapse not stopping on print failure due to firmware error due to missing `PrintFailed` event.
|
||||
|
||||
([Commits](https://github.com/foosel/OctoPrint/compare/1.3.7rc1...1.3.7rc2))
|
||||
|
||||
## 1.3.7rc1 (2018-03-19)
|
||||
|
||||
### Improvements
|
||||
|
||||
+3
-13
@@ -275,22 +275,11 @@ 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.
|
||||
Please refer to [this FAQ entry](https://discourse.octoprint.org/t/how-can-i-find-out-the-version-of-octoprint-or-octopi-i-am-running/204/1).
|
||||
|
||||
### 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).
|
||||
Please refer to [this FAQ entry](https://discourse.octoprint.org/t/where-can-i-find-octoprints-and-octopis-log-files/299/1).
|
||||
|
||||
### Where can I find my browser's error console?
|
||||
|
||||
@@ -483,6 +472,7 @@ the local version identifier to allow for an exact determination of the active c
|
||||
* 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
|
||||
* 2018-03-29: "Where to find version numbers" is now located on the FAQ
|
||||
|
||||
## Footnotes
|
||||
* [1] - If you are wondering why, the problem is that anything that you add
|
||||
|
||||
+4
-4
@@ -6,11 +6,9 @@ thanks to everyone who contributed!
|
||||
|
||||
## Patreon Patrons
|
||||
|
||||
* 3D Moniak
|
||||
* Aleph Objects, Inc.
|
||||
* Andrew Moorby
|
||||
* Arnljot Arntsen
|
||||
* BEEVERYCREATIVE
|
||||
* Boris Hussein
|
||||
* Brad Jackson
|
||||
* Brian E. Tyler
|
||||
* Christian Petropolis
|
||||
@@ -32,7 +30,9 @@ thanks to everyone who contributed!
|
||||
* Kale Stedman
|
||||
* Kazuhiro Ogura
|
||||
* Kodama Inc.
|
||||
* LulzBot®
|
||||
* Makespace Madrid
|
||||
* Mark Walker
|
||||
* Martin Beattie
|
||||
* Michael Aumock
|
||||
* Miles Flavel
|
||||
@@ -54,4 +54,4 @@ thanks to everyone who contributed!
|
||||
* Thomas Hatley
|
||||
* Trent Shumay
|
||||
|
||||
and 1188 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel)!
|
||||
and 1217 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel)!
|
||||
@@ -83,8 +83,8 @@ class EnvironmentDetector(object):
|
||||
|
||||
# try to find pip version
|
||||
try:
|
||||
import pip
|
||||
result["pip"] = pip.__version__
|
||||
import pkg_resources
|
||||
result["pip"] = pkg_resources.get_distribution("pip").version
|
||||
except:
|
||||
self._logger.exception("Error detecting pip version")
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ from octoprint.server import NO_CONTENT, admin_permission
|
||||
from octoprint.server.util.flask import redirect_to_tornado, restricted_access
|
||||
|
||||
from flask import request, jsonify, url_for, make_response
|
||||
from flask_babel import gettext
|
||||
from werkzeug.utils import secure_filename
|
||||
from werkzeug.exceptions import BadRequest
|
||||
import yaml
|
||||
@@ -200,4 +201,7 @@ class LoggingPlugin(octoprint.plugin.AssetPlugin,
|
||||
__plugin_name__ = "Logging"
|
||||
__plugin_author__ = "Shawn Bruce, based on work by Gina Häußge and Marc Hannappel"
|
||||
__plugin_description__ = "Provides access to OctoPrint's logs and logging configuration."
|
||||
__plugin_disabling_discouraged__ = gettext("Without this plugin you will no longer be able to retrieve "
|
||||
"OctoPrint's logs or modify the current logging levels through "
|
||||
"the web interface.")
|
||||
__plugin_implementation__ = LoggingPlugin()
|
||||
+1
-1
@@ -2,6 +2,6 @@
|
||||
<label class="control-label">{{ _('OctoPrint Release Channel') }}</label>
|
||||
<div class="controls">
|
||||
<select data-bind="value: config_releaseChannel, options: config_availableReleaseChannels, optionsText: 'name', optionsValue: 'key'"></select>
|
||||
<span class="help-inline">{{ _('Make sure you have read <a href="%(url)s" target="_blank" rel="noreferrer noopener">"Using Release Channels"</a> before switching to a release channel other than "Stable"', url="https://github.com/foosel/OctoPrint/wiki/Using-Release-Channels") }}</span>
|
||||
<span class="help-inline">{{ _('Make sure you have read <a href="%(url)s" target="_blank" rel="noreferrer noopener">"How to use the release channels to help test release candidates"</a> before switching to a release channel other than "Stable"', url="https://faq.octoprint.org/using-release-channels") }}</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -5,9 +5,10 @@ __license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agp
|
||||
__copyright__ = "Copyright (C) 2018 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
|
||||
import monotonic
|
||||
import time
|
||||
|
||||
from octoprint.util import monotonic_time
|
||||
|
||||
def can_perform_update(target, check, online=True):
|
||||
return True
|
||||
|
||||
@@ -15,9 +16,9 @@ def can_perform_update(target, check, online=True):
|
||||
def perform_update(target, check, target_version, log_cb=None, online=True):
|
||||
duration = check.get("duration", 30)
|
||||
|
||||
now = monotonic.monotonic()
|
||||
now = monotonic_time()
|
||||
end = now + duration
|
||||
while now < end:
|
||||
log_cb(["{}s left...".format(end - now)], prefix=">", stream="output")
|
||||
time.sleep(5)
|
||||
now = monotonic.monotonic()
|
||||
now = monotonic_time()
|
||||
@@ -29,6 +29,7 @@ class VirtualPrinter(object):
|
||||
prepare_ok_regex = re.compile("prepare_ok (.*)")
|
||||
send_regex = re.compile("send (.*)")
|
||||
set_ambient_regex = re.compile("set_ambient ([-+]?[0-9]*\.?[0-9]+)")
|
||||
start_sd_regex = re.compile("start_sd (.*)")
|
||||
|
||||
def __init__(self, seriallog_handler=None, read_timeout=5.0, write_timeout=10.0):
|
||||
import logging
|
||||
@@ -102,10 +103,12 @@ class VirtualPrinter(object):
|
||||
self._selectedSdFile = None
|
||||
self._selectedSdFileSize = None
|
||||
self._selectedSdFilePos = None
|
||||
|
||||
self._writingToSd = False
|
||||
self._writingToSdHandle = None
|
||||
self._newSdFilePos = None
|
||||
self._heatupThread = None
|
||||
|
||||
self._heatingUp = False
|
||||
|
||||
self._okBeforeCommandOutput = settings().getBoolean(["devel", "virtualPrinter", "okBeforeCommandOutput"])
|
||||
self._supportM112 = settings().getBoolean(["devel", "virtualPrinter", "supportM112"])
|
||||
@@ -164,6 +167,74 @@ class VirtualPrinter(object):
|
||||
return "VIRTUAL(read_timeout={read_timeout},write_timeout={write_timeout},options={options})"\
|
||||
.format(read_timeout=self._read_timeout, write_timeout=self._write_timeout, options=settings().get(["devel", "virtualPrinter"]))
|
||||
|
||||
def _reset(self):
|
||||
self._clearQueue(self.incoming)
|
||||
self._clearQueue(self.outgoing)
|
||||
self._clearQueue(self.buffered)
|
||||
|
||||
self._relative = True
|
||||
self._lastX = 0.0
|
||||
self._lastY = 0.0
|
||||
self._lastZ = 0.0
|
||||
self._lastE = [0.0] * self.extruderCount
|
||||
self._lastF = 200
|
||||
|
||||
self._unitModifier = 1
|
||||
self._feedrate_multiplier = 100
|
||||
self._flowrate_multiplier = 100
|
||||
|
||||
self._sdCardReady = True
|
||||
self._sdPrinting = False
|
||||
if self._sdPrinter:
|
||||
self._sdPrinting = False
|
||||
self._sdPrintingSemaphore.set()
|
||||
self._sdPrinter = None
|
||||
self._selectedSdFile = None
|
||||
self._selectedSdFileSize = None
|
||||
self._selectedSdFilePos = None
|
||||
|
||||
if self._writingToSdHandle:
|
||||
try:
|
||||
self._writingToSdHandle.close()
|
||||
except:
|
||||
pass
|
||||
self._writingToSd = False
|
||||
self._writingToSdHandle = None
|
||||
self._newSdFilePos = None
|
||||
|
||||
self._heatingUp = False
|
||||
|
||||
self.currentLine = 0
|
||||
self.lastN = 0
|
||||
|
||||
self._debug_awol = False
|
||||
self._debug_sleep = None
|
||||
self._sleepAfterNext.clear()
|
||||
self._sleepAfter.clear()
|
||||
|
||||
self._dont_answer = False
|
||||
|
||||
self._debug_drop_connection = False
|
||||
|
||||
self._killed = False
|
||||
|
||||
self._triggerResendAt100 = True
|
||||
self._triggerResendWithTimeoutAt105 = True
|
||||
self._triggerResendWithMissingLinenoAt110 = True
|
||||
self._triggerResendWithChecksumMismatchAt115 = True
|
||||
|
||||
if self._temperature_reporter is not None:
|
||||
self._temperature_reporter.cancel()
|
||||
self._temperature_reporter = None
|
||||
|
||||
if self._sdstatus_reporter is not None:
|
||||
self._sdstatus_reporter.cancel()
|
||||
self._sdstatus_reporter = None
|
||||
|
||||
if settings().getBoolean(["devel", "virtualPrinter", "simulateReset"]):
|
||||
for item in settings().get(["devel", "virtualPrinter", "resetLines"]):
|
||||
self._send(item + "\n")
|
||||
|
||||
@property
|
||||
def timeout(self):
|
||||
return self._read_timeout
|
||||
@@ -182,9 +253,10 @@ class VirtualPrinter(object):
|
||||
self._logger.debug("Setting write timeout to {}s".format(value))
|
||||
self._write_timeout = value
|
||||
|
||||
def _clearQueue(self, queue):
|
||||
def _clearQueue(self, q):
|
||||
try:
|
||||
while queue.get(block=False):
|
||||
while q.get(block=False):
|
||||
q.task_done()
|
||||
continue
|
||||
except queue.Empty:
|
||||
pass
|
||||
@@ -195,6 +267,10 @@ class VirtualPrinter(object):
|
||||
while self.incoming is not None and not self._killed:
|
||||
self._simulateTemps()
|
||||
|
||||
if self._heatingUp:
|
||||
time.sleep(1)
|
||||
continue
|
||||
|
||||
try:
|
||||
data = self.incoming.get(timeout=0.01)
|
||||
self.incoming.task_done()
|
||||
@@ -294,7 +370,7 @@ class VirtualPrinter(object):
|
||||
continue
|
||||
|
||||
# shortcut for writing to SD
|
||||
if self._writingToSdHandle is not None and not "M29" in data:
|
||||
if self._writingToSd and self._writingToSdHandle is not None and not "M29" in data:
|
||||
self._writingToSdHandle.write(data)
|
||||
self._sendOk()
|
||||
continue
|
||||
@@ -658,10 +734,19 @@ class VirtualPrinter(object):
|
||||
sleep_after_next <str:command> <int:seconds>
|
||||
| Sleeps <seconds> s after execution of next <command>
|
||||
|
||||
# SD printing
|
||||
|
||||
start_sd <str:file>
|
||||
| Start printing file <file> from SD
|
||||
cancel_sd
|
||||
| Cancels an ongoing SD print
|
||||
|
||||
# Misc
|
||||
|
||||
send <str:message>
|
||||
| Sends back <message>
|
||||
reset
|
||||
| Simulates a reset. Internal state will be lost.
|
||||
"""
|
||||
for line in usage.split("\n"):
|
||||
self._send("echo: {}".format(line.strip()))
|
||||
@@ -683,6 +768,8 @@ class VirtualPrinter(object):
|
||||
self._prepared_errors.append(lambda cur, last, line: self._send(self._error("lineno_missing", last)))
|
||||
elif data == "drop_connection":
|
||||
self._debug_drop_connection = True
|
||||
elif data == "reset":
|
||||
self._reset()
|
||||
elif data == "mintemp_error":
|
||||
self._send(self._error("mintemp"))
|
||||
elif data == "maxtemp_error":
|
||||
@@ -690,6 +777,13 @@ class VirtualPrinter(object):
|
||||
elif data == "go_awol":
|
||||
self._send("// Going AWOL")
|
||||
self._debug_awol = True
|
||||
elif data == "cancel_sd":
|
||||
if self._sdPrinting and self._sdPrinter:
|
||||
self._pauseSdPrint()
|
||||
self._sdPrinting = False
|
||||
self._sdPrintingSemaphore.set()
|
||||
self._sdPrinter.join()
|
||||
self._finishSdPrint()
|
||||
else:
|
||||
try:
|
||||
sleep_match = VirtualPrinter.sleep_regex.match(data)
|
||||
@@ -699,6 +793,7 @@ class VirtualPrinter(object):
|
||||
prepare_ok_match = VirtualPrinter.prepare_ok_regex.match(data)
|
||||
send_match = VirtualPrinter.send_regex.match(data)
|
||||
set_ambient_match = VirtualPrinter.set_ambient_regex.match(data)
|
||||
start_sd_match = VirtualPrinter.start_sd_regex.match(data)
|
||||
|
||||
if sleep_match is not None:
|
||||
interval = int(sleep_match.group(1))
|
||||
@@ -727,6 +822,9 @@ class VirtualPrinter(object):
|
||||
elif set_ambient_match is not None:
|
||||
self._ambient_temperature = float(set_ambient_match.group(1))
|
||||
self._send("// set ambient temperature to {}".format(self._ambient_temperature))
|
||||
elif start_sd_match is not None:
|
||||
self._selectSdFile(start_sd_match.group(1))
|
||||
self._startSdPrint()
|
||||
except:
|
||||
pass
|
||||
|
||||
@@ -764,6 +862,7 @@ class VirtualPrinter(object):
|
||||
def _startSdPrint(self):
|
||||
if self._selectedSdFile is not None:
|
||||
if self._sdPrinter is None:
|
||||
self._sdPrinting = True
|
||||
self._sdPrinter = threading.Thread(target=self._sdPrintingWorker)
|
||||
self._sdPrinter.start()
|
||||
self._sdPrintingSemaphore.set()
|
||||
@@ -877,7 +976,7 @@ class VirtualPrinter(object):
|
||||
matchE = re.search("E([0-9.]+)", line)
|
||||
matchF = re.search("F([0-9.]+)", line)
|
||||
|
||||
duration = 0
|
||||
duration = 0.0
|
||||
if matchF is not None:
|
||||
try:
|
||||
self._lastF = float(matchF.group(1))
|
||||
@@ -946,6 +1045,7 @@ class VirtualPrinter(object):
|
||||
pass
|
||||
|
||||
if duration:
|
||||
duration *= 0.1
|
||||
if duration > self._read_timeout:
|
||||
slept = 0
|
||||
while duration - slept > self._read_timeout and not self._killed:
|
||||
@@ -1025,7 +1125,7 @@ class VirtualPrinter(object):
|
||||
try:
|
||||
with open(self._selectedSdFile, "r") as f:
|
||||
for line in iter(f.readline, ""):
|
||||
if self._killed:
|
||||
if self._killed or not self._sdPrinting:
|
||||
break
|
||||
|
||||
# reset position if requested by client
|
||||
@@ -1038,12 +1138,14 @@ class VirtualPrinter(object):
|
||||
|
||||
# if we are paused, wait for unpausing
|
||||
self._sdPrintingSemaphore.wait()
|
||||
if self._killed or not self._sdPrinting:
|
||||
break
|
||||
|
||||
# set target temps
|
||||
if 'M104' in line or 'M109' in line:
|
||||
self._parseHotendCommand(line)
|
||||
self._parseHotendCommand(line, wait='M109' in line)
|
||||
elif 'M140' in line or 'M190' in line:
|
||||
self._parseBedCommand(line)
|
||||
self._parseBedCommand(line, wait='M190' in line)
|
||||
elif line.startswith("G0") or line.startswith("G1") or line.startswith("G2") or line.startswith("G3"):
|
||||
# simulate reprap buffered commands via a Queue with maxsize which internally simulates the moves
|
||||
self.buffered.put(line)
|
||||
@@ -1052,9 +1154,13 @@ class VirtualPrinter(object):
|
||||
if self.outgoing is not None:
|
||||
raise
|
||||
|
||||
self._finishSdPrint()
|
||||
|
||||
def _finishSdPrint(self):
|
||||
if not self._killed:
|
||||
self._sdPrintingSemaphore.clear()
|
||||
self._selectedSdFilePos = 0
|
||||
self._sdPrinting = False
|
||||
self._sdPrinter = None
|
||||
self._output("Done printing file")
|
||||
|
||||
@@ -1063,6 +1169,7 @@ class VirtualPrinter(object):
|
||||
delay = 1
|
||||
last_busy = time.time()
|
||||
|
||||
self._heatingUp = True
|
||||
try:
|
||||
if heater.startswith("tool"):
|
||||
toolNum = int(heater[len("tool"):])
|
||||
@@ -1074,7 +1181,7 @@ class VirtualPrinter(object):
|
||||
else:
|
||||
return
|
||||
|
||||
while not self._killed and test():
|
||||
while not self._killed and self._heatingUp and test():
|
||||
self._simulateTemps(delta=delta)
|
||||
self._output(output())
|
||||
if self._sendBusy and time.time() - last_busy >= self._busyInterval:
|
||||
@@ -1084,6 +1191,8 @@ class VirtualPrinter(object):
|
||||
except AttributeError:
|
||||
if self.outgoing is not None:
|
||||
raise
|
||||
finally:
|
||||
self._heatingUp = False
|
||||
|
||||
def _deleteSdFile(self, filename):
|
||||
if filename.startswith("/"):
|
||||
@@ -1246,6 +1355,10 @@ class CharCountingQueue(queue.Queue):
|
||||
self._size = 0
|
||||
self._name = name
|
||||
|
||||
def clear(self):
|
||||
with self.mutex:
|
||||
self.queue.clear()
|
||||
|
||||
def put(self, item, block=True, timeout=None, partial=False):
|
||||
self.not_full.acquire()
|
||||
|
||||
|
||||
@@ -550,11 +550,11 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
return self._comm.getStateId(state=state)
|
||||
|
||||
def get_current_data(self, *args, **kwargs):
|
||||
return self._stateMonitor.get_current_data()
|
||||
return util.thaw_frozendict(self._stateMonitor.get_current_data())
|
||||
|
||||
def get_current_job(self, *args, **kwargs):
|
||||
currentData = self._stateMonitor.get_current_data()
|
||||
return currentData["job"]
|
||||
return util.thaw_frozendict(currentData["job"])
|
||||
|
||||
def get_current_temperatures(self, *args, **kwargs):
|
||||
if self._comm is not None:
|
||||
@@ -1049,17 +1049,22 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
with self._selectedFileMutex:
|
||||
if self._selectedFile is not None:
|
||||
if state == comm.MachineCom.STATE_CLOSED or state == comm.MachineCom.STATE_ERROR or state == comm.MachineCom.STATE_CLOSED_WITH_ERROR:
|
||||
def log_print():
|
||||
self._fileManager.log_print(FileDestinations.SDCARD if self._selectedFile["sd"] else FileDestinations.LOCAL,
|
||||
self._selectedFile["filename"],
|
||||
time.time(),
|
||||
self._comm.getPrintTime(),
|
||||
False,
|
||||
self._printerProfileManager.get_current_or_default()["id"])
|
||||
payload = self._payload_for_print_job_event()
|
||||
if payload:
|
||||
payload["time"] = self._comm.getPrintTime()
|
||||
|
||||
thread = threading.Thread(target=log_print)
|
||||
thread.daemon = True
|
||||
thread.start()
|
||||
def finalize():
|
||||
self._fileManager.log_print(payload["origin"],
|
||||
payload["path"],
|
||||
time.time(),
|
||||
payload["time"],
|
||||
False,
|
||||
self._printerProfileManager.get_current_or_default()["id"])
|
||||
eventManager().fire(Events.PRINT_FAILED, payload)
|
||||
|
||||
thread = threading.Thread(target=finalize)
|
||||
thread.daemon = True
|
||||
thread.start()
|
||||
self._analysisQueue.resume() # printing done, put those cpu cycles to good use
|
||||
elif state == comm.MachineCom.STATE_PRINTING:
|
||||
self._analysisQueue.pause() # do not analyse files while printing
|
||||
@@ -1171,7 +1176,8 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
|
||||
def on_comm_print_job_failed(self):
|
||||
payload = self._payload_for_print_job_event()
|
||||
eventManager().fire(Events.PRINT_FAILED, payload)
|
||||
if payload:
|
||||
eventManager().fire(Events.PRINT_FAILED, payload)
|
||||
|
||||
def on_comm_print_job_cancelling(self, firmware_error=None):
|
||||
payload = self._payload_for_print_job_event()
|
||||
|
||||
@@ -223,6 +223,7 @@ class Server(object):
|
||||
|
||||
# monkey patch a bunch of stuff
|
||||
util.tornado.fix_ioloop_scheduling()
|
||||
util.tornado.fix_json_encode()
|
||||
util.flask.enable_additional_translations(additional_folders=[self._settings.getBaseFolder("translations")])
|
||||
|
||||
# setup app
|
||||
@@ -1441,6 +1442,8 @@ class Server(object):
|
||||
def _setup_login_manager(self):
|
||||
util.flask.fix_flask_login_remote_address()
|
||||
|
||||
global loginManager
|
||||
|
||||
loginManager = LoginManager()
|
||||
loginManager.session_protection = "strong"
|
||||
loginManager.user_callback = load_user
|
||||
|
||||
@@ -1422,4 +1422,7 @@ def collect_plugin_assets(enable_gcodeviewer=True, preferred_stylesheet="css"):
|
||||
|
||||
class OctoPrintJsonEncoder(flask.json.JSONEncoder):
|
||||
def default(self, obj):
|
||||
return JsonEncoding.encode(obj)
|
||||
try:
|
||||
return JsonEncoding.encode(obj)
|
||||
except TypeError:
|
||||
return flask.json.JSONEncoder.default(self, obj)
|
||||
@@ -57,15 +57,7 @@ class ThreadSafeSession(sockjs.tornado.session.Session):
|
||||
|
||||
|
||||
class JsonEncodingSessionWrapper(wrapt.ObjectProxy):
|
||||
|
||||
def send_message(self, msg, stats=True, binary=False):
|
||||
"""Send or queue outgoing message
|
||||
|
||||
`msg`
|
||||
Message to send
|
||||
`stats`
|
||||
If set to True, will update statistics after operation completes
|
||||
"""
|
||||
self.send_jsonified(json.dumps(sockjs.tornado.util.bytes_to_str(msg),
|
||||
separators=(',', ':'),
|
||||
default=JsonEncoding.encode),
|
||||
@@ -74,7 +66,8 @@ class JsonEncodingSessionWrapper(wrapt.ObjectProxy):
|
||||
|
||||
class PrinterStateConnection(sockjs.tornado.SockJSConnection, octoprint.printer.PrinterCallback):
|
||||
def __init__(self, printer, fileManager, analysisQueue, userManager, eventManager, pluginManager, session):
|
||||
session = JsonEncodingSessionWrapper(session)
|
||||
if isinstance(session, sockjs.tornado.session.Session):
|
||||
session = JsonEncodingSessionWrapper(session)
|
||||
|
||||
sockjs.tornado.SockJSConnection.__init__(self, session)
|
||||
|
||||
|
||||
@@ -59,6 +59,22 @@ def fix_ioloop_scheduling():
|
||||
tornado.ioloop.PeriodicCallback._schedule_next = _schedule_next
|
||||
|
||||
|
||||
def fix_json_encode():
|
||||
"""
|
||||
This makes tornado.escape.json_encode use octoprint.util.JsonEncoding.encode as fallback in order to allow
|
||||
serialization of globally registered types like frozendict and others.
|
||||
"""
|
||||
|
||||
from octoprint.util.json import JsonEncoding
|
||||
import json
|
||||
|
||||
def fixed_json_encode(value):
|
||||
return json.dumps(value, default=JsonEncoding.encode).replace("</", "<\\/")
|
||||
|
||||
import tornado.escape
|
||||
tornado.escape.json_encode = fixed_json_encode
|
||||
|
||||
|
||||
#~~ More sensible logging
|
||||
|
||||
|
||||
|
||||
@@ -558,7 +558,7 @@ class SlicingManager(object):
|
||||
raise SlicerNotConfigured(slicer)
|
||||
|
||||
slicer_profile_path = self.get_slicer_profile_path(slicer)
|
||||
return self.get_slicer(slicer).get_slicer_profiles(slicer_profile_path)
|
||||
return self.get_slicer(slicer, require_configured=False).get_slicer_profiles(slicer_profile_path)
|
||||
|
||||
def profiles_last_modified(self, slicer):
|
||||
"""
|
||||
@@ -575,7 +575,7 @@ class SlicingManager(object):
|
||||
raise UnknownSlicer(slicer)
|
||||
|
||||
slicer_profile_path = self.get_slicer_profile_path(slicer)
|
||||
return self.get_slicer(slicer).get_slicer_profiles_lastmodified(slicer_profile_path)
|
||||
return self.get_slicer(slicer, require_configured=False).get_slicer_profiles_lastmodified(slicer_profile_path)
|
||||
|
||||
def get_slicer_profile_path(self, slicer):
|
||||
"""
|
||||
|
||||
@@ -1 +1 @@
|
||||
.btn{display:inline-block;*display:inline;*zoom:1;padding:4px 12px;margin-bottom:0;font-size:14px;line-height:20px;text-align:center;vertical-align:middle;cursor:pointer;color:#333;text-shadow:0 1px 1px rgba(255,255,255,.75);background-color:#f5f5f5;background-image:-moz-linear-gradient(top,#fff,#e6e6e6);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#e6e6e6));background-image:-webkit-linear-gradient(top,#fff,#e6e6e6);background-image:-o-linear-gradient(top,#fff,#e6e6e6);background-image:linear-gradient(to bottom,#fff,#e6e6e6);background-repeat:repeat-x;*background-color:#e6e6e6;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);border:1px solid #ccc;*border:0;border-bottom-color:#b3b3b3;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;*margin-left:.3em;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05)}.btn.active,.btn.disabled,.btn:active,.btn:focus,.btn:hover,.btn[disabled]{color:#333;background-color:#e6e6e6;*background-color:#d9d9d9}.btn.active,.btn:active{background-color:#ccc \9}.btn:first-child{*margin-left:0}.btn:focus,.btn:hover{color:#333;text-decoration:none;background-position:0 -15px;-webkit-transition:background-position .1s linear;-moz-transition:background-position .1s linear;-o-transition:background-position .1s linear;transition:background-position .1s linear}.btn:focus{outline:#333 dotted thin;outline:-webkit-focus-ring-color auto 5px;outline-offset:-2px}.btn.active,.btn:active{background-image:none;outline:0;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05)}.btn.disabled,.btn[disabled]{cursor:default;background-image:none;opacity:.65;filter:alpha(opacity=65);-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.btn-large{padding:11px 19px;font-size:17.5px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px}.btn-large [class*=" icon-"],.btn-large [class^=icon-]{margin-top:4px}.btn-small{padding:2px 10px;font-size:11.9px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.btn-small [class*=" icon-"],.btn-small [class^=icon-]{margin-top:0}.btn-mini [class*=" icon-"],.btn-mini [class^=icon-]{margin-top:-1px}.btn-mini{padding:0 6px;font-size:10.5px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.btn-block{display:block;width:100%;padding-left:0;padding-right:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.btn-block+.btn-block{margin-top:5px}input[type=submit].btn-block,input[type=reset].btn-block,input[type=button].btn-block{width:100%}.btn-primary{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#006dcc;background-image:-moz-linear-gradient(top,#08c,#04c);background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#04c));background-image:-webkit-linear-gradient(top,#08c,#04c);background-image:-o-linear-gradient(top,#08c,#04c);background-image:linear-gradient(to bottom,#08c,#04c);background-repeat:repeat-x;border-color:#04c #04c #002a80;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#04c;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-primary.active,.btn-primary.disabled,.btn-primary:active,.btn-primary:focus,.btn-primary:hover,.btn-primary[disabled]{color:#fff;background-color:#04c;*background-color:#003bb3}.btn-primary.active,.btn-primary:active{background-color:#039 \9}.btn-warning{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#faa732;background-image:-moz-linear-gradient(top,#fbb450,#f89406);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fbb450),to(#f89406));background-image:-webkit-linear-gradient(top,#fbb450,#f89406);background-image:-o-linear-gradient(top,#fbb450,#f89406);background-image:linear-gradient(to bottom,#fbb450,#f89406);background-repeat:repeat-x;border-color:#f89406 #f89406 #ad6704;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#f89406;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-warning.active,.btn-warning.disabled,.btn-warning:active,.btn-warning:focus,.btn-warning:hover,.btn-warning[disabled]{color:#fff;background-color:#f89406;*background-color:#df8505}.btn-warning.active,.btn-warning:active{background-color:#c67605 \9}.btn-danger{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#da4f49;background-image:-moz-linear-gradient(top,#ee5f5b,#bd362f);background-image:-webkit-gradient(linear,0 0,0 100%,from(#ee5f5b),to(#bd362f));background-image:-webkit-linear-gradient(top,#ee5f5b,#bd362f);background-image:-o-linear-gradient(top,#ee5f5b,#bd362f);background-image:linear-gradient(to bottom,#ee5f5b,#bd362f);background-repeaLine truncated
|
||||
.btn{display:inline-block;*display:inline;*zoom:1;padding:4px 12px;margin-bottom:0;font-size:14px;line-height:20px;text-align:center;vertical-align:middle;cursor:pointer;color:#333;text-shadow:0 1px 1px rgba(255,255,255,.75);background-color:#f5f5f5;background-image:-moz-linear-gradient(top,#fff,#e6e6e6);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#e6e6e6));background-image:-webkit-linear-gradient(top,#fff,#e6e6e6);background-image:-o-linear-gradient(top,#fff,#e6e6e6);background-image:linear-gradient(to bottom,#fff,#e6e6e6);background-repeat:repeat-x;*background-color:#e6e6e6;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);border:1px solid #ccc;*border:0;border-bottom-color:#b3b3b3;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;*margin-left:.3em;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05)}.btn.active,.btn.disabled,.btn:active,.btn:focus,.btn:hover,.btn[disabled]{color:#333;background-color:#e6e6e6;*background-color:#d9d9d9}.btn.active,.btn:active{background-color:#ccc \9}.btn:first-child{*margin-left:0}.btn:focus,.btn:hover{color:#333;text-decoration:none;background-position:0 -15px;-webkit-transition:background-position .1s linear;-moz-transition:background-position .1s linear;-o-transition:background-position .1s linear;transition:background-position .1s linear}.btn:focus{outline:#333 dotted thin;outline:-webkit-focus-ring-color auto 5px;outline-offset:-2px}.btn.active,.btn:active{background-image:none;outline:0;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05)}.btn.disabled,.btn[disabled]{cursor:default;background-image:none;opacity:.65;filter:alpha(opacity=65);-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.btn-large{padding:11px 19px;font-size:17.5px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px}.btn-large [class*=" icon-"],.btn-large [class^=icon-]{margin-top:4px}.btn-small{padding:2px 10px;font-size:11.9px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.btn-small [class*=" icon-"],.btn-small [class^=icon-]{margin-top:0}.btn-mini [class*=" icon-"],.btn-mini [class^=icon-]{margin-top:-1px}.btn-mini{padding:0 6px;font-size:10.5px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.btn-block{display:block;width:100%;padding-left:0;padding-right:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.btn-block+.btn-block{margin-top:5px}input[type=submit].btn-block,input[type=reset].btn-block,input[type=button].btn-block{width:100%}.btn-primary{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#006dcc;background-image:-moz-linear-gradient(top,#08c,#04c);background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#04c));background-image:-webkit-linear-gradient(top,#08c,#04c);background-image:-o-linear-gradient(top,#08c,#04c);background-image:linear-gradient(to bottom,#08c,#04c);background-repeat:repeat-x;border-color:#04c #04c #002a80;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#04c;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-primary.active,.btn-primary.disabled,.btn-primary:active,.btn-primary:focus,.btn-primary:hover,.btn-primary[disabled]{color:#fff;background-color:#04c;*background-color:#003bb3}.btn-primary.active,.btn-primary:active{background-color:#039 \9}.btn-warning{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#faa732;background-image:-moz-linear-gradient(top,#fbb450,#f89406);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fbb450),to(#f89406));background-image:-webkit-linear-gradient(top,#fbb450,#f89406);background-image:-o-linear-gradient(top,#fbb450,#f89406);background-image:linear-gradient(to bottom,#fbb450,#f89406);background-repeat:repeat-x;border-color:#f89406 #f89406 #ad6704;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#f89406;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-warning.active,.btn-warning.disabled,.btn-warning:active,.btn-warning:focus,.btn-warning:hover,.btn-warning[disabled]{color:#fff;background-color:#f89406;*background-color:#df8505}.btn-warning.active,.btn-warning:active{background-color:#c67605 \9}.btn-danger{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#da4f49;background-image:-moz-linear-gradient(top,#ee5f5b,#bd362f);background-image:-webkit-gradient(linear,0 0,0 100%,from(#ee5f5b),to(#bd362f));background-image:-webkit-linear-gradient(top,#ee5f5b,#bd362f);background-image:-o-linear-gradient(top,#ee5f5b,#bd362f);background-image:linear-gradient(to bottom,#ee5f5b,#bd362f);background-repeaLine truncated
|
||||
@@ -91,6 +91,14 @@
|
||||
return params;
|
||||
};
|
||||
|
||||
var replaceUndefinedWithNull = function(key, value) {
|
||||
if (value === undefined) {
|
||||
return null;
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
OctoPrintClient.prototype.getBaseUrl = function() {
|
||||
var url = this.options.baseurl;
|
||||
if (!_.endsWith(url, "/")) {
|
||||
@@ -165,7 +173,7 @@
|
||||
};
|
||||
|
||||
OctoPrintClient.prototype.postJson = function(url, data, opts) {
|
||||
return this.post(url, JSON.stringify(data), contentTypeJson(opts));
|
||||
return this.post(url, JSON.stringify(data, replaceUndefinedWithNull), contentTypeJson(opts));
|
||||
};
|
||||
|
||||
OctoPrintClient.prototype.put = function(url, data, opts) {
|
||||
@@ -173,7 +181,7 @@
|
||||
};
|
||||
|
||||
OctoPrintClient.prototype.putJson = function(url, data, opts) {
|
||||
return this.put(url, JSON.stringify(data), contentTypeJson(opts));
|
||||
return this.put(url, JSON.stringify(data, replaceUndefinedWithNull), contentTypeJson(opts));
|
||||
};
|
||||
|
||||
OctoPrintClient.prototype.patch = function(url, data, opts) {
|
||||
@@ -181,7 +189,7 @@
|
||||
};
|
||||
|
||||
OctoPrintClient.prototype.patchJson = function(url, data, opts) {
|
||||
return this.patch(url, JSON.stringify(data), contentTypeJson(opts));
|
||||
return this.patch(url, JSON.stringify(data, replaceUndefinedWithNull), contentTypeJson(opts));
|
||||
};
|
||||
|
||||
OctoPrintClient.prototype.delete = function(url, opts) {
|
||||
|
||||
@@ -245,17 +245,17 @@ function DataUpdater(allViewModels, connectCallback, disconnectCallback) {
|
||||
case "resend":
|
||||
case "timeout": {
|
||||
title = gettext("Communication error");
|
||||
text = gettext("There was a communication error while talking to your printer. Please consult the terminal output and octoprint.log for details. Error: %(error)s", payload);
|
||||
text = _.sprintf(gettext("There was a communication error while talking to your printer. Please consult the terminal output and octoprint.log for details. Error: %(error)s"), payload);
|
||||
break;
|
||||
}
|
||||
case "connection": {
|
||||
title = gettext("Error connecting to printer");
|
||||
text = gettext("There was an error while trying to connect to your printer. Error: %(error)s", payload);
|
||||
text = _.sprintf(gettext("There was an error while trying to connect to your printer. Error: %(error)s"), payload);
|
||||
break;
|
||||
}
|
||||
case "start_print": {
|
||||
title = gettext("Error starting a print");
|
||||
text = gettext("There was an error while trying to start a print job. Error: %(error)s", payload);
|
||||
text = _.sprintf(gettext("There was an error while trying to start a print job. Error: %(error)s"), payload);
|
||||
break;
|
||||
}
|
||||
case "autodetect_port":
|
||||
@@ -265,7 +265,7 @@ function DataUpdater(allViewModels, connectCallback, disconnectCallback) {
|
||||
}
|
||||
default: {
|
||||
title = gettext("Unknown error");
|
||||
text = gettext("There was an unknown error while talking to your printer. Please consult the terminal output and octoprint.log for details. Error: %(error)s", payload);
|
||||
text = _.sprintf(gettext("There was an unknown error while talking to your printer. Please consult the terminal output and octoprint.log for details. Error: %(error)s"), payload);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -911,15 +911,12 @@ function splitTextToArray(text, sep, stripEmpty, filter) {
|
||||
* and is optimized to check for value changes, not key updates.
|
||||
*/
|
||||
function hasDataChanged(data, oldData) {
|
||||
if (data == undefined) {
|
||||
// noinspection EqualityComparisonWithCoercionJS
|
||||
if (data == oldData && data == undefined) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (oldData == undefined) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_.isPlainObject(data)) {
|
||||
if (_.isPlainObject(data) && _.isPlainObject(oldData)) {
|
||||
return _.any(_.keys(data), function(key) {return hasDataChanged(data[key], oldData[key]);});
|
||||
} else {
|
||||
return !_.isEqual(data, oldData);
|
||||
@@ -956,10 +953,12 @@ function hasDataChanged(data, oldData) {
|
||||
* and is optimized to check for value changes, not key updates.
|
||||
*/
|
||||
function getOnlyChangedData(data, oldData) {
|
||||
// noinspection EqualityComparisonWithCoercionJS
|
||||
if (data == undefined) {
|
||||
return {};
|
||||
}
|
||||
|
||||
// noinspection EqualityComparisonWithCoercionJS
|
||||
if (oldData == undefined) {
|
||||
return data;
|
||||
}
|
||||
@@ -972,17 +971,20 @@ function getOnlyChangedData(data, oldData) {
|
||||
var retval = {};
|
||||
_.forOwn(root, function(value, key) {
|
||||
var oldValue = undefined;
|
||||
// noinspection EqualityComparisonWithCoercionJS
|
||||
if (oldRoot != undefined && oldRoot.hasOwnProperty(key)) {
|
||||
oldValue = oldRoot[key];
|
||||
}
|
||||
if (_.isPlainObject(value)) {
|
||||
// noinspection EqualityComparisonWithCoercionJS
|
||||
if (oldValue == undefined) {
|
||||
retval[key] = value;
|
||||
} else if (hasDataChanged(value, oldValue)) {
|
||||
retval[key] = f(value, oldValue);
|
||||
}
|
||||
} else {
|
||||
if (!_.isEqual(value, oldValue)) {
|
||||
// noinspection EqualityComparisonWithCoercionJS
|
||||
if (!(value == oldValue && value == undefined) && !_.isEqual(value, oldValue)) {
|
||||
retval[key] = value;
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -7,8 +7,8 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: OctoPrint\n"
|
||||
"Report-Msgid-Bugs-To: i18n@octoprint.org\n"
|
||||
"POT-Creation-Date: 2018-03-16 13:18+0100\n"
|
||||
"PO-Revision-Date: 2018-03-16 14:07+0100\n"
|
||||
"POT-Creation-Date: 2018-04-03 17:40+0200\n"
|
||||
"PO-Revision-Date: 2018-04-03 17:40+0200\n"
|
||||
"Last-Translator: Gina Häußge <osd@foosel.net>\n"
|
||||
"Language: de\n"
|
||||
"Language-Team: German (http://www.transifex.com/projects/p/octoprint/language/de/)\n"
|
||||
@@ -624,6 +624,10 @@ msgstr "Profil entfernen"
|
||||
msgid "Without this plugin your OctoPrint instance will no longer be discoverable on the network via Bonjour and uPnP."
|
||||
msgstr "Ohne dieses Plugin wird deine OctoPrint Instanz nicht mehr in deinem Netzwerk mittels Bonjour oder uPnP automatisch auffindbar sein."
|
||||
|
||||
#: src/octoprint/plugins/logging/__init__.py:204
|
||||
msgid "Without this plugin you will no longer be able to retrieve OctoPrint's logs or modify the current logging levels through the web interface."
|
||||
msgstr "Ohne dieses Plugin kannst du OctoPrints Logfiles nicht mehr über das Webinterface herunterladen und auch die aktuellen Loglevel modifizieren."
|
||||
|
||||
#: src/octoprint/plugins/logging/templates/logging_settings.jinja2:1
|
||||
msgid "Logs"
|
||||
msgstr "Logs"
|
||||
@@ -1196,6 +1200,22 @@ msgstr "Abbruch"
|
||||
msgid "Save"
|
||||
msgstr "Speichern"
|
||||
|
||||
#: src/octoprint/plugins/printer_safety_check/__init__.py:44
|
||||
msgid "Printer Safety Warning"
|
||||
msgstr "Druckersicherheitswarnung"
|
||||
|
||||
#: src/octoprint/plugins/printer_safety_check/__init__.py:105
|
||||
msgid "Without this plugin OctoPrint will no longer be able to check if the printer it is connected to has a known safetyissue and inform you about that fact."
|
||||
msgstr "Ohne dieses Plugin wird OctoPrint nicht länger in der Lage sein, dich über bekannte Sicherheitsprobleme mit verbundenen Druckern zu informieren."
|
||||
|
||||
#: src/octoprint/plugins/printer_safety_check/templates/printer_safety_check_sidebar.jinja2:1
|
||||
msgid "Warning!"
|
||||
msgstr "Warnung!"
|
||||
|
||||
#: src/octoprint/plugins/printer_safety_check/templates/printer_safety_check_sidebar.jinja2:5
|
||||
msgid "Learn more..."
|
||||
msgstr "Mehr erfahren..."
|
||||
|
||||
#: src/octoprint/plugins/softwareupdate/__init__.py:570
|
||||
#: src/octoprint/plugins/softwareupdate/templates/softwareupdate_wizard.jinja2:1
|
||||
msgid "Software Update"
|
||||
@@ -1516,8 +1536,8 @@ msgstr "OctoPrint Release Channel"
|
||||
|
||||
#: src/octoprint/plugins/softwareupdate/templates/snippets/plugins/softwareupdate/releaseChannel.jinja2:5
|
||||
#, python-format
|
||||
msgid "Make sure you have read <a href=\"%(url)s\" target=\"_blank\" rel=\"noreferrer noopener\">\"Using Release Channels\"</a> before switching to a release channel other than \"Stable\""
|
||||
msgstr "Stelle sicher, dass du <a href=\"%(url)s\" target=\"_blank\" rel=\"noreferrer noopener\">\"Using Release Channels\"</a> gelesen hast, bevor du einen anderen Release Channel als \"Stable\" auswählst."
|
||||
msgid "Make sure you have read <a href=\"%(url)s\" target=\"_blank\" rel=\"noreferrer noopener\">\"How to use the release channels to help test release candidates\"</a> before switching to a release channel other than \"Stable\""
|
||||
msgstr "Stelle sicher, dass du <a href=\"%(url)s\" target=\"_blank\" rel=\"noreferrer noopener\">\"How to use the release channels to help test release candidates\"</a> gelesen hast, bevor du einen anderen Release Channel als \"Stable\" auswählst."
|
||||
|
||||
#: src/octoprint/plugins/softwareupdate/templates/snippets/plugins/softwareupdate/versionTracking.jinja2:2
|
||||
msgid "OctoPrint version tracking"
|
||||
@@ -1840,7 +1860,7 @@ msgid "off"
|
||||
msgstr "Aus"
|
||||
|
||||
#: src/octoprint/static/js/app/helpers.js:654
|
||||
#: src/octoprint/static/js/app/viewmodels/connection.js:133
|
||||
#: src/octoprint/static/js/app/viewmodels/connection.js:135
|
||||
msgid "Are you sure?"
|
||||
msgstr "Bist Du sicher?"
|
||||
|
||||
@@ -1902,19 +1922,19 @@ msgid "Connect"
|
||||
msgstr "Verbinden"
|
||||
|
||||
#: src/octoprint/static/js/app/viewmodels/connection.js:44
|
||||
#: src/octoprint/static/js/app/viewmodels/connection.js:142
|
||||
#: src/octoprint/static/js/app/viewmodels/connection.js:144
|
||||
msgid "Disconnect"
|
||||
msgstr "Trennen"
|
||||
|
||||
#: src/octoprint/static/js/app/viewmodels/connection.js:134
|
||||
#: src/octoprint/static/js/app/viewmodels/connection.js:136
|
||||
msgid "<p><strong>You are about to disconnect from the printer while a print is in progress.</strong></p><p>Disconnecting while a print is in progress will prevent OctoPrint from completing the print. If you're printing from an SD card attached directly to the printer, any attempt to restart OctoPrint or reconnect to the printer could interrupt the print.<p>"
|
||||
msgstr "<p><strong>Du bist im Begriff, die Verbindung zu deinem Drucker zu trennen während ein Druck läuft.</strong></p><p>Das Trennen der Verbindung während eines Drucks wird OctoPrint daran hindern, diesen zu vollenden. Falls du von der SD deines Druckers druckst, könnte jeglicher Versuch, OctoPrint neuzustarten oder erneut mit dem Drucker zu verbinden den Druck unterbrechen.<p>"
|
||||
|
||||
#: src/octoprint/static/js/app/viewmodels/connection.js:140
|
||||
#: src/octoprint/static/js/app/viewmodels/connection.js:142
|
||||
msgid "Are you sure you want to disconnect from the printer?"
|
||||
msgstr "Bist Du sicher, dass du die Verbindung zum Drucker trennen willst?"
|
||||
|
||||
#: src/octoprint/static/js/app/viewmodels/connection.js:141
|
||||
#: src/octoprint/static/js/app/viewmodels/connection.js:143
|
||||
msgid "Stay Connected"
|
||||
msgstr "Verbunden bleiben"
|
||||
|
||||
|
||||
@@ -21,6 +21,8 @@ from functools import wraps
|
||||
import warnings
|
||||
import contextlib
|
||||
import collections
|
||||
import frozendict
|
||||
import copy
|
||||
|
||||
try:
|
||||
import queue
|
||||
@@ -970,6 +972,20 @@ except RuntimeError:
|
||||
monotonic_time = time.time
|
||||
|
||||
|
||||
def thaw_frozendict(obj):
|
||||
if not isinstance(obj, (dict, frozendict.frozendict)):
|
||||
raise ValueError("obj must be a dict or frozendict instance")
|
||||
|
||||
# only true love can thaw a frozen dict
|
||||
letitgo = dict()
|
||||
for key, value in obj.items():
|
||||
if isinstance(value, (dict, frozendict.frozendict)):
|
||||
letitgo[key] = thaw_frozendict(value)
|
||||
else:
|
||||
letitgo[key] = copy.deepcopy(value)
|
||||
return letitgo
|
||||
|
||||
|
||||
def utmify(link, source=None, medium=None, name=None, term=None, content=None):
|
||||
if source is None:
|
||||
return link
|
||||
|
||||
+16
-16
@@ -28,7 +28,7 @@ try:
|
||||
except AttributeError:
|
||||
# pyserial < 3.2: add backported Timeout abstraction, slightly modified since we have monotonic available
|
||||
|
||||
import monotonic
|
||||
from octoprint.util import monotonic_time
|
||||
class _Timeout(object):
|
||||
def __init__(self, duration):
|
||||
"""Initialize a timeout with given duration"""
|
||||
@@ -36,7 +36,7 @@ except AttributeError:
|
||||
self.is_non_blocking = (duration == 0)
|
||||
self.duration = duration
|
||||
if duration is not None:
|
||||
self.target_time = monotonic.monotonic() + duration
|
||||
self.target_time = monotonic_time() + duration
|
||||
else:
|
||||
self.target_time = None
|
||||
|
||||
@@ -51,10 +51,10 @@ except AttributeError:
|
||||
elif self.is_infinite:
|
||||
return None
|
||||
else:
|
||||
delta = self.target_time - monotonic.monotonic()
|
||||
delta = self.target_time - monotonic_time()
|
||||
if delta > self.duration:
|
||||
# clock jumped, recalculate
|
||||
self.target_time = monotonic.monotonic() + self.duration
|
||||
self.target_time = monotonic_time() + self.duration
|
||||
return self.duration
|
||||
else:
|
||||
return max(0, delta)
|
||||
@@ -65,7 +65,7 @@ except AttributeError:
|
||||
before.
|
||||
"""
|
||||
self.duration = duration
|
||||
self.target_time = monotonic.monotonic() + duration
|
||||
self.target_time = monotonic_time() + duration
|
||||
|
||||
serial.Timeout = _Timeout
|
||||
del _Timeout
|
||||
@@ -850,7 +850,6 @@ class MachineCom(object):
|
||||
self._monitoring_active = False
|
||||
self._send_queue_active = False
|
||||
|
||||
printing = self.isPrinting() or self.isPaused()
|
||||
if self._serial is not None:
|
||||
if not is_error:
|
||||
self.sendGcodeScript("beforePrinterDisconnected")
|
||||
@@ -883,6 +882,7 @@ class MachineCom(object):
|
||||
self._logger.exception("Error while trying to close serial port")
|
||||
is_error = True
|
||||
|
||||
# if we are printing, this will also make sure of firing PRINT_FAILED
|
||||
if is_error:
|
||||
self._changeState(self.STATE_CLOSED_WITH_ERROR)
|
||||
else:
|
||||
@@ -894,9 +894,6 @@ class MachineCom(object):
|
||||
if settings().getBoolean(["feature", "sdSupport"]):
|
||||
self._sdFileList = []
|
||||
|
||||
if printing:
|
||||
self._callback.on_comm_print_job_failed()
|
||||
|
||||
def setTemperatureOffset(self, offsets):
|
||||
self._tempOffsets.update(offsets)
|
||||
|
||||
@@ -1003,7 +1000,7 @@ class MachineCom(object):
|
||||
if self._currentFile is None:
|
||||
raise ValueError("No file selected for printing")
|
||||
|
||||
self._heatupWaitStartTime = None
|
||||
self._heatupWaitStartTime = None if not self._heating else time.time()
|
||||
self._heatupWaitTimeLost = 0.0
|
||||
self._pauseWaitStartTime = 0
|
||||
self._pauseWaitTimeLost = 0.0
|
||||
@@ -1543,7 +1540,7 @@ class MachineCom(object):
|
||||
handled = False
|
||||
|
||||
# process oks
|
||||
if line.startswith("ok") or (self.isPrinting() and supportWait and line == "wait"):
|
||||
if line.startswith("ok") or (self.isPrinting() and not self.job_on_hold and supportWait and line == "wait"):
|
||||
# ok only considered handled if it's alone on the line, might be
|
||||
# a response to an M105 or an M114
|
||||
self._handle_ok()
|
||||
@@ -1631,7 +1628,7 @@ class MachineCom(object):
|
||||
if not disable_external_heatup_detection and not self._temperature_autoreporting \
|
||||
and not line.strip().startswith("ok") and not self._heating \
|
||||
and self._firmware_info_received:
|
||||
self._logger.debug("Externally triggered heatup detected")
|
||||
self._logger.info("Externally triggered heatup detected")
|
||||
self._heating = True
|
||||
self._heatupWaitStartTime = time.time()
|
||||
|
||||
@@ -2043,9 +2040,10 @@ class MachineCom(object):
|
||||
self._clear_to_send.set()
|
||||
|
||||
def _finish_heatup(self):
|
||||
if self._heatupWaitStartTime:
|
||||
self._heatupWaitTimeLost = self._heatupWaitTimeLost + (time.time() - self._heatupWaitStartTime)
|
||||
self._heatupWaitStartTime = None
|
||||
if self._heating:
|
||||
if self._heatupWaitStartTime:
|
||||
self._heatupWaitTimeLost = self._heatupWaitTimeLost + (time.time() - self._heatupWaitStartTime)
|
||||
self._heatupWaitStartTime = None
|
||||
self._heating = False
|
||||
|
||||
def _continue_sending(self):
|
||||
@@ -2913,7 +2911,9 @@ class MachineCom(object):
|
||||
modified = True
|
||||
else:
|
||||
new_results.append((command, command_type, gcode, subcode, tags))
|
||||
modified = True
|
||||
else:
|
||||
new_results.append((command, command_type, gcode, subcode, tags))
|
||||
|
||||
if modified:
|
||||
if not new_results:
|
||||
# gcode handler returned None or empty list for all commands, so we'll stop here and return a full out empty result
|
||||
|
||||
@@ -11,6 +11,7 @@ import sys
|
||||
import logging
|
||||
import site
|
||||
import threading
|
||||
import os
|
||||
|
||||
import pkg_resources
|
||||
|
||||
@@ -237,6 +238,10 @@ class PipCaller(CommandlineCaller):
|
||||
@classmethod
|
||||
def autodetect_pip(cls):
|
||||
commands = [[sys.executable, "-m", "pip"],
|
||||
[os.path.join(os.path.dirname(sys.executable), "pip.exe" if sys.platform == "win32" else "pip")],
|
||||
|
||||
# this should be our last resort since it might fail thanks to using pip programmatically like
|
||||
# that is not officially supported or sanctioned by the pip developers
|
||||
[sys.executable, "-c", "import sys; sys.argv = ['pip'] + sys.argv[1:]; import pip; pip.main()"]]
|
||||
|
||||
for command in commands:
|
||||
|
||||
@@ -7,6 +7,7 @@ __copyright__ = "Copyright (C) 2017 The OctoPrint Project - Released under terms
|
||||
|
||||
import unittest
|
||||
import ddt
|
||||
from frozendict import frozendict
|
||||
|
||||
import octoprint.util
|
||||
|
||||
@@ -45,3 +46,25 @@ class MiscTestCase(unittest.TestCase):
|
||||
def test_utmify(self, link, kwargs, expected):
|
||||
actual = octoprint.util.utmify(link, **kwargs)
|
||||
self.assertEqual(actual, expected)
|
||||
|
||||
@ddt.data(
|
||||
(frozendict(a=1, b=2, c=3), dict(a=1, b=2, c=3)),
|
||||
(frozendict(a=1, b=2, c=frozendict(c1=1, c2=2)), dict(a=1, b=2, c=dict(c1=1, c2=2))),
|
||||
(dict(a=1, b=2, c=3), dict(a=1, b=2, c=3)),
|
||||
(dict(a=1, b=2, c=frozendict(c1=1, c2=2)), dict(a=1, b=2, c=dict(c1=1, c2=2))),
|
||||
(dict(a=1, b=2, c=dict(c1=1, c2=2, c3=frozendict(c11=11, c12=12))), dict(a=1, b=2, c=dict(c1=1, c2=2, c3=dict(c11=11, c12=12))))
|
||||
)
|
||||
@ddt.unpack
|
||||
def test_unfreeze_frozendict(self, input, expected):
|
||||
result = octoprint.util.thaw_frozendict(input)
|
||||
self.assertIsInstance(result, dict)
|
||||
self.assertDictEqual(result, expected)
|
||||
|
||||
@ddt.data(None, "invalid", 3, [1, 2], (3, 4))
|
||||
def test_unfreeze_frozendict_invalid(self, input):
|
||||
try:
|
||||
octoprint.util.thaw_frozendict(input)
|
||||
self.fail("expected ValueError")
|
||||
except ValueError:
|
||||
# expected
|
||||
pass
|
||||
Binary file not shown.
@@ -7,8 +7,8 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: OctoPrint\n"
|
||||
"Report-Msgid-Bugs-To: i18n@octoprint.org\n"
|
||||
"POT-Creation-Date: 2018-03-19 13:41+0100\n"
|
||||
"PO-Revision-Date: 2018-03-19 13:42+0100\n"
|
||||
"POT-Creation-Date: 2018-04-03 17:40+0200\n"
|
||||
"PO-Revision-Date: 2018-04-03 17:40+0200\n"
|
||||
"Last-Translator: Gina Häußge <osd@foosel.net>\n"
|
||||
"Language: de\n"
|
||||
"Language-Team: German (http://www.transifex.com/projects/p/octoprint/language/de/)\n"
|
||||
@@ -624,6 +624,10 @@ msgstr "Profil entfernen"
|
||||
msgid "Without this plugin your OctoPrint instance will no longer be discoverable on the network via Bonjour and uPnP."
|
||||
msgstr "Ohne dieses Plugin wird deine OctoPrint Instanz nicht mehr in deinem Netzwerk mittels Bonjour oder uPnP automatisch auffindbar sein."
|
||||
|
||||
#: src/octoprint/plugins/logging/__init__.py:204
|
||||
msgid "Without this plugin you will no longer be able to retrieve OctoPrint's logs or modify the current logging levels through the web interface."
|
||||
msgstr "Ohne dieses Plugin kannst du OctoPrints Logfiles nicht mehr über das Webinterface herunterladen und auch die aktuellen Loglevel modifizieren."
|
||||
|
||||
#: src/octoprint/plugins/logging/templates/logging_settings.jinja2:1
|
||||
msgid "Logs"
|
||||
msgstr "Logs"
|
||||
@@ -1532,8 +1536,8 @@ msgstr "OctoPrint Release Channel"
|
||||
|
||||
#: src/octoprint/plugins/softwareupdate/templates/snippets/plugins/softwareupdate/releaseChannel.jinja2:5
|
||||
#, python-format
|
||||
msgid "Make sure you have read <a href=\"%(url)s\" target=\"_blank\" rel=\"noreferrer noopener\">\"Using Release Channels\"</a> before switching to a release channel other than \"Stable\""
|
||||
msgstr "Stelle sicher, dass du <a href=\"%(url)s\" target=\"_blank\" rel=\"noreferrer noopener\">\"Using Release Channels\"</a> gelesen hast, bevor du einen anderen Release Channel als \"Stable\" auswählst."
|
||||
msgid "Make sure you have read <a href=\"%(url)s\" target=\"_blank\" rel=\"noreferrer noopener\">\"How to use the release channels to help test release candidates\"</a> before switching to a release channel other than \"Stable\""
|
||||
msgstr "Stelle sicher, dass du <a href=\"%(url)s\" target=\"_blank\" rel=\"noreferrer noopener\">\"How to use the release channels to help test release candidates\"</a> gelesen hast, bevor du einen anderen Release Channel als \"Stable\" auswählst."
|
||||
|
||||
#: src/octoprint/plugins/softwareupdate/templates/snippets/plugins/softwareupdate/versionTracking.jinja2:2
|
||||
msgid "OctoPrint version tracking"
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: OctoPrint 1.3.7.dev166+g8a3a87efa.dirty\n"
|
||||
"Project-Id-Version: OctoPrint 1.3.7rc4.dev6+g2c77614b3.dirty\n"
|
||||
"Report-Msgid-Bugs-To: i18n@octoprint.org\n"
|
||||
"POT-Creation-Date: 2018-03-19 13:41+0100\n"
|
||||
"POT-Creation-Date: 2018-04-03 17:40+0200\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
@@ -699,6 +699,12 @@ msgid ""
|
||||
"discoverable on the network via Bonjour and uPnP."
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/plugins/logging/__init__.py:204
|
||||
msgid ""
|
||||
"Without this plugin you will no longer be able to retrieve OctoPrint's "
|
||||
"logs or modify the current logging levels through the web interface."
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/plugins/logging/templates/logging_settings.jinja2:1
|
||||
msgid "Logs"
|
||||
msgstr ""
|
||||
@@ -1703,8 +1709,9 @@ msgstr ""
|
||||
#, python-format
|
||||
msgid ""
|
||||
"Make sure you have read <a href=\"%(url)s\" target=\"_blank\" "
|
||||
"rel=\"noreferrer noopener\">\"Using Release Channels\"</a> before "
|
||||
"switching to a release channel other than \"Stable\""
|
||||
"rel=\"noreferrer noopener\">\"How to use the release channels to help "
|
||||
"test release candidates\"</a> before switching to a release channel other"
|
||||
" than \"Stable\""
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/plugins/softwareupdate/templates/snippets/plugins/softwareupdate/versionTracking.jinja2:2
|
||||
|
||||
Reference in new issue
Block a user