From 4bf91e026f24ddc762cad96598e38f31c30643de Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 12 Aug 2020 15:54:16 +0200 Subject: [PATCH 1/2] allow to enable/disable logs suspending on stard with env variable PYBLISH_SUSPEND_LOGS --- pype/tools/pyblish_pype/util.py | 9 +++++++++ pype/tools/pyblish_pype/window.py | 12 ++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/pype/tools/pyblish_pype/util.py b/pype/tools/pyblish_pype/util.py index d10e7a002aa..5a4dbfb2500 100644 --- a/pype/tools/pyblish_pype/util.py +++ b/pype/tools/pyblish_pype/util.py @@ -309,3 +309,12 @@ def parse_group_range(group_range=None): return group_range return float(group_range) + + +def env_variable_to_bool(env_key): + value = os.environ.get(env_key) + if value is not None: + value = value.lower() + if value in ("true", "1", "yes"): + return True + return False diff --git a/pype/tools/pyblish_pype/window.py b/pype/tools/pyblish_pype/window.py index 7d79e0e26ca..723069f0741 100644 --- a/pype/tools/pyblish_pype/window.py +++ b/pype/tools/pyblish_pype/window.py @@ -55,6 +55,7 @@ def __init__(self, controller, parent=None): super(Window, self).__init__(parent=parent) self._suspend_logs = False + # Use plastique style for specific ocations # TODO set style name via environment variable low_keys = { @@ -511,6 +512,10 @@ def __init__(self, controller, parent=None): self.tabs[current_page].setChecked(True) + self.apply_log_suspend_value( + util.env_variable_to_bool("PYBLISH_SUSPEND_LOGS") + ) + # ------------------------------------------------------------------------- # # Event handlers @@ -633,8 +638,11 @@ def on_stop_clicked(self): self.footer_button_play.setEnabled(False) self.footer_button_stop.setEnabled(False) - def on_suspend_clicked(self): - self._suspend_logs = not self._suspend_logs + def on_suspend_clicked(self, value=None): + self.apply_log_suspend_value(not self._suspend_logs) + + def apply_log_suspend_value(self, value): + self._suspend_logs = value if self.state["current_page"] == "terminal": self.on_tab_changed("overview") From 96b4c6e2519c2fed5cfc003f26eefb0530412a55 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 12 Aug 2020 16:06:15 +0200 Subject: [PATCH 2/2] set PYBLISH_SUSPEND_LOGS by default if published family is editorial --- pype/modules/standalonepublish/publish.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pype/modules/standalonepublish/publish.py b/pype/modules/standalonepublish/publish.py index 0a30d5f2cba..27062e8457e 100644 --- a/pype/modules/standalonepublish/publish.py +++ b/pype/modules/standalonepublish/publish.py @@ -83,6 +83,8 @@ def cli_publish(data, gui=True): envcopy["SAPUBLISH_INPATH"] = json_data_path envcopy["PYBLISHGUI"] = "pyblish_pype" envcopy["PUBLISH_PATHS"] = os.pathsep.join(PUBLISH_PATHS) + if data.get("family", "").lower() == "editorial": + envcopy["PYBLISH_SUSPEND_LOGS"] = "1" result = execute( [sys.executable, PUBLISH_SCRIPT_PATH],