refactoring, bugfix theme move buttons
This commit is contained in:
@@ -58,7 +58,6 @@ from debye_bec.bec_widgets.widgets.digital_twin.calc_varia import (
|
||||
wall_geometries,
|
||||
pipe_geometries,
|
||||
)
|
||||
from debye_bec.bec_widgets.widgets.digital_twin.offset_settings import OffsetSettings
|
||||
from debye_bec.devices.absorber import STATUS as ABS_STATUS
|
||||
|
||||
logger = bec_logger.logger
|
||||
|
||||
@@ -292,11 +292,12 @@ class MoveWidget(QWidget):
|
||||
layout.addWidget(self.status_icon)
|
||||
|
||||
# Start / Stop button
|
||||
self.btn_action = QPushButton("▶ Move")
|
||||
self.btn_action = QPushButton("Move")
|
||||
self.btn_action.setFixedWidth(90)
|
||||
self.btn_action.setFixedHeight(20)
|
||||
self.btn_action.clicked.connect(self._on_button_clicked)
|
||||
layout.addWidget(self.btn_action)
|
||||
self.btn_mode = 'start'
|
||||
|
||||
self._apply_button_style("start")
|
||||
|
||||
@@ -316,6 +317,15 @@ class MoveWidget(QWidget):
|
||||
r, g, b = self.text_color['fb']
|
||||
self.fb_label.setStyleSheet(f'QLabel {{color: rgb({r}, {g}, {b})}}')
|
||||
|
||||
if self.btn_mode == 'start':
|
||||
self.btn_action.setStyleSheet(
|
||||
f"QPushButton {{background-color: {get_accent_colors().success.name()}; color: white;}}"
|
||||
)
|
||||
else:
|
||||
self.btn_action.setStyleSheet(
|
||||
f"QPushButton {{background-color: {get_accent_colors().emergency.name()}; color: white;}}"
|
||||
)
|
||||
|
||||
def set_target(self, target):
|
||||
self.target = target
|
||||
text = f'{target:.{int(self.decimals)}f}'
|
||||
@@ -334,6 +344,7 @@ class MoveWidget(QWidget):
|
||||
self._on_target_or_fb_changed()
|
||||
|
||||
def _apply_button_style(self, mode: str):
|
||||
self.btn_mode = mode
|
||||
if mode == "start":
|
||||
self.btn_action.setText("Move")
|
||||
self.btn_action.setStyleSheet(
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
import sys
|
||||
import numpy as np
|
||||
from bec_lib import bec_logger
|
||||
from bec_lib.endpoints import MessageEndpoints
|
||||
|
||||
# pylint: disable=E0611
|
||||
from qtpy.QtWidgets import (
|
||||
QWidget,
|
||||
QVBoxLayout,
|
||||
QHBoxLayout,
|
||||
QApplication,
|
||||
QLayout,
|
||||
QLabel,
|
||||
QPushButton,
|
||||
QDialog,
|
||||
)
|
||||
# pylint: disable=E0611
|
||||
from qtpy.QtCore import (
|
||||
Qt,
|
||||
QTimer,
|
||||
)
|
||||
from qtpy.QtGui import (
|
||||
QColor,
|
||||
QBrush,
|
||||
QCloseEvent,
|
||||
)
|
||||
|
||||
from bec_widgets.utils.bec_widget import BECWidget
|
||||
from bec_widgets.utils.error_popups import SafeSlot
|
||||
|
||||
from debye_bec.bec_widgets.widgets.qt_widgets import (
|
||||
InputNumberField,
|
||||
ComboBox,
|
||||
Group,
|
||||
NumberIndicator,
|
||||
Button,
|
||||
)
|
||||
|
||||
logger = bec_logger.logger
|
||||
|
||||
class OffsetSettings(QDialog):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
self.setWindowTitle("Axes Offset Settings")
|
||||
self.setMinimumSize(300, 150)
|
||||
|
||||
layout = QVBoxLayout()
|
||||
|
||||
label = QLabel("👋 Hello from the secondary window!")
|
||||
label.setAlignment(Qt.AlignCenter)
|
||||
|
||||
close_btn = QPushButton("Close")
|
||||
close_btn.clicked.connect(self.close)
|
||||
|
||||
layout.addWidget(label)
|
||||
layout.addWidget(close_btn)
|
||||
self.setLayout(layout)
|
||||
Reference in New Issue
Block a user