Skip to content

Commit

Permalink
Merge pull request #5 from 6ffm70/6ffm70-patch-1
Browse files Browse the repository at this point in the history
6ffm70 patch 1
  • Loading branch information
Bernhard B authored Oct 21, 2021
2 parents be907d2 + e8979e8 commit 7ce8c6e
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
16 changes: 16 additions & 0 deletions octoprint_signalclirestapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,12 @@ def get_settings_defaults(self):
printfailedevent=True,
printcancelledevent=True,
printpausedevent=True,
filamentchangeevent=True,
printresumedevent=True,
printstartedeventtemplate="OctoPrint@{host}: {filename}: Job started.",
printdoneeventtemplate="OctoPrint@{host}: {filename}: Job complete after {elapsed_time}.",
printpausedeventtemplate="OctoPrint@{host}: {filename}: Job paused!",
filamentchangeeventtemplate="OctoPrint@{host}: Filament change required!",
printfailedeventtemplate="OctoPrint@{host}: {filename}: Job failed after {elapsed_time} ({reason})!",
printcancelledeventtemplate="OctoPrint@{host}: {filename}: Job cancelled after {elapsed_time}!",
printresumedeventtemplate="OctoPrint@{host}: {filename}: Job resumed!",
Expand Down Expand Up @@ -153,6 +155,10 @@ def print_failed_event(self):
def print_paused_event(self):
return self._settings.get_boolean(["printpausedevent"])

@property
def filament_change_event(self):
return self._settings.get_boolean(["filamentchangeevent"])

@property
def print_cancelled_event(self):
return self._settings.get_boolean(["printcancelledevent"])
Expand Down Expand Up @@ -184,6 +190,10 @@ def print_started_event_template(self):
@property
def print_paused_event_template(self):
return self._settings.get(["printpausedeventtemplate"])

@property
def filament_change_event_template(self):
return self._settings.get(["filamentchangeeventtemplate"])

@property
def print_cancelled_event_template(self):
Expand Down Expand Up @@ -308,6 +318,12 @@ def on_event(self, event, payload):
self._create_group_if_not_exists()
message = self.print_paused_event_template.format(**supported_tags)
self._send_message(message)
elif event == "FilamentChange":
if self.enabled and self.filament_change_event:
if self.create_group_for_every_print:
self._create_group_if_not_exists()
message = self.filament_change_event_template.format(**supported_tags)
self._send_message(message)
elif event == "PrintResumed":
if self.enabled and self.print_resumed_event:
if self.create_group_for_every_print:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,25 @@
</form>
<hr/>

<form class="form horizontal">
<div class="control-group">
<div class="control-group" title="{{ _('Filament Change') }}">
<div class="controls">
<label class="checkbox">
<input type="checkbox" data-bind="checked: settings.plugins.signalclirestapi.filamentchangeevent" /> {{ _('Filament Change') }}
</label>
</div>
</div>
<p>Supported Tags: <code>{user}</code>, <code>{host}</code></p>
<div class="control-group" title="{{ _('Body:') }}">
<label class="control-label">{{ _('Body:') }}</label>
<div class="controls">
<input type="text" class="input-block-level" data-bind="value: settings.plugins.signalclirestapi.filamentchangeeventtemplate">
</div>
</div>
</div>
</form>
<hr/>

<form class="form horizontal">
<div class="control-group">
Expand Down

0 comments on commit 7ce8c6e

Please sign in to comment.