Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Publisher window as dialog #6176

Merged
merged 5 commits into from
Feb 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 10 additions & 30 deletions openpype/tools/publisher/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@
)


class PublisherWindow(QtWidgets.QWidget):
class PublisherWindow(QtWidgets.QDialog):
"""Main window of publisher."""
default_width = 1300
default_height = 800
footer_border = 8
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")

Expand Down Expand Up @@ -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
)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down
Loading