Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Buttons #173

Merged
merged 20 commits into from
Nov 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
594d5f6
refactor: icon / text / icon and text are supported in push button
ChinaIceF Oct 29, 2024
bac4215
refactor: `SiProgressPushButton`
ChinaIceF Oct 30, 2024
86154a1
feat: new `init` method for easier initialization for SiExpAnimation
ChinaIceF Oct 30, 2024
9775e9c
feat: color animation in SiProgressPushButton
ChinaIceF Oct 30, 2024
5367495
refactor: `SiLongPressButtonRefactor`
ChinaIceF Oct 30, 2024
f880dd0
refactor: `SiLongPressButtonRefactor`
ChinaIceF Oct 30, 2024
63dcb4a
refactor: `SiToggleButtonRefactor`
ChinaIceF Oct 31, 2024
e77248a
flatten new button.py for further discussion on proj structure
ChinaIceF Oct 31, 2024
cc78ba8
refactor: new SiExpAnimation Inherits QAbstractAnimation
ChinaIceF Nov 2, 2024
1ea040d
refactor: new SiExpAnimation Inherits QAbstractAnimation
ChinaIceF Nov 3, 2024
dff1e85
refactor: use new SiExpAnimationRefactor as a test
ChinaIceF Nov 3, 2024
d4676d6
fix: ghost window caused by tooltip
ChinaIceF Nov 3, 2024
e8b700d
feat: new `toPixmap` in parser.py
ChinaIceF Nov 3, 2024
1d8b6ab
refactor: adopt new `SiExpAnimationRefactor` in button.py
ChinaIceF Nov 3, 2024
9a05bbe
refactor: use Property class for better reference
ChinaIceF Nov 4, 2024
6148b5d
refactor: new `reloadStyleData` method for style reloading when style…
ChinaIceF Nov 5, 2024
8483db5
refactor: impl `GlobalStyleManager` to distribute style data
ChinaIceF Nov 6, 2024
94533bf
feat: impl button scaling ani
ChinaIceF Nov 16, 2024
d31aaa0
chore: opt coding style
ChinaIceF Nov 16, 2024
9eb9639
refactor: SiSwitch
ChinaIceF Nov 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 55 additions & 8 deletions examples/Gallery for siui/components/page_widgets/page_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import numpy
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QCursor
from PyQt5.QtGui import QCursor, QIcon

from siui.components import (
SiCircularProgressBar,
Expand All @@ -14,7 +14,13 @@
SiTitledWidgetGroup,
SiWidget,
)
from siui.components.button import SiPushButtonRefactor
from siui.components.button import (
SiFlatButton,
SiLongPressButtonRefactor,
SiProgressPushButton,
SiPushButtonRefactor,
SiToggleButtonRefactor, SiSwitchRefactor,
)
from siui.components.combobox import SiComboBox
from siui.components.menu import SiMenu
from siui.components.page import SiPage
Expand Down Expand Up @@ -250,6 +256,52 @@ def __init__(self, *args, **kwargs):
with self.titled_widgets_group as group:
group.addTitle("按钮")

# 按钮
self.refactor_buttons = OptionCardPlaneForWidgetDemos(self)
self.refactor_buttons.setSourceCodeURL("https://github.com/ChinaIceF/PyQt-SiliconUI/blob/main/siui/components"
"/widgets/button.py")
self.refactor_buttons.setTitle("重构的按钮")

self.refactor_pushbutton = SiPushButtonRefactor(self)
self.refactor_pushbutton.setText("Confirm")
self.refactor_pushbutton.setSvgIcon(SiGlobal.siui.iconpack.get("ic_fluent_mail_checkmark_filled"))
self.refactor_pushbutton.adjustSize()

self.refactor_progress_button = SiProgressPushButton(self)
self.refactor_progress_button.setText("Downloading")
self.refactor_progress_button.setSvgIcon(SiGlobal.siui.iconpack.get("ic_fluent_arrow_download_filled"))
self.refactor_progress_button.setToolTip("Click me to set a random progress value.")
self.refactor_progress_button.clicked.connect(lambda: self.refactor_progress_button.setProgress(random.random() * 1.3))
self.refactor_progress_button.adjustSize()

self.refactor_long_press_button = SiLongPressButtonRefactor(self)
self.refactor_long_press_button.setText("Delete Files")
self.refactor_long_press_button.setToolTip("Hold me to confirm.<br><strong>Your files will be lost forever!</strong>")
self.refactor_long_press_button.setSvgIcon(SiGlobal.siui.iconpack.get("ic_fluent_delete_filled"))
self.refactor_long_press_button.longPressed.connect(lambda: self.refactor_long_press_button.setToolTip("Deleted!"))
self.refactor_long_press_button.adjustSize()

self.refactor_flat_button = SiFlatButton(self)
self.refactor_flat_button.setText("Flat Button")
self.refactor_flat_button.setSvgIcon(SiGlobal.siui.iconpack.get("ic_fluent_wrench_settings_filled"))
self.refactor_flat_button.adjustSize()

self.refactor_toggle_button = SiToggleButtonRefactor(self)
self.refactor_toggle_button.setText("Auto Save")
self.refactor_toggle_button.setSvgIcon(SiGlobal.siui.iconpack.get("ic_fluent_save_filled"))
self.refactor_toggle_button.adjustSize()

self.refactor_switch = SiSwitchRefactor(self)

self.refactor_buttons.body().addWidget(self.refactor_pushbutton)
self.refactor_buttons.body().addWidget(self.refactor_progress_button)
self.refactor_buttons.body().addWidget(self.refactor_long_press_button)
self.refactor_buttons.body().addWidget(self.refactor_flat_button)
self.refactor_buttons.body().addWidget(self.refactor_toggle_button)
self.refactor_buttons.body().addWidget(self.refactor_switch)
self.refactor_buttons.body().addPlaceholder(12)
self.refactor_buttons.adjustSize()

# 按钮
self.push_buttons = OptionCardPlaneForWidgetDemos(self)
self.push_buttons.setSourceCodeURL("https://github.com/ChinaIceF/PyQt-SiliconUI/blob/main/siui/components"
Expand All @@ -259,11 +311,6 @@ def __init__(self, *args, **kwargs):
container_push_buttons = SiDenseHContainer(self)
container_push_buttons.setFixedHeight(32)

self.debug_new_button = SiPushButtonRefactor(self)
self.debug_new_button.resize(128, 32)
self.debug_new_button.setText("新按钮")
self.debug_new_button.setToolTip("我是工具提示")

self.demo_push_button_normal = SiPushButton(self)
self.demo_push_button_normal.resize(128, 32)
self.demo_push_button_normal.attachment().setText("普通按钮")
Expand All @@ -277,7 +324,6 @@ def __init__(self, *args, **kwargs):
self.demo_push_button_long_press.resize(128, 32)
self.demo_push_button_long_press.attachment().setText("长按按钮")

container_push_buttons.addWidget(self.debug_new_button)
container_push_buttons.addWidget(self.demo_push_button_normal)
container_push_buttons.addWidget(self.demo_push_button_transition)
container_push_buttons.addWidget(self.demo_push_button_long_press)
Expand Down Expand Up @@ -387,6 +433,7 @@ def __init__(self, *args, **kwargs):
self.checkboxes.body().addPlaceholder(12)
self.checkboxes.adjustSize()

group.addWidget(self.refactor_buttons)
group.addWidget(self.push_buttons)
group.addWidget(self.flat_buttons)
group.addWidget(self.switches)
Expand Down
Loading
Loading