Esempio n. 1
0
    def paint(self, painter, option, index):
        QItemDelegate.paint(self, painter, option, index)
        column = index.column()
        row = index.row()
        rect = option.rect

        # Draw borders
        pen = QPen()
        pen.setWidth(1)
        pen.setColor(QColor('#cdcdcd'))
        painter.setPen(pen)
        painter.drawLine(rect.topLeft(), rect.topRight())

        if (row == self.current_hover_row() or row == self.current_row() and
                (self.has_focus_or_context())):
            brush = QBrush(Qt.SolidPattern)
            brush.setColor(QColor(255, 255, 255, 100))
            painter.fillRect(rect, brush)
            if row == self.current_row() and column in [const.COL_START]:
                pen = QPen()
                pen.setWidth(10)
                pen.setColor(QColor('#7cbb4c'))
                painter.setPen(pen)
                dyt = QPoint(0, 5)
                dyb = QPoint(0, 4)
                painter.drawLine(rect.bottomLeft()-dyb, rect.topLeft()+dyt)
Esempio n. 2
0
    def paint(self, painter, option, index):
        """Paint."""
        logtype = self.parent().model().data(
            index.sibling(index.row(), 2))
        if logtype.upper() == 'WARN':
            painter.fillRect(option.rect, PyDMLed.Yellow)
        elif logtype.upper() == 'ERR':
            painter.fillRect(option.rect, PyDMLed.Red)
        elif logtype.upper() == 'DISCONN':
            painter.fillRect(option.rect, PyDMLed.Gray)

        QItemDelegate.paint(self, painter, option, index)
Esempio n. 3
0
    def paint(self, painter, option, index):
        """Override Qt method."""
        QItemDelegate.paint(self, painter, option, index)
        column = index.column()
        row = index.row()
        rect = option.rect

        # Draw borders
        # pen = QPen()
        # pen.setWidth(1)
        # pen.setColor(QColor('#cdcdcd'))
        # painter.setPen(pen)
        # painter.drawLine(rect.topLeft(), rect.topRight())

        if column in [C.COL_NAME, C.COL_DESCRIPTION, C.COL_VERSION]:
            pen = QPen()
            pen.setWidth(1)
            pen.setColor(QColor('#ddd'))
            painter.setPen(pen)
            painter.drawLine(rect.topRight(), rect.bottomRight())

        if (row == self.current_hover_row()
                or row == self.current_row() and self.has_focus_or_context()):
            pen = QPen()
            pen.setWidth(1)
            if row == self.current_row():
                pen.setColor(QColor('#007041'))
            else:
                pen.setColor(QColor('#43b02a'))
            painter.setPen(pen)
            painter.drawLine(rect.topLeft(), rect.topRight())
            painter.drawLine(rect.bottomLeft(), rect.bottomRight())

        if (row == self.current_row() and self.has_focus_or_context()
                and column in [C.COL_START]):
            pen = QPen()
            pen.setWidth(10)
            pen.setColor(QColor('#007041'))
            painter.setPen(pen)
            dyt = QPoint(0, 5)
            dyb = QPoint(0, 4)
            painter.drawLine(rect.bottomLeft() - dyb, rect.topLeft() + dyt)
Esempio n. 4
0
    def paint(self, painter, option, index):
        """Override paint function.

        Responsible for painting dirt columns and cells.
        """
        col = index.column()
        pvname = index.model()._vertical_header[index.row()]['name']
        if pvname in index.model().configurations[col]._dirty_pvs.keys():
            color = QColor(200, 0, 0)
            painter.fillRect(option.rect, color)
            QItemDelegate.paint(self, painter, option, index)
        elif index.model().configurations[col].dirty:
            color = QColor(230, 230, 230)
            painter.fillRect(option.rect, color)
            QItemDelegate.paint(self, painter, option, index)
        else:
            QItemDelegate.paint(self, painter, option, index)