Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
k54kdk
PyQt Fluent Widgets
提交
8d7ae87b
P
PyQt Fluent Widgets
项目概览
k54kdk
/
PyQt Fluent Widgets
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PyQt Fluent Widgets
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
8d7ae87b
编写于
3月 11, 2023
作者:
之一Yo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
添加带遮罩的圆角消息框
上级
5aa049ee
变更
9
展开全部
隐藏空白更改
内联
并排
Showing
9 changed file
with
41566 addition
and
41501 deletion
+41566
-41501
examples/message_dialog/demo.py
examples/message_dialog/demo.py
+3
-2
qfluentwidgets/__init__.py
qfluentwidgets/__init__.py
+1
-1
qfluentwidgets/_rc/qss/dark/dialog.qss
qfluentwidgets/_rc/qss/dark/dialog.qss
+11
-0
qfluentwidgets/_rc/qss/light/dialog.qss
qfluentwidgets/_rc/qss/light/dialog.qss
+11
-0
qfluentwidgets/_rc/resource.py
qfluentwidgets/_rc/resource.py
+41484
-41478
qfluentwidgets/components/dialog_box/__init__.py
qfluentwidgets/components/dialog_box/__init__.py
+1
-1
qfluentwidgets/components/dialog_box/dialog.py
qfluentwidgets/components/dialog_box/dialog.py
+53
-17
qfluentwidgets/components/dialog_box/message_dialog.py
qfluentwidgets/components/dialog_box/message_dialog.py
+1
-1
setup.py
setup.py
+1
-1
未找到文件。
examples/message_dialog/demo.py
浏览文件 @
8d7ae87b
...
@@ -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
,
QPushButton
from
PyQt5.QtWidgets
import
QApplication
,
QWidget
,
QPushButton
from
qfluentwidgets
import
MessageDialog
from
qfluentwidgets
import
MessageDialog
,
MessageBox
class
Window
(
QWidget
):
class
Window
(
QWidget
):
...
@@ -20,7 +20,8 @@ class Window(QWidget):
...
@@ -20,7 +20,8 @@ class Window(QWidget):
def
showDialog
(
self
):
def
showDialog
(
self
):
title
=
'Are you sure you want to delete the folder?'
title
=
'Are you sure you want to delete the folder?'
content
=
"""If you delete the "Music" folder from the list, the folder will no longer appear in the list, but will not be deleted."""
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 = MessageDialog(title, content, self) # Win10 style message box
w
=
MessageBox
(
title
,
content
,
self
)
if
w
.
exec
():
if
w
.
exec
():
print
(
'Yes button is pressed'
)
print
(
'Yes button is pressed'
)
else
:
else
:
...
...
qfluentwidgets/__init__.py
浏览文件 @
8d7ae87b
...
@@ -10,7 +10,7 @@ online at https://pyqt-fluent-widgets.readthedocs.io.
...
@@ -10,7 +10,7 @@ online at https://pyqt-fluent-widgets.readthedocs.io.
:license: MIT, see LICENSE for more details.
:license: MIT, see LICENSE for more details.
"""
"""
__version__
=
"0.2.
7
"
__version__
=
"0.2.
8
"
from
.components
import
*
from
.components
import
*
from
.common
import
*
from
.common
import
*
...
...
qfluentwidgets/_rc/qss/dark/dialog.qss
浏览文件 @
8d7ae87b
...
@@ -10,6 +10,17 @@ QDialog {
...
@@ -10,6 +10,17 @@ QDialog {
border-bottom: none;
border-bottom: none;
}
}
MessageBox #buttonGroup {
border-bottom-left-radius: 8px;
border-bottom-right-radius: 8px;
}
#centerWidget {
border: 1px solid rgb(58, 58, 58);
border-radius: 8px;
background-color: rgb(43, 43, 43);
}
QLabel {
QLabel {
background-color: transparent;
background-color: transparent;
color: white;
color: white;
...
...
qfluentwidgets/_rc/qss/light/dialog.qss
浏览文件 @
8d7ae87b
...
@@ -10,6 +10,17 @@ QDialog {
...
@@ -10,6 +10,17 @@ QDialog {
border-bottom: none;
border-bottom: none;
}
}
MessageBox #buttonGroup {
border-bottom-left-radius: 8px;
border-bottom-right-radius: 8px;
}
#centerWidget {
border: 1px solid rgb(144, 144, 142);
border-radius: 8px;
background-color: white;
}
QLabel {
QLabel {
background-color: transparent;
background-color: transparent;
}
}
...
...
qfluentwidgets/_rc/resource.py
浏览文件 @
8d7ae87b
此差异已折叠。
点击以展开。
qfluentwidgets/components/dialog_box/__init__.py
浏览文件 @
8d7ae87b
from
.color_dialog
import
ColorDialog
from
.color_dialog
import
ColorDialog
from
.dialog
import
Dialog
from
.dialog
import
Dialog
,
MessageBox
from
.folder_list_dialog
import
FolderListDialog
from
.folder_list_dialog
import
FolderListDialog
from
.message_dialog
import
MessageDialog
from
.message_dialog
import
MessageDialog
\ No newline at end of file
qfluentwidgets/components/dialog_box/dialog.py
浏览文件 @
8d7ae87b
# coding:utf-8
# coding:utf-8
from
PyQt5.QtCore
import
Qt
,
pyqtSignal
from
PyQt5.QtCore
import
Qt
,
pyqtSignal
,
QObject
from
PyQt5.QtWidgets
import
QLabel
,
QPushButton
,
QFrame
,
QVBoxLayout
,
QHBoxLayout
from
PyQt5.QtGui
import
QColor
from
PyQt5.QtWidgets
import
QLabel
,
QPushButton
,
QFrame
,
QVBoxLayout
,
QHBoxLayout
,
QSizePolicy
from
qframelesswindow
import
FramelessDialog
from
qframelesswindow
import
FramelessDialog
from
...common.auto_wrap
import
TextWrap
from
...common.auto_wrap
import
TextWrap
from
...common.style_sheet
import
setStyleSheet
from
...common.style_sheet
import
setStyleSheet
from
.mask_dialog_base
import
MaskDialogBase
class
Dialog
(
FramelessDialog
):
""" Dialog box """
class
Ui_MessageBox
(
QObject
):
""" Ui of message box """
yesSignal
=
pyqtSignal
()
yesSignal
=
pyqtSignal
()
cancelSignal
=
pyqtSignal
()
cancelSignal
=
pyqtSignal
()
def
__init__
(
self
,
title
:
str
,
content
:
str
,
parent
=
None
):
def
_setUpUi
(
self
,
title
,
content
,
parent
):
super
().
__init__
(
parent
)
self
.
resize
(
240
,
192
)
self
.
titleBar
.
hide
()
self
.
content
=
content
self
.
content
=
content
self
.
titleLabel
=
QLabel
(
title
,
self
)
self
.
titleLabel
=
QLabel
(
title
,
parent
)
self
.
contentLabel
=
QLabel
(
content
,
self
)
self
.
contentLabel
=
QLabel
(
content
,
parent
)
self
.
windowTitleLabel
=
QLabel
(
title
,
self
)
self
.
buttonGroup
=
QFrame
(
self
)
self
.
buttonGroup
=
QFrame
(
parent
)
self
.
yesButton
=
QPushButton
(
self
.
tr
(
'OK'
),
self
.
buttonGroup
)
self
.
yesButton
=
QPushButton
(
self
.
tr
(
'OK'
),
self
.
buttonGroup
)
self
.
cancelButton
=
QPushButton
(
self
.
tr
(
'Cancel'
),
self
.
buttonGroup
)
self
.
cancelButton
=
QPushButton
(
self
.
tr
(
'Cancel'
),
self
.
buttonGroup
)
self
.
vBoxLayout
=
QVBoxLayout
(
self
)
self
.
vBoxLayout
=
QVBoxLayout
(
parent
)
self
.
textLayout
=
QVBoxLayout
()
self
.
textLayout
=
QVBoxLayout
()
self
.
buttonLayout
=
QHBoxLayout
(
self
.
buttonGroup
)
self
.
buttonLayout
=
QHBoxLayout
(
self
.
buttonGroup
)
...
@@ -40,7 +38,6 @@ class Dialog(FramelessDialog):
...
@@ -40,7 +38,6 @@ class Dialog(FramelessDialog):
self
.
yesButton
.
setFocus
()
self
.
yesButton
.
setFocus
()
self
.
buttonGroup
.
setFixedHeight
(
81
)
self
.
buttonGroup
.
setFixedHeight
(
81
)
self
.
contentLabel
.
setText
(
TextWrap
.
wrap
(
self
.
content
,
100
,
False
)[
0
])
self
.
contentLabel
.
setText
(
TextWrap
.
wrap
(
self
.
content
,
100
,
False
)[
0
])
self
.
setResizeEnabled
(
False
)
self
.
yesButton
.
clicked
.
connect
(
self
.
__onYesButtonClicked
)
self
.
yesButton
.
clicked
.
connect
(
self
.
__onYesButtonClicked
)
self
.
cancelButton
.
clicked
.
connect
(
self
.
__onCancelButtonClicked
)
self
.
cancelButton
.
clicked
.
connect
(
self
.
__onCancelButtonClicked
)
...
@@ -48,9 +45,9 @@ class Dialog(FramelessDialog):
...
@@ -48,9 +45,9 @@ class Dialog(FramelessDialog):
def
__initLayout
(
self
):
def
__initLayout
(
self
):
self
.
vBoxLayout
.
setSpacing
(
0
)
self
.
vBoxLayout
.
setSpacing
(
0
)
self
.
vBoxLayout
.
setContentsMargins
(
0
,
0
,
0
,
0
)
self
.
vBoxLayout
.
setContentsMargins
(
0
,
0
,
0
,
0
)
self
.
vBoxLayout
.
addWidget
(
self
.
windowTitleLabel
,
0
,
Qt
.
AlignTop
)
self
.
vBoxLayout
.
addLayout
(
self
.
textLayout
,
1
)
self
.
vBoxLayout
.
addLayout
(
self
.
textLayout
,
1
)
self
.
vBoxLayout
.
addWidget
(
self
.
buttonGroup
,
0
,
Qt
.
AlignBottom
)
self
.
vBoxLayout
.
addWidget
(
self
.
buttonGroup
,
0
,
Qt
.
AlignBottom
)
self
.
vBoxLayout
.
setSizeConstraint
(
QVBoxLayout
.
SetMinimumSize
)
self
.
textLayout
.
setSpacing
(
12
)
self
.
textLayout
.
setSpacing
(
12
)
self
.
textLayout
.
setContentsMargins
(
24
,
24
,
24
,
24
)
self
.
textLayout
.
setContentsMargins
(
24
,
24
,
24
,
24
)
...
@@ -76,9 +73,48 @@ class Dialog(FramelessDialog):
...
@@ -76,9 +73,48 @@ class Dialog(FramelessDialog):
self
.
contentLabel
.
setObjectName
(
"contentLabel"
)
self
.
contentLabel
.
setObjectName
(
"contentLabel"
)
self
.
yesButton
.
setObjectName
(
'yesButton'
)
self
.
yesButton
.
setObjectName
(
'yesButton'
)
self
.
buttonGroup
.
setObjectName
(
'buttonGroup'
)
self
.
buttonGroup
.
setObjectName
(
'buttonGroup'
)
self
.
windowTitleLabel
.
setObjectName
(
'windowTitleLabel'
)
setStyleSheet
(
self
,
'dialog'
)
setStyleSheet
(
self
,
'dialog'
)
self
.
yesButton
.
adjustSize
()
self
.
yesButton
.
adjustSize
()
self
.
cancelButton
.
adjustSize
()
self
.
cancelButton
.
adjustSize
()
class
Dialog
(
FramelessDialog
,
Ui_MessageBox
):
""" Dialog box """
yesSignal
=
pyqtSignal
()
cancelSignal
=
pyqtSignal
()
def
__init__
(
self
,
title
:
str
,
content
:
str
,
parent
=
None
):
super
().
__init__
(
parent
=
parent
)
self
.
_setUpUi
(
title
,
content
,
self
)
self
.
windowTitleLabel
=
QLabel
(
title
,
self
)
self
.
setResizeEnabled
(
False
)
self
.
resize
(
240
,
192
)
self
.
titleBar
.
hide
()
self
.
vBoxLayout
.
insertWidget
(
0
,
self
.
windowTitleLabel
,
0
,
Qt
.
AlignTop
)
self
.
windowTitleLabel
.
setObjectName
(
'windowTitleLabel'
)
setStyleSheet
(
self
,
'dialog'
)
class
MessageBox
(
MaskDialogBase
,
Ui_MessageBox
):
""" Message box """
yesSignal
=
pyqtSignal
()
cancelSignal
=
pyqtSignal
()
def
__init__
(
self
,
title
:
str
,
content
:
str
,
parent
=
None
):
super
().
__init__
(
parent
=
parent
)
self
.
_setUpUi
(
title
,
content
,
self
.
widget
)
self
.
setShadowEffect
(
60
,
(
0
,
10
),
QColor
(
0
,
0
,
0
,
80
))
self
.
setMaskColor
(
QColor
(
0
,
0
,
0
,
76
))
self
.
widget
.
setFixedSize
(
max
(
self
.
contentLabel
.
width
(),
self
.
titleLabel
.
width
())
+
48
,
self
.
contentLabel
.
y
()
+
self
.
contentLabel
.
height
()
+
105
)
\ No newline at end of file
qfluentwidgets/components/dialog_box/message_dialog.py
浏览文件 @
8d7ae87b
...
@@ -8,7 +8,7 @@ from .mask_dialog_base import MaskDialogBase
...
@@ -8,7 +8,7 @@ from .mask_dialog_base import MaskDialogBase
class
MessageDialog
(
MaskDialogBase
):
class
MessageDialog
(
MaskDialogBase
):
"""
M
essage dialog box with a mask """
"""
Win10 style m
essage dialog box with a mask """
yesSignal
=
pyqtSignal
()
yesSignal
=
pyqtSignal
()
cancelSignal
=
pyqtSignal
()
cancelSignal
=
pyqtSignal
()
...
...
setup.py
浏览文件 @
8d7ae87b
...
@@ -6,7 +6,7 @@ with open('README.md', encoding='utf-8') as f:
...
@@ -6,7 +6,7 @@ with open('README.md', encoding='utf-8') as f:
setuptools
.
setup
(
setuptools
.
setup
(
name
=
"PyQt-Fluent-Widgets"
,
name
=
"PyQt-Fluent-Widgets"
,
version
=
"0.2.
7
"
,
version
=
"0.2.
8
"
,
keywords
=
"pyqt fluent widgets"
,
keywords
=
"pyqt fluent widgets"
,
author
=
"zhiyiYo"
,
author
=
"zhiyiYo"
,
author_email
=
"shokokawaii@outlook.com"
,
author_email
=
"shokokawaii@outlook.com"
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录