def test_gradient(self):
   gs=[gfx.Gradient(),
       gfx.Gradient({0.0: [1,0,0], 1.0: gfx.Color(0,1,0)}),
       gfx.Gradient([[1,0,0], gfx.Color(0,1,0)])]
   gs[0].SetColorAt(0.0,gfx.Color(1.0,0.0,0.0))
   gs[0].SetColorAt(1.0,gfx.Color(0.0,1.0,0.0))
   for g in gs:
     self.assertAlmostEqual(col_delta(g.GetColorAt(0.0),gfx.Color(1.0,0,0)),0.0)
     self.assertAlmostEqual(col_delta(g.GetColorAt(0.5),gfx.Color(0.5,0.5,0)),0.0)
     self.assertAlmostEqual(col_delta(g.GetColorAt(1.0),gfx.Color(0,1.0,0)),0.0)
Exemple #2
0
 def GetGfxGradient(self):
     gradient = gfx.Gradient()
     for s in self.stops:
         c = s.GetColor()
         gradient.SetColorAt(s.GetRel(),
                             gfx.RGB(c.redF(), c.greenF(), c.blueF()))
     return gradient
Exemple #3
0
 def ConvertToGfxGradient(self, gradient):
     gfxgradient = gfx.Gradient()
     for s in gradient.stops():
         rel = s[0]
         color = s[1]
         gfxgradient.SetColorAt(
             s[0], gfx.RGB(s[1].redF(), s[1].greenF(), s[1].blueF()))
     return gfxgradient
Exemple #4
0
    def __init__(self, text, parent=None):
        QtWidgets.QWidget.__init__(self, parent)
        self.parent_ = parent

        #Title
        self.text_ = text

        #UI
        text_label = QtWidgets.QLabel(text)
        font = text_label.font()
        font.setBold(True)

        grid = QtWidgets.QGridLayout()
        grid.addWidget(text_label, 0, 0, 1, 1)
        grid.setRowStretch(2, 1)
        self.setLayout(grid)
        self.setMinimumSize(250, 60)

        self.gradient_ = gfx.Gradient("RAINBOW")