bec-widgets 1.16.2__py3-none-any.whl → 1.16.3__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,6 +1,20 @@
1
1
  # CHANGELOG
2
2
 
3
3
 
4
+ ## v1.16.3 (2025-01-20)
5
+
6
+ ### Bug Fixes
7
+
8
+ - **error_popups**: Logger message in SafeSlot for errors; identification in error log from which
9
+ property or signal errors comes from
10
+ ([`02a4862`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/02a4862afdbbb5d343f798a086395e1596d1239a))
11
+
12
+ ### Testing
13
+
14
+ - **error_popups**: Safeslot tests adjusted; tests extended to cover SafeProperty
15
+ ([`dfa2908`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/dfa2908c3de39802d40a2dee3e77cd5ca2ccad3b))
16
+
17
+
4
18
  ## v1.16.2 (2025-01-20)
5
19
 
6
20
  ### Bug Fixes
PKG-INFO CHANGED
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bec_widgets
3
- Version: 1.16.2
3
+ Version: 1.16.3
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
@@ -33,45 +33,60 @@ def SafeProperty(prop_type, *prop_args, popup_error: bool = False, default=None,
33
33
  """
34
34
 
35
35
  def decorator(py_getter):
36
+ """Decorator for the user's property getter function."""
37
+
36
38
  @functools.wraps(py_getter)
37
39
  def safe_getter(self_):
38
40
  try:
39
41
  return py_getter(self_)
40
42
  except Exception:
43
+ # Identify which property function triggered error
44
+ prop_name = f"{py_getter.__module__}.{py_getter.__qualname__}"
45
+ error_msg = traceback.format_exc()
46
+
41
47
  if popup_error:
42
48
  ErrorPopupUtility().custom_exception_hook(*sys.exc_info(), popup_error=True)
43
- # Return the user-defined default (which might be anything, including None).
44
49
  else:
45
- error_msg = traceback.format_exc()
46
- logger.error(str(error_msg))
50
+ logger.error(f"SafeProperty error in GETTER of '{prop_name}':\n{error_msg}")
47
51
  return default
48
52
 
49
53
  class PropertyWrapper:
54
+ """
55
+ Intermediate wrapper used so that the user can optionally chain .setter(...).
56
+ """
57
+
50
58
  def __init__(self, getter_func):
51
59
  # We store only our safe_getter in the wrapper
52
60
  self.getter_func = safe_getter
53
61
 
54
62
  def setter(self, setter_func):
63
+ """Wraps the user-defined setter to handle errors safely."""
64
+
55
65
  @functools.wraps(setter_func)
56
66
  def safe_setter(self_, value):
57
67
  try:
58
68
  return setter_func(self_, value)
59
69
  except Exception:
70
+ prop_name = f"{setter_func.__module__}.{setter_func.__qualname__}"
71
+ error_msg = traceback.format_exc()
72
+
60
73
  if popup_error:
61
74
  ErrorPopupUtility().custom_exception_hook(
62
75
  *sys.exc_info(), popup_error=True
63
76
  )
64
- # Swallow the exception; no crash in Designer
65
77
  else:
66
- error_msg = traceback.format_exc()
67
- logger.error(str(error_msg))
78
+ logger.error(
79
+ f"SafeProperty error in SETTER of '{prop_name}':\n{error_msg}"
80
+ )
68
81
  return
69
82
 
70
83
  # Return the full read/write Property
71
84
  return Property(prop_type, self.getter_func, safe_setter, *prop_args, **prop_kwargs)
72
85
 
73
86
  def __call__(self):
74
- # If the user never chains a .setter(...) call, we produce a read-only property
87
+ """
88
+ If user never calls `.setter(...)`, produce a read-only property.
89
+ """
75
90
  return Property(prop_type, self.getter_func, None, *prop_args, **prop_kwargs)
76
91
 
77
92
  return PropertyWrapper(py_getter)
@@ -95,7 +110,14 @@ def SafeSlot(*slot_args, **slot_kwargs): # pylint: disable=invalid-name
95
110
  try:
96
111
  return method(*args, **kwargs)
97
112
  except Exception:
98
- ErrorPopupUtility().custom_exception_hook(*sys.exc_info(), popup_error=popup_error)
113
+ slot_name = f"{method.__module__}.{method.__qualname__}"
114
+ error_msg = traceback.format_exc()
115
+ if popup_error:
116
+ ErrorPopupUtility().custom_exception_hook(
117
+ *sys.exc_info(), popup_error=popup_error
118
+ )
119
+ else:
120
+ logger.error(f"SafeSlot error in slot '{slot_name}':\n{error_msg}")
99
121
 
100
122
  return wrapper
101
123
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bec_widgets
3
- Version: 1.16.2
3
+ Version: 1.16.3
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=CLlFGYRGKp4FxCPTkyF9p-7qx67KmbM9Yok9JQEU_Ls,8677
3
3
  .pylintrc,sha256=eeY8YwSI74oFfq6IYIbCqnx3Vk8ZncKaatv96n_Y8Rs,18544
4
4
  .readthedocs.yaml,sha256=aSOc277LqXcsTI6lgvm_JY80lMlr69GbPKgivua2cS0,603
5
- CHANGELOG.md,sha256=XB0U0tL8vwGYFTtxikpELHFwpOxSgylCVq09YQeNC9k,222517
5
+ CHANGELOG.md,sha256=Iqt8ZIE_VhJ6GOkmOZn0AHUfMJwRNYC1d_Gj9TeVMhw,223002
6
6
  LICENSE,sha256=YRKe85CBRyP7UpEAWwU8_qSIyuy5-l_9C-HKg5Qm8MQ,1511
7
- PKG-INFO,sha256=sqiN3l6J2_T9py1gicYZ-ldmqwPwu-vnRMiT_ZtHYHo,1339
7
+ PKG-INFO,sha256=kNXT54BowXz3OgD91TpmoXlC0FYjZrP4viavq7jamYQ,1339
8
8
  README.md,sha256=Od69x-RS85Hph0-WwWACwal4yUd67XkEn4APEfHhHFw,2649
9
- pyproject.toml,sha256=IkOST5eSW4k_6bbLffa2ELh2kDSyKebNhahDRm3fdXI,2596
9
+ pyproject.toml,sha256=xvi3WMJdveaqimlB8fMW998LGmGXfplgeIBS1WWiqIc,2596
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
@@ -49,7 +49,7 @@ bec_widgets/examples/plugin_example_pyside/tictactoetaskmenu.py,sha256=V6OVnBTS-
49
49
  bec_widgets/qt_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
50
50
  bec_widgets/qt_utils/collapsible_panel_manager.py,sha256=tvv77-9YTfYpsU6M_Le3bHR6wtANC83DEOrJ2Hhj6rs,14201
51
51
  bec_widgets/qt_utils/compact_popup.py,sha256=3yeb-GJ1PUla5Q_hT0XDKqvyIEH9yV_eGidf1t8Dbbw,10234
52
- bec_widgets/qt_utils/error_popups.py,sha256=wnkESSS8hhjj4ift3RrgWNc-PmIidVsg1l_VDfV00P4,10858
52
+ bec_widgets/qt_utils/error_popups.py,sha256=-O-mja4-V9Q_eoUDh19LRqMr6BDAuaOngL4H5iB-ZjA,11693
53
53
  bec_widgets/qt_utils/palette_viewer.py,sha256=--B0x7aE7bniHIeuuLY_pH8yBDrTTXaE0IDrC_AM1mo,6326
54
54
  bec_widgets/qt_utils/redis_message_waiter.py,sha256=fvL_QgC0cTDv_FPJdRyp5AKjf401EJU4z3r38p47ydY,1745
55
55
  bec_widgets/qt_utils/round_frame.py,sha256=Ba_sTzYB_vYDepBBMPPqU8XDwKOAiU6ClZ3xUqiveK0,5734
@@ -326,8 +326,8 @@ bec_widgets/widgets/utility/visual/dark_mode_button/dark_mode_button.py,sha256=Z
326
326
  bec_widgets/widgets/utility/visual/dark_mode_button/dark_mode_button.pyproject,sha256=Lbi9zb6HNlIq14k6hlzR-oz6PIFShBuF7QxE6d87d64,34
327
327
  bec_widgets/widgets/utility/visual/dark_mode_button/dark_mode_button_plugin.py,sha256=CzChz2SSETYsR8-36meqWnsXCT-FIy_J_xeU5coWDY8,1350
328
328
  bec_widgets/widgets/utility/visual/dark_mode_button/register_dark_mode_button.py,sha256=rMpZ1CaoucwobgPj1FuKTnt07W82bV1GaSYdoqcdMb8,521
329
- bec_widgets-1.16.2.dist-info/METADATA,sha256=sqiN3l6J2_T9py1gicYZ-ldmqwPwu-vnRMiT_ZtHYHo,1339
330
- bec_widgets-1.16.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
331
- bec_widgets-1.16.2.dist-info/entry_points.txt,sha256=dItMzmwA1wizJ1Itx15qnfJ0ZzKVYFLVJ1voxT7K7D4,214
332
- bec_widgets-1.16.2.dist-info/licenses/LICENSE,sha256=YRKe85CBRyP7UpEAWwU8_qSIyuy5-l_9C-HKg5Qm8MQ,1511
333
- bec_widgets-1.16.2.dist-info/RECORD,,
329
+ bec_widgets-1.16.3.dist-info/METADATA,sha256=kNXT54BowXz3OgD91TpmoXlC0FYjZrP4viavq7jamYQ,1339
330
+ bec_widgets-1.16.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
331
+ bec_widgets-1.16.3.dist-info/entry_points.txt,sha256=dItMzmwA1wizJ1Itx15qnfJ0ZzKVYFLVJ1voxT7K7D4,214
332
+ bec_widgets-1.16.3.dist-info/licenses/LICENSE,sha256=YRKe85CBRyP7UpEAWwU8_qSIyuy5-l_9C-HKg5Qm8MQ,1511
333
+ bec_widgets-1.16.3.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 = "1.16.2"
7
+ version = "1.16.3"
8
8
  description = "BEC Widgets"
9
9
  requires-python = ">=3.10"
10
10
  classifiers = [