Skip to content

Commit 8222e49

Browse files
committed
line edit; more steps etc etc
1 parent d7431f3 commit 8222e49

File tree

2 files changed

+87
-119
lines changed

2 files changed

+87
-119
lines changed

needles2/coverageUI.ui

Lines changed: 66 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<rect>
2525
<x>10</x>
2626
<y>10</y>
27-
<width>271</width>
27+
<width>291</width>
2828
<height>171</height>
2929
</rect>
3030
</property>
@@ -53,25 +53,6 @@
5353
<string>x:</string>
5454
</property>
5555
</widget>
56-
<widget class="QLabel" name="x_label">
57-
<property name="geometry">
58-
<rect>
59-
<x>30</x>
60-
<y>10</y>
61-
<width>60</width>
62-
<height>30</height>
63-
</rect>
64-
</property>
65-
<property name="font">
66-
<font>
67-
<weight>50</weight>
68-
<bold>false</bold>
69-
</font>
70-
</property>
71-
<property name="text">
72-
<string/>
73-
</property>
74-
</widget>
7556
<widget class="QLabel" name="ytitle_label">
7657
<property name="geometry">
7758
<rect>
@@ -85,25 +66,6 @@
8566
<string>y:</string>
8667
</property>
8768
</widget>
88-
<widget class="QLabel" name="y_label">
89-
<property name="geometry">
90-
<rect>
91-
<x>30</x>
92-
<y>40</y>
93-
<width>60</width>
94-
<height>30</height>
95-
</rect>
96-
</property>
97-
<property name="font">
98-
<font>
99-
<weight>50</weight>
100-
<bold>false</bold>
101-
</font>
102-
</property>
103-
<property name="text">
104-
<string/>
105-
</property>
106-
</widget>
10769
<widget class="QLabel" name="dtitle_label">
10870
<property name="geometry">
10971
<rect>
@@ -117,25 +79,6 @@
11779
<string>depth: </string>
11880
</property>
11981
</widget>
120-
<widget class="QLabel" name="d_label">
121-
<property name="geometry">
122-
<rect>
123-
<x>60</x>
124-
<y>70</y>
125-
<width>60</width>
126-
<height>30</height>
127-
</rect>
128-
</property>
129-
<property name="font">
130-
<font>
131-
<weight>50</weight>
132-
<bold>false</bold>
133-
</font>
134-
</property>
135-
<property name="text">
136-
<string/>
137-
</property>
138-
</widget>
13982
<widget class="QLabel" name="ttitle_label">
14083
<property name="geometry">
14184
<rect>
@@ -149,25 +92,6 @@
14992
<string>theta:</string>
15093
</property>
15194
</widget>
152-
<widget class="QLabel" name="t_label">
153-
<property name="geometry">
154-
<rect>
155-
<x>60</x>
156-
<y>100</y>
157-
<width>60</width>
158-
<height>30</height>
159-
</rect>
160-
</property>
161-
<property name="font">
162-
<font>
163-
<weight>50</weight>
164-
<bold>false</bold>
165-
</font>
166-
</property>
167-
<property name="text">
168-
<string/>
169-
</property>
170-
</widget>
17195
<widget class="QLabel" name="lptitle_label">
17296
<property name="geometry">
17397
<rect>
@@ -181,29 +105,10 @@
181105
<string>phi:</string>
182106
</property>
183107
</widget>
184-
<widget class="QLabel" name="p_label">
185-
<property name="geometry">
186-
<rect>
187-
<x>50</x>
188-
<y>130</y>
189-
<width>50</width>
190-
<height>30</height>
191-
</rect>
192-
</property>
193-
<property name="font">
194-
<font>
195-
<weight>50</weight>
196-
<bold>false</bold>
197-
</font>
198-
</property>
199-
<property name="text">
200-
<string/>
201-
</property>
202-
</widget>
203108
<widget class="QComboBox" name="x_comboBox">
204109
<property name="geometry">
205110
<rect>
206-
<x>200</x>
111+
<x>220</x>
207112
<y>15</y>
208113
<width>60</width>
209114
<height>20</height>
@@ -219,7 +124,7 @@
219124
<widget class="QComboBox" name="y_comboBox">
220125
<property name="geometry">
221126
<rect>
222-
<x>200</x>
127+
<x>220</x>
223128
<y>45</y>
224129
<width>60</width>
225130
<height>20</height>
@@ -235,7 +140,7 @@
235140
<widget class="QComboBox" name="d_comboBox">
236141
<property name="geometry">
237142
<rect>
238-
<x>200</x>
143+
<x>220</x>
239144
<y>75</y>
240145
<width>60</width>
241146
<height>20</height>
@@ -251,7 +156,7 @@
251156
<widget class="QComboBox" name="t_comboBox">
252157
<property name="geometry">
253158
<rect>
254-
<x>200</x>
159+
<x>220</x>
255160
<y>105</y>
256161
<width>60</width>
257162
<height>20</height>
@@ -267,7 +172,7 @@
267172
<widget class="QComboBox" name="p_comboBox">
268173
<property name="geometry">
269174
<rect>
270-
<x>200</x>
175+
<x>220</x>
271176
<y>135</y>
272177
<width>60</width>
273178
<height>20</height>
@@ -283,7 +188,7 @@
283188
<widget class="QPushButton" name="yplus_pushButton">
284189
<property name="geometry">
285190
<rect>
286-
<x>120</x>
191+
<x>140</x>
287192
<y>45</y>
288193
<width>30</width>
289194
<height>20</height>
@@ -296,7 +201,7 @@
296201
<widget class="QPushButton" name="dplus_pushButton">
297202
<property name="geometry">
298203
<rect>
299-
<x>120</x>
204+
<x>140</x>
300205
<y>75</y>
301206
<width>30</width>
302207
<height>20</height>
@@ -309,7 +214,7 @@
309214
<widget class="QPushButton" name="xplus_pushButton">
310215
<property name="geometry">
311216
<rect>
312-
<x>120</x>
217+
<x>140</x>
313218
<y>15</y>
314219
<width>30</width>
315220
<height>20</height>
@@ -322,7 +227,7 @@
322227
<widget class="QPushButton" name="tplus_pushButton">
323228
<property name="geometry">
324229
<rect>
325-
<x>120</x>
230+
<x>140</x>
326231
<y>105</y>
327232
<width>30</width>
328233
<height>20</height>
@@ -335,7 +240,7 @@
335240
<widget class="QPushButton" name="pplus_pushButton">
336241
<property name="geometry">
337242
<rect>
338-
<x>120</x>
243+
<x>140</x>
339244
<y>135</y>
340245
<width>30</width>
341246
<height>20</height>
@@ -348,7 +253,7 @@
348253
<widget class="QPushButton" name="xminus_pushButton">
349254
<property name="geometry">
350255
<rect>
351-
<x>160</x>
256+
<x>180</x>
352257
<y>15</y>
353258
<width>30</width>
354259
<height>20</height>
@@ -361,7 +266,7 @@
361266
<widget class="QPushButton" name="yminus_pushButton">
362267
<property name="geometry">
363268
<rect>
364-
<x>160</x>
269+
<x>180</x>
365270
<y>45</y>
366271
<width>30</width>
367272
<height>20</height>
@@ -374,7 +279,7 @@
374279
<widget class="QPushButton" name="dminus_pushButton">
375280
<property name="geometry">
376281
<rect>
377-
<x>160</x>
282+
<x>180</x>
378283
<y>75</y>
379284
<width>30</width>
380285
<height>20</height>
@@ -387,7 +292,7 @@
387292
<widget class="QPushButton" name="tminus_pushButton">
388293
<property name="geometry">
389294
<rect>
390-
<x>160</x>
295+
<x>180</x>
391296
<y>105</y>
392297
<width>30</width>
393298
<height>20</height>
@@ -400,7 +305,7 @@
400305
<widget class="QPushButton" name="pminus_pushButton">
401306
<property name="geometry">
402307
<rect>
403-
<x>160</x>
308+
<x>180</x>
404309
<y>135</y>
405310
<width>30</width>
406311
<height>20</height>
@@ -410,6 +315,56 @@
410315
<string>-</string>
411316
</property>
412317
</widget>
318+
<widget class="QLineEdit" name="x_label">
319+
<property name="geometry">
320+
<rect>
321+
<x>30</x>
322+
<y>15</y>
323+
<width>80</width>
324+
<height>20</height>
325+
</rect>
326+
</property>
327+
</widget>
328+
<widget class="QLineEdit" name="y_label">
329+
<property name="geometry">
330+
<rect>
331+
<x>30</x>
332+
<y>45</y>
333+
<width>80</width>
334+
<height>20</height>
335+
</rect>
336+
</property>
337+
</widget>
338+
<widget class="QLineEdit" name="d_label">
339+
<property name="geometry">
340+
<rect>
341+
<x>50</x>
342+
<y>75</y>
343+
<width>61</width>
344+
<height>20</height>
345+
</rect>
346+
</property>
347+
</widget>
348+
<widget class="QLineEdit" name="t_label">
349+
<property name="geometry">
350+
<rect>
351+
<x>50</x>
352+
<y>105</y>
353+
<width>61</width>
354+
<height>20</height>
355+
</rect>
356+
</property>
357+
</widget>
358+
<widget class="QLineEdit" name="p_label">
359+
<property name="geometry">
360+
<rect>
361+
<x>50</x>
362+
<y>135</y>
363+
<width>61</width>
364+
<height>20</height>
365+
</rect>
366+
</property>
367+
</widget>
413368
</widget>
414369
</widget>
415370
<resources/>

needles2/run_needles2.py

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -377,11 +377,17 @@ def __init__(self, qmain: MainWindow):
377377
self.pplus_pushButton.clicked.connect(lambda: self.ctrl.increase_value('p'))
378378

379379
self.xminus_pushButton.clicked.connect(lambda: self.ctrl.decrease_value('x'))
380-
self.yminus_pushButton.clicked.connect(lambda: self.ctrl.decrease_value('d'))
381-
self.dminus_pushButton.clicked.connect(lambda: self.ctrl.decrease_value('y'))
380+
self.yminus_pushButton.clicked.connect(lambda: self.ctrl.decrease_value('y'))
381+
self.dminus_pushButton.clicked.connect(lambda: self.ctrl.decrease_value('d'))
382382
self.tminus_pushButton.clicked.connect(lambda: self.ctrl.decrease_value('t'))
383383
self.pminus_pushButton.clicked.connect(lambda: self.ctrl.decrease_value('p'))
384384

385+
self.x_label.returnPressed.connect(self.set_values)
386+
self.y_label.returnPressed.connect(self.set_values)
387+
self.d_label.returnPressed.connect(self.set_values)
388+
self.t_label.returnPressed.connect(self.set_values)
389+
self.p_label.returnPressed.connect(self.set_values)
390+
385391
self.update_labels()
386392

387393
def populate_combobox(self, combobox, values):
@@ -404,6 +410,14 @@ def update_view(self):
404410
self.update_labels()
405411
self.qmain.add_extra_coverage(self.ctrl.model.get_traj())
406412

413+
def set_values(self):
414+
self.ctrl.set_value(int(self.x_label.text()), 'x')
415+
self.ctrl.set_value(int(self.y_label.text()), 'y')
416+
self.ctrl.set_value(int(self.d_label.text()), 'd')
417+
self.ctrl.set_value(int(self.t_label.text()), 't')
418+
self.ctrl.set_value(int(self.p_label.text()), 'p')
419+
self.update_view()
420+
407421

408422
class CoverageController:
409423
def __init__(self, view: CoverageView):
@@ -436,11 +450,11 @@ def set_value(self, value, target):
436450
class CoverageModel:
437451
def __init__(self):
438452
self.data = {'x': {}, 'y': {}, 'd': {}, 't': {}, 'p': {}}
439-
self.x_steps = [10, 50]
440-
self.y_steps = [10, 50]
441-
self.d_steps = [50, 100]
442-
self.t_steps = [1, 5]
443-
self.p_steps = [1, 5]
453+
self.x_steps = [100, 500, 50, 10]
454+
self.y_steps = [100, 500, 50, 10]
455+
self.d_steps = [100, 500, 50, 10]
456+
self.t_steps = [5, 1, 10]
457+
self.p_steps = [5, 1, 10]
444458
self.x_minmax = [None, None]
445459
self.y_minmax = [None, None]
446460
self.d_minmax = [None, None]
@@ -770,7 +784,6 @@ def set_slice(self):
770784
self.set_image(layer.image_item, _slice, dw, dh, wl[0], hl[0], **layer.pg_kwargs)
771785

772786

773-
774787
@dataclass
775788
class ImageLayer:
776789
"""

0 commit comments

Comments
 (0)