mirror of
https://github.com/bec-project/bec_widgets.git
synced 2026-04-14 04:30:54 +02:00
Compare commits
2 Commits
scratch/de
...
test/738_d
| Author | SHA1 | Date | |
|---|---|---|---|
| 9c47a13d43 | |||
| 0155ceccc8 |
@@ -39,22 +39,26 @@ class ScanMetadata(PydanticModelForm):
|
||||
|
||||
# self.populate() gets called in super().__init__
|
||||
# so make sure self._additional_metadata exists
|
||||
self._additional_md_box = ExpandableGroupFrame(
|
||||
parent, "Additional metadata", expanded=False
|
||||
)
|
||||
self._scan_name = scan_name or ""
|
||||
self._md_schema = get_metadata_schema_for_scan(self._scan_name)
|
||||
super().__init__(parent=parent, data_model=self._md_schema, client=client, **kwargs)
|
||||
|
||||
self._additional_md_box = ExpandableGroupFrame(self, "Additional metadata", expanded=False)
|
||||
self._additional_md_box_layout = QHBoxLayout()
|
||||
self._additional_md_box.set_layout(self._additional_md_box_layout)
|
||||
|
||||
self._additional_metadata = DictBackedTable(parent, initial_extras or [])
|
||||
self._scan_name = scan_name or ""
|
||||
self._md_schema = get_metadata_schema_for_scan(self._scan_name)
|
||||
self._additional_metadata = DictBackedTable(self, initial_extras or [])
|
||||
self._additional_metadata.data_changed.connect(self.validate_form)
|
||||
|
||||
super().__init__(parent=parent, data_model=self._md_schema, client=client, **kwargs)
|
||||
|
||||
self._layout.addWidget(self._additional_md_box)
|
||||
self._additional_md_box_layout.addWidget(self._additional_metadata)
|
||||
|
||||
self.populate()
|
||||
self.enabled = self._enabled
|
||||
|
||||
def _post_init(self):
|
||||
return
|
||||
|
||||
@SafeSlot(str)
|
||||
def update_with_new_scan(self, scan_name: str):
|
||||
self.set_schema_from_scan(scan_name)
|
||||
|
||||
42
tests/end-2-end/test_dockarea_menu.py
Normal file
42
tests/end-2-end/test_dockarea_menu.py
Normal file
@@ -0,0 +1,42 @@
|
||||
import pytest
|
||||
from qtpy.QtCore import Qt
|
||||
|
||||
from bec_widgets.widgets.containers.dock.dock_area import BECDockArea
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def dock_area(qtbot):
|
||||
|
||||
dock = BECDockArea()
|
||||
qtbot.addWidget(dock)
|
||||
qtbot.waitExposed(dock)
|
||||
dock.show()
|
||||
qtbot.wait(500)
|
||||
|
||||
yield dock
|
||||
|
||||
dock.remove()
|
||||
dock.deleteLater()
|
||||
|
||||
|
||||
def test_sequence_of_add_and_remove(qtbot, dock_area):
|
||||
|
||||
add_sc_action = dock_area.toolbar.widgets["menu_devices"].widgets["scan_control"]
|
||||
add_pb_action = dock_area.toolbar.widgets["menu_devices"].widgets["positioner_box"]
|
||||
|
||||
add_pb_action.trigger()
|
||||
qtbot.wait(1000)
|
||||
|
||||
add_sc_action.trigger()
|
||||
qtbot.wait(1000)
|
||||
|
||||
assert all(w in dock_area.panels for w in ["positioner_box_0", "scan_control_0"])
|
||||
|
||||
dock_area.panels["positioner_box_0"].remove()
|
||||
qtbot.wait(1000)
|
||||
|
||||
dock_area.panels["scan_control_0"].remove()
|
||||
qtbot.wait(1000)
|
||||
|
||||
add_pb_action.trigger()
|
||||
qtbot.wait(1000)
|
||||
Reference in New Issue
Block a user