bec-widgets 0.77.0__py3-none-any.whl → 0.78.1__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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## v0.78.1 (2024-07-02)
4
+
5
+ ### Fix
6
+
7
+ * fix(ui_loader): ui loader is compatible with bec plugins ([`b787759`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/b787759f44486dc7af2c03811efb156041e4b6cb))
8
+
9
+ ## v0.78.0 (2024-07-02)
10
+
11
+ ### Feature
12
+
13
+ * feat(color_button): patched ColorButton from pyqtgraph to be able to be opened in another QDialog ([`c36bb80`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/c36bb80d6a4939802a4a1c8e5452c7b94bac185e))
14
+
3
15
  ## v0.77.0 (2024-07-02)
4
16
 
5
17
  ### Feature
@@ -137,19 +149,3 @@
137
149
  ### Fix
138
150
 
139
151
  * fix(designer): fixed designer for pyenv and venv; closes #237 ([`e631fc1`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/e631fc15d8707b73d58cb64316e115a7e43961ea))
140
-
141
- ## v0.72.1 (2024-06-24)
142
-
143
- ### Fix
144
-
145
- * fix: renamed spiral progress bar to ring progress bar; closes #235 ([`e5c0087`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/e5c0087c9aed831edbe1c172746325a772a3bafa))
146
-
147
- ### Test
148
-
149
- * test: bugfix to prohibit leackage of mock ([`4348ed1`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/4348ed1bb2182da6bdecaf372d6db85279e60af8))
150
-
151
- ## v0.72.0 (2024-06-24)
152
-
153
- ### Feature
154
-
155
- * feat(connector): added threadpool wrapper ([`4ca1efe`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/4ca1efeeb8955604069f7b98374c7f82e1a8da67))
PKG-INFO CHANGED
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: bec_widgets
3
- Version: 0.77.0
3
+ Version: 0.78.1
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
@@ -1,6 +1,30 @@
1
- from qtpy import QT_VERSION
1
+ from qtpy import PYQT6, PYSIDE6, QT_VERSION
2
2
  from qtpy.QtCore import QFile, QIODevice
3
3
 
4
+ if PYSIDE6:
5
+ from PySide6.QtUiTools import QUiLoader
6
+
7
+ from bec_widgets.utils.plugin_utils import get_rpc_classes
8
+ from bec_widgets.widgets.buttons.color_button.color_button import ColorButton
9
+
10
+ class CustomUiLoader(QUiLoader):
11
+ def __init__(self, baseinstance):
12
+ super().__init__(baseinstance)
13
+ widgets = get_rpc_classes("bec_widgets").get("top_level_classes", [])
14
+
15
+ widgets.append(ColorButton)
16
+
17
+ self.custom_widgets = {widget.__name__: widget for widget in widgets}
18
+
19
+ self.baseinstance = baseinstance
20
+
21
+ def createWidget(self, class_name, parent=None, name=""):
22
+ if class_name in self.custom_widgets:
23
+ widget = self.custom_widgets[class_name](parent)
24
+ widget.setObjectName(name)
25
+ return widget
26
+ return super().createWidget(class_name, parent, name)
27
+
4
28
 
5
29
  class UILoader:
6
30
  """Universal UI loader for PyQt5, PyQt6, PySide2, and PySide6."""
@@ -14,14 +38,14 @@ class UILoader:
14
38
  self.loader = uic.loadUi
15
39
  elif QT_VERSION.startswith("6"):
16
40
  # PyQt6 or PySide6
17
- try:
18
- from PySide6.QtUiTools import QUiLoader
19
-
41
+ if PYSIDE6:
20
42
  self.loader = self.load_ui_pyside6
21
- except ImportError:
43
+ elif PYQT6:
22
44
  from PyQt6.uic import loadUi
23
45
 
24
46
  self.loader = loadUi
47
+ else:
48
+ raise ImportError("No compatible Qt bindings found.")
25
49
 
26
50
  def load_ui_pyside6(self, ui_file, parent=None):
27
51
  """
@@ -33,9 +57,8 @@ class UILoader:
33
57
  Returns:
34
58
  QWidget: The loaded widget.
35
59
  """
36
- from PySide6.QtUiTools import QUiLoader
37
60
 
38
- loader = QUiLoader(parent)
61
+ loader = CustomUiLoader(parent)
39
62
  file = QFile(ui_file)
40
63
  if not file.open(QIODevice.ReadOnly):
41
64
  raise IOError(f"Cannot open file: {ui_file}")
File without changes
@@ -0,0 +1,17 @@
1
+ import pyqtgraph as pg
2
+
3
+
4
+ class ColorButton(pg.ColorButton):
5
+ """
6
+ A ColorButton that opens a dialog to select a color. Inherits from pyqtgraph.ColorButton.
7
+ Patches event loop of the ColorDialog, if opened in another QDialog.
8
+ """
9
+
10
+ def __init__(self, *args, **kwargs):
11
+ super().__init__(*args, **kwargs)
12
+
13
+ def selectColor(self):
14
+ self.origColor = self.color()
15
+ self.colorDialog.setCurrentColor(self.color())
16
+ self.colorDialog.open()
17
+ self.colorDialog.exec()
@@ -0,0 +1 @@
1
+ {'files': ['color_button.py']}
@@ -0,0 +1,55 @@
1
+ import os
2
+
3
+ from qtpy.QtDesigner import QDesignerCustomWidgetInterface
4
+ from qtpy.QtGui import QIcon
5
+
6
+ from bec_widgets.widgets.buttons.color_button.color_button import ColorButton
7
+
8
+ DOM_XML = """
9
+ <ui language='c++'>
10
+ <widget class='ColorButton' name='color_button'>
11
+ </widget>
12
+ </ui>
13
+ """
14
+
15
+
16
+ class ColorButtonPlugin(QDesignerCustomWidgetInterface): # pragma: no cover
17
+ def __init__(self):
18
+ super().__init__()
19
+ self._form_editor = None
20
+
21
+ def createWidget(self, parent):
22
+ t = ColorButton(parent)
23
+ return t
24
+
25
+ def domXml(self):
26
+ return DOM_XML
27
+
28
+ def group(self):
29
+ return "BEC Buttons"
30
+
31
+ def icon(self):
32
+ current_path = os.path.dirname(__file__)
33
+ icon_path = os.path.join(current_path, "assets", "color_button.png")
34
+ return QIcon(icon_path)
35
+
36
+ def includeFile(self):
37
+ return "color_button"
38
+
39
+ def initialize(self, form_editor):
40
+ self._form_editor = form_editor
41
+
42
+ def isContainer(self):
43
+ return False
44
+
45
+ def isInitialized(self):
46
+ return self._form_editor is not None
47
+
48
+ def name(self):
49
+ return "ColorButton"
50
+
51
+ def toolTip(self):
52
+ return "ColorButton which opens a color dialog."
53
+
54
+ def whatsThis(self):
55
+ return self.toolTip()
@@ -0,0 +1,15 @@
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.buttons.color_button.color_button_plugin import ColorButtonPlugin
10
+
11
+ QPyDesignerCustomWidgetCollection.addCustomWidget(ColorButtonPlugin())
12
+
13
+
14
+ if __name__ == "__main__": # pragma: no cover
15
+ main()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: bec_widgets
3
- Version: 0.77.0
3
+ Version: 0.78.1
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,11 +2,11 @@
2
2
  .gitlab-ci.yml,sha256=RnYDz4zKXjlqltTryprlB1s5vLXxI2-seW-Vb70NNF0,8162
3
3
  .pylintrc,sha256=OstrgmEyP0smNFBKoIN5_26-UmNZgMHnbjvAWX0UrLs,18535
4
4
  .readthedocs.yaml,sha256=aSOc277LqXcsTI6lgvm_JY80lMlr69GbPKgivua2cS0,603
5
- CHANGELOG.md,sha256=5NFzG6tfisXzHM6jj-he3x3_HPgPdKKyt1oWkUH-bMw,7010
5
+ CHANGELOG.md,sha256=kroZq4JMIbAiYELl0nNoRfIdM8HMJ3zxVLyjBSY_eeQ,6898
6
6
  LICENSE,sha256=YRKe85CBRyP7UpEAWwU8_qSIyuy5-l_9C-HKg5Qm8MQ,1511
7
- PKG-INFO,sha256=61Ifh7zaMqLXKnkSGQ_8azx2be2G1eA947Z7kKfuzjQ,1427
7
+ PKG-INFO,sha256=K--Tt-4cK6WRueP1TWlvlkxdIvtFrITlgoa1YgTzAEY,1427
8
8
  README.md,sha256=y4jB6wvArS7N8_iTbKWnSM_oRAqLA2GqgzUR-FMh5sU,2645
9
- pyproject.toml,sha256=SlNgLZnAPXNh5bnWqZGqsG3ymviFuwjWuW2v0MgQnb4,2403
9
+ pyproject.toml,sha256=AzDPAPgepFikmdL_FQY2rnZ8fd2df7G0l14INJ378ZQ,2403
10
10
  .git_hooks/pre-commit,sha256=n3RofIZHJl8zfJJIUomcMyYGFi_rwq4CC19z0snz3FI,286
11
11
  .gitlab/issue_templates/bug_report_template.md,sha256=gAuyEwl7XlnebBrkiJ9AqffSNOywmr8vygUFWKTuQeI,386
12
12
  .gitlab/issue_templates/documentation_update_template.md,sha256=FHLdb3TS_D9aL4CYZCjyXSulbaW5mrN2CmwTaeLPbNw,860
@@ -51,7 +51,7 @@ bec_widgets/utils/layout_manager.py,sha256=H0nKsIMaPxRkof1MEXlSmW6w1dFxA6astaGzf
51
51
  bec_widgets/utils/plugin_utils.py,sha256=tmZkUNvVlldPjHDfL_TbaV2jjAECgPjGsvLMmmyZcfc,3342
52
52
  bec_widgets/utils/rpc_decorator.py,sha256=pIvtqySQLnuS7l2Ti_UAe4WX7CRivZnsE5ZdKAihxh0,479
53
53
  bec_widgets/utils/thread_checker.py,sha256=rDNuA3X6KQyA7JPb67mccTg0z8YkInynLAENQDQpbuE,1607
54
- bec_widgets/utils/ui_loader.py,sha256=5NktcP1r1HQub7K82fW_jkj8rT2cqJQdMvDxwToLY4E,1650
54
+ bec_widgets/utils/ui_loader.py,sha256=2N50GPH2nh7lT7NQVoHzcjgZzk2zFybFqrBmG91dq8M,2552
55
55
  bec_widgets/utils/validator_delegate.py,sha256=Emj1WF6W8Ke1ruBWUfmHdVJpmOSPezuOt4zvQTay_44,442
56
56
  bec_widgets/utils/widget_io.py,sha256=U_02ESf9Ukz63B01AzYioNepSc6SX11nJhPPSDmL4IA,11318
57
57
  bec_widgets/utils/yaml_dialog.py,sha256=T6UyGNGdmpXW74fa_7Nk6b99T5pp2Wvyw3AOauRc8T8,2407
@@ -67,6 +67,12 @@ bec_widgets/widgets/bec_status_box/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQe
67
67
  bec_widgets/widgets/bec_status_box/bec_status_box.py,sha256=twWugYlGVSl9ziSbjeB75BZwuruXFszRoOlN0d79Gnk,14523
68
68
  bec_widgets/widgets/bec_status_box/status_item.py,sha256=wPkDm0GCGNXXpy3rR_Ljaxy0ZHeiiYcrWFqEntZnz4E,5869
69
69
  bec_widgets/widgets/buttons/__init__.py,sha256=74ucIRU6-anoqQ-zT7wbrysmxhg_3_04xGhN_kllNUI,48
70
+ bec_widgets/widgets/buttons/color_button/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
71
+ bec_widgets/widgets/buttons/color_button/color_button.py,sha256=AJUMOQVLd4H39wzW2MJLhGAww7a1NtjivTkfexVhHHo,512
72
+ bec_widgets/widgets/buttons/color_button/color_button.pyproject,sha256=LUYF4VkDOB4ttVe7YfvLh64K-XZg0-xaVT06BqCT3UA,30
73
+ bec_widgets/widgets/buttons/color_button/color_button_plugin.py,sha256=4phedgYl94PAn2VL-_IPIU3rKq6dwDGgHXyk5c2HcgU,1264
74
+ bec_widgets/widgets/buttons/color_button/register_color_button.py,sha256=PqsqOMNcdBL956mRIRFau4emb0bExuEtI9_l1l6rf88,483
75
+ bec_widgets/widgets/buttons/color_button/assets/color_button.png,sha256=dkjgGHSdxu98nM68O16fGpxBjxkkeLN8iu9M_8i5-NY,5618
70
76
  bec_widgets/widgets/buttons/stop_button/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
71
77
  bec_widgets/widgets/buttons/stop_button/stop_button.py,sha256=x4a7RvlMkHzOd05zKOGYkyTmBza7Me7jgOL9WIgA_c4,906
72
78
  bec_widgets/widgets/console/console.py,sha256=EgKYlbW3NrRPoQwIr8x739sLd1IRBWkEy286VDQw0gA,17838
@@ -223,8 +229,8 @@ tests/unit_tests/test_configs/config_device_no_entry.yaml,sha256=hdvue9KLc_kfNzG
223
229
  tests/unit_tests/test_configs/config_scan.yaml,sha256=vo484BbWOjA_e-h6bTjSV9k7QaQHrlAvx-z8wtY-P4E,1915
224
230
  tests/unit_tests/test_msgs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
225
231
  tests/unit_tests/test_msgs/available_scans_message.py,sha256=m_z97hIrjHXXMa2Ex-UvsPmTxOYXfjxyJaGkIY6StTY,46532
226
- bec_widgets-0.77.0.dist-info/METADATA,sha256=61Ifh7zaMqLXKnkSGQ_8azx2be2G1eA947Z7kKfuzjQ,1427
227
- bec_widgets-0.77.0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
228
- bec_widgets-0.77.0.dist-info/entry_points.txt,sha256=3otEkCdDB9LZJuBLzG4pFLK5Di0CVybN_12IsZrQ-58,166
229
- bec_widgets-0.77.0.dist-info/licenses/LICENSE,sha256=YRKe85CBRyP7UpEAWwU8_qSIyuy5-l_9C-HKg5Qm8MQ,1511
230
- bec_widgets-0.77.0.dist-info/RECORD,,
232
+ bec_widgets-0.78.1.dist-info/METADATA,sha256=K--Tt-4cK6WRueP1TWlvlkxdIvtFrITlgoa1YgTzAEY,1427
233
+ bec_widgets-0.78.1.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
234
+ bec_widgets-0.78.1.dist-info/entry_points.txt,sha256=3otEkCdDB9LZJuBLzG4pFLK5Di0CVybN_12IsZrQ-58,166
235
+ bec_widgets-0.78.1.dist-info/licenses/LICENSE,sha256=YRKe85CBRyP7UpEAWwU8_qSIyuy5-l_9C-HKg5Qm8MQ,1511
236
+ bec_widgets-0.78.1.dist-info/RECORD,,
pyproject.toml CHANGED
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "bec_widgets"
7
- version = "0.77.0"
7
+ version = "0.78.1"
8
8
  description = "BEC Widgets"
9
9
  requires-python = ">=3.10"
10
10
  classifiers = [