提交 ca1c5299 编写于 作者: 之一Yo's avatar 之一Yo

重构项目,添加设置卡

上级 904d3c0a
# PyQt-Fluent-Widgets # PyQt-Fluent-Widgets
A collection of commonly used widgets. A library of fluent design widgets.
## Install
To install use pip:
```shell
pip install PyQt-Fluent-Widgets
```
Or clone the repo:
```shell
git clone https://github.com/zhiyiYo/PyQt-Fluent-Widgets.git
python setup.py install
```
## Detailed list ## Detailed list
<table> <table>
...@@ -20,32 +31,6 @@ A collection of commonly used widgets. ...@@ -20,32 +31,6 @@ A collection of commonly used widgets.
<img src="screenshot/switch_button.gif" /> <img src="screenshot/switch_button.gif" />
</td> </td>
</tr> </tr>
<tr>
<td>
Radio Button
</td>
<td>
<code>QRadioButton</code>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<img src="screenshot/radio_button.gif" />
</td>
</tr>
<tr>
<td>
Slider
</td>
<td>
<code>Slider</code>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<img src="screenshot/slider.gif" />
</td>
</tr>
<tr> <tr>
<td> <td>
Hollow Handle Slider Hollow Handle Slider
...@@ -111,19 +96,6 @@ A collection of commonly used widgets. ...@@ -111,19 +96,6 @@ A collection of commonly used widgets.
<img src="screenshot/folder_list_dialog.gif" /> <img src="screenshot/folder_list_dialog.gif" />
</td> </td>
</tr> </tr>
<tr>
<td>
Color Picker
</td>
<td>
<code>ColorPicker</code>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<img src="screenshot/color_picker.gif" style="height:70%"/>
</td>
</tr>
<tr> <tr>
<td> <td>
State Tooltip State Tooltip
......
...@@ -4,7 +4,7 @@ import sys ...@@ -4,7 +4,7 @@ import sys
from PyQt5.QtGui import QColor from PyQt5.QtGui import QColor
from PyQt5.QtWidgets import QApplication from PyQt5.QtWidgets import QApplication
from acrylic_label import AcrylicLabel from qfluentwidgets import AcrylicLabel
app = QApplication(sys.argv) app = QApplication(sys.argv)
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import sys import sys
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton from PyQt5.QtWidgets import QApplication, QWidget, QPushButton
from dialog import Dialog from qfluentwidgets import Dialog
class Window(QWidget): class Window(QWidget):
...@@ -10,15 +10,16 @@ class Window(QWidget): ...@@ -10,15 +10,16 @@ class Window(QWidget):
def __init__(self, parent=None): def __init__(self, parent=None):
super().__init__(parent=parent) super().__init__(parent=parent)
self.resize(1000, 500) self.resize(1000, 500)
self.btn = QPushButton('点我', parent=self) self.btn = QPushButton('Click Me', parent=self)
self.btn.move(425, 225) self.btn.move(425, 225)
self.btn.clicked.connect(self.showDialog) self.btn.clicked.connect(self.showDialog)
with open('resource/demo.qss', encoding='utf-8') as f: with open('resource/demo.qss', encoding='utf-8') as f:
self.setStyleSheet(f.read()) self.setStyleSheet(f.read())
def showDialog(self): def showDialog(self):
content = '如果将"音乐"文件夹从音乐中移除,则该文件夹不会再出现在音乐中,但不会被删除。' title = 'Are you sure you want to delete the folder?'
w = Dialog('删除此文件夹吗?', content, self) content = """If you delete the "Music" folder from the list, the folder will no longer appear in the list, but will not be deleted."""
w = Dialog(title, content, self)
w.exec() w.exec()
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import sys import sys
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton from PyQt5.QtWidgets import QApplication, QWidget, QPushButton
from flow_layout import FlowLayout from qfluentwidgets import FlowLayout
class Demo(QWidget): class Demo(QWidget):
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import sys import sys
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton from PyQt5.QtWidgets import QApplication, QWidget, QPushButton
from folder_list_dialog import FolderListDialog from qfluentwidgets import FolderListDialog
class Window(QWidget): class Window(QWidget):
...@@ -10,17 +10,17 @@ class Window(QWidget): ...@@ -10,17 +10,17 @@ class Window(QWidget):
def __init__(self, parent=None): def __init__(self, parent=None):
super().__init__(parent=parent) super().__init__(parent=parent)
self.resize(1000, 800) self.resize(1000, 800)
self.btn = QPushButton('点我', parent=self) self.btn = QPushButton('Click Me', parent=self)
self.btn.move(425, 375) self.btn.move(390, 375)
self.btn.clicked.connect(self.showDialog) self.btn.clicked.connect(self.showDialog)
self.btn.setObjectName('btn') self.btn.setObjectName('btn')
with open('resource/style/demo.qss', encoding='utf-8') as f: with open('resource/demo.qss', encoding='utf-8') as f:
self.setStyleSheet(f.read()) self.setStyleSheet(f.read())
def showDialog(self): def showDialog(self):
folder_paths = ['D:/KuGou', 'C:/Users/shoko/Documents/音乐'] folder_paths = ['D:/KuGou', 'C:/Users/shoko/Documents/Music']
title = '从本地曲库创建个人"收藏"' title = 'Build your collection from your local music files'
content = '现在我们正在查看这些文件夹:' content = "Right now, we're watching these folders:"
w = FolderListDialog(folder_paths, title, content, self) w = FolderListDialog(folder_paths, title, content, self)
w.folderChanged.connect(lambda x: print(x)) w.folderChanged.connect(lambda x: print(x))
w.exec() w.exec()
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import sys import sys
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton from PyQt5.QtWidgets import QApplication, QWidget, QPushButton
from message_dialog import MessageDialog from qfluentwidgets import MessageDialog
class Window(QWidget): class Window(QWidget):
...@@ -17,8 +17,9 @@ class Window(QWidget): ...@@ -17,8 +17,9 @@ class Window(QWidget):
self.setStyleSheet(f.read()) self.setStyleSheet(f.read())
def showDialog(self): def showDialog(self):
content = '如果将"音乐"文件夹从音乐中移除,则该文件夹不会再出现在音乐中。' title = 'Are you sure you want to delete the folder?'
w = MessageDialog('删除此文件夹吗?', content, self) content = """If you delete the "Music" folder from the list, the folder will no longer appear in the list, but will not be deleted."""
w = MessageDialog(title, content, self)
w.exec() w.exec()
......
...@@ -4,7 +4,7 @@ from PyQt5.QtCore import Qt ...@@ -4,7 +4,7 @@ from PyQt5.QtCore import Qt
from PyQt5.QtGui import QColor from PyQt5.QtGui import QColor
from PyQt5.QtWidgets import QApplication, QWidget, QSlider from PyQt5.QtWidgets import QApplication, QWidget, QSlider
from hollow_handle_style import HollowHandleStyle from qfluentwidgets import HollowHandleStyle
class Demo(QWidget): class Demo(QWidget):
...@@ -14,7 +14,7 @@ class Demo(QWidget): ...@@ -14,7 +14,7 @@ class Demo(QWidget):
self.resize(300, 150) self.resize(300, 150)
self.setStyleSheet("Demo{background: rgb(184, 106, 106)}") self.setStyleSheet("Demo{background: rgb(184, 106, 106)}")
# 改变默认样式 # customize style
style = { style = {
"sub-page.color": QColor(70, 23, 180) "sub-page.color": QColor(70, 23, 180)
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import sys import sys
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton from PyQt5.QtWidgets import QApplication, QWidget, QPushButton
from state_tooltip import StateTooltip from qfluentwidgets import StateToolTip
class Window(QWidget): class Window(QWidget):
...@@ -10,11 +10,11 @@ class Window(QWidget): ...@@ -10,11 +10,11 @@ class Window(QWidget):
def __init__(self, parent=None): def __init__(self, parent=None):
super().__init__(parent=parent) super().__init__(parent=parent)
self.resize(800, 300) self.resize(800, 300)
self.btn = QPushButton('点我', parent=self) self.btn = QPushButton('Click Me', parent=self)
self.btn.move(310, 225) self.btn.move(310, 225)
self.btn.clicked.connect(self.onButtonClicked) self.btn.clicked.connect(self.onButtonClicked)
self.stateTooltip = None self.stateTooltip = None
with open('resource/style/demo.qss', encoding='utf-8') as f: with open('resource/demo.qss', encoding='utf-8') as f:
self.setStyleSheet(f.read()) self.setStyleSheet(f.read())
def onButtonClicked(self): def onButtonClicked(self):
...@@ -23,7 +23,7 @@ class Window(QWidget): ...@@ -23,7 +23,7 @@ class Window(QWidget):
self.stateTooltip.setState(True) self.stateTooltip.setState(True)
self.stateTooltip = None self.stateTooltip = None
else: else:
self.stateTooltip = StateTooltip('正在训练模型', '客官请耐心等待哦~~', self) self.stateTooltip = StateToolTip('正在训练模型', '客官请耐心等待哦~~', self)
self.stateTooltip.move(510, 30) self.stateTooltip.move(510, 30)
self.stateTooltip.show() self.stateTooltip.show()
......
...@@ -3,7 +3,7 @@ import sys ...@@ -3,7 +3,7 @@ import sys
from PyQt5.QtCore import Qt from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QApplication, QWidget from PyQt5.QtWidgets import QApplication, QWidget
from switch_button import SwitchButton from qfluentwidgets import SwitchButton
class Window(QWidget): class Window(QWidget):
...@@ -14,11 +14,9 @@ class Window(QWidget): ...@@ -14,11 +14,9 @@ class Window(QWidget):
self.switchButton = SwitchButton(parent=self) self.switchButton = SwitchButton(parent=self)
self.switchButton.move(60, 30) self.switchButton.move(60, 30)
self.switchButton.checkedChanged.connect(self.onCheckedChanged) self.switchButton.checkedChanged.connect(self.onCheckedChanged)
with open('resource/switch_button.qss', encoding='utf-8') as f:
self.setStyleSheet(f.read())
def onCheckedChanged(self, isChecked: bool): def onCheckedChanged(self, isChecked: bool):
text = '开' if isChecked else '关' text = 'On' if isChecked else 'Off'
self.switchButton.setText(text) self.switchButton.setText(text)
......
...@@ -3,7 +3,7 @@ import sys ...@@ -3,7 +3,7 @@ import sys
from PyQt5.QtCore import QEvent, QPoint from PyQt5.QtCore import QEvent, QPoint
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QHBoxLayout from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QHBoxLayout
from tool_tip import ToolTip from qfluentwidgets import ToolTip
class Demo(QWidget): class Demo(QWidget):
...@@ -16,7 +16,7 @@ class Demo(QWidget): ...@@ -16,7 +16,7 @@ class Demo(QWidget):
self._toolTip = ToolTip(parent=self) self._toolTip = ToolTip(parent=self)
# self._toolTip.setDarkTheme(True) # self._toolTip.setDarkTheme(True)
self.button1.setToolTip('aiko - キラキラ ✨') self.button1.setToolTip('aiko - キラキラ ✨\n'*8)
self.button2.setToolTip('aiko - 食べた愛 🥰') self.button2.setToolTip('aiko - 食べた愛 🥰')
self.button1.setToolTipDuration(1000) self.button1.setToolTipDuration(1000)
self.button2.setToolTipDuration(5000) self.button2.setToolTipDuration(5000)
......
"""
PyQt-Fluent-Widgets
===================
A library of fluent design widgets.
:copyright: (c) 2023 by zhiyiYo.
:license: MIT, see LICENSE for more details.
"""
__version__ = "0.0.1"
from .components.dialog_box import *
from .components.layout import *
from .components.settings import *
from .components.widgets import *
from .common import *
from ._rc import resource
\ No newline at end of file
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册