From 449e601a5fe37617d7c663b47f9d0bd45b083aec Mon Sep 17 00:00:00 2001 From: Toke Stuart Jepsen Date: Mon, 29 Jan 2024 17:39:28 +0000 Subject: [PATCH 1/5] Show message with error on action failure. --- openpype/tools/publisher/control.py | 15 +++++++++++++++ openpype/tools/publisher/window.py | 15 +++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/openpype/tools/publisher/control.py b/openpype/tools/publisher/control.py index 47e374edf2a..0137d5c95f4 100644 --- a/openpype/tools/publisher/control.py +++ b/openpype/tools/publisher/control.py @@ -2329,6 +2329,21 @@ def run_action(self, plugin_id, action_id): result = pyblish.plugin.process( plugin, self._publish_context, None, action.id ) + exception = result.get("error") + if exception: + self._emit_event( + "action.failed", + { + "title": "Action failed", + "message": "Action failed.", + "traceback": "".join( + traceback.format_exception(exception) + ), + "label": "", + "identifier": action.__name__ + } + ) + self._publish_report.add_action_result(action, result) def _publish_next_process(self): diff --git a/openpype/tools/publisher/window.py b/openpype/tools/publisher/window.py index 5dd6998b241..e5b47f43098 100644 --- a/openpype/tools/publisher/window.py +++ b/openpype/tools/publisher/window.py @@ -321,6 +321,9 @@ def __init__(self, parent=None, controller=None, reset_on_show=None): controller.event_system.add_callback( "convertors.find.failed", self._on_convertor_error ) + controller.event_system.add_callback( + "action.failed", self._on_action_error + ) controller.event_system.add_callback( "export_report.request", self._export_report ) @@ -1012,6 +1015,18 @@ def _on_convertor_error(self, event): event["title"], new_failed_info, "Convertor:" ) + def _on_action_error(self, event): + self.add_error_message_dialog( + event["title"], + [{ + "message": event["message"], + "traceback": event["traceback"], + "label": event["label"], + "identifier": event["identifier"] + }], + "Action:" + ) + def _update_create_overlay_size(self): metrics = self._create_overlay_button.fontMetrics() height = int(metrics.height()) From 2b3160773332c53cc4e923e897ea532e06d7c968 Mon Sep 17 00:00:00 2001 From: Toke Stuart Jepsen Date: Tue, 30 Jan 2024 10:57:59 +0000 Subject: [PATCH 2/5] Feedback action finished. --- openpype/tools/publisher/control.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openpype/tools/publisher/control.py b/openpype/tools/publisher/control.py index 0137d5c95f4..61528c7c885 100644 --- a/openpype/tools/publisher/control.py +++ b/openpype/tools/publisher/control.py @@ -2346,6 +2346,8 @@ def run_action(self, plugin_id, action_id): self._publish_report.add_action_result(action, result) + self.emit_card_message("Action finished.") + def _publish_next_process(self): # Validations of progress before using iterator # - same conditions may be inside iterator but they may be used From d0a09bcad47299e341152cb47a600abc3d269f43 Mon Sep 17 00:00:00 2001 From: Toke Stuart Jepsen Date: Wed, 31 Jan 2024 07:15:36 +0000 Subject: [PATCH 3/5] Illicit suggestion --- openpype/tools/publisher/control.py | 2 +- openpype/tools/publisher/window.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openpype/tools/publisher/control.py b/openpype/tools/publisher/control.py index 61528c7c885..9bae0deac82 100644 --- a/openpype/tools/publisher/control.py +++ b/openpype/tools/publisher/control.py @@ -2332,7 +2332,7 @@ def run_action(self, plugin_id, action_id): exception = result.get("error") if exception: self._emit_event( - "action.failed", + "publish.action.failed", { "title": "Action failed", "message": "Action failed.", diff --git a/openpype/tools/publisher/window.py b/openpype/tools/publisher/window.py index e5b47f43098..193b6948a5b 100644 --- a/openpype/tools/publisher/window.py +++ b/openpype/tools/publisher/window.py @@ -322,7 +322,7 @@ def __init__(self, parent=None, controller=None, reset_on_show=None): "convertors.find.failed", self._on_convertor_error ) controller.event_system.add_callback( - "action.failed", self._on_action_error + "publish.action.failed", self._on_action_error ) controller.event_system.add_callback( "export_report.request", self._export_report From 149f53daff8a4267fc0a45370bcd414db00d7981 Mon Sep 17 00:00:00 2001 From: Toke Stuart Jepsen Date: Wed, 31 Jan 2024 09:15:11 +0000 Subject: [PATCH 4/5] identifier > name --- openpype/tools/publisher/control.py | 2 +- openpype/tools/publisher/window.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openpype/tools/publisher/control.py b/openpype/tools/publisher/control.py index 9bae0deac82..23ef6ae6c1c 100644 --- a/openpype/tools/publisher/control.py +++ b/openpype/tools/publisher/control.py @@ -2340,7 +2340,7 @@ def run_action(self, plugin_id, action_id): traceback.format_exception(exception) ), "label": "", - "identifier": action.__name__ + "name": action.__name__ } ) diff --git a/openpype/tools/publisher/window.py b/openpype/tools/publisher/window.py index 193b6948a5b..f4de3a08f76 100644 --- a/openpype/tools/publisher/window.py +++ b/openpype/tools/publisher/window.py @@ -1022,7 +1022,7 @@ def _on_action_error(self, event): "message": event["message"], "traceback": event["traceback"], "label": event["label"], - "identifier": event["identifier"] + "identifier": event["name"] }], "Action:" ) From b39c41f98a5ece76b6466ab08e8e55e7462df8a3 Mon Sep 17 00:00:00 2001 From: Toke Stuart Jepsen Date: Wed, 31 Jan 2024 10:01:02 +0000 Subject: [PATCH 5/5] Use label --- openpype/tools/publisher/control.py | 4 ++-- openpype/tools/publisher/window.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/openpype/tools/publisher/control.py b/openpype/tools/publisher/control.py index 23ef6ae6c1c..13d007dd356 100644 --- a/openpype/tools/publisher/control.py +++ b/openpype/tools/publisher/control.py @@ -2339,8 +2339,8 @@ def run_action(self, plugin_id, action_id): "traceback": "".join( traceback.format_exception(exception) ), - "label": "", - "name": action.__name__ + "label": action.__name__, + "identifier": action.id } ) diff --git a/openpype/tools/publisher/window.py b/openpype/tools/publisher/window.py index f4de3a08f76..193b6948a5b 100644 --- a/openpype/tools/publisher/window.py +++ b/openpype/tools/publisher/window.py @@ -1022,7 +1022,7 @@ def _on_action_error(self, event): "message": event["message"], "traceback": event["traceback"], "label": event["label"], - "identifier": event["name"] + "identifier": event["identifier"] }], "Action:" )