Skip to content

Commit

Permalink
✨ Show 'Printer locked' message
Browse files Browse the repository at this point in the history
Closes #50
  • Loading branch information
cp2004 committed Nov 13, 2021
1 parent 9f9e8aa commit 73f400a
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 2 deletions.
6 changes: 6 additions & 0 deletions octoprint_eeprom_marlin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,12 @@ def comm_protocol_gcode_received(self, comm, line, *args, **kwargs):
self.collecting_eeprom = False
self.collecting_stats = False

elif "printer locked" in line.lower():
self._logger.info("Printer locked, aborting data collection")
self.send_message("locked", {})
self.collecting_eeprom = False
self.collecting_stats = False

if self.collecting_eeprom:
parsed = self._parser.parse_eeprom_data(line)
if parsed:
Expand Down
3 changes: 3 additions & 0 deletions octoprint_eeprom_marlin/static/css/eeprom_marlin.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion octoprint_eeprom_marlin/static/css/eeprom_marlin.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions octoprint_eeprom_marlin/static/js/eeprom_marlin.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,9 @@ $(function () {
self.initialLoad = ko.observable(true);
self.saving = ko.observable(false);
self.unsaved = ko.observable(false);

self.printer_locked = ko.observable(false);

self.enable_fields = ko.pureComputed(function () {
return (
!self.loading() &&
Expand Down Expand Up @@ -455,6 +458,11 @@ $(function () {
self.info_from_json(data.data);
self.stats_from_json(data.data.stats);
self.loading(false);
self.printer_locked(false);
}
if (data.type === "locked") {
self.loading(false);
self.printer_locked(true);
}
};

Expand Down
6 changes: 6 additions & 0 deletions octoprint_eeprom_marlin/static/scss/eeprom_marlin.scss
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,12 @@ $touchUI_icon: "\f14b";
.eeprom-checkbox {
margin-top: -3px;
}

.eeprom-locked {
p {
text-align: center;
}
}
}

#plugin_eeprom_marlin_backup_upload {
Expand Down
13 changes: 13 additions & 0 deletions octoprint_eeprom_marlin/templates/alerts/printer_locked.jinja2
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<div class="alert alert-block eeprom-locked" data-bind="visible: printer_locked">
<p>
<i class="fas fa-2x fa-lock"></i>
</p>
<p>
<strong>
{{ _("Looks like the printer is locked") }}
</strong>
</p>
<p>
{{ _("Unlock the printer to use the EEPROM editor") }}
</p>
</div>
1 change: 1 addition & 0 deletions octoprint_eeprom_marlin/templates/eeprom_marlin_tab.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
<div class="row-fluid eeprom-alerts">
<div class="span12">
{% include "alerts/printer.jinja2" %}
{% include "alerts/printer_locked.jinja2" %}
</div>
</div>
<div id="eeprom_tab_data" class="collapse in" data-bind="visible: !initialLoad() && info.is_marlin() && info.name().length > 0">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
</strong>
</p>
<p>
{{ ("Connect to the printer to edit it's configuration.") }}
{{ _("Connect to the printer to edit it's configuration.") }}
</p>
</div>

0 comments on commit 73f400a

Please sign in to comment.