fix name scheme for gcode script events

This commit is contained in:
Levi Blaney authored and Gina Häußge committed 2021-01-18 16:47:06 +01:00
1 parent cd9aab7eef
commit 2474653a7f
3 files changed
+12 -9

No files matched your search

+4 -4
View File
@@ -539,7 +539,7 @@ PrintResumed
.. versionchanged:: 1.4.0
${ScriptName}Running
GcodeScript${ScriptName}Running
A custom :ref:`GCODE script <sec-features-gcode_scripts>` has started running.
Payload:
@@ -551,9 +551,9 @@ ${ScriptName}Running
* ``owner``: the user who started the print job (if available)
* ``time``: the time needed for the print, in seconds (float)
.. versionadded:: X.X.X
.. versionadded:: 1.6.0
${ScriptName}Finished
GcodeScript${ScriptName}Finished
A custom :ref:`GCODE script <sec-features-gcode_scripts>` has finished running.
Payload:
@@ -565,7 +565,7 @@ ${ScriptName}Finished
* ``owner``: the user who started the print job (if available)
* ``time``: the time needed for the print, in seconds (float)
.. versionadded:: X.X.X
.. versionadded:: 1.6.0
.. _sec-events-available_events-gcode_processing:
+3 -3
View File
@@ -48,9 +48,9 @@ The following GCODE scripts are sent by OctoPrint automatically:
Events
------
Every GCODE script that is executed will emit two events. The events will start with the capitalized name of the script.
When ``afterPrintDone`` has started the event will be ``AfterPrintDoneRunning`` and once it has completed the last event
will be ``AfterPrintDoneFinished``. You can find more details in the :ref:`Events <sec-events-available_events-printing>` documentation.
Every GCODE script that is executed will emit two events. The event name will start with 'GcodeScript' followed by the capitalized name
of the script. When ``afterPrintDone`` has started the event will be ``GcodeScriptAfterPrintDoneRunning`` and once it has completed the last event
will be ``GcodeScriptAfterPrintDoneFinished``. You can find more details in the :ref:`Events <sec-events-available_events-printing>` documentation.
.. _sec-features-gcode_scripts-snippets:
+5 -2
View File
@@ -444,8 +444,11 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
if name is None or not name:
raise ValueError("name must be set")
# .capitalize() will lowercase all letters but the first
# this code preserves existing CamelCase
event_name = name[0].upper() + name[1:]
event_start = "{}{}".format(event_name, "GcodeRunning")
event_start = "GcodeScript{}Running".format(event_name)
payload = context.get("event", None) if isinstance(context, dict) else None
eventManager().fire(event_start, payload)
@@ -459,7 +462,7 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
if not result and must_be_set:
raise UnknownScript(name)
event_end = "{}{}".format(event_name, "GcodeFinished")
event_end = "GcodeScript{}Finished".format(event_name)
eventManager().fire(event_end, payload)
def jog(self, axes, relative=True, speed=None, *args, **kwargs):