Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
k54kdk
PyQt Fluent Widgets
提交
e431d69b
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看板
提交
e431d69b
编写于
3月 26, 2023
作者:
之一Yo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
添加对话框 gallery 界面
上级
b9500857
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
78 addition
and
2 deletion
+78
-2
examples/gallery/app/view/basic_input_interface.py
examples/gallery/app/view/basic_input_interface.py
+2
-0
examples/gallery/app/view/dialog_interface.py
examples/gallery/app/view/dialog_interface.py
+70
-0
examples/gallery/app/view/main_window.py
examples/gallery/app/view/main_window.py
+6
-2
未找到文件。
examples/gallery/app/view/basic_input_interface.py
浏览文件 @
e431d69b
...
...
@@ -87,6 +87,7 @@ class BasicInputInterface(GalleryInterface):
radioLayout
.
addWidget
(
radioButton1
)
radioLayout
.
addWidget
(
radioButton2
)
radioLayout
.
addWidget
(
radioButton3
)
radioButton1
.
click
()
self
.
addExampleCard
(
self
.
tr
(
'A group of RadioButton controls in a button group'
),
radioWidget
,
...
...
@@ -95,6 +96,7 @@ class BasicInputInterface(GalleryInterface):
slider
=
Slider
(
Qt
.
Horizontal
)
slider
.
setRange
(
0
,
100
)
slider
.
setValue
(
30
)
slider
.
setFixedWidth
(
200
)
self
.
addExampleCard
(
self
.
tr
(
'A simple horizontal slider'
),
...
...
examples/gallery/app/view/dialog_interface.py
0 → 100644
浏览文件 @
e431d69b
# coding:utf-8
from
PyQt5.QtCore
import
Qt
,
pyqtSignal
from
PyQt5.QtGui
import
QPixmap
from
PyQt5.QtWidgets
import
QWidget
from
qfluentwidgets
import
PushButton
,
Dialog
,
MessageBox
,
ColorDialog
from
..common.translator
import
Translator
from
.gallery_interface
import
GalleryInterface
class
DialogInterface
(
GalleryInterface
):
""" Dialog interface """
def
__init__
(
self
,
parent
=
None
):
t
=
Translator
()
super
().
__init__
(
title
=
t
.
dialogs
,
subtitle
=
'qfluentwidgets.components.dialog_box'
,
parent
=
parent
)
button
=
PushButton
(
self
.
tr
(
'Show dialog'
))
button
.
clicked
.
connect
(
self
.
showDialog
)
self
.
addExampleCard
(
self
.
tr
(
'A frameless message box'
),
button
,
'https://github.com/zhiyiYo/PyQt-Fluent-Widgets/blob/master/examples/dialog/demo.py'
)
button
=
PushButton
(
self
.
tr
(
'Show dialog'
))
button
.
clicked
.
connect
(
self
.
showMessageDialog
)
self
.
addExampleCard
(
self
.
tr
(
'A message box with mask'
),
button
,
'https://github.com/zhiyiYo/PyQt-Fluent-Widgets/blob/master/examples/message_dialog/demo.py'
)
button
=
PushButton
(
self
.
tr
(
'Show dialog'
))
button
.
clicked
.
connect
(
self
.
showColorDialog
)
self
.
addExampleCard
(
self
.
tr
(
'A color dialog'
),
button
,
'https://github.com/zhiyiYo/PyQt-Fluent-Widgets/blob/master/examples/color_dialog/demo.py'
)
def
showDialog
(
self
):
title
=
self
.
tr
(
'This is a frameless message dialog'
)
content
=
self
.
tr
(
"If the content of the message box is veeeeeeeeeeeeeeeeeeeeeeeeeery long, it will automatically wrap like this."
)
w
=
Dialog
(
title
,
content
,
self
.
window
())
if
w
.
exec
():
print
(
'Yes button is pressed'
)
else
:
print
(
'Cancel button is pressed'
)
def
showMessageDialog
(
self
):
title
=
self
.
tr
(
'This is a frameless message dialog'
)
content
=
self
.
tr
(
"If the content of the message box is veeeeeeeeeeeeeeeeeeeeeeeeeery long, it will automatically wrap like this."
)
w
=
MessageBox
(
title
,
content
,
self
.
window
())
if
w
.
exec
():
print
(
'Yes button is pressed'
)
else
:
print
(
'Cancel button is pressed'
)
def
showColorDialog
(
self
):
w
=
ColorDialog
(
Qt
.
cyan
,
self
.
tr
(
'Choose color'
),
self
.
window
())
w
.
updateStyle
()
w
.
colorChanged
.
connect
(
lambda
c
:
print
(
c
.
name
()))
w
.
exec
()
\ No newline at end of file
examples/gallery/app/view/main_window.py
浏览文件 @
e431d69b
...
...
@@ -11,6 +11,7 @@ from qframelesswindow import FramelessWindow
from
.title_bar
import
CustomTitleBar
from
.setting_interface
import
SettingInterface
,
cfg
from
.basic_input_interface
import
BasicInputInterface
from
.dialog_interface
import
DialogInterface
from
..components.avatar_widget
import
AvatarWidget
from
..common.icon
import
Icon
...
...
@@ -55,9 +56,11 @@ class MainWindow(FramelessWindow):
# create sub interface
self
.
basicInputInterface
=
BasicInputInterface
(
self
)
self
.
dialogInterface
=
DialogInterface
(
self
)
self
.
settingInterface
=
SettingInterface
(
self
)
self
.
stackWidget
.
addWidget
(
self
.
basicInputInterface
)
self
.
stackWidget
.
addWidget
(
self
.
dialogInterface
)
self
.
stackWidget
.
addWidget
(
self
.
settingInterface
)
# initialize layout
...
...
@@ -84,6 +87,7 @@ class MainWindow(FramelessWindow):
def
initNavigation
(
self
):
self
.
basicInputInterface
.
setObjectName
(
'basicInterface'
)
self
.
dialogInterface
.
setObjectName
(
'dialogInterface'
)
self
.
settingInterface
.
setObjectName
(
'settingsInterface'
)
self
.
navigationInterface
.
addItem
(
...
...
@@ -102,10 +106,10 @@ class MainWindow(FramelessWindow):
position
=
NavigationItemPostion
.
SCROLL
)
self
.
navigationInterface
.
addItem
(
routeKey
=
'Dialogs'
,
routeKey
=
self
.
dialogInterface
.
objectName
()
,
icon
=
Icon
.
MESSAGE
,
text
=
self
.
tr
(
'Dialogs'
),
onClick
=
print
,
onClick
=
lambda
:
self
.
switchTo
(
self
.
dialogInterface
)
,
position
=
NavigationItemPostion
.
SCROLL
)
self
.
navigationInterface
.
addItem
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录