diff --git a/openpype/tools/new_publisher/__init__.py b/openpype/tools/new_publisher/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/openpype/tools/new_publisher/image_file.png b/openpype/tools/new_publisher/image_file.png new file mode 100644 index 0000000000..adea862e5b Binary files /dev/null and b/openpype/tools/new_publisher/image_file.png differ diff --git a/openpype/tools/new_publisher/widgets.py b/openpype/tools/new_publisher/widgets.py new file mode 100644 index 0000000000..1f38f5a8e1 --- /dev/null +++ b/openpype/tools/new_publisher/widgets.py @@ -0,0 +1,98 @@ +import os +from Qt import QtWidgets, QtCore, QtGui + + +def get_default_thumbnail_image_path(): + dirpath = os.path.dirname(os.path.abspath(__file__)) + return os.path.join(dirpath, "image_file.png") + + +class SubsetAttributesWidget(QtWidgets.QWidget): + def __init__(self, parent): + super(SubsetAttributesWidget, self).__init__(parent) + + """ + _____________________________ + | | | + | Global | Thumbnail | + | attributes | | TOP + |_________________|___________| + | | | + | | Publish | + | Family | plugin | + | attributes | attributes | BOTTOM + |______________|______________| + """ + + # TOP PART + top_widget = QtWidgets.QWidget(self) + + # Global attributes + global_attrs_widget = QtWidgets.QWidget(top_widget) + + variant_input = QtWidgets.QLineEdit(global_attrs_widget) + subset_value_widget = QtWidgets.QLabel(global_attrs_widget) + family_value_widget = QtWidgets.QLabel(global_attrs_widget) + asset_value_widget = QtWidgets.QLabel(global_attrs_widget) + task_value_widget = QtWidgets.QLabel(global_attrs_widget) + + subset_value_widget.setText("") + family_value_widget.setText("") + asset_value_widget.setText("") + task_value_widget.setText("") + + global_attrs_layout = QtWidgets.QFormLayout(global_attrs_widget) + global_attrs_layout.addRow("Name", variant_input) + global_attrs_layout.addRow("Family", family_value_widget) + global_attrs_layout.addRow("Asset", asset_value_widget) + global_attrs_layout.addRow("Task", task_value_widget) + global_attrs_layout.addRow("Subset", subset_value_widget) + + thumbnail_widget = ThumbnailWidget(top_widget) + + top_layout = QtWidgets.QHBoxLayout(top_widget) + top_layout.setContentsMargins(0, 0, 0, 0) + top_layout.addWidget(global_attrs_widget, 7) + top_layout.addWidget(thumbnail_widget, 3) + + # BOTTOM PART + bottom_widget = QtWidgets.QWidget(self) + # TODO they should be scrollable + family_attrs_widget = QtWidgets.QWidget(bottom_widget) + publish_attrs_widget = QtWidgets.QWidget(bottom_widget) + + bottom_layout = QtWidgets.QHBoxLayout(bottom_widget) + bottom_layout.setContentsMargins(0, 0, 0, 0) + bottom_layout.addWidget(family_attrs_widget, 1) + bottom_layout.addWidget(publish_attrs_widget, 1) + + layout = QtWidgets.QVBoxLayout(self) + layout.addWidget(top_widget, 0) + layout.addWidget(bottom_widget, 1) + + self.global_attrs_widget = global_attrs_widget + self.thumbnail_widget = thumbnail_widget + + +class ThumbnailWidget(QtWidgets.QWidget): + def __init__(self, parent): + super(ThumbnailWidget, self).__init__(parent) + + default_pix = QtGui.QPixmap(get_default_thumbnail_image_path()) + + thumbnail_label = QtWidgets.QLabel(self) + thumbnail_label.setPixmap( + default_pix.scaled( + 200, 100, + QtCore.Qt.KeepAspectRatio, + QtCore.Qt.SmoothTransformation + ) + ) + + layout = QtWidgets.QHBoxLayout(self) + layout.setContentsMargins(0, 0, 0, 0) + layout.addWidget(thumbnail_label, alignment=QtCore.Qt.AlignCenter) + + self.thumbnail_label = thumbnail_label + self.default_pix = default_pix + self.current_pix = None diff --git a/openpype/tools/new_publisher/window.py b/openpype/tools/new_publisher/window.py new file mode 100644 index 0000000000..f1d753e83c --- /dev/null +++ b/openpype/tools/new_publisher/window.py @@ -0,0 +1,97 @@ +import sys +sys.path.append(r"C:\Users\iLLiCiT\PycharmProjects\pype3\.venv\Lib\site-packages") +from Qt import QtWidgets, QtCore + +from widgets import SubsetAttributesWidget + + +class PublisherWindow(QtWidgets.QWidget): + def __init__(self, parent=None): + super(PublisherWindow, self).__init__(parent) + + # TODO Title, Icon, Stylesheet + + main_frame = QtWidgets.QWidget(self) + + # Header + context_label = QtWidgets.QLabel(main_frame) + + # Content + content_widget = QtWidgets.QWidget(main_frame) + + # Subset widget + subset_widget = QtWidgets.QWidget(content_widget) + + subset_view = QtWidgets.QTreeView(subset_widget) + subset_attributes = SubsetAttributesWidget(subset_widget) + + subset_layout = QtWidgets.QHBoxLayout(subset_widget) + subset_layout.addWidget(subset_view, 0) + subset_layout.addWidget(subset_attributes, 1) + + content_layout = QtWidgets.QVBoxLayout(content_widget) + content_layout.setContentsMargins(0, 0, 0, 0) + content_layout.addWidget(subset_widget) + + # Footer + footer_widget = QtWidgets.QWidget(self) + + message_input = QtWidgets.QLineEdit(footer_widget) + validate_btn = QtWidgets.QPushButton("Validate", footer_widget) + publish_btn = QtWidgets.QPushButton("Publish", footer_widget) + + footer_layout = QtWidgets.QHBoxLayout(footer_widget) + footer_layout.setContentsMargins(0, 0, 0, 0) + footer_layout.addWidget(message_input, 1) + footer_layout.addWidget(validate_btn, 0) + footer_layout.addWidget(publish_btn, 0) + + # Main frame + main_frame_layout = QtWidgets.QVBoxLayout(main_frame) + main_frame_layout.addWidget(context_label, 0) + main_frame_layout.addWidget(content_widget, 1) + main_frame_layout.addWidget(footer_widget, 0) + + # Add main frame to this window + main_layout = QtWidgets.QHBoxLayout(self) + main_layout.addWidget(main_frame) + + validate_btn.clicked.connect(self._on_validate_clicked) + publish_btn.clicked.connect(self._on_publish_clicked) + + self.main_frame = main_frame + + self.context_label = context_label + + self.footer_widget = footer_widget + self.message_input = message_input + self.validate_btn = validate_btn + self.publish_btn = publish_btn + + # DEBUGING + self.set_context_label( + "////" + ) + # self.setStyleSheet("border: 1px solid black;") + + def set_context_label(self, label): + self.context_label.setText(label) + + def _on_validate_clicked(self): + print("Validation!!!") + + def _on_publish_clicked(self): + print("Publishing!!!") + + +def main(): + """Main function for testing purposes.""" + + app = QtWidgets.QApplication([]) + window = PublisherWindow() + window.show() + app.exec_() + + +if __name__ == "__main__": + main()