diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index e0816d0f9..1e4093eae 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -1,9 +1,9 @@ -name: Bug report -about: Create a report to help improve OctoPrint +name: 🐛 Report a bug +about: Create a bug report to help improve OctoPrint title: "" issue_body: true -inputs: - - type: description +body: + - type: markdown attributes: value: > **Thank you for wanting to report a bug in OctoPrint!** @@ -35,7 +35,6 @@ inputs: - type: textarea attributes: label: The problem - required: true description: >- Describe the issue you are experiencing here. Tell us what you were trying to do step by step, and what happened that you did not expect. @@ -46,6 +45,8 @@ inputs: 1. ... 2. ... 3. ... + validations: + required: true - type: dropdown attributes: label: Did the issue persist even in safe mode? @@ -53,10 +54,11 @@ inputs: Testing in safe mode is required to make sure the issue you are reporting is not caused by a third party plugin. Please see [here](https://docs.octoprint.org/en/master/features/safemode.html) on how to run OctoPrint in safe mode. - choices: + options: - Yes, it did persist - No, it did not persist (it's an issue with one of your installed plugins, don't report here) - I cannot test this issue in safe mode (state why below) + validations: required: true - type: input attributes: @@ -69,7 +71,7 @@ inputs: enable it" as you can find info on that [here](https://docs.octoprint.org/en/master/features/safemode.html). If you really *cannot* test in safe mode, leave a short explanation as to why. - - type: description + - type: markdown attributes: value: | ## Environment @@ -77,6 +79,7 @@ inputs: attributes: label: Version of OctoPrint description: Can be found in the lower left corner of the web interface. + validations: required: true - type: input attributes: @@ -85,6 +88,7 @@ inputs: OctoPi, Linux, Windows, MacOS, something else? With version please? OctoPi's version can be found in `/etc/octopi_version` or in the lower left corner of the web interface. + validations: required: true - type: input attributes: @@ -94,11 +98,11 @@ inputs: attributes: label: Browser and version of browser, operating system running browser description: If applicable, always include if unsure - - type: description + - type: markdown attributes: value: | ## Logs and other files needed for analysis - - type: description + - type: markdown attributes: value: >- Please also be sure to upload the following files below: @@ -119,14 +123,14 @@ inputs: - type: checkboxes attributes: label: Checklist of files to include below - choices: + options: - label: octoprint.log required: true - label: serial.log or contents of your terminal tab (always include in cases of issues with printer communication) - label: Contents of the JavaScript browser console (always include in cases of issues with the user interface) - label: Screenshots and/or videos showing the problem (always include in case of issues with the user interface) - label: GCODE file with which to reproduce (always include in case of issues with GCODE analysis or printing behaviour) - - type: description + - type: markdown attributes: value: | ## Additional information & file uploads diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index eb9fb4bd9..ed748bff5 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,4 +1,7 @@ contact_links: - - name: Have questions or need support? + - name: 🤔 Have questions or need support? url: https://community.octoprint.org - about: Please get in touch on the OctoPrint Community Forum! + about: Please get in touch on the OctoPrint Community Forums! + - name: 💸 Want to donate? + url: https://support.octoprint.org + about: Please take a look at the various options to support OctoPrint's development financially! diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index cd4966224..000000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: '[Request]' - ---- - - - -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] - -**Describe the solution you'd like** -A clear and concise description of what you want to happen. - -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - -**Additional context** -Add any other context or screenshots about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 000000000..f054080f7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,37 @@ +name: ✨ Request a feature +about: Request a new feature to implement in OctoPrint +title: "[Request]" +issue_body: true +body: + - type: markdown + attributes: + value: > + **Thank you for wanting to request a feature in OctoPrint!** + + + Before you go ahead with your request, please first consider if it wouldn't be + better suited for a plugin. As a general rule of thumb, any feature that is only + of interest to a small sub group should be moved into a plugin. Only such features + that are of interest to a majority of OctoPrint's users will be implemented as + part of the core itself. + + - type: textarea + attributes: + label: Is your feature request related to a problem? Please describe. + description: A clear and concise description of what the problem is. Eg, "I'm always frustrated when [...]". + - type: textarea + attributes: + label: Describe the solution you'd like + description: A clear and concise description of what you want to happen. Explain why it needs to be included in OctoPrint's core and can't become a plugin. + validations: + required: true + - type: textarea + attributes: + label: Describe alternatives you've considered + description: A clear and concise description of any alternative solutions or features you've considered. + - type: markdown + attributes: + value: > + **Additional context** + + Add any other context or screenshots about the feature request here. diff --git a/docs/bundledplugins/gcodeviewer.rst b/docs/bundledplugins/gcodeviewer.rst index 704d04213..b112a22c7 100644 --- a/docs/bundledplugins/gcodeviewer.rst +++ b/docs/bundledplugins/gcodeviewer.rst @@ -27,6 +27,7 @@ The plugin supports the following configuration keys: * ``mobileSizeThreshold``: Whether to also enable tracking on unreleased OctoPrint versions (anything not stable releases or release candidates). Defaults to ``false``. * ``sizeThreshold``: Unique instance identifier, auto generated on first activation + * ``skipUntilThis``: If this string is provided the GCode Viewer will search for this string, and if found, skip all gcode up until this string. This can be used to skip prime nozzle gcode in the preview .. _sec-bundledplugins-gcodeviewer-sourcecode: diff --git a/src/octoprint/plugins/gcodeviewer/__init__.py b/src/octoprint/plugins/gcodeviewer/__init__.py index d7fea0215..505d41dbc 100644 --- a/src/octoprint/plugins/gcodeviewer/__init__.py +++ b/src/octoprint/plugins/gcodeviewer/__init__.py @@ -45,8 +45,9 @@ class GcodeviewerPlugin( def get_settings_defaults(self): return { "mobileSizeThreshold": 2 * 1024 * 1024, # 2MB - "sizeThreshold": 20 * 1024 * 1024, - } # 20MB + "sizeThreshold": 20 * 1024 * 1024, # 20MB + "skipUntilThis": None, + } def get_settings_version(self): return 1 diff --git a/src/octoprint/plugins/gcodeviewer/static/js/gcodeviewer.js b/src/octoprint/plugins/gcodeviewer/static/js/gcodeviewer.js index c462bc1c3..5f194574a 100644 --- a/src/octoprint/plugins/gcodeviewer/static/js/gcodeviewer.js +++ b/src/octoprint/plugins/gcodeviewer/static/js/gcodeviewer.js @@ -475,6 +475,20 @@ $(function () { }; self.showGCodeViewer = function (response, rstatus) { + // Slice of the gcode + var findThis = self.settings.settings.plugins.gcodeviewer.skipUntilThis(); + if (findThis && findThis !== "") { + var indexPos = response.indexOf("\n" + findThis); + // Try windows newlines if not found + if (indexPos === -1) { + indexPos = response.indexOf("\r" + findThis); + } + if (indexPos !== -1) { + // Slice and make sure we comment out any string left back after slicing - so if a user configures something like "G1" we dont end up with a snippet of gcode commands + // Yes it would be prettier to parse it line by line and remove the entire line, that is very slow and uses mem - this way we find the string, and remove it + response = ";" + response.slice(indexPos + findThis.length + 1); + } + } var par = { target: { result: response diff --git a/src/octoprint/plugins/gcodeviewer/templates/gcodeviewer_settings.jinja2 b/src/octoprint/plugins/gcodeviewer/templates/gcodeviewer_settings.jinja2 index f61067956..1520023a1 100644 --- a/src/octoprint/plugins/gcodeviewer/templates/gcodeviewer_settings.jinja2 +++ b/src/octoprint/plugins/gcodeviewer/templates/gcodeviewer_settings.jinja2 @@ -19,4 +19,15 @@ +
+ +
+ +
+
+ + {% trans %}If provided, the GCode Viewer will search for a line beginning with this string. If found, all GCode up to that point will be skipped. This can be used to skip "purge/nozzle wipe" GCode in the viewer. Note the search is case sensitive. Example: ; layer 1{% endtrans %} + +
+
diff --git a/src/octoprint/util/comm.py b/src/octoprint/util/comm.py index c4668419e..154255124 100644 --- a/src/octoprint/util/comm.py +++ b/src/octoprint/util/comm.py @@ -169,7 +169,7 @@ Groups will be as follows: * ``value``: reported position value """ -regex_firmware_splitter = re.compile(r"\s*([A-Z0-9_]+):\s*") +regex_firmware_splitter = re.compile(r"(^|\s+)([A-Z][A-Z0-9_]*):") """Regex to use for splitting M115 responses.""" regex_resend_linenumber = re.compile(r"(N|N:)?(?P%s)" % regex_int_pattern) @@ -6074,6 +6074,10 @@ def parse_firmware_line(line): The result will be a dictionary mapping from the contained keys to the contained values. + Valid keys must only contain A-Z, 0-9 and _ and must start with a letter. See the + unit tests for valid and invalid examples. There sadly is no existing specification + of the key format, but this is the format extracted from real life logs. + Arguments: line (str): the line to parse @@ -6091,7 +6095,7 @@ def parse_firmware_line(line): split_line = regex_firmware_splitter.split(line.strip())[ 1: ] # first entry is empty start of trimmed string - for key, value in chunks(split_line, 2): + for _, key, value in chunks(split_line, 3): result[key] = value.strip() return result diff --git a/tests/settings/test_settings.py b/tests/settings/test_settings.py index d6a4c88ea..1457acb0b 100644 --- a/tests/settings/test_settings.py +++ b/tests/settings/test_settings.py @@ -607,6 +607,9 @@ class TestSettings(unittest.TestCase): basedir, configfile = paths settings = octoprint.settings.Settings() + # Make sure the config files last modified time changes + time.sleep(1.0) + self.assertEqual("0.0.0.0", settings.get(["server", "host"])) # modify yaml file externally diff --git a/tests/util/test_comm_helpers.py b/tests/util/test_comm_helpers.py index 750ee41ed..3082339d1 100644 --- a/tests/util/test_comm_helpers.py +++ b/tests/util/test_comm_helpers.py @@ -373,6 +373,23 @@ class TestCommHelpers(unittest.TestCase): "UUID": "00000000-0000-0000-0000-000000000000", }, ), + # Test firmware name with time created + ( + "FIRMWARE_NAME:Marlin 2.0.7.2 (Nov 27 2020 14:30:11) SOURCE_CODE_URL:https://github.com/MarlinFirmware/Marlin PROTOCOL_VERSION:1.0 MACHINE_TYPE:Ender 5 Pro EXTRUDER_COUNT:1 UUID:cede2a2f-41a2-4748-9b12-c55c62f367ff", + { + "FIRMWARE_NAME": "Marlin 2.0.7.2 (Nov 27 2020 14:30:11)", + "SOURCE_CODE_URL": "https://github.com/MarlinFirmware/Marlin", + "PROTOCOL_VERSION": "1.0", + "MACHINE_TYPE": "Ender 5 Pro", + "EXTRUDER_COUNT": "1", + "UUID": "cede2a2f-41a2-4748-9b12-c55c62f367ff", + }, + ), + # Test that keys beginning with _ or number are ignored + ( + "KEY1:VALUE1 _KEY2:INVALID 123:INVALID 1KEY:INVALID KEY2:VALUE2", + {"KEY1": "VALUE1 _KEY2:INVALID 123:INVALID 1KEY:INVALID", "KEY2": "VALUE2"}, + ), ) @unpack def test_parse_firmware_line(self, line, expected):