Skip to content

Commit

Permalink
New Verison 1.7.0
Browse files Browse the repository at this point in the history
- MR #15 inform external ui (like OctoDash) about filament change. Credit goes to @gdombiak
- MR #28 creating and selecting a spool via API. Credit goes to @oschwartz10612
  • Loading branch information
OllisGit committed Jan 28, 2021
1 parent ac7fa66 commit 2c56c03
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions octoprint_filamentmanager/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@

class FilamentManagerApi(octoprint.plugin.BlueprintPlugin):

def send_client_message(self, message_type, data=None):
self._plugin_manager.send_plugin_message(self._identifier, dict(type=message_type, data=data))

@octoprint.plugin.BlueprintPlugin.route("/profiles", methods=["GET"])
def get_profiles_list(self):
force = request.values.get("force", "false") in valid_boolean_trues
Expand Down Expand Up @@ -247,6 +244,10 @@ def create_spool(self):
try:
if (self.filamentManager != None):
saved_spool = self.filamentManager.create_spool(new_spool)
if ("updateui" in json_data):
update = json_data["updateui"]
if update == True:
self.send_client_message("data_changed", data=dict(table="spools", action="update"))
else:
self._logger.warn("self.filamentManager is not initialized yet")
return
Expand Down Expand Up @@ -362,6 +363,11 @@ def update_selection(self, identifier):
saved_selection = self.filamentManager.update_selection(identifier, self.client_id, selection)
# Inform (external e.g. OctoPod) UI about spool selection change
self.send_client_message("selection_changed", data=dict(table="selections", action="update"))
if ("updateui" in json_data["selection"]):
update = json_data["selection"]["updateui"]
if update == True:
self.send_client_message("data_changed", data=dict(table="spools", action="update"))

else:
self._logger.warn("self.filamentManager is not initialized yet")
return
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
plugin_identifier = "filamentmanager"
plugin_package = "octoprint_filamentmanager"
plugin_name = "OctoPrint-FilamentManager"
plugin_version = "1.6.3"
plugin_version = "1.7.0"
plugin_description = "Manage your spools and keep track of remaining filament on them"
plugin_author = "Sven Lohrmann, Olli"
plugin_author_email = "ollisgit@gmail.com, malnvenshorn@gmail.com"
Expand Down

0 comments on commit 2c56c03

Please sign in to comment.