0
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2025-07-14 03:31:50 +02:00

fix(positioner_box): visual improvements to the positioner_box and positioner_control_line

This commit is contained in:
2024-09-16 13:34:39 +02:00
parent 9045323049
commit 7ea4a482e7
4 changed files with 60 additions and 27 deletions

View File

@ -16,7 +16,7 @@ from qtpy.QtWidgets import QDialog, QDoubleSpinBox, QPushButton, QVBoxLayout, QW
from bec_widgets.utils import UILoader
from bec_widgets.utils.bec_widget import BECWidget
from bec_widgets.utils.colors import set_theme
from bec_widgets.utils.colors import get_accent_colors, set_theme
from bec_widgets.widgets.device_line_edit.device_line_edit import DeviceLineEdit
logger = bec_logger.logger
@ -73,6 +73,10 @@ class PositionerBox(BECWidget, QWidget):
self.ui.step_size.setStepType(QDoubleSpinBox.AdaptiveDecimalStepType)
self.ui.stop.clicked.connect(self.on_stop)
self.ui.stop.setToolTip("Stop")
self.ui.stop.setStyleSheet(
f"QPushButton {{background-color: {get_accent_colors().emergency.name()}; color: white;}}"
)
self.ui.tweak_right.clicked.connect(self.on_tweak_right)
self.ui.tweak_right.setToolTip("Tweak right")
self.ui.tweak_left.clicked.connect(self.on_tweak_left)

View File

@ -170,7 +170,20 @@
</layout>
</item>
<item>
<widget class="PositionIndicator" name="position_indicator"/>
<widget class="PositionIndicator" name="position_indicator">
<property name="maximum" stdset="0">
<double>1.000000000000000</double>
</property>
<property name="value" stdset="0">
<double>0.500000000000000</double>
</property>
<property name="indicator_width" stdset="0">
<number>4</number>
</property>
<property name="rounded_corners" stdset="0">
<number>4</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="readback">

View File

@ -24,11 +24,9 @@ class PositionerControlLine(PositionerBox):
if __name__ == "__main__": # pragma: no cover
import sys
import qdarktheme
from qtpy.QtWidgets import QApplication
app = QApplication(sys.argv)
qdarktheme.setup_theme("dark")
widget = PositionerControlLine(device="samy")
widget.show()

View File

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>785</width>
<width>612</width>
<height>91</height>
</rect>
</property>
@ -59,16 +59,6 @@
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="PositionIndicator" name="position_indicator">
<property name="minimumSize">
<size>
<width>80</width>
<height>10</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="SpinnerWidget" name="spinner_widget">
<property name="minimumSize">
@ -139,14 +129,14 @@
<widget class="QToolButton" name="tweak_left">
<property name="minimumSize">
<size>
<width>30</width>
<height>30</height>
<width>25</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>30</width>
<height>30</height>
<width>25</width>
<height>25</height>
</size>
</property>
<property name="text">
@ -154,8 +144,8 @@
</property>
<property name="iconSize">
<size>
<width>30</width>
<height>30</height>
<width>25</width>
<height>25</height>
</size>
</property>
<property name="arrowType">
@ -170,14 +160,14 @@
<widget class="QToolButton" name="tweak_right">
<property name="minimumSize">
<size>
<width>30</width>
<height>30</height>
<width>25</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>30</width>
<height>30</height>
<width>25</width>
<height>25</height>
</size>
</property>
<property name="text">
@ -185,8 +175,8 @@
</property>
<property name="iconSize">
<size>
<width>30</width>
<height>30</height>
<width>25</width>
<height>25</height>
</size>
</property>
<property name="arrowType">
@ -194,6 +184,34 @@
</property>
</widget>
</item>
<item>
<widget class="PositionIndicator" name="position_indicator">
<property name="minimumSize">
<size>
<width>15</width>
<height>10</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>15</width>
<height>16777215</height>
</size>
</property>
<property name="maximum" stdset="0">
<double>1.000000000000000</double>
</property>
<property name="vertical" stdset="0">
<bool>true</bool>
</property>
<property name="value" stdset="0">
<double>0.500000000000000</double>
</property>
<property name="rounded_corners" stdset="0">
<number>2</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>