Skip to content

Commit

Permalink
Squashed commits of pyblish-gui-sanity-mode:
Browse files Browse the repository at this point in the history
commit bf31458
Author: Jérôme LORRAIN <jerome.lorrain@protonmail.com>
Date:   Fri Oct 8 10:50:44 2021 +0200

    change button name and add tooltip

commit da42cbf
Author: Jérôme LORRAIN <jerome.lorrain@protonmail.com>
Date:   Thu Oct 7 17:35:17 2021 +0200

    Fix syntax for linter

commit fc4f98b
Author: Jérôme LORRAIN <jerome.lorrain@protonmail.com>
Date:   Thu Oct 7 16:54:52 2021 +0200

    Implement sanity mode to pyblish openpype GUI

commit 6f79251
Merge: ecae9f6 6468751
Author: Petr Kalis <petr.kalis@gmail.com>
Date:   Mon Feb 7 10:05:55 2022 +0100

    Merge pull request ynput#2634 from Ellipsanime/fix-photoshop-environement-workfiles-on-launch

    Fix open workfile on launch in photoshop

commit ecae9f6
Merge: 4b3834e 3160199
Author: Milan Kolar <mkolar@users.noreply.github.com>
Date:   Mon Feb 7 09:52:39 2022 +0100

    Merge pull request ynput#2556 from pypeclub/feature/OP-2429_Publisher-Preparations-before-standalone-publisher

commit 4b3834e
Merge: ccea535 604a590
Author: pypebot <82967070+pypebot@users.noreply.github.com>
Date:   Mon Feb 7 09:38:20 2022 +0100

    [Automated] Merged release main into develop

commit ccea535
Merge: f2a9543 a11700e
Author: pypebot <82967070+pypebot@users.noreply.github.com>
Date:   Sat Feb 5 04:34:51 2022 +0100

    [Automated] Merged main into develop

commit 6468751
Author: clement.hector <clement.hector@gmail.com>
Date:   Fri Feb 4 12:11:05 2022 +0100

    use env_value_to_bool instead of ast.literal_eval + os.getenv

commit fe46093
Author: clement.hector <clement.hector@gmail.com>
Date:   Wed Feb 2 19:36:49 2022 +0100

    fix test on string to boolean

commit 3160199
Author: Jakub Trllo <jakub.trllo@gmail.com>
Date:   Tue Jan 25 14:15:19 2022 +0100

    fix grammar

commit d739364
Author: Jakub Trllo <jakub.trllo@gmail.com>
Date:   Tue Jan 25 13:48:18 2022 +0100

    handle default value of 'is_label_horizontal'

commit 7ec4d50
Author: Jakub Trllo <jakub.trllo@gmail.com>
Date:   Tue Jan 25 13:48:03 2022 +0100

    precreate widget is separated from create dialog completely

commit f8be576
Author: iLLiCiTiT <jakub.trllo@gmail.com>
Date:   Tue Jan 18 18:05:32 2022 +0100

    renamed method 'get_attribute_defs' to 'get_instance_attr_defs'

commit 20f5e8f
Author: iLLiCiTiT <jakub.trllo@gmail.com>
Date:   Tue Jan 18 17:51:25 2022 +0100

    hound fixes

commit 95176b6
Author: iLLiCiTiT <jakub.trllo@gmail.com>
Date:   Tue Jan 18 17:26:16 2022 +0100

    modified example creator

commit 23c3bc8
Author: iLLiCiTiT <jakub.trllo@gmail.com>
Date:   Tue Jan 18 17:26:09 2022 +0100

    style changes of header view nad checkbox

commit 2d75212
Author: iLLiCiTiT <jakub.trllo@gmail.com>
Date:   Tue Jan 18 17:25:51 2022 +0100

    ui attribute definitions are skipped for storing data

commit f0b7f72
Author: iLLiCiTiT <jakub.trllo@gmail.com>
Date:   Tue Jan 18 17:25:34 2022 +0100

    creator dialog has context widget and creator's attributes

commit 9c6a57a
Author: iLLiCiTiT <jakub.trllo@gmail.com>
Date:   Tue Jan 18 17:23:37 2022 +0100

    creator can define precreate attribute definitions and allowing context change

commit 3878c52
Author: iLLiCiTiT <jakub.trllo@gmail.com>
Date:   Tue Jan 18 17:22:57 2022 +0100

    added widgett for pre create attributes

commit fffdef5
Author: iLLiCiTiT <jakub.trllo@gmail.com>
Date:   Tue Jan 18 17:22:41 2022 +0100

    added publisher specific asset and task widgets

commit fbdd1d8
Author: iLLiCiTiT <jakub.trllo@gmail.com>
Date:   Tue Jan 18 17:22:08 2022 +0100

    moved few widgets to tools/utils and modified asset/task widgets to easily change source model

commit 396bdfd
Author: iLLiCiTiT <jakub.trllo@gmail.com>
Date:   Tue Jan 18 17:16:32 2022 +0100

    added few new attribute definitions and their widgets
  • Loading branch information
BenoitConnan committed Feb 28, 2022
1 parent db92de9 commit a0e5f7d
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
27 changes: 27 additions & 0 deletions openpype/tools/pyblish_pype/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ def _stop_if_empty(self):

class Controller(QtCore.QObject):
log = logging.getLogger("PyblishController")

sanity_mode = False
last_active_plugin = {}
# Emitted when the GUI is about to start processing;
# e.g. resetting, validating or publishing.
about_to_process = QtCore.Signal(object, object)
Expand Down Expand Up @@ -136,6 +139,10 @@ class Controller(QtCore.QObject):

def __init__(self, parent=None):
super(Controller, self).__init__(parent)

if os.getenv("PYBLISH_SANITY_MODE", "") == "true":
self.sanity_mode = True

self.context = None
self.plugins = {}
self.optional_default = {}
Expand Down Expand Up @@ -239,6 +246,8 @@ def reset_context(self):

def reset(self):
"""Discover plug-ins and run collection."""
self.last_active_plugin = {x.__name__: x.active for x in self.plugins}

self._main_thread_processor.clear()
self._main_thread_processor.process(self._reset)
self._main_thread_processor.start()
Expand Down Expand Up @@ -277,9 +286,27 @@ def load_plugins(self):
and not getattr(plugin, "active", True)
):
continue

if self.sanity_mode:
order = getattr(plugin, "order", 100)
if order >= pyblish.api.ExtractorOrder - 0.5:
continue
elif order >= pyblish.api.ValidatorOrder - 0.5:
plugin.optional = True
plugin.active = False
if self.last_active_plugin.get(plugin.__name__, False):
plugin.active = True

_plugins.append(plugin)
self.plugins = _plugins

def deactivate_validator_plugins(self):
for plugin in self.plugins:
if getattr(plugin, "order", 100) >= \
pyblish.api.ValidatorOrder - 0.5:
plugin.active = False


def on_published(self):
if self.is_running:
self.is_running = False
Expand Down
33 changes: 33 additions & 0 deletions openpype/tools/pyblish_pype/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ def __init__(self, controller, parent=None):

presets_button = widgets.ButtonWithMenu(awesome["filter"])
presets_button.setEnabled(False)

self.change_mode_btn = QtWidgets.QPushButton()
if self.controller.sanity_mode:
self.set_publish_mode_btn()
else:
self.set_validation_mode_btn()
aditional_btns_layout.addWidget(self.change_mode_btn)
aditional_btns_layout.addWidget(presets_button)

layout_tab = QtWidgets.QHBoxLayout(header_tab_widget)
Expand Down Expand Up @@ -435,6 +442,7 @@ def __init__(self, controller, parent=None):
footer_button_reset.clicked.connect(self.on_reset_clicked)
footer_button_validate.clicked.connect(self.on_validate_clicked)
footer_button_play.clicked.connect(self.on_play_clicked)
self.change_mode_btn.clicked.connect(self.on_change_mode_clicked)

comment_box.textChanged.connect(self.on_comment_entered)
comment_box.returnPressed.connect(self.on_play_clicked)
Expand Down Expand Up @@ -873,6 +881,12 @@ def on_stop_clicked(self):
def on_suspend_clicked(self, value=None):
self.apply_log_suspend_value(not self._suspend_logs)

def on_change_mode_clicked(self):
if self.controller.sanity_mode:
self.change_to_classic_mode()
else:
self.change_to_sanity_mode()

def apply_log_suspend_value(self, value):
self._suspend_logs = value
if self.state["current_page"] == "terminal":
Expand Down Expand Up @@ -1126,6 +1140,25 @@ def on_was_processed(self, result):
#
# -------------------------------------------------------------------------

def set_validation_mode_btn(self):
self.change_mode_btn.setText("V")
self.change_mode_btn.setToolTip("Switch to Validation mode.")

def set_publish_mode_btn(self):
self.change_mode_btn.setText("P")
self.change_mode_btn.setToolTip("Switch to Publish mode.")

def change_to_sanity_mode(self):
self.set_publish_mode_btn()
self.controller.sanity_mode = True
self.controller.deactivate_validator_plugins()
self.reset()

def change_to_classic_mode(self):
self.set_validation_mode_btn()
self.controller.sanity_mode = False
self.reset()

def reset(self):
"""Prepare GUI for reset"""
self.info(self.tr("About to reset.."))
Expand Down

0 comments on commit a0e5f7d

Please sign in to comment.