diff --git a/openpype/tools/publisher/window.py b/openpype/tools/publisher/window.py index 5dd6998b241..82c7b167b70 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") @@ -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 ) @@ -328,7 +322,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 @@ -491,8 +484,14 @@ def _uninstall_app_event_listener(self): app.removeEventFilter(self) def keyPressEvent(self, event): - # Ignore escape button to close window - if event.key() == QtCore.Qt.Key_Escape: + 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, + }: event.accept() return @@ -558,18 +557,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. @@ -882,12 +869,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) @@ -898,7 +879,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)