Skip to content

Commit

Permalink
Added special axis options for SMC100 in GUI
Browse files Browse the repository at this point in the history
  • Loading branch information
kingofpayne committed Sep 17, 2024
1 parent f2fd098 commit 93d6206
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion pystages/gui/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ def connect(self, on_off):
elif selected == StageType.Corvus:
self.stage = Corvus(dev)
elif selected == StageType.SMC:
self.stage = SMC100(dev, [1, 2])
axis = [int(x) for x in self.lineedit_smc100_axis.text().split(",")]
self.stage = SMC100(dev, axis)
elif selected == StageType.M3FS:
self.stage = M3FS(dev, baudrate=115200)
self.position_timer.start(100)
Expand All @@ -60,6 +61,7 @@ def connect(self, on_off):

self.stage_selection.setDisabled(on_off)
self.port_selection.setDisabled(on_off)
self.lineedit_smc100_axis.setDisabled(on_off)

self.set_controls_enabled(on_off)

Expand Down Expand Up @@ -88,6 +90,7 @@ def __init__(self):
box.addWidget(w)
self.stage_selection = w = QComboBox()
w.addItems([StageType.CNC, StageType.Corvus, StageType.SMC, StageType.M3FS])
w.currentIndexChanged.connect(self.update_stage_options)
box.addWidget(w)
self.port_selection = w = QComboBox()
w.addItem("Auto detection", None)
Expand All @@ -106,6 +109,17 @@ def __init__(self):
w.clicked.connect(self.connect)
box.addWidget(w)

# SMC100 options
hbox_widget = self.widget_smc100 = QWidget()
hbox = QHBoxLayout()
hbox.setContentsMargins(0, 0, 0, 0)
hbox_widget.setLayout(hbox)
vbox.addWidget(hbox_widget)
hbox.addWidget(QLabel("SMC100 Axis"))
self.lineedit_smc100_axis = w = QLineEdit("1, 2")
hbox.addWidget(w)
self.widget_smc100.hide()

box = QHBoxLayout()
vbox.addLayout(box)
box.addWidget(QLabel("Step"))
Expand Down Expand Up @@ -239,3 +253,7 @@ def go_to_position(self):
pos.y = y
pos.z = z
self.stage.move_to(pos)

def update_stage_options(self, index):
model = self.stage_selection.currentText()
self.widget_smc100.setVisible(model == StageType.SMC)

0 comments on commit 93d6206

Please sign in to comment.