From 3178af7cadcd488eb6321b5bf18f6f8a39405373 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Thu, 22 Jul 2021 16:55:51 +0200 Subject: [PATCH] added first version of status overlay --- openpype/tools/new_publisher/widgets.py | 66 +++++++++++++++++++++++++ openpype/tools/new_publisher/window.py | 32 ++++++++++++ 2 files changed, 98 insertions(+) diff --git a/openpype/tools/new_publisher/widgets.py b/openpype/tools/new_publisher/widgets.py index 691bbc96f3..81cfc7f8e8 100644 --- a/openpype/tools/new_publisher/widgets.py +++ b/openpype/tools/new_publisher/widgets.py @@ -1301,3 +1301,69 @@ class InstanceListView(_AbstractInstanceView): ) proxy_index = self.proxy_model.mapFromSource(group_index) self.instance_view.setExpanded(proxy_index, expanded) + + +class PublishOverlayFrame(QtWidgets.QWidget): + def __init__(self, parent): + super(PublishOverlayFrame, self).__init__(parent) + + info_frame = QtWidgets.QFrame(self) + info_frame.setObjectName("PublishOverlay") + + content_widget = QtWidgets.QWidget(info_frame) + content_widget.setAttribute(QtCore.Qt.WA_TranslucentBackground) + + info_layout = QtWidgets.QVBoxLayout(info_frame) + info_layout.setContentsMargins(0, 0, 0, 0) + info_layout.addWidget(content_widget) + + main_label = QtWidgets.QLabel("Publishing...", content_widget) + main_label.setAlignment(QtCore.Qt.AlignCenter) + + instance_label = QtWidgets.QLabel("", content_widget) + instance_label.setAlignment( + QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter + ) + plugin_label = QtWidgets.QLabel("", content_widget) + plugin_label.setAlignment( + QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter + ) + instance_plugin_layout = QtWidgets.QHBoxLayout() + instance_plugin_layout.addWidget(instance_label, 1) + instance_plugin_layout.addWidget(plugin_label, 1) + + progress_widget = QtWidgets.QProgressBar(content_widget) + + content_layout = QtWidgets.QVBoxLayout(content_widget) + content_layout.setAlignment(QtCore.Qt.AlignCenter) + content_layout.addStretch(1) + content_layout.addWidget(main_label) + content_layout.addStretch(1) + content_layout.addLayout(instance_plugin_layout) + content_layout.addWidget(progress_widget) + content_layout.addStretch(1) + + main_layout = QtWidgets.QVBoxLayout(self) + main_layout.setContentsMargins(0, 0, 0, 0) + main_layout.addStretch(1) + main_layout.addWidget(info_frame, 2) + main_layout.addStretch(1) + + self.main_label = main_label + self.info_frame = info_frame + + self.instance_label = instance_label + self.plugin_label = plugin_label + self.progress_widget = progress_widget + + def set_instance(self, instance_name): + self.instance_label.setText(instance_name) + + def set_plugin(self, plugin_name): + self.plugin_label.setText(plugin_name) + + def set_progress_range(self, max_value): + self.progress_widget.setMaximum(max_value) + + def set_progress(self, value): + self.progress_widget.setValue(value) diff --git a/openpype/tools/new_publisher/window.py b/openpype/tools/new_publisher/window.py index 49eb2a67b1..327e957774 100644 --- a/openpype/tools/new_publisher/window.py +++ b/openpype/tools/new_publisher/window.py @@ -30,6 +30,7 @@ from Qt import QtWidgets from openpype import style from control import PublisherController from widgets import ( + PublishOverlayFrame, SubsetAttributesWidget, InstanceCardView, InstanceListView, @@ -52,6 +53,15 @@ class PublisherWindow(QtWidgets.QWidget): # TODO Title, Icon, Stylesheet main_frame = QtWidgets.QWidget(self) + # Overlay MUST be created after Main to be painted on top of it + overlay_frame = PublishOverlayFrame(self) + overlay_frame.setVisible(False) + + blur_effect = QtWidgets.QGraphicsBlurEffect(main_frame) + blur_effect.setBlurRadius(3) + blur_effect.setEnabled(False) + + main_frame.setGraphicsEffect(blur_effect) # Header header_widget = QtWidgets.QWidget(main_frame) @@ -154,6 +164,9 @@ class PublisherWindow(QtWidgets.QWidget): ) self.main_frame = main_frame + self.overlay_frame = overlay_frame + + self.blur_effect = blur_effect self.context_label = context_label @@ -185,6 +198,15 @@ class PublisherWindow(QtWidgets.QWidget): "////" ) + def resizeEvent(self, event): + super(PublisherWindow, self).resizeEvent(event) + + self.overlay_frame.resize(self.main_frame.size()) + + def moveEvent(self, event): + super(PublisherWindow, self).moveEvent(event) + self.overlay_frame.move(self.main_frame.pos()) + def showEvent(self, event): super(PublisherWindow, self).showEvent(event) if self._first_show: @@ -270,10 +292,20 @@ class PublisherWindow(QtWidgets.QWidget): def _on_save_clicked(self): self.controller.save_instance_changes() + def _show_overlay(self): + if self.overlay_frame.isVisible(): + return + + self.overlay_frame.setVisible(True) + + self.blur_effect.setEnabled(True) + def _on_validate_clicked(self): + self._show_overlay() self.controller.validate() def _on_publish_clicked(self): + self._show_overlay() self.controller.publish() def _refresh_instances(self):