Ejemplo n.º 1
0
 def getOrdinalColor(self, value, alternate=1):
     if self.binColors:
         lowerIndex = int(math.floor(1.0*value))
         higherIndex = int(math.ceil(1.0*value))
         closerIndex = lowerIndex if value-math.floor(value) < math.ceil(value)-value else higherIndex
         if alternate == 2:
             return AppState.ORDINAL_COLORS_2[closerIndex]
         elif alternate == 3:
             return AppState.ORDINAL_COLORS_3[closerIndex]
         elif alternate == 4:
             return AppState.ORDINAL_COLORS_4[closerIndex]
         elif alternate == 5:
             return AppState.ORDINAL_COLORS_5[closerIndex]
         else:
             return AppState.ORDINAL_COLORS_1[closerIndex]
     else:
         if alternate == 2:
             hue = AppState.ORDINAL_COLORS_2[0]
         elif alternate == 3:
             hue = AppState.ORDINAL_COLORS_3[0]
         elif alternate == 4:
             hue = AppState.ORDINAL_COLORS_4[0]
         elif alternate == 5:
             hue = AppState.ORDINAL_COLORS_5[0]
         else:
             hue = AppState.ORDINAL_COLORS_1[0]
         return QColor.fromHsvF(hue.hueF(),0.9-0.6*value,0.6+0.4*value)
Ejemplo n.º 2
0
 def onTextHSVChanged(self, value):
     if self.updating: return
     h = float(self.ui.numH.value()) / 360.0
     s = self.ui.numS.value()
     v = self.ui.numV.value()
     color = QColor.fromHsvF(h, s, v)
     color.setAlphaF(self.currentColor.alphaF())
     self.setColor(color)
     self.updateColorPlane()
Ejemplo n.º 3
0
 def setUp(self):
     self.original = QColor.fromHsvF(0.2, 0.3, 0.4, 0.5)
Ejemplo n.º 4
0
 def testReduceHsv(self):
     self.reduceColor(QColor.fromHsvF(0.1, 0.2, 0.3, 0.4))
Ejemplo n.º 5
0
 def setUp(self):
     self.original = QColor.fromHsvF(0.2, 0.3, 0.4, 0.5)
Ejemplo n.º 6
0
 def onColorBaseChanged(self, x, y, z):
     if self.updating: return
     hue, s, v = z, x, 1.0 - y
     color = QColor.fromHsvF(hue, s, v)
     color.setAlphaF(self.currentColor.alphaF())
     self.setColor(color)
Ejemplo n.º 7
0
 def testReduceHsv(self):
     self.reduceColor(QColor.fromHsvF(0.1, 0.2, 0.3, 0.4))