Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added special axis options for SMC100 in GUI #16

Merged
merged 1 commit into from
Nov 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Loading