diff --git a/.versioneer-lookup b/.versioneer-lookup index 28de35100..4a56f141b 100644 --- a/.versioneer-lookup +++ b/.versioneer-lookup @@ -29,10 +29,10 @@ improve/.* 1.9.0 fa2c4680cca0d1d6b46e6c1ed68ceea4d9b79afb pep440-dev staging/bugfix 1.7.4 59cbfadf8922d85b9df40f8d0173e8c21724c3b8 pep440-dev bug/.* 1.7.4 59cbfadf8922d85b9df40f8d0173e8c21724c3b8 pep440-dev -# staging/maintenance is currently the branch for preparation of 1.8.0rc4 +# staging/maintenance is currently the branch for preparation of 1.8.0rc6 # so is regressionfix/... -staging/maintenance 1.8.0rc5 c5b095a8b905d759c84acab5e8a65ed3170d124c pep440-dev -regressionfix/.* 1.8.0rc5 c5b095a8b905d759c84acab5e8a65ed3170d124c pep440-dev +staging/maintenance 1.8.0rc6 45598764e6c7f6257de87a98d15964209ddc9e09 pep440-dev +regressionfix/.* 1.8.0rc6 45598764e6c7f6257de87a98d15964209ddc9e09 pep440-dev # staging/devel is currently inactive (but has the 1.4.1rc4 namespace) staging/devel 1.4.1rc4 650d54d1885409fa1d411eb54b9e8c7ff428910f pep440-dev diff --git a/docs/features/custom_controls.rst b/docs/features/custom_controls.rst index 977567a2c..5b88f7c88 100644 --- a/docs/features/custom_controls.rst +++ b/docs/features/custom_controls.rst @@ -44,7 +44,7 @@ a GCODE script including user input. - name: Example for multiple commands children: - name: Move X (static) - confirm: You are about to move the X axis right by 10mm with 3000mm/s. + confirm: You are about to move the X axis right by 10mm with 3000mm/min. commands: - G91 - G1 X10 F3000 diff --git a/setup.py b/setup.py index 5491ca1c1..6a174f76c 100644 --- a/setup.py +++ b/setup.py @@ -42,7 +42,7 @@ core_deps = [ "filetype>=1.0.7,<2", "Flask-Assets>=2.0,<3", "Flask-Babel>=2.0,<3", - "Flask-Login>=0.5,<0.6", # flask-login doesn't use semver & breaks stuff on minor version increases + "Flask-Login>=0.6,<0.7", # breaking changes can happen on minor version increases "flask>=2,<3", "frozendict>=2.0,<3", "future>=0.18.2,<1", # not really needed anymore, but leaving in for py2/3 compat plugins @@ -62,7 +62,7 @@ core_deps = [ "tornado>=6.0.4,<7", "watchdog>=1,<2", "websocket-client>=1.2.1,<2", - "werkzeug>=2.0,<2.1", # breaking changes can happen on minor version increases, flask-login 0.5 is incompatible with 2.1 + "werkzeug>=2.1,<2.2", # breaking changes can happen on minor version increases "wrapt>=1.13.3,<1.14", "zeroconf>=0.33,<0.34", # breaking changes can happen on minor version increases "zipstream-ng>=1.3.4,<2.0.0", diff --git a/src/octoprint/plugins/errortracking/__init__.py b/src/octoprint/plugins/errortracking/__init__.py index e15b1bb57..ad47d8a25 100644 --- a/src/octoprint/plugins/errortracking/__init__.py +++ b/src/octoprint/plugins/errortracking/__init__.py @@ -18,10 +18,10 @@ from octoprint.util.version import ( ) SENTRY_URL_SERVER = ( - "https://b39cd0dcaea5404798ec3eb193b291db@o118517.ingest.sentry.io/1373987" + "https://890bd6bca44a4b7e92918b0ba74049ca@o118517.ingest.sentry.io/1373987" ) SENTRY_URL_COREUI = ( - "https://ab48b21452fe424eaf79468aa6c94bd7@o118517.ingest.sentry.io/1374096" + "https://1f4ba2d14bfc4b1c9a861fde1c1d452d@o118517.ingest.sentry.io/1374096" ) SETTINGS_DEFAULTS = { diff --git a/src/octoprint/printer/profile.py b/src/octoprint/printer/profile.py index 6d9b17889..d7322550b 100644 --- a/src/octoprint/printer/profile.py +++ b/src/octoprint/printer/profile.py @@ -94,7 +94,7 @@ A printer profile is a ``dict`` of the following structure: - Information about the printer's X axis * - ``axes.x.speed`` - ``float`` - - Speed of the X axis in mm/s + - Speed of the X axis in mm/min * - ``axes.x.inverted`` - ``bool`` - Whether a positive value change moves the nozzle away from the print bed's origin (False, default) or towards it (True) @@ -103,7 +103,7 @@ A printer profile is a ``dict`` of the following structure: - Information about the printer's Y axis * - ``axes.y.speed`` - ``float`` - - Speed of the Y axis in mm/s + - Speed of the Y axis in mm/min * - ``axes.y.inverted`` - ``bool`` - Whether a positive value change moves the nozzle away from the print bed's origin (False, default) or towards it (True) @@ -112,7 +112,7 @@ A printer profile is a ``dict`` of the following structure: - Information about the printer's Z axis * - ``axes.z.speed`` - ``float`` - - Speed of the Z axis in mm/s + - Speed of the Z axis in mm/min * - ``axes.z.inverted`` - ``bool`` - Whether a positive value change moves the nozzle away from the print bed (False, default) or towards it (True) @@ -121,7 +121,7 @@ A printer profile is a ``dict`` of the following structure: - Information about the printer's E axis * - ``axes.e.speed`` - ``float`` - - Speed of the E axis in mm/s + - Speed of the E axis in mm/min * - ``axes.e.inverted`` - ``bool`` - Whether a positive value change extrudes (False, default) or retracts (True) filament diff --git a/src/octoprint/server/api/settings.py b/src/octoprint/server/api/settings.py index 82015542d..280816432 100644 --- a/src/octoprint/server/api/settings.py +++ b/src/octoprint/server/api/settings.py @@ -473,6 +473,7 @@ def _saveSettings(data): s.setBaseFolder(folder, future[folder]) except Exception: + logger.exception("Something went wrong while saving a folder path") abort(400, description="At least one of the configured folders is invalid") if "api" in data: diff --git a/src/octoprint/settings.py b/src/octoprint/settings.py index 3b036d406..b54a8391c 100644 --- a/src/octoprint/settings.py +++ b/src/octoprint/settings.py @@ -34,6 +34,7 @@ from yaml import YAMLError from octoprint.util import ( CaseInsensitiveSet, atomic_write, + deprecated, dict_merge, fast_deepcopy, is_hidden_path, @@ -808,7 +809,7 @@ class Settings: serial: port: "/dev/ttyACM0" baudrate: 250000 - timeouts: + timeout: communication: 20.0 temperature: 5.0 sdStatus: 1.0 @@ -861,7 +862,6 @@ class Settings: self._map = HierarchicalChainMap({}, default_settings) self.load_overlays(overlays) - self._config = None self._dirty = False self._dirty_time = 0 self._last_config_hash = None @@ -1120,7 +1120,7 @@ class Settings: @property def config_yaml(self): - return yaml.dump(self._config) + return yaml.dump(self.config) @property def config_hash(self): @@ -1135,10 +1135,28 @@ class Settings: return self._last_config_hash @property - def _config(self): + def config(self): + """ + A view of the local config as stored in config.yaml + + Does not support modifications, they will be thrown away silently. If you need to + modify anything in the settings, utilize the provided set and remove methods. + """ return self._map.top_map + @property + @deprecated( + "Settings._config has been deprecated and is a read-only view. Please use Settings.config or the set & remove methods instead.", + since="1.8.0", + ) + def _config(self): + return self.config + @_config.setter + @deprecated( + "Setting of Settings._config has been deprecated. Please use the set & remove methods instead and get in touch if you have a usecase they don't cover.", + since="1.8.0", + ) def _config(self, value): self._map.top_map = value @@ -1169,11 +1187,14 @@ class Settings: # ~~ load and save def load(self, migrate=False): + config = None + mtime = None + if os.path.exists(self._configfile) and os.path.isfile(self._configfile): with open(self._configfile, encoding="utf-8", errors="replace") as f: try: - self._config = yaml.load_from_file(file=f) - self._mtime = self.last_modified + config = yaml.load_from_file(file=f) + mtime = self.last_modified except YAMLError as e: details = str(e) @@ -1193,8 +1214,11 @@ class Settings: ) # changed from else to handle cases where the file exists, but is empty / 0 bytes - if not self._config or not isinstance(self._config, dict): - self._config = {} + if not config or not isinstance(config, dict): + config = {} + + self._map.top_map = config + self._mtime = mtime if migrate: self._migrate_config() @@ -1288,7 +1312,7 @@ class Settings: def _migrate_config(self, config=None, persist=False): if config is None: - config = self._config + config = self._map.top_map persist = True dirty = False @@ -1310,6 +1334,9 @@ class Settings: dirty = migrate(config) or dirty if dirty and persist: + self._map.top_map = ( + config # we need to write it back here or the changes will be lost + ) self.save(force=True) def _migrate_gcode_scripts(self, config): @@ -1828,7 +1855,7 @@ class Settings: permissions=0o600, max_permissions=0o666, ) as configFile: - yaml.save_to_file(self._config, file=configFile) + yaml.save_to_file(self._map.top_map, file=configFile) self._dirty = False except Exception: self._logger.exception("Error while saving config.yaml!") @@ -2067,10 +2094,7 @@ class Settings: folder = default_folder try: - del self._config["folder"][type] - if not len(self._config["folder"]): - del self._config["folder"] - self._mark_dirty() + self.remove(["folder", type]) self.save() except KeyError: pass @@ -2265,23 +2289,12 @@ class Settings: currentPath = self.getBaseFolder(type) defaultPath = self._get_default_folder(type) - if ( - (path is None or path == defaultPath) - and "folder" in self._config - and type in self._config["folder"] - ): - del self._config["folder"][type] - if not self._config["folder"]: - del self._config["folder"] - self._mark_dirty() + if path is None or path == defaultPath: + self.remove(["folder", type]) elif (path != currentPath and path != defaultPath) or force: if validate: _validate_folder(path, check_writable=True, deep_check_writable=True) - - if "folder" not in self._config: - self._config["folder"] = {} - self._config["folder"][type] = path - self._mark_dirty() + self.set(["folder", type], path, force=force) def saveScript(self, script_type, name, script): script_folder = self.getBaseFolder("scripts") diff --git a/src/octoprint/util/comm.py b/src/octoprint/util/comm.py index efdb79b07..0db07fbf0 100644 --- a/src/octoprint/util/comm.py +++ b/src/octoprint/util/comm.py @@ -6265,6 +6265,10 @@ def parse_temperature_line(line, current): for match in re.finditer(regex_temp, line): values = match.groupdict() sensor = values["sensor"] + if sensor in result: + # sensor already seen, let's not overwrite stuff + continue + toolnum = values.get("toolnum", None) tool_number = int(toolnum) if toolnum is not None and len(toolnum) else None if tool_number and tool_number > max_tool_num: diff --git a/tests/util/test_comm_helpers.py b/tests/util/test_comm_helpers.py index ac600b978..7bcf90386 100644 --- a/tests/util/test_comm_helpers.py +++ b/tests/util/test_comm_helpers.py @@ -330,6 +330,16 @@ class TestCommHelpers(unittest.TestCase): }, 0, ), + ( + # Only first occurrence of a sensor should be used, second B gets ignored + "T:210.04 /210.00 B:52.00 /52.00 @:85 B:1234.0 /1234.0", + 0, + { + "T0": (210.04, 210.0), + "B": (52.00, 52.0), + }, + 0, + ), ) @unpack def test_process_temperature_line(self, line, current, expected_result, expected_max):