1
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2026-04-24 01:00:45 +02:00

Compare commits

...

1 Commits

Author SHA1 Message Date
perl_d b1194da8b7 wip 2025-11-21 09:41:17 +01:00
25 changed files with 72 additions and 88 deletions
@@ -3,6 +3,7 @@ from __future__ import annotations
from bec_qthemes import material_icon
from qtpy import QtWidgets
from qtpy.QtCore import QEasingCurve, QParallelAnimationGroup, QPropertyAnimation, Qt, Signal
from qtpy.QtGui import QIcon
from qtpy.QtWidgets import (
QGraphicsOpacityEffect,
QHBoxLayout,
@@ -79,7 +80,7 @@ class SideBar(QScrollArea):
self.toggle = QToolButton(self)
self.toggle.setCheckable(False)
self.toggle.setIcon(material_icon("keyboard_arrow_right", convert_to_pixmap=False))
self.toggle.setIcon(material_icon("keyboard_arrow_right", icon_type=QIcon))
self.toggle.clicked.connect(self.on_expand)
self.toggle_row_layout.addWidget(self.title_label, 1, Qt.AlignLeft | Qt.AlignVCenter)
@@ -152,7 +153,7 @@ class SideBar(QScrollArea):
self.toggle.setIcon(
material_icon(
"keyboard_arrow_left" if self._is_expanded else "keyboard_arrow_right",
convert_to_pixmap=False,
icon_type=QIcon,
)
)
@@ -198,7 +199,7 @@ class SideBar(QScrollArea):
self.toggle.setIcon(
material_icon(
"keyboard_arrow_left" if self._is_expanded else "keyboard_arrow_right",
convert_to_pixmap=False,
icon_type=QIcon,
)
)
# Refresh each component that supports it
@@ -1,5 +1,7 @@
from __future__ import annotations
from qtpy.QtGui import QIcon
from bec_qthemes import material_icon
from qtpy import QtCore
from qtpy.QtCore import QEasingCurve, QPropertyAnimation, Qt
@@ -121,7 +123,7 @@ class NavigationItem(QWidget):
# Main Icon
self.icon_btn = QToolButton(self)
self.icon_btn.setIcon(material_icon(self._icon_name, filled=False, convert_to_pixmap=False))
self.icon_btn.setIcon(material_icon(self._icon_name, filled=False, icon_type=QIcon))
self.icon_btn.setAutoRaise(True)
self._icon_size_collapsed = QtCore.QSize(20, 20)
self._icon_size_expanded = QtCore.QSize(26, 26)
@@ -278,12 +280,10 @@ class NavigationItem(QWidget):
self._toggled = value
if value:
new_icon = material_icon(
self._icon_name, filled=True, color=get_on_primary(), convert_to_pixmap=False
self._icon_name, filled=True, color=get_on_primary(), icon_type=QIcon
)
else:
new_icon = material_icon(
self._icon_name, filled=False, color=get_fg(), convert_to_pixmap=False
)
new_icon = material_icon(self._icon_name, filled=False, color=get_fg(), icon_type=QIcon)
self.icon_btn.setIcon(new_icon)
# Re-polish so QSS applies correct colors to icon/labels
for w in (self, self.icon_btn, self.title_lbl, self.mini_lbl):
@@ -352,7 +352,7 @@ class DarkModeNavItem(NavigationItem):
self.mini_lbl.setText("Light" if is_dark else "Dark")
# Update icon
self.icon_btn.setIcon(
material_icon("light_mode" if is_dark else "dark_mode", convert_to_pixmap=False)
material_icon("light_mode" if is_dark else "dark_mode", icon_type=QIcon)
)
def refresh_theme(self):
@@ -8,6 +8,7 @@ from bec_lib.bec_yaml_loader import yaml_load
from bec_lib.logger import bec_logger
from bec_qthemes import material_icon
from qtpy import QtCore, QtWidgets
from qtpy.QtGui import QIcon
from bec_widgets.applications.views.device_manager_view.device_manager_view import DeviceManagerView
from bec_widgets.utils.bec_widget import BECWidget
@@ -46,13 +47,13 @@ class DeviceManagerWidget(BECWidget, QtWidgets.QWidget):
)
# Load current config
self.button_load_current_config = QtWidgets.QPushButton("Load Current Config")
icon = material_icon(icon_name="database", size=(24, 24), convert_to_pixmap=False)
icon = material_icon(icon_name="database", size=(24, 24), icon_type=QIcon)
self.button_load_current_config.setIcon(icon)
self._overlay_layout.addWidget(self.button_load_current_config)
self.button_load_current_config.clicked.connect(self._load_config_clicked)
# Load config from disk
self.button_load_config_from_file = QtWidgets.QPushButton("Load Config From File")
icon = material_icon(icon_name="folder", size=(24, 24), convert_to_pixmap=False)
icon = material_icon(icon_name="folder", size=(24, 24), icon_type=QIcon)
self.button_load_config_from_file.setIcon(icon)
self._overlay_layout.addWidget(self.button_load_config_from_file)
self.button_load_config_from_file.clicked.connect(self._load_config_from_file_clicked)
+2 -2
View File
@@ -8,7 +8,7 @@ from pathlib import Path
from bec_qthemes import material_icon
from qtpy import PYSIDE6
from qtpy.QtGui import QIcon
from qtpy.QtGui import QIcon, QPixmap
from bec_widgets.utils.bec_plugin_helper import user_widget_plugin
@@ -35,7 +35,7 @@ def designer_material_icon(icon_name: str) -> QIcon:
Returns:
QIcon: The QIcon for the material icon.
"""
return QIcon(material_icon(icon_name, filled=True, convert_to_pixmap=True))
return QIcon(material_icon(icon_name, filled=True, icon_type=QPixmap))
def list_editable_packages() -> set[str]:
+4 -8
View File
@@ -3,7 +3,7 @@ from types import SimpleNamespace
from bec_qthemes import material_icon
from qtpy.QtCore import Property, Qt, Signal
from qtpy.QtGui import QColor
from qtpy.QtGui import QColor, QIcon
from qtpy.QtWidgets import (
QDialog,
QHBoxLayout,
@@ -132,7 +132,7 @@ class CompactPopupWidget(QWidget):
self.compact_status = LedLabel(self.compact_view_widget)
self.compact_show_popup = QToolButton(self.compact_view_widget)
self.compact_show_popup.setIcon(
material_icon(icon_name="expand_content", size=(10, 10), convert_to_pixmap=False)
material_icon(icon_name="expand_content", size=(10, 10), icon_type=QIcon)
)
self.compact_view_widget.layout().addWidget(self.compact_label)
self.compact_view_widget.layout().addWidget(self.compact_status)
@@ -171,9 +171,7 @@ class CompactPopupWidget(QWidget):
self.compact_label.setVisible(False)
self.compact_status.setVisible(False)
self.compact_show_popup.setIcon(
material_icon(
icon_name="collapse_content", size=(10, 10), convert_to_pixmap=False
)
material_icon(icon_name="collapse_content", size=(10, 10), icon_type=QIcon)
)
self.expand.emit(True)
else:
@@ -181,9 +179,7 @@ class CompactPopupWidget(QWidget):
self.compact_label.setVisible(True)
self.compact_status.setVisible(True)
self.compact_show_popup.setIcon(
material_icon(
icon_name="expand_content", size=(10, 10), convert_to_pixmap=False
)
material_icon(icon_name="expand_content", size=(10, 10), icon_type=QIcon)
)
self.compact_view = True
self.expand.emit(False)
+4 -5
View File
@@ -2,6 +2,7 @@ from __future__ import annotations
from bec_qthemes import material_icon
from qtpy.QtCore import QSize, Signal
from qtpy.QtGui import QIcon
from qtpy.QtWidgets import (
QApplication,
QFrame,
@@ -95,11 +96,9 @@ class ExpandableGroupFrame(QFrame):
def _update_expansion_icon(self):
self._expansion_button.setIcon(
material_icon(icon_name=self.EXPANDED_ICON_NAME, size=(10, 10), convert_to_pixmap=False)
material_icon(icon_name=self.EXPANDED_ICON_NAME, size=(10, 10), icon_type=QIcon)
if self.expanded
else material_icon(
icon_name=self.COLLAPSED_ICON_NAME, size=(10, 10), convert_to_pixmap=False
)
else material_icon(icon_name=self.COLLAPSED_ICON_NAME, size=(10, 10), icon_type=QIcon)
)
@SafeProperty(str)
@@ -115,7 +114,7 @@ class ExpandableGroupFrame(QFrame):
if icon_name:
self._title_icon.setVisible(True)
self._title_icon.setPixmap(
material_icon(icon_name=icon_name, size=(20, 20), convert_to_pixmap=True)
material_icon(icon_name=icon_name, size=(20, 20), icon_type=QPixmap)
)
else:
self._title_icon.setVisible(False)
+2 -1
View File
@@ -7,6 +7,7 @@ from bec_lib.logger import bec_logger
from bec_qthemes import material_icon
from pydantic import BaseModel, ValidationError
from qtpy.QtCore import Signal # type: ignore
from qtpy.QtGui import QIcon
from qtpy.QtWidgets import QApplication, QGridLayout, QLabel, QSizePolicy, QVBoxLayout, QWidget
from bec_widgets.utils.bec_widget import BECWidget
@@ -207,7 +208,7 @@ class PydanticModelForm(TypedForm):
self._validity.compact_view = True # type: ignore
self._validity.label = "Validity" # type: ignore
self._validity.compact_show_popup.setIcon(
material_icon(icon_name="info", size=(10, 10), convert_to_pixmap=False)
material_icon(icon_name="info", size=(10, 10), icon_type=QIcon)
)
self._validity_message = QLabel("Not yet validated")
self._validity.addWidget(self._validity_message)
+2 -4
View File
@@ -26,7 +26,7 @@ from pydantic.fields import FieldInfo
from pydantic_core import PydanticUndefined
from qtpy import QtCore
from qtpy.QtCore import QSize, Qt, Signal # type: ignore
from qtpy.QtGui import QFontMetrics
from qtpy.QtGui import QFontMetrics, QIcon
from qtpy.QtWidgets import (
QApplication,
QButtonGroup,
@@ -203,9 +203,7 @@ class DynamicFormItem(QWidget):
def _add_clear_button(self):
self._clear_button = QToolButton()
self._clear_button.setIcon(
material_icon(icon_name="close", size=(10, 10), convert_to_pixmap=False)
)
self._clear_button.setIcon(material_icon(icon_name="close", size=(10, 10), icon_type=QIcon))
self._layout.addWidget(self._clear_button)
# the widget added in _add_main_widget must implement .clear() if value is not required
self._clear_button.setToolTip("Clear value or reset to default.")
+1 -5
View File
@@ -218,11 +218,7 @@ class MaterialIconAction(ToolBarAction):
self.text_position = text_position
# Generate the icon using the material_icon helper
self.icon = material_icon(
self.icon_name,
size=(20, 20),
convert_to_pixmap=False,
filled=self.filled,
color=self.color,
self.icon_name, size=(20, 20), icon_type=QIcon, filled=self.filled, color=self.color
)
if parent is None:
logger.warning(
@@ -2,6 +2,7 @@ from __future__ import annotations
from bec_qthemes import material_icon
from qtpy.QtCore import Qt
from qtpy.QtGui import QIcon
from qtpy.QtWidgets import QComboBox, QSizePolicy, QWidget
from bec_widgets import SafeSlot
@@ -28,7 +29,7 @@ class ProfileComboBox(QComboBox):
self.blockSignals(True)
self.clear()
lock_icon = material_icon("edit_off", size=(16, 16), convert_to_pixmap=False)
lock_icon = material_icon("edit_off", size=(16, 16), icon_type=QIcon)
for profile in list_profiles():
if is_profile_readonly(profile):
@@ -168,9 +169,7 @@ class WorkspaceConnection(BundleConnection):
"""
setattr(self.target_widget, "lock_workspace", value)
self.components.get_action("lock").action.setChecked(value)
icon = material_icon(
"lock" if value else "lock_open_right", size=(20, 20), convert_to_pixmap=False
)
icon = material_icon("lock" if value else "lock_open_right", size=(20, 20), icon_type=QIcon)
self.components.get_action("lock").action.setIcon(icon)
@SafeSlot()
@@ -2,7 +2,7 @@ from __future__ import annotations
from bec_qthemes import material_icon
from qtpy.QtCore import QMimeData, Qt, Signal
from qtpy.QtGui import QDrag
from qtpy.QtGui import QDrag, QIcon
from qtpy.QtWidgets import QHBoxLayout, QPushButton, QSizePolicy, QToolButton, QVBoxLayout, QWidget
from bec_widgets.utils.colors import get_theme_palette
@@ -100,7 +100,7 @@ class CollapsibleSection(QWidget):
"""Update the header button appearance based on expanded state"""
# Use material icons with consistent sizing to match tree items
icon_name = "keyboard_arrow_down" if self.expanded else "keyboard_arrow_right"
icon = material_icon(icon_name=icon_name, size=(20, 20), convert_to_pixmap=False)
icon = material_icon(icon_name=icon_name, size=(20, 20), icon_type=QIcon)
self.header_button.setIcon(icon)
self.header_button.setText(self.title)
@@ -119,7 +119,7 @@ class NotificationToast(QFrame):
color=SEVERITY[self._kind.value]["color"],
filled=True,
size=(24, 24),
convert_to_pixmap=False,
icon_type=QtGui.QIcon,
)
)
icon_btn.setIconSize(QtCore.QSize(24, 24))
@@ -901,7 +901,7 @@ class NotificationIndicator(QWidget):
color=SEVERITY[sev.value]["color"],
filled=True,
size=(20, 20),
convert_to_pixmap=False,
icon_type=QIcon,
)
b.setIcon(icon)
b.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
@@ -1,5 +1,6 @@
from bec_qthemes import material_icon
from qtpy.QtCore import Qt
from qtpy.QtGui import QIcon
from qtpy.QtWidgets import QHBoxLayout, QMessageBox, QPushButton, QToolButton, QWidget
from bec_widgets.utils.bec_widget import BECWidget
@@ -23,9 +24,7 @@ class ResetButton(BECWidget, QWidget):
self.layout.setAlignment(Qt.AlignmentFlag.AlignVCenter)
if toolbar:
icon = material_icon(
"restart_alt", color="#F19E39", filled=True, convert_to_pixmap=False
)
icon = material_icon("restart_alt", color="#F19E39", filled=True, icon_type=QIcon)
self.button = QToolButton(icon=icon)
self.button.setToolTip("Reset the scan queue")
else:
@@ -1,5 +1,6 @@
from bec_qthemes import material_icon
from qtpy.QtCore import Qt
from qtpy.QtGui import QIcon
from qtpy.QtWidgets import QHBoxLayout, QPushButton, QToolButton, QWidget
from bec_widgets.utils.bec_widget import BECWidget
@@ -24,7 +25,7 @@ class ResumeButton(BECWidget, QWidget):
self.layout.setAlignment(Qt.AlignmentFlag.AlignVCenter)
if toolbar:
icon = material_icon("resume", color="#2793e8", filled=True, convert_to_pixmap=False)
icon = material_icon("resume", color="#2793e8", filled=True, icon_type=QIcon)
self.button = QToolButton(icon=icon)
self.button.setToolTip("Resume the scan queue")
else:
@@ -1,5 +1,6 @@
from bec_qthemes import material_icon
from qtpy.QtCore import Qt
from qtpy.QtGui import QIcon
from qtpy.QtWidgets import QHBoxLayout, QPushButton, QSizePolicy, QToolButton, QWidget
from bec_widgets.utils.bec_widget import BECWidget
@@ -24,7 +25,7 @@ class StopButton(BECWidget, QWidget):
self.layout.setAlignment(Qt.AlignmentFlag.AlignVCenter)
if toolbar:
icon = material_icon("stop", color="#cc181e", filled=True, convert_to_pixmap=False)
icon = material_icon("stop", color="#cc181e", filled=True, icon_type=QIcon)
self.button = QToolButton(icon=icon)
self.button.setToolTip("Stop the scan queue")
else:
@@ -8,7 +8,7 @@ from bec_lib.device import Positioner
from bec_lib.logger import bec_logger
from bec_qthemes import material_icon
from qtpy.QtCore import Signal
from qtpy.QtGui import QDoubleValidator
from qtpy.QtGui import QDoubleValidator, QIcon
from qtpy.QtWidgets import QDoubleSpinBox
from bec_widgets.utils import UILoader
@@ -87,7 +87,7 @@ class PositionerBox(PositionerBoxBase):
self.ui.setpoint.setValidator(self.setpoint_validator)
self.ui.spinner_widget.start()
self.ui.tool_button.clicked.connect(self._open_dialog_selection(self.set_positioner))
icon = material_icon(icon_name="edit_note", size=(16, 16), convert_to_pixmap=False)
icon = material_icon(icon_name="edit_note", size=(16, 16), icon_type=QIcon)
self.ui.tool_button.setIcon(icon)
def force_update_readback(self):
@@ -9,7 +9,7 @@ from bec_lib.device import Positioner
from bec_lib.logger import bec_logger
from bec_qthemes import material_icon
from qtpy.QtCore import Signal
from qtpy.QtGui import QDoubleValidator
from qtpy.QtGui import QDoubleValidator, QIcon
from qtpy.QtWidgets import QDoubleSpinBox
from bec_widgets.utils import UILoader
@@ -121,7 +121,7 @@ class PositionerBox2D(PositionerBoxBase):
self.ui.tool_button_ver.clicked.connect(
self._open_dialog_selection(self.set_positioner_ver)
)
icon = material_icon(icon_name="edit_note", size=(16, 16), convert_to_pixmap=False)
icon = material_icon(icon_name="edit_note", size=(16, 16), icon_type=QIcon)
self.ui.tool_button_hor.setIcon(icon)
self.ui.tool_button_ver.setIcon(icon)
@@ -3,6 +3,7 @@ from typing import Literal, Sequence
from bec_lib.logger import bec_logger
from bec_qthemes import material_icon
from qtpy.QtCore import Property, Qt, Signal, Slot
from qtpy.QtGui import QIcon
from qtpy.QtWidgets import (
QCheckBox,
QComboBox,
@@ -197,12 +198,12 @@ class ScanGroupBox(QGroupBox):
# Add bundle button
self.button_add_bundle = QPushButton(self)
self.button_add_bundle.setIcon(
material_icon(icon_name="add", size=(15, 15), convert_to_pixmap=False)
material_icon(icon_name="add", size=(15, 15), icon_type=QIcon)
)
# Remove bundle button
self.button_remove_bundle = QPushButton(self)
self.button_remove_bundle.setIcon(
material_icon(icon_name="remove", size=(15, 15), convert_to_pixmap=False)
material_icon(icon_name="remove", size=(15, 15), icon_type=QIcon)
)
hbox_layout.addWidget(self.button_add_bundle)
hbox_layout.addWidget(self.button_remove_bundle)
+7 -7
View File
@@ -4,7 +4,7 @@ import time
from bec_qthemes import material_icon
from qtpy.QtCore import QSize, Qt, QTimer, Signal, Slot
from qtpy.QtGui import QBrush, QColor, QPainter, QPen
from qtpy.QtGui import QBrush, QColor, QPainter, QPen, QPixmap
from qtpy.QtWidgets import (
QApplication,
QComboBox,
@@ -87,7 +87,7 @@ class Pos(QWidget):
if self.is_revealed:
if self.is_mine:
p.drawPixmap(r, material_icon("experiment", convert_to_pixmap=True, filled=True))
p.drawPixmap(r, material_icon("experiment", icon_type=QPixmap, filled=True))
elif self.adjacent_n > 0:
pen = QPen(NUM_COLORS[self.adjacent_n])
@@ -103,7 +103,7 @@ class Pos(QWidget):
material_icon(
"flag",
size=(50, 50),
convert_to_pixmap=True,
icon_type=QPixmap,
filled=True,
color=self.palette().base().color(),
),
@@ -376,13 +376,13 @@ class Minesweeper(BECWidget, QWidget):
self.status = status
match status:
case GameStatus.READY:
icon = material_icon(icon_name="add", convert_to_pixmap=False)
icon = material_icon(icon_name="add", icon_type=QIcon)
case GameStatus.PLAYING:
icon = material_icon(icon_name="smart_toy", convert_to_pixmap=False)
icon = material_icon(icon_name="smart_toy", icon_type=QIcon)
case GameStatus.FAILED:
icon = material_icon(icon_name="error", convert_to_pixmap=False)
icon = material_icon(icon_name="error", icon_type=QIcon)
case GameStatus.SUCCESS:
icon = material_icon(icon_name="celebration", convert_to_pixmap=False)
icon = material_icon(icon_name="celebration", icon_type=QIcon)
self.reset_button.setIcon(icon)
def update_timer(self):
@@ -6,7 +6,7 @@ from typing import TYPE_CHECKING, Literal
from bec_lib import bec_logger
from bec_qthemes import material_icon
from qtpy.QtCore import QEvent, Qt
from qtpy.QtGui import QColor
from qtpy.QtGui import QColor, QIcon
from qtpy.QtWidgets import (
QColorDialog,
QHBoxLayout,
@@ -62,7 +62,7 @@ class ROILockButton(QToolButton):
movable = self._roi.movable
self.setChecked(not movable)
icon = "lock_open_right" if movable else "lock"
self.setIcon(material_icon(icon, size=(20, 20), convert_to_pixmap=False))
self.setIcon(material_icon(icon, size=(20, 20), icon_type=QIcon))
class ROIPropertyTree(BECWidget, QWidget):
@@ -209,11 +209,11 @@ class ROIPropertyTree(BECWidget, QWidget):
if on:
# switched to expanded state
self.tree.expandAll()
new_icon = material_icon("unfold_less", size=(20, 20), convert_to_pixmap=False)
new_icon = material_icon("unfold_less", size=(20, 20), icon_type=QIcon)
else:
# collapsed state
self.tree.collapseAll()
new_icon = material_icon("unfold_more", size=(20, 20), convert_to_pixmap=False)
new_icon = material_icon("unfold_more", size=(20, 20), icon_type=QIcon)
self.expand_toggle.action.setIcon(new_icon)
self.expand_toggle.action.toggled.connect(_exp_toggled)
@@ -231,7 +231,7 @@ class ROIPropertyTree(BECWidget, QWidget):
for r in self.controller.rois:
r.movable = not checked
new_icon = material_icon(
"lock" if checked else "lock_open_right", size=(20, 20), convert_to_pixmap=False
"lock" if checked else "lock_open_right", size=(20, 20), icon_type=QIcon
)
self.lock_all_action.action.setIcon(new_icon)
@@ -402,11 +402,7 @@ class ROIPropertyTree(BECWidget, QWidget):
# delete button
del_btn = QToolButton()
delete_icon = material_icon(
"delete",
size=(20, 20),
convert_to_pixmap=False,
filled=False,
color=self.DELETE_BUTTON_COLOR,
"delete", size=(20, 20), icon_type=QIcon, filled=False, color=self.DELETE_BUTTON_COLOR
)
del_btn.setIcon(delete_icon)
del_btn.clicked.connect(lambda _=None, r=roi: self._delete_roi(r))
@@ -5,7 +5,7 @@ from typing import TYPE_CHECKING
from bec_lib.logger import bec_logger
from bec_qthemes._icon.material_icons import material_icon
from qtpy.QtGui import QValidator
from qtpy.QtGui import QIcon, QValidator
class ScanIndexValidator(QValidator):
@@ -184,11 +184,7 @@ class CurveRow(QTreeWidgetItem):
# Delete button
self.delete_button = QToolButton()
delete_icon = material_icon(
"delete",
size=(20, 20),
convert_to_pixmap=False,
filled=False,
color=self.DELETE_BUTTON_COLOR,
"delete", size=(20, 20), icon_type=QIcon, filled=False, color=self.DELETE_BUTTON_COLOR
)
self.delete_button.setIcon(delete_icon)
self.delete_button.clicked.connect(lambda: self.remove_self())
@@ -200,7 +196,7 @@ class CurveRow(QTreeWidgetItem):
analysis_icon = material_icon(
"monitoring",
size=(20, 20),
convert_to_pixmap=False,
icon_type=QIcon,
filled=False,
color=self.app.theme.colors["FG"].toTuple(),
)
@@ -3,7 +3,7 @@ from __future__ import annotations
from bec_lib.endpoints import MessageEndpoints
from bec_qthemes import material_icon
from qtpy.QtCore import Property, Qt, Signal, Slot
from qtpy.QtGui import QColor
from qtpy.QtGui import QColor, QIcon
from qtpy.QtWidgets import QHeaderView, QLabel, QTableWidget, QTableWidgetItem, QVBoxLayout, QWidget
from bec_widgets.utils.bec_connector import ConnectionConfig
@@ -240,7 +240,7 @@ class BECQueue(BECWidget, CompactPopupWidget):
abort_button.button.setText("")
abort_button.button.setIcon(
material_icon("cancel", color="#cc181e", filled=True, convert_to_pixmap=False)
material_icon("cancel", color="#cc181e", filled=True, icon_type=QIcon)
)
abort_button.setStyleSheet(
"""
@@ -10,6 +10,7 @@ from bec_lib.messages import ConfigAction, ScanStatusMessage
from bec_qthemes import material_icon
from pyqtgraph import SignalProxy
from qtpy.QtCore import QThreadPool, Signal
from qtpy.QtGui import QIcon
from qtpy.QtWidgets import QFileDialog, QListWidget, QToolButton, QVBoxLayout, QWidget
from bec_widgets.cli.rpc.rpc_register import RPCRegister
@@ -97,7 +98,7 @@ class DeviceBrowser(BECWidget, QWidget):
def init_tool_buttons(self):
def _setup_button(button: QToolButton, icon: str, slot: Callable, tooltip: str = ""):
button.clicked.connect(slot)
button.setIcon(material_icon(icon, size=(20, 20), convert_to_pixmap=False))
button.setIcon(material_icon(icon, size=(20, 20), icon_type=QIcon))
button.setToolTip(tooltip)
_setup_button(self.ui.add_button, "add", self._create_add_dialog, "add new device")
@@ -1,6 +1,7 @@
from bec_lib.device import Device
from bec_qthemes import material_icon
from qtpy.QtCore import Qt
from qtpy.QtGui import QIcon
from qtpy.QtWidgets import QHBoxLayout, QLabel, QToolButton, QVBoxLayout, QWidget
from bec_widgets.utils.bec_connector import ConnectionConfig
@@ -47,9 +48,7 @@ class SignalDisplay(BECWidget, QWidget):
button_holder.layout().setAlignment(Qt.AlignmentFlag.AlignRight)
button_holder.layout().setContentsMargins(0, 0, 0, 0)
refresh_button = QToolButton()
refresh_button.setIcon(
material_icon(icon_name="refresh", size=(20, 20), convert_to_pixmap=False)
)
refresh_button.setIcon(material_icon(icon_name="refresh", size=(20, 20), icon_type=QIcon))
refresh_button.clicked.connect(self._refresh)
button_holder.layout().addWidget(refresh_button)
self._content_layout.addWidget(button_holder)
@@ -2,6 +2,7 @@ from __future__ import annotations
from bec_qthemes import material_icon
from qtpy.QtCore import Property, Qt, Slot
from qtpy.QtGui import QIcon
from qtpy.QtWidgets import QApplication, QHBoxLayout, QPushButton, QToolButton, QWidget
from bec_widgets.utils.bec_widget import BECWidget
@@ -89,9 +90,7 @@ class DarkModeButton(BECWidget, QWidget):
def update_mode_button(self):
icon = material_icon(
"light_mode" if self.dark_mode_enabled else "dark_mode",
size=(20, 20),
convert_to_pixmap=False,
"light_mode" if self.dark_mode_enabled else "dark_mode", size=(20, 20), icon_type=QIcon
)
self.mode_button.setIcon(icon)
self.mode_button.setToolTip("Set Light Mode" if self.dark_mode_enabled else "Set Dark Mode")