Skip to content

Commit

Permalink
fix codesmell
Browse files Browse the repository at this point in the history
and add Changes from Code Review
  • Loading branch information
Josef-MrBeam committed Sep 25, 2023
1 parent db6c1be commit 46452e9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
8 changes: 5 additions & 3 deletions octoprint_mrbeam/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ def get_settings_defaults(self):
)

def on_settings_load(self):
self._send_maintenance_information(trigger="settings_load")
self._send_maintenance_information(trigger=MrBeamEvents.SETTINGS_LOAD)
return dict(
svgDPI=self._settings.get(["svgDPI"]),
dxfScale=self._settings.get(["dxfScale"]),
Expand Down Expand Up @@ -605,7 +605,7 @@ def _get_usage_data_dict(self):
)

def on_airfilter_changed(self, *args, **kwargs):
self._send_maintenance_information(trigger="airfilter_changed")
self._send_maintenance_information(trigger=MrBeamEvents.AIRFILTER_CHANGED)

def _send_maintenance_information(self, trigger=None):
self._plugin_manager.send_plugin_message(
Expand Down Expand Up @@ -697,7 +697,9 @@ def on_settings_save(self, data):

def set_heavy_duty_prefilter(self, value):
if value != self._settings.get(["heavyDutyPrefilter"]):
self._send_maintenance_information(trigger="heavyDutyPrefilter_changed")
self._send_maintenance_information(
trigger=MrBeamEvents.HEAVY_DUTY_PREFILTER_CHANGED
)
self._settings.set_boolean(["heavyDutyPrefilter"], value)

def is_heavy_duty_prefilter_enabled(self):
Expand Down
2 changes: 2 additions & 0 deletions octoprint_mrbeam/mrbeam_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
# NOTICE: This is used by the camera plugin
class MrBeamEvents(object):

HEAVY_DUTY_PREFILTER_CHANGED = "HeavyDutyPrefilterChanged"
SETTINGS_LOAD = "SettingsLoad"
MRB_PLUGIN_INITIALIZED = "MrbPluginInitialized"
BOOT_GRACE_PERIOD_END = "BootGracePeriodEnd"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ $(function () {
return;
}
if ("maintenance_information" in data) {
maintenanceInformation = data.maintenance_information;
const maintenanceInformation = data.maintenance_information;
console.log(
"Maintenance information received",
maintenanceInformation
Expand Down

0 comments on commit 46452e9

Please sign in to comment.