mirror of
https://github.com/bec-project/bec_widgets.git
synced 2025-07-14 03:31:50 +02:00
fix(waveform): fixed icon appearance
This commit is contained in:
@ -182,20 +182,13 @@ class ModularToolBar(QToolBar):
|
||||
parent (QWidget, optional): The parent widget of the toolbar. Defaults to None.
|
||||
actions (list[ToolBarAction], optional): A list of action creators to populate the toolbar. Defaults to None.
|
||||
target_widget (QWidget, optional): The widget that the actions will target. Defaults to None.
|
||||
color (str, optional): The background color of the toolbar. Defaults to "black".
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
parent=None,
|
||||
actions: dict | None = None,
|
||||
target_widget=None,
|
||||
color: str = "rgba(255, 255, 255, 0)",
|
||||
):
|
||||
def __init__(self, parent=None, actions: dict | None = None, target_widget=None):
|
||||
super().__init__(parent)
|
||||
|
||||
self.widgets = defaultdict(dict)
|
||||
self.set_background_color(color)
|
||||
self.set_background_color()
|
||||
|
||||
if actions is not None and target_widget is not None:
|
||||
self.populate_toolbar(actions, target_widget)
|
||||
@ -212,8 +205,7 @@ class ModularToolBar(QToolBar):
|
||||
action.add_to_toolbar(self, target_widget)
|
||||
self.widgets[action_id] = action
|
||||
|
||||
def set_background_color(self, color: str):
|
||||
self.setStyleSheet(f"QToolBar {{ background: {color}; }}")
|
||||
def set_background_color(self):
|
||||
self.setIconSize(QSize(20, 20))
|
||||
self.setMovable(False)
|
||||
self.setFloatable(False)
|
||||
|
@ -88,24 +88,26 @@ class BECWaveformWidget(BECWidget, QWidget):
|
||||
self.fig = BECFigure()
|
||||
self.toolbar = ModularToolBar(
|
||||
actions={
|
||||
"save": IconAction(icon_path="save.svg", tooltip="Open Export Dialog"),
|
||||
"matplotlib": IconAction(
|
||||
icon_path="photo_library.svg", tooltip="Open Matplotlib Plot"
|
||||
"save": MaterialIconAction(icon_name="save", tooltip="Open Export Dialog"),
|
||||
"matplotlib": MaterialIconAction(
|
||||
icon_name="photo_library", tooltip="Open Matplotlib Plot"
|
||||
),
|
||||
"separator_1": SeparatorAction(),
|
||||
"drag_mode": IconAction(
|
||||
icon_path="drag_pan_mode.svg", tooltip="Drag Mouse Mode", checkable=True
|
||||
"drag_mode": MaterialIconAction(
|
||||
icon_name="drag_pan", tooltip="Drag Mouse Mode", checkable=True
|
||||
),
|
||||
"rectangle_mode": IconAction(
|
||||
icon_path="rectangle_mode.svg", tooltip="Rectangle Zoom Mode", checkable=True
|
||||
"rectangle_mode": MaterialIconAction(
|
||||
icon_name="frame_inspect", tooltip="Rectangle Zoom Mode", checkable=True
|
||||
),
|
||||
"auto_range": MaterialIconAction(
|
||||
icon_name="open_in_full", tooltip="Autorange Plot"
|
||||
),
|
||||
"auto_range": IconAction(icon_path="auto_range.svg", tooltip="Autorange Plot"),
|
||||
"separator_2": SeparatorAction(),
|
||||
"curves": IconAction(
|
||||
icon_path="line_axis.svg", tooltip="Open Curves Configuration"
|
||||
"curves": MaterialIconAction(
|
||||
icon_name="stacked_line_chart", tooltip="Open Curves Configuration"
|
||||
),
|
||||
"fit_params": IconAction(
|
||||
icon_path="fitting_parameters.svg", tooltip="Open Fitting Parameters"
|
||||
"fit_params": MaterialIconAction(
|
||||
icon_name="monitoring", tooltip="Open Fitting Parameters"
|
||||
),
|
||||
"axis_settings": MaterialIconAction(
|
||||
icon_name="settings", tooltip="Open Configuration Dialog"
|
||||
@ -595,9 +597,13 @@ class BECWaveformWidget(BECWidget, QWidget):
|
||||
|
||||
def main(): # pragma: no cover
|
||||
|
||||
import bec_qthemes
|
||||
from bec_qthemes._os_appearance.listener import OSThemeSwitchListener
|
||||
from qtpy.QtWidgets import QApplication
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
bec_qthemes.setup_theme("auto")
|
||||
|
||||
widget = BECWaveformWidget()
|
||||
widget.show()
|
||||
sys.exit(app.exec_())
|
||||
|
Reference in New Issue
Block a user