Skip to content

Commit 85c397c

Browse files
committed
In control panel's 'Stage (XYZ)', add Z control (ugly but very useful)
1 parent a6cb1f4 commit 85c397c

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/instamatic/gui/ctrl_frame.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def __init__(self, parent):
4848
Label(frame, text='Angle (0)', width=20).grid(row=2, column=0, sticky='W')
4949
Label(frame, text='Angle (+)', width=20).grid(row=3, column=0, sticky='W')
5050
Label(frame, text='Alpha wobbler (±)', width=20).grid(row=4, column=0, sticky='W')
51-
Label(frame, text='Stage (XY)', width=20).grid(row=6, column=0, sticky='W')
51+
Label(frame, text='Stage (XYZ)', width=20).grid(row=6, column=0, sticky='W')
5252

5353
angle = {'width': 10, 'from_': -90, 'to': 90, 'increment': 5}
5454
angle_i1 = {**angle, 'increment': 1}
@@ -75,6 +75,8 @@ def __init__(self, parent):
7575
e_stage_x.grid(row=6, column=1, sticky='EW')
7676
e_stage_y = Spinbox(frame, textvariable=self.var_stage_y, **stage)
7777
e_stage_y.grid(row=6, column=2, sticky='EW')
78+
e_stage_z = Spinbox(frame, textvariable=self.var_stage_z, **stage)
79+
e_stage_z.grid(row=6, column=3, sticky='EW')
7880

7981
if config.settings.use_goniotool:
8082
Label(frame, text='Rot. Speed', width=20).grid(row=5, column=0, sticky='W')
@@ -97,9 +99,9 @@ def __init__(self, parent):
9799
b_positive_angle.grid(row=3, column=2, sticky='W')
98100

99101
b_stage = Button(frame, text='Set', command=self.set_stage)
100-
b_stage.grid(row=6, column=3, sticky='W')
102+
b_stage.grid(row=6, column=4, sticky='W')
101103
b_stage_get = Button(frame, text='Get', command=self.get_stage)
102-
b_stage_get.grid(row=6, column=4, sticky='W')
104+
b_stage_get.grid(row=6, column=5, sticky='W')
103105

104106
# defocus button
105107
Label(frame, text='Diff defocus', width=20).grid(row=13, column=0, sticky='W')
@@ -196,6 +198,7 @@ def init_vars(self):
196198

197199
self.var_stage_x = IntVar(value=0)
198200
self.var_stage_y = IntVar(value=0)
201+
self.var_stage_z = IntVar(value=0)
199202

200203
self.var_goniotool_tx = IntVar(value=1)
201204

@@ -272,16 +275,18 @@ def set_stage(self):
272275
'task': 'stage.set',
273276
'x': self.var_stage_x.get(),
274277
'y': self.var_stage_y.get(),
278+
'z': self.var_stage_z.get(),
275279
'wait': self.var_stage_wait.get(),
276280
},
277281
)
278282
)
279283
self.triggerEvent.set()
280284

281285
def get_stage(self, event=None):
282-
x, y, _, _, _ = self.ctrl.stage.get()
286+
x, y, z, _, _ = self.ctrl.stage.get()
283287
self.var_stage_x.set(round(x))
284288
self.var_stage_y.set(round(y))
289+
self.var_stage_z.set(round(z))
285290

286291
def toggle_alpha_wobbler(self):
287292
if self.var_alpha_wobbler_on.get():

0 commit comments

Comments
 (0)