def _update_widgets(self):
        _BaseColorsWidget._update_widgets(self)
        color = self._model.color
        c, m, y, k = self._get_color_params(color)
        self._widget_0.set_gradient_stops(
            [(x / 100, QColor.fromCmykF(x / 100., m, y, k)) for x in range(101)])

        self._widget_1.set_gradient_stops(
            [(x / 100, QColor.fromCmykF(c, x / 100., y, k)) for x in range(101)])

        self._widget_2.set_gradient_stops(
            [(x / 100, QColor.fromCmykF(c, m, x / 100., k)) for x in range(101)])

        self._widget_3.set_gradient_stops(
            [(x / 100, QColor.fromCmykF(c, m, y, x / 100)) for x in range(101)])
def test_choose_color_widget(qtapi, choose_color_widget):
    from pyvmmonitor_qt.qt_event_loop import process_events
    from pyvmmonitor_qt.qt.QtGui import QColor

    process_events()
    color_wheel_widget = choose_color_widget.color_wheel_widget
    choose_color_widget.color_wheel_widget.repaint()
    pixmap_size = choose_color_widget.color_wheel_widget._pixmap.size()

    # Just checking that the color wheel was built on paint
    assert pixmap_size.width() > 30
    assert pixmap_size.height() > 30
    assert color_wheel_widget.width() > pixmap_size.width()
    assert color_wheel_widget.height() > pixmap_size.height()

    center = color_wheel_widget._center

    assert color_wheel_widget.saturation_from_point(center[0],
                                                    center[1]) == 0.0
    assert color_wheel_widget.saturation_from_point(pixmap_size.width(),
                                                    0.0) == 1.0

    choose_color_widget.model.color = QColor.fromCmykF(0.000000, 0.000000,
                                                       0.000000, 0.000000,
                                                       1.000000)
    def _update_widgets(self):
        _BaseColorsWidget._update_widgets(self)
        color = self._model.color
        c, m, y, k = self._get_color_params(color)
        self._widget_0.set_gradient_stops([
            (x / 100, QColor.fromCmykF(x / 100., m, y, k)) for x in range(101)
        ])

        self._widget_1.set_gradient_stops([
            (x / 100, QColor.fromCmykF(c, x / 100., y, k)) for x in range(101)
        ])

        self._widget_2.set_gradient_stops([
            (x / 100, QColor.fromCmykF(c, m, x / 100., k)) for x in range(101)
        ])

        self._widget_3.set_gradient_stops([
            (x / 100, QColor.fromCmykF(c, m, y, x / 100)) for x in range(101)
        ])
def test_choose_color_widget(qtapi, choose_color_widget):
    from pyvmmonitor_qt.qt_event_loop import process_events
    from pyvmmonitor_qt.qt.QtGui import QColor

    process_events()
    color_wheel_widget = choose_color_widget.color_wheel_widget
    choose_color_widget.color_wheel_widget.repaint()
    pixmap_size = choose_color_widget.color_wheel_widget._pixmap.size()

    # Just checking that the color wheel was built on paint
    assert pixmap_size.width() > 30
    assert pixmap_size.height() > 30
    assert color_wheel_widget.width() > pixmap_size.width()
    assert color_wheel_widget.height() > pixmap_size.height()

    center = color_wheel_widget._center

    assert color_wheel_widget.saturation_from_point(center[0], center[1]) == 0.0
    assert color_wheel_widget.saturation_from_point(pixmap_size.width(), 0.0) == 1.0

    choose_color_widget.model.color = QColor.fromCmykF(
        0.000000, 0.000000, 0.000000, 0.000000, 1.000000)
 def _create_color_from_params(self, params):
     return QColor.fromCmykF(*params)
 def _create_color_from_params(self, params):
     return QColor.fromCmykF(*params)