示例#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
示例#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
示例#3
0
 def _column1():
     if role == Qt.DecorationRole:
         continuous_palette = \
             ContinuousPaletteGenerator(*desc.get_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:
         colors = desc.get_colors()
         return f"{self._encode_color(colors[0])} " \
                f"- {self._encode_color(colors[1])}"
     if role == ColorRole:
         return desc.get_colors()
     return None
示例#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
示例#5
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