bec-widgets 0.107.0__py3-none-any.whl → 0.109.0__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 +22 -20
- PKG-INFO +1 -1
- bec_widgets/cli/client.py +52 -0
- bec_widgets/cli/generate_cli.py +20 -3
- bec_widgets/cli/server.py +7 -2
- bec_widgets/utils/bec_widget.py +1 -1
- bec_widgets/utils/colors.py +21 -6
- bec_widgets/widgets/bec_progressbar/__init__.py +0 -0
- bec_widgets/widgets/bec_progressbar/bec_progress_bar.pyproject +1 -0
- bec_widgets/widgets/bec_progressbar/bec_progress_bar_plugin.py +54 -0
- bec_widgets/widgets/bec_progressbar/bec_progressbar.py +258 -0
- bec_widgets/widgets/bec_progressbar/register_bec_progress_bar.py +15 -0
- bec_widgets/widgets/dark_mode_button/dark_mode_button.py +1 -1
- bec_widgets/widgets/figure/plots/plot_base.py +1 -1
- bec_widgets/widgets/figure/plots/waveform/waveform.py +2 -1
- {bec_widgets-0.107.0.dist-info → bec_widgets-0.109.0.dist-info}/METADATA +1 -1
- {bec_widgets-0.107.0.dist-info → bec_widgets-0.109.0.dist-info}/RECORD +21 -16
- pyproject.toml +1 -1
- {bec_widgets-0.107.0.dist-info → bec_widgets-0.109.0.dist-info}/WHEEL +0 -0
- {bec_widgets-0.107.0.dist-info → bec_widgets-0.109.0.dist-info}/entry_points.txt +0 -0
- {bec_widgets-0.107.0.dist-info → bec_widgets-0.109.0.dist-info}/licenses/LICENSE +0 -0
CHANGELOG.md
CHANGED
@@ -1,5 +1,27 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## v0.109.0 (2024-09-06)
|
4
|
+
|
5
|
+
### Feature
|
6
|
+
|
7
|
+
* feat(accent colors): added helper function to get all accent colors ([`84a59f7`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/84a59f70eed6d8a3c3aeeabc77a5f9ea4e864f61))
|
8
|
+
|
9
|
+
### Fix
|
10
|
+
|
11
|
+
* fix(theme): fixed theme access for themecontainer ([`de303f0`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/de303f0227fc9d3a74a0410f1e7999ac5132273c))
|
12
|
+
|
13
|
+
## v0.108.0 (2024-09-06)
|
14
|
+
|
15
|
+
### Documentation
|
16
|
+
|
17
|
+
* docs(progressbar): added docs ([`7d07cea`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/7d07cea946f9c884477b01bebfb60b332ff09e0a))
|
18
|
+
|
19
|
+
### Feature
|
20
|
+
|
21
|
+
* feat(progressbar): added bec progressbar ([`f6d1d0b`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/f6d1d0bbe3ba30a3b7291cd36a1f7f8e6bd5b895))
|
22
|
+
|
23
|
+
* feat(generate_cli): added support for property and qproperty setter ([`a52182d`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/a52182dca978833bfc3fad755c596d3a2ef45c42))
|
24
|
+
|
3
25
|
## v0.107.0 (2024-09-06)
|
4
26
|
|
5
27
|
### Documentation
|
@@ -141,23 +163,3 @@
|
|
141
163
|
* fix(pyqt slot): removed slot decorator to avoid problems with pyqt6 ([`6c1f89a`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/6c1f89ad39b7240ab1d1c1123422b99ae195bf01))
|
142
164
|
|
143
165
|
## v0.99.15 (2024-08-31)
|
144
|
-
|
145
|
-
### Fix
|
146
|
-
|
147
|
-
* fix(theme): update pg axes on theme update ([`af23e74`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/af23e74f71152f4abc319ab7b45e65deefde3519))
|
148
|
-
|
149
|
-
* fix(positioner_box): fixed positioner box dialog; added test; closes #332 ([`0bf1cf9`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/0bf1cf9b8ab2f9171d5ff63d4e3672eb93e9a5fa))
|
150
|
-
|
151
|
-
## v0.99.14 (2024-08-30)
|
152
|
-
|
153
|
-
### Fix
|
154
|
-
|
155
|
-
* 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))
|
156
|
-
|
157
|
-
* fix(color_button): inheritance changed to QWidget ([`3c0e501`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/3c0e501c56227d4d98ff0ac2186ff5065bff8d7a))
|
158
|
-
|
159
|
-
## v0.99.13 (2024-08-30)
|
160
|
-
|
161
|
-
### Fix
|
162
|
-
|
163
|
-
* fix(dark mode button): fixed dark mode button state for external updates, including auto ([`a3110d9`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/a3110d98147295dcb1f9353f9aaf5461cba9232a))
|
PKG-INFO
CHANGED
bec_widgets/cli/client.py
CHANGED
@@ -19,6 +19,7 @@ class Widgets(str, enum.Enum):
|
|
19
19
|
BECFigure = "BECFigure"
|
20
20
|
BECImageWidget = "BECImageWidget"
|
21
21
|
BECMotorMapWidget = "BECMotorMapWidget"
|
22
|
+
BECProgressBar = "BECProgressBar"
|
22
23
|
BECQueue = "BECQueue"
|
23
24
|
BECStatusBox = "BECStatusBox"
|
24
25
|
BECWaveformWidget = "BECWaveformWidget"
|
@@ -1693,6 +1694,57 @@ class BECPlotBase(RPCBase):
|
|
1693
1694
|
"""
|
1694
1695
|
|
1695
1696
|
|
1697
|
+
class BECProgressBar(RPCBase):
|
1698
|
+
@rpc_call
|
1699
|
+
def set_value(self, value):
|
1700
|
+
"""
|
1701
|
+
Set the value of the progress bar.
|
1702
|
+
|
1703
|
+
Args:
|
1704
|
+
value (float): The value to set.
|
1705
|
+
"""
|
1706
|
+
|
1707
|
+
@rpc_call
|
1708
|
+
def set_maximum(self, maximum: float):
|
1709
|
+
"""
|
1710
|
+
Set the maximum value of the progress bar.
|
1711
|
+
|
1712
|
+
Args:
|
1713
|
+
maximum (float): The maximum value.
|
1714
|
+
"""
|
1715
|
+
|
1716
|
+
@rpc_call
|
1717
|
+
def set_minimum(self, minimum: float):
|
1718
|
+
"""
|
1719
|
+
Set the minimum value of the progress bar.
|
1720
|
+
|
1721
|
+
Args:
|
1722
|
+
minimum (float): The minimum value.
|
1723
|
+
"""
|
1724
|
+
|
1725
|
+
@property
|
1726
|
+
@rpc_call
|
1727
|
+
def label_template(self):
|
1728
|
+
"""
|
1729
|
+
The template for the center label. Use $value, $maximum, and $percentage to insert the values.
|
1730
|
+
|
1731
|
+
Examples:
|
1732
|
+
>>> progressbar.label_template = "$value / $maximum - $percentage %"
|
1733
|
+
>>> progressbar.label_template = "$value / $percentage %"
|
1734
|
+
"""
|
1735
|
+
|
1736
|
+
@label_template.setter
|
1737
|
+
@rpc_call
|
1738
|
+
def label_template(self):
|
1739
|
+
"""
|
1740
|
+
The template for the center label. Use $value, $maximum, and $percentage to insert the values.
|
1741
|
+
|
1742
|
+
Examples:
|
1743
|
+
>>> progressbar.label_template = "$value / $maximum - $percentage %"
|
1744
|
+
>>> progressbar.label_template = "$value / $percentage %"
|
1745
|
+
"""
|
1746
|
+
|
1747
|
+
|
1696
1748
|
class BECQueue(RPCBase):
|
1697
1749
|
@property
|
1698
1750
|
@rpc_call
|
bec_widgets/cli/generate_cli.py
CHANGED
@@ -8,6 +8,7 @@ import sys
|
|
8
8
|
|
9
9
|
import black
|
10
10
|
import isort
|
11
|
+
from qtpy.QtCore import Property as QtProperty
|
11
12
|
|
12
13
|
from bec_widgets.utils.generate_designer_plugin import DesignerPluginGenerator
|
13
14
|
from bec_widgets.utils.plugin_utils import BECClassContainer, get_rpc_classes
|
@@ -90,11 +91,27 @@ class {class_name}(RPCBase):"""
|
|
90
91
|
self.content += """...
|
91
92
|
"""
|
92
93
|
for method in cls.USER_ACCESS:
|
93
|
-
|
94
|
-
|
95
|
-
|
94
|
+
is_property_setter = False
|
95
|
+
obj = getattr(cls, method, None)
|
96
|
+
if obj is None:
|
97
|
+
obj = getattr(cls, method.split(".setter")[0], None)
|
98
|
+
is_property_setter = True
|
99
|
+
method = method.split(".setter")[0]
|
100
|
+
if obj is None:
|
101
|
+
raise AttributeError(
|
102
|
+
f"Method {method} not found in class {cls.__name__}. Please check the USER_ACCESS list."
|
103
|
+
)
|
104
|
+
if isinstance(obj, (property, QtProperty)):
|
105
|
+
# for the cli, we can map qt properties to regular properties
|
106
|
+
if is_property_setter:
|
107
|
+
self.content += f"""
|
108
|
+
@{method}.setter
|
109
|
+
@rpc_call"""
|
110
|
+
else:
|
111
|
+
self.content += """
|
96
112
|
@property
|
97
113
|
@rpc_call"""
|
114
|
+
|
98
115
|
sig = str(inspect.signature(obj.fget))
|
99
116
|
doc = inspect.getdoc(obj.fget)
|
100
117
|
else:
|
bec_widgets/cli/server.py
CHANGED
@@ -86,10 +86,15 @@ class BECWidgetsCLIServer:
|
|
86
86
|
return obj
|
87
87
|
|
88
88
|
def run_rpc(self, obj, method, args, kwargs):
|
89
|
+
logger.debug(f"Running RPC instruction: {method} with args: {args}, kwargs: {kwargs}")
|
89
90
|
method_obj = getattr(obj, method)
|
90
91
|
# check if the method accepts args and kwargs
|
91
92
|
if not callable(method_obj):
|
92
|
-
|
93
|
+
if not args:
|
94
|
+
res = method_obj
|
95
|
+
else:
|
96
|
+
setattr(obj, method, args[0])
|
97
|
+
res = None
|
93
98
|
else:
|
94
99
|
sig = inspect.signature(method_obj)
|
95
100
|
if sig.parameters:
|
@@ -245,5 +250,5 @@ def main():
|
|
245
250
|
|
246
251
|
|
247
252
|
if __name__ == "__main__": # pragma: no cover
|
248
|
-
sys.argv = ["bec_widgets.cli.server", "--id", "
|
253
|
+
sys.argv = ["bec_widgets.cli.server", "--id", "e2860", "--gui_class", "BECDockArea"]
|
249
254
|
main()
|
bec_widgets/utils/bec_widget.py
CHANGED
bec_widgets/utils/colors.py
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
1
3
|
import itertools
|
2
4
|
import re
|
3
|
-
from typing import Literal
|
5
|
+
from typing import TYPE_CHECKING, Literal
|
4
6
|
|
5
7
|
import bec_qthemes
|
6
8
|
import numpy as np
|
@@ -8,25 +10,38 @@ import pyqtgraph as pg
|
|
8
10
|
from bec_qthemes._os_appearance.listener import OSThemeSwitchListener
|
9
11
|
from pydantic_core import PydanticCustomError
|
10
12
|
from qtpy.QtGui import QColor
|
11
|
-
from qtpy.QtWidgets import QApplication
|
13
|
+
from qtpy.QtWidgets import QApplication
|
14
|
+
|
15
|
+
if TYPE_CHECKING:
|
16
|
+
from bec_qthemes._main import AccentColors
|
12
17
|
|
13
18
|
|
14
19
|
def get_theme_palette():
|
15
20
|
if QApplication.instance() is None or not hasattr(QApplication.instance(), "theme"):
|
16
21
|
theme = "dark"
|
17
22
|
else:
|
18
|
-
theme = QApplication.instance().theme
|
23
|
+
theme = QApplication.instance().theme.theme
|
19
24
|
return bec_qthemes.load_palette(theme)
|
20
25
|
|
21
26
|
|
27
|
+
def get_accent_colors() -> AccentColors | None:
|
28
|
+
"""
|
29
|
+
Get the accent colors for the current theme. These colors are extensions of the color palette
|
30
|
+
and are used to highlight specific elements in the UI.
|
31
|
+
"""
|
32
|
+
if QApplication.instance() is None or not hasattr(QApplication.instance(), "theme"):
|
33
|
+
return None
|
34
|
+
return QApplication.instance().theme.accent_colors
|
35
|
+
|
36
|
+
|
22
37
|
def _theme_update_callback():
|
23
38
|
"""
|
24
39
|
Internal callback function to update the theme based on the system theme.
|
25
40
|
"""
|
26
41
|
app = QApplication.instance()
|
27
42
|
# pylint: disable=protected-access
|
28
|
-
app.theme
|
29
|
-
app.theme_signal.theme_updated.emit(app.theme
|
43
|
+
app.theme.theme = app.os_listener._theme.lower()
|
44
|
+
app.theme_signal.theme_updated.emit(app.theme.theme)
|
30
45
|
apply_theme(app.os_listener._theme.lower())
|
31
46
|
|
32
47
|
|
@@ -124,7 +139,7 @@ class Colors:
|
|
124
139
|
color_index = int(color_selection[ii])
|
125
140
|
color = cmap_colors[color_index]
|
126
141
|
app = QApplication.instance()
|
127
|
-
if hasattr(app, "theme") and app.theme
|
142
|
+
if hasattr(app, "theme") and app.theme.theme == "light":
|
128
143
|
background = 255
|
129
144
|
else:
|
130
145
|
background = 0
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
{'files': ['bec_progressbar.py']}
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# Copyright (C) 2022 The Qt Company Ltd.
|
2
|
+
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
3
|
+
|
4
|
+
from qtpy.QtDesigner import QDesignerCustomWidgetInterface
|
5
|
+
|
6
|
+
from bec_widgets.utils.bec_designer import designer_material_icon
|
7
|
+
from bec_widgets.widgets.bec_progressbar.bec_progressbar import BECProgressBar
|
8
|
+
|
9
|
+
DOM_XML = """
|
10
|
+
<ui language='c++'>
|
11
|
+
<widget class='BECProgressBar' name='bec_progress_bar'>
|
12
|
+
</widget>
|
13
|
+
</ui>
|
14
|
+
"""
|
15
|
+
|
16
|
+
|
17
|
+
class BECProgressBarPlugin(QDesignerCustomWidgetInterface): # pragma: no cover
|
18
|
+
def __init__(self):
|
19
|
+
super().__init__()
|
20
|
+
self._form_editor = None
|
21
|
+
|
22
|
+
def createWidget(self, parent):
|
23
|
+
t = BECProgressBar(parent)
|
24
|
+
return t
|
25
|
+
|
26
|
+
def domXml(self):
|
27
|
+
return DOM_XML
|
28
|
+
|
29
|
+
def group(self):
|
30
|
+
return "BEC Utils"
|
31
|
+
|
32
|
+
def icon(self):
|
33
|
+
return designer_material_icon(BECProgressBar.ICON_NAME)
|
34
|
+
|
35
|
+
def includeFile(self):
|
36
|
+
return "bec_progress_bar"
|
37
|
+
|
38
|
+
def initialize(self, form_editor):
|
39
|
+
self._form_editor = form_editor
|
40
|
+
|
41
|
+
def isContainer(self):
|
42
|
+
return False
|
43
|
+
|
44
|
+
def isInitialized(self):
|
45
|
+
return self._form_editor is not None
|
46
|
+
|
47
|
+
def name(self):
|
48
|
+
return "BECProgressBar"
|
49
|
+
|
50
|
+
def toolTip(self):
|
51
|
+
return "A custom progress bar with smooth transitions and a modern design."
|
52
|
+
|
53
|
+
def whatsThis(self):
|
54
|
+
return self.toolTip()
|
@@ -0,0 +1,258 @@
|
|
1
|
+
import sys
|
2
|
+
from string import Template
|
3
|
+
|
4
|
+
from qtpy.QtCore import Property, QEasingCurve, QPropertyAnimation, QRectF, Qt, QTimer, Slot
|
5
|
+
from qtpy.QtGui import QColor, QPainter, QPainterPath
|
6
|
+
from qtpy.QtWidgets import QApplication, QLabel, QVBoxLayout, QWidget
|
7
|
+
|
8
|
+
from bec_widgets.utils.bec_widget import BECWidget
|
9
|
+
from bec_widgets.utils.colors import get_accent_colors
|
10
|
+
|
11
|
+
|
12
|
+
class BECProgressBar(BECWidget, QWidget):
|
13
|
+
"""
|
14
|
+
A custom progress bar with smooth transitions. The displayed text can be customized using a template.
|
15
|
+
"""
|
16
|
+
|
17
|
+
USER_ACCESS = [
|
18
|
+
"set_value",
|
19
|
+
"set_maximum",
|
20
|
+
"set_minimum",
|
21
|
+
"label_template",
|
22
|
+
"label_template.setter",
|
23
|
+
]
|
24
|
+
ICON_NAME = "page_control"
|
25
|
+
|
26
|
+
def __init__(self, parent=None, client=None, config=None, gui_id=None):
|
27
|
+
super().__init__(client=client, config=config, gui_id=gui_id)
|
28
|
+
QWidget.__init__(self, parent=parent)
|
29
|
+
|
30
|
+
accent_colors = get_accent_colors()
|
31
|
+
|
32
|
+
# internal values
|
33
|
+
self._oversampling_factor = 50
|
34
|
+
self._value = 0
|
35
|
+
self._target_value = 0
|
36
|
+
self._maximum = 100 * self._oversampling_factor
|
37
|
+
|
38
|
+
# User values
|
39
|
+
self._user_value = 0
|
40
|
+
self._user_minimum = 0
|
41
|
+
self._user_maximum = 100
|
42
|
+
self._label_template = "$value / $maximum - $percentage %"
|
43
|
+
|
44
|
+
# Color settings
|
45
|
+
self._background_color = QColor(30, 30, 30)
|
46
|
+
self._progress_color = accent_colors.highlight # QColor(210, 55, 130)
|
47
|
+
|
48
|
+
self._completed_color = accent_colors.success
|
49
|
+
self._border_color = QColor(50, 50, 50)
|
50
|
+
|
51
|
+
# layout settings
|
52
|
+
self._value_animation = QPropertyAnimation(self, b"_progressbar_value")
|
53
|
+
self._value_animation.setDuration(200)
|
54
|
+
self._value_animation.setEasingCurve(QEasingCurve.Type.OutCubic)
|
55
|
+
|
56
|
+
# label on top of the progress bar
|
57
|
+
self.center_label = QLabel(self)
|
58
|
+
self.center_label.setAlignment(Qt.AlignCenter)
|
59
|
+
self.center_label.setStyleSheet("color: white;")
|
60
|
+
self.center_label.setMinimumSize(0, 0)
|
61
|
+
|
62
|
+
layout = QVBoxLayout(self)
|
63
|
+
layout.setContentsMargins(0, 0, 0, 0)
|
64
|
+
layout.setSpacing(0)
|
65
|
+
layout.addWidget(self.center_label)
|
66
|
+
self.setLayout(layout)
|
67
|
+
|
68
|
+
self.update()
|
69
|
+
|
70
|
+
@Property(str, doc="The template for the center label. Use $value, $maximum, and $percentage.")
|
71
|
+
def label_template(self):
|
72
|
+
"""
|
73
|
+
The template for the center label. Use $value, $maximum, and $percentage to insert the values.
|
74
|
+
|
75
|
+
Examples:
|
76
|
+
>>> progressbar.label_template = "$value / $maximum - $percentage %"
|
77
|
+
>>> progressbar.label_template = "$value / $percentage %"
|
78
|
+
|
79
|
+
"""
|
80
|
+
return self._label_template
|
81
|
+
|
82
|
+
@label_template.setter
|
83
|
+
def label_template(self, template):
|
84
|
+
self._label_template = template
|
85
|
+
self.set_value(self._user_value)
|
86
|
+
self.update()
|
87
|
+
|
88
|
+
@Property(float, designable=False)
|
89
|
+
def _progressbar_value(self):
|
90
|
+
"""
|
91
|
+
The current value of the progress bar.
|
92
|
+
"""
|
93
|
+
return self._value
|
94
|
+
|
95
|
+
@_progressbar_value.setter
|
96
|
+
def _progressbar_value(self, val):
|
97
|
+
self._value = val
|
98
|
+
self.update()
|
99
|
+
|
100
|
+
def _update_template(self):
|
101
|
+
template = Template(self._label_template)
|
102
|
+
return template.safe_substitute(
|
103
|
+
value=self._user_value,
|
104
|
+
maximum=self._user_maximum,
|
105
|
+
percentage=int((self.map_value(self._user_value) / self._maximum) * 100),
|
106
|
+
)
|
107
|
+
|
108
|
+
@Slot(float)
|
109
|
+
@Slot(int)
|
110
|
+
def set_value(self, value):
|
111
|
+
"""
|
112
|
+
Set the value of the progress bar.
|
113
|
+
|
114
|
+
Args:
|
115
|
+
value (float): The value to set.
|
116
|
+
"""
|
117
|
+
if value > self._user_maximum:
|
118
|
+
value = self._user_maximum
|
119
|
+
elif value < self._user_minimum:
|
120
|
+
value = self._user_minimum
|
121
|
+
self._target_value = self.map_value(value)
|
122
|
+
self._user_value = value
|
123
|
+
self.center_label.setText(self._update_template())
|
124
|
+
self.animate_progress()
|
125
|
+
|
126
|
+
def paintEvent(self, event):
|
127
|
+
painter = QPainter(self)
|
128
|
+
painter.setRenderHint(QPainter.Antialiasing)
|
129
|
+
rect = self.rect().adjusted(10, 0, -10, -1)
|
130
|
+
|
131
|
+
# Draw background
|
132
|
+
painter.setBrush(self._background_color)
|
133
|
+
painter.setPen(Qt.NoPen)
|
134
|
+
painter.drawRoundedRect(rect, 10, 10) # Rounded corners
|
135
|
+
|
136
|
+
# Draw border
|
137
|
+
painter.setBrush(Qt.NoBrush)
|
138
|
+
painter.setPen(self._border_color)
|
139
|
+
painter.drawRoundedRect(rect, 10, 10)
|
140
|
+
|
141
|
+
# Determine progress color based on completion
|
142
|
+
if self._value >= self._maximum:
|
143
|
+
current_color = self._completed_color
|
144
|
+
else:
|
145
|
+
current_color = self._progress_color
|
146
|
+
|
147
|
+
# Set clipping region to preserve the background's rounded corners
|
148
|
+
progress_rect = rect.adjusted(
|
149
|
+
0, 0, int(-rect.width() + (self._value / self._maximum) * rect.width()), 0
|
150
|
+
)
|
151
|
+
clip_path = QPainterPath()
|
152
|
+
clip_path.addRoundedRect(QRectF(rect), 10, 10) # Clip to the background's rounded corners
|
153
|
+
painter.setClipPath(clip_path)
|
154
|
+
|
155
|
+
# Draw progress bar
|
156
|
+
painter.setBrush(current_color)
|
157
|
+
painter.drawRect(progress_rect) # Less rounded, no additional rounding
|
158
|
+
|
159
|
+
painter.end()
|
160
|
+
|
161
|
+
def animate_progress(self):
|
162
|
+
"""
|
163
|
+
Animate the progress bar from the current value to the target value.
|
164
|
+
"""
|
165
|
+
self._value_animation.stop()
|
166
|
+
self._value_animation.setStartValue(self._value)
|
167
|
+
self._value_animation.setEndValue(self._target_value)
|
168
|
+
self._value_animation.start()
|
169
|
+
|
170
|
+
@Property(float)
|
171
|
+
def maximum(self):
|
172
|
+
"""
|
173
|
+
The maximum value of the progress bar.
|
174
|
+
"""
|
175
|
+
return self._user_maximum
|
176
|
+
|
177
|
+
@maximum.setter
|
178
|
+
def maximum(self, maximum: float):
|
179
|
+
"""
|
180
|
+
Set the maximum value of the progress bar.
|
181
|
+
"""
|
182
|
+
self.set_maximum(maximum)
|
183
|
+
|
184
|
+
@Property(float)
|
185
|
+
def minimum(self):
|
186
|
+
"""
|
187
|
+
The minimum value of the progress bar.
|
188
|
+
"""
|
189
|
+
return self._user_minimum
|
190
|
+
|
191
|
+
@minimum.setter
|
192
|
+
def minimum(self, minimum: float):
|
193
|
+
self.set_minimum(minimum)
|
194
|
+
|
195
|
+
@Property(float)
|
196
|
+
def initial_value(self):
|
197
|
+
"""
|
198
|
+
The initial value of the progress bar.
|
199
|
+
"""
|
200
|
+
return self._user_value
|
201
|
+
|
202
|
+
@initial_value.setter
|
203
|
+
def initial_value(self, value: float):
|
204
|
+
self.set_value(value)
|
205
|
+
|
206
|
+
@Slot(float)
|
207
|
+
def set_maximum(self, maximum: float):
|
208
|
+
"""
|
209
|
+
Set the maximum value of the progress bar.
|
210
|
+
|
211
|
+
Args:
|
212
|
+
maximum (float): The maximum value.
|
213
|
+
"""
|
214
|
+
self._user_maximum = maximum
|
215
|
+
self.set_value(self._user_value) # Update the value to fit the new range
|
216
|
+
self.update()
|
217
|
+
|
218
|
+
@Slot(float)
|
219
|
+
def set_minimum(self, minimum: float):
|
220
|
+
"""
|
221
|
+
Set the minimum value of the progress bar.
|
222
|
+
|
223
|
+
Args:
|
224
|
+
minimum (float): The minimum value.
|
225
|
+
"""
|
226
|
+
self._user_minimum = minimum
|
227
|
+
self.set_value(self._user_value) # Update the value to fit the new range
|
228
|
+
self.update()
|
229
|
+
|
230
|
+
def map_value(self, value: float):
|
231
|
+
"""
|
232
|
+
Map the user value to the range [0, 100*self._oversampling_factor] for the progress
|
233
|
+
"""
|
234
|
+
return (
|
235
|
+
(value - self._user_minimum) / (self._user_maximum - self._user_minimum) * self._maximum
|
236
|
+
)
|
237
|
+
|
238
|
+
|
239
|
+
if __name__ == "__main__": # pragma: no cover
|
240
|
+
app = QApplication(sys.argv)
|
241
|
+
|
242
|
+
progressBar = BECProgressBar()
|
243
|
+
progressBar.show()
|
244
|
+
progressBar.set_minimum(-100)
|
245
|
+
progressBar.set_maximum(0)
|
246
|
+
|
247
|
+
# Example of setting values
|
248
|
+
def update_progress():
|
249
|
+
value = progressBar._user_value + 2.5
|
250
|
+
if value > progressBar._user_maximum:
|
251
|
+
value = -100 # progressBar._maximum / progressBar._upsampling_factor
|
252
|
+
progressBar.set_value(value)
|
253
|
+
|
254
|
+
timer = QTimer()
|
255
|
+
timer.timeout.connect(update_progress)
|
256
|
+
timer.start(200) # Update every half second
|
257
|
+
|
258
|
+
sys.exit(app.exec())
|
@@ -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.bec_progressbar.bec_progress_bar_plugin import BECProgressBarPlugin
|
10
|
+
|
11
|
+
QPyDesignerCustomWidgetCollection.addCustomWidget(BECProgressBarPlugin())
|
12
|
+
|
13
|
+
|
14
|
+
if __name__ == "__main__": # pragma: no cover
|
15
|
+
main()
|
@@ -60,7 +60,7 @@ class DarkModeButton(BECWidget, QWidget):
|
|
60
60
|
bool: True if dark mode is enabled, False otherwise.
|
61
61
|
"""
|
62
62
|
qapp = QApplication.instance()
|
63
|
-
if hasattr(qapp, "theme") and qapp.theme
|
63
|
+
if hasattr(qapp, "theme") and qapp.theme.theme == "dark":
|
64
64
|
return True
|
65
65
|
|
66
66
|
return False
|
@@ -119,7 +119,7 @@ class BECPlotBase(BECConnector, pg.GraphicsLayout):
|
|
119
119
|
if theme is None:
|
120
120
|
qapp = QApplication.instance()
|
121
121
|
if hasattr(qapp, "theme"):
|
122
|
-
theme = qapp.theme
|
122
|
+
theme = qapp.theme.theme
|
123
123
|
else:
|
124
124
|
theme = "dark"
|
125
125
|
self.apply_theme(theme)
|
@@ -16,6 +16,7 @@ from qtpy.QtWidgets import QApplication, QWidget
|
|
16
16
|
|
17
17
|
from bec_widgets.qt_utils.error_popups import SafeSlot as Slot
|
18
18
|
from bec_widgets.utils import Colors, EntryValidator
|
19
|
+
from bec_widgets.utils.colors import get_accent_colors
|
19
20
|
from bec_widgets.utils.linear_region_selector import LinearRegionWrapper
|
20
21
|
from bec_widgets.widgets.figure.plots.plot_base import BECPlotBase, SubplotConfig
|
21
22
|
from bec_widgets.widgets.figure.plots.waveform.waveform_curve import (
|
@@ -108,7 +109,7 @@ class BECWaveform(BECPlotBase):
|
|
108
109
|
self.scan_item = None
|
109
110
|
self._roi_region = None
|
110
111
|
self.roi_select = None
|
111
|
-
self._accent_colors =
|
112
|
+
self._accent_colors = get_accent_colors()
|
112
113
|
self._x_axis_mode = {
|
113
114
|
"name": None,
|
114
115
|
"entry": None,
|
@@ -2,11 +2,11 @@
|
|
2
2
|
.gitlab-ci.yml,sha256=Dc1iDjsc72UxdUtihx4uSZU0lrTQeR8hZwGx1MQBfKE,8432
|
3
3
|
.pylintrc,sha256=eeY8YwSI74oFfq6IYIbCqnx3Vk8ZncKaatv96n_Y8Rs,18544
|
4
4
|
.readthedocs.yaml,sha256=aSOc277LqXcsTI6lgvm_JY80lMlr69GbPKgivua2cS0,603
|
5
|
-
CHANGELOG.md,sha256=
|
5
|
+
CHANGELOG.md,sha256=bgDc0rOOjtX6B9h8AhdM62BYiL3g22MWq3A5H-O3QMM,7258
|
6
6
|
LICENSE,sha256=YRKe85CBRyP7UpEAWwU8_qSIyuy5-l_9C-HKg5Qm8MQ,1511
|
7
|
-
PKG-INFO,sha256=
|
7
|
+
PKG-INFO,sha256=1CGyi--Q2TVQN36On9aWRM3ZgGhJTV-2DTyeuyRwIdw,1334
|
8
8
|
README.md,sha256=Od69x-RS85Hph0-WwWACwal4yUd67XkEn4APEfHhHFw,2649
|
9
|
-
pyproject.toml,sha256=
|
9
|
+
pyproject.toml,sha256=IM5KF7HZkkzb-e_nVkRg72j5C4OvcTooeYqd1mB8ddM,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
|
@@ -22,12 +22,12 @@ bec_widgets/assets/status_icons/running.svg,sha256=nlc6rKh_f-uOxQSk0BkBNyWnPAJU5
|
|
22
22
|
bec_widgets/assets/status_icons/warning.svg,sha256=CNx88p9kbDG51s9ztKf-cfYan4JdDBbk3-IFKfOOFlI,364
|
23
23
|
bec_widgets/cli/__init__.py,sha256=d0Q6Fn44e7wFfLabDOBxpcJ1DPKWlFunGYDUBmO-4hA,22
|
24
24
|
bec_widgets/cli/auto_updates.py,sha256=DwzRChcFIWPH2kCYvp8H7dXvyYSKGYv6LwCmK2sDR2E,5676
|
25
|
-
bec_widgets/cli/client.py,sha256=
|
25
|
+
bec_widgets/cli/client.py,sha256=aG1m5xXbIsn0Cq7isrUgyA_l4yLFgbKsmmiXye6yPp8,81550
|
26
26
|
bec_widgets/cli/client_utils.py,sha256=EdDfo3uuYAWtZiDGGu3_GPnl94FSLkNG2N_4I9FNfMc,11809
|
27
|
-
bec_widgets/cli/generate_cli.py,sha256=
|
27
|
+
bec_widgets/cli/generate_cli.py,sha256=zRhhcErjHqnNymoxu9oqeUZUfwLX84De1RIeGiZGUyY,6602
|
28
28
|
bec_widgets/cli/rpc_register.py,sha256=QxXUZu5XNg00Yf5O3UHWOXg3-f_pzKjjoZYMOa-MOJc,2216
|
29
29
|
bec_widgets/cli/rpc_wigdet_handler.py,sha256=6kQng2DyS6rhLJqSJ7xa0kdgSxp-35A2upcf833dJRE,1483
|
30
|
-
bec_widgets/cli/server.py,sha256=
|
30
|
+
bec_widgets/cli/server.py,sha256=KfZ0W2OKb1UeqkR0buXrdVF4MpznzyLw9EQtGzEBkvI,8833
|
31
31
|
bec_widgets/examples/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
32
32
|
bec_widgets/examples/general_app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
33
33
|
bec_widgets/examples/general_app/general_app.py,sha256=PoFCTuA_1yqrpgthASpYFgH7JDUZTcXAPZ5h0e3XZfc,3053
|
@@ -52,8 +52,8 @@ bec_widgets/utils/bec_connector.py,sha256=I9M_4g-_-WaMmhyXzChFCGXAElelx0mG6E1g0K
|
|
52
52
|
bec_widgets/utils/bec_designer.py,sha256=Z3MeMju-KmTz8POtm23VQfp4rvtD2sF6eIOKQkl2F7w,4729
|
53
53
|
bec_widgets/utils/bec_dispatcher.py,sha256=OFmkx9vOz4pA4Sdc14QreyDZ870QYskJ4B5daVVeYg4,6325
|
54
54
|
bec_widgets/utils/bec_table.py,sha256=nA2b8ukSeUfquFMAxGrUVOqdrzMoDYD6O_4EYbOG2zk,717
|
55
|
-
bec_widgets/utils/bec_widget.py,sha256=
|
56
|
-
bec_widgets/utils/colors.py,sha256=
|
55
|
+
bec_widgets/utils/bec_widget.py,sha256=1lrHNuvW6uOuPpr-cJBYJNbFekTsqpnQdfTo3P5tbWI,3330
|
56
|
+
bec_widgets/utils/colors.py,sha256=aUQkDMTRjTjS9lQfgO5NrUllU2r4ygDTTSUROtTBX90,12838
|
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
|
@@ -73,6 +73,11 @@ bec_widgets/utils/plugin_templates/register.template,sha256=XyL3OZPT_FTArLAM8tHd
|
|
73
73
|
bec_widgets/widgets/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
74
74
|
bec_widgets/widgets/base_classes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
75
75
|
bec_widgets/widgets/base_classes/device_input_base.py,sha256=thCOHOa9Z0b3-vlNFWK6PT_DdPTANnfj0_DLES_K-eE,3902
|
76
|
+
bec_widgets/widgets/bec_progressbar/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
77
|
+
bec_widgets/widgets/bec_progressbar/bec_progress_bar.pyproject,sha256=Pb3n9seM95_8myKJ0pv_9IcfJDNJJNOFBskuRdEVzhU,33
|
78
|
+
bec_widgets/widgets/bec_progressbar/bec_progress_bar_plugin.py,sha256=b0b0F37HrwFAtizF4VC9udOe1eKbpDkrUE1pM7fI_f0,1352
|
79
|
+
bec_widgets/widgets/bec_progressbar/bec_progressbar.py,sha256=kkmpe5o9RPOCIKKPp0jjfQORLT8XKW_e-ETEl5Zmltk,7980
|
80
|
+
bec_widgets/widgets/bec_progressbar/register_bec_progress_bar.py,sha256=ZcGLPYEwkrbSOpxQeuZJRRVV3yXvcFh133hnlKIQGKw,488
|
76
81
|
bec_widgets/widgets/bec_queue/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
77
82
|
bec_widgets/widgets/bec_queue/bec_queue.py,sha256=8gayhWyIB3_gdpeongGTDQxHs37Waf3H5TDjySCctho,7998
|
78
83
|
bec_widgets/widgets/bec_queue/bec_queue.pyproject,sha256=VhoNmAv1DQUl9dg7dELyf5i4pZ5k65N3GnqOYiSwbQo,27
|
@@ -116,7 +121,7 @@ bec_widgets/widgets/dap_combo_box/dap_combo_box.pyproject,sha256=3TzD8j0F6UYw8TP
|
|
116
121
|
bec_widgets/widgets/dap_combo_box/dap_combo_box_plugin.py,sha256=WVR8k10SESRFm-hQUrcUfgycuNu7HIcZqV--24nw-TU,1270
|
117
122
|
bec_widgets/widgets/dap_combo_box/register_dap_combo_box.py,sha256=RGFzFmldBwQjpKB7wbIxJU20uprjXtqCVnUkt0Zc7aA,477
|
118
123
|
bec_widgets/widgets/dark_mode_button/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
119
|
-
bec_widgets/widgets/dark_mode_button/dark_mode_button.py,sha256=
|
124
|
+
bec_widgets/widgets/dark_mode_button/dark_mode_button.py,sha256=Yd084huvWfN4z1JxI35HjMBZ_AeYXseb-_Wq4-xRsnE,3256
|
120
125
|
bec_widgets/widgets/dark_mode_button/dark_mode_button.pyproject,sha256=Lbi9zb6HNlIq14k6hlzR-oz6PIFShBuF7QxE6d87d64,34
|
121
126
|
bec_widgets/widgets/dark_mode_button/dark_mode_button_plugin.py,sha256=RJWeBEqR9BueUxUSuPcU-AmnzfIzt3j4jtsIacp-2Ug,1335
|
122
127
|
bec_widgets/widgets/dark_mode_button/register_dark_mode_button.py,sha256=_4Fw6j1KLuluko8X2B7zf_DT5eA07G0CqR-aRMAn0iA,489
|
@@ -149,7 +154,7 @@ bec_widgets/widgets/figure/figure.py,sha256=IzQaV_9utjViJyjMydOa3-EJ9k-FVG2PTVm8
|
|
149
154
|
bec_widgets/widgets/figure/plots/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
150
155
|
bec_widgets/widgets/figure/plots/axis_settings.py,sha256=grgrX4t4eAzccW4jj4HYtMSxy8Wgcd9N9J1aU7UHtIs,3723
|
151
156
|
bec_widgets/widgets/figure/plots/axis_settings.ui,sha256=ye-guaRU_jhu7sHZS-9AjBjLrCtA1msOD0dszu4o9x8,11785
|
152
|
-
bec_widgets/widgets/figure/plots/plot_base.py,sha256=
|
157
|
+
bec_widgets/widgets/figure/plots/plot_base.py,sha256=ByzXVZ8pjIN9947iI7OLNksjpwO2_I58uezQSgWCZVQ,15676
|
153
158
|
bec_widgets/widgets/figure/plots/image/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
154
159
|
bec_widgets/widgets/figure/plots/image/image.py,sha256=rq2zy-vwZLd3___rFRNEBnPFGKSu88T5T4ngrTkcbr0,25014
|
155
160
|
bec_widgets/widgets/figure/plots/image/image_item.py,sha256=DhlBbI-c8nVbJ8tREQhyNr8Qk4W6PXF0HgBhrIoYQPo,11012
|
@@ -157,7 +162,7 @@ bec_widgets/widgets/figure/plots/image/image_processor.py,sha256=GeTtWjbldy6VejM
|
|
157
162
|
bec_widgets/widgets/figure/plots/motor_map/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
158
163
|
bec_widgets/widgets/figure/plots/motor_map/motor_map.py,sha256=AiDq4bmcEoj9PlkRQtHCk-5cwvOFGPBcfxPNNr8E53Y,18399
|
159
164
|
bec_widgets/widgets/figure/plots/waveform/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
160
|
-
bec_widgets/widgets/figure/plots/waveform/waveform.py,sha256=
|
165
|
+
bec_widgets/widgets/figure/plots/waveform/waveform.py,sha256=y18zurrvyw0VSy1DMc0h323qlQFocoV1KKjFOs2SigM,56301
|
161
166
|
bec_widgets/widgets/figure/plots/waveform/waveform_curve.py,sha256=RUo4GfXwlaCei8BBvWBQF3IEB8h-KgpvaHur6JUvT6s,8682
|
162
167
|
bec_widgets/widgets/image/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
163
168
|
bec_widgets/widgets/image/bec_image_widget.pyproject,sha256=PHisdBo5_5UCApd27GkizzqgfdjsDx2bFZa_p9LiSW8,30
|
@@ -250,8 +255,8 @@ bec_widgets/widgets/website/register_website_widget.py,sha256=LIQJpV9uqcBiPR9cEA
|
|
250
255
|
bec_widgets/widgets/website/website.py,sha256=42pncCc_zI2eqeMArIurVmPUukRo5bTxa2h1Skah-io,3012
|
251
256
|
bec_widgets/widgets/website/website_widget.pyproject,sha256=scOiV3cV1_BjbzpPzy2N8rIJL5P2qIZz8ObTJ-Uvdtg,25
|
252
257
|
bec_widgets/widgets/website/website_widget_plugin.py,sha256=pz38_C2cZ0yvPPS02wdIPcmhFo_yiwUhflsASocAPQQ,1341
|
253
|
-
bec_widgets-0.
|
254
|
-
bec_widgets-0.
|
255
|
-
bec_widgets-0.
|
256
|
-
bec_widgets-0.
|
257
|
-
bec_widgets-0.
|
258
|
+
bec_widgets-0.109.0.dist-info/METADATA,sha256=1CGyi--Q2TVQN36On9aWRM3ZgGhJTV-2DTyeuyRwIdw,1334
|
259
|
+
bec_widgets-0.109.0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
260
|
+
bec_widgets-0.109.0.dist-info/entry_points.txt,sha256=3otEkCdDB9LZJuBLzG4pFLK5Di0CVybN_12IsZrQ-58,166
|
261
|
+
bec_widgets-0.109.0.dist-info/licenses/LICENSE,sha256=YRKe85CBRyP7UpEAWwU8_qSIyuy5-l_9C-HKg5Qm8MQ,1511
|
262
|
+
bec_widgets-0.109.0.dist-info/RECORD,,
|
pyproject.toml
CHANGED
File without changes
|
File without changes
|
File without changes
|