Skip to content

Commit

Permalink
3.1.2rc9 (#11)
Browse files Browse the repository at this point in the history
* add Blueprint mixin for checking printer state to determine if it's safe to reboot the pi or not
  • Loading branch information
jneilliii authored Dec 23, 2021
1 parent 5a639f7 commit dca9138
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
13 changes: 12 additions & 1 deletion octoprint_simplyprint/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class SimplyPrint(
octoprint.plugin.AssetPlugin,
octoprint.plugin.EventHandlerPlugin,
octoprint.plugin.ShutdownPlugin,
octoprint.plugin.BlueprintPlugin,
):
_files_analyzed = []

Expand Down Expand Up @@ -258,6 +259,16 @@ def on_api_get(self, request):
except:
pass

# Blueprint mixin
@octoprint.plugin.BlueprintPlugin.route("/can_reboot", methods=["GET"])
def can_reboot_route(self):
can_reboot = self._printer.get_state_id() not in ["PRINTING", "PAUSED", "PAUSING"]
self._logger.debug("Is it ok to reboot? {}".format(can_reboot))
return flask.jsonify({"can_reboot": can_reboot})

def is_blueprint_protected(self):
return False

# EventHandler mixin
def on_event(self, event, payload):
if event in SIMPLYPRINT_EVENTS:
Expand Down Expand Up @@ -336,7 +347,7 @@ def get_update_information(self):
that will continue to run if you disable it.
"""
# Remember to bump the version in setup.py as well
__plugin_version__ = "3.1.2rc8"
__plugin_version__ = "3.1.2rc9"


def __plugin_load__():
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@

# The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module
# Remember to bump the version in octoprint_simplyprint/__init__.py as well

plugin_version = "3.1.2rc8"
plugin_version = "3.1.2rc9"

# The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin
# module
Expand Down

0 comments on commit dca9138

Please sign in to comment.