From 5fc22593f945e357a7db6ee0f68d2bf77bae608c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 11 Aug 2021 15:08:45 +0200 Subject: [PATCH 01/11] =?UTF-8?q?=F0=9F=90=9B=20swu:=20Remove=20active=20c?= =?UTF-8?q?lass?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #4207 --- .../softwareupdate/templates/softwareupdate_settings.jinja2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/octoprint/plugins/softwareupdate/templates/softwareupdate_settings.jinja2 b/src/octoprint/plugins/softwareupdate/templates/softwareupdate_settings.jinja2 index a995fe21c..40deec7bd 100644 --- a/src/octoprint/plugins/softwareupdate/templates/softwareupdate_settings.jinja2 +++ b/src/octoprint/plugins/softwareupdate/templates/softwareupdate_settings.jinja2 @@ -128,7 +128,7 @@ -
+

{{ _('Update log') }}

From 4bdf904eeb45fa052ce45901a3771a3892780f45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 9 Sep 2021 11:41:39 +0200 Subject: [PATCH 02/11] =?UTF-8?q?=E2=AC=87=EF=B8=8F=20Keep=20unidecode=20=1.0.7,<2", "zipstream-new>=1.1.8,<1.2", # vendor bundled dependencies - "unidecode", # dependency of awesome-slugify, leave w/o range to not cause dependency hell w/ Octolapse deps "blinker>=1.4,<2", # dependency of flask_principal ] @@ -78,6 +77,8 @@ INSTALL_REQUIRES_PYTHON2 = [ "enum34>=1.1.10,<1.2", "frozendict==1.2", # newer versions from different maintainer require Python 3 "colorlog<5", # newer versions require Python 3 + # vendor bundled dependencies + "unidecode<1.3", # dependency of awesome-slugify, newer versions require Python 3 ] # Python 3 specific requirements @@ -88,6 +89,8 @@ INSTALL_REQUIRES_PYTHON3 = [ "immutabledict>=2.1,<3", "pathvalidate>=2.4.1,<3", "colorlog>=5.0.1,<6", + # vendor bundled dependencies + "unidecode", # dependency of awesome-slugify, leave w/o range to not cause dependency hell w/ Octolapse deps ] # OSX specific requirements From 0bba8be6dce5d85f7d772b838febbe332f50185a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 9 Sep 2021 12:22:30 +0200 Subject: [PATCH 03/11] =?UTF-8?q?=F0=9F=90=9B=20Convert=20showProgressDial?= =?UTF-8?q?og=20to=20#4105=20changes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #4210 --- src/octoprint/static/js/app/helpers.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/octoprint/static/js/app/helpers.js b/src/octoprint/static/js/app/helpers.js index 3c7de9d76..ef6ac98e8 100644 --- a/src/octoprint/static/js/app/helpers.js +++ b/src/octoprint/static/js/app/helpers.js @@ -1060,18 +1060,14 @@ function showProgressModal(options, promise) { var progress = $('
'); var progressBar = $('
').addClass(barClassSuccess); - var progressTextBack = $(''); - var progressTextFront = $('').width( - progress.width() - ); + var progressText = $(''); if (max === undefined) { progress.addClass("progress-striped active"); progressBar.width("100%"); } - progressBar.append(progressTextFront); - progress.append(progressTextBack).append(progressBar); + progress.append(progressBar).append(progressText); var button = $('") .prop("disabled", true) @@ -1127,9 +1123,16 @@ function showProgressModal(options, promise) { // update progress bar progressBar.width(String(value) + "%"); - progressTextFront.text(short); - progressTextBack.text(short); - progressTextFront.width(progress.width()); + progressText.text(short); + if (value < 50 && progressText.hasClass("progress-text-front")) { + progressText + .removeClass("progress-text-front") + .addClass("progress-text-back"); + } else if (value >= 50 && progressText.hasClass("progress-text-back")) { + progressText + .removeClass("progress-text-back") + .addClass("progress-text-front"); + } // if not successful, apply failure class if (!success && !progressBar.hasClass(barClassFailure)) { From 18c3e6660fd97da30cec84abfd9e8bf5ac48ce2d Mon Sep 17 00:00:00 2001 From: Charlie Powell <31997505+cp2004@users.noreply.github.com> Date: Tue, 17 Aug 2021 15:32:39 +0100 Subject: [PATCH 04/11] :bug: Remove CSS `width: auto` on announcements dialog, breaks things This makes the width of the modal really narrow when it is first opened & on certain screen sizes, removing this line appears to fix the issues. Closes #4216 --- src/octoprint/plugins/announcements/static/js/announcements.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/octoprint/plugins/announcements/static/js/announcements.js b/src/octoprint/plugins/announcements/static/js/announcements.js index 75720f39a..dccf4e953 100644 --- a/src/octoprint/plugins/announcements/static/js/announcements.js +++ b/src/octoprint/plugins/announcements/static/js/announcements.js @@ -209,7 +209,6 @@ $(function () { } }) .css({ - "width": "auto", "margin-left": function () { return -($(this).width() / 2); } From 0e1ada7a0e8445a86da329ebd222fa03020c6e90 Mon Sep 17 00:00:00 2001 From: Charlie Powell <31997505+cp2004@users.noreply.github.com> Date: Tue, 10 Aug 2021 20:49:50 +0100 Subject: [PATCH 05/11] :pencil2: Add missing tool change scripts documentation --- docs/features/gcode_scripts.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/features/gcode_scripts.rst b/docs/features/gcode_scripts.rst index a15cc7f79..aa8fb1329 100644 --- a/docs/features/gcode_scripts.rst +++ b/docs/features/gcode_scripts.rst @@ -38,6 +38,8 @@ The following GCODE scripts are sent by OctoPrint automatically: * ``afterPrintDone``: Sent just after a print job finished. Defaults to an empty script. * ``afterPrintPaused``: Sent just after a print job was paused. Defaults to an empty script. * ``beforePrintResumed``: Sent just before a print job is resumed. Defaults to an empty script. + * ``beforeToolChange``: Sent just before a tool change command (``Tn``) is issued. + * ``afterToolChange``: Sent just after a tool change command (``Tn``) is issued .. note:: @@ -108,6 +110,11 @@ There are a few additional template variables available for the following specif * ``cancel_temperature``: Last known temperature values when the print was cancelled. See ``last_temperature`` above for the structure to expect here. + * ``beforeToolChange`` and ``afterToolChange`` + + * ``tool.old``: The number of the previous tool + * ``tool.new``: The number of the new tool + .. warning:: From 9c072d6440269e46b754ff988fe10f4656cad39b Mon Sep 17 00:00:00 2001 From: Flaviu Tamas Date: Mon, 6 Sep 2021 15:03:51 -0400 Subject: [PATCH 06/11] Replace multiple globs with single regex The existing code lists the directory contents 7 times. This usually isn't a big deal, but I'm running Octoprint on a really slow ARM board, so this ends up taking 123ms (coming out to 17ms per call). We can speed this up a lot by only listing the files once, and searching through them. With this change, this function is fast enough that it doesn't show up in the profiler --- src/octoprint/util/comm.py | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/src/octoprint/util/comm.py b/src/octoprint/util/comm.py index 694d180a0..c4f0f5d6e 100644 --- a/src/octoprint/util/comm.py +++ b/src/octoprint/util/comm.py @@ -188,6 +188,25 @@ regex_firmware_splitter = re.compile(r"(^|\s+)([A-Z][A-Z0-9_]*):") regex_resend_linenumber = re.compile(r"(N|N:)?(?P%s)" % regex_int_pattern) """Regex to use for request line numbers in resend requests""" +regex_serial_devices = re.compile(r"^(?:ttyUSB|ttyACM|tty\.usb|cu\.|cuaU|ttyS|rfcomm).*") +"""Regex used to filter out valid tty devices""" + + +def _searchFiles(directory, pattern): + """ + Searches the directory for files matching the regex pattern + + We could use glob, but that might require multiple glob executions (and + multiple directory file listings), which can end up being slow on the + low-end devices we support. + """ + result = [] + with os.scandir(directory) as it: + for entry in it: + if pattern.match(entry.name): + result.append(entry.path) + return result + def serialList(): if os.name == "nt": @@ -204,15 +223,7 @@ def serialList(): pass else: - candidates = ( - glob.glob("/dev/ttyUSB*") - + glob.glob("/dev/ttyACM*") - + glob.glob("/dev/tty.usb*") - + glob.glob("/dev/cu.*") - + glob.glob("/dev/cuaU*") - + glob.glob("/dev/ttyS*") - + glob.glob("/dev/rfcomm*") - ) + candidates = _searchFiles("/dev", regex_serial_devices) # additional ports additionalPorts = settings().get(["serial", "additionalPorts"]) From 01855da9158495c1240ba28d5a81f9f26472c81e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 9 Sep 2021 16:13:31 +0200 Subject: [PATCH 07/11] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Make=20py2=20compati?= =?UTF-8?q?ble=20&=20internalize=20search?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We only use the search in one single place, it's not part of an external API and three lines only. It makes sense to internalize it into serialList. Also, python 2 doesn't yet have os.scandir, so use the fallback implementation in that case. --- src/octoprint/util/comm.py | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/src/octoprint/util/comm.py b/src/octoprint/util/comm.py index c4f0f5d6e..eb1e909f3 100644 --- a/src/octoprint/util/comm.py +++ b/src/octoprint/util/comm.py @@ -24,6 +24,11 @@ try: except ImportError: import Queue as queue +try: + from os import scandir +except ImportError: + from scandir import scandir + import logging from collections import deque @@ -192,22 +197,6 @@ regex_serial_devices = re.compile(r"^(?:ttyUSB|ttyACM|tty\.usb|cu\.|cuaU|ttyS|rf """Regex used to filter out valid tty devices""" -def _searchFiles(directory, pattern): - """ - Searches the directory for files matching the regex pattern - - We could use glob, but that might require multiple glob executions (and - multiple directory file listings), which can end up being slow on the - low-end devices we support. - """ - result = [] - with os.scandir(directory) as it: - for entry in it: - if pattern.match(entry.name): - result.append(entry.path) - return result - - def serialList(): if os.name == "nt": candidates = [] @@ -223,7 +212,11 @@ def serialList(): pass else: - candidates = _searchFiles("/dev", regex_serial_devices) + candidates = [] + with scandir("/dev") as it: + for entry in it: + if regex_serial_devices.match(entry.name): + candidates.append(entry.path) # additional ports additionalPorts = settings().get(["serial", "additionalPorts"]) From 53d73182dee834a7aa19b0a5f405e7a6c05cd061 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Mon, 13 Sep 2021 09:42:23 +0200 Subject: [PATCH 08/11] =?UTF-8?q?=F0=9F=90=9B=20Set=20autocapitalize=3Dnon?= =?UTF-8?q?e=20on=20login=20form?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #4226 --- src/octoprint/templates/login.jinja2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/octoprint/templates/login.jinja2 b/src/octoprint/templates/login.jinja2 index 175738b6b..a7744ff96 100644 --- a/src/octoprint/templates/login.jinja2 +++ b/src/octoprint/templates/login.jinja2 @@ -50,7 +50,7 @@ {{ _('An account with the following permissions is required:') }} {{ permission_names|join(", ") }}

{% endif %} - + {{ _('Forgot password?') }}