BioImager  3.9.1
A .NET microscopy imaging library. Supports various microscopes by using imported libraries & GUI automation. Supported libraries include PriorĀ® & ZeissĀ® & all devices supported by Micromanager 2.0 and python-microscope.
Loading...
Searching...
No Matches
microscope.gui.LightSourceWidget Class Reference
Inheritance diagram for microscope.gui.LightSourceWidget:

Public Member Functions

None __init__ (self, microscope.abc.LightSource device, *args, **kwargs)
 
None updateEnableState (self)
 
None updateCurrentPower (self)
 

Detailed Description

Definition at line 345 of file gui.py.

Constructor & Destructor Documentation

◆ __init__()

None microscope.gui.LightSourceWidget.__init__ (   self,
microscope.abc.LightSource  device,
args,
**  kwargs 
)

Definition at line 346 of file gui.py.

348 ) -> None:
349 super().__init__(*args, **kwargs)
350 self._device = device
351
352 self._enable_check = QtWidgets.QCheckBox("Enabled", parent=self)
353 self._enable_check.stateChanged.connect(self.updateEnableState)
354
355 self._set_power_box = QtWidgets.QDoubleSpinBox(parent=self)
356 self._set_power_box.setMinimum(0.0)
357 self._set_power_box.setMaximum(1.0)
358 self._set_power_box.setValue(self._device.power)
359 self._set_power_box.setSingleStep(0.01)
360 self._set_power_box.setAlignment(QtCore.Qt.AlignRight)
361 self._set_power_box.valueChanged.connect(
362 lambda x: setattr(self._device, "power", x)
363 )
364
365 self._current_power = QtWidgets.QLineEdit(
366 str(self._device.power), parent=self
367 )
368 self._current_power.setReadOnly(True)
369 self._current_power.setAlignment(QtCore.Qt.AlignRight)
370
371 self._get_power_timer = QtCore.QTimer(self)
372 self._get_power_timer.timeout.connect(self.updateCurrentPower)
373 self._get_power_timer.setInterval(500) # msec
374
375 self.updateEnableState()
376
377 layout = QtWidgets.QVBoxLayout()
378 layout.addWidget(self._enable_check)
379 power_layout = QtWidgets.QFormLayout()
380 power_layout.addRow("Set power", self._set_power_box)
381 power_layout.addRow("Current power", self._current_power)
382 layout.addLayout(power_layout)
383 self.setLayout(layout)
384

Member Function Documentation

◆ updateCurrentPower()

None microscope.gui.LightSourceWidget.updateCurrentPower (   self)

Definition at line 408 of file gui.py.

408 def updateCurrentPower(self) -> None:
409 self._current_power.setText(str(self._device.power))
410
411

◆ updateEnableState()

None microscope.gui.LightSourceWidget.updateEnableState (   self)
Update UI and light source state after enable check box

Definition at line 385 of file gui.py.

385 def updateEnableState(self) -> None:
386 """Update UI and light source state after enable check box"""
387 if self._enable_check.isChecked():
388 self._device.enable()
389 else:
390 self._device.disable()
391
392 device_is_enabled = self._device.get_is_enabled()
393
394 if self._enable_check.isChecked() != device_is_enabled:
395 self._enable_check.setChecked(device_is_enabled)
396 _logger.error(
397 "failed to %s light",
398 "enable" if self._enable_check.isChecked() else "disable",
399 )
400
401 self._current_power.setEnabled(device_is_enabled)
402 if device_is_enabled:
403 self._get_power_timer.start()
404 else:
405 self._get_power_timer.stop()
406 self._current_power.setText("0.0")
407

References microscope.gui.LightSourceWidget._current_power, microscope.gui.DeviceSettingsWidget._device, microscope.gui.ControllerWidget._device, microscope.gui.CameraWidget._device, microscope.gui.DeformableMirrorWidget._device, microscope.gui.FilterWheelWidget._device, microscope.gui.LightSourceWidget._device, microscope.gui.StageWidget._device, microscope.gui.CameraWidget._enable_check, microscope.gui.LightSourceWidget._enable_check, and microscope.gui.LightSourceWidget._get_power_timer.


The documentation for this class was generated from the following file: