Control Panel¶
ControlPanel(theme_manager=None)
¶
Bases: QWidget
Main control panel widget for managing plot axes and curves.
This widget provides the primary interface for adding, configuring, and managing plot axes and their associated curves. It includes functionality for PV search, formula creation, and curve management.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
theme_manager
|
ThemeManager
|
The theme manager for handling UI theming |
None
|
Source code in trace/widgets/control_panel.py
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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | |
plot
property
writable
¶
Get the associated plot widget.
curve_dict
property
¶
Return dictionary of curves with PV keys.
curve_item_dict
property
¶
Returns dictionary of curves on plot with associated pvname, axisItem, and curveItem
update_icons()
¶
Update all icons based on current theme.
Source code in trace/widgets/control_panel.py
117 118 119 120 121 122 123 124 125 | |
on_theme_changed(theme)
¶
Handle theme changes by updating icons.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
theme
|
Theme
|
The new theme, unused |
required |
Source code in trace/widgets/control_panel.py
127 128 129 130 131 132 133 134 135 | |
minimumSizeHint()
¶
Return the minimum size hint for the control panel.
Source code in trace/widgets/control_panel.py
137 138 139 140 141 | |
add_curve_from_line_edit()
¶
Add a curve from the PV line edit input.
Source code in trace/widgets/control_panel.py
143 144 145 146 147 | |
search_pv()
¶
Show or activate the PV search widget.
Source code in trace/widgets/control_panel.py
170 171 172 173 174 175 176 | |
show_formula_dialog()
¶
Show the formula dialog pop-up.
Source code in trace/widgets/control_panel.py
178 179 180 181 182 183 184 | |
handle_formula_accepted(formula)
¶
Handle the formula accepted from the formula dialog.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
formula
|
str
|
The accepted formula string |
required |
Source code in trace/widgets/control_panel.py
186 187 188 189 190 191 192 193 194 195 196 | |
cleanup_duplicate_curves()
¶
Remove duplicate entries in curve dictionary.
Source code in trace/widgets/control_panel.py
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | |
add_curves(pvs)
¶
Add multiple curves from a list of PV names.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pvs
|
list[str]
|
List of PV names to add as curves |
required |
Source code in trace/widgets/control_panel.py
243 244 245 246 247 248 249 250 251 252 | |
add_axis_item(axis)
¶
Add an existing AxisItem to the plot.
Source code in trace/widgets/control_panel.py
267 268 269 270 271 272 273 274 275 276 | |
match_axis_tick_font(axis)
¶
Matches the axis' tick font to the X-Axis of the plot. Only necessary if the user has changed the tick font of the plot's axes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
axis
|
BasePlotAxisItem
|
The axis to match the tick font for. |
required |
Source code in trace/widgets/control_panel.py
278 279 280 281 282 283 284 285 286 287 288 | |
get_axis_item(axis_name)
¶
Get an AxisItem by its name.
Source code in trace/widgets/control_panel.py
290 291 292 293 294 295 296 | |
get_last_axis_item()
¶
Get the last AxisItem in the list.
Source code in trace/widgets/control_panel.py
298 299 300 301 302 303 304 | |
set_curve_palette(palette_name, apply=False)
¶
Set the default palette for new curves.
Parameters: palette_name (str): name of selected palette apply (bool): If true, apply palette to exiting curves
Source code in trace/widgets/control_panel.py
306 307 308 309 310 311 312 313 314 315 316 317 318 319 | |
clear_all()
¶
Clear all axes and curves from the plot and control panel.
Source code in trace/widgets/control_panel.py
358 359 360 361 362 363 | |
clear_curves()
¶
Clear all curves from the plot and control panel.
Source code in trace/widgets/control_panel.py
365 366 367 368 369 370 | |
set_axes(axes=None)
¶
Given a list of dictionaries containing axis data, clear the plot's axes, and set all new axes based on the provided axis data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
axes
|
List[Dict]
|
Axis properties to be set for all new axes on the plot |
None
|
Source code in trace/widgets/control_panel.py
372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 | |
set_curves(curves=None)
¶
Given a list of dictionaries containing curve data, clear the plot's curves, and set all new curves based on the provided curve data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
curves
|
List[Dict]
|
Curve properties to be set for all new curves on the plot |
None
|
Source code in trace/widgets/control_panel.py
402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 | |
move_curve_to_axis(curve_item, target_axis_name)
¶
Remove a given CurveItem from its current AxisItem and add it to the AxisItem with the given target axis name. If no such AxisItem exists, a new one will be created. Intended to be used for Axes named after a curve's unit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
curve_item
|
CurveItem
|
CurveItem to be moved to a new axis. |
required |
target_axis_name
|
str
|
Name of the target axis to move the CurveItem to. |
required |
Source code in trace/widgets/control_panel.py
431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 | |
AxisItem(plot_axis_item, control_panel=None, theme_manager=None)
¶
Bases: QWidget
Widget for managing a single plot axis and its associated curves.
This widget provides controls for axis configuration including name, range, auto-scaling, and curve management. It supports drag-and-drop for curve reordering and moving curves between axes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
plot_axis_item
|
BasePlotAxisItem
|
The plot axis item to manage |
required |
control_panel
|
ControlPanel
|
Reference to the parent control panel |
None
|
theme_manager
|
ThemeManager
|
The theme manager for UI theming |
None
|
Source code in trace/widgets/control_panel.py
468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 | |
name
property
¶
Get the name of the axis.
update_icons()
¶
Update all icons based on current theme
Source code in trace/widgets/control_panel.py
551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 | |
on_theme_changed(theme)
¶
Handle theme changes by updating icons
Source code in trace/widgets/control_panel.py
570 571 572 573 574 575 576 | |
make_curve_widget(plot_curve_item)
¶
Create a CurveItem widget for the given plot curve item and add it to this AxisItem.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
plot_curve_item
|
ArchivePlotCurveItem | FormulaCurveItem
|
The plot curve item to create a CurveItem for. |
required |
Returns:
| Type | Description |
|---|---|
CurveItem
|
The created CurveItem widget. |
Source code in trace/widgets/control_panel.py
587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 | |
add_curve(pv, channel_args=None)
¶
Create a new ArchivePlotCurveItem for the given PV and add it to this AxisItem. Also creates a CurveItem widget for it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pv
|
str
|
The process variable name to create the curve for. |
required |
channel_args
|
dict
|
The arguments to pass to the ArchivePlotCurveItem constructor, by default None |
None
|
Returns:
| Type | Description |
|---|---|
CurveItem
|
The created CurveItem widget. |
Source code in trace/widgets/control_panel.py
613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 | |
add_formula_curve(formula)
¶
Create a new FormulaCurveItem for the given formula and add it to this AxisItem. Also creates a CurveItem widget for it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
formula
|
str
|
The formula to create the curve for. Must start with "f://". |
required |
Returns:
| Type | Description |
|---|---|
CurveItem
|
The created CurveItem widget. |
Source code in trace/widgets/control_panel.py
647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 | |
auto_hide_invalid_formula(formula_curve=None)
¶
Automatically hide a formula when it becomes invalid
Source code in trace/widgets/control_panel.py
686 687 688 689 690 691 692 693 694 695 696 697 | |
find_curve_item_for_curve(target_curve)
¶
Find the CurveItem widget that corresponds to a given curve
Source code in trace/widgets/control_panel.py
763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 | |
set_curve_palette(palette_name, apply=True)
¶
Set colors of all curves on this axisItem according to selected palette
Source code in trace/widgets/control_panel.py
812 813 814 815 816 817 818 819 820 821 | |
remove_curve_item(curve_item, delete_curve=False)
¶
Removes the given CurveItem from the AxisItem and plot's axis. This is required for moving a CurveItem to a new AxisItem. Can delete the CurveItem and curve if specified. This will remove it from the plot.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
curve_item
|
CurveItem
|
The CurveItem to be removed from the axis. |
required |
delete_curve
|
bool
|
If True, the CurveItem will be deleted and the curve removed from the plot entirely. If False, it will just be unlinked from this axis., by default False. |
False
|
Source code in trace/widgets/control_panel.py
851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 | |
add_curve_item(curve_item)
¶
Add an existing CurveItem to this AxisItem.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
curve_item
|
CurveItem
|
The CurveItem to be added to this axis. |
required |
Source code in trace/widgets/control_panel.py
874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 | |
clear_curves()
¶
Clear all curves from this axis item.
Source code in trace/widgets/control_panel.py
899 900 901 902 903 904 | |
CurveItem(axis_item, source)
¶
Bases: QWidget
Widget for managing a single curve on the plot.
This widget provides controls for curve configuration including name, color, visibility, and connection status. It supports drag-and-drop for moving curves between axes and formula editing for formula curves.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
axis_item
|
AxisItem
|
The parent axis item |
required |
source
|
ArchivePlotCurveItem or FormulaCurveItem
|
The plot curve item to manage |
required |
Source code in trace/widgets/control_panel.py
955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 | |
plot
property
¶
Get the PlotWidget that this CurveItem belongs to.
axis_item
property
¶
Get the AxisItem that this CurveItem belongs to.
move_to_axis_from_unit()
¶
Automatically move curve to axis based on unit
Source code in trace/widgets/control_panel.py
978 979 980 981 982 983 984 985 | |
setup_layout()
¶
Setup the layout and widgets for the CurveItem.
Source code in trace/widgets/control_panel.py
1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 | |
setup_line_edit()
¶
Set up the line edit with appropriate behavior for formula vs regular curves
Source code in trace/widgets/control_panel.py
1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 | |
update_icons()
¶
Update all icons based on current theme
Source code in trace/widgets/control_panel.py
1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 | |
show_invalid_icon(show=True)
¶
Show or hide the invalid formula icon overlaid on the line edit
Source code in trace/widgets/control_panel.py
1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 | |
on_color_changed(color)
¶
Handle color change from settings modal
Source code in trace/widgets/control_panel.py
1154 1155 1156 1157 | |
update_color_toggle()
¶
Update the color toggle when the curve color changes
Source code in trace/widgets/control_panel.py
1159 1160 1161 1162 1163 | |
is_formula_curve()
¶
Check if this is a formula curve.
Returns:
| Type | Description |
|---|---|
bool
|
True if this is a formula curve, False otherwise |
Source code in trace/widgets/control_panel.py
1175 1176 1177 1178 1179 1180 1181 1182 1183 | |
update_formula()
¶
Handle formula updates when user edits the formula text.
Source code in trace/widgets/control_panel.py
1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 | |