bec-widgets 0.99.13__py3-none-any.whl → 0.99.14__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,13 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## v0.99.14 (2024-08-30)
4
+
5
+ ### Fix
6
+
7
+ * fix(color_button): signal and slot added for selecting color and for emitting color after change ([`99a98de`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/99a98de8a3b7a83d71e4b567e865ac6f5c62a754))
8
+
9
+ * fix(color_button): inheritance changed to QWidget ([`3c0e501`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/3c0e501c56227d4d98ff0ac2186ff5065bff8d7a))
10
+
3
11
  ## v0.99.13 (2024-08-30)
4
12
 
5
13
  ### Documentation
@@ -144,18 +152,6 @@ If not theme is set, the init of the BECWidget base class sets the default theme
144
152
 
145
153
  * docs(darkmodebutton): added dark mode button docs ([`406c263`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/406c263746f0e809c1a4d98356c48f40428c23d7))
146
154
 
147
- ### Feature
148
-
149
- * feat(darkmodebutton): added button to toggle between dark and light mode ([`cc8c166`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/cc8c166b5c1d37e0f64c83801b2347a54a6550b6))
150
-
151
- ### Fix
152
-
153
- * fix(toggle): emit state change ([`c4f3308`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/c4f3308dc0c3e4b2064760ccd7372d71b3e49f96))
154
-
155
155
  ### Refactor
156
156
 
157
157
  * refactor(darkmodebutton): renamed set_dark_mode_enabled to toggle_dark_mode ([`c70724a`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/c70724a456900bcb06b040407a2c5d497e49ce77))
158
-
159
- ### Test
160
-
161
- * test(dark_mode_button): added tests for dark mode button ([`df35aab`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/df35aabff30c5d00b1c441132bd370446653741e))
PKG-INFO CHANGED
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: bec_widgets
3
- Version: 0.99.13
3
+ Version: 0.99.14
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
@@ -3,24 +3,52 @@ from __future__ import annotations
3
3
  from typing import Literal
4
4
 
5
5
  import pyqtgraph as pg
6
+ from qtpy.QtCore import Qt, Signal
7
+ from qtpy.QtWidgets import QHBoxLayout, QWidget
6
8
 
9
+ from bec_widgets.qt_utils.error_popups import SafeSlot
7
10
 
8
- class ColorButton(pg.ColorButton):
11
+
12
+ class ColorButton(QWidget):
9
13
  """
10
14
  A ColorButton that opens a dialog to select a color. Inherits from pyqtgraph.ColorButton.
11
15
  Patches event loop of the ColorDialog, if opened in another QDialog.
12
16
  """
13
17
 
18
+ color_selected = Signal(str)
19
+
14
20
  ICON_NAME = "colors"
15
21
 
16
22
  def __init__(self, *args, **kwargs):
17
23
  super().__init__(*args, **kwargs)
18
24
 
19
- def selectColor(self):
20
- self.origColor = self.color()
21
- self.colorDialog.setCurrentColor(self.color())
22
- self.colorDialog.open()
23
- self.colorDialog.exec()
25
+ self.layout = QHBoxLayout(self)
26
+ self.layout.setSpacing(0)
27
+ self.layout.setContentsMargins(0, 0, 0, 0)
28
+ self.layout.setAlignment(Qt.AlignmentFlag.AlignVCenter)
29
+
30
+ self.button = pg.ColorButton()
31
+ self.button.setFlat(True)
32
+ self.button.clicked.connect(self.select_color)
33
+ self.layout.addWidget(self.button)
34
+
35
+ @SafeSlot()
36
+ def select_color(self):
37
+ self.origColor = self.button.color()
38
+ self.button.colorDialog.setCurrentColor(self.button.color())
39
+ self.button.colorDialog.open()
40
+ self.button.colorDialog.exec()
41
+ self.color_selected.emit(self.button.color().name())
42
+
43
+ @SafeSlot(str)
44
+ def set_color(self, color: tuple | str):
45
+ """
46
+ Set the color of the button.
47
+
48
+ Args:
49
+ color(tuple|str): The color to set.
50
+ """
51
+ self.button.setColor(color)
24
52
 
25
53
  def get_color(self, format: Literal["RGBA", "HEX"] = "RGBA") -> tuple | str:
26
54
  """
@@ -33,13 +61,13 @@ class ColorButton(pg.ColorButton):
33
61
  tuple|str: The color in the specified format.
34
62
  """
35
63
  if format == "RGBA":
36
- return self.color().getRgb()
64
+ return self.button.color().getRgb()
37
65
  if format == "HEX":
38
- return self.color().name()
66
+ return self.button.color().name()
39
67
 
40
68
  def cleanup(self):
41
69
  """
42
70
  Clean up the ColorButton.
43
71
  """
44
- self.colorDialog.close()
45
- self.colorDialog.deleteLater()
72
+ self.button.colorDialog.close()
73
+ self.button.colorDialog.deleteLater()
@@ -27,7 +27,7 @@ class MotorMapSettings(SettingWidget):
27
27
  background_intensity = int((config["background_value"] / 255) * 100)
28
28
  WidgetIO.set_value(self.ui.background_value, background_intensity)
29
29
  color = config["color"]
30
- self.ui.color.setColor(color)
30
+ self.ui.color.set_color(color)
31
31
 
32
32
  @Slot()
33
33
  def accept_changes(self):
@@ -123,7 +123,7 @@ class CurveSettings(SettingWidget):
123
123
  colors = Colors.golden_angle_color(colormap=cm, num=max(10, rows + 1), format="HEX")
124
124
  color_button_col = 2 if target == "scan" else 3
125
125
  for row in range(rows):
126
- table.cellWidget(row, color_button_col).setColor(colors[row])
126
+ table.cellWidget(row, color_button_col).set_color(colors[row])
127
127
 
128
128
  @Slot()
129
129
  def accept_changes(self):
@@ -275,7 +275,7 @@ class DialogRow(QObject):
275
275
  if self.config is not None:
276
276
  self.device_line_edit.setText(self.config.signals.y.name)
277
277
  self.entry_line_edit.setText(self.config.signals.y.entry)
278
- self.color_button.setColor(self.config.color)
278
+ self.color_button.set_color(self.config.color)
279
279
  self.style_combo.setCurrentText(self.config.pen_style)
280
280
  self.width.setValue(self.config.pen_width)
281
281
  self.symbol_size.setValue(self.config.symbol_size)
@@ -284,7 +284,7 @@ class DialogRow(QObject):
284
284
  colormap="magma", num=max(10, self.row + 1), format="HEX"
285
285
  )
286
286
  default_color = default_colors[self.row]
287
- self.color_button.setColor(default_color)
287
+ self.color_button.set_color(default_color)
288
288
 
289
289
  self.table_widget.setCellWidget(self.row, 0, self.device_line_edit)
290
290
  self.table_widget.setCellWidget(self.row, 1, self.entry_line_edit)
@@ -299,7 +299,7 @@ class DialogRow(QObject):
299
299
  self.device_line_edit.setText(self.config.signals.y.name)
300
300
  self.entry_line_edit.setText(self.config.signals.y.entry)
301
301
  self.dap_combo.setCurrentText(self.config.signals.dap)
302
- self.color_button.setColor(self.config.color)
302
+ self.color_button.set_color(self.config.color)
303
303
  self.style_combo.setCurrentText(self.config.pen_style)
304
304
  self.width.setValue(self.config.pen_width)
305
305
  self.symbol_size.setValue(self.config.symbol_size)
@@ -308,7 +308,7 @@ class DialogRow(QObject):
308
308
  colormap="magma", num=max(10, self.row + 1), format="HEX"
309
309
  )
310
310
  default_color = default_colors[self.row]
311
- self.color_button.setColor(default_color)
311
+ self.color_button.set_color(default_color)
312
312
 
313
313
  self.table_widget.setCellWidget(self.row, 0, self.device_line_edit)
314
314
  self.table_widget.setCellWidget(self.row, 1, self.entry_line_edit)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: bec_widgets
3
- Version: 0.99.13
3
+ Version: 0.99.14
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=HE_stq5wl-0wE5ZetfEmaaDbectk20jX7Z2cxwsBegg,8348
3
3
  .pylintrc,sha256=eeY8YwSI74oFfq6IYIbCqnx3Vk8ZncKaatv96n_Y8Rs,18544
4
4
  .readthedocs.yaml,sha256=aSOc277LqXcsTI6lgvm_JY80lMlr69GbPKgivua2cS0,603
5
- CHANGELOG.md,sha256=INE_XxIw2paIS1rKnad9YIxTW6Ik-jAUMx7gWFYN2yo,6819
5
+ CHANGELOG.md,sha256=491h8rG7itgG2nLAv5euKTtvvCOYox6DulZYb2EUAn4,6702
6
6
  LICENSE,sha256=YRKe85CBRyP7UpEAWwU8_qSIyuy5-l_9C-HKg5Qm8MQ,1511
7
- PKG-INFO,sha256=wJQzigYAwf7RY6soP0JaYqw7ytnmwdxdn95c_8r_EUg,1334
7
+ PKG-INFO,sha256=aCSXdwjkwwz5IUUEd1UXlQuWiYwJ-NVqnvkL9Pn3d2o,1334
8
8
  README.md,sha256=Od69x-RS85Hph0-WwWACwal4yUd67XkEn4APEfHhHFw,2649
9
- pyproject.toml,sha256=2cFWlhLsnZBTnLgOqX1LktBeto948IZF_s-XGJgYFhQ,2544
9
+ pyproject.toml,sha256=NYP-yfDe-xMggOl9oDDj701cUBvVA4DqM0pZ6VCtKco,2544
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
@@ -99,7 +99,7 @@ bec_widgets/widgets/button_resume/register_resume_button.py,sha256=01t5Ruz7FkKt7
99
99
  bec_widgets/widgets/button_resume/resume_button.pyproject,sha256=QEPSupXQtXZDfT1Y0PuCv7Fj6NhBTq1dyvRiFNkvhH8,31
100
100
  bec_widgets/widgets/button_resume/resume_button_plugin.py,sha256=sqGn2I5XlsEpCjqZQBX8KNYpONJVAkBbzfFZL8OAsxI,1300
101
101
  bec_widgets/widgets/color_button/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
102
- bec_widgets/widgets/color_button/color_button.py,sha256=qGyZgQSFfF-IuZeEhdZv8t7hSx3YDFs22evmZejKC0Y,1229
102
+ bec_widgets/widgets/color_button/color_button.py,sha256=0fyiO1gpVe4j3T5VKZ3I1WBx9sfYh077l9GXGmgORcY,2123
103
103
  bec_widgets/widgets/color_button/color_button.pyproject,sha256=LUYF4VkDOB4ttVe7YfvLh64K-XZg0-xaVT06BqCT3UA,30
104
104
  bec_widgets/widgets/color_button/color_button_plugin.py,sha256=dVpr7Q6c871EmDQxGF7tmhelrdbKFfMh9k9cmN_RGu0,1267
105
105
  bec_widgets/widgets/color_button/register_color_button.py,sha256=ZAx3t7G2VI2S-1qcEof31Xi9O0X8deLeZNgS651L1JI,475
@@ -166,7 +166,7 @@ bec_widgets/widgets/motor_map/bec_motor_map_widget_plugin.py,sha256=jM-fxEfpkcyT
166
166
  bec_widgets/widgets/motor_map/motor_map_widget.py,sha256=dsCptljLV5BaSEikxJa3H9O8Cmv0cLwisVySLRofe50,7637
167
167
  bec_widgets/widgets/motor_map/register_bec_motor_map_widget.py,sha256=qRG8PtWGjso0pWbvj_DXKnbUfmQzfGqPSrnAozXfM7o,492
168
168
  bec_widgets/widgets/motor_map/motor_map_dialog/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
169
- bec_widgets/widgets/motor_map/motor_map_dialog/motor_map_settings.py,sha256=U-r3YHsxf2XvZn0kVbrYIT2aXKSaG5wM1JEnGzwGMVU,2258
169
+ bec_widgets/widgets/motor_map/motor_map_dialog/motor_map_settings.py,sha256=-VsVe1yZ41heD2JyknsbFOa9MMThg-G7JPoaJc5ZbYg,2259
170
170
  bec_widgets/widgets/motor_map/motor_map_dialog/motor_map_settings.ui,sha256=nv5vPftt6vcIl60OOZLRvwD29rdHVWOoGmz168BnwKw,2685
171
171
  bec_widgets/widgets/position_indicator/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
172
172
  bec_widgets/widgets/position_indicator/position_indicator.py,sha256=nxmz7zqKhJsWqjH9hPzncTY07dNt-I2UzqiXhmoK4vo,2061
@@ -228,7 +228,7 @@ bec_widgets/widgets/waveform/register_bec_waveform_widget.py,sha256=qZHVZH_lP2hv
228
228
  bec_widgets/widgets/waveform/waveform_widget.py,sha256=QBGv0qLP7FPc8uT3KF6_js2cOcgcdI_SHfqMri77U1s,22170
229
229
  bec_widgets/widgets/waveform/waveform_popups/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
230
230
  bec_widgets/widgets/waveform/waveform_popups/curve_dialog/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
231
- bec_widgets/widgets/waveform/waveform_popups/curve_dialog/curve_dialog.py,sha256=VQwGwZ5Dui7VBU4eCx8PxA_Vtz5f6Xy7mr7Ew5dQYJU,13167
231
+ bec_widgets/widgets/waveform/waveform_popups/curve_dialog/curve_dialog.py,sha256=ApWv0n33TJBP59CQ4MUdyPRSiKfXjTdfui1IfwzFNjE,13172
232
232
  bec_widgets/widgets/waveform/waveform_popups/curve_dialog/curve_dialog.ui,sha256=OaQE5HlyBQ3RQoHqxOFHiUoNcx8SDZP5sHJ9NNGhsPI,10404
233
233
  bec_widgets/widgets/waveform/waveform_popups/dap_summary_dialog/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
234
234
  bec_widgets/widgets/waveform/waveform_popups/dap_summary_dialog/dap_summary.ui,sha256=PFEKro61UXd-jmx65U4pqJ5D29DXtVnhQRnsnDvN-wM,6138
@@ -238,8 +238,8 @@ bec_widgets/widgets/website/register_website_widget.py,sha256=LIQJpV9uqcBiPR9cEA
238
238
  bec_widgets/widgets/website/website.py,sha256=kDlqjwtx0yft1ZNRhTdHnYh_5KZHfqT_ZGPOKT4C-yI,2619
239
239
  bec_widgets/widgets/website/website_widget.pyproject,sha256=scOiV3cV1_BjbzpPzy2N8rIJL5P2qIZz8ObTJ-Uvdtg,25
240
240
  bec_widgets/widgets/website/website_widget_plugin.py,sha256=pz38_C2cZ0yvPPS02wdIPcmhFo_yiwUhflsASocAPQQ,1341
241
- bec_widgets-0.99.13.dist-info/METADATA,sha256=wJQzigYAwf7RY6soP0JaYqw7ytnmwdxdn95c_8r_EUg,1334
242
- bec_widgets-0.99.13.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
243
- bec_widgets-0.99.13.dist-info/entry_points.txt,sha256=3otEkCdDB9LZJuBLzG4pFLK5Di0CVybN_12IsZrQ-58,166
244
- bec_widgets-0.99.13.dist-info/licenses/LICENSE,sha256=YRKe85CBRyP7UpEAWwU8_qSIyuy5-l_9C-HKg5Qm8MQ,1511
245
- bec_widgets-0.99.13.dist-info/RECORD,,
241
+ bec_widgets-0.99.14.dist-info/METADATA,sha256=aCSXdwjkwwz5IUUEd1UXlQuWiYwJ-NVqnvkL9Pn3d2o,1334
242
+ bec_widgets-0.99.14.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
243
+ bec_widgets-0.99.14.dist-info/entry_points.txt,sha256=3otEkCdDB9LZJuBLzG4pFLK5Di0CVybN_12IsZrQ-58,166
244
+ bec_widgets-0.99.14.dist-info/licenses/LICENSE,sha256=YRKe85CBRyP7UpEAWwU8_qSIyuy5-l_9C-HKg5Qm8MQ,1511
245
+ bec_widgets-0.99.14.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.99.13"
7
+ version = "0.99.14"
8
8
  description = "BEC Widgets"
9
9
  requires-python = ">=3.10"
10
10
  classifiers = [