def __init__(self, camera, auto_connect=True): super(LumeneraCameraControlWidget, self).__init__(camera, auto_connect=False) gb = QuickControlBox() gb.add_doublespinbox("exposure") gb.add_doublespinbox("gain") gb.add_button("show_camera_properties_dialog", title="Camera Setup") gb.add_button("show_video_format_dialog", title="Video Format") 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=False)
def __init__(self, camera, auto_connect=True): super(TimelapseCameraControlWidget, self).__init__(camera, auto_connect=False) gb = QuickControlBox() gb.add_doublespinbox("exposure") gb.add_spinbox("timelapse_n") gb.add_doublespinbox("timelapse_dt") gb.add_button("take_timelapse", title="Acquire Timelapse") 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=False)
def __init__(self, camera, auto_connect=True): super(MyCameraControlWidget, self).__init__(camera, auto_connect=False) 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=False)
def __init__(self, camera, auto_connect=True): super(MyCameraControlWidget, self).__init__(camera, auto_connect=False) # gb = QtGui.QGroupBox() # self.quick_settings_groupbox = gb # gb.setTitle("Quick Settings") # 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)
def get_qt_ui(self): """Return a user interface for the experiment""" gb = QuickControlBox("Irradiation Experiment") gb.add_doublespinbox("irradiation_time") gb.add_doublespinbox("wait_time") gb.add_button("start") gb.add_button("stop") gb.auto_connect_by_name(self) return gb
# 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()
def __init__(self, cwl): super(CameraWithLocationControlUI, self).__init__() self.cwl = cwl cc = QuickControlBox("Settings") cc.add_doublespinbox("calibration_distance") cc.add_button("calibrate_xy_gui", "Calibrate XY") cc.add_button('load_calibration_gui', 'Load Calibration') cc.auto_connect_by_name(self) self.calibration_controls = cc fc = QuickControlBox("Autofocus") fc.add_doublespinbox("af_step_size") fc.add_spinbox("af_steps") fc.add_button("autofocus_gui", "Autofocus") fc.add_button("quick_autofocus_gui", "Quick Autofocus") fc.auto_connect_by_name(self.cwl) self.focus_controls = fc # sc = l = QtWidgets.QHBoxLayout() l.addWidget(cc) l.addWidget(fc) self.setLayout(l)
def get_control_widget(self): """Return a widget that controls the experiment's settings.""" return QuickControlBox()
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_())