From dadf8989be620616cdebc0bc3ee99dc3ba9d9ebd Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Fri, 26 Jan 2024 16:45:44 +0100 Subject: [PATCH 1/4] Use QDialog as super class and pass parent to init --- openpype/tools/publisher/window.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openpype/tools/publisher/window.py b/openpype/tools/publisher/window.py index 5dd6998b241..de1a6249ad4 100644 --- a/openpype/tools/publisher/window.py +++ b/openpype/tools/publisher/window.py @@ -42,7 +42,7 @@ ) -class PublisherWindow(QtWidgets.QWidget): +class PublisherWindow(QtWidgets.QDialog): """Main window of publisher.""" default_width = 1300 default_height = 800 @@ -50,7 +50,7 @@ class PublisherWindow(QtWidgets.QWidget): publish_footer_spacer = 2 def __init__(self, parent=None, controller=None, reset_on_show=None): - super(PublisherWindow, self).__init__() + super(PublisherWindow, self).__init__(parent) self.setObjectName("PublishWindow") From 34b42c132d56a69c190681b6b3aad0c4c8f06369 Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Fri, 26 Jan 2024 16:46:03 +0100 Subject: [PATCH 2/4] ignore enter and return event key --- openpype/tools/publisher/window.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/openpype/tools/publisher/window.py b/openpype/tools/publisher/window.py index de1a6249ad4..ab337c9b32d 100644 --- a/openpype/tools/publisher/window.py +++ b/openpype/tools/publisher/window.py @@ -328,7 +328,6 @@ def __init__(self, parent=None, controller=None, reset_on_show=None): "copy_report.request", self._copy_report ) - # Store extra header widget for TrayPublisher # - can be used to add additional widgets to header between context # label and help button @@ -492,7 +491,11 @@ def _uninstall_app_event_listener(self): def keyPressEvent(self, event): # Ignore escape button to close window - if event.key() == QtCore.Qt.Key_Escape: + if event.key() in { + QtCore.Qt.Key_Escape, + QtCore.Qt.Key_Enter, + QtCore.Qt.Key_Return, + }: event.accept() return From 87b4b6e483de6dfc5db677a8fbc848f24cedda3a Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Fri, 26 Jan 2024 17:43:09 +0100 Subject: [PATCH 3/4] removed '_make_sure_on_top' --- openpype/tools/publisher/window.py | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/openpype/tools/publisher/window.py b/openpype/tools/publisher/window.py index ab337c9b32d..5b56802055c 100644 --- a/openpype/tools/publisher/window.py +++ b/openpype/tools/publisher/window.py @@ -294,12 +294,6 @@ def __init__(self, parent=None, controller=None, reset_on_show=None): controller.event_system.add_callback( "publish.process.stopped", self._on_publish_stop ) - controller.event_system.add_callback( - "publish.process.instance.changed", self._on_instance_change - ) - controller.event_system.add_callback( - "publish.process.plugin.changed", self._on_plugin_change - ) controller.event_system.add_callback( "show.card.message", self._on_overlay_message ) @@ -561,18 +555,6 @@ def _on_show_timer(self): self._reset_on_show = False self.reset() - def _make_sure_on_top(self): - """Raise window to top and activate it. - - This may not work for some DCCs without Qt. - """ - - if not self._window_is_visible: - self.show() - - self.setWindowState(QtCore.Qt.WindowActive) - self.raise_() - def _checks_before_save(self, explicit_save): """Save of changes may trigger some issues. @@ -885,12 +867,6 @@ def _on_publish_start(self): if self._is_on_create_tab(): self._go_to_publish_tab() - def _on_instance_change(self): - self._make_sure_on_top() - - def _on_plugin_change(self): - self._make_sure_on_top() - def _on_publish_validated_change(self, event): if event["value"]: self._validate_btn.setEnabled(False) @@ -901,7 +877,6 @@ def _on_publish_finished_change(self, event): self._comment_input.setText("") def _on_publish_stop(self): - self._make_sure_on_top() self._set_publish_overlay_visibility(False) self._reset_btn.setEnabled(True) self._stop_btn.setEnabled(False) From 781bd615a6506dd36d5c69c90393596a3a35e299 Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Fri, 26 Jan 2024 17:53:30 +0100 Subject: [PATCH 4/4] add comments to enter and return keys --- openpype/tools/publisher/window.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openpype/tools/publisher/window.py b/openpype/tools/publisher/window.py index 5b56802055c..82c7b167b70 100644 --- a/openpype/tools/publisher/window.py +++ b/openpype/tools/publisher/window.py @@ -484,9 +484,11 @@ def _uninstall_app_event_listener(self): app.removeEventFilter(self) def keyPressEvent(self, event): - # Ignore escape button to close window if event.key() in { + # Ignore escape button to close window QtCore.Qt.Key_Escape, + # Ignore enter keyboard event which by default triggers + # first available button in QDialog QtCore.Qt.Key_Enter, QtCore.Qt.Key_Return, }: