예제 #1
0
    def pyData(self, index, role):
        if not index.isValid():
            return None

        item = index.internalPointer()
        row, column, depth = index.row(), index.column(), item.depth()
        taurus_role = self.role(column, depth)

        ret = None
        if role == Qt.Qt.DisplayRole:
            if taurus_role != ElemType.Exported:
                ret = item.data(index)
        elif role == Qt.Qt.DecorationRole:
            if column == 0:
                ret = self.roleIcon(taurus_role)
            if taurus_role == ElemType.Exported:
                state = item.data(index)
                ret = getDevStateIcon(state)
        elif role == Qt.Qt.ToolTipRole:
            ret = item.toolTip(index)
            if ret is None:
                data = item.data(index)
                if data is not None:
                    if taurus_role == ElemType.Exported:
                        ret = getDevStateToolTip(data)
                    else:
                        ret = self.roleToolTip(taurus_role)
        # elif role == Qt.Qt.SizeHintRole:
        #    ret = self.columnSize(column)
        elif role == Qt.Qt.FontRole:
            ret = self.DftFont
        return ret
예제 #2
0
def getDevStateToolTip(*args, **kwargs):
    """Wrapper to prevent loading qtgui when this module is imported"""
    from taurus.qt.qtgui.icon import getDevStateToolTip
    return getDevStateToolTip(*args, **kwargs)