Skip to content

Commit

Permalink
Bug fixes, add settings screenshot
Browse files Browse the repository at this point in the history
  • Loading branch information
ieatacid committed Sep 8, 2018
1 parent 5471038 commit 46fdab4
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 14 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ dist
*.egg*
.DS_Store
*.zip
.vscode/
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# OctoPrint-AtCommands

**TODO:** Describe what your plugin does.
Executes system commands/scripts using @commands.

## Setup

Expand All @@ -9,9 +9,7 @@ or manually using this URL:

https://github.com/ieatacid/OctoPrint-AtCommands/archive/master.zip

**TODO:** Describe how to install your plugin, if more needs to be done than just installing it via pip or through
the plugin manager.

## Configuration
## Screenshot

**TODO:** Describe your plugin's configuration options (if any).
![Settings](extras/assets/img/settings.png?raw=true)
Binary file added extras/assets/img/settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 4 additions & 5 deletions octoprint_AtCommands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,12 @@ def atcommand_hook(self, comm, phase, command, parameters, tags=None, *args, **k

if at_cmd["type"] == "system":
self._logger.info("AtCommand '@%s' is type 'system'" % (command))

self._logger.info("Executing system command '%s'" % (at_cmd["command"]))
try:
if len(parameters) > 0:
self._logger.info("Executing system command '%s'" % (at_cmd["command"]))
self._logger.info("...with parameters: %s" % (parameters))
r = subprocess.call([at_cmd["command"], parameters])
else:
self._logger.info("Executing system command '%s'" % (at_cmd["command"]))
r = subprocess.call(at_cmd["command"])
except:
e = sys.exc_info()[0]
Expand All @@ -97,9 +95,10 @@ def atcommand_hook(self, comm, phase, command, parameters, tags=None, *args, **k

self._logger.info("Command '%s' returned: %s" % (command, r))

elif at_cmd["type"] == "octoprint":
self._logger.info("AtCommand '@%s' is type 'octoprint'" % (command))
elif at_cmd["type"] == "gcode":
self._logger.info("AtCommand '@%s' is type 'gcode'" % (command))
self._logger.info("Executing octoprint command '%s'" % (at_cmd["command"]))
self._printer.commands(this_command["command"].split(";"))

else:
self._logger.error("AtCommand type not found or not known for '@%s'" % command)
Expand Down
6 changes: 3 additions & 3 deletions octoprint_AtCommands/templates/AtCommands_settings.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<div class="row-fluid">
<div class="span3"><h4>&#64;name</h4></div>
<div class="span2"><h4>Type</h4></div>
<div class="span5"><h4>Command</h4></div>
<div class="span5"><h4>Command<small><a href="#" data-toggle="tooltip" title="Multiple gcode commands can be&#013;&#010;separated with a semicolon ( ; )">?</a></small></h4></div>
</div>
<div data-bind="foreach: at_commands">
<div class="row-fluid" style="margin-bottom: 5px">
Expand All @@ -23,10 +23,10 @@
<div class="span2" title="System commands are executed by the OctoPrint host, octoprint commands are passed to the OctoPrint server.">
<select class="span12" id=type data-bind="value: type">
<option value="system">system</option>
<option value="octoprint">octoprint</option>
<option value="gcode">gcode</option>
</select>
</div>
<div class="span5" title="The command to execute.">
<div class="span5" title="The command or gcode to execute." >
<input type="text" class="input-block-level" data-bind="value: command">
</div>
<div class="span1">
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
plugin_name = "OctoPrint-AtCommands"

# The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module
plugin_version = "0.1.2"
plugin_version = "0.1.3"

# 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 46fdab4

Please sign in to comment.