From e5f58b2c10e7300245457b585a92a6b1e5042b8e Mon Sep 17 00:00:00 2001 From: Toke Stuart Jepsen Date: Fri, 30 Jul 2021 12:35:29 +0100 Subject: [PATCH] Disregard publishing time. --- openpype/plugins/publish/start_timer.py | 15 +++++++++++++++ openpype/plugins/publish/stop_timer.py | 19 +++++++++++++++++++ .../defaults/system_settings/modules.json | 5 +++-- .../schemas/system_schema/schema_modules.json | 5 +++++ 4 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 openpype/plugins/publish/start_timer.py create mode 100644 openpype/plugins/publish/stop_timer.py diff --git a/openpype/plugins/publish/start_timer.py b/openpype/plugins/publish/start_timer.py new file mode 100644 index 00000000000..6312294bf17 --- /dev/null +++ b/openpype/plugins/publish/start_timer.py @@ -0,0 +1,15 @@ +import pyblish.api + +from openpype.api import get_system_settings +from openpype.lib import change_timer_to_current_context + + +class StartTimer(pyblish.api.ContextPlugin): + label = "Start Timer" + order = pyblish.api.IntegratorOrder + 1 + hosts = ["*"] + + def process(self, context): + modules_settings = get_system_settings()["modules"] + if modules_settings["timers_manager"]["disregard_publishing"]: + change_timer_to_current_context() diff --git a/openpype/plugins/publish/stop_timer.py b/openpype/plugins/publish/stop_timer.py new file mode 100644 index 00000000000..81afd163786 --- /dev/null +++ b/openpype/plugins/publish/stop_timer.py @@ -0,0 +1,19 @@ +import os +import requests + +import pyblish.api + +from openpype.api import get_system_settings + + +class StopTimer(pyblish.api.ContextPlugin): + label = "Stop Timer" + order = pyblish.api.ExtractorOrder - 0.5 + hosts = ["*"] + + def process(self, context): + modules_settings = get_system_settings()["modules"] + if modules_settings["timers_manager"]["disregard_publishing"]: + webserver_url = os.environ.get("OPENPYPE_WEBSERVER_URL") + rest_api_url = "{}/timers_manager/stop_timer".format(webserver_url) + requests.post(rest_api_url) diff --git a/openpype/settings/defaults/system_settings/modules.json b/openpype/settings/defaults/system_settings/modules.json index 1b74b4695cd..e6f5096df76 100644 --- a/openpype/settings/defaults/system_settings/modules.json +++ b/openpype/settings/defaults/system_settings/modules.json @@ -128,7 +128,8 @@ "enabled": true, "auto_stop": true, "full_time": 15.0, - "message_time": 0.5 + "message_time": 0.5, + "disregard_publishing": false }, "clockify": { "enabled": false, @@ -171,4 +172,4 @@ "slack": { "enabled": false } -} \ No newline at end of file +} diff --git a/openpype/settings/entities/schemas/system_schema/schema_modules.json b/openpype/settings/entities/schemas/system_schema/schema_modules.json index 7d734ff4fd5..a0f2f626a06 100644 --- a/openpype/settings/entities/schemas/system_schema/schema_modules.json +++ b/openpype/settings/entities/schemas/system_schema/schema_modules.json @@ -60,6 +60,11 @@ "decimal": 2, "key": "message_time", "label": "When dialog will show" + }, + { + "type": "boolean", + "key": "disregard_publishing", + "label": "Disregard Publishing" } ] },