Esempio n. 1
0
    def __init__(self, parent=None):
        super(CommentWidget, self).__init__(parent)

        css_comment_frame = """
        QFrame { 4px; background: #222; color: #FFF; }
        QLabel { padding: 0px; background: none; }
        QTextEdit { border: 3px solid #252525; background: #444; }
        QScrollBar { border: 0;
                     background-color: #333; margin: 1px;}
        QScrollBar::handle {background: #222; border: 1px solid #111;}
        QScrollBar::sub-line, QScrollBar::add-line {height: 0px; width: 0px;}
        """

        self.setMinimumWidth(600)
        # self.setMaximumHeight(100)
        self.setStyleSheet(css_comment_frame)

        layout = QtWidgets.QFormLayout(self)
        layout.setSpacing(10)
        layout.setContentsMargins(0, 0, 0, 0)
        label = QtWidgets.QLabel("Comment", self)
        self._edit_field = QtWidgets.QTextEdit(self)
        self._edit_field.setObjectName('ftrack-edit-field')
        self._edit_field.textChanged.connect(self._validate_comment)
        layout.setWidget(0, QtWidgets.QFormLayout.LabelRole, label)
        layout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self._edit_field)
    def setupUI(self):
        css_task_global = """
        QLabel { padding: 0px; background: none; }
        /*QTabWidget::pane { border-top: 2px solid #151515; top: -2px;}
        QTabBar::tab { padding: 6px 10px; background: #151515;
                       border-top: 2px solid #151515;
                       border-right: 2px solid #151515;
                       border-left: 2px solid #151515;
                       border-radius: 0px; }
        QTabBar::tab:selected { background: #333;
                                border-top-left-radius: 4px;
                                border-top-right-radius: 4px; }
        QTabBar::tab:hover { background: #222; }
        QTabBar::tab:!selected { margin-top: 2px; }*/
        """
        css_task_name_lbl = "font-size: 13px;"
        css_task_name = "color: #c3cfa4; font-size: 13px; font-weight: bold;"

        self.setStyleSheet(css_task_global)

        task_frame_layout = QtWidgets.QVBoxLayout(self)
        task_frame_layout.setContentsMargins(0, 0, 0, 0)
        task_frame_layout.setSpacing(15)

        # Display Task infos

        task_info_layout = QtWidgets.QFormLayout()
        task_info_layout.setContentsMargins(10, 10, 10, 10)
        task_info_layout.setSpacing(10)

        task_name_lbl = QtWidgets.QLabel("Task", self)
        task_name_lbl.setStyleSheet(css_task_name_lbl)
        self._task_name = QtWidgets.QLabel(self._t_name, self)
        self._task_name.setStyleSheet(css_task_name)

        project_lbl = QtWidgets.QLabel("Project", self)
        self._project_name = QtWidgets.QLabel(self._t_project_name, self)

        shot_lbl = QtWidgets.QLabel("Shot", self)
        shot_layout = QtWidgets.QHBoxLayout()
        shot_layout.setSpacing(6)
        self._shot_name = QtWidgets.QLabel(self)
        self._separator_shot = QtWidgets.QLabel("/", self)
        self._separator_shot.setVisible(False)
        self._sequence_name = QtWidgets.QLabel(self)
        spacer_shot = QtWidgets.QSpacerItem(0, 0,
                                            QtWidgets.QSizePolicy.Expanding,
                                            QtWidgets.QSizePolicy.Minimum)
        shot_layout.addWidget(self._sequence_name)
        shot_layout.addWidget(self._separator_shot)
        shot_layout.addWidget(self._shot_name)
        shot_layout.addItem(spacer_shot)

        shot_status_lbl = QtWidgets.QLabel("Shot status", self)
        shot_status = ftrack.getShotStatuses()
        self._shot_status = StatusWidget(shot_status, self)

        task_status_lbl = QtWidgets.QLabel("Task status", self)
        task_status = ftrack.getTaskStatuses()
        self._task_status = StatusWidget(task_status, self)

        due_date_lbl = QtWidgets.QLabel("Due date", self)
        self._due_date = QtWidgets.QLabel(self)

        task_info_layout.setWidget(0, QtWidgets.QFormLayout.LabelRole,
                                   task_name_lbl)
        task_info_layout.setWidget(0, QtWidgets.QFormLayout.FieldRole,
                                   self._task_name)
        task_info_layout.setWidget(1, QtWidgets.QFormLayout.LabelRole,
                                   project_lbl)
        task_info_layout.setWidget(1, QtWidgets.QFormLayout.FieldRole,
                                   self._project_name)
        task_info_layout.setWidget(2, QtWidgets.QFormLayout.LabelRole,
                                   shot_lbl)
        task_info_layout.setItem(2, QtWidgets.QFormLayout.FieldRole,
                                 shot_layout)
        task_info_layout.setWidget(3, QtWidgets.QFormLayout.LabelRole,
                                   shot_status_lbl)
        task_info_layout.setWidget(3, QtWidgets.QFormLayout.FieldRole,
                                   self._shot_status)
        task_info_layout.setWidget(4, QtWidgets.QFormLayout.LabelRole,
                                   task_status_lbl)
        task_info_layout.setWidget(4, QtWidgets.QFormLayout.FieldRole,
                                   self._task_status)
        task_info_layout.setWidget(5, QtWidgets.QFormLayout.LabelRole,
                                   due_date_lbl)
        task_info_layout.setWidget(5, QtWidgets.QFormLayout.FieldRole,
                                   self._due_date)
        task_frame_layout.addItem(task_info_layout)

        self._tab_widget = QtWidgets.QTabWidget(self)

        # Display Nuke Assets from this task

        self.tab_asset_tree = QtWidgets.QWidget()

        self.tab_asset_tree.busy_overlay = LoadingOverlay(self.tab_asset_tree)
        self.tab_asset_tree.busy_overlay.hide()

        tab_asset_tree_layout = QtWidgets.QVBoxLayout(self.tab_asset_tree)
        tab_asset_tree_layout.setContentsMargins(0, 8, 0, 0)
        self.assets_widget = SceneAssetsWidget(self)

        self.assets_widget.worker_started.connect(
            self.tab_asset_tree.busy_overlay.show)
        self.assets_widget.worker_started.connect(
            self.tab_asset_tree.busy_overlay.raise_)

        self.assets_widget.worker_stopped.connect(
            self.tab_asset_tree.busy_overlay.hide)
        tab_asset_tree_layout.addWidget(self.assets_widget)
        self._tab_widget.addTab(self.tab_asset_tree, "All Scene Assets")

        task_frame_layout.addWidget(self._tab_widget)