bec-widgets 0.99.12__py3-none-any.whl → 0.99.13__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.99.13 (2024-08-30)
4
+
5
+ ### Documentation
6
+
7
+ * docs: minor updates to the widget tutorial ([`ec9c8f2`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/ec9c8f29633364c45ebd998a5411d428c1ce488d))
8
+
9
+ * docs(widget tutorial): step by step guide added ([`b32ced8`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/b32ced85fff628a9e1303a781630cdae3865238e))
10
+
11
+ ### Fix
12
+
13
+ * fix(dark mode button): fixed dark mode button state for external updates, including auto ([`a3110d9`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/a3110d98147295dcb1f9353f9aaf5461cba9232a))
14
+
3
15
  ## v0.99.12 (2024-08-29)
4
16
 
5
17
  ### Fix
@@ -147,19 +159,3 @@ If not theme is set, the init of the BECWidget base class sets the default theme
147
159
  ### Test
148
160
 
149
161
  * test(dark_mode_button): added tests for dark mode button ([`df35aab`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/df35aabff30c5d00b1c441132bd370446653741e))
150
-
151
- ## v0.98.0 (2024-08-25)
152
-
153
- ### Fix
154
-
155
- * fix(toolbar): removed hardcoded color values ([`afdf4e8`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/afdf4e8782a22566932180224fa1c924d24c810f))
156
-
157
- * fix: transitioning to material icons ([`2a82032`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/2a82032644a84e38df04e2035a6aa63f4a046360))
158
-
159
- * fix(dock_area): transitioned to MaterialIconAction ([`88a2f66`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/88a2f667588e9aeb34ae556fa327898824052bc3))
160
-
161
- * fix: fix color palette if qtheme was not called ([`3f3b207`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/3f3b207295ebd406ebaeecee465c774965161b8b))
162
-
163
- ### Refactor
164
-
165
- * refactor(waveform): use set theme for demo ([`44cfda1`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/44cfda1c07306669c9a4e09706d95e6b91dee370))
PKG-INFO CHANGED
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: bec_widgets
3
- Version: 0.99.12
3
+ Version: 0.99.13
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
@@ -8,7 +8,7 @@ import pyqtgraph as pg
8
8
  from bec_qthemes._os_appearance.listener import OSThemeSwitchListener
9
9
  from pydantic_core import PydanticCustomError
10
10
  from qtpy.QtGui import QColor
11
- from qtpy.QtWidgets import QApplication
11
+ from qtpy.QtWidgets import QApplication, QPushButton, QToolButton
12
12
 
13
13
 
14
14
  def get_theme_palette():
@@ -56,6 +56,17 @@ def apply_theme(theme: Literal["dark", "light"]):
56
56
  for pg_widget in children:
57
57
  pg_widget.setBackground("k" if theme == "dark" else "w")
58
58
 
59
+ dark_mode_buttons = [
60
+ button
61
+ for button in app.topLevelWidgets()
62
+ if hasattr(button, "dark_mode_enabled")
63
+ and hasattr(button, "mode_button")
64
+ and isinstance(button.mode_button, (QPushButton, QToolButton))
65
+ ]
66
+
67
+ for button in dark_mode_buttons:
68
+ button.dark_mode_enabled = theme == "dark"
69
+ button.update_mode_button()
59
70
  # now define stylesheet according to theme and apply it
60
71
  style = bec_qthemes.load_stylesheet(theme)
61
72
  app.setStyleSheet(style)
@@ -1,6 +1,6 @@
1
1
  from bec_qthemes import material_icon
2
2
  from qtpy.QtCore import Property, Qt, Slot
3
- from qtpy.QtWidgets import QHBoxLayout, QPushButton, QToolButton, QWidget
3
+ from qtpy.QtWidgets import QApplication, QHBoxLayout, QPushButton, QToolButton, QWidget
4
4
 
5
5
  from bec_widgets.utils.bec_widget import BECWidget
6
6
  from bec_widgets.utils.colors import set_theme
@@ -27,17 +27,31 @@ class DarkModeButton(BECWidget, QWidget):
27
27
  self.layout.setContentsMargins(0, 0, 0, 0)
28
28
  self.layout.setAlignment(Qt.AlignmentFlag.AlignVCenter)
29
29
 
30
- icon = material_icon("dark_mode", size=(20, 20), convert_to_pixmap=False)
31
30
  if toolbar:
32
- self.mode_button = QToolButton(icon=icon)
31
+ self.mode_button = QToolButton()
33
32
  else:
34
- self.mode_button = QPushButton(icon=icon)
33
+ self.mode_button = QPushButton()
34
+
35
+ self.dark_mode_enabled = self._get_qapp_dark_mode_state()
35
36
  self.update_mode_button()
36
37
  self.mode_button.clicked.connect(self.toggle_dark_mode)
37
38
  self.layout.addWidget(self.mode_button)
38
39
  self.setLayout(self.layout)
39
40
  self.setFixedSize(40, 40)
40
41
 
42
+ def _get_qapp_dark_mode_state(self) -> bool:
43
+ """
44
+ Get the dark mode state from the QApplication.
45
+
46
+ Returns:
47
+ bool: True if dark mode is enabled, False otherwise.
48
+ """
49
+ qapp = QApplication.instance()
50
+ if hasattr(qapp, "theme") and qapp.theme["theme"] == "dark":
51
+ return True
52
+
53
+ return False
54
+
41
55
  @Property(bool)
42
56
  def dark_mode_enabled(self) -> bool:
43
57
  """
@@ -72,8 +86,10 @@ class DarkModeButton(BECWidget, QWidget):
72
86
  if __name__ == "__main__":
73
87
  from qtpy.QtWidgets import QApplication
74
88
 
75
- app = QApplication([])
89
+ from bec_widgets.utils.colors import set_theme
76
90
 
91
+ app = QApplication([])
92
+ set_theme("auto")
77
93
  w = DarkModeButton()
78
94
  w.show()
79
95
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: bec_widgets
3
- Version: 0.99.12
3
+ Version: 0.99.13
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=6c9TNioj6VAiLpKefbh4exckHJCVVPUQqjFqFq0F9Q0,7069
5
+ CHANGELOG.md,sha256=INE_XxIw2paIS1rKnad9YIxTW6Ik-jAUMx7gWFYN2yo,6819
6
6
  LICENSE,sha256=YRKe85CBRyP7UpEAWwU8_qSIyuy5-l_9C-HKg5Qm8MQ,1511
7
- PKG-INFO,sha256=meqZoR4X-i0IEv8GXcSeCQBGzHpF6CdYR9oCul-5syA,1334
7
+ PKG-INFO,sha256=wJQzigYAwf7RY6soP0JaYqw7ytnmwdxdn95c_8r_EUg,1334
8
8
  README.md,sha256=Od69x-RS85Hph0-WwWACwal4yUd67XkEn4APEfHhHFw,2649
9
- pyproject.toml,sha256=8epLbMmPD9IdOXkD8j_T6lAGr8Lkf_QX-6Nz1gUKzX0,2544
9
+ pyproject.toml,sha256=2cFWlhLsnZBTnLgOqX1LktBeto948IZF_s-XGJgYFhQ,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=XB4s7zpzoqR_2dGOue-xKjRl8MLpZn7c2k1NJSbYC0Y,11921
56
+ bec_widgets/utils/colors.py,sha256=bdURzbrIv7UWXTlaj1wJYq2JmI_gw1pi6LVYqijbLKA,12325
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
@@ -110,7 +110,7 @@ bec_widgets/widgets/colormap_selector/colormap_selector_plugin.py,sha256=c5Kk4do
110
110
  bec_widgets/widgets/colormap_selector/register_colormap_selector.py,sha256=bfw7RWmTmMLTLxGT-izSwcGtxGLKvL3jdivJw2z8oN4,512
111
111
  bec_widgets/widgets/console/console.py,sha256=NG0cBuqqPX4hC-sHhk_UEkT-nHhhN9Y7karJITPLzyo,17864
112
112
  bec_widgets/widgets/dark_mode_button/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
113
- bec_widgets/widgets/dark_mode_button/dark_mode_button.py,sha256=SOixqA9ylbpAgH1ZQnhoA_lO1P4WlN36brcWldkyAuc,2509
113
+ bec_widgets/widgets/dark_mode_button/dark_mode_button.py,sha256=2mjLC6FiICy_xucxLlvwZPGinJoJYYDqdCbsAj1qtLs,2929
114
114
  bec_widgets/widgets/dark_mode_button/dark_mode_button.pyproject,sha256=Lbi9zb6HNlIq14k6hlzR-oz6PIFShBuF7QxE6d87d64,34
115
115
  bec_widgets/widgets/dark_mode_button/dark_mode_button_plugin.py,sha256=RJWeBEqR9BueUxUSuPcU-AmnzfIzt3j4jtsIacp-2Ug,1335
116
116
  bec_widgets/widgets/dark_mode_button/register_dark_mode_button.py,sha256=_4Fw6j1KLuluko8X2B7zf_DT5eA07G0CqR-aRMAn0iA,489
@@ -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.12.dist-info/METADATA,sha256=meqZoR4X-i0IEv8GXcSeCQBGzHpF6CdYR9oCul-5syA,1334
242
- bec_widgets-0.99.12.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
243
- bec_widgets-0.99.12.dist-info/entry_points.txt,sha256=3otEkCdDB9LZJuBLzG4pFLK5Di0CVybN_12IsZrQ-58,166
244
- bec_widgets-0.99.12.dist-info/licenses/LICENSE,sha256=YRKe85CBRyP7UpEAWwU8_qSIyuy5-l_9C-HKg5Qm8MQ,1511
245
- bec_widgets-0.99.12.dist-info/RECORD,,
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,,
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.12"
7
+ version = "0.99.13"
8
8
  description = "BEC Widgets"
9
9
  requires-python = ">=3.10"
10
10
  classifiers = [