diff options
Diffstat (limited to 'klippy/configfile.py')
-rw-r--r-- | klippy/configfile.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/klippy/configfile.py b/klippy/configfile.py index f099b563..b1f7d6d6 100644 --- a/klippy/configfile.py +++ b/klippy/configfile.py @@ -143,6 +143,8 @@ class PrinterConfig: self.printer = printer self.autosave = None self.deprecated = {} + self.runtime_warnings = [] + self.deprecate_warnings = [] self.status_raw_config = {} self.status_save_pending = {} self.status_settings = {} @@ -314,6 +316,11 @@ class PrinterConfig: "======================="] self.printer.set_rollover_info("config", "\n".join(lines)) # Status reporting + def runtime_warning(self, msg): + logging.warn(msg) + res = {'type': 'runtime_warning', 'message': msg} + self.runtime_warnings.append(res) + self.status_warnings = self.runtime_warnings + self.deprecate_warnings def deprecate(self, section, option, value=None, msg=None): self.deprecated[(section, option, value)] = msg def _build_status(self, config): @@ -325,7 +332,7 @@ class PrinterConfig: self.status_settings = {} for (section, option), value in config.access_tracking.items(): self.status_settings.setdefault(section, {})[option] = value - self.status_warnings = [] + self.deprecate_warnings = [] for (section, option, value), msg in self.deprecated.items(): if value is None: res = {'type': 'deprecated_option'} @@ -334,7 +341,8 @@ class PrinterConfig: res['message'] = msg res['section'] = section res['option'] = option - self.status_warnings.append(res) + self.deprecate_warnings.append(res) + self.status_warnings = self.runtime_warnings + self.deprecate_warnings def get_status(self, eventtime): return {'config': self.status_raw_config, 'settings': self.status_settings, |