Ejemplo n.º 1
0
 def _column1():
     if role == Qt.DecorationRole:
         continuous_palette = ContinuousPaletteGenerator(*var.colors)
         line = continuous_palette.getRGB(np.arange(0, 1, 1 / 256))
         data = np.arange(0, 256, dtype=np.int8). \
             reshape((1, 256)). \
             repeat(16, 0)
         img = QImage(data, 256, 16, QImage.Format_Indexed8)
         img.setColorCount(256)
         img.setColorTable([qRgb(*x) for x in line])
         img.data = data
         return img
     if role == Qt.ToolTipRole:
         return "{} - {}".format(self._encode_color(var.colors[0]),
                                 self._encode_color(var.colors[1]))
     if role == ColorRole:
         return var.colors
Ejemplo n.º 2
0
 def _column1():
     if role == Qt.DecorationRole:
         continuous_palette = ContinuousPaletteGenerator(*var.colors)
         line = continuous_palette.getRGB(np.arange(0, 1, 1 / 256))
         data = np.arange(0, 256, dtype=np.int8). \
             reshape((1, 256)). \
             repeat(16, 0)
         img = QImage(data, 256, 16, QImage.Format_Indexed8)
         img.setColorCount(256)
         img.setColorTable([qRgb(*x) for x in line])
         img.data = data
         return img
     if role == Qt.ToolTipRole:
         return "{} - {}".format(self._encode_color(var.colors[0]),
                                 self._encode_color(var.colors[1]))
     if role == ColorRole:
         return var.colors
Ejemplo n.º 3
0
 def data(self, index, role=Qt.DisplayRole):
     row, col = index.row(), index.column()
     if col == 0:
         return ColorTableModel.data(self, index, role)
     if col > 1:
         return
     var = self.variables[row]
     if role == Qt.DecorationRole:
         continuous_palette = ContinuousPaletteGenerator(*var.colors)
         line = continuous_palette.getRGB(np.arange(0, 1, 1 / 256))
         data = np.arange(0, 256, dtype=np.int8).\
             reshape((1, 256)).\
             repeat(16, 0)
         img = QImage(data, 256, 16, QImage.Format_Indexed8)
         img.setColorCount(256)
         img.setColorTable([qRgb(*x) for x in line])
         img.data = data
         return img
     if role == Qt.ToolTipRole:
         return "{} - {}".format(self._encode_color(var.colors[0]),
                                 self._encode_color(var.colors[1]))
     if role == ColorRole:
         return var.colors
Ejemplo n.º 4
0
 def data(self, index, role=Qt.DisplayRole):
     row, col = index.row(), index.column()
     if col == 0:
         return ColorTableModel.data(self, index, role)
     if col > 1:
         return
     var = self.variables[row]
     if role == Qt.DecorationRole:
         continuous_palette = ContinuousPaletteGenerator(*var.colors)
         line = continuous_palette.getRGB(np.arange(0, 1, 1 / 256))
         data = np.arange(0, 256, dtype=np.int8).\
             reshape((1, 256)).\
             repeat(16, 0)
         img = QImage(data, 256, 16, QImage.Format_Indexed8)
         img.setColorCount(256)
         img.setColorTable([qRgb(*x) for x in line])
         img.data = data
         return img
     if role == Qt.ToolTipRole:
         return "{} - {}".format(self._encode_color(var.colors[0]),
                                 self._encode_color(var.colors[1]))
     if role == ColorRole:
         return var.colors