def _update_widgets(self):
        _BaseColorsWidget._update_widgets(self)
        color = self._model.color
        r, g, b = self._get_color_params(color)
        self._widget_0.set_gradient_stops(
            [(x / 255, QColor.fromRgbF(x / 255., g, b)) for x in range(256)])

        self._widget_1.set_gradient_stops(
            [(x / 255, QColor.fromRgbF(r, x / 255., b)) for x in range(256)])

        self._widget_2.set_gradient_stops(
            [(x / 255, QColor.fromRgbF(r, g, x / 255.)) for x in range(256)])
def test_rgb_widget(qtapi, rgb_widget):
    from pyvmmonitor_qt.qt.QtGui import QColor
    assert rgb_widget.model is not None

    color = rgb_widget.model.color = QColor.fromRgbF(0.5, 0.5, 0.5)
    # Note: qt doesn't really store the original float for the later redF (it's re-normalized
    # based on 0-255.
    assert rgb_widget._r_widget._slider.value == 255 * color.redF()

    color = rgb_widget.model.color = QColor.fromRgbF(0.1, 0.5, 0.5)
    assert rgb_widget._r_widget._slider.value == 255 * color.redF()

    rgb_widget._r_widget._slider.value = 255 * .4
    assert rgb_widget.model.color == QColor.fromRgbF(0.4, 0.5, 0.5)
def test_rgb_widget(qtapi, rgb_widget):
    from pyvmmonitor_qt.qt.QtGui import QColor
    assert rgb_widget.model is not None

    color = rgb_widget.model.color = QColor.fromRgbF(0.5, 0.5, 0.5)
    # Note: qt doesn't really store the original float for the later redF (it's re-normalized
    # based on 0-255.
    assert rgb_widget._r_widget._slider.value == 255 * color.redF()

    color = rgb_widget.model.color = QColor.fromRgbF(0.1, 0.5, 0.5)
    assert rgb_widget._r_widget._slider.value == 255 * color.redF()

    rgb_widget._r_widget._slider.value = 255 * .4
    assert rgb_widget.model.color == QColor.fromRgbF(0.4, 0.5, 0.5)
    def _update_widgets(self):
        _BaseColorsWidget._update_widgets(self)
        color = self._model.color
        r, g, b = self._get_color_params(color)
        self._widget_0.set_gradient_stops([
            (x / 255, QColor.fromRgbF(x / 255., g, b)) for x in range(256)
        ])

        self._widget_1.set_gradient_stops([
            (x / 255, QColor.fromRgbF(r, x / 255., b)) for x in range(256)
        ])

        self._widget_2.set_gradient_stops([
            (x / 255, QColor.fromRgbF(r, g, x / 255.)) for x in range(256)
        ])
 def _update_widgets(self):
     color = self._model.color
     r, g, b = color.redF(), color.greenF(), color.blueF()
     self._widget_0.set_gradient_stops([
         (a / 255, QColor.fromRgbF(r, g, b, a / 255)) for a in range(256)
     ])
     self._widget_0.set_normalized_value(self._model.opacity / 255.)
 def _update_widgets(self):
     color = self._model.color
     r, g, b = color.redF(), color.greenF(), color.blueF()
     self._widget_0.set_gradient_stops(
         [(a / 255, QColor.fromRgbF(r, g, b, a / 255)) for a in range(256)])
     self._widget_0.set_normalized_value(self._model.opacity / 255.)
 def _create_color_from_params(self, params):
     return QColor.fromRgbF(*params)
 def _create_color_from_params(self, params):
     return QColor.fromRgbF(*params)