Example #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
Example #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
Example #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