def __init__( self, parent: QWidget, lcrmeter: LCRMeterIM3536, lcrmeter_status: DeviceStatus, stage_controller: StageControllerShot702, stage_controller_status: DeviceStatus, ) -> None: super().__init__(parent=parent) self._lcrmeter = lcrmeter self._lcrmeter_status = lcrmeter_status self._stage_controller = stage_controller self._stage_controller_status = stage_controller_status self._lcr_combobox_port = PortCombobox(LCRMeterIM3536.PORT_FILTER) self._lcr_combobox_baudrate = QComboBox() self._lcr_t_btn_connect = create_tool_button(is_text_beside_icon=True) self._stage_combobox_port = PortCombobox("") self._stage_t_btn_connect = create_tool_button( is_text_beside_icon=True) self._action_connect_lcr = create_action( self, text="Connect Port", icon=create_qicon(IconNames.ADD_GREEN), triggered=self._connect_lcr, ) self._action_disconnect_lcr = create_action( self, text="Disconnect Port", icon=create_qicon(IconNames.REMOVE_RED), triggered=self._disconnect_lcr, ) self._action_connect_stage_controller = create_action( self, text="Connect Port", icon=create_qicon(IconNames.ADD_GREEN), triggered=self._connect_stage_controller, ) self._action_disconnect_stage_controller = create_action( self, text="Disconnect Port", icon=create_qicon(IconNames.REMOVE_RED), triggered=self._disconnect_stage_controller, ) self._setup()
def change_step_mode(self): self.update_icon(create_qicon(IconNames.DYNAMIC_GROUP_WHITE)) self.update_tool_tip("Step Mode")
def change_lcr_mode(self): self.update_icon(create_qicon(IconNames.DYNAMIC_GROUP_WHITE)) self.update_tool_tip("Only LCR Mode")
def change_cycle_mode(self): self.update_icon(create_qicon(IconNames.DYNAMIC_GROUP_WHITE)) self.update_tool_tip("Cycle Mode")
def change_disconnecting(self): """Switch to disconnecting mode of this widget.""" self.update_icon(create_qicon(IconNames.CONNECT_UNPLUGGED_WHITE)) self.update_tool_tip(f"{self._device_name} Disconnecting")
def change_stopping(self): """Switch to stopping mode of this widget.""" self.update_icon(create_qicon(IconNames.PAUSE_CIRCLE_RED)) self.update_tool_tip("Stopping")
def change_running(self): """Switch to running mode of this widget.""" self.update_icon(create_qicon(IconNames.PLAY_CIRCLE_GREEN)) self.update_tool_tip("Running")
def __init__( self, controller: StageControllerShot702, controller_status: DeviceStatus, parent: QWidget = None, ): super().__init__(parent=parent) self._controller = controller self._controller_status = controller_status self._lcd_position = ALabel() self._int_slider = IntSlider() self._t_btn_up = create_tool_button( arrow_type=Qt.UpArrow, fixed_height=50, fixed_width=50, toggled=self.up_stage, ) self._t_btn_down = create_tool_button( arrow_type=Qt.DownArrow, fixed_height=50, fixed_width=50, icon_size=QSize(30, 30), toggled=self.down_stage, ) self._t_btn_stop = create_tool_button( fixed_width=50, fixed_height=50, icon=create_qicon(IconNames.STOP_WHITE), icon_size=QSize(70, 70), toggled=self.stop_stage, ) self._p_button_fix_zero = create_push_button(clicked=self.fix_zero, text="Fix Zero") self._p_button_move_machine_zero = create_push_button( clicked=self.move_to_machine_zero, text="Move Machine Zero-Point") self._p_button_set_speed = create_push_button( clicked=self.set_stage_speed, fixed_width=100, text="Set") # timer self.timer_measure_position = create_timer( parent=self, timeout=self.measure_position) # setup self._int_slider.range = 1, 50000 button_group = QButtonGroup(self) button_group.addButton(self._t_btn_up) button_group.addButton(self._t_btn_stop) button_group.addButton(self._t_btn_down) button_group.setExclusive(True) # setup layout v_layout_control = AVBoxLayout() v_layout_control.addWidget(self._t_btn_up) v_layout_control.addWidget(self._t_btn_stop) v_layout_control.addWidget(self._t_btn_down) v_layout_control.setAlignment(Qt.AlignHCenter) group_control = QGroupBox("Control") group_control.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) group_control.setLayout(v_layout_control) h_layout_position = AHBoxLayout() h_layout_position.addWidget(add_unit(self._lcd_position, "μm")) group_position = QGroupBox("Current Position") group_position.setLayout(h_layout_position) v_layout_origin = AVBoxLayout() v_layout_origin.addWidget(self._p_button_fix_zero) v_layout_origin.addWidget(self._p_button_move_machine_zero) group_origin = QGroupBox("Origin") group_origin.setLayout(v_layout_origin) v_layout_speed = AVBoxLayout() v_layout_speed.addWidget(add_unit(self._int_slider, "μm/msec")) v_layout_speed.addWidget(self._p_button_set_speed, alignment=Qt.AlignRight) group_speed = QGroupBox("Speed Setting") group_speed.setLayout(v_layout_speed) g_layout = QGridLayout() g_layout.addWidget(group_control, 1, 1, 2, 1) g_layout.addWidget(group_position, 1, 2) g_layout.addWidget(group_origin, 2, 2) g_layout.addWidget(group_speed, 3, 1, 1, 2) self.setLayout(g_layout)