MCPcopy Create free account
hub / github.com/NSLS2/PyXRF / __init__

Method __init__

pyxrf/gui_module/dlg_select_scan.py:13–83  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

11
12class DialogSelectScan(QDialog):
13 def __init__(self):
14 super().__init__()
15
16 self.resize(400, 200)
17 self.setWindowTitle("Load Run From Database")
18
19 self._id_uid = None
20 self._mode_id_uid = "id"
21
22 label = QLabel("Enter run ID or UID:")
23 self.le_id_uid = LineEditExtended()
24 self.le_id_uid.textChanged.connect(self.le_id_uid_text_changed)
25 self.le_id_uid.editingFinished.connect(self.le_id_uid_editing_finished)
26 set_tooltip(self.le_id_uid, "Enter <b>Run ID</b> or <b>Run UID</b>.")
27
28 self._validator_id = IntValidatorStrict()
29 # Short UID example: "04c9afa7"
30 self._validator_uid_short = QRegExpValidator(QRegExp(r"[0-9a-f]{8}"))
31 # Full UID example: "04c9afa7-a43a-4af1-8e55-2034384d4a77"
32 self._validator_uid_full = QRegExpValidator(
33 QRegExp(r"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}")
34 )
35
36 self.rb_id = QRadioButton("Run ID")
37 set_tooltip(self.rb_id, "The value in the line edit box is <b>Run ID</b> (e.g. <b>34235</b> or <b>-1</b>)")
38 self.rb_id.setChecked(self._mode_id_uid == "id")
39 self.rb_uid = QRadioButton("Run UID")
40 self.rb_uid.setChecked(self._mode_id_uid == "uid")
41 set_tooltip(
42 self.rb_uid,
43 "The value in the line edit box is <b>Run UID</b> "
44 "(e.g. <b>04c9afb7-a43a-4af1-8e55-2034384d4a77</b> or <b>04c9afb7</b>)",
45 )
46
47 self.btn_group = QButtonGroup()
48 self.btn_group.addButton(self.rb_id)
49 self.btn_group.addButton(self.rb_uid)
50 self.btn_group.buttonToggled.connect(self.btn_group_button_toggled)
51
52 button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
53 button_box.accepted.connect(self.accept)
54 button_box.rejected.connect(self.reject)
55 self.pb_ok = button_box.button(QDialogButtonBox.Ok)
56
57 vbox = QVBoxLayout()
58
59 vbox.addStretch(1)
60
61 hbox = QHBoxLayout()
62 hbox.addWidget(label)
63 hbox.addStretch(1)
64 vbox.addLayout(hbox)
65 vbox.addWidget(self.le_id_uid)
66
67 hbox = QHBoxLayout()
68 hbox.addStretch(1)
69 hbox.addWidget(self.rb_id)
70 hbox.addStretch(1)

Callers

nothing calls this directly

Calls 5

_validate_id_uidMethod · 0.95
LineEditExtendedClass · 0.85
set_tooltipFunction · 0.85
IntValidatorStrictClass · 0.85
setTextMethod · 0.80

Tested by

no test coverage detected