Skip to content

Commit 6b9da17

Browse files
authored
Merge pull request #1509 from HEXRD/structureless-params-resource
Move structureless params yaml file to resources
2 parents 504c046 + 93af299 commit 6b9da17

File tree

4 files changed

+142
-123
lines changed

4 files changed

+142
-123
lines changed

hexrd/ui/calibration/structureless/calibration_dialog.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
)
1111
from hexrd.ui.pinhole_correction_editor import PinholeCorrectionEditor
1212
from hexrd.ui.ui_loader import UiLoader
13+
from hexrd.ui.utils.dialog import add_help_url
1314

14-
import hexrd.ui.calibration.structureless
15+
import hexrd.ui.resources.calibration
1516

1617

1718
class StructurelessCalibrationDialog(QObject):
@@ -38,6 +39,7 @@ def __init__(self, instr, params_dict, parent=None,
3839
parent)
3940

4041
self.ui.setWindowFlags(self.ui.windowFlags() | Qt.Tool)
42+
add_help_url(self.ui.button_box, 'calibration/structureless/')
4143

4244
self.pinhole_correction_editor = PinholeCorrectionEditor(self.ui)
4345
editor = self.pinhole_correction_editor
@@ -207,8 +209,9 @@ def update_from_calibrator(self, calibrator):
207209
self.params_dict = calibrator.params
208210

209211
def load_tree_view_mapping(self):
210-
module = hexrd.ui.calibration.structureless
211-
text = resource_loader.load_resource(module, 'params_tree_view.yml')
212+
module = hexrd.ui.resources.calibration
213+
filename = 'structureless_params_tree_view.yml'
214+
text = resource_loader.load_resource(module, filename)
212215
self.yaml_tree_view = yaml.safe_load(text)
213216

214217
@property

hexrd/ui/calibration/structureless/runner.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from hexrd.ui.tree_views import GenericPicksTreeViewDialog
1919
from hexrd.ui.utils import instr_to_internal_dict
2020
from hexrd.ui.utils.conversions import angles_to_cart, cart_to_angles
21+
from hexrd.ui.utils.dialog import add_help_url
2122
from hexrd.ui.utils.guess_instrument_type import guess_instrument_type
2223
from hexrd.ui.utils.tth_distortion import apply_tth_distortion_if_needed
2324

@@ -136,6 +137,9 @@ def hand_pick_points(self):
136137
self.line_picker = picker
137138
picker.ui.setWindowTitle('Structureless Calibration')
138139

140+
# Add the help url
141+
add_help_url(picker.ui.button_box, 'calibration/structureless/')
142+
139143
# We don't support viewing these yet, so hide it
140144
picker.ui.view_picks.setVisible(False)
141145
picker.start_new_line_label = (

hexrd/ui/resources/ui/structureless_calibration_dialog.ui

Lines changed: 132 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,6 @@
1414
<string>Structureless Calibration Dialog</string>
1515
</property>
1616
<layout class="QGridLayout" name="gridLayout_2">
17-
<item row="2" column="0">
18-
<widget class="QGroupBox" name="canvas_settings_group">
19-
<property name="title">
20-
<string>Canvas Settings</string>
21-
</property>
22-
<layout class="QGridLayout" name="gridLayout">
23-
<item row="0" column="1">
24-
<widget class="QCheckBox" name="draw_picks">
25-
<property name="toolTip">
26-
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Draw the picks on the main canvas. These pick positions are stored in detector Cartesian coordinates, and their positions will be updated automatically as detector parameters get modified.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
27-
</property>
28-
<property name="text">
29-
<string>Draw picks?</string>
30-
</property>
31-
</widget>
32-
</item>
33-
</layout>
34-
</widget>
35-
</item>
3617
<item row="2" column="1">
3718
<widget class="QGroupBox" name="groupBox">
3819
<property name="title">
@@ -69,12 +50,132 @@
6950
</layout>
7051
</widget>
7152
</item>
72-
<item row="6" column="0" colspan="2">
73-
<widget class="QGroupBox" name="pinhole_distortion_group">
53+
<item row="10" column="0" colspan="2">
54+
<layout class="QHBoxLayout" name="button_layout">
55+
<item>
56+
<widget class="QDialogButtonBox" name="button_box">
57+
<property name="sizePolicy">
58+
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
59+
<horstretch>0</horstretch>
60+
<verstretch>0</verstretch>
61+
</sizepolicy>
62+
</property>
63+
<property name="standardButtons">
64+
<set>QDialogButtonBox::Help</set>
65+
</property>
66+
</widget>
67+
</item>
68+
<item>
69+
<widget class="QPushButton" name="undo_run_button">
70+
<property name="enabled">
71+
<bool>false</bool>
72+
</property>
73+
<property name="toolTip">
74+
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Undo the last &amp;quot;Run&amp;quot; performed. This revert both the instrument settings and parameter settings to what they were right before &amp;quot;Run&amp;quot; was clicked.&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;This button may be clicked multiple times if multiple runs were performed.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
75+
</property>
76+
<property name="text">
77+
<string>Undo Run</string>
78+
</property>
79+
<property name="icon">
80+
<iconset theme="reload">
81+
<normaloff>.</normaloff>.</iconset>
82+
</property>
83+
</widget>
84+
</item>
85+
<item>
86+
<spacer name="button_layout_spacer">
87+
<property name="orientation">
88+
<enum>Qt::Horizontal</enum>
89+
</property>
90+
<property name="sizeHint" stdset="0">
91+
<size>
92+
<width>40</width>
93+
<height>20</height>
94+
</size>
95+
</property>
96+
</spacer>
97+
</item>
98+
<item>
99+
<widget class="QPushButton" name="run_button">
100+
<property name="sizePolicy">
101+
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
102+
<horstretch>0</horstretch>
103+
<verstretch>0</verstretch>
104+
</sizepolicy>
105+
</property>
106+
<property name="toolTip">
107+
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Run the calibration using the selected parameters and options.&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;Results will be printed to the messages dialog, and the canvas will update automatically with the results.&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;A run may be undone by clicking &amp;quot;Undo Run&amp;quot;.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
108+
</property>
109+
<property name="text">
110+
<string>Run</string>
111+
</property>
112+
<property name="icon">
113+
<iconset theme="dialog-ok">
114+
<normaloff>.</normaloff>.</iconset>
115+
</property>
116+
</widget>
117+
</item>
118+
</layout>
119+
</item>
120+
<item row="2" column="0">
121+
<widget class="QGroupBox" name="canvas_settings_group">
74122
<property name="title">
75-
<string>Pinhole Distortion</string>
123+
<string>Canvas Settings</string>
76124
</property>
77-
<layout class="QVBoxLayout" name="pinhole_distortion_layout"/>
125+
<layout class="QGridLayout" name="gridLayout">
126+
<item row="0" column="1">
127+
<widget class="QCheckBox" name="draw_picks">
128+
<property name="toolTip">
129+
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Draw the picks on the main canvas. These pick positions are stored in detector Cartesian coordinates, and their positions will be updated automatically as detector parameters get modified.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
130+
</property>
131+
<property name="text">
132+
<string>Draw picks?</string>
133+
</property>
134+
</widget>
135+
</item>
136+
</layout>
137+
</widget>
138+
</item>
139+
<item row="3" column="0" colspan="2">
140+
<layout class="QVBoxLayout" name="tree_view_layout"/>
141+
</item>
142+
<item row="7" column="0" colspan="2">
143+
<widget class="QGroupBox" name="picks_group">
144+
<property name="title">
145+
<string>Picks</string>
146+
</property>
147+
<layout class="QGridLayout" name="gridLayout_3">
148+
<item row="0" column="2">
149+
<widget class="QPushButton" name="load_picks_button">
150+
<property name="toolTip">
151+
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Load picks from a structureless calibration HDF5 file.&lt;br/&gt;&lt;/p&gt;&lt;p&gt;This HDF5 file is special to structureless calibration. Other HDF5 files will not work.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
152+
</property>
153+
<property name="text">
154+
<string>Load Picks</string>
155+
</property>
156+
</widget>
157+
</item>
158+
<item row="0" column="1">
159+
<widget class="QPushButton" name="save_picks_button">
160+
<property name="toolTip">
161+
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Save picks to a structureless calibration HDF5 file.&lt;br/&gt;&lt;/p&gt;&lt;p&gt;This HDF5 file is special to structureless calibration.&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;Picks are saved as detector Cartesian coordinates (not as polar coordinates).&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
162+
</property>
163+
<property name="text">
164+
<string>Save Picks</string>
165+
</property>
166+
</widget>
167+
</item>
168+
<item row="0" column="0">
169+
<widget class="QPushButton" name="edit_picks_button">
170+
<property name="toolTip">
171+
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Open the picks editor to edit the picks. Picks may be added, deleted, or edited (either by hand picking a new point or manually entering coordinates).&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
172+
</property>
173+
<property name="text">
174+
<string>Edit Picks</string>
175+
</property>
176+
</widget>
177+
</item>
178+
</layout>
78179
</widget>
79180
</item>
80181
<item row="9" column="0" colspan="2">
@@ -303,109 +404,21 @@ See scipy.optimize.least_squares for more details.</string>
303404
</layout>
304405
</widget>
305406
</item>
306-
<item row="3" column="0" colspan="2">
307-
<layout class="QVBoxLayout" name="tree_view_layout"/>
308-
</item>
309-
<item row="7" column="0" colspan="2">
310-
<widget class="QGroupBox" name="picks_group">
311-
<property name="title">
312-
<string>Picks</string>
313-
</property>
314-
<layout class="QGridLayout" name="gridLayout_3">
315-
<item row="0" column="2">
316-
<widget class="QPushButton" name="load_picks_button">
317-
<property name="toolTip">
318-
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Load picks from a structureless calibration HDF5 file.&lt;br/&gt;&lt;/p&gt;&lt;p&gt;This HDF5 file is special to structureless calibration. Other HDF5 files will not work.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
319-
</property>
320-
<property name="text">
321-
<string>Load Picks</string>
322-
</property>
323-
</widget>
324-
</item>
325-
<item row="0" column="1">
326-
<widget class="QPushButton" name="save_picks_button">
327-
<property name="toolTip">
328-
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Save picks to a structureless calibration HDF5 file.&lt;br/&gt;&lt;/p&gt;&lt;p&gt;This HDF5 file is special to structureless calibration.&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;Picks are saved as detector Cartesian coordinates (not as polar coordinates).&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
329-
</property>
330-
<property name="text">
331-
<string>Save Picks</string>
332-
</property>
333-
</widget>
334-
</item>
335-
<item row="0" column="0">
336-
<widget class="QPushButton" name="edit_picks_button">
337-
<property name="toolTip">
338-
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Open the picks editor to edit the picks. Picks may be added, deleted, or edited (either by hand picking a new point or manually entering coordinates).&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
339-
</property>
340-
<property name="text">
341-
<string>Edit Picks</string>
342-
</property>
343-
</widget>
344-
</item>
345-
</layout>
346-
</widget>
347-
</item>
348-
<item row="10" column="0" colspan="2">
349-
<layout class="QHBoxLayout" name="button_layout">
350-
<item>
351-
<widget class="QPushButton" name="undo_run_button">
352-
<property name="enabled">
353-
<bool>false</bool>
354-
</property>
355-
<property name="toolTip">
356-
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Undo the last &amp;quot;Run&amp;quot; performed. This revert both the instrument settings and parameter settings to what they were right before &amp;quot;Run&amp;quot; was clicked.&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;This button may be clicked multiple times if multiple runs were performed.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
357-
</property>
358-
<property name="text">
359-
<string>Undo Run</string>
360-
</property>
361-
<property name="icon">
362-
<iconset theme="reload">
363-
<normaloff>.</normaloff>.</iconset>
364-
</property>
365-
</widget>
366-
</item>
367-
<item>
368-
<spacer name="button_layout_spacer">
369-
<property name="orientation">
370-
<enum>Qt::Horizontal</enum>
371-
</property>
372-
<property name="sizeHint" stdset="0">
373-
<size>
374-
<width>40</width>
375-
<height>20</height>
376-
</size>
377-
</property>
378-
</spacer>
379-
</item>
380-
<item>
381-
<widget class="QPushButton" name="run_button">
382-
<property name="sizePolicy">
383-
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
384-
<horstretch>0</horstretch>
385-
<verstretch>0</verstretch>
386-
</sizepolicy>
387-
</property>
388-
<property name="toolTip">
389-
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Run the calibration using the selected parameters and options.&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;Results will be printed to the messages dialog, and the canvas will update automatically with the results.&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;A run may be undone by clicking &amp;quot;Undo Run&amp;quot;.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
390-
</property>
391-
<property name="text">
392-
<string>Run</string>
393-
</property>
394-
<property name="icon">
395-
<iconset theme="dialog-ok">
396-
<normaloff>.</normaloff>.</iconset>
397-
</property>
398-
</widget>
399-
</item>
400-
</layout>
401-
</item>
402407
<item row="8" column="0">
403408
<widget class="QCheckBox" name="show_advanced_options">
404409
<property name="text">
405410
<string>Show Advanced Options</string>
406411
</property>
407412
</widget>
408413
</item>
414+
<item row="6" column="0" colspan="2">
415+
<widget class="QGroupBox" name="pinhole_distortion_group">
416+
<property name="title">
417+
<string>Pinhole Distortion</string>
418+
</property>
419+
<layout class="QVBoxLayout" name="pinhole_distortion_layout"/>
420+
</widget>
421+
</item>
409422
</layout>
410423
</widget>
411424
<customwidgets>
@@ -429,7 +442,6 @@ See scipy.optimize.least_squares for more details.</string>
429442
<tabstop>max_nfev</tabstop>
430443
<tabstop>jac</tabstop>
431444
<tabstop>method</tabstop>
432-
<tabstop>undo_run_button</tabstop>
433445
<tabstop>run_button</tabstop>
434446
</tabstops>
435447
<resources/>

0 commit comments

Comments
 (0)