qplotter 1.6.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. qplot/__init__.py +46 -0
  2. qplot/__main__.py +232 -0
  3. qplot/_auxiliary_paths.py +67 -0
  4. qplot/_build_info.json +1 -0
  5. qplot/_metadata.py +75 -0
  6. qplot/_repair.py +14 -0
  7. qplot/_shutdown_supervisor.py +4049 -0
  8. qplot/_version.py +12 -0
  9. qplot/_windows_shutdown_job.py +1166 -0
  10. qplot/configuration/__init__.py +3 -0
  11. qplot/configuration/config.py +578 -0
  12. qplot/configuration/config_schema.json +357 -0
  13. qplot/configuration/fonts.py +3 -0
  14. qplot/configuration/scripts.py +255 -0
  15. qplot/configuration/themes/__init__.py +13 -0
  16. qplot/configuration/themes/_base.py +592 -0
  17. qplot/configuration/themes/blank.py +17 -0
  18. qplot/configuration/themes/dark.py +54 -0
  19. qplot/configuration/themes/light.py +54 -0
  20. qplot/datahandling/LoadFromDB.py +224 -0
  21. qplot/datahandling/__init__.py +47 -0
  22. qplot/datahandling/_trusted_live_helper.py +812 -0
  23. qplot/datahandling/_trusted_live_protocol.py +1745 -0
  24. qplot/datahandling/database.py +2340 -0
  25. qplot/datahandling/dimensions.py +43 -0
  26. qplot/datahandling/file_identity.py +461 -0
  27. qplot/datahandling/parameter_data.py +149 -0
  28. qplot/datahandling/plot_progress.py +17 -0
  29. qplot/datahandling/qcodes_cache.py +277 -0
  30. qplot/datahandling/qcodes_compat.py +14 -0
  31. qplot/datahandling/readSQL.py +2442 -0
  32. qplot/datahandling/readonly.py +2566 -0
  33. qplot/datahandling/source_activity.py +21 -0
  34. qplot/datahandling/trusted_array_preview.py +148 -0
  35. qplot/datahandling/trusted_derived_cache.py +1605 -0
  36. qplot/datahandling/trusted_derived_rendering.py +876 -0
  37. qplot/datahandling/trusted_heatmap.py +246 -0
  38. qplot/datahandling/trusted_live.py +2808 -0
  39. qplot/datahandling/trusted_live_queries.py +5907 -0
  40. qplot/datahandling/trusted_live_service.py +1919 -0
  41. qplot/datahandling/trusted_live_supervisor.py +2161 -0
  42. qplot/datahandling/trusted_plot.py +283 -0
  43. qplot/datahandling/trusted_presentation.py +1065 -0
  44. qplot/datahandling/trusted_snapshot.py +1132 -0
  45. qplot/datahandling/trusted_work_coordinator.py +2157 -0
  46. qplot/datahandling/trusted_work_scheduler.py +1204 -0
  47. qplot/diagnostics.py +241 -0
  48. qplot/resources/testdata/qplot_test_db_01_10mb.csv +11 -0
  49. qplot/resources/testdata/qplot_test_db_02_25mb.csv +14 -0
  50. qplot/resources/testdata/qplot_test_db_03_50mb.csv +17 -0
  51. qplot/resources/testdata/qplot_test_db_04_100mb.csv +20 -0
  52. qplot/resources/testdata/qplot_test_db_05_250mb.csv +23 -0
  53. qplot/resources/testdata/qplot_test_db_06_500mb.csv +26 -0
  54. qplot/resources/testdata/qplot_test_db_07_1gb.csv +29 -0
  55. qplot/resources/testdata/qplot_test_db_08_5gb.csv +32 -0
  56. qplot/resources/testdata/qplot_test_db_09_10gb.csv +35 -0
  57. qplot/resources/testdata/qplot_test_db_10_30gb.csv +38 -0
  58. qplot/testdata.py +1804 -0
  59. qplot/tools/__init__.py +13 -0
  60. qplot/tools/finite_means.py +123 -0
  61. qplot/tools/general.py +139 -0
  62. qplot/tools/heatmap_geometry.py +391 -0
  63. qplot/tools/operation_registry.py +179 -0
  64. qplot/tools/plot_tools.py +650 -0
  65. qplot/tools/sample_statistics.py +111 -0
  66. qplot/tools/worker.py +2838 -0
  67. qplot/windows/__init__.py +9 -0
  68. qplot/windows/_colorbar.py +422 -0
  69. qplot/windows/_commands.py +523 -0
  70. qplot/windows/_config_persistence.py +123 -0
  71. qplot/windows/_database_actions.py +4933 -0
  72. qplot/windows/_dataset_handle.py +221 -0
  73. qplot/windows/_display_precision.py +48 -0
  74. qplot/windows/_dragdrop.py +70 -0
  75. qplot/windows/_export_paths.py +1167 -0
  76. qplot/windows/_help.py +210 -0
  77. qplot/windows/_mixed_appearance.py +303 -0
  78. qplot/windows/_mixed_plots.py +461 -0
  79. qplot/windows/_native_averaging.py +323 -0
  80. qplot/windows/_native_transforms.py +551 -0
  81. qplot/windows/_plot1d_snap.py +612 -0
  82. qplot/windows/_plot1d_traces.py +2236 -0
  83. qplot/windows/_plot2d_colorbar.py +1127 -0
  84. qplot/windows/_plot2d_colorbar_dialog.py +786 -0
  85. qplot/windows/_plot2d_layers.py +2291 -0
  86. qplot/windows/_plot2d_sweeps.py +712 -0
  87. qplot/windows/_plotWin.py +2082 -0
  88. qplot/windows/_plot_actions.py +2703 -0
  89. qplot/windows/_plot_annotation.py +186 -0
  90. qplot/windows/_plot_appearance.py +283 -0
  91. qplot/windows/_plot_axis_scaling.py +1521 -0
  92. qplot/windows/_plot_data_viewbox.py +94 -0
  93. qplot/windows/_plot_drop_axes.py +224 -0
  94. qplot/windows/_plot_export.py +1445 -0
  95. qplot/windows/_plot_feedback.py +112 -0
  96. qplot/windows/_plot_marquee.py +659 -0
  97. qplot/windows/_plot_refresh.py +950 -0
  98. qplot/windows/_plot_source_promotion.py +178 -0
  99. qplot/windows/_plot_state.py +237 -0
  100. qplot/windows/_plot_status.py +115 -0
  101. qplot/windows/_plot_tiling.py +35 -0
  102. qplot/windows/_plot_transform_labels.py +60 -0
  103. qplot/windows/_preferences.py +724 -0
  104. qplot/windows/_refresh_interval.py +172 -0
  105. qplot/windows/_run_controls.py +789 -0
  106. qplot/windows/_shortcuts.py +47 -0
  107. qplot/windows/_subplots/__init__.py +8 -0
  108. qplot/windows/_subplots/subplot1d.py +532 -0
  109. qplot/windows/_subplots/subplot2d.py +919 -0
  110. qplot/windows/_svg_export.py +209 -0
  111. qplot/windows/_trusted_derived_qt.py +1759 -0
  112. qplot/windows/_widgets/__init__.py +23 -0
  113. qplot/windows/_widgets/_run_formatting.py +387 -0
  114. qplot/windows/_widgets/details_tables.py +1119 -0
  115. qplot/windows/_widgets/dropbox.py +290 -0
  116. qplot/windows/_widgets/operations.py +460 -0
  117. qplot/windows/_widgets/preview.py +2997 -0
  118. qplot/windows/_widgets/run_list_items.py +488 -0
  119. qplot/windows/_widgets/toolbar.py +111 -0
  120. qplot/windows/_widgets/treeWidgets.py +2572 -0
  121. qplot/windows/_window_controls.py +414 -0
  122. qplot/windows/main.py +1632 -0
  123. qplot/windows/plot1d.py +313 -0
  124. qplot/windows/plot2d.py +1935 -0
  125. qplotter-1.6.0.dist-info/METADATA +322 -0
  126. qplotter-1.6.0.dist-info/RECORD +130 -0
  127. qplotter-1.6.0.dist-info/WHEEL +5 -0
  128. qplotter-1.6.0.dist-info/entry_points.txt +4 -0
  129. qplotter-1.6.0.dist-info/licenses/LICENSE +21 -0
  130. qplotter-1.6.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,592 @@
1
+ from __future__ import annotations
2
+
3
+ from dataclasses import asdict, dataclass
4
+ from string import Template
5
+
6
+ import pyqtgraph as pg
7
+ from PyQt6 import QtGui
8
+ from PyQt6 import QtWidgets as qtw
9
+
10
+ from ..fonts import FONT_SIZE_KEY
11
+
12
+
13
+ @dataclass(frozen=True)
14
+ class ThemePalette:
15
+ window_bg: str
16
+ panel_bg: str
17
+ panel_alt_bg: str
18
+ field_bg: str
19
+ field_alt_bg: str
20
+ button_bg: str
21
+ button_hover_bg: str
22
+ button_pressed_bg: str
23
+ text: str
24
+ text_strong: str
25
+ muted_text: str
26
+ disabled_text: str
27
+ selection_bg: str
28
+ selection_text: str
29
+ accent: str
30
+ accent_hover: str
31
+ accent_soft: str
32
+ accent_pressed: str
33
+ border: str
34
+ border_strong: str
35
+ menu_hover_bg: str
36
+ tab_bg: str
37
+ tab_selected_bg: str
38
+ tab_hover_bg: str
39
+ table_bg: str
40
+ table_alt_bg: str
41
+ table_hover_bg: str
42
+ header_bg: str
43
+ status_text: str
44
+ progress_text: str
45
+ splitter: str
46
+ scrollbar_bg: str
47
+ scrollbar_handle: str
48
+ scrollbar_handle_hover: str
49
+ danger: str
50
+ danger_bg: str
51
+ danger_pressed_bg: str
52
+
53
+
54
+ _STYLESHEET_TEMPLATE = Template(
55
+ """
56
+ QMainWindow, QDialog, QColorDialog {
57
+ background-color: $window_bg;
58
+ }
59
+ QMainWindow, QDialog, QWidget {
60
+ font-size: 10pt;
61
+ }
62
+ QLabel {
63
+ color: $text;
64
+ }
65
+ QLabel#mainEmptyStateTitle {
66
+ color: $text_strong;
67
+ font-weight: 600;
68
+ }
69
+ QLabel#mainEmptyStateDetail {
70
+ color: $muted_text;
71
+ }
72
+ QTextEdit, QPlainTextEdit {
73
+ background-color: $field_bg;
74
+ color: $text;
75
+ selection-background-color: $selection_bg;
76
+ selection-color: $selection_text;
77
+ border: 1px solid transparent;
78
+ }
79
+ QFrame#mainEmptyState {
80
+ background-color: $panel_alt_bg;
81
+ border-top: 1px solid $border;
82
+ border-bottom: 1px solid $border;
83
+ }
84
+ QMenuBar {
85
+ background-color: $window_bg;
86
+ border-bottom: 1px solid $border;
87
+ }
88
+ QMenuBar::item {
89
+ color: $text;
90
+ spacing: 3px;
91
+ padding: 4px 4px;
92
+ background-color: $window_bg;
93
+ }
94
+ QMenuBar::item:selected {
95
+ background-color: $menu_hover_bg;
96
+ color: $text_strong;
97
+ }
98
+ QMenu {
99
+ background-color: $window_bg;
100
+ }
101
+ QMenu::item {
102
+ border-style: solid;
103
+ border-color: transparent;
104
+ border-left-width: 2px;
105
+ color: $text;
106
+ padding: 4px 17px;
107
+ background-color: $window_bg;
108
+ }
109
+ QMenu::item:selected {
110
+ border-left-color: $accent;
111
+ color: $text_strong;
112
+ padding-left: 15px;
113
+ padding-right: 7px;
114
+ background-color: $menu_hover_bg;
115
+ }
116
+ QLabel#plotStatusMessage {
117
+ color: $status_text;
118
+ }
119
+ QStatusBar {
120
+ background-color: $window_bg;
121
+ color: $status_text;
122
+ border-top: 1px solid $border;
123
+ }
124
+ QToolBar {
125
+ background-color: $panel_bg;
126
+ border: none;
127
+ border-bottom: 1px solid $border;
128
+ spacing: 6px;
129
+ padding: 2px 8px;
130
+ }
131
+ QToolBar QLabel {
132
+ color: $text;
133
+ }
134
+ QToolBar#plotRefreshToolbar {
135
+ /* Qt uses the largest padding edge as the toolbar frame width. */
136
+ padding: 2px;
137
+ }
138
+ QPushButton {
139
+ min-height: 20px;
140
+ border: 1px solid $border_strong;
141
+ border-radius: 5px;
142
+ padding: 1px 10px;
143
+ color: $text;
144
+ background-color: $button_bg;
145
+ }
146
+ QPushButton::default {
147
+ border-bottom: 1px solid $accent;
148
+ }
149
+ QPushButton:hover {
150
+ border: 1px solid $accent;
151
+ color: $text_strong;
152
+ background-color: $button_hover_bg;
153
+ }
154
+ QPushButton:pressed {
155
+ color: $text_strong;
156
+ background-color: $button_pressed_bg;
157
+ }
158
+ QPushButton:disabled {
159
+ border: 1px solid $border;
160
+ color: $disabled_text;
161
+ background-color: $panel_bg;
162
+ }
163
+ QToolButton {
164
+ border: 1px solid transparent;
165
+ border-bottom: 1px solid $accent;
166
+ color: $text;
167
+ padding: 2px;
168
+ background-color: $panel_bg;
169
+ }
170
+ QToolButton:hover {
171
+ border: 1px solid transparent;
172
+ border-bottom: 2px solid $accent_hover;
173
+ color: $text_strong;
174
+ padding-bottom: 1px;
175
+ background-color: $panel_bg;
176
+ }
177
+ QToolButton#databaseIconButton,
178
+ QToolButton#plotIconButton,
179
+ QToolButton#exportIconButton,
180
+ QToolButton#closeAllPlotsButton {
181
+ border: 1px solid $border_strong;
182
+ border-radius: 5px;
183
+ padding: 1px;
184
+ background-color: $button_bg;
185
+ }
186
+ QToolButton#databaseIconButton:hover,
187
+ QToolButton#plotIconButton:hover,
188
+ QToolButton#exportIconButton:hover {
189
+ border: 1px solid $accent;
190
+ background-color: $button_hover_bg;
191
+ }
192
+ QToolButton#databaseIconButton:pressed,
193
+ QToolButton#plotIconButton:pressed,
194
+ QToolButton#exportIconButton:pressed {
195
+ background-color: $button_pressed_bg;
196
+ }
197
+ QToolButton#closeAllPlotsButton {
198
+ margin-right: 8px;
199
+ }
200
+ QToolButton#closeAllPlotsButton:hover {
201
+ border: 1px solid $danger;
202
+ background-color: $danger_bg;
203
+ }
204
+ QToolButton#closeAllPlotsButton:pressed {
205
+ background-color: $danger_pressed_bg;
206
+ }
207
+ QLineEdit,
208
+ QSpinBox,
209
+ QDoubleSpinBox,
210
+ QTimeEdit,
211
+ QDateTimeEdit,
212
+ QDateEdit,
213
+ QComboBox,
214
+ QFontComboBox {
215
+ min-height: 20px;
216
+ border: 1px solid $border_strong;
217
+ border-radius: 5px;
218
+ padding: 0 6px;
219
+ color: $text;
220
+ background-color: $field_bg;
221
+ selection-background-color: $selection_bg;
222
+ selection-color: $selection_text;
223
+ }
224
+ QLineEdit:disabled,
225
+ QSpinBox:disabled,
226
+ QDoubleSpinBox:disabled,
227
+ QComboBox:disabled {
228
+ background-color: $panel_bg;
229
+ color: $disabled_text;
230
+ border: 1px solid $border;
231
+ }
232
+ QLineEdit#databasePathField {
233
+ background-color: $field_alt_bg;
234
+ color: $muted_text;
235
+ }
236
+ QSpinBox#heatmapAppearanceOpacity {
237
+ padding: 0 16px 0 4px;
238
+ }
239
+ QSpinBox#heatmapAppearanceOpacity QLineEdit {
240
+ padding: 0;
241
+ }
242
+ QComboBox:editable {
243
+ background-color: $field_bg;
244
+ color: $text;
245
+ }
246
+ QComboBox:on {
247
+ padding-top: 3px;
248
+ padding-left: 4px;
249
+ }
250
+ QComboBox QAbstractItemView {
251
+ border: 1px solid $accent;
252
+ background-color: $field_bg;
253
+ selection-background-color: $selection_bg;
254
+ selection-color: $selection_text;
255
+ color: $text;
256
+ }
257
+ QProgressBar {
258
+ text-align: center;
259
+ color: $progress_text;
260
+ border: 1px inset $border_strong;
261
+ border-radius: 10px;
262
+ background-color: $field_bg;
263
+ }
264
+ QProgressBar::chunk {
265
+ background-color: $accent;
266
+ border-radius: 5px;
267
+ }
268
+ QLCDNumber {
269
+ color: $accent_hover;
270
+ }
271
+ QCheckBox {
272
+ color: $text;
273
+ padding: 2px;
274
+ spacing: 6px;
275
+ }
276
+ QCheckBox:disabled {
277
+ color: $disabled_text;
278
+ }
279
+ QCheckBox:hover {
280
+ border-radius: 4px;
281
+ border: 1px solid $border_strong;
282
+ padding: 1px;
283
+ background-color: $panel_bg;
284
+ }
285
+ QCheckBox::indicator {
286
+ width: 14px;
287
+ height: 14px;
288
+ }
289
+ QRadioButton {
290
+ color: $text;
291
+ background-color: $window_bg;
292
+ padding: 1px;
293
+ }
294
+ QRadioButton::indicator:checked,
295
+ QRadioButton::indicator:!checked {
296
+ height: 10px;
297
+ width: 10px;
298
+ border: 1px solid $accent;
299
+ border-radius: 5px;
300
+ }
301
+ QRadioButton::indicator:checked {
302
+ background-color: $accent;
303
+ }
304
+ QRadioButton::indicator:!checked {
305
+ background-color: transparent;
306
+ }
307
+ QSplitter::handle:vertical {
308
+ background-color: $splitter;
309
+ height: 6px;
310
+ margin: 2px 0px;
311
+ }
312
+ QSplitter::handle:vertical:hover {
313
+ background-color: $accent;
314
+ }
315
+ QTabWidget {
316
+ color: $text;
317
+ background-color: $window_bg;
318
+ }
319
+ QTabWidget::pane {
320
+ border: 1px solid $border_strong;
321
+ border-radius: 6px;
322
+ background-color: $panel_bg;
323
+ top: -1px;
324
+ }
325
+ QTabBar::tab {
326
+ min-height: 24px;
327
+ min-width: 84px;
328
+ padding: 3px 10px;
329
+ margin-left: 0px;
330
+ border: 1px solid $border_strong;
331
+ border-left: none;
332
+ background-color: $tab_bg;
333
+ color: $muted_text;
334
+ }
335
+ QTabBar::tab:first {
336
+ border-left: 1px solid $border_strong;
337
+ border-top-left-radius: 6px;
338
+ border-bottom-left-radius: 6px;
339
+ }
340
+ QTabBar::tab:last {
341
+ border-top-right-radius: 6px;
342
+ border-bottom-right-radius: 6px;
343
+ }
344
+ QTabBar::tab:selected {
345
+ background-color: $tab_selected_bg;
346
+ color: $text_strong;
347
+ border: 1px solid $accent_hover;
348
+ padding: 3px 10px;
349
+ }
350
+ QTabBar::tab:hover {
351
+ background-color: $tab_hover_bg;
352
+ color: $text_strong;
353
+ border: 1px solid $accent_hover;
354
+ padding: 3px 10px;
355
+ }
356
+ QTabWidget#runDetailsTabs QTabBar::tab {
357
+ min-height: 18px;
358
+ min-width: 74px;
359
+ padding: 1px 8px;
360
+ }
361
+ QTabWidget#runDetailsTabs QTabBar::tab:selected,
362
+ QTabWidget#runDetailsTabs QTabBar::tab:hover {
363
+ padding: 1px 8px;
364
+ }
365
+ QTreeView,
366
+ QListView,
367
+ QTreeWidget,
368
+ QTableView,
369
+ QTableWidget {
370
+ background-color: $table_bg;
371
+ alternate-background-color: $table_alt_bg;
372
+ color: $text;
373
+ border: 1px solid $border_strong;
374
+ gridline-color: $border;
375
+ outline: 0;
376
+ selection-background-color: $selection_bg;
377
+ selection-color: $selection_text;
378
+ font-size: 10pt;
379
+ }
380
+ QTreeView::item,
381
+ QListView::item,
382
+ QTreeWidget::item,
383
+ QTableView::item,
384
+ QTableWidget::item {
385
+ padding: 2px 6px;
386
+ border: none;
387
+ color: $text;
388
+ }
389
+ QTreeView::item:selected,
390
+ QListView::item:selected,
391
+ QTreeWidget::item:selected,
392
+ QTableView::item:selected,
393
+ QTableWidget::item:selected {
394
+ background-color: $selection_bg;
395
+ color: $selection_text;
396
+ }
397
+ QTreeView::item:hover,
398
+ QListView::item:hover,
399
+ QTreeWidget::item:hover,
400
+ QTableView::item:hover,
401
+ QTableWidget::item:hover {
402
+ background-color: $table_hover_bg;
403
+ color: $text_strong;
404
+ }
405
+ QTreeView::branch {
406
+ background: transparent;
407
+ border: none;
408
+ margin: 0px;
409
+ }
410
+ QHeaderView::section {
411
+ background-color: $header_bg;
412
+ color: $text;
413
+ padding: 4px 8px;
414
+ border: none;
415
+ border-right: 1px solid $border_strong;
416
+ border-bottom: 1px solid $border_strong;
417
+ }
418
+ QTableWidget#detailsTable::item {
419
+ padding: 0px 6px;
420
+ }
421
+ QTableWidget#detailsTable QHeaderView::section {
422
+ padding: 1px 6px;
423
+ font-size: 9pt;
424
+ }
425
+ QListWidget {
426
+ background-color: $table_bg;
427
+ color: $text;
428
+ border: 1px solid $border_strong;
429
+ outline: 0;
430
+ }
431
+ QListWidget::item {
432
+ padding: 0px 0px;
433
+ border: none;
434
+ }
435
+ QListWidget::item:selected {
436
+ background-color: $selection_bg;
437
+ color: $selection_text;
438
+ }
439
+ QListWidget::item:hover {
440
+ background-color: $table_hover_bg;
441
+ color: $text_strong;
442
+ }
443
+ QScrollArea {
444
+ color: $text;
445
+ background-color: $window_bg;
446
+ border: none;
447
+ }
448
+ QScrollArea QWidget {
449
+ background-color: $window_bg;
450
+ }
451
+ QScrollBar:vertical {
452
+ width: 10px;
453
+ background: $scrollbar_bg;
454
+ margin: 0px;
455
+ border: none;
456
+ }
457
+ QScrollBar:horizontal {
458
+ height: 10px;
459
+ background: $scrollbar_bg;
460
+ margin: 0px;
461
+ border: none;
462
+ }
463
+ QScrollBar::handle:vertical,
464
+ QScrollBar::handle:horizontal {
465
+ background: $scrollbar_handle;
466
+ border-radius: 5px;
467
+ min-height: 20px;
468
+ min-width: 20px;
469
+ border: none;
470
+ }
471
+ QScrollBar::handle:vertical:hover,
472
+ QScrollBar::handle:horizontal:hover {
473
+ background: $scrollbar_handle_hover;
474
+ }
475
+ QScrollBar::add-line:vertical,
476
+ QScrollBar::sub-line:vertical,
477
+ QScrollBar::add-line:horizontal,
478
+ QScrollBar::sub-line:horizontal,
479
+ QScrollBar::up-arrow:vertical,
480
+ QScrollBar::down-arrow:vertical,
481
+ QScrollBar::left-arrow:horizontal,
482
+ QScrollBar::right-arrow:horizontal {
483
+ width: 0;
484
+ height: 0;
485
+ background: none;
486
+ border: none;
487
+ }
488
+ QSlider::groove:horizontal {
489
+ height: 5px;
490
+ background: $accent;
491
+ }
492
+ QSlider::groove:vertical {
493
+ width: 5px;
494
+ background: $accent;
495
+ }
496
+ QSlider::handle:horizontal,
497
+ QSlider::handle:vertical {
498
+ background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #b4b4b4, stop:1 #8f8f8f);
499
+ border: 1px solid #5c5c5c;
500
+ width: 14px;
501
+ height: 14px;
502
+ margin: -5px 0;
503
+ border-radius: 7px;
504
+ }
505
+ QSlider::add-page:horizontal,
506
+ QSlider::add-page:vertical {
507
+ background: $disabled_text;
508
+ }
509
+ QSlider::sub-page:horizontal,
510
+ QSlider::sub-page:vertical {
511
+ background: $accent;
512
+ }
513
+ """
514
+ )
515
+
516
+
517
+ def build_stylesheet(palette: ThemePalette) -> str:
518
+ """
519
+ Builds qPlot's shared application stylesheet from a palette.
520
+
521
+ """
522
+ return _STYLESHEET_TEMPLATE.substitute(asdict(palette))
523
+
524
+
525
+ def color_list(names: list[str]) -> list:
526
+ """
527
+ Converts pyqtgraph color names into reusable QColor instances.
528
+
529
+ """
530
+ return [pg.mkColor(color) for color in names]
531
+
532
+
533
+ class PlotTheme:
534
+ """
535
+ Shared pyqtgraph styling for qPlot themes.
536
+
537
+ """
538
+
539
+ plot_background = "w"
540
+ plot_foreground = "k"
541
+ plot_grid = "darkgray"
542
+ colors = color_list(["red", "green", "blue", "black", "darkcyan", "darkorange"])
543
+
544
+ @classmethod
545
+ def style_plotItem(cls, plot_win):
546
+ plot_item = plot_win.plot
547
+ plot_win.widget.setBackground(cls.plot_background)
548
+
549
+ width = plot_win.config.get("user_preference.axis_tick_width")
550
+ pen = pg.mkPen(cls.plot_foreground, width=width)
551
+ font = QtGui.QFont(qtw.QApplication.font())
552
+ font.setPointSize(plot_win.config.get(FONT_SIZE_KEY))
553
+
554
+ def style_axis(axis):
555
+ axis.setPen(pen)
556
+ axis.setTickPen(pen)
557
+ axis.setTextPen(pen)
558
+ axis.setTickFont(font)
559
+ axis.label.setFont(font)
560
+ # pyqtgraph otherwise halves the opacity at each successive tick
561
+ # level. Keep minor and subminor ticks visibly at the selected
562
+ # line weight rather than blending them into the heatmap.
563
+ axis.setStyle(tickAlpha=255)
564
+ # AxisItem clears its cached picture when its pens change, but
565
+ # does not schedule a repaint itself. This makes preference
566
+ # changes visible immediately, including minor tick levels.
567
+ axis.update()
568
+
569
+ for side in ["left", "bottom", "right", "top"]:
570
+ style_axis(plot_item.getAxis(side))
571
+
572
+ # A heatmap colour scale owns separate AxisItems from the plot. Style
573
+ # both the labelled axis and its mirrored tick-only axis when present.
574
+ colorbar = getattr(plot_win, "bar", None)
575
+ get_axis = getattr(colorbar, "getAxis", None)
576
+ if callable(get_axis):
577
+ for side in ["left", "bottom", "right", "top"]:
578
+ axis = get_axis(side)
579
+ if axis is not None:
580
+ style_axis(axis)
581
+
582
+ plot_item.vb.gridPen = pg.mkPen(color=cls.plot_grid)
583
+ cls.set_line_colours(plot_item)
584
+ update_annotation = getattr(plot_win, "_update_plot_annotation", None)
585
+ if callable(update_annotation):
586
+ update_annotation()
587
+
588
+ @classmethod
589
+ def set_line_colours(cls, plot_item):
590
+ for index, line in enumerate(plot_item.listDataItems()):
591
+ color = cls.colors[index % len(cls.colors)]
592
+ line.setPen(pg.mkPen(color=color))
@@ -0,0 +1,17 @@
1
+ import pyqtgraph as pg
2
+
3
+ from ._base import PlotTheme, color_list
4
+
5
+
6
+ class blank(PlotTheme):
7
+ main = ""
8
+ colors = color_list(["red", "green", "blue", "black", "darkcyan", "darkorange"])
9
+ plot_background = "w"
10
+ plot_foreground = "k"
11
+ plot_grid = "darkgray"
12
+
13
+ @classmethod
14
+ def style_plotItem(cls, plot_win):
15
+ pg.setConfigOption('background', "w")
16
+ pg.setConfigOption('foreground', "k")
17
+ super().style_plotItem(plot_win)
@@ -0,0 +1,54 @@
1
+ from ._base import (
2
+ PlotTheme,
3
+ ThemePalette,
4
+ build_stylesheet,
5
+ color_list,
6
+ )
7
+
8
+ _PALETTE = ThemePalette(
9
+ window_bg="#1f2026",
10
+ panel_bg="#202127",
11
+ panel_alt_bg="#20242a",
12
+ field_bg="#24262d",
13
+ field_alt_bg="#202127",
14
+ button_bg="#24262d",
15
+ button_hover_bg="#292d34",
16
+ button_pressed_bg="#123b36",
17
+ text="#c7d2e1",
18
+ text_strong="#ffffff",
19
+ muted_text="#aebacc",
20
+ disabled_text="#808086",
21
+ selection_bg="#0f766e",
22
+ selection_text="#ffffff",
23
+ accent="#16a085",
24
+ accent_hover="#37efba",
25
+ accent_soft="#183f3b",
26
+ accent_pressed="#123b36",
27
+ border="#343842",
28
+ border_strong="#474c57",
29
+ menu_hover_bg="#292d34",
30
+ tab_bg="#24262d",
31
+ tab_selected_bg="#0c625b",
32
+ tab_hover_bg="#183f3b",
33
+ table_bg="#1f2026",
34
+ table_alt_bg="#252730",
35
+ table_hover_bg="#24443f",
36
+ header_bg="#2a2d35",
37
+ status_text="#16a085",
38
+ progress_text="rgb(240, 240, 240)",
39
+ splitter="#343842",
40
+ scrollbar_bg="#252730",
41
+ scrollbar_handle="#6b7280",
42
+ scrollbar_handle_hover="#8d96a5",
43
+ danger="#f97316",
44
+ danger_bg="#3a2a22",
45
+ danger_pressed_bg="#4a2d1c",
46
+ )
47
+
48
+
49
+ class dark(PlotTheme):
50
+ main = build_stylesheet(_PALETTE)
51
+ colors = color_list(["red", "green", "blue", "white", "cyan", "yellow"])
52
+ plot_background = "k"
53
+ plot_foreground = "w"
54
+ plot_grid = "lightgray"
@@ -0,0 +1,54 @@
1
+ from ._base import (
2
+ PlotTheme,
3
+ ThemePalette,
4
+ build_stylesheet,
5
+ color_list,
6
+ )
7
+
8
+ _PALETTE = ThemePalette(
9
+ window_bg="#f0f0f0",
10
+ panel_bg="#eceef1",
11
+ panel_alt_bg="#f6f8fb",
12
+ field_bg="#ffffff",
13
+ field_alt_bg="#f8f9fb",
14
+ button_bg="#f7f8fa",
15
+ button_hover_bg="#ffffff",
16
+ button_pressed_bg="#e6f1ff",
17
+ text="#111827",
18
+ text_strong="#000000",
19
+ muted_text="#526173",
20
+ disabled_text="#a0a0a0",
21
+ selection_bg="#0a84ff",
22
+ selection_text="#ffffff",
23
+ accent="#0a84ff",
24
+ accent_hover="#075eb8",
25
+ accent_soft="#dcecff",
26
+ accent_pressed="#e6f1ff",
27
+ border="#d4d9e2",
28
+ border_strong="#b8bec7",
29
+ menu_hover_bg="#e0e0e0",
30
+ tab_bg="#f7f8fa",
31
+ tab_selected_bg="#dcecff",
32
+ tab_hover_bg="#eef6ff",
33
+ table_bg="#ffffff",
34
+ table_alt_bg="#f3f5f7",
35
+ table_hover_bg="#dcecff",
36
+ header_bg="#eef0f3",
37
+ status_text="#01664d",
38
+ progress_text="rgb(40, 40, 40)",
39
+ splitter="#d7dbe1",
40
+ scrollbar_bg="#eef0f3",
41
+ scrollbar_handle="#8b929b",
42
+ scrollbar_handle_hover="#66707c",
43
+ danger="#c2410c",
44
+ danger_bg="#fff7ed",
45
+ danger_pressed_bg="#ffedd5",
46
+ )
47
+
48
+
49
+ class light(PlotTheme):
50
+ main = build_stylesheet(_PALETTE)
51
+ colors = color_list(["red", "green", "blue", "black", "darkcyan", "darkorange"])
52
+ plot_background = "w"
53
+ plot_foreground = "k"
54
+ plot_grid = "darkgray"