Пример #1
0
    def __init__(self, parent=None):
        QtWidgets.QWidget.__init__(self, parent)

        self.setWindowTitle("Project Manager")
        self.resize(1200, 800)

        self.projects = {}

        layout = QtWidgets.QVBoxLayout()

        # Main control
        ctrl_button_w = 30
        ctrl_button_h = 30

        # Calculate icon size
        icon_size = QtCore.QSize(ctrl_button_w - 4, ctrl_button_h - 4)

        main_control_layout = QtWidgets.QHBoxLayout()

        database_label = QtWidgets.QLabel()

        # Main buttons - create
        create_button = QtWidgets.QPushButton()
        create_icon = qta.icon("fa.plus-square", color=style.colors.light)

        create_button.setIconSize(icon_size)

        create_button.setFixedWidth(ctrl_button_w)
        create_button.setFixedHeight(ctrl_button_h)

        create_button.setIcon(create_icon)
        create_button.setStyleSheet(cbstyle.flat_button)

        # Main buttons - refresh
        refresh_button = QtWidgets.QPushButton()
        refresh_icon = qta.icon("fa.refresh", color=style.colors.light)

        refresh_button.setIconSize(icon_size)

        refresh_button.setFixedWidth(ctrl_button_w)
        refresh_button.setFixedHeight(ctrl_button_h)

        refresh_button.setIcon(refresh_icon)
        refresh_button.setStyleSheet(cbstyle.flat_button)

        # Project switch control
        projects_label = QtWidgets.QLabel("Project:")
        projects = QtWidgets.QComboBox()
        projects.insertItem(0, "<None>")

        # Add buttons to the main control layout
        main_control_layout.addWidget(create_button)
        main_control_layout.addStretch()
        main_control_layout.addWidget(database_label)
        main_control_layout.addWidget(projects_label)
        main_control_layout.addWidget(projects)
        main_control_layout.addWidget(refresh_button)

        # Splitter for tabwidget and preview / details widget
        split_widget = QtWidgets.QSplitter()

        # Widgets will be stored in a StackedWidget
        stacked_widget = QtWidgets.QStackedWidget()

        # Control widgets which make the tool
        manager_widget = ManageProjectWidget(parent=self)

        # Sub manager widgets
        overview = OverviewWidget()
        manager_widget.add_widget(overview)

        stacked_widget.insertWidget(manager_widget.order, manager_widget)

        # Navigation panel widget
        navigation_panel = Navigation()

        # Add buttons to navigation panel
        navigation_panel.add_button(manager_widget.label, manager_widget.order)

        # Add widgets to the SplitWidget
        split_widget.addWidget(navigation_panel)
        split_widget.addWidget(stacked_widget)
        split_widget.setHandleWidth(4)
        split_widget.setSizes([100, 700])

        layout.addLayout(main_control_layout)
        layout.addWidget(split_widget)

        self.setLayout(layout)

        # To connect widget store in self attribute
        self._navigation_panel = navigation_panel
        self._stacked_widget = stacked_widget

        self._database_label = database_label
        self._create_button = create_button
        self._projects = projects
        self._refresh_button = refresh_button

        self._overview = overview

        self.connect_signals()

        self.refresh()

        manager_widget.setFocus(True)
Пример #2
0
    def setup_ui(self):
        """Build the UI"""

        main_layout = QtWidgets.QHBoxLayout()
        splitter = QtWidgets.QSplitter()

        # Container overview
        container_widget = QtWidgets.QWidget()
        container_title = self._create_label("Assets")
        container_layout = QtWidgets.QVBoxLayout()

        container_model = models.ContainerModel()
        container_view = views.View()
        container_view.setModel(container_model)
        container_view.setContextMenuPolicy(QtCore.Qt.NoContextMenu)

        from_selection_btn = QtWidgets.QPushButton("Get Looks From Selection")
        from_all_asset_btn = QtWidgets.QPushButton("Get Looks From All Assets")

        container_layout.addWidget(container_title)
        container_layout.addWidget(from_selection_btn)
        container_layout.addWidget(from_all_asset_btn)
        container_layout.addWidget(container_view)

        # Add container view
        container_widget.setLayout(container_layout)
        splitter.addWidget(container_widget)

        # look manager layout
        look_views_widget = QtWidgets.QWidget()
        look_views_layout = QtWidgets.QVBoxLayout()
        look_views_layout.setSpacing(10)

        # Looks from database
        documents_title = self._create_label("Available looks")
        documents_title.setAlignment(QtCore.Qt.AlignCenter)
        document_model = models.FlatModel()
        document_view = views.View()
        document_view.setToolTip("Use right mouse button menu for direct actions")
        document_view.setModel(document_model)
        document_view.setMinimumHeight(230)

        look_views_layout.addWidget(documents_title)
        look_views_layout.addWidget(document_view)

        # Turn off queue at start, show this widget
        queue_off_message = QtWidgets.QLabel(
            "Queue is empty, add items to the queue to active it")
        queue_off_message.setAlignment(QtCore.Qt.AlignCenter)
        queue_off_message.setStyleSheet("font-size: 12px;")

        # Queue view
        queue_title = self._create_label("Queue")
        queue_title.setAlignment(QtCore.Qt.AlignCenter)
        queue_model = models.LookQueueModel()
        queue_view = views.View()
        queue_view.setModel(queue_model)

        queue_widgets = QtWidgets.QStackedWidget()
        queue_widgets.addWidget(queue_off_message)
        queue_widgets.addWidget(queue_view)

        look_views_layout.addWidget(queue_title)
        look_views_layout.addWidget(queue_widgets)

        # Method buttons
        method_buttons_layout = QtWidgets.QHBoxLayout()
        assign_to_selected_btn = QtWidgets.QPushButton("Process Selected Queue")
        assign_to_all_btn = QtWidgets.QPushButton("Process Queued Looks")
        remove_unused_btn = QtWidgets.QPushButton("Remove Unused Looks")
        method_buttons_layout.addWidget(assign_to_selected_btn)
        method_buttons_layout.addWidget(assign_to_all_btn)
        method_buttons_layout.addWidget(remove_unused_btn)

        load_save_buttons_layout = QtWidgets.QHBoxLayout()
        load_queue_btn = QtWidgets.QPushButton("Load Queue from File")
        save_queue_btn = QtWidgets.QPushButton("Save Queue to File")
        load_save_buttons_layout.addWidget(load_queue_btn)
        load_save_buttons_layout.addWidget(save_queue_btn)

        look_views_layout.addLayout(method_buttons_layout)
        look_views_layout.addLayout(load_save_buttons_layout)
        look_views_widget.setLayout(look_views_layout)
        splitter.addWidget(look_views_widget)

        main_layout.addWidget(splitter)

        container_view.setColumnWidth(0, 200)  # subset
        document_view.setColumnWidth(0, 200)
        queue_view.setColumnWidth(0, 200)

        self.from_selection_btn = from_selection_btn
        self.from_all_asset_btn = from_all_asset_btn

        self.assign_to_selected_btn = assign_to_selected_btn
        self.assign_to_all_btn = assign_to_all_btn
        self.remove_unused_btn = remove_unused_btn

        self.container_model = container_model
        self.container_view = container_view

        self.document_model = document_model
        self.document_view = document_view

        self.queue_widgets = queue_widgets
        self.queue_model = queue_model
        self.queue_view = queue_view

        self.save_queue = save_queue_btn
        self.load_queue = load_queue_btn

        self.setLayout(main_layout)