bec-widgets 0.90.0__py3-none-any.whl → 0.92.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 +34 -34
- PKG-INFO +1 -1
- bec_widgets/assets/app_icons/BEC-Dark.png +0 -0
- bec_widgets/assets/designer_icons/code.png +0 -0
- bec_widgets/assets/designer_icons/color_button.png +0 -0
- bec_widgets/assets/designer_icons/device_box.png +0 -0
- bec_widgets/assets/designer_icons/device_combo_box.png +0 -0
- bec_widgets/assets/designer_icons/device_line_edit.png +0 -0
- bec_widgets/assets/designer_icons/dock_area.png +0 -0
- bec_widgets/assets/designer_icons/games.png +0 -0
- bec_widgets/assets/designer_icons/position_indicator.png +0 -0
- bec_widgets/assets/designer_icons/queue.png +0 -0
- bec_widgets/assets/designer_icons/ring_progress.png +0 -0
- bec_widgets/assets/designer_icons/scan_control.png +0 -0
- bec_widgets/assets/designer_icons/spinner.png +0 -0
- bec_widgets/assets/designer_icons/status.png +0 -0
- bec_widgets/assets/designer_icons/stop.png +0 -0
- bec_widgets/assets/designer_icons/text.png +0 -0
- bec_widgets/assets/designer_icons/toggle.png +0 -0
- bec_widgets/assets/designer_icons/web.png +0 -0
- bec_widgets/assets/status_icons/error.svg +3 -0
- bec_widgets/assets/status_icons/not_connected.svg +3 -0
- bec_widgets/assets/status_icons/refresh.svg +3 -0
- bec_widgets/assets/status_icons/running.svg +3 -0
- bec_widgets/assets/status_icons/warning.svg +3 -0
- bec_widgets/assets/toolbar_icons/attach_all.svg +3 -0
- bec_widgets/assets/toolbar_icons/device_box.svg +3 -0
- bec_widgets/assets/toolbar_icons/image.svg +3 -0
- bec_widgets/assets/toolbar_icons/motor_map.svg +3 -0
- bec_widgets/assets/toolbar_icons/progress.svg +3 -0
- bec_widgets/assets/toolbar_icons/queue.svg +3 -0
- bec_widgets/assets/toolbar_icons/restore_state.svg +3 -0
- bec_widgets/assets/toolbar_icons/ring_progress.svg +3 -0
- bec_widgets/assets/toolbar_icons/save_state.svg +3 -0
- bec_widgets/assets/toolbar_icons/scan_control.svg +3 -0
- bec_widgets/assets/toolbar_icons/status.svg +3 -0
- bec_widgets/assets/toolbar_icons/terminal.svg +3 -0
- bec_widgets/assets/toolbar_icons/waveform.svg +3 -0
- bec_widgets/cli/client.py +1 -1
- bec_widgets/examples/general_app/__init__.py +0 -0
- bec_widgets/examples/general_app/general_app.py +92 -0
- bec_widgets/examples/general_app/general_app.ui +262 -0
- bec_widgets/examples/general_app/web_links.py +15 -0
- bec_widgets/examples/plugin_example_pyside/tictactoeplugin.py +8 -2
- bec_widgets/qt_utils/toolbar.py +52 -2
- bec_widgets/utils/generate_designer_plugin.py +1 -1
- bec_widgets/widgets/bec_queue/bec_queue_plugin.py +7 -2
- bec_widgets/widgets/bec_status_box/bec_status_box_plugin.py +7 -2
- bec_widgets/widgets/bec_status_box/status_item.py +14 -8
- bec_widgets/widgets/color_button/color_button_plugin.py +3 -2
- bec_widgets/widgets/device_box/device_box_plugin.py +6 -1
- bec_widgets/widgets/device_combobox/{device_combobox_plugin.py → device_combo_box_plugin.py} +5 -3
- bec_widgets/widgets/device_combobox/device_combobox.py +1 -2
- bec_widgets/widgets/device_combobox/{register_device_combobox.py → register_device_combo_box.py} +1 -1
- bec_widgets/widgets/device_line_edit/device_line_edit_plugin.py +5 -3
- bec_widgets/widgets/dock/dock.py +68 -4
- bec_widgets/widgets/dock/dock_area.py +139 -29
- bec_widgets/widgets/dock/dock_area.pyproject +1 -0
- bec_widgets/widgets/dock/dock_area_plugin.py +59 -0
- bec_widgets/widgets/dock/register_dock_area.py +15 -0
- bec_widgets/widgets/position_indicator/__init__.py +0 -0
- bec_widgets/widgets/position_indicator/position_indicator_plugin.py +7 -2
- bec_widgets/widgets/ring_progress_bar/register_ring_progress_bar.py +15 -0
- bec_widgets/widgets/ring_progress_bar/ring_progress_bar.pyproject +1 -0
- bec_widgets/widgets/ring_progress_bar/ring_progress_bar_plugin.py +58 -0
- bec_widgets/widgets/scan_control/register_scan_control.py +15 -0
- bec_widgets/widgets/scan_control/scan_control.pyproject +1 -0
- bec_widgets/widgets/scan_control/scan_control_plugin.py +58 -0
- bec_widgets/widgets/spinner/spinner_widget_plugin.py +7 -2
- bec_widgets/widgets/stop_button/stop_button_plugin.py +5 -3
- bec_widgets/widgets/text_box/register_text_box.py +15 -0
- bec_widgets/widgets/text_box/text_box.pyproject +1 -0
- bec_widgets/widgets/text_box/text_box_plugin.py +58 -0
- bec_widgets/widgets/toggle/toggle_switch_plugin.py +7 -2
- bec_widgets/widgets/vscode/register_vs_code_editor.py +15 -0
- bec_widgets/widgets/vscode/vs_code_editor.pyproject +1 -0
- bec_widgets/widgets/vscode/vs_code_editor_plugin.py +59 -0
- bec_widgets/widgets/waveform/bec_waveform_widget_plugin.py +1 -1
- bec_widgets/widgets/website/register_website_widget.py +15 -0
- bec_widgets/widgets/website/website_widget.pyproject +1 -0
- bec_widgets/widgets/website/website_widget_plugin.py +58 -0
- {bec_widgets-0.90.0.dist-info → bec_widgets-0.92.0.dist-info}/METADATA +1 -1
- {bec_widgets-0.90.0.dist-info → bec_widgets-0.92.0.dist-info}/RECORD +90 -35
- pyproject.toml +1 -1
- tests/unit_tests/test_bec_dock.py +70 -30
- bec_widgets/widgets/color_button/assets/color_button.png +0 -0
- bec_widgets/widgets/device_combobox/assets/device_combobox_icon.png +0 -0
- bec_widgets/widgets/device_line_edit/assets/line_edit_icon.png +0 -0
- bec_widgets/widgets/stop_button/assets/stop.png +0 -0
- /bec_widgets/assets/designer_icons/{BECWaveformWidget.png → waveform.png} +0 -0
- /bec_widgets/widgets/device_combobox/{device_combobox.pyproject → device_combo_box.pyproject} +0 -0
- {bec_widgets-0.90.0.dist-info → bec_widgets-0.92.0.dist-info}/WHEEL +0 -0
- {bec_widgets-0.90.0.dist-info → bec_widgets-0.92.0.dist-info}/entry_points.txt +0 -0
- {bec_widgets-0.90.0.dist-info → bec_widgets-0.92.0.dist-info}/licenses/LICENSE +0 -0
@@ -1,11 +1,14 @@
|
|
1
1
|
# Copyright (C) 2022 The Qt Company Ltd.
|
2
2
|
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
3
|
+
import os
|
3
4
|
|
4
5
|
from qtpy.QtDesigner import QDesignerCustomWidgetInterface
|
5
6
|
from qtpy.QtGui import QIcon
|
6
7
|
from tictactoe import TicTacToe
|
7
8
|
from tictactoetaskmenu import TicTacToeTaskMenuFactory
|
8
9
|
|
10
|
+
import bec_widgets
|
11
|
+
|
9
12
|
DOM_XML = """
|
10
13
|
<ui language='c++'>
|
11
14
|
<widget class='TicTacToe' name='ticTacToe'>
|
@@ -24,6 +27,8 @@ DOM_XML = """
|
|
24
27
|
</ui>
|
25
28
|
"""
|
26
29
|
|
30
|
+
MODULE_PATH = os.path.dirname(bec_widgets.__file__)
|
31
|
+
|
27
32
|
|
28
33
|
class TicTacToePlugin(QDesignerCustomWidgetInterface): # pragma: no cover
|
29
34
|
def __init__(self):
|
@@ -38,10 +43,11 @@ class TicTacToePlugin(QDesignerCustomWidgetInterface): # pragma: no cover
|
|
38
43
|
return DOM_XML
|
39
44
|
|
40
45
|
def group(self):
|
41
|
-
return ""
|
46
|
+
return "Games"
|
42
47
|
|
43
48
|
def icon(self):
|
44
|
-
|
49
|
+
icon_path = os.path.join(MODULE_PATH, "assets", "designer_icons", "games.png")
|
50
|
+
return QIcon(icon_path)
|
45
51
|
|
46
52
|
def includeFile(self):
|
47
53
|
return "tictactoe"
|
bec_widgets/qt_utils/toolbar.py
CHANGED
@@ -5,7 +5,7 @@ from collections import defaultdict
|
|
5
5
|
|
6
6
|
from qtpy.QtCore import QSize
|
7
7
|
from qtpy.QtGui import QAction, QIcon
|
8
|
-
from qtpy.QtWidgets import QHBoxLayout, QLabel, QToolBar, QToolButton, QWidget
|
8
|
+
from qtpy.QtWidgets import QHBoxLayout, QLabel, QMenu, QToolBar, QToolButton, QWidget
|
9
9
|
|
10
10
|
import bec_widgets
|
11
11
|
|
@@ -98,6 +98,52 @@ class DeviceSelectionAction(ToolBarAction):
|
|
98
98
|
self.device_combobox.setStyleSheet(f"QComboBox {{ background-color: {color}; }}")
|
99
99
|
|
100
100
|
|
101
|
+
class ExpandableMenuAction(ToolBarAction):
|
102
|
+
"""
|
103
|
+
Action for an expandable menu in the toolbar.
|
104
|
+
|
105
|
+
Args:
|
106
|
+
label (str): The label for the menu.
|
107
|
+
actions (dict): A dictionary of actions to populate the menu.
|
108
|
+
icon_path (str, optional): The path to the icon file. Defaults to None.
|
109
|
+
|
110
|
+
"""
|
111
|
+
|
112
|
+
def __init__(self, label: str, actions: dict, icon_path: str = None):
|
113
|
+
super().__init__(icon_path, label)
|
114
|
+
self.actions = actions
|
115
|
+
self.widgets = defaultdict(dict)
|
116
|
+
|
117
|
+
def add_to_toolbar(self, toolbar: QToolBar, target: QWidget):
|
118
|
+
button = QToolButton(toolbar)
|
119
|
+
if self.icon_path:
|
120
|
+
button.setIcon(QIcon(self.icon_path))
|
121
|
+
button.setText(self.tooltip)
|
122
|
+
button.setPopupMode(QToolButton.InstantPopup)
|
123
|
+
button.setStyleSheet(
|
124
|
+
"""
|
125
|
+
QToolButton {
|
126
|
+
font-size: 14px;
|
127
|
+
}
|
128
|
+
QMenu {
|
129
|
+
font-size: 14px;
|
130
|
+
}
|
131
|
+
"""
|
132
|
+
)
|
133
|
+
menu = QMenu(button)
|
134
|
+
for action_id, action in self.actions.items():
|
135
|
+
sub_action = QAction(action.tooltip, target)
|
136
|
+
if action.icon_path:
|
137
|
+
icon = QIcon()
|
138
|
+
icon.addFile(action.icon_path, size=QSize(20, 20))
|
139
|
+
sub_action.setIcon(icon)
|
140
|
+
sub_action.setCheckable(action.checkable)
|
141
|
+
menu.addAction(sub_action)
|
142
|
+
self.widgets[action_id] = sub_action
|
143
|
+
button.setMenu(menu)
|
144
|
+
toolbar.addWidget(button)
|
145
|
+
|
146
|
+
|
101
147
|
class ModularToolBar(QToolBar):
|
102
148
|
"""Modular toolbar with optional automatic initialization.
|
103
149
|
Args:
|
@@ -108,7 +154,11 @@ class ModularToolBar(QToolBar):
|
|
108
154
|
"""
|
109
155
|
|
110
156
|
def __init__(
|
111
|
-
self,
|
157
|
+
self,
|
158
|
+
parent=None,
|
159
|
+
actions: dict | None = None,
|
160
|
+
target_widget=None,
|
161
|
+
color: str = "rgba(255, 255, 255, 0)",
|
112
162
|
):
|
113
163
|
super().__init__(parent)
|
114
164
|
|
@@ -1,9 +1,11 @@
|
|
1
1
|
# Copyright (C) 2022 The Qt Company Ltd.
|
2
2
|
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
3
|
+
import os
|
3
4
|
|
4
5
|
from qtpy.QtDesigner import QDesignerCustomWidgetInterface
|
5
6
|
from qtpy.QtGui import QIcon
|
6
7
|
|
8
|
+
import bec_widgets
|
7
9
|
from bec_widgets.widgets.bec_queue.bec_queue import BECQueue
|
8
10
|
|
9
11
|
DOM_XML = """
|
@@ -13,6 +15,8 @@ DOM_XML = """
|
|
13
15
|
</ui>
|
14
16
|
"""
|
15
17
|
|
18
|
+
MODULE_PATH = os.path.dirname(bec_widgets.__file__)
|
19
|
+
|
16
20
|
|
17
21
|
class BECQueuePlugin(QDesignerCustomWidgetInterface): # pragma: no cover
|
18
22
|
def __init__(self):
|
@@ -27,10 +31,11 @@ class BECQueuePlugin(QDesignerCustomWidgetInterface): # pragma: no cover
|
|
27
31
|
return DOM_XML
|
28
32
|
|
29
33
|
def group(self):
|
30
|
-
return ""
|
34
|
+
return "BEC Services"
|
31
35
|
|
32
36
|
def icon(self):
|
33
|
-
|
37
|
+
icon_path = os.path.join(MODULE_PATH, "assets", "designer_icons", "device_line_edit.png")
|
38
|
+
return QIcon(icon_path)
|
34
39
|
|
35
40
|
def includeFile(self):
|
36
41
|
return "bec_queue"
|
@@ -1,9 +1,11 @@
|
|
1
1
|
# Copyright (C) 2022 The Qt Company Ltd.
|
2
2
|
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
3
|
+
import os
|
3
4
|
|
4
5
|
from qtpy.QtDesigner import QDesignerCustomWidgetInterface
|
5
6
|
from qtpy.QtGui import QIcon
|
6
7
|
|
8
|
+
import bec_widgets
|
7
9
|
from bec_widgets.widgets.bec_status_box.bec_status_box import BECStatusBox
|
8
10
|
|
9
11
|
DOM_XML = """
|
@@ -13,6 +15,8 @@ DOM_XML = """
|
|
13
15
|
</ui>
|
14
16
|
"""
|
15
17
|
|
18
|
+
MODULE_PATH = os.path.dirname(bec_widgets.__file__)
|
19
|
+
|
16
20
|
|
17
21
|
class BECStatusBoxPlugin(QDesignerCustomWidgetInterface): # pragma: no cover
|
18
22
|
def __init__(self):
|
@@ -27,10 +31,11 @@ class BECStatusBoxPlugin(QDesignerCustomWidgetInterface): # pragma: no cover
|
|
27
31
|
return DOM_XML
|
28
32
|
|
29
33
|
def group(self):
|
30
|
-
return ""
|
34
|
+
return "BEC Services"
|
31
35
|
|
32
36
|
def icon(self):
|
33
|
-
|
37
|
+
icon_path = os.path.join(MODULE_PATH, "assets", "designer_icons", "status.png")
|
38
|
+
return QIcon(icon_path)
|
34
39
|
|
35
40
|
def includeFile(self):
|
36
41
|
return "bec_status_box"
|
@@ -2,24 +2,30 @@
|
|
2
2
|
The widget is bound to be used with the BECStatusBox widget."""
|
3
3
|
|
4
4
|
import enum
|
5
|
+
import os
|
5
6
|
from datetime import datetime
|
6
7
|
|
7
8
|
from bec_lib.utils.import_utils import lazy_import_from
|
8
9
|
from qtpy.QtCore import Qt, Slot
|
9
|
-
from qtpy.
|
10
|
+
from qtpy.QtGui import QIcon
|
11
|
+
from qtpy.QtWidgets import QDialog, QHBoxLayout, QLabel, QVBoxLayout, QWidget
|
12
|
+
|
13
|
+
import bec_widgets
|
10
14
|
|
11
15
|
# TODO : Put normal imports back when Pydantic gets faster
|
12
16
|
BECStatus = lazy_import_from("bec_lib.messages", ("BECStatus",))
|
13
17
|
|
18
|
+
MODULE_PATH = os.path.dirname(bec_widgets.__file__)
|
19
|
+
|
14
20
|
|
15
21
|
class IconsEnum(enum.Enum):
|
16
22
|
"""Enum class for icons in the status item widget."""
|
17
23
|
|
18
|
-
RUNNING = "
|
19
|
-
BUSY = "
|
20
|
-
IDLE = "
|
21
|
-
ERROR = "
|
22
|
-
NOTCONNECTED = "
|
24
|
+
RUNNING = os.path.join(MODULE_PATH, "assets", "status_icons", "running.svg")
|
25
|
+
BUSY = os.path.join(MODULE_PATH, "assets", "status_icons", "refresh.svg")
|
26
|
+
IDLE = os.path.join(MODULE_PATH, "assets", "status_icons", "warning.svg")
|
27
|
+
ERROR = os.path.join(MODULE_PATH, "assets", "status_icons", "error.svg")
|
28
|
+
NOTCONNECTED = os.path.join(MODULE_PATH, "assets", "status_icons", "not_connected.svg")
|
23
29
|
|
24
30
|
|
25
31
|
class StatusItem(QWidget):
|
@@ -91,8 +97,8 @@ class StatusItem(QWidget):
|
|
91
97
|
|
92
98
|
def set_status(self) -> None:
|
93
99
|
"""Set the status icon for the status item widget."""
|
94
|
-
|
95
|
-
icon =
|
100
|
+
icon_path = IconsEnum[self.config.status].value
|
101
|
+
icon = QIcon(icon_path)
|
96
102
|
self._icon.setPixmap(icon.pixmap(*self.icon_size))
|
97
103
|
self._icon.setAlignment(Qt.AlignmentFlag.AlignRight)
|
98
104
|
|
@@ -3,6 +3,7 @@ import os
|
|
3
3
|
from qtpy.QtDesigner import QDesignerCustomWidgetInterface
|
4
4
|
from qtpy.QtGui import QIcon
|
5
5
|
|
6
|
+
import bec_widgets
|
6
7
|
from bec_widgets.widgets.color_button.color_button import ColorButton
|
7
8
|
|
8
9
|
DOM_XML = """
|
@@ -11,6 +12,7 @@ DOM_XML = """
|
|
11
12
|
</widget>
|
12
13
|
</ui>
|
13
14
|
"""
|
15
|
+
MODULE_PATH = os.path.dirname(bec_widgets.__file__)
|
14
16
|
|
15
17
|
|
16
18
|
class ColorButtonPlugin(QDesignerCustomWidgetInterface): # pragma: no cover
|
@@ -29,8 +31,7 @@ class ColorButtonPlugin(QDesignerCustomWidgetInterface): # pragma: no cover
|
|
29
31
|
return "BEC Buttons"
|
30
32
|
|
31
33
|
def icon(self):
|
32
|
-
|
33
|
-
icon_path = os.path.join(current_path, "assets", "color_button.png")
|
34
|
+
icon_path = os.path.join(MODULE_PATH, "assets", "designer_icons", "color_button.png")
|
34
35
|
return QIcon(icon_path)
|
35
36
|
|
36
37
|
def includeFile(self):
|
@@ -1,9 +1,11 @@
|
|
1
1
|
# Copyright (C) 2022 The Qt Company Ltd.
|
2
2
|
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
3
|
+
import os
|
3
4
|
|
4
5
|
from qtpy.QtDesigner import QDesignerCustomWidgetInterface
|
5
6
|
from qtpy.QtGui import QIcon
|
6
7
|
|
8
|
+
import bec_widgets
|
7
9
|
from bec_widgets.widgets.device_box.device_box import DeviceBox
|
8
10
|
|
9
11
|
DOM_XML = """
|
@@ -13,6 +15,8 @@ DOM_XML = """
|
|
13
15
|
</ui>
|
14
16
|
"""
|
15
17
|
|
18
|
+
MODULE_PATH = os.path.dirname(bec_widgets.__file__)
|
19
|
+
|
16
20
|
|
17
21
|
class DeviceBoxPlugin(QDesignerCustomWidgetInterface): # pragma: no cover
|
18
22
|
def __init__(self):
|
@@ -30,7 +34,8 @@ class DeviceBoxPlugin(QDesignerCustomWidgetInterface): # pragma: no cover
|
|
30
34
|
return "Device Control"
|
31
35
|
|
32
36
|
def icon(self):
|
33
|
-
|
37
|
+
icon_path = os.path.join(MODULE_PATH, "assets", "designer_icons", "device_box.png")
|
38
|
+
return QIcon(icon_path)
|
34
39
|
|
35
40
|
def includeFile(self):
|
36
41
|
return "device_box"
|
bec_widgets/widgets/device_combobox/{device_combobox_plugin.py → device_combo_box_plugin.py}
RENAMED
@@ -5,6 +5,7 @@ import os
|
|
5
5
|
from qtpy.QtDesigner import QDesignerCustomWidgetInterface
|
6
6
|
from qtpy.QtGui import QIcon
|
7
7
|
|
8
|
+
import bec_widgets
|
8
9
|
from bec_widgets.widgets.device_combobox.device_combobox import DeviceComboBox
|
9
10
|
|
10
11
|
DOM_XML = """
|
@@ -14,6 +15,8 @@ DOM_XML = """
|
|
14
15
|
</ui>
|
15
16
|
"""
|
16
17
|
|
18
|
+
MODULE_PATH = os.path.dirname(bec_widgets.__file__)
|
19
|
+
|
17
20
|
|
18
21
|
class DeviceComboBoxPlugin(QDesignerCustomWidgetInterface): # pragma: no cover
|
19
22
|
def __init__(self):
|
@@ -28,11 +31,10 @@ class DeviceComboBoxPlugin(QDesignerCustomWidgetInterface): # pragma: no cover
|
|
28
31
|
return DOM_XML
|
29
32
|
|
30
33
|
def group(self):
|
31
|
-
return "
|
34
|
+
return "Device Control"
|
32
35
|
|
33
36
|
def icon(self):
|
34
|
-
|
35
|
-
icon_path = os.path.join(current_path, "assets", "device_combobox_icon.png")
|
37
|
+
icon_path = os.path.join(MODULE_PATH, "assets", "designer_icons", "device_combo_box.png")
|
36
38
|
return QIcon(icon_path)
|
37
39
|
|
38
40
|
def includeFile(self):
|
@@ -2,7 +2,6 @@ from typing import TYPE_CHECKING
|
|
2
2
|
|
3
3
|
from qtpy.QtWidgets import QComboBox
|
4
4
|
|
5
|
-
from bec_widgets.utils.bec_widget import BECWidget
|
6
5
|
from bec_widgets.widgets.base_classes.device_input_base import DeviceInputBase, DeviceInputConfig
|
7
6
|
|
8
7
|
if TYPE_CHECKING:
|
@@ -35,7 +34,7 @@ class DeviceComboBox(DeviceInputBase, QComboBox):
|
|
35
34
|
):
|
36
35
|
super().__init__(client=client, config=config, gui_id=gui_id)
|
37
36
|
QComboBox.__init__(self, parent=parent)
|
38
|
-
|
37
|
+
self.setMinimumSize(125, 26)
|
39
38
|
self.populate_combobox()
|
40
39
|
|
41
40
|
if arg_name is not None:
|
bec_widgets/widgets/device_combobox/{register_device_combobox.py → register_device_combo_box.py}
RENAMED
@@ -6,7 +6,7 @@ def main(): # pragma: no cover
|
|
6
6
|
return
|
7
7
|
from PySide6.QtDesigner import QPyDesignerCustomWidgetCollection
|
8
8
|
|
9
|
-
from bec_widgets.widgets.device_combobox.
|
9
|
+
from bec_widgets.widgets.device_combobox.device_combo_box_plugin import DeviceComboBoxPlugin
|
10
10
|
|
11
11
|
QPyDesignerCustomWidgetCollection.addCustomWidget(DeviceComboBoxPlugin())
|
12
12
|
|
@@ -5,6 +5,7 @@ import os
|
|
5
5
|
from qtpy.QtDesigner import QDesignerCustomWidgetInterface
|
6
6
|
from qtpy.QtGui import QIcon
|
7
7
|
|
8
|
+
import bec_widgets
|
8
9
|
from bec_widgets.widgets.device_line_edit.device_line_edit import DeviceLineEdit
|
9
10
|
|
10
11
|
DOM_XML = """
|
@@ -14,6 +15,8 @@ DOM_XML = """
|
|
14
15
|
</ui>
|
15
16
|
"""
|
16
17
|
|
18
|
+
MODULE_PATH = os.path.dirname(bec_widgets.__file__)
|
19
|
+
|
17
20
|
|
18
21
|
class DeviceLineEditPlugin(QDesignerCustomWidgetInterface): # pragma: no cover
|
19
22
|
def __init__(self):
|
@@ -28,11 +31,10 @@ class DeviceLineEditPlugin(QDesignerCustomWidgetInterface): # pragma: no cover
|
|
28
31
|
return DOM_XML
|
29
32
|
|
30
33
|
def group(self):
|
31
|
-
return "
|
34
|
+
return "Device Control"
|
32
35
|
|
33
36
|
def icon(self):
|
34
|
-
|
35
|
-
icon_path = os.path.join(current_path, "assets", "line_edit_icon.png")
|
37
|
+
icon_path = os.path.join(MODULE_PATH, "assets", "designer_icons", "device_line_edit.png")
|
36
38
|
return QIcon(icon_path)
|
37
39
|
|
38
40
|
def includeFile(self):
|
bec_widgets/widgets/dock/dock.py
CHANGED
@@ -3,7 +3,7 @@ from __future__ import annotations
|
|
3
3
|
from typing import TYPE_CHECKING, Any, Literal, Optional
|
4
4
|
|
5
5
|
from pydantic import Field
|
6
|
-
from pyqtgraph.dockarea import Dock
|
6
|
+
from pyqtgraph.dockarea import Dock, DockLabel
|
7
7
|
|
8
8
|
from bec_widgets.cli.rpc_wigdet_handler import widget_handler
|
9
9
|
from bec_widgets.utils import ConnectionConfig, GridLayoutManager
|
@@ -25,6 +25,64 @@ class DockConfig(ConnectionConfig):
|
|
25
25
|
)
|
26
26
|
|
27
27
|
|
28
|
+
class CustomDockLabel(DockLabel):
|
29
|
+
def updateStyle(self):
|
30
|
+
r = "3px"
|
31
|
+
if self.dim:
|
32
|
+
fg = "#aaa"
|
33
|
+
bg = "#44a"
|
34
|
+
border = "#339"
|
35
|
+
else:
|
36
|
+
fg = "#fff"
|
37
|
+
bg = "#3f4042"
|
38
|
+
border = "#3f4042"
|
39
|
+
|
40
|
+
if self.orientation == "vertical":
|
41
|
+
self.vStyle = """DockLabel {
|
42
|
+
background-color : %s;
|
43
|
+
color : %s;
|
44
|
+
border-top-right-radius: 0px;
|
45
|
+
border-top-left-radius: %s;
|
46
|
+
border-bottom-right-radius: 0px;
|
47
|
+
border-bottom-left-radius: %s;
|
48
|
+
border-width: 0px;
|
49
|
+
border-right: 2px solid %s;
|
50
|
+
padding-top: 3px;
|
51
|
+
padding-bottom: 3px;
|
52
|
+
font-size: %s;
|
53
|
+
}""" % (
|
54
|
+
bg,
|
55
|
+
fg,
|
56
|
+
r,
|
57
|
+
r,
|
58
|
+
border,
|
59
|
+
self.fontSize,
|
60
|
+
)
|
61
|
+
self.setStyleSheet(self.vStyle)
|
62
|
+
else:
|
63
|
+
self.hStyle = """DockLabel {
|
64
|
+
background-color : %s;
|
65
|
+
color : %s;
|
66
|
+
border-top-right-radius: %s;
|
67
|
+
border-top-left-radius: %s;
|
68
|
+
border-bottom-right-radius: 0px;
|
69
|
+
border-bottom-left-radius: 0px;
|
70
|
+
border-width: 0px;
|
71
|
+
border-bottom: 2px solid %s;
|
72
|
+
padding-left: 3px;
|
73
|
+
padding-right: 3px;
|
74
|
+
font-size: %s;
|
75
|
+
}""" % (
|
76
|
+
bg,
|
77
|
+
fg,
|
78
|
+
r,
|
79
|
+
r,
|
80
|
+
border,
|
81
|
+
self.fontSize,
|
82
|
+
)
|
83
|
+
self.setStyleSheet(self.hStyle)
|
84
|
+
|
85
|
+
|
28
86
|
class BECDock(BECWidget, Dock):
|
29
87
|
USER_ACCESS = [
|
30
88
|
"_config_dict",
|
@@ -46,11 +104,12 @@ class BECDock(BECWidget, Dock):
|
|
46
104
|
def __init__(
|
47
105
|
self,
|
48
106
|
parent: QWidget | None = None,
|
49
|
-
parent_dock_area:
|
107
|
+
parent_dock_area: QWidget | None = None,
|
50
108
|
config: DockConfig | None = None,
|
51
109
|
name: str | None = None,
|
52
110
|
client=None,
|
53
111
|
gui_id: str | None = None,
|
112
|
+
closable: bool = True,
|
54
113
|
**kwargs,
|
55
114
|
) -> None:
|
56
115
|
if config is None:
|
@@ -62,7 +121,11 @@ class BECDock(BECWidget, Dock):
|
|
62
121
|
config = DockConfig(**config)
|
63
122
|
self.config = config
|
64
123
|
super().__init__(client=client, config=config, gui_id=gui_id)
|
65
|
-
|
124
|
+
label = CustomDockLabel(text=name, closable=closable)
|
125
|
+
Dock.__init__(self, name=name, label=label, **kwargs)
|
126
|
+
# Dock.__init__(self, name=name, **kwargs)
|
127
|
+
|
128
|
+
self.parent_dock_area = parent_dock_area
|
66
129
|
|
67
130
|
# Layout Manager
|
68
131
|
self.layout_manager = GridLayoutManager(self.layout)
|
@@ -230,7 +293,7 @@ class BECDock(BECWidget, Dock):
|
|
230
293
|
Remove the dock from the parent dock area.
|
231
294
|
"""
|
232
295
|
# self.cleanup()
|
233
|
-
self.
|
296
|
+
self.parent_dock_area.remove_dock(self.name())
|
234
297
|
|
235
298
|
def cleanup(self):
|
236
299
|
"""
|
@@ -249,3 +312,4 @@ class BECDock(BECWidget, Dock):
|
|
249
312
|
"""
|
250
313
|
self.cleanup()
|
251
314
|
super().close()
|
315
|
+
self.parent_dock_area.dock_area.docks.pop(self.name(), None)
|