Skip to content

Commit

Permalink
opt: ani and style of radio buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
ChinaIceF committed Nov 25, 2024
1 parent 235e017 commit 6394996
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -328,10 +328,15 @@ def __init__(self, *args, **kwargs):
self.refactor_radio_button4.setText("不是哥们我真的要困死了让我睡觉吧")
self.refactor_radio_button4.adjustSize()

self.refactor_radio_button5 = SiRadioButtonRefactor(self)
self.refactor_radio_button5.setText("nihao")
self.refactor_radio_button5.adjustSize()

radio_button_container.addWidget(self.refactor_radio_button)
radio_button_container.addWidget(self.refactor_radio_button2)
radio_button_container.addWidget(self.refactor_radio_button3)
radio_button_container.addWidget(self.refactor_radio_button4)
radio_button_container.addWidget(self.refactor_radio_button5)
radio_button_container.adjustSize()

self.refactor_radiobuttons.body().addWidget(radio_button_container)
Expand Down
2 changes: 1 addition & 1 deletion examples/Gallery for siui/start.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import siui
from siui.core import SiGlobal

#siui.gui.set_scale_factor(1)
# siui.gui.set_scale_factor(1)


def show_version_message(window):
Expand Down
12 changes: 6 additions & 6 deletions siui/components/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -799,10 +799,10 @@ def _drawTextRect(self, painter: QPainter, rect: QRect) -> None:
class SwitchStyleData(QObject):
STYLE_TYPES = ["Switch"]

background_color_starting: QColor = QColor("#52389a")
background_color_ending: QColor = QColor("#9c4e8b")
background_color_starting: QColor = QColor("#519868")
background_color_ending: QColor = QColor("#519868")
frame_color: QColor = QColor("#D2D2D2")
thumb_color_checked: QColor = QColor("#100912")
thumb_color_checked: QColor = QColor("#09120c")
thumb_color_unchecked: QColor = QColor("#D2D2D2")


Expand Down Expand Up @@ -957,15 +957,15 @@ class RadioButtonStyleData(QObject):

indicator_border_radius: float = 9.5
indicator_allocated_width: int = 60
indicator_hover_additional_width: int = 4
indicator_hover_additional_width: int = 2
indicator_height: int = 19

avatar_width: int = 36
avatar_height: int = 36
avatar_border_radius: int = 18

highlight_idle_color: QColor = QColor("#00baadc7")
highlight_flash_color: QColor = QColor("#70baadc7")
highlight_flash_color: QColor = QColor("#90baadc7")
highlight_hover_color: QColor = QColor("#40baadc7")

unchecked_indicator_color: QColor = QColor("#25222A")
Expand Down Expand Up @@ -1056,7 +1056,7 @@ def _drawIndicatorPath(self, rect: QRect) -> QPainterPath:
alloc_width = self.style_data.indicator_allocated_width
radius = self.style_data.indicator_border_radius
width = (self._indicatorWidthInterpolation(self._indi_width_prog) +
self._indi_hover_width * (1 - self._indi_width_prog * 0.6))
self._indi_hover_width * ((self._indi_width_prog + 1) / 2))
path = QPainterPath()
path.addRoundedRect(QRectF(alloc_width - width, rect.y(), width, rect.height()), radius, radius)
return path
Expand Down
2 changes: 1 addition & 1 deletion siui/core/painter.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def createPainter(
"""
painter = QPainter(paintDevice)
if renderHint is not None:
painter.setRenderHint(renderHint)
painter.setRenderHints(renderHint)

if penStyle is not None:
painter.setPen(penStyle)
Expand Down

0 comments on commit 6394996

Please sign in to comment.