added first version of status overlay

This commit is contained in:
iLLiCiTiT 2021-07-22 16:55:51 +02:00
parent 9b0339246b
commit 3178af7cad
2 changed files with 98 additions and 0 deletions

View file

@ -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("<Instance name>", content_widget)
instance_label.setAlignment(
QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter
)
plugin_label = QtWidgets.QLabel("<Plugin name>", 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)

View file

@ -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):
"<project>/<hierarchy>/<asset>/<task>/<workfile>"
)
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):