Пример #1
0
    def _setup_ui(self):
        """create the ui elements
        """
        self.resize(1350, 950)
        self.vertical_layout = QtWidgets.QVBoxLayout(self)

        # Dialog Label
        self.dialog_label = QtWidgets.QLabel(self)
        self.dialog_label.setText('Task Manager')
        self.dialog_label.setStyleSheet("color: rgb(71, 143, 202);font: 18pt;")
        self.vertical_layout.addWidget(self.dialog_label)

        # Title Line
        line = QtWidgets.QFrame(self)
        line.setFrameShape(QtWidgets.QFrame.HLine)
        line.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.vertical_layout.addWidget(line)

        # --------------------------------------------
        # Filter Fields
        label_role = QtWidgets.QFormLayout.LabelRole
        field_role = QtWidgets.QFormLayout.FieldRole

        expanding = QtWidgets.QSizePolicy.Expanding
        fixed = QtWidgets.QSizePolicy.Fixed
        minimum = QtWidgets.QSizePolicy.Minimum

        # Filters Form Layout
        self.filters_form_layout = QtWidgets.QFormLayout()
        self.filters_form_layout.setLabelAlignment(QtCore.Qt.AlignRight
                                                   | QtCore.Qt.AlignTrailing
                                                   | QtCore.Qt.AlignVCenter)
        self.vertical_layout.addLayout(self.filters_form_layout)

        # Filer By Label
        i = 0
        self.filter_by_label = QtWidgets.QLabel(self)
        self.filter_by_label.setText('Filter By')
        self.filters_form_layout.setWidget(i, field_role, self.filter_by_label)
        i += 1

        # Project
        #   Label
        self.filter_by_project_label = QtWidgets.QLabel(self)
        self.filter_by_project_label.setText('Project')

        self.filters_form_layout.setWidget(i, label_role,
                                           self.filter_by_project_label)

        #   Field
        self.filter_by_project_combo_box = QtWidgets.QComboBox(self)
        self.filter_by_project_combo_box.setSizePolicy(expanding, fixed)
        self.filter_by_project_combo_box.setEditable(True)

        self.filters_form_layout.setWidget(i, field_role,
                                           self.filter_by_project_combo_box)
        i += 1

        # Entity Type
        #   Label
        self.filter_by_entity_type_label = QtWidgets.QLabel(self)
        self.filter_by_entity_type_label.setText('Entity Type')
        self.filters_form_layout.setWidget(i, label_role,
                                           self.filter_by_entity_type_label)

        #   Field
        self.filter_by_entity_type_combo_box = QtWidgets.QComboBox(self)
        self.filter_by_entity_type_combo_box.setSizePolicy(expanding, fixed)
        self.filters_form_layout.setWidget(
            i, field_role, self.filter_by_entity_type_combo_box)
        i += 1

        # Task Type
        #   Label
        self.filter_by_task_type_label = QtWidgets.QLabel(self)
        self.filter_by_task_type_label.setText('Task Type')
        self.filters_form_layout.setWidget(i, label_role,
                                           self.filter_by_task_type_label)

        #   Field
        self.filter_by_task_type_combo_box = QtWidgets.QComboBox(self)
        self.filter_by_task_type_combo_box.setSizePolicy(expanding, fixed)
        self.filters_form_layout.setWidget(i, field_role,
                                           self.filter_by_task_type_combo_box)
        i += 1

        # Sequence
        #   Only visible when entity type is Shot
        #   Label
        self.filter_by_sequence_label = QtWidgets.QLabel(self)
        self.filter_by_sequence_label.setText('Sequence')
        self.filters_form_layout.setWidget(i, label_role,
                                           self.filter_by_sequence_label)

        #   Field
        self.filter_by_sequence_combo_box = QtWidgets.QComboBox(self)
        self.filter_by_sequence_combo_box.setSizePolicy(expanding, fixed)
        self.filters_form_layout.setWidget(i, field_role,
                                           self.filter_by_sequence_combo_box)
        i += 1

        # Resource
        #   Label
        self.filter_by_resource_label = QtWidgets.QLabel(self)
        self.filter_by_resource_label.setText('Resource')
        self.filters_form_layout.setWidget(i, label_role,
                                           self.filter_by_resource_label)

        #   Field
        self.filter_by_resource_combo_box = QtWidgets.QComboBox(self)
        self.filter_by_resource_combo_box.setSizePolicy(expanding, fixed)
        self.filters_form_layout.setWidget(i, field_role,
                                           self.filter_by_resource_combo_box)
        i += 1

        # ------------------------------------------------
        # Filter Button
        self.filter_button_horizontal_layout = QtWidgets.QHBoxLayout(self)
        self.filters_form_layout.setLayout(
            i, field_role, self.filter_button_horizontal_layout)

        self.filter_push_button = QtWidgets.QPushButton(self)
        self.filter_push_button.setText('-> Apply Filter <-')
        self.filter_button_horizontal_layout.addWidget(self.filter_push_button)

        # spacer
        spacer = QtWidgets.QSpacerItem(40, 20, expanding, minimum)
        self.filter_button_horizontal_layout.addItem(spacer)

        # ------------------------------------------------
        # The main table widget
        self.data_table_widget = QtWidgets.QTableWidget(self)
        self.data_table_widget.setAutoFillBackground(True)
        self.data_table_widget.setEditTriggers(
            QtWidgets.QAbstractItemView.NoEditTriggers)
        self.data_table_widget.setColumnCount(2)
        self.data_table_widget.setRowCount(0)
        item = QtWidgets.QTableWidgetItem()
        self.data_table_widget.setHorizontalHeaderItem(0, item)

        item = QtWidgets.QTableWidgetItem()
        self.data_table_widget.setHorizontalHeaderItem(1, item)

        self.data_table_widget.horizontalHeader().setStretchLastSection(True)
        self.vertical_layout.addWidget(self.data_table_widget)
Пример #2
0
    def create(self, parent=None):
        """Creates this publisher

        :param parent:
        :return:
        """
        # Create layout
        self.layout = QtWidgets.QHBoxLayout(parent)

        # Create Icons
        self.publisher_state_ok_icon = parent.style() \
            .standardIcon(QtWidgets.QStyle.SP_DialogYesButton)
        self.publisher_state_not_ok_icon = parent.style() \
            .standardIcon(QtWidgets.QStyle.SP_DialogNoButton)

        # Create check push button
        self.check_push_button = QtWidgets.QPushButton(parent)
        self.check_push_button.setText('Check')
        self.layout.addWidget(self.check_push_button)
        self.check_push_button.setSizePolicy(QtWidgets.QSizePolicy.Fixed,
                                             QtWidgets.QSizePolicy.Fixed)

        # Create fix push button
        self.fix_push_button = QtWidgets.QPushButton(parent)
        self.fix_push_button.setText('Fix')
        self.layout.addWidget(self.fix_push_button)
        self.fix_push_button.setSizePolicy(QtWidgets.QSizePolicy.Fixed,
                                           QtWidgets.QSizePolicy.Fixed)
        self.fix_push_button.setMaximumWidth(40)

        # Create Progress Bar
        self.progress_bar = QtWidgets.QProgressBar(parent)
        self.progress_bar.setFixedWidth(100)
        self.progress_bar.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                        QtWidgets.QSizePolicy.Fixed)
        self.layout.addWidget(self.progress_bar)

        self.progress_bar_manager = QProgressBarWrapper(
            progress_bar=self.progress_bar,
            minimum=0,
            maximum=100.0,
            value=0.0)

        # Create state label
        self.publisher_state_label = QtWidgets.QLabel(parent)
        self.publisher_state_label.setSizePolicy(QtWidgets.QSizePolicy.Fixed,
                                                 QtWidgets.QSizePolicy.Fixed)
        self.layout.addWidget(self.publisher_state_label)

        # Create performance label
        self.performance_label = QtWidgets.QLabel(parent)
        self.performance_label.setText('x.x sec')
        self.performance_label.setSizePolicy(QtWidgets.QSizePolicy.Fixed,
                                             QtWidgets.QSizePolicy.Fixed)
        self.layout.addWidget(self.performance_label)

        # Create name label
        self.publisher_name_label = QtWidgets.QLabel(parent)
        self.publisher_name_label.setText(
            self.publisher.__doc__.split('\n')[0].strip())
        self.publisher_name_label.setAlignment(QtCore.Qt.AlignLeft
                                               | QtCore.Qt.AlignVCenter)
        self.publisher_name_label.setToolTip(self.publisher.__doc__)
        self.performance_label.setSizePolicy(QtWidgets.QSizePolicy.Fixed,
                                             QtWidgets.QSizePolicy.Fixed)
        self.layout.addWidget(self.publisher_name_label)

        # Create help push button
        self.help_push_button = QtWidgets.QPushButton(parent)
        self.help_push_button.setText('?')
        self.layout.addWidget(self.help_push_button)
        self.help_push_button.setSizePolicy(QtWidgets.QSizePolicy.Fixed,
                                            QtWidgets.QSizePolicy.Fixed)
        self.help_push_button.setMaximumWidth(20)

        spacer = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Expanding,
                                       QtWidgets.QSizePolicy.Minimum)
        self.layout.addItem(spacer)

        self.state = False

        # create button signal
        QtCore.QObject.connect(self.check_push_button,
                               QtCore.SIGNAL("clicked()"), self.run_publisher)

        QtCore.QObject.connect(self.help_push_button,
                               QtCore.SIGNAL('clicked()'),
                               self.show_publisher_docs)

        QtCore.QObject.connect(self.fix_push_button,
                               QtCore.SIGNAL('clicked()'),
                               self.run_fix_definition)