Compare commits

...
18 Commits
Author SHA1 Message Date
Gina Häußge 339d1df5a9 Preparing release of 1.3.7rc2 2018-03-23 15:29:00 +01:00
Gina Häußge 2abe67a24c Logging: Discourage disabling this plugin 2018-03-23 15:27:12 +01:00
Gina Häußge 47267abcd1 Fix HTTP 500 in case of unconfigured slicer
Fixes #2508
2018-03-23 14:24:10 +01:00
Gina Häußge 23f130da58 Fix "undefined" settings values not saving
Fixes #2494
2018-03-23 14:17:23 +01:00
Gina Häußge 9af6b42bdd Virtual: Fix queue clearing on reset 2018-03-22 17:50:48 +01:00
Gina Häußge 7cb910a69a Forgot a monotonic.monotonic 2018-03-22 17:10:06 +01:00
Gina Häußge c30db16085 Fire print failed event on error while printing
That will ensure to also stop timelapse
2018-03-22 16:17:25 +01:00
Gina Häußge 832a0c88aa Virtual: also reset autoreporting & fix heatup 2018-03-22 16:15:56 +01:00
Gina Häußge 972c2823a0 Add missing _sprintf wrapper around messages
Fixes #2499
2018-03-22 14:21:20 +01:00
Gina Häußge f10bfa67ca Use "import pip" method of calling pip only as last resort
Doing that poses too much risk with pip's general "no API support", as
seen in #2499.
2018-03-22 13:59:38 +01:00
Gina Häußge fb834f81ee Use pkg_resources to find out local pip version
Doing a "import pip; pip.__version__" or "from pip import __version__"
poses too much risk with pip's general "no API support", as seen in
#2499.
2018-03-22 13:46:38 +01:00
Gina Häußge 957ba43320 Virtual: Support for simulated reset 2018-03-22 13:36:12 +01:00
Gina Häußge 133850f61c Actually, make that a deepcopy 2018-03-22 13:08:01 +01:00
Gina Häußge f782cfe83f Thaw the frozendict on printer.get_current_data
We don't want calling code to run into trouble because of that.

Fixes #2506
2018-03-22 12:58:52 +01:00
Gina Häußge 70254e910c Use octoprint.util.monotonic_time instead of monotonic 2018-03-22 11:41:31 +01:00
Gina Häußge f981cca47e Forgot a "global"
Fixes #2501
2018-03-22 11:34:39 +01:00
Gina Häußge 0224037478 Have OctoPrintJsonEncoder fall back to flask encoder
That supports some types we want to keep just in case.
2018-03-20 16:19:06 +01:00
Gina Häußge e4914b8bd3 staging/maintenance is now 1.3.7rc2.dev 2018-03-19 17:18:39 +01:00
24 changed files with 263 additions and 61 deletions

No files matched your search

+3 -3
View File
@@ -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.7rc2
# so is regressionfix/...
staging/maintenance 1.3.6rc4 a8747f7e36a03ff2449b62cdf68b8a26a6fa61b3 pep440-dev
regressionfix/.* 1.3.6rc4 a8747f7e36a03ff2449b62cdf68b8a26a6fa61b3 pep440-dev
staging/maintenance 1.3.7rc2 da2c9632ea54fd1b3c8ae34f8f26bab29dbaf3c6 pep440-dev
regressionfix/.* 1.3.7rc2 da2c9632ea54fd1b3c8ae34f8f26bab29dbaf3c6 pep440-dev
# every other branch is a development branch and thus gets resolved to 1.4.0-dev for now
.* 1.4.0 7f5d03d0549bcbd26f40e7e4a3297ea5204fb1cc pep440-dev
+17
View File
@@ -1,5 +1,22 @@
# OctoPrint Changelog
## 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
+2 -1
View File
@@ -11,6 +11,7 @@ thanks to everyone who contributed!
* Andrew Moorby
* Arnljot Arntsen
* BEEVERYCREATIVE
* Boris Hussein
* Brad Jackson
* Brian E. Tyler
* Christian Petropolis
@@ -54,4 +55,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 1199 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel)!
+2 -2
View File
@@ -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()
@@ -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()
@@ -102,10 +102,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 +166,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 +252,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
@@ -294,7 +365,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
@@ -662,6 +733,8 @@ class VirtualPrinter(object):
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 +756,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":
@@ -764,6 +839,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()
@@ -1025,7 +1101,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,6 +1114,8 @@ 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:
@@ -1055,6 +1133,7 @@ class VirtualPrinter(object):
if not self._killed:
self._sdPrintingSemaphore.clear()
self._selectedSdFilePos = 0
self._sdPrinting = False
self._sdPrinter = None
self._output("Done printing file")
@@ -1063,6 +1142,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 +1154,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 +1164,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 +1328,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()
+17 -12
View File
@@ -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
+2
View File
@@ -1441,6 +1441,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
+4 -1
View File
@@ -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)
+2 -2
View File
@@ -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
View File
@@ -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
+11 -3
View File
@@ -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) {
+4 -4
View File
@@ -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;
}
}
+9 -7
View File
@@ -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;
}
}
@@ -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-03-23 15:23+0100\n"
"PO-Revision-Date: 2018-03-23 15:25+0100\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"
@@ -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"
+16
View File
@@ -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, 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
+5 -5
View File
@@ -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
+5
View File
@@ -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:
+22
View File
@@ -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,24 @@ 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))),
)
@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.
+6 -2
View File
@@ -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-03-23 15:23+0100\n"
"PO-Revision-Date: 2018-03-23 15:25+0100\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"
+8 -2
View File
@@ -6,9 +6,9 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: OctoPrint 1.3.7.dev166+g8a3a87efa.dirty\n"
"Project-Id-Version: OctoPrint 1.3.7rc2.dev16+g47267abcd.dirty\n"
"Report-Msgid-Bugs-To: i18n@octoprint.org\n"
"POT-Creation-Date: 2018-03-19 13:41+0100\n"
"POT-Creation-Date: 2018-03-23 15:23+0100\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 ""