From f140dd9d443340aa2b38e246ec6da2d51465fd4f Mon Sep 17 00:00:00 2001 From: Eyal Date: Mon, 8 Jul 2019 21:20:08 -0400 Subject: [PATCH 1/3] Quote arguments in pip install If the argument is not quoted, the shell will interpret the braces. --- docs/development/environment.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/development/environment.rst b/docs/development/environment.rst index 8308712b7..04f9af807 100644 --- a/docs/development/environment.rst +++ b/docs/development/environment.rst @@ -25,7 +25,7 @@ below. ``source venv/Scripts/activate`` (Git Bash under Windows, see below) * Update ``pip`` in the virtual environment: ``pip install --upgrade pip`` * Install OctoPrint in `"editable" mode `_, - including its regular *and* development and plugin development dependencies: ``pip install -e .[develop,plugins]`` + including its regular *and* development and plugin development dependencies: ``pip install -e '.[develop,plugins]'`` When the virtual environment is activated you can then: From 78c2199d89adc510a9fdf060724d7364bc46e97e Mon Sep 17 00:00:00 2001 From: Gaston Dombiak Date: Mon, 12 Aug 2019 20:32:42 -0700 Subject: [PATCH 2/3] Fire PRINTER_PROFILE_MODIFIED when printer profile was modified --- docs/events/index.rst | 14 +++++++++++++- src/octoprint/printer/profile.py | 8 +++++++- src/octoprint/server/api/printer_profiles.py | 3 ++- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/docs/events/index.rst b/docs/events/index.rst index 108cfc20b..87e7c439e 100644 --- a/docs/events/index.rst +++ b/docs/events/index.rst @@ -628,7 +628,7 @@ SlicingProfileAdded * ``profile``: the profile that was added SlicingProfileModified - A new slicing profile was modified. + A slicing profile was modified. Payload: @@ -653,3 +653,15 @@ SettingsUpdated This event may also be triggered if calling code of :py:class:`octoprint.settings.Settings.save` or :py:class:`octoprint.plugin.PluginSettings.save` sets the ``trigger_event`` parameter to ``True``. + +.. _sec-events-available_events-printer_profile: + +Printer Profile +-------- + +PrinterProfileModified + A printer profile was modified. + + Payload: + + * ``identifier``: the identifier of the modified printer profile diff --git a/src/octoprint/printer/profile.py b/src/octoprint/printer/profile.py index b846f1e20..293b7b231 100644 --- a/src/octoprint/printer/profile.py +++ b/src/octoprint/printer/profile.py @@ -326,7 +326,7 @@ class PrinterProfileManager(object): return False return self._remove_from_path(self._get_profile_path(identifier)) - def save(self, profile, allow_overwrite=False, make_default=False): + def save(self, profile, allow_overwrite=False, make_default=False, trigger_event=False): if "id" in profile: identifier = profile["id"] elif "name" in profile: @@ -349,6 +349,12 @@ class PrinterProfileManager(object): if self._current is not None and self._current["id"] == identifier: self.select(identifier) + + from octoprint.events import eventManager, Events + if trigger_event: + payload = dict(identifier=identifier) + eventManager().fire(Events.PRINTER_PROFILE_MODIFIED, payload=payload) + return self.get(identifier) def is_default_unmodified(self): diff --git a/src/octoprint/server/api/printer_profiles.py b/src/octoprint/server/api/printer_profiles.py index 5e4933309..0b390146e 100644 --- a/src/octoprint/server/api/printer_profiles.py +++ b/src/octoprint/server/api/printer_profiles.py @@ -146,7 +146,8 @@ def printerProfilesUpdate(identifier): merged_profile["id"] = identifier try: - saved_profile = printerProfileManager.save(merged_profile, allow_overwrite=True, make_default=make_default) + saved_profile = printerProfileManager.save(merged_profile, allow_overwrite=True, make_default=make_default, + trigger_event=True) except InvalidProfileError: return make_response("Profile is invalid", 400) except CouldNotOverwriteError: From 9c748a85b44bca880d0f30f97d2f9c5128b7fc13 Mon Sep 17 00:00:00 2001 From: Gaston Dombiak Date: Mon, 12 Aug 2019 20:40:17 -0700 Subject: [PATCH 3/3] removed ' to march master --- docs/development/environment.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/development/environment.rst b/docs/development/environment.rst index 04f9af807..8308712b7 100644 --- a/docs/development/environment.rst +++ b/docs/development/environment.rst @@ -25,7 +25,7 @@ below. ``source venv/Scripts/activate`` (Git Bash under Windows, see below) * Update ``pip`` in the virtual environment: ``pip install --upgrade pip`` * Install OctoPrint in `"editable" mode `_, - including its regular *and* development and plugin development dependencies: ``pip install -e '.[develop,plugins]'`` + including its regular *and* development and plugin development dependencies: ``pip install -e .[develop,plugins]`` When the virtual environment is activated you can then: