Formula Dialog¶
FormulaDialog(parent)
¶
Bases: QDialog
A QDialog that provides a user-friendly interface for creating mathematical formulas using existing curves as variables. It includes a calculator-style button layout and a table showing available curve variables.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent
|
QObject
|
The parent object |
required |
Source code in trace/widgets/formula_dialog.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | |
keyPressEvent(e)
¶
Handle key press events for formula submission.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
e
|
QKeyEvent
|
The key press event |
required |
Source code in trace/widgets/formula_dialog.py
102 103 104 105 106 107 108 109 110 111 112 | |
showPVList()
¶
Hide or show the PV list on PVButton click.
Source code in trace/widgets/formula_dialog.py
114 115 116 117 118 119 120 121 | |
accept_formula()
¶
Accept the entered formula and emit the formula_accepted signal.
Source code in trace/widgets/formula_dialog.py
123 124 125 126 127 128 129 130 131 | |
insert_pv_key(index)
¶
Insert the variable name into the formula field when a row is double-clicked.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index
|
QModelIndex
|
The index of the double-clicked row |
required |
Source code in trace/widgets/formula_dialog.py
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | |
CurveModel(control_panel)
¶
Bases: QAbstractTableModel
Table model for displaying available curves in the formula dialog. It provides a two-column view of available curves with their variable names and curve names for use in formula creation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
control_panel
|
ControlPanel
|
The control panel containing the curve dictionary |
required |
Source code in trace/widgets/formula_dialog.py
162 163 164 165 166 167 168 169 170 171 172 | |
rowCount(parent=QModelIndex())
¶
Return the number of rows in the model.
Source code in trace/widgets/formula_dialog.py
174 175 176 177 178 | |
columnCount(parent=QModelIndex())
¶
Return the number of columns in the model.
Source code in trace/widgets/formula_dialog.py
180 181 182 | |
data(index, role=Qt.DisplayRole)
¶
Return the data for the given index and role.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index
|
QModelIndex
|
The model index |
required |
role
|
int
|
The data role |
DisplayRole
|
Returns:
| Type | Description |
|---|---|
Any
|
The data for the given index and role |
Source code in trace/widgets/formula_dialog.py
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | |
headerData(section, orientation, role=Qt.DisplayRole)
¶
Return the header data for the given section.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
section
|
int
|
The section index |
required |
orientation
|
Orientation
|
The orientation (horizontal or vertical) |
required |
role
|
int
|
The data role |
DisplayRole
|
Returns:
| Type | Description |
|---|---|
Any
|
The header data |
Source code in trace/widgets/formula_dialog.py
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 | |
row_to_key(row)
¶
Get the variable key for the given row index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
row
|
int
|
Row index for the requested key. |
required |
Returns:
| Type | Description |
|---|---|
str or None
|
The variable key for the row, or None if invalid |
Source code in trace/widgets/formula_dialog.py
251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 | |
refresh()
¶
Force a refresh of the model data.
Source code in trace/widgets/formula_dialog.py
271 272 273 274 | |