qplotter 1.6.0b3__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.
- qplot/__init__.py +46 -0
- qplot/__main__.py +232 -0
- qplot/_auxiliary_paths.py +63 -0
- qplot/_metadata.py +12 -0
- qplot/_repair.py +14 -0
- qplot/_shutdown_supervisor.py +4049 -0
- qplot/_version.py +12 -0
- qplot/_windows_shutdown_job.py +1166 -0
- qplot/configuration/__init__.py +3 -0
- qplot/configuration/config.py +573 -0
- qplot/configuration/config_schema.json +319 -0
- qplot/configuration/scripts.py +255 -0
- qplot/configuration/themes/__init__.py +13 -0
- qplot/configuration/themes/_base.py +579 -0
- qplot/configuration/themes/blank.py +17 -0
- qplot/configuration/themes/dark.py +54 -0
- qplot/configuration/themes/light.py +54 -0
- qplot/datahandling/LoadFromDB.py +224 -0
- qplot/datahandling/__init__.py +47 -0
- qplot/datahandling/_trusted_live_helper.py +812 -0
- qplot/datahandling/_trusted_live_protocol.py +1745 -0
- qplot/datahandling/database.py +2330 -0
- qplot/datahandling/dimensions.py +43 -0
- qplot/datahandling/file_identity.py +461 -0
- qplot/datahandling/parameter_data.py +149 -0
- qplot/datahandling/plot_progress.py +17 -0
- qplot/datahandling/qcodes_cache.py +277 -0
- qplot/datahandling/qcodes_compat.py +14 -0
- qplot/datahandling/readSQL.py +2442 -0
- qplot/datahandling/readonly.py +2561 -0
- qplot/datahandling/source_activity.py +21 -0
- qplot/datahandling/trusted_array_preview.py +127 -0
- qplot/datahandling/trusted_derived_cache.py +1605 -0
- qplot/datahandling/trusted_derived_rendering.py +868 -0
- qplot/datahandling/trusted_heatmap.py +241 -0
- qplot/datahandling/trusted_live.py +2808 -0
- qplot/datahandling/trusted_live_queries.py +5907 -0
- qplot/datahandling/trusted_live_service.py +1894 -0
- qplot/datahandling/trusted_live_supervisor.py +2161 -0
- qplot/datahandling/trusted_plot.py +283 -0
- qplot/datahandling/trusted_presentation.py +1065 -0
- qplot/datahandling/trusted_snapshot.py +1132 -0
- qplot/datahandling/trusted_work_coordinator.py +2157 -0
- qplot/datahandling/trusted_work_scheduler.py +1204 -0
- qplot/diagnostics.py +241 -0
- qplot/resources/testdata/qplot_test_db_01_10mb.csv +11 -0
- qplot/resources/testdata/qplot_test_db_02_25mb.csv +14 -0
- qplot/resources/testdata/qplot_test_db_03_50mb.csv +17 -0
- qplot/resources/testdata/qplot_test_db_04_100mb.csv +20 -0
- qplot/resources/testdata/qplot_test_db_05_250mb.csv +23 -0
- qplot/resources/testdata/qplot_test_db_06_500mb.csv +26 -0
- qplot/resources/testdata/qplot_test_db_07_1gb.csv +29 -0
- qplot/resources/testdata/qplot_test_db_08_5gb.csv +32 -0
- qplot/resources/testdata/qplot_test_db_09_10gb.csv +35 -0
- qplot/resources/testdata/qplot_test_db_10_30gb.csv +38 -0
- qplot/testdata.py +1733 -0
- qplot/tools/__init__.py +13 -0
- qplot/tools/finite_means.py +114 -0
- qplot/tools/general.py +134 -0
- qplot/tools/heatmap_geometry.py +381 -0
- qplot/tools/operation_registry.py +179 -0
- qplot/tools/plot_tools.py +625 -0
- qplot/tools/sample_statistics.py +56 -0
- qplot/tools/worker.py +2787 -0
- qplot/windows/__init__.py +9 -0
- qplot/windows/_colorbar.py +422 -0
- qplot/windows/_commands.py +523 -0
- qplot/windows/_config_persistence.py +123 -0
- qplot/windows/_database_actions.py +4904 -0
- qplot/windows/_dataset_handle.py +221 -0
- qplot/windows/_dragdrop.py +71 -0
- qplot/windows/_export_paths.py +1167 -0
- qplot/windows/_help.py +169 -0
- qplot/windows/_native_averaging.py +173 -0
- qplot/windows/_native_transforms.py +389 -0
- qplot/windows/_plot1d_snap.py +608 -0
- qplot/windows/_plot1d_traces.py +2183 -0
- qplot/windows/_plot2d_colorbar.py +1126 -0
- qplot/windows/_plot2d_colorbar_dialog.py +786 -0
- qplot/windows/_plot2d_layers.py +2197 -0
- qplot/windows/_plot2d_sweeps.py +712 -0
- qplot/windows/_plotWin.py +1993 -0
- qplot/windows/_plot_actions.py +2695 -0
- qplot/windows/_plot_appearance.py +276 -0
- qplot/windows/_plot_axis_scaling.py +1485 -0
- qplot/windows/_plot_export.py +1445 -0
- qplot/windows/_plot_feedback.py +110 -0
- qplot/windows/_plot_marquee.py +656 -0
- qplot/windows/_plot_refresh.py +942 -0
- qplot/windows/_plot_state.py +239 -0
- qplot/windows/_plot_transform_labels.py +60 -0
- qplot/windows/_preferences.py +635 -0
- qplot/windows/_refresh_interval.py +70 -0
- qplot/windows/_run_controls.py +828 -0
- qplot/windows/_shortcuts.py +47 -0
- qplot/windows/_subplots/__init__.py +8 -0
- qplot/windows/_subplots/subplot1d.py +531 -0
- qplot/windows/_subplots/subplot2d.py +918 -0
- qplot/windows/_svg_export.py +209 -0
- qplot/windows/_trusted_derived_qt.py +1759 -0
- qplot/windows/_widgets/__init__.py +23 -0
- qplot/windows/_widgets/_run_formatting.py +387 -0
- qplot/windows/_widgets/details_tables.py +1119 -0
- qplot/windows/_widgets/dropbox.py +290 -0
- qplot/windows/_widgets/operations.py +460 -0
- qplot/windows/_widgets/preview.py +2997 -0
- qplot/windows/_widgets/run_list_items.py +488 -0
- qplot/windows/_widgets/toolbar.py +111 -0
- qplot/windows/_widgets/treeWidgets.py +2572 -0
- qplot/windows/_window_controls.py +413 -0
- qplot/windows/main.py +1635 -0
- qplot/windows/plot1d.py +311 -0
- qplot/windows/plot2d.py +1901 -0
- qplotter-1.6.0b3.dist-info/METADATA +318 -0
- qplotter-1.6.0b3.dist-info/RECORD +119 -0
- qplotter-1.6.0b3.dist-info/WHEEL +5 -0
- qplotter-1.6.0b3.dist-info/entry_points.txt +4 -0
- qplotter-1.6.0b3.dist-info/licenses/LICENSE +21 -0
- qplotter-1.6.0b3.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
"""Shared widgets used by plot-item appearance dialogs."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
from PyQt6 import QtCore, QtGui
|
|
8
|
+
from PyQt6 import QtWidgets as qtw
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class CenteredPreviewDelegate(qtw.QStyledItemDelegate):
|
|
12
|
+
"""Paint an icon-only plot preview in the centre of its table cell."""
|
|
13
|
+
|
|
14
|
+
def paint(self, painter, option, index):
|
|
15
|
+
icon = index.data(QtCore.Qt.ItemDataRole.DecorationRole)
|
|
16
|
+
if not isinstance(icon, QtGui.QIcon) or icon.isNull():
|
|
17
|
+
super().paint(painter, option, index)
|
|
18
|
+
return
|
|
19
|
+
|
|
20
|
+
styled_option = qtw.QStyleOptionViewItem(option)
|
|
21
|
+
self.initStyleOption(styled_option, index)
|
|
22
|
+
styled_option.text = ""
|
|
23
|
+
styled_option.icon = QtGui.QIcon()
|
|
24
|
+
|
|
25
|
+
widget = styled_option.widget
|
|
26
|
+
style = widget.style() if widget else qtw.QApplication.style()
|
|
27
|
+
if style is None:
|
|
28
|
+
super().paint(painter, option, index)
|
|
29
|
+
return
|
|
30
|
+
style.drawControl(
|
|
31
|
+
qtw.QStyle.ControlElement.CE_ItemViewItem,
|
|
32
|
+
styled_option,
|
|
33
|
+
painter,
|
|
34
|
+
widget,
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
icon_size = icon.actualSize(styled_option.rect.size())
|
|
38
|
+
icon_rect = QtCore.QRect(QtCore.QPoint(), icon_size)
|
|
39
|
+
icon_rect.moveCenter(styled_option.rect.center())
|
|
40
|
+
icon.paint(painter, icon_rect, QtCore.Qt.AlignmentFlag.AlignCenter)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class ReorderAppearanceTable(qtw.QTableWidget):
|
|
44
|
+
"""Three-column appearance table with internal multi-row reordering."""
|
|
45
|
+
|
|
46
|
+
def __init__(
|
|
47
|
+
self,
|
|
48
|
+
dialog: Any,
|
|
49
|
+
*,
|
|
50
|
+
mime_type: str,
|
|
51
|
+
) -> None:
|
|
52
|
+
super().__init__(0, 3, dialog)
|
|
53
|
+
self.dialog = dialog
|
|
54
|
+
self._reorder_mime_type = mime_type
|
|
55
|
+
self._dragged_rows: list[int] = []
|
|
56
|
+
self._drag_origin = QtCore.QModelIndex()
|
|
57
|
+
self.setMouseTracking(True)
|
|
58
|
+
self.viewport().setMouseTracking(True)
|
|
59
|
+
self._drop_indicator = qtw.QWidget(self.viewport())
|
|
60
|
+
self._drop_indicator.setAttribute(
|
|
61
|
+
QtCore.Qt.WidgetAttribute.WA_TransparentForMouseEvents
|
|
62
|
+
)
|
|
63
|
+
self._drop_indicator.setAttribute(
|
|
64
|
+
QtCore.Qt.WidgetAttribute.WA_StyledBackground
|
|
65
|
+
)
|
|
66
|
+
self._drop_indicator.setFixedHeight(2)
|
|
67
|
+
self._drop_indicator.setStyleSheet(
|
|
68
|
+
"background-color: palette(highlight);"
|
|
69
|
+
)
|
|
70
|
+
self._drop_indicator.hide()
|
|
71
|
+
|
|
72
|
+
def selectRow(self, row: int) -> None:
|
|
73
|
+
"""Select a whole row reliably before the table has been displayed."""
|
|
74
|
+
|
|
75
|
+
super().selectRow(row)
|
|
76
|
+
selection_model = self.selectionModel()
|
|
77
|
+
model = self.model()
|
|
78
|
+
if selection_model is None or model is None:
|
|
79
|
+
return
|
|
80
|
+
index = model.index(row, 0)
|
|
81
|
+
if not index.isValid():
|
|
82
|
+
return
|
|
83
|
+
selection_model.select(
|
|
84
|
+
index,
|
|
85
|
+
QtCore.QItemSelectionModel.SelectionFlag.Select
|
|
86
|
+
| QtCore.QItemSelectionModel.SelectionFlag.Rows,
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
def mousePressEvent(self, event: QtGui.QMouseEvent) -> None:
|
|
90
|
+
self._drag_origin = self.indexAt(event.position().toPoint())
|
|
91
|
+
super().mousePressEvent(event)
|
|
92
|
+
|
|
93
|
+
def mouseReleaseEvent(self, event: QtGui.QMouseEvent) -> None:
|
|
94
|
+
try:
|
|
95
|
+
super().mouseReleaseEvent(event)
|
|
96
|
+
finally:
|
|
97
|
+
self._drag_origin = QtCore.QModelIndex()
|
|
98
|
+
|
|
99
|
+
def mouseMoveEvent(self, event: QtGui.QMouseEvent) -> None:
|
|
100
|
+
self._update_reorder_cursor(event.position().toPoint())
|
|
101
|
+
super().mouseMoveEvent(event)
|
|
102
|
+
|
|
103
|
+
def leaveEvent(self, event: QtCore.QEvent) -> None:
|
|
104
|
+
self.viewport().unsetCursor()
|
|
105
|
+
super().leaveEvent(event)
|
|
106
|
+
|
|
107
|
+
def dragEnterEvent(self, event: QtGui.QDragEnterEvent) -> None:
|
|
108
|
+
if self._is_internal_reorder_drag(event):
|
|
109
|
+
event.acceptProposedAction()
|
|
110
|
+
return
|
|
111
|
+
event.ignore()
|
|
112
|
+
|
|
113
|
+
def dragMoveEvent(self, event: QtGui.QDragMoveEvent) -> None:
|
|
114
|
+
if self._is_internal_reorder_drag(event):
|
|
115
|
+
self._show_drop_indicator(
|
|
116
|
+
self._drop_insertion_row(event.position().toPoint())
|
|
117
|
+
)
|
|
118
|
+
event.acceptProposedAction()
|
|
119
|
+
return
|
|
120
|
+
event.ignore()
|
|
121
|
+
|
|
122
|
+
def dragLeaveEvent(self, event: QtGui.QDragLeaveEvent) -> None:
|
|
123
|
+
self._hide_drop_indicator()
|
|
124
|
+
super().dragLeaveEvent(event)
|
|
125
|
+
|
|
126
|
+
def dropEvent(self, event: QtGui.QDropEvent) -> None:
|
|
127
|
+
self._hide_drop_indicator()
|
|
128
|
+
if not self._is_internal_reorder_drag(event):
|
|
129
|
+
event.ignore()
|
|
130
|
+
return
|
|
131
|
+
|
|
132
|
+
source_rows = self._dragged_rows
|
|
133
|
+
self._dragged_rows = []
|
|
134
|
+
if not source_rows:
|
|
135
|
+
event.ignore()
|
|
136
|
+
return
|
|
137
|
+
|
|
138
|
+
self.dialog._move_rows_to_position(
|
|
139
|
+
source_rows,
|
|
140
|
+
self._drop_insertion_row(event.position().toPoint()),
|
|
141
|
+
)
|
|
142
|
+
event.acceptProposedAction()
|
|
143
|
+
|
|
144
|
+
def startDrag(self, supported_actions):
|
|
145
|
+
del supported_actions
|
|
146
|
+
index = self._drag_origin
|
|
147
|
+
if not index.isValid():
|
|
148
|
+
index = self.currentIndex()
|
|
149
|
+
if not index.isValid() or index.column() == self.dialog._COL_PREVIEW:
|
|
150
|
+
return
|
|
151
|
+
|
|
152
|
+
source_rows = self.dialog._selected_rows()
|
|
153
|
+
if not source_rows:
|
|
154
|
+
return
|
|
155
|
+
|
|
156
|
+
mime_data = QtCore.QMimeData()
|
|
157
|
+
mime_data.setData(self._reorder_mime_type, QtCore.QByteArray())
|
|
158
|
+
drag = QtGui.QDrag(self)
|
|
159
|
+
drag.setMimeData(mime_data)
|
|
160
|
+
self._dragged_rows = source_rows
|
|
161
|
+
try:
|
|
162
|
+
drag.exec(QtCore.Qt.DropAction.MoveAction)
|
|
163
|
+
finally:
|
|
164
|
+
self._dragged_rows = []
|
|
165
|
+
self._hide_drop_indicator()
|
|
166
|
+
|
|
167
|
+
def _is_internal_reorder_drag(self, event: QtGui.QDropEvent) -> bool:
|
|
168
|
+
return (
|
|
169
|
+
event.source() is self
|
|
170
|
+
and event.mimeData().hasFormat(self._reorder_mime_type)
|
|
171
|
+
)
|
|
172
|
+
|
|
173
|
+
def _drop_insertion_row(self, position: QtCore.QPoint) -> int:
|
|
174
|
+
index = self.indexAt(position)
|
|
175
|
+
if not index.isValid():
|
|
176
|
+
return self.rowCount()
|
|
177
|
+
if position.y() > self.visualRect(index).center().y():
|
|
178
|
+
return index.row() + 1
|
|
179
|
+
return index.row()
|
|
180
|
+
|
|
181
|
+
def _update_reorder_cursor(self, position: QtCore.QPoint) -> None:
|
|
182
|
+
index = self.indexAt(position)
|
|
183
|
+
if index.isValid() and index.column() != self.dialog._COL_PREVIEW:
|
|
184
|
+
self.viewport().setCursor(QtCore.Qt.CursorShape.SizeVerCursor)
|
|
185
|
+
return
|
|
186
|
+
self.viewport().unsetCursor()
|
|
187
|
+
|
|
188
|
+
def _show_drop_indicator(self, destination_row: int) -> None:
|
|
189
|
+
if not self.rowCount():
|
|
190
|
+
self._hide_drop_indicator()
|
|
191
|
+
return
|
|
192
|
+
|
|
193
|
+
destination_row = max(0, min(destination_row, self.rowCount()))
|
|
194
|
+
if destination_row == self.rowCount():
|
|
195
|
+
index = self.model().index(self.rowCount() - 1, 0)
|
|
196
|
+
y_position = self.visualRect(index).bottom() + 1
|
|
197
|
+
else:
|
|
198
|
+
index = self.model().index(destination_row, 0)
|
|
199
|
+
y_position = self.visualRect(index).top()
|
|
200
|
+
self._drop_indicator.setGeometry(
|
|
201
|
+
0,
|
|
202
|
+
max(0, y_position - 1),
|
|
203
|
+
self.viewport().width(),
|
|
204
|
+
self._drop_indicator.height(),
|
|
205
|
+
)
|
|
206
|
+
self._drop_indicator.show()
|
|
207
|
+
self._drop_indicator.raise_()
|
|
208
|
+
|
|
209
|
+
def _hide_drop_indicator(self) -> None:
|
|
210
|
+
self._drop_indicator.hide()
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
def configure_appearance_table(
|
|
214
|
+
table: qtw.QTableWidget,
|
|
215
|
+
dialog: Any,
|
|
216
|
+
*,
|
|
217
|
+
object_name: str,
|
|
218
|
+
item_name: str,
|
|
219
|
+
) -> None:
|
|
220
|
+
"""Apply the common appearance-table layout and interaction policy."""
|
|
221
|
+
|
|
222
|
+
table.setObjectName(object_name)
|
|
223
|
+
table.setHorizontalHeaderLabels(["ID", "Preview", "Measurement"])
|
|
224
|
+
table.setEditTriggers(qtw.QAbstractItemView.EditTrigger.NoEditTriggers)
|
|
225
|
+
table.setSelectionBehavior(qtw.QAbstractItemView.SelectionBehavior.SelectRows)
|
|
226
|
+
table.setSelectionMode(qtw.QAbstractItemView.SelectionMode.ExtendedSelection)
|
|
227
|
+
table.setAlternatingRowColors(True)
|
|
228
|
+
table.setShowGrid(False)
|
|
229
|
+
table.setWordWrap(False)
|
|
230
|
+
table.setTextElideMode(QtCore.Qt.TextElideMode.ElideRight)
|
|
231
|
+
table.setIconSize(QtCore.QSize(64, 22))
|
|
232
|
+
table.setHorizontalScrollBarPolicy(
|
|
233
|
+
QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff
|
|
234
|
+
)
|
|
235
|
+
table.setToolTip(f"Drag a {item_name} up or down to change its order.")
|
|
236
|
+
table.setDragEnabled(True)
|
|
237
|
+
table.setAcceptDrops(True)
|
|
238
|
+
table.viewport().setAcceptDrops(True)
|
|
239
|
+
table.setDragDropMode(qtw.QAbstractItemView.DragDropMode.DragDrop)
|
|
240
|
+
table.setDefaultDropAction(QtCore.Qt.DropAction.MoveAction)
|
|
241
|
+
table.setDropIndicatorShown(False)
|
|
242
|
+
table.setItemDelegateForColumn(
|
|
243
|
+
dialog._COL_PREVIEW,
|
|
244
|
+
CenteredPreviewDelegate(table),
|
|
245
|
+
)
|
|
246
|
+
|
|
247
|
+
horizontal_header = table.horizontalHeader()
|
|
248
|
+
if horizontal_header is not None:
|
|
249
|
+
header_font = horizontal_header.font()
|
|
250
|
+
header_font.setBold(False)
|
|
251
|
+
horizontal_header.setFont(header_font)
|
|
252
|
+
for column in range(table.columnCount()):
|
|
253
|
+
header_item = table.horizontalHeaderItem(column)
|
|
254
|
+
if header_item is not None:
|
|
255
|
+
item_font = header_item.font()
|
|
256
|
+
item_font.setBold(False)
|
|
257
|
+
header_item.setFont(item_font)
|
|
258
|
+
horizontal_header.setFixedHeight(24)
|
|
259
|
+
horizontal_header.setSectionResizeMode(
|
|
260
|
+
dialog._COL_ID,
|
|
261
|
+
qtw.QHeaderView.ResizeMode.ResizeToContents,
|
|
262
|
+
)
|
|
263
|
+
horizontal_header.setSectionResizeMode(
|
|
264
|
+
dialog._COL_PREVIEW,
|
|
265
|
+
qtw.QHeaderView.ResizeMode.ResizeToContents,
|
|
266
|
+
)
|
|
267
|
+
horizontal_header.setSectionResizeMode(
|
|
268
|
+
dialog._COL_MEASUREMENT,
|
|
269
|
+
qtw.QHeaderView.ResizeMode.Stretch,
|
|
270
|
+
)
|
|
271
|
+
|
|
272
|
+
vertical_header = table.verticalHeader()
|
|
273
|
+
if vertical_header is not None:
|
|
274
|
+
vertical_header.setVisible(False)
|
|
275
|
+
vertical_header.setDefaultSectionSize(28)
|
|
276
|
+
vertical_header.setMinimumSectionSize(24)
|