bec-widgets 0.96.3__py3-none-any.whl → 0.98.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.
Files changed (42) hide show
  1. CHANGELOG.md +36 -42
  2. PKG-INFO +1 -1
  3. bec_widgets/examples/plugin_example_pyside/tictactoeplugin.py +2 -5
  4. bec_widgets/qt_utils/toolbar.py +28 -23
  5. bec_widgets/utils/bec_designer.py +15 -0
  6. bec_widgets/utils/colors.py +30 -6
  7. bec_widgets/widgets/bec_queue/bec_queue_plugin.py +2 -5
  8. bec_widgets/widgets/bec_status_box/bec_status_box_plugin.py +2 -5
  9. bec_widgets/widgets/color_button/color_button_plugin.py +2 -5
  10. bec_widgets/widgets/colormap_selector/colormap_selector_plugin.py +2 -5
  11. bec_widgets/widgets/device_browser/device_browser_plugin.py +2 -5
  12. bec_widgets/widgets/device_combobox/device_combo_box_plugin.py +2 -5
  13. bec_widgets/widgets/device_line_edit/device_line_edit_plugin.py +2 -5
  14. bec_widgets/widgets/dock/dock_area.py +46 -21
  15. bec_widgets/widgets/dock/dock_area_plugin.py +2 -5
  16. bec_widgets/widgets/figure/figure.py +0 -1
  17. bec_widgets/widgets/image/bec_image_widget_plugin.py +2 -5
  18. bec_widgets/widgets/image/image_widget.py +28 -28
  19. bec_widgets/widgets/motor_map/bec_motor_map_widget_plugin.py +2 -5
  20. bec_widgets/widgets/motor_map/motor_map_widget.py +6 -4
  21. bec_widgets/widgets/position_indicator/position_indicator_plugin.py +2 -5
  22. bec_widgets/widgets/positioner_box/positioner_box.py +6 -9
  23. bec_widgets/widgets/positioner_box/positioner_box_plugin.py +2 -5
  24. bec_widgets/widgets/positioner_box/positioner_control_line_plugin.py +2 -5
  25. bec_widgets/widgets/ring_progress_bar/ring_progress_bar_plugin.py +2 -5
  26. bec_widgets/widgets/scan_control/scan_control.py +3 -1
  27. bec_widgets/widgets/scan_control/scan_control_plugin.py +2 -5
  28. bec_widgets/widgets/spinner/spinner_widget_plugin.py +2 -5
  29. bec_widgets/widgets/stop_button/stop_button_plugin.py +2 -5
  30. bec_widgets/widgets/text_box/text_box_plugin.py +2 -5
  31. bec_widgets/widgets/toggle/toggle_switch_plugin.py +2 -5
  32. bec_widgets/widgets/vscode/vs_code_editor_plugin.py +2 -5
  33. bec_widgets/widgets/waveform/bec_waveform_widget_plugin.py +2 -5
  34. bec_widgets/widgets/waveform/waveform_popups/curve_dialog/curve_dialog.py +4 -6
  35. bec_widgets/widgets/waveform/waveform_widget.py +18 -19
  36. bec_widgets/widgets/website/website_widget_plugin.py +2 -5
  37. {bec_widgets-0.96.3.dist-info → bec_widgets-0.98.0.dist-info}/METADATA +1 -1
  38. {bec_widgets-0.96.3.dist-info → bec_widgets-0.98.0.dist-info}/RECORD +42 -42
  39. pyproject.toml +1 -1
  40. {bec_widgets-0.96.3.dist-info → bec_widgets-0.98.0.dist-info}/WHEEL +0 -0
  41. {bec_widgets-0.96.3.dist-info → bec_widgets-0.98.0.dist-info}/entry_points.txt +0 -0
  42. {bec_widgets-0.96.3.dist-info → bec_widgets-0.98.0.dist-info}/licenses/LICENSE +0 -0
CHANGELOG.md CHANGED
@@ -1,5 +1,41 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## v0.98.0 (2024-08-25)
4
+
5
+ ### Feature
6
+
7
+ * feat(themes): added set_theme method ([`2b4449a`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/2b4449afebdda0a97f95712a1353cf40ec55c283))
8
+
9
+ ### Fix
10
+
11
+ * fix(toolbar): removed hardcoded color values ([`afdf4e8`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/afdf4e8782a22566932180224fa1c924d24c810f))
12
+
13
+ * fix: transitioning to material icons ([`2a82032`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/2a82032644a84e38df04e2035a6aa63f4a046360))
14
+
15
+ * fix(dock_area): transitioned to MaterialIconAction ([`88a2f66`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/88a2f667588e9aeb34ae556fa327898824052bc3))
16
+
17
+ * fix: fix color palette if qtheme was not called ([`3f3b207`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/3f3b207295ebd406ebaeecee465c774965161b8b))
18
+
19
+ * fix(figure): removed theme from figure init ([`e42b84c`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/e42b84c63650297d67feffccc02a2c2ba111ca79))
20
+
21
+ * fix: use globally set theme instead of the internal bec widgets theme ([`77c5aa7`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/77c5aa741cf1f5b969a42aa878aa2965176dbf41))
22
+
23
+ * fix(waveform): fixed icon appearance ([`36ad464`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/36ad4641594b67c9b789515c28f7db78a12757ee))
24
+
25
+ ### Refactor
26
+
27
+ * refactor(waveform): use set theme for demo ([`44cfda1`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/44cfda1c07306669c9a4e09706d95e6b91dee370))
28
+
29
+ ## v0.97.0 (2024-08-23)
30
+
31
+ ### Feature
32
+
33
+ * feat(designer): added designer icon factory ([`82a55dd`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/82a55ddf3eafb589cb63408db1c0e7e5c9d629da))
34
+
35
+ ### Fix
36
+
37
+ * fix(toolbar icon): fixed material icon toolbar for theme changes ([`3ecbd60`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/3ecbd60627994417c9175364e5909710dbcdceb2))
38
+
3
39
  ## v0.96.3 (2024-08-23)
4
40
 
5
41
  ### Documentation
@@ -115,45 +151,3 @@ Since we now rely on reusing the BECClient singleton, we need the fix introduced
115
151
  * fix(rpc): use client singleton instead of dispatcher ([`ea9240d`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/ea9240d2f71931082f33fb6b68231469875c3d63))
116
152
 
117
153
  * fix: removed qcoreapplication for polling events ([`4d02b42`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/4d02b42f11e9882b843317255a4975565c8a536f))
118
-
119
- ## v0.94.4 (2024-08-14)
120
-
121
- ### Documentation
122
-
123
- * docs: review developer section; add introduction ([`2af5c94`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/2af5c94913a3435c1839034df4f45f885b56d08b))
124
-
125
- ### Fix
126
-
127
- * fix: do not shutdown client in "close"
128
-
129
- Terminating client connections has to be done at the application level ([`198c1d1`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/198c1d1064cc2dae55de4b941929341faddacb28))
130
-
131
- ## v0.94.3 (2024-08-13)
132
-
133
- ### Fix
134
-
135
- * fix(curve_dialog): async curves are shown in curve dialog after addition. ([`7aeb2b5`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/7aeb2b5c26c7c2851e8d663d32521da8daec95ef))
136
-
137
- * fix(waveform): async device entry is correctly passed, updated and with new scan the previous data are cleared ([`d56ea95`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/d56ea95ef97bfdd0bc3eeddc4505d20b38e28559))
138
-
139
- ### Test
140
-
141
- * test(waveform_widget): added tests for axis setting and curve dialog ([`f285b35`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/f285b35b491660549e74349318119f7c2c44f619))
142
-
143
- ## v0.94.2 (2024-08-13)
144
-
145
- ### Fix
146
-
147
- * fix(image): image is single image mode do not raise popup error when connected twice with the same monitor ([`98b79aa`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/98b79aac7b47b73137f4d582f7f1d552b1d95366))
148
-
149
- ## v0.94.1 (2024-08-12)
150
-
151
- ### Fix
152
-
153
- * fix: issue #292, wrong key was used to clean _slots internal dictionary ([`93d3977`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/93d397759c756397604ebff5e24f3a580be8620d))
154
-
155
- ## v0.94.0 (2024-08-08)
156
-
157
- ### Refactor
158
-
159
- * refactor: adjust dimensions ([`0273bf4`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/0273bf485694609325b5b556a3c69fb53c18446e))
PKG-INFO CHANGED
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: bec_widgets
3
- Version: 0.96.3
3
+ Version: 0.98.0
4
4
  Summary: BEC Widgets
5
5
  Project-URL: Bug Tracker, https://gitlab.psi.ch/bec/bec_widgets/issues
6
6
  Project-URL: Homepage, https://gitlab.psi.ch/bec/bec_widgets
@@ -2,13 +2,12 @@
2
2
  # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
3
  import os
4
4
 
5
- from bec_qthemes import material_icon
6
5
  from qtpy.QtDesigner import QDesignerCustomWidgetInterface
7
- from qtpy.QtGui import QGuiApplication, QIcon
8
6
 
9
7
  import bec_widgets
10
8
  from bec_widgets.examples.plugin_example_pyside.tictactoe import TicTacToe
11
9
  from bec_widgets.examples.plugin_example_pyside.tictactoetaskmenu import TicTacToeTaskMenuFactory
10
+ from bec_widgets.utils.bec_designer import designer_material_icon
12
11
 
13
12
  DOM_XML = """
14
13
  <ui language='c++'>
@@ -47,9 +46,7 @@ class TicTacToePlugin(QDesignerCustomWidgetInterface): # pragma: no cover
47
46
  return "Games"
48
47
 
49
48
  def icon(self):
50
- palette = QGuiApplication.palette()
51
- pixmap = material_icon("sports_esports", color=palette.text().color(), filled=True)
52
- return QIcon(pixmap)
49
+ return designer_material_icon("sports_esports")
53
50
 
54
51
  def includeFile(self):
55
52
  return "tictactoe"
@@ -3,9 +3,9 @@ import os
3
3
  from abc import ABC, abstractmethod
4
4
  from collections import defaultdict
5
5
 
6
- from bec_qthemes import material_icon
6
+ from bec_qthemes._icon.material_icons import material_icon
7
7
  from qtpy.QtCore import QSize
8
- from qtpy.QtGui import QAction, QGuiApplication, QIcon
8
+ from qtpy.QtGui import QAction, QIcon
9
9
  from qtpy.QtWidgets import QHBoxLayout, QLabel, QMenu, QToolBar, QToolButton, QWidget
10
10
 
11
11
  import bec_widgets
@@ -73,30 +73,41 @@ class IconAction(ToolBarAction):
73
73
 
74
74
  class MaterialIconAction:
75
75
  """
76
- Abstract base class for toolbar actions.
76
+ Action with a Material icon for the toolbar.
77
77
 
78
78
  Args:
79
- icon_path (str, optional): The name of the icon file from `assets/toolbar_icons`. Defaults to None.
79
+ icon_path (str, optional): The name of the Material icon. Defaults to None.
80
80
  tooltip (bool, optional): The tooltip for the action. Defaults to None.
81
81
  checkable (bool, optional): Whether the action is checkable. Defaults to False.
82
+ filled (bool, optional): Whether the icon is filled. Defaults to False.
82
83
  """
83
84
 
84
- def __init__(self, icon_name: str = None, tooltip: str = None, checkable: bool = False):
85
+ def __init__(
86
+ self,
87
+ icon_name: str = None,
88
+ tooltip: str = None,
89
+ checkable: bool = False,
90
+ filled: bool = False,
91
+ ):
85
92
  self.icon_name = icon_name
86
93
  self.tooltip = tooltip
87
94
  self.checkable = checkable
88
95
  self.action = None
96
+ self.filled = filled
89
97
 
90
98
  def add_to_toolbar(self, toolbar: QToolBar, target: QWidget):
91
- palette = QGuiApplication.palette()
92
- color = "#FFFFFF" # FIXME: This should be a theme color but the toolbar doesn't respect the theme atm
93
- # one fixed, change it to palette.toolTipBase().color()
94
-
95
- icon = material_icon(self.icon_name, size=(20, 20), color=color)
96
- self.action = QAction(QIcon(icon), self.tooltip, target)
99
+ icon = self.get_icon()
100
+ self.action = QAction(icon, self.tooltip, target)
97
101
  self.action.setCheckable(self.checkable)
98
102
  toolbar.addAction(self.action)
99
103
 
104
+ def get_icon(self):
105
+
106
+ icon = material_icon(
107
+ self.icon_name, size=(20, 20), convert_to_pixmap=False, filled=self.filled
108
+ )
109
+ return icon
110
+
100
111
 
101
112
  class DeviceSelectionAction(ToolBarAction):
102
113
  """
@@ -161,10 +172,12 @@ class ExpandableMenuAction(ToolBarAction):
161
172
  menu = QMenu(button)
162
173
  for action_id, action in self.actions.items():
163
174
  sub_action = QAction(action.tooltip, target)
164
- if action.icon_path:
175
+ if hasattr(action, "icon_path"):
165
176
  icon = QIcon()
166
177
  icon.addFile(action.icon_path, size=QSize(20, 20))
167
178
  sub_action.setIcon(icon)
179
+ elif hasattr(action, "get_icon"):
180
+ sub_action.setIcon(action.get_icon())
168
181
  sub_action.setCheckable(action.checkable)
169
182
  menu.addAction(sub_action)
170
183
  self.widgets[action_id] = sub_action
@@ -178,20 +191,13 @@ class ModularToolBar(QToolBar):
178
191
  parent (QWidget, optional): The parent widget of the toolbar. Defaults to None.
179
192
  actions (list[ToolBarAction], optional): A list of action creators to populate the toolbar. Defaults to None.
180
193
  target_widget (QWidget, optional): The widget that the actions will target. Defaults to None.
181
- color (str, optional): The background color of the toolbar. Defaults to "black".
182
194
  """
183
195
 
184
- def __init__(
185
- self,
186
- parent=None,
187
- actions: dict | None = None,
188
- target_widget=None,
189
- color: str = "rgba(255, 255, 255, 0)",
190
- ):
196
+ def __init__(self, parent=None, actions: dict | None = None, target_widget=None):
191
197
  super().__init__(parent)
192
198
 
193
199
  self.widgets = defaultdict(dict)
194
- self.set_background_color(color)
200
+ self.set_background_color()
195
201
 
196
202
  if actions is not None and target_widget is not None:
197
203
  self.populate_toolbar(actions, target_widget)
@@ -208,8 +214,7 @@ class ModularToolBar(QToolBar):
208
214
  action.add_to_toolbar(self, target_widget)
209
215
  self.widgets[action_id] = action
210
216
 
211
- def set_background_color(self, color: str):
212
- self.setStyleSheet(f"QToolBar {{ background: {color}; }}")
217
+ def set_background_color(self):
213
218
  self.setIconSize(QSize(20, 20))
214
219
  self.setMovable(False)
215
220
  self.setFloatable(False)
@@ -6,7 +6,9 @@ import sys
6
6
  import sysconfig
7
7
  from pathlib import Path
8
8
 
9
+ from bec_qthemes import material_icon
9
10
  from qtpy import PYSIDE6
11
+ from qtpy.QtGui import QIcon
10
12
 
11
13
  if PYSIDE6:
12
14
  from PySide6.scripts.pyside_tool import (
@@ -21,6 +23,19 @@ if PYSIDE6:
21
23
  import bec_widgets
22
24
 
23
25
 
26
+ def designer_material_icon(icon_name: str) -> QIcon:
27
+ """
28
+ Create a QIcon for the BECDesigner with the given material icon name.
29
+
30
+ Args:
31
+ icon_name (str): The name of the material icon.
32
+
33
+ Returns:
34
+ QIcon: The QIcon for the material icon.
35
+ """
36
+ return QIcon(material_icon(icon_name, filled=True, convert_to_pixmap=True))
37
+
38
+
24
39
  def list_editable_packages() -> set[str]:
25
40
  """
26
41
  List all editable packages in the environment.
@@ -5,21 +5,45 @@ from typing import Literal
5
5
  import bec_qthemes
6
6
  import numpy as np
7
7
  import pyqtgraph as pg
8
+ from bec_qthemes._os_appearance.listener import OSThemeSwitchListener
8
9
  from pydantic_core import PydanticCustomError
9
10
  from qtpy.QtGui import QColor
10
11
  from qtpy.QtWidgets import QApplication
11
12
 
12
- CURRENT_THEME = "dark"
13
-
14
13
 
15
14
  def get_theme_palette():
16
- return bec_qthemes.load_palette(CURRENT_THEME)
15
+ if QApplication.instance() is None or not hasattr(QApplication.instance(), "theme"):
16
+ theme = "dark"
17
+ else:
18
+ theme = QApplication.instance().theme["theme"]
19
+ return bec_qthemes.load_palette(theme)
17
20
 
18
21
 
19
- def apply_theme(theme: Literal["dark", "light"]):
20
- global CURRENT_THEME
21
- CURRENT_THEME = theme
22
+ def set_theme(theme: Literal["dark", "light", "auto"]):
23
+ """
24
+ Set the theme for the application.
25
+
26
+ Args:
27
+ theme (Literal["dark", "light", "auto"]): The theme to set. "auto" will automatically switch between dark and light themes based on the system theme.
28
+ """
29
+ app = QApplication.instance()
30
+ bec_qthemes.setup_theme(theme)
31
+ pg.setConfigOption("background", "w" if app.theme["theme"] == "light" else "k")
32
+
33
+ # pylint: disable=protected-access
34
+ if theme != "auto":
35
+ return
22
36
 
37
+ def callback():
38
+ app.theme["theme"] = listener._theme.lower()
39
+ apply_theme(listener._theme.lower())
40
+
41
+ listener = OSThemeSwitchListener(callback)
42
+
43
+ app.installEventFilter(listener)
44
+
45
+
46
+ def apply_theme(theme: Literal["dark", "light"]):
23
47
  app = QApplication.instance()
24
48
  # go through all pyqtgraph widgets and set background
25
49
  children = itertools.chain.from_iterable(
@@ -2,11 +2,10 @@
2
2
  # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
3
  import os
4
4
 
5
- from bec_qthemes import material_icon
6
5
  from qtpy.QtDesigner import QDesignerCustomWidgetInterface
7
- from qtpy.QtGui import QGuiApplication, QIcon
8
6
 
9
7
  import bec_widgets
8
+ from bec_widgets.utils.bec_designer import designer_material_icon
10
9
  from bec_widgets.widgets.bec_queue.bec_queue import BECQueue
11
10
 
12
11
  DOM_XML = """
@@ -35,9 +34,7 @@ class BECQueuePlugin(QDesignerCustomWidgetInterface): # pragma: no cover
35
34
  return "BEC Services"
36
35
 
37
36
  def icon(self):
38
- palette = QGuiApplication.palette()
39
- pixmap = material_icon("edit_note", color=palette.text().color(), filled=True)
40
- return QIcon(pixmap)
37
+ return designer_material_icon("edit_note")
41
38
 
42
39
  def includeFile(self):
43
40
  return "bec_queue"
@@ -2,11 +2,10 @@
2
2
  # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
3
  import os
4
4
 
5
- from bec_qthemes import material_icon
6
5
  from qtpy.QtDesigner import QDesignerCustomWidgetInterface
7
- from qtpy.QtGui import QGuiApplication, QIcon
8
6
 
9
7
  import bec_widgets
8
+ from bec_widgets.utils.bec_designer import designer_material_icon
10
9
  from bec_widgets.widgets.bec_status_box.bec_status_box import BECStatusBox
11
10
 
12
11
  DOM_XML = """
@@ -35,9 +34,7 @@ class BECStatusBoxPlugin(QDesignerCustomWidgetInterface): # pragma: no cover
35
34
  return "BEC Services"
36
35
 
37
36
  def icon(self):
38
- palette = QGuiApplication.palette()
39
- pixmap = material_icon("dns", color=palette.text().color(), filled=True)
40
- return QIcon(pixmap)
37
+ return designer_material_icon("dns")
41
38
 
42
39
  def includeFile(self):
43
40
  return "bec_status_box"
@@ -1,10 +1,9 @@
1
1
  import os
2
2
 
3
- from bec_qthemes import material_icon
4
3
  from qtpy.QtDesigner import QDesignerCustomWidgetInterface
5
- from qtpy.QtGui import QGuiApplication, QIcon
6
4
 
7
5
  import bec_widgets
6
+ from bec_widgets.utils.bec_designer import designer_material_icon
8
7
  from bec_widgets.widgets.color_button.color_button import ColorButton
9
8
 
10
9
  DOM_XML = """
@@ -32,9 +31,7 @@ class ColorButtonPlugin(QDesignerCustomWidgetInterface): # pragma: no cover
32
31
  return "BEC Buttons"
33
32
 
34
33
  def icon(self):
35
- palette = QGuiApplication.palette()
36
- pixmap = material_icon("colors", color=palette.text().color(), filled=True)
37
- return QIcon(pixmap)
34
+ return designer_material_icon("colors")
38
35
 
39
36
  def includeFile(self):
40
37
  return "color_button"
@@ -2,11 +2,10 @@
2
2
  # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
3
  import os
4
4
 
5
- from bec_qthemes import material_icon
6
5
  from qtpy.QtDesigner import QDesignerCustomWidgetInterface
7
- from qtpy.QtGui import QGuiApplication, QIcon
8
6
 
9
7
  import bec_widgets
8
+ from bec_widgets.utils.bec_designer import designer_material_icon
10
9
  from bec_widgets.widgets.colormap_selector.colormap_selector import ColormapSelector
11
10
 
12
11
  DOM_XML = """
@@ -35,9 +34,7 @@ class ColormapSelectorPlugin(QDesignerCustomWidgetInterface): # pragma: no cove
35
34
  return "BEC Buttons"
36
35
 
37
36
  def icon(self):
38
- palette = QGuiApplication.palette()
39
- pixmap = material_icon("palette", color=palette.text().color(), filled=True)
40
- return QIcon(pixmap)
37
+ return designer_material_icon("palette")
41
38
 
42
39
  def includeFile(self):
43
40
  return "colormap_selector"
@@ -1,10 +1,9 @@
1
1
  # Copyright (C) 2022 The Qt Company Ltd.
2
2
  # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
3
 
4
- from bec_qthemes import material_icon
5
4
  from qtpy.QtDesigner import QDesignerCustomWidgetInterface
6
- from qtpy.QtGui import QGuiApplication, QIcon
7
5
 
6
+ from bec_widgets.utils.bec_designer import designer_material_icon
8
7
  from bec_widgets.widgets.device_browser.device_browser import DeviceBrowser
9
8
 
10
9
  DOM_XML = """
@@ -31,9 +30,7 @@ class DeviceBrowserPlugin(QDesignerCustomWidgetInterface): # pragma: no cover
31
30
  return "BEC Services"
32
31
 
33
32
  def icon(self):
34
- palette = QGuiApplication.palette()
35
- pixmap = material_icon("lists", color=palette.text().color(), filled=True)
36
- return QIcon(pixmap)
33
+ return designer_material_icon("lists")
37
34
 
38
35
  def includeFile(self):
39
36
  return "device_browser"
@@ -2,11 +2,10 @@
2
2
  # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
3
  import os
4
4
 
5
- from bec_qthemes import material_icon
6
5
  from qtpy.QtDesigner import QDesignerCustomWidgetInterface
7
- from qtpy.QtGui import QGuiApplication, QIcon
8
6
 
9
7
  import bec_widgets
8
+ from bec_widgets.utils.bec_designer import designer_material_icon
10
9
  from bec_widgets.widgets.device_combobox.device_combobox import DeviceComboBox
11
10
 
12
11
  DOM_XML = """
@@ -35,9 +34,7 @@ class DeviceComboBoxPlugin(QDesignerCustomWidgetInterface): # pragma: no cover
35
34
  return "Device Control"
36
35
 
37
36
  def icon(self):
38
- palette = QGuiApplication.palette()
39
- pixmap = material_icon("list_alt", color=palette.text().color(), filled=True)
40
- return QIcon(pixmap)
37
+ return designer_material_icon("list_alt")
41
38
 
42
39
  def includeFile(self):
43
40
  return "device_combobox"
@@ -2,11 +2,10 @@
2
2
  # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
3
  import os
4
4
 
5
- from bec_qthemes import material_icon
6
5
  from qtpy.QtDesigner import QDesignerCustomWidgetInterface
7
- from qtpy.QtGui import QGuiApplication, QIcon
8
6
 
9
7
  import bec_widgets
8
+ from bec_widgets.utils.bec_designer import designer_material_icon
10
9
  from bec_widgets.widgets.device_line_edit.device_line_edit import DeviceLineEdit
11
10
 
12
11
  DOM_XML = """
@@ -35,9 +34,7 @@ class DeviceLineEditPlugin(QDesignerCustomWidgetInterface): # pragma: no cover
35
34
  return "Device Control"
36
35
 
37
36
  def icon(self):
38
- palette = QGuiApplication.palette()
39
- pixmap = material_icon("edit_note", color=palette.text().color(), filled=True)
40
- return QIcon(pixmap)
37
+ return designer_material_icon("edit_note")
41
38
 
42
39
  def includeFile(self):
43
40
  return "device_line_edit"
@@ -9,17 +9,16 @@ from qtpy.QtCore import Qt
9
9
  from qtpy.QtGui import QPainter, QPaintEvent
10
10
  from qtpy.QtWidgets import QVBoxLayout, QWidget
11
11
 
12
+ from bec_widgets.qt_utils.error_popups import SafeSlot
12
13
  from bec_widgets.qt_utils.toolbar import (
13
14
  ExpandableMenuAction,
14
- IconAction,
15
+ MaterialIconAction,
15
16
  ModularToolBar,
16
17
  SeparatorAction,
17
18
  )
18
19
  from bec_widgets.utils import ConnectionConfig, WidgetContainerUtils
19
20
  from bec_widgets.utils.bec_widget import BECWidget
20
-
21
- from ...qt_utils.error_popups import SafeSlot
22
- from .dock import BECDock, DockConfig
21
+ from bec_widgets.widgets.dock.dock import BECDock, DockConfig
23
22
 
24
23
 
25
24
  class DockAreaConfig(ConnectionConfig):
@@ -71,20 +70,26 @@ class BECDockArea(BECWidget, QWidget):
71
70
  "menu_plots": ExpandableMenuAction(
72
71
  label="Add Plot ",
73
72
  actions={
74
- "waveform": IconAction(icon_path="waveform.svg", tooltip="Add Waveform"),
75
- "image": IconAction(icon_path="image.svg", tooltip="Add Image"),
76
- "motor_map": IconAction(icon_path="motor_map.svg", tooltip="Add Motor Map"),
73
+ "waveform": MaterialIconAction(
74
+ icon_name="show_chart", tooltip="Add Waveform", filled=True
75
+ ),
76
+ "image": MaterialIconAction(
77
+ icon_name="image", tooltip="Add Image", filled=True
78
+ ),
79
+ "motor_map": MaterialIconAction(
80
+ icon_name="my_location", tooltip="Add Motor Map", filled=True
81
+ ),
77
82
  },
78
83
  ),
79
84
  "separator_0": SeparatorAction(),
80
85
  "menu_devices": ExpandableMenuAction(
81
86
  label="Add Device Control ",
82
87
  actions={
83
- "scan_control": IconAction(
84
- icon_path="scan_control.svg", tooltip="Add Scan Control"
88
+ "scan_control": MaterialIconAction(
89
+ icon_name="stacked_line_chart", tooltip="Add Scan Control", filled=True
85
90
  ),
86
- "positioner_box": IconAction(
87
- icon_path="positioner_box.svg", tooltip="Add Device Box"
91
+ "positioner_box": MaterialIconAction(
92
+ icon_name="switch_right", tooltip="Add Device Box", filled=True
88
93
  ),
89
94
  },
90
95
  ),
@@ -92,21 +97,29 @@ class BECDockArea(BECWidget, QWidget):
92
97
  "menu_utils": ExpandableMenuAction(
93
98
  label="Add Utils ",
94
99
  actions={
95
- "queue": IconAction(icon_path="queue.svg", tooltip="Add Scan Queue"),
96
- "vs_code": IconAction(icon_path="terminal.svg", tooltip="Add VS Code"),
97
- "status": IconAction(icon_path="status.svg", tooltip="Add BEC Status Box"),
98
- "progress_bar": IconAction(
99
- icon_path="ring_progress.svg", tooltip="Add Circular ProgressBar"
100
+ "queue": MaterialIconAction(
101
+ icon_name="edit_note", tooltip="Add Scan Queue", filled=True
102
+ ),
103
+ "vs_code": MaterialIconAction(
104
+ icon_name="show_chart", tooltip="Add VS Code", filled=True
105
+ ),
106
+ "status": MaterialIconAction(
107
+ icon_name="dns", tooltip="Add BEC Status Box", filled=True
108
+ ),
109
+ "progress_bar": MaterialIconAction(
110
+ icon_name="track_changes",
111
+ tooltip="Add Circular ProgressBar",
112
+ filled=True,
100
113
  ),
101
114
  },
102
115
  ),
103
116
  "separator_2": SeparatorAction(),
104
- "attach_all": IconAction(
105
- icon_path="attach_all.svg", tooltip="Attach all floating docks"
117
+ "attach_all": MaterialIconAction(
118
+ icon_name="zoom_in_map", tooltip="Attach all floating docks"
106
119
  ),
107
- "save_state": IconAction(icon_path="save_state.svg", tooltip="Save Dock State"),
108
- "restore_state": IconAction(
109
- icon_path="restore_state.svg", tooltip="Restore Dock State"
120
+ "save_state": MaterialIconAction(icon_name="bookmark", tooltip="Save Dock State"),
121
+ "restore_state": MaterialIconAction(
122
+ icon_name="frame_reload", tooltip="Restore Dock State"
110
123
  ),
111
124
  },
112
125
  target_widget=self,
@@ -368,3 +381,15 @@ class BECDockArea(BECWidget, QWidget):
368
381
  """
369
382
  self.cleanup()
370
383
  super().close()
384
+
385
+
386
+ if __name__ == "__main__":
387
+ from qtpy.QtWidgets import QApplication
388
+
389
+ from bec_widgets.utils.colors import set_theme
390
+
391
+ app = QApplication([])
392
+ set_theme("auto")
393
+ dock_area = BECDockArea()
394
+ dock_area.show()
395
+ app.exec_()
@@ -2,11 +2,10 @@
2
2
  # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
3
  import os
4
4
 
5
- from bec_qthemes import material_icon
6
5
  from qtpy.QtDesigner import QDesignerCustomWidgetInterface
7
- from qtpy.QtGui import QGuiApplication, QIcon
8
6
 
9
7
  import bec_widgets
8
+ from bec_widgets.utils.bec_designer import designer_material_icon
10
9
  from bec_widgets.widgets.dock import BECDockArea
11
10
 
12
11
  DOM_XML = """
@@ -35,9 +34,7 @@ class BECDockAreaPlugin(QDesignerCustomWidgetInterface): # pragma: no cover
35
34
  return "BEC Plots"
36
35
 
37
36
  def icon(self):
38
- palette = QGuiApplication.palette()
39
- pixmap = material_icon("widgets", color=palette.text().color(), filled=True)
40
- return QIcon(pixmap)
37
+ return designer_material_icon("widgets")
41
38
 
42
39
  def includeFile(self):
43
40
  return "dock_area"
@@ -182,7 +182,6 @@ class BECFigure(BECWidget, pg.GraphicsLayoutWidget):
182
182
  print(f"Error in applying config: {e}")
183
183
  return
184
184
  self.config = config
185
- self.change_theme(self.config.theme)
186
185
 
187
186
  # widget_config has to be reset for not have each widget config twice when added to the figure
188
187
  widget_configs = list(self.config.widgets.values())
@@ -2,11 +2,10 @@
2
2
  # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
3
  import os
4
4
 
5
- from bec_qthemes import material_icon
6
5
  from qtpy.QtDesigner import QDesignerCustomWidgetInterface
7
- from qtpy.QtGui import QGuiApplication, QIcon
8
6
 
9
7
  import bec_widgets
8
+ from bec_widgets.utils.bec_designer import designer_material_icon
10
9
  from bec_widgets.widgets.image.image_widget import BECImageWidget
11
10
 
12
11
  DOM_XML = """
@@ -35,9 +34,7 @@ class BECImageWidgetPlugin(QDesignerCustomWidgetInterface): # pragma: no cover
35
34
  return "BEC Plots"
36
35
 
37
36
  def icon(self):
38
- palette = QGuiApplication.palette()
39
- pixmap = material_icon("image", color=palette.text().color(), filled=True)
40
- return QIcon(pixmap)
37
+ return designer_material_icon("image")
41
38
 
42
39
  def includeFile(self):
43
40
  return "bec_image_widget"