Ejemplo n.º 1
0
    def setData(self, index, value, role=QtCore.Qt.EditRole):
        """
        Set data method for model.
        """

        # index invalid
        if not (index.isValid()):
            # log
            self.logger.debug("Index {0} not valid.".format(index))
            # evaluate in superclass
            return self.parent_class.setData(index, value, role)

        # row & col
        row = index.row()
        col = index.column()

        # current_header
        current_header = self.header_name_list[col]

        # renderthreads_node
        renderthreads_node = self.data_list[row][0]

        # nuke_node exists
        if not (renderthreads_node.nuke_node_exists()):
            return False

        # EditRole
        if role == QtCore.Qt.EditRole:

            # column nuke_node
            if current_header == self.header_name_list[0]:

                # validate
                if self.validate_value_for_nuke_node(value):

                    # set value
                    renderthreads_node.setName(value)
                    # data changed signal
                    self.dataChanged.emit(index, index)

                    return True

                return False

            # column start_frame
            elif current_header == self.header_name_list[1]:

                # validate
                if self.validate_value_for_start_frame(value):

                    # set value
                    renderthreads_node.start_frame = value
                    # data changed signal
                    self.dataChanged.emit(index, index)

                    return True

                return False

            # column end_frame
            elif current_header == self.header_name_list[2]:

                # validate
                if self.validate_value_for_end_frame(value):

                    # set value
                    renderthreads_node.end_frame = value
                    # data changed signal
                    self.dataChanged.emit(index, index)

                    return True

                return False

            # column priority
            elif current_header == self.header_name_list[4]:

                # validate
                if self.validate_value_for_priority(value):

                    # set value
                    renderthreads_node.set_priority(value)
                    # data changed signal
                    self.dataChanged.emit(index, index)

                    # Setting the priority via signal on the
                    # command objects works. However it has
                    # no influence of the PriorityQueue since
                    # priority queues cannot be updated.
                    # nuke_node_full_name
                    nuke_node_full_name = renderthreads_node.fullName()
                    # negated_value
                    negated_value = 101 - value
                    # emit sgnl_command_set_priority_for_identifier
                    renderthreads_node.sgnl_command_set_priority_for_identifier.emit(nuke_node_full_name, negated_value)

                    return True

                return False

            else:
                # evaluate in superclass
                return self.parent_class.setData(index, value, role)

        else:
            # evaluate in superclass
            return self.parent_class.setData(index, value, role)
Ejemplo n.º 2
0
    def setData(self, index, value, role=QtCore.Qt.EditRole):
        """
        Set data method for model.
        """

        # index invalid
        if not(index.isValid()):
            # log
            self.logger.debug('Index {0} not valid.'.format(index))
            # evaluate in superclass
            return self.parent_class.setData(index, value, role)

        # row & col
        row = index.row()
        col = index.column()

        # current_header
        current_header = self.header_name_list[col]

        # renderthreads_node
        renderthreads_node = self.data_list[row][0]

        # nuke_node exists
        if not(renderthreads_node.nuke_node_exists()):
            return False

        # EditRole
        if (role == QtCore.Qt.EditRole):

            # column nuke_node
            if (current_header == self.header_name_list[0]):

                # validate
                if(self.validate_value_for_nuke_node(value)):

                    # set value
                    renderthreads_node.setName(value)
                    # data changed signal
                    self.dataChanged.emit(index, index)

                    return True

                return False

            # column start_frame
            elif (current_header == self.header_name_list[1]):

                # validate
                if(self.validate_value_for_start_frame(value)):

                    # set value
                    renderthreads_node.start_frame = value
                    # data changed signal
                    self.dataChanged.emit(index, index)

                    return True

                return False

            # column end_frame
            elif (current_header == self.header_name_list[2]):

                # validate
                if(self.validate_value_for_end_frame(value)):

                    # set value
                    renderthreads_node.end_frame = value
                    # data changed signal
                    self.dataChanged.emit(index, index)

                    return True

                return False

            # column priority
            elif (current_header == self.header_name_list[4]):

                # validate
                if(self.validate_value_for_priority(value)):

                    # set value
                    renderthreads_node.set_priority(value)
                    # data changed signal
                    self.dataChanged.emit(index, index)

                    # Setting the priority via signal on the
                    # command objects works. However it has
                    # no influence of the PriorityQueue since
                    # priority queues cannot be updated.
                    # nuke_node_full_name
                    nuke_node_full_name = renderthreads_node.fullName()
                    # negated_value
                    negated_value = 101 - value
                    # emit sgnl_command_set_priority_for_identifier
                    renderthreads_node.sgnl_command_set_priority_for_identifier.emit(nuke_node_full_name,
                                                                                        negated_value)

                    return True

                return False

            else:
                # evaluate in superclass
                return self.parent_class.setData(index, value, role)

        else:
            # evaluate in superclass
            return self.parent_class.setData(index, value, role)
Ejemplo n.º 3
0
    def data(self, index, role=QtCore.Qt.DisplayRole):
        """
        Return data for current index. The returned data is
        rendered by QItemDelegate.
        """

        # index invalid
        if not (index.isValid()):
            # log
            self.logger.debug("Index {0} not valid.".format(index))
            # evaluate in superclass
            return None

        # row & col
        row = index.row()
        col = index.column()

        # current_header
        current_header = self.header_name_list[col]

        # renderthreads_node
        renderthreads_node = self.data_list[row][0]

        # nuke_node exists
        if not (renderthreads_node.nuke_node_exists()):
            # return
            return None

        # DisplayRole and EditRole (return identical in most cases,
        # if not then do recheck later)
        if role == QtCore.Qt.DisplayRole or role == QtCore.Qt.EditRole:

            # column nuke_node
            if current_header == self.header_name_list[0]:

                # nuke_node
                nuke_node = renderthreads_node.nuke_node
                return nuke_node

            # column start_frame
            elif current_header == self.header_name_list[1]:

                # start_frame
                start_frame = renderthreads_node.start_frame
                return start_frame

            # column end_frame
            elif current_header == self.header_name_list[2]:

                # end_frame
                end_frame = renderthreads_node.end_frame
                return end_frame

            # column progress
            elif current_header == self.header_name_list[3]:

                # progress
                progress = renderthreads_node.get_progressbar()
                return progress

            # column priority
            elif current_header == self.header_name_list[4]:

                # priority
                priority = renderthreads_node.get_priority()
                return priority

            else:
                # evaluate in superclass
                return None

        # TextAlignmentRole
        elif role == QtCore.Qt.TextAlignmentRole:

            # column start_frame
            if current_header == self.header_name_list[1]:

                return QtCore.Qt.AlignCenter

            # column end_frame
            elif current_header == self.header_name_list[2]:

                return QtCore.Qt.AlignCenter

            # column priority
            elif current_header == self.header_name_list[4]:

                return QtCore.Qt.AlignCenter

            else:

                # left
                return QtCore.Qt.AlignLeft

        # ToolTipRole
        elif role == QtCore.Qt.ToolTipRole:

            # column nuke_node
            if current_header == self.header_name_list[0]:

                # nuke_node_full_name
                nuke_node_full_name = renderthreads_node.fullName()
                return nuke_node_full_name

            # column start_frame
            elif current_header == self.header_name_list[1]:

                # start_frame
                start_frame = renderthreads_node.start_frame
                return start_frame

            # column end_frame
            elif current_header == self.header_name_list[2]:

                # end_frame
                end_frame = renderthreads_node.end_frame
                return end_frame

            # column progress
            elif current_header == self.header_name_list[3]:

                # progress_value
                progress_value = renderthreads_node.get_progressbar().text()
                return progress_value

            # column priority
            elif current_header == self.header_name_list[4]:

                # priority
                priority = renderthreads_node.get_priority()

                # priority_tooltip
                priority_tooltip = "Priority: {0}\n\
{1}\n\
Priority cannot be adjusted after job has been added.".format(
                    priority, TEXT_DIVIDER
                )

                # return
                return priority_tooltip

            else:
                # evaluate in superclass
                return None

        else:

            # evaluate in superclass
            return None
Ejemplo n.º 4
0
    def data(self, index, role=QtCore.Qt.DisplayRole):
        """
        Return data for current index. The returned data is
        rendered by QItemDelegate.
        """

        # index invalid
        if not(index.isValid()):
            # log
            self.logger.debug('Index {0} not valid.'.format(index))
            # evaluate in superclass
            return None

        # row & col
        row = index.row()
        col = index.column()

        # current_header
        current_header = self.header_name_list[col]

        # renderthreads_node
        renderthreads_node = self.data_list[row][0]

        # nuke_node exists
        if not(renderthreads_node.nuke_node_exists()):
            # return
            return None

        # DisplayRole and EditRole (return identical in most cases,
        # if not then do recheck later)
        if (role == QtCore.Qt.DisplayRole or
                role == QtCore.Qt.EditRole):

            # column nuke_node
            if (current_header == self.header_name_list[0]):

                # nuke_node
                nuke_node = renderthreads_node.nuke_node
                return nuke_node

            # column start_frame
            elif (current_header == self.header_name_list[1]):

                # start_frame
                start_frame = renderthreads_node.start_frame
                return start_frame

            # column end_frame
            elif (current_header == self.header_name_list[2]):

                # end_frame
                end_frame = renderthreads_node.end_frame
                return end_frame

            # column progress
            elif (current_header == self.header_name_list[3]):

                # progress
                progress = renderthreads_node.get_progressbar()
                return progress

            # column priority
            elif (current_header == self.header_name_list[4]):

                # priority
                priority = renderthreads_node.get_priority()
                return priority

            else:
                # evaluate in superclass
                return None

        # TextAlignmentRole
        elif (role == QtCore.Qt.TextAlignmentRole):

            # column start_frame
            if (current_header == self.header_name_list[1]):

                return QtCore.Qt.AlignCenter

            # column end_frame
            elif (current_header == self.header_name_list[2]):

                return QtCore.Qt.AlignCenter

            # column priority
            elif (current_header == self.header_name_list[4]):

                return QtCore.Qt.AlignCenter

            else:

                # left
                return QtCore.Qt.AlignLeft

        # ToolTipRole
        elif (role == QtCore.Qt.ToolTipRole):

            # column nuke_node
            if (current_header == self.header_name_list[0]):

                # nuke_node_full_name
                nuke_node_full_name = renderthreads_node.fullName()
                return nuke_node_full_name

            # column start_frame
            elif (current_header == self.header_name_list[1]):

                # start_frame
                start_frame = renderthreads_node.start_frame
                return start_frame

            # column end_frame
            elif (current_header == self.header_name_list[2]):

                # end_frame
                end_frame = renderthreads_node.end_frame
                return end_frame

            # column progress
            elif (current_header == self.header_name_list[3]):

                # progress_value
                progress_value = renderthreads_node.get_progressbar().text()
                return progress_value

            # column priority
            elif (current_header == self.header_name_list[4]):

                # priority
                priority = renderthreads_node.get_priority()

                # priority_tooltip
                priority_tooltip = 'Priority: {0}\n\
{1}\n\
Priority cannot be adjusted after job has been added.'.format(priority, TEXT_DIVIDER)

                # return
                return priority_tooltip

            else:
                # evaluate in superclass
                return None

        else:

            # evaluate in superclass
            return None