Beispiel #1
0
    def test_controls(self):

        c1 = Control('a', value=1, constraints=dict(min=1, max=2))
        assert c1.interface.min == 1
        assert c1.interface.max == 2
        assert c1.value == 1
        self.assertEqual(repr(c1.interface), 'IInt(min=1, max=2, step=1)')

        c2 = Control('a', 'IInt', constraints=dict(min=3, max=4))
        assert c2.interface.min == 3
        assert c2.interface.max == 4
        #assert c2.value == 3

        c3 = Control('a', 'IInt', constraints=dict(min=5, max=6))

        c4 = Control('a', 'IInt')
        c5 = Control('a', value=4)

        cb1 = create_control('a', value=1, constraints=dict(min=1, max=2))
        cb2 = create_control('a', 'IInt', constraints=dict(min=3, max=4))
        cb3 = create_control('a', 'IInt', value=0, constraints=dict(min=5, max=6))
        cb4 = create_control('a', 'IInt')
        cb5 = create_control('a', value=4)

        self.compare_controls(c1, cb1)
        self.compare_controls(c2, cb2)
        self.compare_controls(c3, cb3)
        self.compare_controls(c4, cb4)
        self.compare_controls(c5, cb5)
Beispiel #2
0
    def test_controls(self):

        c1 = Control('a', value=1, constraints=dict(min=1, max=2))
        assert c1.interface.min == 1
        assert c1.interface.max == 2
        assert c1.value == 1
        self.assertEqual(repr(c1.interface), 'IInt(min=1, max=2, step=1)')

        c2 = Control('a', 'IInt', constraints=dict(min=3, max=4))
        assert c2.interface.min == 3
        assert c2.interface.max == 4
        #assert c2.value == 3

        c3 = Control('a', 'IInt', constraints=dict(min=5, max=6))

        c4 = Control('a', 'IInt')
        c5 = Control('a', value=4)

        cb1 = create_control('a', value=1, constraints=dict(min=1, max=2))
        cb2 = create_control('a', 'IInt', constraints=dict(min=3, max=4))
        cb3 = create_control('a', 'IInt', value=0, constraints=dict(min=5, max=6))
        cb4 = create_control('a', 'IInt')
        cb5 = create_control('a', value=4)

        self.compare_controls(c1, cb1)
        self.compare_controls(c2, cb2)
        self.compare_controls(c3, cb3)
        self.compare_controls(c4, cb4)
        self.compare_controls(c5, cb5)
from openalea.vpltk.qt import QtGui
from openalea.core.service.control import create_control
from openalea.oalab.service.qt_control import qt_editor

instance = QtGui.QApplication.instance()
if instance is None:
    app = QtGui.QApplication([])

control = create_control('i', 'IInt', 250, dict(min=200, max=300))
widget = qt_editor(control)
# widget.show()
assert control.value == 250
assert widget.value() == 250

#if instance is None:
#     app.exec_()
Beispiel #4
0
from openalea.vpltk.qt import QtGui
from openalea.core.service.control import create_control
from openalea.oalab.service.qt_control import qt_editor

instance = QtGui.QApplication.instance()
if instance is None:
    app = QtGui.QApplication([])


control = create_control('i', 'IInt', 250, dict(min=200, max=300))
widget = qt_editor(control)
# widget.show()
assert control.value == 250
assert widget.value() == 250

#if instance is None:
#     app.exec_()