Пример #1
0
        #        gb.setLayout(QtGui.QFormLayout())
        #
        #        self.gain_spinbox = QtGui.QDoubleSpinBox()
        #        self.gain_spinbox.setObjectName("gain_spinbox")
        #        print "gain spinbox is called " + self.gain_spinbox.objectName()
        #        gb.layout().addRow("Gain:",self.gain_spinbox)
        #        self.exposure_spinbox = QtGui.QDoubleSpinBox()
        #        self.exposure_spinbox.setObjectName("exposure_spinbox")
        #        gb.layout().addRow("Exposure:",self.exposure_spinbox)

        gb = QuickControlBox()
        gb.add_doublespinbox("gain")
        gb.add_doublespinbox("exposure")
        self.layout().insertWidget(1,
                                   gb)  # put the extra settings in the middle
        self.quick_settings_groupbox = gb

        self.auto_connect_by_name(controlled_object=self.camera, verbose=True)


if __name__ == '__main__':
    cam = MyOpenCVCamera()
    cam.show_gui()

    gb = QuickControlBox()
    gb.add_doublespinbox("gain")
    gb.add_checkbox("live_view")
    gb.auto_connect_by_name(cam, verbose=True)
    gb.show()
    cam.show_gui()
Пример #2
0
    def toggle(self):
        """toggle the state of the shutter"""
        self._open = not self._open

    def get_state(self):
        """Return the state of the shutter, a string reading 'open' or 'closed'"""
        return "Open" if self._open else "Closed"

    def set_state(self, value):
        """Set the state of the shutter (to open or closed)"""
        if isinstance(value, str):
            self._open = (value.lower() == "open")
        elif isinstance(value, bool):
            self._open = value


if __name__ == '__main__':
    import sys
    app = get_qt_app()
    shutter = DummyShutter()

    state_peek = QuickControlBox(title="Internal State")
    state_peek.add_checkbox("_open", title="Shutter Open")
    state_peek.auto_connect_by_name(controlled_object=shutter)
    state_peek.show()

    ui = shutter.get_qt_ui()
    ui.show()
    sys.exit(app.exec_())