logqbit 0.7.1__tar.gz → 0.7.2__tar.gz
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.
- {logqbit-0.7.1 → logqbit-0.7.2}/PKG-INFO +1 -1
- {logqbit-0.7.1 → logqbit-0.7.2}/src/logqbit/gui/browser/plot/manager.py +49 -4
- {logqbit-0.7.1 → logqbit-0.7.2}/tests/gui/browser/test_plot.py +81 -5
- {logqbit-0.7.1 → logqbit-0.7.2}/.gitignore +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/LICENSE +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/README.md +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/pyproject.toml +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/src/logqbit/__init__.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/src/logqbit/assets/browser.svg +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/src/logqbit/assets/live_plotter.svg +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/src/logqbit/catalog.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/src/logqbit/cli/__init__.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/src/logqbit/cli/__main__.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/src/logqbit/cli/demo.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/src/logqbit/cli/main.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/src/logqbit/cli/shortcuts.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/src/logqbit/cli/svg2ico.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/src/logqbit/dataframe.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/src/logqbit/file_version.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/src/logqbit/gui/__init__.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/src/logqbit/gui/browser/__init__.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/src/logqbit/gui/browser/__main__.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/src/logqbit/gui/browser/about.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/src/logqbit/gui/browser/detail/__init__.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/src/logqbit/gui/browser/detail/data.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/src/logqbit/gui/browser/detail/files.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/src/logqbit/gui/browser/detail/view.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/src/logqbit/gui/browser/detail/yaml.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/src/logqbit/gui/browser/plot/__init__.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/src/logqbit/gui/browser/plot/cursor.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/src/logqbit/gui/browser/plot/fitting.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/src/logqbit/gui/browser/plot/grouping.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/src/logqbit/gui/browser/plot/mesh.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/src/logqbit/gui/browser/startup.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/src/logqbit/gui/browser/window/__init__.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/src/logqbit/gui/browser/window/merge.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/src/logqbit/gui/browser/window/model.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/src/logqbit/gui/browser/window/preferences.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/src/logqbit/gui/browser/window/view.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/src/logqbit/gui/live_plotter.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/src/logqbit/logfolder.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/src/logqbit/metadata.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/src/logqbit/registry.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/src/logqbit/templates/move_from_labrad.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/tests/core/test_browser_launcher.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/tests/core/test_cli.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/tests/core/test_dataframe.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/tests/core/test_log_catalog.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/tests/core/test_logfolder.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/tests/core/test_metadata.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/tests/core/test_public_api.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/tests/core/test_registry.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/tests/for_all_pythons.ps1 +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/tests/gui/browser/conftest.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/tests/gui/browser/test_catalog.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/tests/gui/browser/test_data.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/tests/gui/browser/test_detail.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/tests/gui/browser/test_list.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/tests/gui/browser/test_preferences.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/tests/gui/browser/test_startup.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/tests/gui/browser/test_window.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/tests/gui/browser/test_yaml.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/tests/gui/conftest.py +0 -0
- {logqbit-0.7.1 → logqbit-0.7.2}/tests/gui/test_live_plotter.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: logqbit
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.2
|
|
4
4
|
Summary: A lightweight, directory-based toolkit for logging and organizing lab experiment data.
|
|
5
5
|
Project-URL: Homepage, https://github.com/Qiujv/logqbit
|
|
6
6
|
Author-email: Qiujv <qiujv@outlook.com>
|
|
@@ -41,7 +41,7 @@ from logqbit.gui.browser.plot.grouping import iter_plot_groups
|
|
|
41
41
|
from logqbit.gui.browser.plot.mesh import build_plot_mesh
|
|
42
42
|
|
|
43
43
|
PLOT_EXPORT_SCALE = 2
|
|
44
|
-
PLOT_AUTO_RANGE_PADDING = 0.
|
|
44
|
+
PLOT_AUTO_RANGE_PADDING = 0.01
|
|
45
45
|
COLOR_BAR_HEIGHT_FACTOR = 0.9
|
|
46
46
|
PLOT_COLORS = (
|
|
47
47
|
"#1E90FF",
|
|
@@ -78,12 +78,13 @@ class TagBar(QWidget):
|
|
|
78
78
|
self._list.setDefaultDropAction(Qt.MoveAction)
|
|
79
79
|
self._list.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
|
|
80
80
|
self._list.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
|
|
81
|
+
self._list.setToolTip("Click to toggle field. Drag to reorder.")
|
|
81
82
|
row_height = self._list.fontMetrics().height() + 4
|
|
82
83
|
self._list.setFixedHeight(row_height + self._list.frameWidth() * 2)
|
|
83
84
|
self._list.installEventFilter(self)
|
|
84
85
|
self._list.setContextMenuPolicy(Qt.CustomContextMenu)
|
|
85
86
|
self._list.customContextMenuRequested.connect(self._show_context_menu)
|
|
86
|
-
self._list.itemClicked.connect(
|
|
87
|
+
self._list.itemClicked.connect(self._toggle_item_role)
|
|
87
88
|
|
|
88
89
|
model = self._list.model()
|
|
89
90
|
model.rowsInserted.connect(lambda *_: self._on_model_changed())
|
|
@@ -132,6 +133,39 @@ class TagBar(QWidget):
|
|
|
132
133
|
menu.addAction("Save", self.save_clicked.emit)
|
|
133
134
|
menu.exec(self._list.mapToGlobal(pos))
|
|
134
135
|
|
|
136
|
+
def _toggle_item_role(self, item: QListWidgetItem) -> None:
|
|
137
|
+
item_index = self._list.row(item)
|
|
138
|
+
separators = [
|
|
139
|
+
index
|
|
140
|
+
for index in range(self._list.count())
|
|
141
|
+
if self._list.item(index).text() == self._SEP
|
|
142
|
+
]
|
|
143
|
+
if item.text() == self._SEP or len(separators) < 2:
|
|
144
|
+
self._list.clearSelection()
|
|
145
|
+
return
|
|
146
|
+
if item_index < separators[0]:
|
|
147
|
+
self._list.clearSelection()
|
|
148
|
+
return
|
|
149
|
+
|
|
150
|
+
was_field = separators[0] < item_index < separators[1]
|
|
151
|
+
self._loading = True
|
|
152
|
+
try:
|
|
153
|
+
item = self._list.takeItem(item_index)
|
|
154
|
+
separator_indices = [
|
|
155
|
+
index
|
|
156
|
+
for index in range(self._list.count())
|
|
157
|
+
if self._list.item(index).text() == self._SEP
|
|
158
|
+
]
|
|
159
|
+
second_separator = separator_indices[1]
|
|
160
|
+
self._list.insertItem(
|
|
161
|
+
second_separator + 1 if was_field else second_separator,
|
|
162
|
+
item,
|
|
163
|
+
)
|
|
164
|
+
finally:
|
|
165
|
+
self._loading = False
|
|
166
|
+
self._list.clearSelection()
|
|
167
|
+
self._on_model_changed()
|
|
168
|
+
|
|
135
169
|
def eventFilter(self, obj, event):
|
|
136
170
|
if obj is self._list and event.type() == QEvent.Wheel:
|
|
137
171
|
bar = self._list.horizontalScrollBar()
|
|
@@ -455,20 +489,31 @@ class PlotManager:
|
|
|
455
489
|
previous_title = title_label.text
|
|
456
490
|
previous_options = dict(title_label.opts)
|
|
457
491
|
title_was_visible = title_label.isVisible()
|
|
492
|
+
previous_text_width = title_label.item.textWidth()
|
|
458
493
|
record = self._plot_record
|
|
459
494
|
if record is not None:
|
|
495
|
+
available_width = max(1.0, plot_item.vb.width())
|
|
496
|
+
title_label.item.setTextWidth(available_width)
|
|
497
|
+
title = html.escape(record.title)
|
|
498
|
+
path = html.escape(str(record.path)).replace("/", "/<wbr>")
|
|
460
499
|
plot_item.setTitle(
|
|
461
|
-
|
|
500
|
+
f"{title} — {path}",
|
|
462
501
|
color="k",
|
|
463
|
-
size="9pt",
|
|
464
502
|
)
|
|
503
|
+
title_height = title_label.item.boundingRect().height()
|
|
504
|
+
title_label.setMaximumHeight(title_height)
|
|
505
|
+
plot_item.layout.setRowFixedHeight(0, title_height)
|
|
465
506
|
plot_item.layout.activate()
|
|
466
507
|
try:
|
|
467
508
|
yield plot_item
|
|
468
509
|
finally:
|
|
469
510
|
if title_was_visible:
|
|
470
511
|
plot_item.setTitle(previous_title, **previous_options)
|
|
512
|
+
title_label.item.setTextWidth(previous_text_width)
|
|
513
|
+
title_label.updateMin()
|
|
471
514
|
else:
|
|
515
|
+
title_label.item.setTextWidth(previous_text_width)
|
|
516
|
+
title_label.setText("")
|
|
472
517
|
plot_item.setTitle(None)
|
|
473
518
|
plot_item.layout.activate()
|
|
474
519
|
|
|
@@ -118,6 +118,78 @@ class TestTagBar:
|
|
|
118
118
|
assert tag_bar.groupby == []
|
|
119
119
|
assert tag_bar.groupby_button.text() == "group by"
|
|
120
120
|
|
|
121
|
+
def test_clicking_field_moves_it_to_start_of_ignored_columns(self) -> None:
|
|
122
|
+
tag_bar = TagBar()
|
|
123
|
+
tag_bar.set_columns(
|
|
124
|
+
["x", "signal", "reference", "note"],
|
|
125
|
+
["x"],
|
|
126
|
+
["signal", "reference"],
|
|
127
|
+
[],
|
|
128
|
+
)
|
|
129
|
+
changes: list[None] = []
|
|
130
|
+
tag_bar.changed.connect(lambda: changes.append(None))
|
|
131
|
+
|
|
132
|
+
tag_bar._toggle_item_role(tag_bar._list.item(2))
|
|
133
|
+
|
|
134
|
+
assert tag_bar.axes == ["x"]
|
|
135
|
+
assert tag_bar.fields == ["reference"]
|
|
136
|
+
assert tag_bar._split()[2] == ["signal", "note"]
|
|
137
|
+
assert changes == [None]
|
|
138
|
+
|
|
139
|
+
def test_clicking_axis_does_not_change_roles(self) -> None:
|
|
140
|
+
tag_bar = TagBar()
|
|
141
|
+
tag_bar.set_columns(["x", "signal"], ["x"], ["signal"], [])
|
|
142
|
+
changes: list[None] = []
|
|
143
|
+
tag_bar.changed.connect(lambda: changes.append(None))
|
|
144
|
+
|
|
145
|
+
tag_bar._toggle_item_role(tag_bar._list.item(0))
|
|
146
|
+
|
|
147
|
+
assert tag_bar.axes == ["x"]
|
|
148
|
+
assert tag_bar.fields == ["signal"]
|
|
149
|
+
assert changes == []
|
|
150
|
+
|
|
151
|
+
def test_clicking_non_field_moves_it_to_end_of_fields(self) -> None:
|
|
152
|
+
tag_bar = TagBar()
|
|
153
|
+
tag_bar.set_columns(
|
|
154
|
+
["x", "signal", "reference"],
|
|
155
|
+
["x"],
|
|
156
|
+
["signal"],
|
|
157
|
+
[],
|
|
158
|
+
)
|
|
159
|
+
|
|
160
|
+
tag_bar._toggle_item_role(tag_bar._list.item(4))
|
|
161
|
+
|
|
162
|
+
assert tag_bar.axes == ["x"]
|
|
163
|
+
assert tag_bar.fields == ["signal", "reference"]
|
|
164
|
+
assert tag_bar._split()[2] == []
|
|
165
|
+
|
|
166
|
+
def test_clicking_groupby_column_moves_it_to_fields(self) -> None:
|
|
167
|
+
tag_bar = TagBar()
|
|
168
|
+
tag_bar.set_columns(
|
|
169
|
+
["x", "signal", "device"],
|
|
170
|
+
["x"],
|
|
171
|
+
["signal"],
|
|
172
|
+
["device"],
|
|
173
|
+
)
|
|
174
|
+
|
|
175
|
+
tag_bar._toggle_item_role(tag_bar._list.item(4))
|
|
176
|
+
|
|
177
|
+
assert tag_bar.axes == ["x"]
|
|
178
|
+
assert tag_bar.fields == ["signal", "device"]
|
|
179
|
+
assert tag_bar.groupby == []
|
|
180
|
+
|
|
181
|
+
def test_clicking_separator_does_not_change_roles(self) -> None:
|
|
182
|
+
tag_bar = TagBar()
|
|
183
|
+
tag_bar.set_columns(["x", "signal"], ["x"], ["signal"], [])
|
|
184
|
+
changes: list[None] = []
|
|
185
|
+
tag_bar.changed.connect(lambda: changes.append(None))
|
|
186
|
+
|
|
187
|
+
tag_bar._toggle_item_role(tag_bar._list.item(1))
|
|
188
|
+
|
|
189
|
+
assert tag_bar.axes == ["x"]
|
|
190
|
+
assert tag_bar.fields == ["signal"]
|
|
191
|
+
assert changes == []
|
|
192
|
+
|
|
121
193
|
|
|
122
194
|
def test_resolve_plot_columns_fills_axes_before_fields() -> None:
|
|
123
195
|
resolved = resolve_plot_columns(
|
|
@@ -377,7 +449,9 @@ class TestPlotManagerFitAndColorBar:
|
|
|
377
449
|
) -> None:
|
|
378
450
|
manager = PlotManager()
|
|
379
451
|
record_path = Path("/logs/example-record")
|
|
380
|
-
manager._plot_record = SimpleNamespace(path=record_path)
|
|
452
|
+
manager._plot_record = SimpleNamespace(path=record_path, title="Example title")
|
|
453
|
+
plot_item = manager.plot_widget.getPlotItem()
|
|
454
|
+
initial_minimum_width = plot_item.layout.minimumWidth()
|
|
381
455
|
observed: dict[str, object] = {}
|
|
382
456
|
|
|
383
457
|
class FakeExporter:
|
|
@@ -402,11 +476,13 @@ class TestPlotManagerFitAndColorBar:
|
|
|
402
476
|
|
|
403
477
|
assert observed == {
|
|
404
478
|
"copy": True,
|
|
405
|
-
"title": str(record_path),
|
|
479
|
+
"title": f"Example title — {str(record_path).replace('/', '/<wbr>')}",
|
|
406
480
|
"visible": True,
|
|
407
481
|
"width": 800,
|
|
408
482
|
}
|
|
409
|
-
assert not
|
|
483
|
+
assert not plot_item.titleLabel.isVisible()
|
|
484
|
+
assert plot_item.titleLabel.text == ""
|
|
485
|
+
assert plot_item.layout.minimumWidth() == initial_minimum_width
|
|
410
486
|
manager.widget.deleteLater()
|
|
411
487
|
|
|
412
488
|
def test_save_plot_writes_png_with_record_path_title(
|
|
@@ -415,7 +491,7 @@ class TestPlotManagerFitAndColorBar:
|
|
|
415
491
|
monkeypatch: pytest.MonkeyPatch,
|
|
416
492
|
) -> None:
|
|
417
493
|
manager = PlotManager()
|
|
418
|
-
manager._plot_record = SimpleNamespace(path=tmp_path)
|
|
494
|
+
manager._plot_record = SimpleNamespace(path=tmp_path, title="Example title")
|
|
419
495
|
observed: dict[str, object] = {}
|
|
420
496
|
|
|
421
497
|
class FakeExporter:
|
|
@@ -447,7 +523,7 @@ class TestPlotManagerFitAndColorBar:
|
|
|
447
523
|
|
|
448
524
|
assert observed == {
|
|
449
525
|
"to_bytes": True,
|
|
450
|
-
"title": str(tmp_path),
|
|
526
|
+
"title": f"Example title — {str(tmp_path).replace('/', '/<wbr>')}",
|
|
451
527
|
"width": 800,
|
|
452
528
|
"path": str(tmp_path / "plot.png"),
|
|
453
529
|
"format": "PNG",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|