Merge branch 'hotfix/allow_enable_disable_suspending_logs'

This commit is contained in:
Milan Kolar 2020-08-12 22:51:00 +02:00
commit 3e60bfbf57
3 changed files with 21 additions and 2 deletions

View file

@ -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],

View file

@ -309,3 +309,12 @@ class OrderGroups:
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

View file

@ -55,6 +55,7 @@ class Window(QtWidgets.QDialog):
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 @@ class Window(QtWidgets.QDialog):
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 @@ class Window(QtWidgets.QDialog):
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")