Ejemplo n.º 1
0
    def setBaseColor(newcolor):
        StyleHelper.requestedBaseColor = newcolor
        color = QColor()
        color.setHsv(newcolor.hue(), newcolor.saturation() * 0.7, 64 + newcolor.value() / 3)

        if color.isValid() and color != StyleHelper.baseColor:
            StyleHelper.baseColor = color
            for w in QApplication.topLevelWidgets():
                w.update()
 def startNewLineCollection(self):
     self.lineCollections.append(LineCollection())
     self.openCollectionIdx += 1
     newColor = QColor()
     # http://martin.ankerl.com/2009/12/09/how-to-create-random-colors-programmatically/
     '''
     rand = random.random()
     rand += 0.618033988749895
     rand %= 1
     '''
     phi = 0.618033988749895
     hue = self.openCollectionIdx * phi - floor(self.openCollectionIdx * phi)
     newColor.setHsv(int(hue*256), 120 + int(random.random()*(240-120+1)), 242)
     self.colors.append(newColor)