bec-widgets 0.69.0__py3-none-any.whl → 0.71.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.
- CHANGELOG.md +64 -87
- PKG-INFO +1 -1
- bec_widgets/cli/client.py +19 -0
- bec_widgets/examples/plugin_example_pyside/__init__.py +0 -0
- bec_widgets/examples/plugin_example_pyside/main.py +17 -0
- bec_widgets/examples/plugin_example_pyside/registertictactoe.py +12 -0
- bec_widgets/examples/plugin_example_pyside/taskmenuextension.pyproject +4 -0
- bec_widgets/examples/plugin_example_pyside/tictactoe.py +135 -0
- bec_widgets/examples/plugin_example_pyside/tictactoeplugin.py +68 -0
- bec_widgets/examples/plugin_example_pyside/tictactoetaskmenu.py +67 -0
- bec_widgets/utils/bec_designer.py +87 -0
- bec_widgets/utils/widget_io.py +18 -2
- bec_widgets/widgets/device_inputs/device_combobox/device_combobox.py +10 -13
- bec_widgets/widgets/device_inputs/device_combobox/device_combobox.pyproject +4 -0
- bec_widgets/widgets/device_inputs/device_combobox/device_combobox_plugin.py +54 -0
- bec_widgets/widgets/device_inputs/device_combobox/launch_device_combobox.py +11 -0
- bec_widgets/widgets/device_inputs/device_combobox/register_device_combobox.py +17 -0
- bec_widgets/widgets/device_inputs/device_input_base.py +5 -2
- bec_widgets/widgets/device_inputs/device_line_edit/device_line_edit.py +16 -14
- bec_widgets/widgets/device_inputs/device_line_edit/device_line_edit.pyproject +4 -0
- bec_widgets/widgets/device_inputs/device_line_edit/device_line_edit_plugin.py +54 -0
- bec_widgets/widgets/device_inputs/device_line_edit/launch_device_line_edit.py +11 -0
- bec_widgets/widgets/device_inputs/device_line_edit/register_device_line_edit.py +17 -0
- bec_widgets/widgets/scan_control/scan_control.py +133 -365
- bec_widgets/widgets/scan_control/scan_group_box.py +223 -0
- {bec_widgets-0.69.0.dist-info → bec_widgets-0.71.0.dist-info}/METADATA +1 -1
- {bec_widgets-0.69.0.dist-info → bec_widgets-0.71.0.dist-info}/RECORD +39 -18
- {bec_widgets-0.69.0.dist-info → bec_widgets-0.71.0.dist-info}/WHEEL +1 -1
- {bec_widgets-0.69.0.dist-info → bec_widgets-0.71.0.dist-info}/entry_points.txt +1 -0
- docs/user/widgets/bec_status_box.md +1 -1
- docs/user/widgets/scan_control.gif +0 -0
- docs/user/widgets/scan_control.md +35 -0
- pyproject.toml +2 -1
- tests/end-2-end/test_scan_control_e2e.py +71 -0
- tests/unit_tests/test_device_input_base.py +4 -4
- tests/unit_tests/test_device_input_widgets.py +10 -10
- tests/unit_tests/test_scan_control.py +255 -115
- tests/unit_tests/test_scan_control_group_box.py +160 -0
- {bec_widgets-0.69.0.dist-info → bec_widgets-0.71.0.dist-info}/licenses/LICENSE +0 -0
@@ -18,7 +18,7 @@ class DeviceComboBox(DeviceInputBase, QComboBox):
|
|
18
18
|
config: Device input configuration.
|
19
19
|
gui_id: GUI ID.
|
20
20
|
device_filter: Device filter, name of the device class.
|
21
|
-
|
21
|
+
default: Default device name.
|
22
22
|
arg_name: Argument name, can be used for the other widgets which has to call some other function in bec using correct argument names.
|
23
23
|
"""
|
24
24
|
|
@@ -29,7 +29,7 @@ class DeviceComboBox(DeviceInputBase, QComboBox):
|
|
29
29
|
config: DeviceInputConfig = None,
|
30
30
|
gui_id: str | None = None,
|
31
31
|
device_filter: str | None = None,
|
32
|
-
|
32
|
+
default: str | None = None,
|
33
33
|
arg_name: str | None = None,
|
34
34
|
):
|
35
35
|
super().__init__(client=client, config=config, gui_id=gui_id)
|
@@ -41,8 +41,8 @@ class DeviceComboBox(DeviceInputBase, QComboBox):
|
|
41
41
|
self.config.arg_name = arg_name
|
42
42
|
if device_filter is not None:
|
43
43
|
self.set_device_filter(device_filter)
|
44
|
-
if
|
45
|
-
self.set_default_device(
|
44
|
+
if default is not None:
|
45
|
+
self.set_default_device(default)
|
46
46
|
|
47
47
|
def set_device_filter(self, device_filter: str):
|
48
48
|
"""
|
@@ -83,13 +83,10 @@ class DeviceComboBox(DeviceInputBase, QComboBox):
|
|
83
83
|
raise ValueError(f"Device {device_name} is not found.")
|
84
84
|
return device_obj
|
85
85
|
|
86
|
+
def cleanup(self):
|
87
|
+
"""Cleanup the widget."""
|
88
|
+
super().cleanup()
|
86
89
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
from qtpy.QtWidgets import QApplication
|
91
|
-
|
92
|
-
app = QApplication(sys.argv)
|
93
|
-
w = DeviceComboBox(default_device="samx")
|
94
|
-
w.show()
|
95
|
-
sys.exit(app.exec_())
|
90
|
+
def closeEvent(self, event):
|
91
|
+
super().cleanup()
|
92
|
+
QComboBox().closeEvent(event)
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# Copyright (C) 2022 The Qt Company Ltd.
|
2
|
+
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
3
|
+
|
4
|
+
from qtpy.QtDesigner import QDesignerCustomWidgetInterface
|
5
|
+
from qtpy.QtGui import QIcon
|
6
|
+
|
7
|
+
from bec_widgets.widgets.device_inputs import DeviceComboBox
|
8
|
+
|
9
|
+
DOM_XML = """
|
10
|
+
<ui language='c++'>
|
11
|
+
<widget class='DeviceComboBox' name='device_combobox'>
|
12
|
+
</widget>
|
13
|
+
</ui>
|
14
|
+
"""
|
15
|
+
|
16
|
+
|
17
|
+
class DeviceComboBoxPlugin(QDesignerCustomWidgetInterface): # pragma: no cover
|
18
|
+
def __init__(self):
|
19
|
+
super().__init__()
|
20
|
+
self._form_editor = None
|
21
|
+
|
22
|
+
def createWidget(self, parent):
|
23
|
+
t = DeviceComboBox(parent)
|
24
|
+
return t
|
25
|
+
|
26
|
+
def domXml(self):
|
27
|
+
return DOM_XML
|
28
|
+
|
29
|
+
def group(self):
|
30
|
+
return ""
|
31
|
+
|
32
|
+
def icon(self):
|
33
|
+
return QIcon()
|
34
|
+
|
35
|
+
def includeFile(self):
|
36
|
+
return "device_combobox"
|
37
|
+
|
38
|
+
def initialize(self, form_editor):
|
39
|
+
self._form_editor = form_editor
|
40
|
+
|
41
|
+
def isContainer(self):
|
42
|
+
return False
|
43
|
+
|
44
|
+
def isInitialized(self):
|
45
|
+
return self._form_editor is not None
|
46
|
+
|
47
|
+
def name(self):
|
48
|
+
return "DeviceComboBox"
|
49
|
+
|
50
|
+
def toolTip(self):
|
51
|
+
return "Device ComboBox Example for BEC Widgets"
|
52
|
+
|
53
|
+
def whatsThis(self):
|
54
|
+
return self.toolTip()
|
@@ -0,0 +1,11 @@
|
|
1
|
+
from bec_widgets.widgets.device_inputs import DeviceComboBox
|
2
|
+
|
3
|
+
if __name__ == "__main__": # pragma: no cover
|
4
|
+
import sys
|
5
|
+
|
6
|
+
from qtpy.QtWidgets import QApplication
|
7
|
+
|
8
|
+
app = QApplication(sys.argv)
|
9
|
+
w = DeviceComboBox()
|
10
|
+
w.show()
|
11
|
+
sys.exit(app.exec_())
|
@@ -0,0 +1,17 @@
|
|
1
|
+
def main(): # pragma: no cover
|
2
|
+
from qtpy import PYSIDE6
|
3
|
+
|
4
|
+
if not PYSIDE6:
|
5
|
+
print("PYSIDE6 is not available in the environment. Cannot patch designer.")
|
6
|
+
return
|
7
|
+
from PySide6.QtDesigner import QPyDesignerCustomWidgetCollection
|
8
|
+
|
9
|
+
from bec_widgets.widgets.device_inputs.device_combobox.device_combobox_plugin import (
|
10
|
+
DeviceComboBoxPlugin,
|
11
|
+
)
|
12
|
+
|
13
|
+
QPyDesignerCustomWidgetCollection.addCustomWidget(DeviceComboBoxPlugin())
|
14
|
+
|
15
|
+
|
16
|
+
if __name__ == "__main__": # pragma: no cover
|
17
|
+
main()
|
@@ -5,7 +5,7 @@ from bec_widgets.utils import BECConnector, ConnectionConfig
|
|
5
5
|
|
6
6
|
class DeviceInputConfig(ConnectionConfig):
|
7
7
|
device_filter: str | list[str] | None = None
|
8
|
-
|
8
|
+
default: str | None = None
|
9
9
|
arg_name: str | None = None
|
10
10
|
|
11
11
|
|
@@ -65,7 +65,7 @@ class DeviceInputBase(BECConnector):
|
|
65
65
|
default_device(str): Default device name.
|
66
66
|
"""
|
67
67
|
self.validate_device(default_device)
|
68
|
-
self.config.
|
68
|
+
self.config.default = default_device
|
69
69
|
|
70
70
|
def get_device_list(self, filter: str | list[str] | None = None) -> list[str]:
|
71
71
|
"""
|
@@ -118,3 +118,6 @@ class DeviceInputBase(BECConnector):
|
|
118
118
|
"""
|
119
119
|
if device not in self.get_device_list(self.config.device_filter):
|
120
120
|
raise ValueError(f"Device {device} is not valid.")
|
121
|
+
|
122
|
+
def cleanup(self):
|
123
|
+
super().cleanup()
|
@@ -1,6 +1,7 @@
|
|
1
1
|
from typing import TYPE_CHECKING
|
2
2
|
|
3
|
-
from qtpy.
|
3
|
+
from qtpy.QtCore import QSize
|
4
|
+
from qtpy.QtWidgets import QCompleter, QLineEdit, QSizePolicy
|
4
5
|
|
5
6
|
from bec_widgets.widgets.device_inputs.device_input_base import DeviceInputBase, DeviceInputConfig
|
6
7
|
|
@@ -18,7 +19,7 @@ class DeviceLineEdit(DeviceInputBase, QLineEdit):
|
|
18
19
|
config: Device input configuration.
|
19
20
|
gui_id: GUI ID.
|
20
21
|
device_filter: Device filter, name of the device class.
|
21
|
-
|
22
|
+
default: Default device name.
|
22
23
|
arg_name: Argument name, can be used for the other widgets which has to call some other function in bec using correct argument names.
|
23
24
|
"""
|
24
25
|
|
@@ -29,7 +30,7 @@ class DeviceLineEdit(DeviceInputBase, QLineEdit):
|
|
29
30
|
config: DeviceInputConfig = None,
|
30
31
|
gui_id: str | None = None,
|
31
32
|
device_filter: str | list[str] | None = None,
|
32
|
-
|
33
|
+
default: str | None = None,
|
33
34
|
arg_name: str | None = None,
|
34
35
|
):
|
35
36
|
QLineEdit.__init__(self, parent=parent)
|
@@ -41,10 +42,14 @@ class DeviceLineEdit(DeviceInputBase, QLineEdit):
|
|
41
42
|
|
42
43
|
if arg_name is not None:
|
43
44
|
self.config.arg_name = arg_name
|
45
|
+
self.arg_name = arg_name
|
44
46
|
if device_filter is not None:
|
45
47
|
self.set_device_filter(device_filter)
|
46
|
-
if
|
47
|
-
self.set_default_device(
|
48
|
+
if default is not None:
|
49
|
+
self.set_default_device(default)
|
50
|
+
|
51
|
+
self.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed)
|
52
|
+
self.setMinimumSize(QSize(100, 0))
|
48
53
|
|
49
54
|
def set_device_filter(self, device_filter: str | list[str]):
|
50
55
|
"""
|
@@ -90,13 +95,10 @@ class DeviceLineEdit(DeviceInputBase, QLineEdit):
|
|
90
95
|
raise ValueError(f"Device {device_name} is not found.")
|
91
96
|
return device_obj
|
92
97
|
|
98
|
+
def cleanup(self):
|
99
|
+
"""Cleanup the widget."""
|
100
|
+
super().cleanup()
|
93
101
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
from qtpy.QtWidgets import QApplication
|
98
|
-
|
99
|
-
app = QApplication(sys.argv)
|
100
|
-
w = DeviceLineEdit(default_device="samx")
|
101
|
-
w.show()
|
102
|
-
sys.exit(app.exec_())
|
102
|
+
def closeEvent(self, event):
|
103
|
+
super().cleanup()
|
104
|
+
QLineEdit().closeEvent(event)
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# Copyright (C) 2022 The Qt Company Ltd.
|
2
|
+
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
3
|
+
|
4
|
+
from qtpy.QtDesigner import QDesignerCustomWidgetInterface
|
5
|
+
from qtpy.QtGui import QIcon
|
6
|
+
|
7
|
+
from bec_widgets.widgets.device_inputs import DeviceLineEdit
|
8
|
+
|
9
|
+
DOM_XML = """
|
10
|
+
<ui language='c++'>
|
11
|
+
<widget class='DeviceLineEdit' name='device_line_edit'>
|
12
|
+
</widget>
|
13
|
+
</ui>
|
14
|
+
"""
|
15
|
+
|
16
|
+
|
17
|
+
class DeviceLineEditPlugin(QDesignerCustomWidgetInterface): # pragma: no cover
|
18
|
+
def __init__(self):
|
19
|
+
super().__init__()
|
20
|
+
self._form_editor = None
|
21
|
+
|
22
|
+
def createWidget(self, parent):
|
23
|
+
t = DeviceLineEdit(parent)
|
24
|
+
return t
|
25
|
+
|
26
|
+
def domXml(self):
|
27
|
+
return DOM_XML
|
28
|
+
|
29
|
+
def group(self):
|
30
|
+
return ""
|
31
|
+
|
32
|
+
def icon(self):
|
33
|
+
return QIcon()
|
34
|
+
|
35
|
+
def includeFile(self):
|
36
|
+
return "device_line_edit"
|
37
|
+
|
38
|
+
def initialize(self, form_editor):
|
39
|
+
self._form_editor = form_editor
|
40
|
+
|
41
|
+
def isContainer(self):
|
42
|
+
return False
|
43
|
+
|
44
|
+
def isInitialized(self):
|
45
|
+
return self._form_editor is not None
|
46
|
+
|
47
|
+
def name(self):
|
48
|
+
return "DeviceLineEdit"
|
49
|
+
|
50
|
+
def toolTip(self):
|
51
|
+
return "Device LineEdit Example for BEC Widgets with autocomplete."
|
52
|
+
|
53
|
+
def whatsThis(self):
|
54
|
+
return self.toolTip()
|
@@ -0,0 +1,11 @@
|
|
1
|
+
from bec_widgets.widgets.device_inputs import DeviceLineEdit
|
2
|
+
|
3
|
+
if __name__ == "__main__": # pragma: no cover
|
4
|
+
import sys
|
5
|
+
|
6
|
+
from qtpy.QtWidgets import QApplication
|
7
|
+
|
8
|
+
app = QApplication(sys.argv)
|
9
|
+
w = DeviceLineEdit()
|
10
|
+
w.show()
|
11
|
+
sys.exit(app.exec_())
|
@@ -0,0 +1,17 @@
|
|
1
|
+
def main(): # pragma: no cover
|
2
|
+
from qtpy import PYSIDE6
|
3
|
+
|
4
|
+
if not PYSIDE6:
|
5
|
+
print("PYSIDE6 is not available in the environment. Cannot patch designer.")
|
6
|
+
return
|
7
|
+
from PySide6.QtDesigner import QPyDesignerCustomWidgetCollection
|
8
|
+
|
9
|
+
from bec_widgets.widgets.device_inputs.device_line_edit.device_line_edit_plugin import (
|
10
|
+
DeviceLineEditPlugin,
|
11
|
+
)
|
12
|
+
|
13
|
+
QPyDesignerCustomWidgetCollection.addCustomWidget(DeviceLineEditPlugin())
|
14
|
+
|
15
|
+
|
16
|
+
if __name__ == "__main__": # pragma: no cover
|
17
|
+
main()
|