bec-widgets 0.99.14__py3-none-any.whl → 0.99.15__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.15 (2024-08-31)
4
+
5
+ ### Fix
6
+
7
+ * fix(theme): update pg axes on theme update ([`af23e74`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/af23e74f71152f4abc319ab7b45e65deefde3519))
8
+
9
+ * fix(positioner_box): fixed positioner box dialog; added test; closes #332 ([`0bf1cf9`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/0bf1cf9b8ab2f9171d5ff63d4e3672eb93e9a5fa))
10
+
3
11
  ## v0.99.14 (2024-08-30)
4
12
 
5
13
  ### Fix
@@ -147,11 +155,3 @@ If not theme is set, the init of the BECWidget base class sets the default theme
147
155
  * fix(crosshair): emit all crosshair events, not just line coordinates ([`2265458`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/2265458dcc57970db18c62619f5877d542d72e81))
148
156
 
149
157
  ## v0.99.0 (2024-08-25)
150
-
151
- ### Documentation
152
-
153
- * docs(darkmodebutton): added dark mode button docs ([`406c263`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/406c263746f0e809c1a4d98356c48f40428c23d7))
154
-
155
- ### Refactor
156
-
157
- * refactor(darkmodebutton): renamed set_dark_mode_enabled to toggle_dark_mode ([`c70724a`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/c70724a456900bcb06b040407a2c5d497e49ce77))
PKG-INFO CHANGED
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: bec_widgets
3
- Version: 0.99.14
3
+ Version: 0.99.15
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
@@ -29,6 +29,7 @@ def set_theme(theme: Literal["dark", "light", "auto"]):
29
29
  app = QApplication.instance()
30
30
  bec_qthemes.setup_theme(theme)
31
31
  pg.setConfigOption("background", "w" if app.theme["theme"] == "light" else "k")
32
+ app.theme_signal.theme_updated.emit(theme)
32
33
  apply_theme(theme)
33
34
 
34
35
  # pylint: disable=protected-access
@@ -37,6 +38,7 @@ def set_theme(theme: Literal["dark", "light", "auto"]):
37
38
 
38
39
  def callback():
39
40
  app.theme["theme"] = listener._theme.lower()
41
+ app.theme_signal.theme_updated.emit(app.theme["theme"])
40
42
  apply_theme(listener._theme.lower())
41
43
 
42
44
  listener = OSThemeSwitchListener(callback)
@@ -53,6 +55,7 @@ def apply_theme(theme: Literal["dark", "light"]):
53
55
  children = itertools.chain.from_iterable(
54
56
  top.findChildren(pg.GraphicsLayoutWidget) for top in app.topLevelWidgets()
55
57
  )
58
+ pg.setConfigOptions(foreground="d" if theme == "dark" else "k")
56
59
  for pg_widget in children:
57
60
  pg_widget.setBackground("k" if theme == "dark" else "w")
58
61
 
@@ -2,10 +2,11 @@ from __future__ import annotations
2
2
 
3
3
  from typing import Literal, Optional
4
4
 
5
+ import bec_qthemes
5
6
  import pyqtgraph as pg
6
7
  from pydantic import BaseModel, Field
7
8
  from qtpy.QtCore import Signal, Slot
8
- from qtpy.QtWidgets import QWidget
9
+ from qtpy.QtWidgets import QApplication, QWidget
9
10
 
10
11
  from bec_widgets.utils import BECConnector, ConnectionConfig
11
12
  from bec_widgets.utils.crosshair import Crosshair
@@ -98,6 +99,36 @@ class BECPlotBase(BECConnector, pg.GraphicsLayout):
98
99
 
99
100
  self.add_legend()
100
101
  self.crosshair = None
102
+ self.connect_to_theme_change()
103
+ self.apply_theme()
104
+
105
+ def connect_to_theme_change(self):
106
+ """Connect to the theme change signal."""
107
+ qapp = QApplication.instance()
108
+ if hasattr(qapp, "theme_signal"):
109
+ qapp.theme_signal.theme_updated.connect(self.apply_theme)
110
+
111
+ @Slot(str)
112
+ @Slot()
113
+ def apply_theme(self, theme: str | None = None):
114
+ """
115
+ Apply the theme to the plot widget.
116
+
117
+ Args:
118
+ theme(str, optional): The theme to be applied.
119
+ """
120
+ if theme is None:
121
+ qapp = QApplication.instance()
122
+ if hasattr(qapp, "theme"):
123
+ theme = qapp.theme["theme"]
124
+ else:
125
+ theme = "dark"
126
+ palette = bec_qthemes.load_palette(theme)
127
+ text_pen = pg.mkPen(color=palette.text().color())
128
+
129
+ for axis in ["left", "bottom", "right", "top"]:
130
+ self.plot_item.getAxis(axis).setPen(text_pen)
131
+ self.plot_item.getAxis(axis).setTextPen(text_pen)
101
132
 
102
133
  def set(self, **kwargs) -> None:
103
134
  """
@@ -46,6 +46,7 @@ class PositionerBox(BECWidget, QWidget):
46
46
  self.get_bec_shortcuts()
47
47
  self._device = ""
48
48
  self._limits = None
49
+ self._dialog = None
49
50
 
50
51
  self.init_ui()
51
52
 
@@ -87,17 +88,18 @@ class PositionerBox(BECWidget, QWidget):
87
88
 
88
89
  def _open_dialog_selection(self):
89
90
  """Open dialog window for positioner selection"""
90
- dialog = QDialog(self)
91
- dialog.setWindowTitle("Positioner Selection")
91
+ self._dialog = QDialog(self)
92
+ self._dialog.setWindowTitle("Positioner Selection")
92
93
  layout = QVBoxLayout()
93
94
  line_edit = DeviceLineEdit(self, client=self.client, device_filter="Positioner")
94
- line_edit.textChanged.connect(self._positioner_changed)
95
+ line_edit.textChanged.connect(self.set_positioner)
95
96
  layout.addWidget(line_edit)
96
97
  close_button = QPushButton("Close")
97
- close_button.clicked.connect(dialog.accept)
98
+ close_button.clicked.connect(self._dialog.accept)
98
99
  layout.addWidget(close_button)
99
- dialog.setLayout(layout)
100
- dialog.exec()
100
+ self._dialog.setLayout(layout)
101
+ self._dialog.exec()
102
+ self._dialog = None
101
103
 
102
104
  def init_device(self):
103
105
  """Init the device view and readback"""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: bec_widgets
3
- Version: 0.99.14
3
+ Version: 0.99.15
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=491h8rG7itgG2nLAv5euKTtvvCOYox6DulZYb2EUAn4,6702
5
+ CHANGELOG.md,sha256=_HCeY9bzET0OS8ksAlJtZPE2LccyFanuUVeUFjWVY4U,6695
6
6
  LICENSE,sha256=YRKe85CBRyP7UpEAWwU8_qSIyuy5-l_9C-HKg5Qm8MQ,1511
7
- PKG-INFO,sha256=aCSXdwjkwwz5IUUEd1UXlQuWiYwJ-NVqnvkL9Pn3d2o,1334
7
+ PKG-INFO,sha256=qo2aifx_l3H1ofv9U1qzWJ7Y-0Kahsy79VLTF36ncgY,1334
8
8
  README.md,sha256=Od69x-RS85Hph0-WwWACwal4yUd67XkEn4APEfHhHFw,2649
9
- pyproject.toml,sha256=NYP-yfDe-xMggOl9oDDj701cUBvVA4DqM0pZ6VCtKco,2544
9
+ pyproject.toml,sha256=4zOaAOMO3mwmQh3XdEw776I_hGGc4Qjw8wM2DY61zek,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
@@ -53,7 +53,7 @@ bec_widgets/utils/bec_designer.py,sha256=Z3MeMju-KmTz8POtm23VQfp4rvtD2sF6eIOKQkl
53
53
  bec_widgets/utils/bec_dispatcher.py,sha256=NkObWO_gRO9Uobz-fy0gVTZqQsbFRaKj6fbjYZoErFI,6400
54
54
  bec_widgets/utils/bec_table.py,sha256=nA2b8ukSeUfquFMAxGrUVOqdrzMoDYD6O_4EYbOG2zk,717
55
55
  bec_widgets/utils/bec_widget.py,sha256=vMJy-mR0kmcGaI5u1WytEuIoTJfMEcgepxIpv8yVmHY,1113
56
- bec_widgets/utils/colors.py,sha256=bdURzbrIv7UWXTlaj1wJYq2JmI_gw1pi6LVYqijbLKA,12325
56
+ bec_widgets/utils/colors.py,sha256=YuExmqsu2sbaWE2RIYGjNaGfOwZV_SmPA08B9PXm6zw,12504
57
57
  bec_widgets/utils/container_utils.py,sha256=0wr3ZfuMiAFKCrQHVjxjw-Vuk8wsHdridqcjy2eY840,1531
58
58
  bec_widgets/utils/crosshair.py,sha256=8lik9k69WI2WMj5FGLbrKtny9duxqXUJAhpX8tHoyp0,11543
59
59
  bec_widgets/utils/entry_validator.py,sha256=3skJIsUwTYicT76AMHm_M78RiWtUgyD2zb-Rxo2HdHQ,1313
@@ -143,7 +143,7 @@ bec_widgets/widgets/figure/figure.py,sha256=kd7enVkT7df79HWzYjCzAZ1qF8jtlzqNfo7Y
143
143
  bec_widgets/widgets/figure/plots/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
144
144
  bec_widgets/widgets/figure/plots/axis_settings.py,sha256=QxRpQwgfBr1H0HTjfOpiXi_-n8I0BaZhS8LRXNeVfFg,3544
145
145
  bec_widgets/widgets/figure/plots/axis_settings.ui,sha256=a2qIuK9lyi9HCyrSvPr6wxzmm1FymaWcpmyOhMIiFt8,11013
146
- bec_widgets/widgets/figure/plots/plot_base.py,sha256=RLQeize3X02rzp5DyBzvQI7SdA4DiEuFH-Dzij1mohg,14029
146
+ bec_widgets/widgets/figure/plots/plot_base.py,sha256=VB_erv2ITXA87NpCcYtL-Y_tTnNb9Xoqt9Z7I8XQX0I,15078
147
147
  bec_widgets/widgets/figure/plots/image/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
148
148
  bec_widgets/widgets/figure/plots/image/image.py,sha256=y2MqgJv6Njv-huDN_exn0Fq1rAh5vs_assKCKHgQH6I,24941
149
149
  bec_widgets/widgets/figure/plots/image/image_item.py,sha256=RljjbkqJEr2cKDlqj1j5GQ1h89jpqOV-OpFz1TbED8I,10937
@@ -174,7 +174,7 @@ bec_widgets/widgets/position_indicator/position_indicator.pyproject,sha256=s0JEf
174
174
  bec_widgets/widgets/position_indicator/position_indicator_plugin.py,sha256=ehQPpwkjJ7k365i4gdwtmAmCbVmB1tvQLEo60J_ivo4,1413
175
175
  bec_widgets/widgets/position_indicator/register_position_indicator.py,sha256=OZNiMgM_80TPSAXK_0hXAkne4vUh8DGvh_OdpOiMpwI,516
176
176
  bec_widgets/widgets/positioner_box/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
177
- bec_widgets/widgets/positioner_box/positioner_box.py,sha256=XJFbHiPkVbqp2wS6wgwzQUjqI_Iqu3CFmyQrDl0xFSY,11223
177
+ bec_widgets/widgets/positioner_box/positioner_box.py,sha256=9k1i5o_8lxZApMTmy1k0nwkbGedFHph25oYPKXZ9pgo,11304
178
178
  bec_widgets/widgets/positioner_box/positioner_box.pyproject,sha256=7966pHdDseaHciaPNEKgdQgbUThSZf5wEDCeAEJh9po,32
179
179
  bec_widgets/widgets/positioner_box/positioner_box.ui,sha256=Y-Xp0z32okT7X4-rL5r7dF_QH_QpXvPes3f778cC7_k,5633
180
180
  bec_widgets/widgets/positioner_box/positioner_box_plugin.py,sha256=kJtQgRFGkJYWbZqJ7K7o0UhdsgAlODUVZL8pKJWwMhs,1413
@@ -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.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,,
241
+ bec_widgets-0.99.15.dist-info/METADATA,sha256=qo2aifx_l3H1ofv9U1qzWJ7Y-0Kahsy79VLTF36ncgY,1334
242
+ bec_widgets-0.99.15.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
243
+ bec_widgets-0.99.15.dist-info/entry_points.txt,sha256=3otEkCdDB9LZJuBLzG4pFLK5Di0CVybN_12IsZrQ-58,166
244
+ bec_widgets-0.99.15.dist-info/licenses/LICENSE,sha256=YRKe85CBRyP7UpEAWwU8_qSIyuy5-l_9C-HKg5Qm8MQ,1511
245
+ bec_widgets-0.99.15.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.14"
7
+ version = "0.99.15"
8
8
  description = "BEC Widgets"
9
9
  requires-python = ">=3.10"
10
10
  classifiers = [