diff --git a/docs/events/index.rst b/docs/events/index.rst index 5407a4935..71a55d68e 100644 --- a/docs/events/index.rst +++ b/docs/events/index.rst @@ -539,7 +539,7 @@ PrintResumed .. versionchanged:: 1.4.0 -${ScriptName}Running +GcodeScript${ScriptName}Running A custom :ref:`GCODE script ` 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 ` 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: diff --git a/docs/features/gcode_scripts.rst b/docs/features/gcode_scripts.rst index a1c0d6167..d836d3fad 100644 --- a/docs/features/gcode_scripts.rst +++ b/docs/features/gcode_scripts.rst @@ -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 ` 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 ` documentation. .. _sec-features-gcode_scripts-snippets: diff --git a/src/octoprint/printer/standard.py b/src/octoprint/printer/standard.py index 2adb0c0cb..d971c0128 100644 --- a/src/octoprint/printer/standard.py +++ b/src/octoprint/printer/standard.py @@ -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):