Esempio n. 1
0
    def data(self, index, role=_Qt.DisplayRole):
        if not index.isValid() or not 0 <= index.row() < self.rowCount():
            return _QVariant()

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

        if role == _Qt.DisplayRole:
            if col == TableModelLines._COL_COLOR:
                return str(round_list(self._model_data[row]['color']))
            elif col == TableModelLines._COL_ALPHA:
                return str(self._model_data[row]['alpha'])
            elif col == TableModelLines._COL_LINEWIDTH:
                return str(self._model_data[row]['linewidth'])
            elif col == TableModelLines._COL_LINESTYLE:
                ls = self._model_data[row]['linestyle']
                return str(MplLines.LINESTYLE_DICT[ls])
            elif col == TableModelLines._COL_MARKER:
                mk = self._model_data[row]['marker']
                return str(MplMarkers.MARKER_DICT[mk])
            elif col == TableModelLines._COL_MARKERSIZE:
                return str(self._model_data[row]['markersize'])
            elif col == TableModelLines._COL_LABEL:
                return str(self._model_data[row]['label'])
            elif col == TableModelLines._COL_DELETE:
                return ''

        elif role == _Qt.DecorationRole:
            if col == TableModelLines._COL_COLOR:
                color = self._model_data[row]['color']
                color_256 = [color[0] * 255, color[1] * 255, color[2] * 255]
                qcolor = _QColor(color_256[0], color_256[1], color_256[2])
                pm = _QPixmap(20, 20)
                pm.fill(qcolor)
                icon = _QIcon(pm)
                return icon
            elif col == TableModelLines._COL_DELETE:
                color = [1, 0, 0]
                color_256 = [color[0] * 255, color[1] * 255, color[2] * 255]
                qcolor = _QColor(color_256[0], color_256[1], color_256[2])
                pm = _QPixmap(20, 20)
                pm.fill(qcolor)
                icon = _QIcon(pm)
                return icon
            else:
                pass
        else:
            return _QVariant()
Esempio n. 2
0
    def data(self, index, role=_Qt.DisplayRole):
        if not index.isValid() or not 0 <= index.row() < self.rowCount():
            return _QVariant()

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

        if role == _Qt.DisplayRole:
            if col == TableModelLines._COL_COLOR:
                return str(self._model_data[row]['color'])
            elif col == TableModelLines._COL_ALPHA:
                return str(self._model_data[row]['alpha'])
            elif col == TableModelLines._COL_LINEWIDTH:
                return str(self._model_data[row]['linewidth'])
            elif col == TableModelLines._COL_LINESTYLE:
                ls = self._model_data[row]['linestyle']
                return str(MplLines.LINESTYLE_DICT[ls])
            elif col == TableModelLines._COL_MARKER:
                mk = self._model_data[row]['marker']
                return str(MplMarkers.MARKER_DICT[mk])
            elif col == TableModelLines._COL_MARKERSIZE:
                return str(self._model_data[row]['markersize'])
            elif col == TableModelLines._COL_LABEL:
                return str(self._model_data[row]['label'])
            elif col == TableModelLines._COL_DELETE:
                return ''

        elif role == _Qt.DecorationRole:
            if col == TableModelLines._COL_COLOR:
                color = self._model_data[row]['color']
                color_256 = [color[0]*255, color[1]*255, color[2]*255]
                qcolor = _QColor(color_256[0], color_256[1], color_256[2])
                pm = _QPixmap(20, 20)
                pm.fill(qcolor)
                icon = _QIcon(pm)
                return icon
            elif col == TableModelLines._COL_DELETE:
                color = [1, 0, 0]
                color_256 = [color[0]*255, color[1]*255, color[2]*255]
                qcolor = _QColor(color_256[0], color_256[1], color_256[2])
                pm = _QPixmap(20, 20)
                pm.fill(qcolor)
                icon = _QIcon(pm)
                return icon
            else:
                pass
        else:
            return _QVariant()
Esempio n. 3
0
    def data(self, index, role=_Qt.DisplayRole):
        if not index.isValid() or not 0 <= index.row() < self.rowCount():
            return _QVariant()

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

        if role == _Qt.DisplayRole:
            if col == TableModelImages._COL_CMAP:
                return str(self._model_data[row]['cmap_name'])
            elif col == TableModelImages._COL_ALPHA:
                return str(self._model_data[row]['alpha'])
            elif col == TableModelImages._COL_CLIM_LOW:
                return str(self._model_data[row]['clim_low'])
            elif col == TableModelImages._COL_CLIM_HIGH:
                return str(self._model_data[row]['clim_high'])
            elif col == TableModelImages._COL_CBAR:
                #                print('1')
                return str(self._model_data[row]['colorbar'])
            elif col == TableModelImages._COL_LABEL:
                return str(self._model_data[row]['label'])
            elif col == TableModelImages._COL_DELETE:
                return ''
        elif role == _Qt.DecorationRole:
            if col == TableModelImages._COL_DELETE:
                color = [1, 0, 0]
                color_256 = [color[0] * 255, color[1] * 255, color[2] * 255]
                qcolor = _QColor(color_256[0], color_256[1], color_256[2])
                pm = _QPixmap(20, 20)
                pm.fill(qcolor)
                icon = _QIcon(pm)
                return icon
        else:
            return _QVariant()
Esempio n. 4
0
    def data(self, index, role=_Qt.DisplayRole):
        if not index.isValid() or not 0 <= index.row() < self.rowCount():
            return _QVariant()

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

        if role == _Qt.DisplayRole:
            if col == TableModelImages._COL_CMAP:
                return str(self._model_data[row]['cmap_name'])
            elif col == TableModelImages._COL_ALPHA:
                return str(self._model_data[row]['alpha'])
            elif col == TableModelImages._COL_CLIM_LOW:
                return str(self._model_data[row]['clim_low'])
            elif col == TableModelImages._COL_CLIM_HIGH:
                return str(self._model_data[row]['clim_high'])
            elif col == TableModelImages._COL_CBAR:
#                print('1')
                return str(self._model_data[row]['colorbar'])
            elif col == TableModelImages._COL_LABEL:
                return str(self._model_data[row]['label'])
            elif col == TableModelImages._COL_DELETE:
                return ''
        elif role == _Qt.DecorationRole:
            if col == TableModelImages._COL_DELETE:
                color = [1, 0, 0]
                color_256 = [color[0]*255, color[1]*255, color[2]*255]
                qcolor = _QColor(color_256[0], color_256[1], color_256[2])
                pm = _QPixmap(20, 20)
                pm.fill(qcolor)
                icon = _QIcon(pm)
                return icon
        else:
            return _QVariant()
Esempio n. 5
0
    def data(self, index, role=_Qt.DisplayRole):
        if not index.isValid() or not 0 <= index.row() < self.rowCount():
            return _QVariant()

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

        if role == _Qt.DisplayRole:
            if col == TableModelBars._COL_FACECOLOR:
                return str(self._model_data[row]['facecolor'])
            elif col == TableModelBars._COL_ALPHA:
                return str(self._model_data[row]['alpha'])
            elif col == TableModelBars._COL_EDGECOLOR:
                return str(self._model_data[row]['edgecolor'])
            elif col == TableModelBars._COL_LINEWIDTH:
                return str(self._model_data[row]['linewidth'])
            elif col == TableModelBars._COL_WIDTH_FACTOR:
                return str(self._model_data[row]['width_factor'])
            elif col == TableModelBars._COL_LABEL:
                return str(self._model_data[row]['label'])
            elif col == TableModelBars._COL_DELETE:
                return ''
        elif role == _Qt.DecorationRole:
            if col == TableModelBars._COL_FACECOLOR:
                color = self._model_data[row]['facecolor']
            elif col == TableModelBars._COL_EDGECOLOR:
                color = self._model_data[row]['edgecolor']
            if (col == TableModelBars._COL_FACECOLOR or
                    col == TableModelBars._COL_EDGECOLOR):
                color_256 = [color[0]*255, color[1]*255, color[2]*255]
                qcolor = _QColor(color_256[0], color_256[1], color_256[2])
                pm = _QPixmap(20, 20)
                pm.fill(qcolor)
                icon = _QIcon(pm)
                return icon
            elif col == TableModelBars._COL_DELETE:
                color = [1, 0, 0]
                color_256 = [color[0]*255, color[1]*255, color[2]*255]
                qcolor = _QColor(color_256[0], color_256[1], color_256[2])
                pm = _QPixmap(20, 20)
                pm.fill(qcolor)
                icon = _QIcon(pm)
                return icon
            else:
                pass
        else:
            return _QVariant()
Esempio n. 6
0
    def data(self, index, role=_Qt.DisplayRole):
        if not index.isValid() or not 0 <= index.row() < self.rowCount():
            return _QVariant()

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

        if role == _Qt.DisplayRole:
            if col == TableModelBars._COL_FACECOLOR:
                return str(round_list(self._model_data[row]['facecolor']))
            elif col == TableModelBars._COL_ALPHA:
                return str(self._model_data[row]['alpha'])
            elif col == TableModelBars._COL_EDGECOLOR:
                return str(round_list(self._model_data[row]['edgecolor']))
            elif col == TableModelBars._COL_LINEWIDTH:
                return str(self._model_data[row]['linewidth'])
            elif col == TableModelBars._COL_WIDTH_FACTOR:
                return str(self._model_data[row]['width_factor'])
            elif col == TableModelBars._COL_LABEL:
                return str(self._model_data[row]['label'])
            elif col == TableModelBars._COL_DELETE:
                return ''
        elif role == _Qt.DecorationRole:
            if col == TableModelBars._COL_FACECOLOR:
                color = self._model_data[row]['facecolor']
            elif col == TableModelBars._COL_EDGECOLOR:
                color = self._model_data[row]['edgecolor']
            if (col == TableModelBars._COL_FACECOLOR
                    or col == TableModelBars._COL_EDGECOLOR):
                color_256 = [color[0] * 255, color[1] * 255, color[2] * 255]
                qcolor = _QColor(color_256[0], color_256[1], color_256[2])
                pm = _QPixmap(20, 20)
                pm.fill(qcolor)
                icon = _QIcon(pm)
                return icon
            elif col == TableModelBars._COL_DELETE:
                color = [1, 0, 0]
                color_256 = [color[0] * 255, color[1] * 255, color[2] * 255]
                qcolor = _QColor(color_256[0], color_256[1], color_256[2])
                pm = _QPixmap(20, 20)
                pm.fill(qcolor)
                icon = _QIcon(pm)
                return icon
            else:
                pass
        else:
            return _QVariant()