diff --git a/.versioneer-lookup b/.versioneer-lookup index 5f1c73468..cc9665637 100644 --- a/.versioneer-lookup +++ b/.versioneer-lookup @@ -23,10 +23,10 @@ maintenance 1.3.8 da2c9632ea54fd1b3c8ae34f8f26bab29dbaf3c6 pep440-dev fix/.* 1.3.8 da2c9632ea54fd1b3c8ae34f8f26bab29dbaf3c6 pep440-dev improve/.* 1.3.8 da2c9632ea54fd1b3c8ae34f8f26bab29dbaf3c6 pep440-dev -# staging/maintenance is currently the branch for preparation of 1.3.7rc4 +# staging/maintenance is currently the branch for preparation of 1.3.7rc5 # so is regressionfix/... -staging/maintenance 1.3.7rc4 9c5d996ea2b66a085392981a5e6e0ee341013674 pep440-dev -regressionfix/.* 1.3.7rc4 9c5d996ea2b66a085392981a5e6e0ee341013674 pep440-dev +staging/maintenance 1.3.7rc5 e5caa3d0bf77ed23f04c1d96ab0fa997d19d2006 pep440-dev +regressionfix/.* 1.3.7rc5 e5caa3d0bf77ed23f04c1d96ab0fa997d19d2006 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 diff --git a/CHANGELOG.md b/CHANGELOG.md index a1bb98327..963eb5425 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # 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///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 diff --git a/SUPPORTERS.md b/SUPPORTERS.md index de67c9adb..1de21d611 100644 --- a/SUPPORTERS.md +++ b/SUPPORTERS.md @@ -6,8 +6,6 @@ thanks to everyone who contributed! ## Patreon Patrons - * 3D Moniak - * Aleph Objects, Inc. * Andrew Moorby * Arnljot Arntsen * Boris Hussein @@ -32,6 +30,7 @@ thanks to everyone who contributed! * Kale Stedman * Kazuhiro Ogura * Kodama Inc. + * LulzBot® * Makespace Madrid * Mark Walker * Martin Beattie @@ -55,4 +54,4 @@ thanks to everyone who contributed! * Thomas Hatley * Trent Shumay -and 1214 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel)! \ No newline at end of file +and 1217 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel)! \ No newline at end of file diff --git a/src/octoprint/plugins/softwareupdate/templates/snippets/plugins/softwareupdate/releaseChannel.jinja2 b/src/octoprint/plugins/softwareupdate/templates/snippets/plugins/softwareupdate/releaseChannel.jinja2 index 57ec4151c..5506dff4a 100644 --- a/src/octoprint/plugins/softwareupdate/templates/snippets/plugins/softwareupdate/releaseChannel.jinja2 +++ b/src/octoprint/plugins/softwareupdate/templates/snippets/plugins/softwareupdate/releaseChannel.jinja2 @@ -2,6 +2,6 @@
- {{ _('Make sure you have read "Using Release Channels" before switching to a release channel other than "Stable"', url="https://github.com/foosel/OctoPrint/wiki/Using-Release-Channels") }} + {{ _('Make sure you have read "How to use the release channels to help test release candidates" before switching to a release channel other than "Stable"', url="https://faq.octoprint.org/using-release-channels") }}
diff --git a/src/octoprint/plugins/virtual_printer/virtual.py b/src/octoprint/plugins/virtual_printer/virtual.py index 3862e455a..d4f7cc260 100644 --- a/src/octoprint/plugins/virtual_printer/virtual.py +++ b/src/octoprint/plugins/virtual_printer/virtual.py @@ -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 @@ -266,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() @@ -729,6 +734,13 @@ class VirtualPrinter(object): sleep_after_next | Sleeps s after execution of next + # SD printing + + start_sd + | Start printing file from SD + cancel_sd + | Cancels an ongoing SD print + # Misc send @@ -765,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) @@ -774,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)) @@ -802,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 @@ -953,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)) @@ -1022,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: @@ -1119,9 +1143,9 @@ class VirtualPrinter(object): # 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) @@ -1130,6 +1154,9 @@ 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 diff --git a/src/octoprint/printer/standard.py b/src/octoprint/printer/standard.py index b85f4e501..d11e47ffc 100644 --- a/src/octoprint/printer/standard.py +++ b/src/octoprint/printer/standard.py @@ -1176,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() diff --git a/src/octoprint/server/__init__.py b/src/octoprint/server/__init__.py index 1413119c5..934fe0f0e 100644 --- a/src/octoprint/server/__init__.py +++ b/src/octoprint/server/__init__.py @@ -223,6 +223,7 @@ class Server(object): # monkey patch a bunch of stuff util.sockjs.fix_tornado5_compatibility() + util.tornado.fix_json_encode() util.flask.enable_additional_translations(additional_folders=[self._settings.getBaseFolder("translations")]) # setup app diff --git a/src/octoprint/server/util/sockjs.py b/src/octoprint/server/util/sockjs.py index c3538a158..d67a0fd35 100644 --- a/src/octoprint/server/util/sockjs.py +++ b/src/octoprint/server/util/sockjs.py @@ -151,15 +151,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), @@ -168,7 +160,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) diff --git a/src/octoprint/server/util/tornado.py b/src/octoprint/server/util/tornado.py index dd56dc2dc..3ec1624a2 100644 --- a/src/octoprint/server/util/tornado.py +++ b/src/octoprint/server/util/tornado.py @@ -26,6 +26,22 @@ import octoprint.util +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("\n" "Language: de\n" "Language-Team: German (http://www.transifex.com/projects/p/octoprint/language/de/)\n" @@ -1536,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 \"Using Release Channels\" before switching to a release channel other than \"Stable\"" -msgstr "Stelle sicher, dass du \"Using Release Channels\" gelesen hast, bevor du einen anderen Release Channel als \"Stable\" auswählst." +msgid "Make sure you have read \"How to use the release channels to help test release candidates\" before switching to a release channel other than \"Stable\"" +msgstr "Stelle sicher, dass du \"How to use the release channels to help test release candidates\" 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" diff --git a/src/octoprint/util/__init__.py b/src/octoprint/util/__init__.py index 892a31782..7a2467044 100644 --- a/src/octoprint/util/__init__.py +++ b/src/octoprint/util/__init__.py @@ -979,7 +979,7 @@ def thaw_frozendict(obj): # only true love can thaw a frozen dict letitgo = dict() for key, value in obj.items(): - if isinstance(value, frozendict.frozendict): + if isinstance(value, (dict, frozendict.frozendict)): letitgo[key] = thaw_frozendict(value) else: letitgo[key] = copy.deepcopy(value) diff --git a/src/octoprint/util/comm.py b/src/octoprint/util/comm.py index 6638be7d8..060ee607f 100644 --- a/src/octoprint/util/comm.py +++ b/src/octoprint/util/comm.py @@ -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 @@ -1633,7 +1630,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() @@ -2060,9 +2057,10 @@ class MachineCom(object): self._trigger_error(error_text, "autodetect_baudrate") 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): diff --git a/tests/util/test_misc.py b/tests/util/test_misc.py index f07b087f4..b0bd8b98d 100644 --- a/tests/util/test_misc.py +++ b/tests/util/test_misc.py @@ -52,6 +52,7 @@ class MiscTestCase(unittest.TestCase): (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): diff --git a/translations/de/LC_MESSAGES/messages.mo b/translations/de/LC_MESSAGES/messages.mo index f4be601cd..c47cb5b84 100644 Binary files a/translations/de/LC_MESSAGES/messages.mo and b/translations/de/LC_MESSAGES/messages.mo differ diff --git a/translations/de/LC_MESSAGES/messages.po b/translations/de/LC_MESSAGES/messages.po index 84c35566a..e3db810a4 100644 --- a/translations/de/LC_MESSAGES/messages.po +++ b/translations/de/LC_MESSAGES/messages.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: OctoPrint\n" "Report-Msgid-Bugs-To: i18n@octoprint.org\n" -"POT-Creation-Date: 2018-03-23 15:23+0100\n" -"PO-Revision-Date: 2018-03-23 15:25+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 \n" "Language: de\n" "Language-Team: German (http://www.transifex.com/projects/p/octoprint/language/de/)\n" @@ -1536,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 \"Using Release Channels\" before switching to a release channel other than \"Stable\"" -msgstr "Stelle sicher, dass du \"Using Release Channels\" gelesen hast, bevor du einen anderen Release Channel als \"Stable\" auswählst." +msgid "Make sure you have read \"How to use the release channels to help test release candidates\" before switching to a release channel other than \"Stable\"" +msgstr "Stelle sicher, dass du \"How to use the release channels to help test release candidates\" 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" diff --git a/translations/messages.pot b/translations/messages.pot index dc10155d3..5709bddc2 100644 --- a/translations/messages.pot +++ b/translations/messages.pot @@ -6,9 +6,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: OctoPrint 1.3.7rc2.dev16+g47267abcd.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-23 15:23+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 \n" "Language-Team: LANGUAGE \n" @@ -1709,8 +1709,9 @@ msgstr "" #, python-format msgid "" "Make sure you have read \"Using Release Channels\" before " -"switching to a release channel other than \"Stable\"" +"rel=\"noreferrer noopener\">\"How to use the release channels to help " +"test release candidates\" before switching to a release channel other" +" than \"Stable\"" msgstr "" #: src/octoprint/plugins/softwareupdate/templates/snippets/plugins/softwareupdate/versionTracking.jinja2:2