Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
k54kdk
PyQt Fluent Widgets
提交
0c04b4f6
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看板
提交
0c04b4f6
编写于
3月 26, 2023
作者:
之一Yo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
添加翻译和过渡动画
上级
1874a838
变更
28
展开全部
隐藏空白更改
内联
并排
Showing
28 changed file
with
1554 addition
and
772 deletion
+1554
-772
examples/gallery/app/common/config.py
examples/gallery/app/common/config.py
+5
-10
examples/gallery/app/common/icon.py
examples/gallery/app/common/icon.py
+1
-0
examples/gallery/app/resource/i18n/gallery_hk.qm
examples/gallery/app/resource/i18n/gallery_hk.qm
+0
-0
examples/gallery/app/resource/i18n/gallery_hk.ts
examples/gallery/app/resource/i18n/gallery_hk.ts
+597
-0
examples/gallery/app/resource/i18n/gallery_zh.qm
examples/gallery/app/resource/i18n/gallery_zh.qm
+0
-0
examples/gallery/app/resource/i18n/gallery_zh.ts
examples/gallery/app/resource/i18n/gallery_zh.ts
+597
-0
examples/gallery/app/resource/i18n/qfluentwidgets_hk.qm
examples/gallery/app/resource/i18n/qfluentwidgets_hk.qm
+0
-0
examples/gallery/app/resource/i18n/qfluentwidgets_hk.ts
examples/gallery/app/resource/i18n/qfluentwidgets_hk.ts
+152
-370
examples/gallery/app/resource/i18n/qfluentwidgets_zh.qm
examples/gallery/app/resource/i18n/qfluentwidgets_zh.qm
+0
-0
examples/gallery/app/resource/i18n/qfluentwidgets_zh.ts
examples/gallery/app/resource/i18n/qfluentwidgets_zh.ts
+11
-226
examples/gallery/app/resource/images/icons/Album_black.svg
examples/gallery/app/resource/images/icons/Album_black.svg
+4
-0
examples/gallery/app/resource/images/icons/Album_white.svg
examples/gallery/app/resource/images/icons/Album_white.svg
+4
-0
examples/gallery/app/view/basic_input_interface.py
examples/gallery/app/view/basic_input_interface.py
+16
-10
examples/gallery/app/view/dialog_interface.py
examples/gallery/app/view/dialog_interface.py
+1
-1
examples/gallery/app/view/gallery_interface.py
examples/gallery/app/view/gallery_interface.py
+6
-1
examples/gallery/app/view/main_window.py
examples/gallery/app/view/main_window.py
+21
-18
examples/gallery/app/view/material_interface.py
examples/gallery/app/view/material_interface.py
+14
-6
examples/gallery/app/view/menu_interface.py
examples/gallery/app/view/menu_interface.py
+14
-12
examples/gallery/app/view/scroll_interface.py
examples/gallery/app/view/scroll_interface.py
+5
-2
examples/gallery/app/view/setting_interface.py
examples/gallery/app/view/setting_interface.py
+25
-6
examples/gallery/app/view/status_info_interface.py
examples/gallery/app/view/status_info_interface.py
+5
-5
examples/gallery/demo.py
examples/gallery/demo.py
+4
-0
examples/gallery/gallery.pro
examples/gallery/gallery.pro
+14
-0
qfluentwidgets/components/navigation/navigation_panel.py
qfluentwidgets/components/navigation/navigation_panel.py
+2
-2
qfluentwidgets/components/navigation/navigation_widget.py
qfluentwidgets/components/navigation/navigation_widget.py
+2
-2
qfluentwidgets/components/settings/setting_card.py
qfluentwidgets/components/settings/setting_card.py
+3
-3
qfluentwidgets/components/widgets/label.py
qfluentwidgets/components/widgets/label.py
+0
-3
qfluentwidgets/components/widgets/stacked_widget.py
qfluentwidgets/components/widgets/stacked_widget.py
+51
-95
未找到文件。
examples/gallery/app/common/config.py
浏览文件 @
0c04b4f6
# coding:utf-8
from
enum
import
Enum
from
PyQt5.QtCore
import
Qt
from
PyQt5.QtGui
import
QGuiApplication
,
QFont
from
qfluentwidgets
import
(
qconfig
,
QConfig
,
ConfigItem
,
OptionsConfigItem
,
BoolValidator
,
ColorConfigItem
,
OptionsValidator
,
RangeConfigItem
,
RangeValidator
,
OptionsValidator
,
RangeConfigItem
,
RangeValidator
,
FolderListValidator
,
EnumSerializer
,
FolderValidator
)
...
...
@@ -28,19 +26,16 @@ class Config(QConfig):
"Folders"
,
"Download"
,
"app/download"
,
FolderValidator
())
# main window
minimizeToTray
=
ConfigItem
(
"MainWindow"
,
"MinimizeToTray"
,
True
,
BoolValidator
())
playBarColor
=
ColorConfigItem
(
"MainWindow"
,
"PlayBarColor"
,
"#225C7F"
)
recentPlaysNumber
=
RangeConfigItem
(
"MainWindow"
,
"RecentPlayNumbers"
,
300
,
RangeValidator
(
10
,
300
))
dpiScale
=
OptionsConfigItem
(
"MainWindow"
,
"DpiScale"
,
"Auto"
,
OptionsValidator
([
1
,
1.25
,
1.5
,
1.75
,
2
,
"Auto"
]),
restart
=
True
)
language
=
OptionsConfigItem
(
"MainWindow"
,
"Language"
,
Language
.
AUTO
,
OptionsValidator
(
Language
),
EnumSerializer
(
Language
),
restart
=
True
)
# Material
blurRadius
=
RangeConfigItem
(
"Material"
,
"AcrylicBlurRadius"
,
15
,
RangeValidator
(
0
,
40
))
# software update
checkUpdateAtStartUp
=
ConfigItem
(
"Update"
,
"CheckUpdateAtStartUp"
,
True
,
BoolValidator
())
checkUpdateAtStartUp
=
ConfigItem
(
"Update"
,
"CheckUpdateAtStartUp"
,
True
,
BoolValidator
())
YEAR
=
2023
...
...
examples/gallery/app/common/icon.py
浏览文件 @
0c04b4f6
...
...
@@ -9,6 +9,7 @@ class Icon(FluentIconBase, Enum):
HOME
=
"Home"
CHAT
=
"Chat"
MENU
=
"Menu"
ALBUM
=
"Album"
SCROLL
=
"Scroll"
LAYOUT
=
"Layout"
GITHUB
=
"Github"
...
...
examples/gallery/app/resource/i18n/gallery_hk.qm
0 → 100644
浏览文件 @
0c04b4f6
文件已添加
examples/gallery/app/resource/i18n/gallery_hk.ts
0 → 100644
浏览文件 @
0c04b4f6
此差异已折叠。
点击以展开。
examples/gallery/app/resource/i18n/gallery_zh.qm
0 → 100644
浏览文件 @
0c04b4f6
文件已添加
examples/gallery/app/resource/i18n/gallery_zh.ts
0 → 100644
浏览文件 @
0c04b4f6
此差异已折叠。
点击以展开。
examples/gallery/app/resource/i18n/qfluentwidgets_hk.qm
浏览文件 @
0c04b4f6
无法预览此类型文件
examples/gallery/app/resource/i18n/qfluentwidgets_hk.ts
浏览文件 @
0c04b4f6
<
?
xml
version
=
"
1.0
"
encoding
=
"
utf-8
"
?
>
<!
DOCTYPE
TS
>
<
TS
version
=
"
2.1
"
language
=
"
zh_CN
"
>
<!--
The
translation
of
components
in
PyQt
-
Fluent
-
Widgets
-->
<
context
>
<
name
>
ColorDialog
<
/name
>
<
message
>
<
source
>
OK
<
/source
>
<
translation
>
確認
<
/translation
>
<
/message
>
<
message
>
<
source
>
Cancel
<
/source
>
<
translation
>
取消
<
/translation
>
<
/message
>
<
message
>
<
source
>
Edit
Color
<
/source
>
<
translation
>
編輯顏色
<
/translation
>
<
/message
>
<
message
>
<
source
>
Red
<
/source
>
<
translation
>
紅色
<
/translation
>
<
/message
>
<
message
>
<
source
>
Blue
<
/source
>
<
translation
>
藍色
<
/translation
>
<
/message
>
<
message
>
<
source
>
Green
<
/source
>
<
translation
>
綠色
<
/translation
>
<
/message
>
<
/context
>
<
context
>
<
name
>
MessageDialog
<
/name
>
<
message
>
<
source
>
OK
<
/source
>
<
translation
>
確認
<
/translation
>
<
/message
>
<
message
>
<
source
>
Cancel
<
/source
>
<
translation
>
取消
<
/translation
>
<
/message
>
<
/context
>
<
context
>
<
name
>
Dialog
<
/name
>
<
message
>
<
source
>
OK
<
/source
>
<
translation
>
確認
<
/translation
>
<
/message
>
<
message
>
<
source
>
Cancel
<
/source
>
<
translation
>
取消
<
/translation
>
<
/message
>
<
/context
>
<
context
>
<
name
>
FolderListDialog
<
/name
>
<
message
>
<
source
>
Done
<
/source
>
<
translation
>
完成
<
/translation
>
<
/message
>
<
message
>
<
source
>
Choose
folder
<
/source
>
<
translation
>
選擇文件夾
<
/translation
>
<
/message
>
<
message
>
<
source
>
Are
you
sure
you
want
to
delete
the
folder
?
<
/source
>
<
translation
>
是否確認刪除此文件夾
?
<
/translation
>
<
/message
>
<
message
>
<
source
>
If
you
delete
the
<
/source
>
<
translation
>
如果將
<
/translation
>
<
/message
>
<
message
>
<
source
>
folder
and
remove
it
from
the
list
,
the
folder
will
no
longer
appear
in
the
list
,
but
will
not
be
deleted
.
<
/source
>
<
translation
>
文件夾從列表中移除
,
則該文件夾不會再出現在列表中
,
但不會被刪除
。
<
/translation
>
<
/message
>
<
/context
>
<
context
>
<
name
>
SwitchSettingCard
<
/name
>
<
message
>
<
source
>
Off
<
/source
>
<
translation
>
關
<
/translation
>
<
/message
>
<
message
>
<
source
>
On
<
/source
>
<
translation
>
開
<
/translation
>
<
/message
>
<
/context
>
<
context
>
<
name
>
CustomColorSettingCard
<
/name
>
<
message
>
<
source
>
Custom
color
<
/source
>
<
translation
>
自定義顏色
<
/translation
>
<
/message
>
<
message
>
<
source
>
Default
color
<
/source
>
<
translation
>
默認顏色
<
/translation
>
<
/message
>
<
message
>
<
source
>
Choose
color
<
/source
>
<
translation
>
選擇顏色
<
/translation
>
<
/message
>
<
/context
>
<
context
>
<
name
>
ColorPickerButton
<
/name
>
<
message
>
<
source
>
Choose
<
/source
>
<
translation
>
選擇
<
/translation
>
<
/message
>
<
/context
>
<
context
>
<
name
>
FolderListSettingCard
<
/name
>
<
message
>
<
source
>
Add
folder
<
/source
>
<
translation
>
添加文件夾
<
/translation
>
<
/message
>
<
message
>
<
source
>
Choose
folder
<
/source
>
<
translation
>
選擇文件夾
<
/translation
>
<
/message
>
<
message
>
<
source
>
Are
you
sure
you
want
to
delete
the
folder
?
<
/source
>
<
translation
>
是否確認刪除此文件夾
?
<
/translation
>
<
/message
>
<
message
>
<
source
>
If
you
delete
the
<
/source
>
<
translation
>
如果將
<
/translation
>
<
/message
>
<
message
>
<
source
>
folder
and
remove
it
from
the
list
,
the
folder
will
no
longer
appear
in
the
list
,
but
will
not
be
deleted
.
<
/source
>
<
translation
>
文件夾從列表中移除
,
則該文件夾不會再出現在列表中
,
但不會被刪除
。
<
/translation
>
<
/message
>
<
/context
>
<!--
Put
the
translation
of
your
interface
below
-->
<
context
>
<
name
>
SettingInterface
<
/name
>
<
message
>
<
source
>
Settings
<
/source
>
<
translation
>
設置
<
/translation
>
<
/message
>
<
message
>
<
source
>
Music
on
this
PC
<
/source
>
<
translation
>
此
PC
上的音樂
<
/translation
>
<
/message
>
<
message
>
<
source
>
Local
music
library
<
/source
>
<
translation
>
本地音樂庫
<
/translation
>
<
/message
>
<
message
>
<
source
>
Choose
folder
<
/source
>
<
translation
>
選擇文件夾
<
/translation
>
<
/message
>
<
message
>
<
source
>
Download
directory
<
/source
>
<
translation
>
下載目錄
<
/translation
>
<
/message
>
<
message
>
<
source
>
Personalization
<
/source
>
<
translation
>
個性化
<
/translation
>
<
/message
>
<
message
>
<
source
>
Use
Acrylic
effect
<
/source
>
<
translation
>
啟用亞克力效果
<
/translation
>
<
/message
>
<
message
>
<
source
>
Acrylic
effect
has
better
visual
experience
,
but
it
may
cause
the
window
to
become
stuck
<
/source
>
<
translation
>
亞克力效果的視覺體驗更好
,
但可能導致窗口卡頓
<
/translation
>
<
/message
>
<
message
>
<
source
>
Application
theme
<
/source
>
<
translation
>
應用主題
<
/translation
>
<
/message
>
<
message
>
<
source
>
Theme
color
<
/source
>
<
translation
>
主題色
<
/translation
>
<
/message
>
<
message
>
<
source
>
Change
the
theme
color
of
you
application
<
/source
>
<
translation
>
調整你的應用主題顏色
<
/translation
>
<
/message
>
<
message
>
<
source
>
Change
the
appearance
of
your
application
<
/source
>
<
translation
>
調整你的應用外觀
<
/translation
>
<
/message
>
<
message
>
<
source
>
Light
<
/source
>
<
translation
>
淺色
<
/translation
>
<
/message
>
<
message
>
<
source
>
Dark
<
/source
>
<
translation
>
深色
<
/translation
>
<
/message
>
<
message
>
<
source
>
Use
system
setting
<
/source
>
<
translation
>
跟隨系統設置
<
/translation
>
<
/message
>
<
message
>
<
source
>
Interface
zoom
<
/source
>
<
translation
>
界面縮放
<
/translation
>
<
/message
>
<
message
>
<
source
>
Change
the
size
of
widgets
and
fonts
<
/source
>
<
translation
>
調整組件和字體的大小
<
/translation
>
<
/message
>
<
message
>
<
source
>
Language
<
/source
>
<
translation
>
語言
<
/translation
>
<
/message
>
<
message
>
<
source
>
Set
your
preferred
language
for
UI
<
/source
>
<
translation
>
選擇界面所使用的語言
<
/translation
>
<
/message
>
<
message
>
<
source
>
Online
Music
<
/source
>
<
translation
>
在線音樂
<
/translation
>
<
/message
>
<
message
>
<
source
>
Number
of
online
music
displayed
on
each
page
<
/source
>
<
translation
>
每頁顯示的在線歌曲數量
<
/translation
>
<
/message
>
<
message
>
<
source
>
Online
music
quality
<
/source
>
<
translation
>
在線播放音質
<
/translation
>
<
/message
>
<
message
>
<
source
>
Standard
quality
<
/source
>
<
translation
>
流暢
<
/translation
>
<
/message
>
<
message
>
<
source
>
High
quality
<
/source
>
<
translation
>
高品
<
/translation
>
<
/message
>
<
message
>
<
source
>
Super
quality
<
/source
>
<
translation
>
超品
<
/translation
>
<
/message
>
<
message
>
<
source
>
Lossless
quality
<
/source
>
<
translation
>
無損
<
/translation
>
<
/message
>
<
message
>
<
source
>
Online
MV
quality
<
/source
>
<
translation
>
在線
MV
畫質
<
/translation
>
<
/message
>
<
message
>
<
source
>
Full
HD
<
/source
>
<
translation
>
超清
<
/translation
>
<
/message
>
<
message
>
<
source
>
HD
<
/source
>
<
translation
>
高清
<
/translation
>
<
/message
>
<
message
>
<
source
>
SD
<
/source
>
<
translation
>
標清
<
/translation
>
<
/message
>
<
message
>
<
source
>
LD
<
/source
>
<
translation
>
流暢
<
/translation
>
<
/message
>
<
message
>
<
source
>
Desktop
Lyric
<
/source
>
<
translation
>
桌面歌詞
<
/translation
>
<
/message
>
<
message
>
<
source
>
Choose
font
<
/source
>
<
translation
>
選擇字體
<
/translation
>
<
/message
>
<
message
>
<
source
>
Font
<
/source
>
<
translation
>
字體
<
/translation
>
<
/message
>
<
message
>
<
source
>
Foreground
color
<
/source
>
<
translation
>
前景色
<
/translation
>
<
/message
>
<
message
>
<
source
>
Background
color
<
/source
>
<
translation
>
背景色
<
/translation
>
<
/message
>
<
message
>
<
source
>
Stroke
color
<
/source
>
<
translation
>
描邊色
<
/translation
>
<
/message
>
<
message
>
<
source
>
Stroke
size
<
/source
>
<
translation
>
描邊大小
<
/translation
>
<
/message
>
<
message
>
<
source
>
Alignment
<
/source
>
<
translation
>
對齊方式
<
/translation
>
<
/message
>
<
message
>
<
source
>
Center
aligned
<
/source
>
<
translation
>
居中對齊
<
/translation
>
<
/message
>
<
message
>
<
source
>
Left
aligned
<
/source
>
<
translation
>
左對齊
<
/translation
>
<
/message
>
<
message
>
<
source
>
Right
aligned
<
/source
>
<
translation
>
右對齊
<
/translation
>
<
/message
>
<
message
>
<
source
>
Main
Panel
<
/source
>
<
translation
>
主面板
<
/translation
>
<
/message
>
<
message
>
<
source
>
Minimize
to
tray
after
closing
<
/source
>
<
translation
>
關閉後最小化到托盤
<
/translation
>
<
/message
>
<
message
>
<
source
>
PyQt
-
Fluent
-
Widgets
will
continue
to
run
in
the
background
<
/source
>
<
translation
>
PyQt
-
Fluent
-
Widgets
將在後臺繼續運行
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../View/setting_interface/setting_interface.py
"
line
=
"
156
"
/>
<
source
>
Software
update
<
/source
>
<
translation
>
軟件更新
<
/translation
>
<
/message
>
<
message
>
<
source
>
Check
for
updates
when
the
application
starts
<
/source
>
<
translation
>
在應用程序啟動時檢查更新
<
/translation
>
<
/message
>
<
message
>
<
source
>
The
new
version
will
be
more
stable
and
have
more
features
<
/source
>
<
translation
>
新版本將更加穩定並擁有更多功能
(
建議啟用此選項
)
<
/translation
>
<
/message
>
<
message
>
<
source
>
About
<
/source
>
<
translation
>
關於
<
/translation
>
<
/message
>
<
message
>
<
source
>
Open
help
page
<
/source
>
<
translation
>
打開幫助頁面
<
/translation
>
<
/message
>
<
message
>
<
source
>
Discover
new
features
and
learn
useful
tips
about
PyQt
-
Fluent
-
Widgets
<
/source
>
<
translation
>
發現新功能並了解有關
PyQt
-
Fluent
-
Widgets
的使用技巧
<
/translation
>
<
/message
>
<
message
>
<
source
>
Provide
feedback
<
/source
>
<
translation
>
提供反饋
<
/translation
>
<
/message
>
<
message
>
<
source
>
Help
us
improve
PyQt
-
Fluent
-
Widgets
by
providing
feedback
<
/source
>
<
translation
>
通過提供反饋幫助我們改進
PyQt
-
Fluent
-
Widgets
<
/translation
>
<
/message
>
<
message
>
<
source
>
Check
update
<
/source
>
<
translation
>
檢查更新
<
/translation
>
<
/message
>
<
message
>
<
source
>
Copyright
<
/source
>
<
translation
>
版權所有
<
/translation
>
<
/message
>
<
message
>
<
source
>
Version
<
/source
>
<
translation
>
當前版本
<
/translation
>
<
/message
>
<
message
>
<
source
>
Configuration
updated
successfully
<
/source
>
<
translation
>
配置更新成功
<
/translation
>
<
/message
>
<
message
>
<
source
>
Configuration
takes
effect
after
restart
<
/source
>
<
translation
>
配置在重啟軟件後生效
<
/translation
>
<
/message
>
<
/context
>
<!--
The
translation
of
components
in
PyQt
-
Fluent
-
Widgets
-->
<
context
>
<
name
>
ColorDialog
<
/name
>
<
message
>
<
source
>
OK
<
/source
>
<
translation
>
確認
<
/translation
>
<
/message
>
<
message
>
<
source
>
Cancel
<
/source
>
<
translation
>
取消
<
/translation
>
<
/message
>
<
message
>
<
source
>
Edit
Color
<
/source
>
<
translation
>
編輯顏色
<
/translation
>
<
/message
>
<
message
>
<
source
>
Red
<
/source
>
<
translation
>
紅色
<
/translation
>
<
/message
>
<
message
>
<
source
>
Blue
<
/source
>
<
translation
>
藍色
<
/translation
>
<
/message
>
<
message
>
<
source
>
Green
<
/source
>
<
translation
>
綠色
<
/translation
>
<
/message
>
<
/context
>
<
context
>
<
name
>
MessageDialog
<
/name
>
<
message
>
<
source
>
OK
<
/source
>
<
translation
>
確認
<
/translation
>
<
/message
>
<
message
>
<
source
>
Cancel
<
/source
>
<
translation
>
取消
<
/translation
>
<
/message
>
<
/context
>
<
context
>
<
name
>
Dialog
<
/name
>
<
message
>
<
source
>
OK
<
/source
>
<
translation
>
確認
<
/translation
>
<
/message
>
<
message
>
<
source
>
Cancel
<
/source
>
<
translation
>
取消
<
/translation
>
<
/message
>
<
/context
>
<
context
>
<
name
>
FolderListDialog
<
/name
>
<
message
>
<
source
>
Done
<
/source
>
<
translation
>
完成
<
/translation
>
<
/message
>
<
message
>
<
source
>
Choose
folder
<
/source
>
<
translation
>
選擇文件夾
<
/translation
>
<
/message
>
<
message
>
<
source
>
Are
you
sure
you
want
to
delete
the
folder
?
<
/source
>
<
translation
>
是否確認刪除此文件夾
?
<
/translation
>
<
/message
>
<
message
>
<
source
>
If
you
delete
the
<
/source
>
<
translation
>
如果將
<
/translation
>
<
/message
>
<
message
>
<
source
>
folder
and
remove
it
from
the
list
,
the
folder
will
no
longer
appear
in
the
list
,
but
will
not
be
deleted
.
<
/source
>
<
translation
>
文件夾從列表中移除
,
則該文件夾不會再出現在列表中
,
但不會被刪除
。
<
/translation
>
<
/message
>
<
/context
>
<
context
>
<
name
>
SwitchSettingCard
<
/name
>
<
message
>
<
source
>
Off
<
/source
>
<
translation
>
關
<
/translation
>
<
/message
>
<
message
>
<
source
>
On
<
/source
>
<
translation
>
開
<
/translation
>
<
/message
>
<
/context
>
<
context
>
<
name
>
CustomColorSettingCard
<
/name
>
<
message
>
<
source
>
Custom
color
<
/source
>
<
translation
>
自定義顏色
<
/translation
>
<
/message
>
<
message
>
<
source
>
Default
color
<
/source
>
<
translation
>
默認顏色
<
/translation
>
<
/message
>
<
message
>
<
source
>
Choose
color
<
/source
>
<
translation
>
選擇顏色
<
/translation
>
<
/message
>
<
/context
>
<
context
>
<
name
>
ColorPickerButton
<
/name
>
<
message
>
<
source
>
Choose
<
/source
>
<
translation
>
選擇
<
/translation
>
<
/message
>
<
/context
>
<
context
>
<
name
>
FolderListSettingCard
<
/name
>
<
message
>
<
source
>
Add
folder
<
/source
>
<
translation
>
添加文件夾
<
/translation
>
<
/message
>
<
message
>
<
source
>
Choose
folder
<
/source
>
<
translation
>
選擇文件夾
<
/translation
>
<
/message
>
<
message
>
<
source
>
Are
you
sure
you
want
to
delete
the
folder
?
<
/source
>
<
translation
>
是否確認刪除此文件夾
?
<
/translation
>
<
/message
>
<
message
>
<
source
>
If
you
delete
the
<
/source
>
<
translation
>
如果將
<
/translation
>
<
/message
>
<
message
>
<
source
>
folder
and
remove
it
from
the
list
,
the
folder
will
no
longer
appear
in
the
list
,
but
will
not
be
deleted
.
<
/source
>
<
translation
>
文件夾從列表中移除
,
則該文件夾不會再出現在列表中
,
但不會被刪除
。
<
/translation
>
<
/message
>
<
/context
>
<
context
>
<
name
>
LineEditMenu
<
/name
>
<
message
>
<
source
>
Cut
<
/source
>
<
translation
>
剪切
<
/translation
>
<
/message
>
<
message
>
<
source
>
Copy
<
/source
>
<
translation
>
復製
<
/translation
>
<
/message
>
<
message
>
<
source
>
Paste
<
/source
>
<
translation
>
粘貼
<
/translation
>
<
/message
>
<
message
>
<
source
>
Cancel
<
/source
>
<
translation
>
撤回
<
/translation
>
<
/message
>
<
message
>
<
source
>
Select
all
<
/source
>
<
translation
>
全選
<
/translation
>
<
/message
>
<
/context
>
<
/TS>
\ No newline at end of file
examples/gallery/app/resource/i18n/qfluentwidgets_zh.qm
浏览文件 @
0c04b4f6
无法预览此类型文件
examples/gallery/app/resource/i18n/qfluentwidgets_zh.ts
浏览文件 @
0c04b4f6
...
...
@@ -130,242 +130,27 @@
<
translation
>
文件夹从列表中移除
,
则该文件夹不会再出现在列表中
,
但不会被删除
。
<
/translation
>
<
/message
>
<
/context
>
<!--
Put
the
translation
of
your
interface
below
-->
<
context
>
<
name
>
SettingInterface
<
/name
>
<
name
>
LineEditMenu
<
/name
>
<
message
>
<
source
>
Settings
<
/source
>
<
translation
>
设置
<
/translation
>
<
source
>
Cut
<
/source
>
<
translation
>
剪切
<
/translation
>
<
/message
>
<
message
>
<
source
>
Music
on
this
PC
<
/source
>
<
translation
>
此
PC
上的音乐
<
/translation
>
<
source
>
Copy
<
/source
>
<
translation
>
复制
<
/translation
>
<
/message
>
<
message
>
<
source
>
Local
music
library
<
/source
>
<
translation
>
本地音乐库
<
/translation
>
<
source
>
Paste
<
/source
>
<
translation
>
粘贴
<
/translation
>
<
/message
>
<
message
>
<
source
>
Choose
folder
<
/source
>
<
translation
>
选择文件夹
<
/translation
>
<
/message
>
<
message
>
<
source
>
Download
directory
<
/source
>
<
translation
>
下载目录
<
/translation
>
<
/message
>
<
message
>
<
source
>
Personalization
<
/source
>
<
translation
>
个性化
<
/translation
>
<
/message
>
<
message
>
<
source
>
Use
Acrylic
effect
<
/source
>
<
translation
>
启用亚克力效果
<
/translation
>
<
/message
>
<
message
>
<
source
>
Acrylic
effect
has
better
visual
experience
,
but
it
may
cause
the
window
to
become
stuck
<
/source
>
<
translation
>
亚克力效果的视觉体验更好
,
但可能导致窗口卡顿
<
/translation
>
<
/message
>
<
message
>
<
source
>
Application
theme
<
/source
>
<
translation
>
应用主题
<
/translation
>
<
/message
>
<
message
>
<
source
>
Theme
color
<
/source
>
<
translation
>
主题色
<
/translation
>
<
/message
>
<
message
>
<
source
>
Change
the
theme
color
of
you
application
<
/source
>
<
translation
>
调整你的应用主题颜色
<
/translation
>
<
/message
>
<
message
>
<
source
>
Change
the
appearance
of
your
application
<
/source
>
<
translation
>
调整你的应用外观
<
/translation
>
<
/message
>
<
message
>
<
source
>
Light
<
/source
>
<
translation
>
浅色
<
/translation
>
<
/message
>
<
message
>
<
source
>
Dark
<
/source
>
<
translation
>
深色
<
/translation
>
<
/message
>
<
message
>
<
source
>
Use
system
setting
<
/source
>
<
translation
>
跟随系统设置
<
/translation
>
<
/message
>
<
message
>
<
source
>
Interface
zoom
<
/source
>
<
translation
>
界面缩放
<
/translation
>
<
/message
>
<
message
>
<
source
>
Change
the
size
of
widgets
and
fonts
<
/source
>
<
translation
>
调整组件和字体的大小
<
/translation
>
<
/message
>
<
message
>
<
source
>
Language
<
/source
>
<
translation
>
语言
<
/translation
>
<
/message
>
<
message
>
<
source
>
Set
your
preferred
language
for
UI
<
/source
>
<
translation
>
选择界面所使用的语言
<
/translation
>
<
/message
>
<
message
>
<
source
>
Online
Music
<
/source
>
<
translation
>
在线音乐
<
/translation
>
<
/message
>
<
message
>
<
source
>
Number
of
online
music
displayed
on
each
page
<
/source
>
<
translation
>
每页显示的在线歌曲数量
<
/translation
>
<
/message
>
<
message
>
<
source
>
Online
music
quality
<
/source
>
<
translation
>
在线播放音质
<
/translation
>
<
/message
>
<
message
>
<
source
>
Standard
quality
<
/source
>
<
translation
>
流畅
<
/translation
>
<
/message
>
<
message
>
<
source
>
High
quality
<
/source
>
<
translation
>
高品
<
/translation
>
<
/message
>
<
message
>
<
source
>
Super
quality
<
/source
>
<
translation
>
超品
<
/translation
>
<
/message
>
<
message
>
<
source
>
Lossless
quality
<
/source
>
<
translation
>
无损
<
/translation
>
<
/message
>
<
message
>
<
source
>
Online
MV
quality
<
/source
>
<
translation
>
在线
MV
画质
<
/translation
>
<
/message
>
<
message
>
<
source
>
Full
HD
<
/source
>
<
translation
>
超清
<
/translation
>
<
/message
>
<
message
>
<
source
>
HD
<
/source
>
<
translation
>
高清
<
/translation
>
<
/message
>
<
message
>
<
source
>
SD
<
/source
>
<
translation
>
标清
<
/translation
>
<
/message
>
<
message
>
<
source
>
LD
<
/source
>
<
translation
>
流畅
<
/translation
>
<
/message
>
<
message
>
<
source
>
Desktop
Lyric
<
/source
>
<
translation
>
桌面歌词
<
/translation
>
<
/message
>
<
message
>
<
source
>
Choose
font
<
/source
>
<
translation
>
选择字体
<
/translation
>
<
/message
>
<
message
>
<
source
>
Font
<
/source
>
<
translation
>
字体
<
/translation
>
<
/message
>
<
message
>
<
source
>
Foreground
color
<
/source
>
<
translation
>
前景色
<
/translation
>
<
/message
>
<
message
>
<
source
>
Background
color
<
/source
>
<
translation
>
背景色
<
/translation
>
<
/message
>
<
message
>
<
source
>
Stroke
color
<
/source
>
<
translation
>
描边色
<
/translation
>
<
/message
>
<
message
>
<
source
>
Stroke
size
<
/source
>
<
translation
>
描边大小
<
/translation
>
<
/message
>
<
message
>
<
source
>
Alignment
<
/source
>
<
translation
>
对齐方式
<
/translation
>
<
/message
>
<
message
>
<
source
>
Center
aligned
<
/source
>
<
translation
>
居中对齐
<
/translation
>
<
/message
>
<
message
>
<
source
>
Left
aligned
<
/source
>
<
translation
>
左对齐
<
/translation
>
<
/message
>
<
message
>
<
source
>
Right
aligned
<
/source
>
<
translation
>
右对齐
<
/translation
>
<
/message
>
<
message
>
<
source
>
Main
Panel
<
/source
>
<
translation
>
主面板
<
/translation
>
<
/message
>
<
message
>
<
source
>
Minimize
to
tray
after
closing
<
/source
>
<
translation
>
关闭后最小化到托盘
<
/translation
>
<
/message
>
<
message
>
<
source
>
PyQt
-
Fluent
-
Widgets
will
continue
to
run
in
the
background
<
/source
>
<
translation
>
PyQt
-
Fluent
-
Widgets
将在后台继续运行
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../View/setting_interface/setting_interface.py
"
line
=
"
156
"
/>
<
source
>
Software
update
<
/source
>
<
translation
>
软件更新
<
/translation
>
<
/message
>
<
message
>
<
source
>
Check
for
updates
when
the
application
starts
<
/source
>
<
translation
>
在应用程序启动时检查更新
<
/translation
>
<
/message
>
<
message
>
<
source
>
The
new
version
will
be
more
stable
and
have
more
features
<
/source
>
<
translation
>
新版本将更加稳定并拥有更多功能
(
建议启用此选项
)
<
/translation
>
<
/message
>
<
message
>
<
source
>
About
<
/source
>
<
translation
>
关于
<
/translation
>
<
/message
>
<
message
>
<
source
>
Open
help
page
<
/source
>
<
translation
>
打开帮助页面
<
/translation
>
<
/message
>
<
message
>
<
source
>
Discover
new
features
and
learn
useful
tips
about
PyQt
-
Fluent
-
Widgets
<
/source
>
<
translation
>
发现新功能并了解有关
PyQt
-
Fluent
-
Widgets
的使用技巧
<
/translation
>
<
/message
>
<
message
>
<
source
>
Provide
feedback
<
/source
>
<
translation
>
提供反馈
<
/translation
>
<
/message
>
<
message
>
<
source
>
Help
us
improve
PyQt
-
Fluent
-
Widgets
by
providing
feedback
<
/source
>
<
translation
>
通过提供反馈帮助我们改进
PyQt
-
Fluent
-
Widgets
<
/translation
>
<
/message
>
<
message
>
<
source
>
Check
update
<
/source
>
<
translation
>
检查更新
<
/translation
>
<
/message
>
<
message
>
<
source
>
Copyright
<
/source
>
<
translation
>
版权所有
<
/translation
>
<
/message
>
<
message
>
<
source
>
Version
<
/source
>
<
translation
>
当前版本
<
/translation
>
<
/message
>
<
message
>
<
source
>
Configuration
updated
successfully
<
/source
>
<
translation
>
配置更新成功
<
/translation
>
<
source
>
Cancel
<
/source
>
<
translation
>
撤回
<
/translation
>
<
/message
>
<
message
>
<
source
>
Configuration
takes
effect
after
restart
<
/source
>
<
translation
>
配置在重启软件后生效
<
/translation
>
<
source
>
Select
all
<
/source
>
<
translation
>
全选
<
/translation
>
<
/message
>
<
/context
>
<
/TS>
\ No newline at end of file
examples/gallery/app/resource/images/icons/Album_black.svg
0 → 100644
浏览文件 @
0c04b4f6
<?xml version="1.0" encoding="utf-8"?>
<svg
id=
""
width=
"16"
height=
"16"
style=
"width:16px;height:16px;"
version=
"1.1"
xmlns=
"http://www.w3.org/2000/svg"
viewBox=
"0 0 2048 2048"
enable-background=
"new 0 0 2048 2048"
xml:space=
"preserve"
><path
fill=
"#000000"
d=
"M429.71 2048 q-85.71 0 -163.99 -34.86 q-78.29 -34.86 -137.15 -93.72 q-58.86 -58.86 -93.72 -137.14 q-34.85 -78.28 -34.85 -163.99 l0 -1188.58 q0 -85.71 34.85 -163.99 q34.85 -78.29 93.72 -137.15 q58.86 -58.86 137.15 -93.72 q78.28 -34.85 163.99 -34.85 l1188.58 0 q85.71 0 163.99 34.85 q78.29 34.85 137.14 93.72 q58.86 58.86 93.72 137.15 q34.86 78.28 34.86 163.99 l0 1188.58 q0 85.71 -34.86 163.99 q-34.86 78.29 -93.72 137.14 q-58.86 58.86 -137.14 93.72 q-78.28 34.86 -163.99 34.86 l-1188.58 0 ZM1614.86 1901.71 q57.14 0 109.14 -23.43 q52 -23.42 91.43 -62.86 q39.43 -39.43 62.86 -91.43 q23.43 -52 23.43 -109.14 l0 -1181.72 q0 -57.14 -23.43 -109.14 q-23.42 -52 -62.86 -91.43 q-39.43 -39.43 -91.43 -62.86 q-52 -23.42 -109.14 -23.42 l-1181.72 0 q-57.14 0 -109.14 23.42 q-52 23.43 -91.43 62.86 q-39.43 39.43 -62.86 91.43 q-23.42 52 -23.42 109.14 l0 1181.72 q0 57.14 23.42 109.14 q23.43 52 62.86 91.43 q39.43 39.43 91.43 62.86 q52 23.43 109.14 23.43 l1181.72 0 ZM292.57 1024 q0 -152 57.15 -285.14 q57.14 -133.14 156.57 -232.57 q99.43 -99.43 232.57 -156.57 q133.14 -57.15 285.14 -57.15 q152 0 285.14 57.15 q133.14 57.14 232.57 156.57 q99.42 99.43 156.57 232.57 q57.14 133.14 57.14 285.14 q0 152 -57.14 285.14 q-57.14 133.14 -156.57 232.57 q-99.43 99.42 -232.57 156.57 q-133.14 57.14 -285.14 57.14 q-152 0 -285.14 -57.14 q-133.14 -57.14 -232.57 -156.57 q-99.43 -99.43 -156.57 -232.57 q-57.15 -133.14 -57.15 -285.14 ZM1609.14 1024 l0 -11.43 q0 -118.86 -47.42 -223.43 q-47.43 -104.57 -128 -182.29 q-80.58 -77.72 -186.29 -122.86 q-105.72 -45.14 -223.43 -45.14 q-121.14 0 -228 45.71 q-106.86 45.71 -186.29 125.14 q-79.42 79.43 -125.14 186.29 q-45.71 106.86 -45.71 228 q0 121.14 45.71 228 q45.71 106.86 125.14 186.28 q79.43 79.43 186.29 125.14 q106.86 45.71 228 45.71 q121.14 0 228 -45.71 q106.86 -45.72 186.28 -125.14 q79.43 -79.42 125.14 -186.28 q45.71 -106.86 45.71 -228 ZM877.71 1024 q0 -30.86 11.43 -57.14 q11.43 -26.28 31.43 -46.28 q20 -20 46.28 -31.43 q26.28 -11.43 57.14 -11.43 q29.71 0 56.57 11.43 q26.86 11.43 46.86 31.43 q20 20 31.43 46.86 q11.43 26.86 11.43 56.57 q0 30.86 -11.43 57.14 q-11.43 26.29 -31.43 46.29 q-20 20 -46.29 31.43 q-26.29 11.43 -57.14 11.43 q-30.86 0 -57.72 -11.43 q-26.86 -11.43 -46.28 -30.86 q-19.43 -19.43 -30.86 -46.29 q-11.43 -26.86 -11.43 -57.71 Z"
/></svg>
\ No newline at end of file
examples/gallery/app/resource/images/icons/Album_white.svg
0 → 100644
浏览文件 @
0c04b4f6
<?xml version="1.0" encoding="utf-8"?>
<svg
id=
""
width=
"16"
height=
"16"
style=
"width:16px;height:16px;"
version=
"1.1"
xmlns=
"http://www.w3.org/2000/svg"
viewBox=
"0 0 2048 2048"
enable-background=
"new 0 0 2048 2048"
xml:space=
"preserve"
><path
fill=
"#ffffff"
d=
"M429.71 2048 q-85.71 0 -163.99 -34.86 q-78.29 -34.86 -137.15 -93.72 q-58.86 -58.86 -93.72 -137.14 q-34.85 -78.28 -34.85 -163.99 l0 -1188.58 q0 -85.71 34.85 -163.99 q34.85 -78.29 93.72 -137.15 q58.86 -58.86 137.15 -93.72 q78.28 -34.85 163.99 -34.85 l1188.58 0 q85.71 0 163.99 34.85 q78.29 34.85 137.14 93.72 q58.86 58.86 93.72 137.15 q34.86 78.28 34.86 163.99 l0 1188.58 q0 85.71 -34.86 163.99 q-34.86 78.29 -93.72 137.14 q-58.86 58.86 -137.14 93.72 q-78.28 34.86 -163.99 34.86 l-1188.58 0 ZM1614.86 1901.71 q57.14 0 109.14 -23.43 q52 -23.42 91.43 -62.86 q39.43 -39.43 62.86 -91.43 q23.43 -52 23.43 -109.14 l0 -1181.72 q0 -57.14 -23.43 -109.14 q-23.42 -52 -62.86 -91.43 q-39.43 -39.43 -91.43 -62.86 q-52 -23.42 -109.14 -23.42 l-1181.72 0 q-57.14 0 -109.14 23.42 q-52 23.43 -91.43 62.86 q-39.43 39.43 -62.86 91.43 q-23.42 52 -23.42 109.14 l0 1181.72 q0 57.14 23.42 109.14 q23.43 52 62.86 91.43 q39.43 39.43 91.43 62.86 q52 23.43 109.14 23.43 l1181.72 0 ZM292.57 1024 q0 -152 57.15 -285.14 q57.14 -133.14 156.57 -232.57 q99.43 -99.43 232.57 -156.57 q133.14 -57.15 285.14 -57.15 q152 0 285.14 57.15 q133.14 57.14 232.57 156.57 q99.42 99.43 156.57 232.57 q57.14 133.14 57.14 285.14 q0 152 -57.14 285.14 q-57.14 133.14 -156.57 232.57 q-99.43 99.42 -232.57 156.57 q-133.14 57.14 -285.14 57.14 q-152 0 -285.14 -57.14 q-133.14 -57.14 -232.57 -156.57 q-99.43 -99.43 -156.57 -232.57 q-57.15 -133.14 -57.15 -285.14 ZM1609.14 1024 l0 -11.43 q0 -118.86 -47.42 -223.43 q-47.43 -104.57 -128 -182.29 q-80.58 -77.72 -186.29 -122.86 q-105.72 -45.14 -223.43 -45.14 q-121.14 0 -228 45.71 q-106.86 45.71 -186.29 125.14 q-79.42 79.43 -125.14 186.29 q-45.71 106.86 -45.71 228 q0 121.14 45.71 228 q45.71 106.86 125.14 186.28 q79.43 79.43 186.29 125.14 q106.86 45.71 228 45.71 q121.14 0 228 -45.71 q106.86 -45.72 186.28 -125.14 q79.43 -79.42 125.14 -186.28 q45.71 -106.86 45.71 -228 ZM877.71 1024 q0 -30.86 11.43 -57.14 q11.43 -26.28 31.43 -46.28 q20 -20 46.28 -31.43 q26.28 -11.43 57.14 -11.43 q29.71 0 56.57 11.43 q26.86 11.43 46.86 31.43 q20 20 31.43 46.86 q11.43 26.86 11.43 56.57 q0 30.86 -11.43 57.14 q-11.43 26.29 -31.43 46.29 q-20 20 -46.29 31.43 q-26.29 11.43 -57.14 11.43 q-30.86 0 -57.72 -11.43 q-26.86 -11.43 -46.28 -30.86 q-19.43 -19.43 -30.86 -46.29 q-11.43 -26.86 -11.43 -57.71 Z"
/></svg>
\ No newline at end of file
examples/gallery/app/view/basic_input_interface.py
浏览文件 @
0c04b4f6
...
...
@@ -22,7 +22,7 @@ class BasicInputInterface(GalleryInterface):
self
.
addExampleCard
(
self
.
tr
(
'A simple button with text content'
),
PushButton
(
'Standard push button'
),
PushButton
(
self
.
tr
(
'Standard push button'
)
),
'https://github.com/zhiyiYo/PyQt-Fluent-Widgets/blob/master/examples/button/demo.py'
)
...
...
@@ -39,23 +39,23 @@ class BasicInputInterface(GalleryInterface):
self
.
addExampleCard
(
self
.
tr
(
'Accent style applied to button'
),
PrimaryPushButton
(
'Accent style button'
),
PrimaryPushButton
(
self
.
tr
(
'Accent style button'
)
),
'https://github.com/zhiyiYo/PyQt-Fluent-Widgets/blob/master/examples/button/demo.py'
)
self
.
addExampleCard
(
self
.
tr
(
'A hyperlink button that navigates to a URI'
),
HyperlinkButton
(
'http://github.com'
,
'GitHub home page'
),
HyperlinkButton
(
'http://github.com'
,
self
.
tr
(
'GitHub home page'
)
),
'https://github.com/zhiyiYo/PyQt-Fluent-Widgets/blob/master/examples/button/demo.py'
)
self
.
addExampleCard
(
self
.
tr
(
'A 2-state CheckBox'
),
CheckBox
(
'Two-state CheckBox'
),
CheckBox
(
self
.
tr
(
'Two-state CheckBox'
)
),
'https://github.com/zhiyiYo/PyQt-Fluent-Widgets/blob/master/examples/check_box/demo.py'
)
checkBox
=
CheckBox
(
'Three-state CheckBox'
)
checkBox
=
CheckBox
(
self
.
tr
(
'Three-state CheckBox'
)
)
checkBox
.
setTristate
(
True
)
self
.
addExampleCard
(
self
.
tr
(
'A 3-state CheckBox'
),
...
...
@@ -77,9 +77,9 @@ class BasicInputInterface(GalleryInterface):
radioLayout
=
QVBoxLayout
(
radioWidget
)
radioLayout
.
setContentsMargins
(
2
,
0
,
0
,
0
)
radioLayout
.
setSpacing
(
15
)
radioButton1
=
RadioButton
(
'Star Platinum'
,
radioWidget
)
radioButton2
=
RadioButton
(
'Crazy Diamond'
,
radioWidget
)
radioButton3
=
RadioButton
(
'Soft and Wet'
,
radioWidget
)
radioButton1
=
RadioButton
(
self
.
tr
(
'Star Platinum'
)
,
radioWidget
)
radioButton2
=
RadioButton
(
self
.
tr
(
'Crazy Diamond'
)
,
radioWidget
)
radioButton3
=
RadioButton
(
self
.
tr
(
'Soft and Wet'
)
,
radioWidget
)
buttonGroup
=
QButtonGroup
(
radioWidget
)
buttonGroup
.
addButton
(
radioButton1
)
buttonGroup
.
addButton
(
radioButton2
)
...
...
@@ -104,10 +104,16 @@ class BasicInputInterface(GalleryInterface):
'https://github.com/zhiyiYo/PyQt-Fluent-Widgets/blob/master/examples/slider/demo.py'
)
self
.
switchButton
=
SwitchButton
(
self
.
tr
(
'Off'
))
self
.
switchButton
.
checkedChanged
.
connect
(
self
.
onSwitchCheckedChanged
)
self
.
addExampleCard
(
self
.
tr
(
'A simple switch button'
),
SwitchButton
(
self
.
tr
(
'Off'
),
self
)
,
self
.
switchButton
,
'https://github.com/zhiyiYo/PyQt-Fluent-Widgets/blob/master/examples/switch_button/demo.py'
)
def
onSwitchCheckedChanged
(
self
,
isChecked
):
if
isChecked
:
self
.
switchButton
.
setText
(
self
.
tr
(
'On'
))
else
:
self
.
switchButton
.
setText
(
self
.
tr
(
'Off'
))
examples/gallery/app/view/dialog_interface.py
浏览文件 @
0c04b4f6
...
...
@@ -52,7 +52,7 @@ class DialogInterface(GalleryInterface):
print
(
'Cancel button is pressed'
)
def
showMessageDialog
(
self
):
title
=
self
.
tr
(
'This is a
frameless message dialog
'
)
title
=
self
.
tr
(
'This is a
message dialog with mask
'
)
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
())
...
...
examples/gallery/app/view/gallery_interface.py
浏览文件 @
0c04b4f6
...
...
@@ -4,7 +4,7 @@ from PyQt5.QtGui import QDesktopServices
from
PyQt5.QtWidgets
import
QWidget
,
QLabel
,
QVBoxLayout
,
QHBoxLayout
,
QFrame
from
qfluentwidgets
import
(
ScrollArea
,
PushButton
,
ToolButton
,
FluentIcon
,
isDarkTheme
,
IconWidget
,
Theme
)
isDarkTheme
,
IconWidget
,
Theme
,
ToolTipFilter
)
from
..common.icon
import
Icon
from
..common.config
import
cfg
,
FEEDBACK_URL
,
DOCUMENT_URL
,
EXAMPLE_URL
...
...
@@ -48,6 +48,11 @@ class ToolBar(QWidget):
self
.
buttonLayout
.
addWidget
(
self
.
feedbackButton
,
0
,
Qt
.
AlignRight
)
self
.
buttonLayout
.
setAlignment
(
Qt
.
AlignVCenter
|
Qt
.
AlignLeft
)
self
.
themeButton
.
installEventFilter
(
ToolTipFilter
(
self
.
themeButton
))
self
.
feedbackButton
.
installEventFilter
(
ToolTipFilter
(
self
.
feedbackButton
))
self
.
themeButton
.
setToolTip
(
self
.
tr
(
'Toggle theme'
))
self
.
feedbackButton
.
setToolTip
(
self
.
tr
(
'Send feedback'
))
self
.
titleLabel
.
setObjectName
(
'titleLabel'
)
self
.
subtitleLabel
.
setObjectName
(
'subtitleLabel'
)
...
...
examples/gallery/app/view/main_window.py
浏览文件 @
0c04b4f6
# coding: utf-8
from
PyQt5.QtCore
import
Qt
,
pyqtSignal
from
PyQt5.QtCore
import
Qt
,
pyqtSignal
,
QEasingCurve
from
PyQt5.QtGui
import
QIcon
from
PyQt5.QtWidgets
import
QApplication
,
Q
StackedWidget
,
Q
HBoxLayout
,
QFrame
,
QWidget
from
PyQt5.QtWidgets
import
QApplication
,
QHBoxLayout
,
QFrame
,
QWidget
from
qfluentwidgets
import
(
NavigationInterface
,
NavigationItemPostion
,
MessageBox
,
isDarkTheme
)
isDarkTheme
,
PopUpAniStackedWidget
)
from
qfluentwidgets
import
FluentIcon
as
FIF
from
qframelesswindow
import
FramelessWindow
...
...
@@ -29,7 +29,7 @@ class StackedWidget(QFrame):
def
__init__
(
self
,
parent
=
None
):
super
().
__init__
(
parent
=
parent
)
self
.
hBoxLayout
=
QHBoxLayout
(
self
)
self
.
view
=
Q
StackedWidget
(
self
)
self
.
view
=
PopUpAni
StackedWidget
(
self
)
self
.
hBoxLayout
.
setContentsMargins
(
0
,
0
,
0
,
0
)
self
.
hBoxLayout
.
addWidget
(
self
.
view
)
...
...
@@ -41,11 +41,14 @@ class StackedWidget(QFrame):
""" add widget to view """
self
.
view
.
addWidget
(
widget
)
def
setCurrentWidget
(
self
,
widget
):
self
.
view
.
setCurrentWidget
(
widget
)
def
setCurrentWidget
(
self
,
widget
,
popOut
=
False
):
if
not
popOut
:
self
.
view
.
setCurrentWidget
(
widget
,
duration
=
300
)
else
:
self
.
view
.
setCurrentWidget
(
widget
,
True
,
False
,
200
,
QEasingCurve
.
InQuad
)
def
setCurrentIndex
(
self
,
index
):
self
.
view
.
setCurrentIndex
(
index
)
def
setCurrentIndex
(
self
,
index
,
popOut
=
False
):
self
.
setCurrentWidget
(
self
.
view
.
widget
(
index
),
popOut
)
class
MainWindow
(
FramelessWindow
):
...
...
@@ -122,49 +125,49 @@ class MainWindow(FramelessWindow):
routeKey
=
self
.
basicInputInterface
.
objectName
(),
icon
=
Icon
.
CHECKBOX
,
text
=
self
.
tr
(
'Basic input'
),
onClick
=
lambda
:
self
.
switchTo
(
self
.
basicInputInterface
),
onClick
=
lambda
t
:
self
.
switchTo
(
self
.
basicInputInterface
,
t
),
position
=
NavigationItemPostion
.
SCROLL
)
self
.
navigationInterface
.
addItem
(
routeKey
=
self
.
dialogInterface
.
objectName
(),
icon
=
Icon
.
MESSAGE
,
text
=
self
.
tr
(
'Dialogs'
),
onClick
=
lambda
:
self
.
switchTo
(
self
.
dialogInterface
),
onClick
=
lambda
t
:
self
.
switchTo
(
self
.
dialogInterface
,
t
),
position
=
NavigationItemPostion
.
SCROLL
)
self
.
navigationInterface
.
addItem
(
routeKey
=
self
.
layoutInterface
.
objectName
(),
icon
=
Icon
.
LAYOUT
,
text
=
self
.
tr
(
'Layout'
),
onClick
=
lambda
:
self
.
switchTo
(
self
.
layoutInterface
),
onClick
=
lambda
t
:
self
.
switchTo
(
self
.
layoutInterface
,
t
),
position
=
NavigationItemPostion
.
SCROLL
)
self
.
navigationInterface
.
addItem
(
routeKey
=
self
.
menuInterface
.
objectName
(),
icon
=
Icon
.
MENU
,
text
=
self
.
tr
(
'Menus'
),
onClick
=
lambda
:
self
.
switchTo
(
self
.
menuInterface
),
onClick
=
lambda
t
:
self
.
switchTo
(
self
.
menuInterface
,
t
),
position
=
NavigationItemPostion
.
SCROLL
)
self
.
navigationInterface
.
addItem
(
routeKey
=
self
.
materialInterface
.
objectName
(),
icon
=
FIF
.
PALETTE
,
text
=
self
.
tr
(
'Material'
),
onClick
=
lambda
:
self
.
switchTo
(
self
.
materialInterface
),
onClick
=
lambda
t
:
self
.
switchTo
(
self
.
materialInterface
,
t
),
position
=
NavigationItemPostion
.
SCROLL
)
self
.
navigationInterface
.
addItem
(
routeKey
=
self
.
scrollInterface
.
objectName
(),
icon
=
Icon
.
SCROLL
,
text
=
self
.
tr
(
'Scrolling'
),
onClick
=
lambda
:
self
.
switchTo
(
self
.
scrollInterface
),
onClick
=
lambda
t
:
self
.
switchTo
(
self
.
scrollInterface
,
t
),
position
=
NavigationItemPostion
.
SCROLL
)
self
.
navigationInterface
.
addItem
(
routeKey
=
self
.
statusInfoInterface
.
objectName
(),
icon
=
Icon
.
CHAT
,
text
=
self
.
tr
(
'Status & info'
),
onClick
=
lambda
:
self
.
switchTo
(
self
.
statusInfoInterface
),
onClick
=
lambda
t
:
self
.
switchTo
(
self
.
statusInfoInterface
,
t
),
position
=
NavigationItemPostion
.
SCROLL
)
...
...
@@ -180,7 +183,7 @@ class MainWindow(FramelessWindow):
routeKey
=
self
.
settingInterface
.
objectName
(),
icon
=
FIF
.
SETTING
,
text
=
'Settings'
,
onClick
=
lambda
:
self
.
switchTo
(
self
.
settingInterface
),
onClick
=
lambda
t
:
self
.
switchTo
(
self
.
settingInterface
,
t
),
position
=
NavigationItemPostion
.
BOTTOM
)
...
...
@@ -213,8 +216,8 @@ class MainWindow(FramelessWindow):
with
open
(
f
'app/resource/qss/
{
color
}
/main_window.qss'
,
encoding
=
'utf-8'
)
as
f
:
self
.
setStyleSheet
(
f
.
read
())
def
switchTo
(
self
,
widget
):
self
.
stackWidget
.
setCurrentWidget
(
widget
)
def
switchTo
(
self
,
widget
,
triggerByUser
=
True
):
self
.
stackWidget
.
setCurrentWidget
(
widget
,
not
triggerByUser
)
def
resizeEvent
(
self
,
e
):
self
.
titleBar
.
move
(
46
,
0
)
...
...
examples/gallery/app/view/material_interface.py
浏览文件 @
0c04b4f6
...
...
@@ -5,6 +5,7 @@ from qfluentwidgets import FluentIcon as FIF
from
.gallery_interface
import
GalleryInterface
from
..common.translator
import
Translator
from
..common.config
import
cfg
class
MaterialInterface
(
GalleryInterface
):
...
...
@@ -13,18 +14,25 @@ class MaterialInterface(GalleryInterface):
def
__init__
(
self
,
parent
=
None
):
t
=
Translator
()
super
().
__init__
(
title
=
t
.
m
enus
,
title
=
t
.
m
aterial
,
subtitle
=
'qfluentwidgets.components.widgets'
,
parent
=
parent
)
label
=
AcrylicLabel
(
15
,
QColor
(
105
,
114
,
168
,
102
))
label
.
setImage
(
'app/resource/images/chidanta.jpg'
)
label
.
setMaximumSize
(
787
,
579
)
label
.
setMinimumSize
(
197
,
145
)
self
.
label
=
AcrylicLabel
(
cfg
.
get
(
cfg
.
blurRadius
),
QColor
(
105
,
114
,
168
,
102
))
self
.
label
.
setImage
(
'app/resource/images/chidanta.jpg'
)
self
.
label
.
setMaximumSize
(
787
,
579
)
self
.
label
.
setMinimumSize
(
197
,
145
)
cfg
.
blurRadius
.
valueChanged
.
connect
(
self
.
onBlurRadiusChanged
)
self
.
addExampleCard
(
self
.
tr
(
'Acrylic label'
),
label
,
self
.
label
,
'https://github.com/zhiyiYo/PyQt-Fluent-Widgets/blob/master/examples/acrylic_label/demo.py'
,
stretch
=
1
)
def
onBlurRadiusChanged
(
self
,
radius
:
int
):
self
.
label
.
blurRadius
=
radius
self
.
label
.
setImage
(
'app/resource/images/chidanta.jpg'
)
examples/gallery/app/view/menu_interface.py
浏览文件 @
0c04b4f6
...
...
@@ -19,7 +19,7 @@ class MenuInterface(GalleryInterface):
parent
=
parent
)
button
=
PushButton
(
'Show menu'
)
button
=
PushButton
(
self
.
tr
(
'Show menu'
)
)
button
.
clicked
.
connect
(
lambda
:
self
.
createMenu
(
button
.
mapToGlobal
(
QPoint
())
+
QPoint
(
button
.
width
()
+
5
,
-
100
)))
...
...
@@ -33,35 +33,37 @@ class MenuInterface(GalleryInterface):
menu
=
RoundMenu
(
parent
=
self
)
# add actions
menu
.
addAction
(
QAction
(
FIF
.
COPY
.
icon
(),
'Copy'
))
menu
.
addAction
(
QAction
(
FIF
.
CUT
.
icon
(),
'Cut'
))
menu
.
addAction
(
QAction
(
FIF
.
COPY
.
icon
(),
self
.
tr
(
'Copy'
)
))
menu
.
addAction
(
QAction
(
FIF
.
CUT
.
icon
(),
self
.
tr
(
'Cut'
)
))
# add sub menu
submenu
=
RoundMenu
(
"Add to"
,
self
)
submenu
=
RoundMenu
(
self
.
tr
(
"Add to"
)
,
self
)
submenu
.
setIcon
(
FIF
.
ADD
.
icon
())
submenu
.
addActions
([
QAction
(
FIF
.
VIDEO
.
icon
(),
'Video'
),
QAction
(
FIF
.
MUSIC
.
icon
(),
'Music'
),
QAction
(
FIF
.
VIDEO
.
icon
(),
self
.
tr
(
'Video'
)
),
QAction
(
FIF
.
MUSIC
.
icon
(),
self
.
tr
(
'Music'
)
),
])
menu
.
addMenu
(
submenu
)
# add actions
menu
.
addActions
([
QAction
(
FIF
.
PASTE
.
icon
(),
'Paste'
),
QAction
(
FIF
.
CANCEL
.
icon
(),
'Undo'
)
QAction
(
FIF
.
PASTE
.
icon
(),
self
.
tr
(
'Paste'
)
),
QAction
(
FIF
.
CANCEL
.
icon
(),
self
.
tr
(
'Undo'
)
)
])
# add separator
menu
.
addSeparator
()
menu
.
addAction
(
QAction
(
f
'Select all'
))
menu
.
addAction
(
QAction
(
self
.
tr
(
'Select all'
)
))
# insert actions
menu
.
insertAction
(
menu
.
menuActions
()[
-
1
],
QAction
(
FIF
.
SETTING
.
icon
(),
'Settings'
))
menu
.
menuActions
()[
-
1
],
QAction
(
FIF
.
SETTING
.
icon
(),
self
.
tr
(
'Settings'
)
))
menu
.
insertActions
(
menu
.
menuActions
()[
-
1
],
[
QAction
(
FIF
.
HELP
.
icon
(),
'Help'
),
QAction
(
FIF
.
FEEDBACK
.
icon
(),
'Feedback'
)]
[
QAction
(
FIF
.
HELP
.
icon
(),
self
.
tr
(
'Help'
)),
QAction
(
FIF
.
FEEDBACK
.
icon
(),
self
.
tr
(
'Feedback'
))
]
)
# show menu
...
...
examples/gallery/app/view/scroll_interface.py
浏览文件 @
0c04b4f6
...
...
@@ -2,7 +2,7 @@
from
PyQt5.QtCore
import
Qt
,
QEasingCurve
from
PyQt5.QtGui
import
QPixmap
from
PyQt5.QtWidgets
import
QWidget
,
QLabel
from
qfluentwidgets
import
ScrollArea
,
SmoothScrollArea
from
qfluentwidgets
import
ScrollArea
,
SmoothScrollArea
,
ToolTipFilter
from
.gallery_interface
import
GalleryInterface
from
..common.translator
import
Translator
...
...
@@ -24,10 +24,13 @@ class ScrollInterface(GalleryInterface):
label
.
setPixmap
(
QPixmap
(
"app/resource/images/chidanta2.jpg"
).
scaled
(
775
,
1229
,
Qt
.
KeepAspectRatio
,
Qt
.
SmoothTransformation
))
label
.
installEventFilter
(
ToolTipFilter
(
label
,
showDelay
=
500
))
label
.
setToolTip
(
self
.
tr
(
'Chitanda Eru is too hot 🥵'
))
label
.
setToolTipDuration
(
2000
)
w
.
horizontalScrollBar
().
setValue
(
0
)
w
.
setWidget
(
label
)
w
.
setFixed
Height
(
40
0
)
w
.
setFixed
Size
(
780
,
42
0
)
w
.
setObjectName
(
'imageViewer'
)
self
.
addExampleCard
(
...
...
examples/gallery/app/view/setting_interface.py
浏览文件 @
0c04b4f6
...
...
@@ -3,12 +3,13 @@ from qfluentwidgets import (SettingCardGroup, SwitchSettingCard, FolderListSetti
OptionsSettingCard
,
PushSettingCard
,
HyperlinkCard
,
PrimaryPushSettingCard
,
ScrollArea
,
ComboBoxSettingCard
,
ExpandLayout
,
Theme
,
ToastToolTip
,
CustomColorSettingCard
,
setTheme
,
setThemeColor
)
setTheme
,
setThemeColor
,
RangeSettingCard
)
from
qfluentwidgets
import
FluentIcon
as
FIF
from
PyQt5.QtCore
import
Qt
,
pyqtSignal
,
QUrl
,
QStandardPaths
from
PyQt5.QtGui
import
QDesktopServices
from
PyQt5.QtWidgets
import
QWidget
,
QLabel
,
QFileDialog
from
..common.icon
import
Icon
from
..common.config
import
cfg
,
HELP_URL
,
FEEDBACK_URL
,
AUTHOR
,
VERSION
,
YEAR
...
...
@@ -35,7 +36,8 @@ class SettingInterface(ScrollArea):
self
.
musicFolderCard
=
FolderListSettingCard
(
cfg
.
musicFolders
,
self
.
tr
(
"Local music library"
),
directory
=
QStandardPaths
.
writableLocation
(
QStandardPaths
.
MusicLocation
),
directory
=
QStandardPaths
.
writableLocation
(
QStandardPaths
.
MusicLocation
),
parent
=
self
.
musicInThisPCGroup
)
self
.
downloadFolderCard
=
PushSettingCard
(
...
...
@@ -47,7 +49,8 @@ class SettingInterface(ScrollArea):
)
# personalization
self
.
personalGroup
=
SettingCardGroup
(
self
.
tr
(
'Personalization'
),
self
.
scrollWidget
)
self
.
personalGroup
=
SettingCardGroup
(
self
.
tr
(
'Personalization'
),
self
.
scrollWidget
)
self
.
themeCard
=
OptionsSettingCard
(
cfg
.
themeMode
,
FIF
.
BRUSH
,
...
...
@@ -59,7 +62,7 @@ class SettingInterface(ScrollArea):
],
parent
=
self
.
personalGroup
)
self
.
themeColorCard
=
CustomColorSettingCard
(
self
.
themeColorCard
=
CustomColorSettingCard
(
cfg
.
themeColor
,
FIF
.
PALETTE
,
self
.
tr
(
'Theme color'
),
...
...
@@ -86,8 +89,20 @@ class SettingInterface(ScrollArea):
parent
=
self
.
personalGroup
)
# material
self
.
materialGroup
=
SettingCardGroup
(
self
.
tr
(
'Material'
),
self
.
scrollWidget
)
self
.
blurRadiusCard
=
RangeSettingCard
(
cfg
.
blurRadius
,
Icon
.
ALBUM
,
self
.
tr
(
'Acrylic blur radius'
),
self
.
tr
(
'The greater the radius, the more blurred the image'
),
self
.
materialGroup
)
# update software
self
.
updateSoftwareGroup
=
SettingCardGroup
(
self
.
tr
(
"Software update"
),
self
.
scrollWidget
)
self
.
updateSoftwareGroup
=
SettingCardGroup
(
self
.
tr
(
"Software update"
),
self
.
scrollWidget
)
self
.
updateOnStartUpCard
=
SwitchSettingCard
(
FIF
.
UPDATE
,
self
.
tr
(
'Check for updates when the application starts'
),
...
...
@@ -103,7 +118,8 @@ class SettingInterface(ScrollArea):
self
.
tr
(
'Open help page'
),
FIF
.
HELP
,
self
.
tr
(
'Help'
),
self
.
tr
(
'Discover new features and learn useful tips about PyQt-Fluent-Widgets'
),
self
.
tr
(
'Discover new features and learn useful tips about PyQt-Fluent-Widgets'
),
self
.
aboutGroup
)
self
.
feedbackCard
=
PrimaryPushSettingCard
(
...
...
@@ -150,6 +166,8 @@ class SettingInterface(ScrollArea):
self
.
personalGroup
.
addSettingCard
(
self
.
zoomCard
)
self
.
personalGroup
.
addSettingCard
(
self
.
languageCard
)
self
.
materialGroup
.
addSettingCard
(
self
.
blurRadiusCard
)
self
.
updateSoftwareGroup
.
addSettingCard
(
self
.
updateOnStartUpCard
)
self
.
aboutGroup
.
addSettingCard
(
self
.
helpCard
)
...
...
@@ -161,6 +179,7 @@ class SettingInterface(ScrollArea):
self
.
expandLayout
.
setContentsMargins
(
36
,
10
,
36
,
0
)
self
.
expandLayout
.
addWidget
(
self
.
musicInThisPCGroup
)
self
.
expandLayout
.
addWidget
(
self
.
personalGroup
)
self
.
expandLayout
.
addWidget
(
self
.
materialGroup
)
self
.
expandLayout
.
addWidget
(
self
.
updateSoftwareGroup
)
self
.
expandLayout
.
addWidget
(
self
.
aboutGroup
)
...
...
examples/gallery/app/view/status_info_interface.py
浏览文件 @
0c04b4f6
...
...
@@ -20,7 +20,7 @@ class StatusInfoInterface(GalleryInterface):
)
self
.
stateTooltip
=
None
button
=
PushButton
(
'Show StateToolTip'
)
button
=
PushButton
(
self
.
tr
(
'Show StateToolTip'
)
)
button
.
clicked
.
connect
(
self
.
onStateButtonClicked
)
self
.
addExampleCard
(
self
.
tr
(
'State tool tip'
),
...
...
@@ -28,9 +28,9 @@ class StatusInfoInterface(GalleryInterface):
'https://github.com/zhiyiYo/PyQt-Fluent-Widgets/blob/master/examples/status_tool_tip/demo.py'
)
button
=
PushButton
(
'Button with a simple ToolTip'
)
button
=
PushButton
(
self
.
tr
(
'Button with a simple ToolTip'
)
)
button
.
installEventFilter
(
ToolTipFilter
(
button
))
button
.
setToolTip
(
'Simple ToolTip'
)
button
.
setToolTip
(
self
.
tr
(
'Simple ToolTip'
)
)
self
.
addExampleCard
(
self
.
tr
(
'State tool tip'
),
button
,
...
...
@@ -52,12 +52,12 @@ class StatusInfoInterface(GalleryInterface):
def
onStateButtonClicked
(
self
):
if
self
.
stateTooltip
:
self
.
stateTooltip
.
setContent
(
'The model training is complete!
😆'
)
self
.
stateTooltip
.
setContent
(
self
.
tr
(
'The model training is complete!'
)
+
'
😆'
)
self
.
stateTooltip
.
setState
(
True
)
self
.
stateTooltip
=
None
else
:
self
.
stateTooltip
=
StateToolTip
(
'Training model'
,
'Please wait patiently'
,
self
.
window
())
self
.
tr
(
'Training model'
),
self
.
tr
(
'Please wait patiently'
)
,
self
.
window
())
self
.
sender
().
setText
(
self
.
tr
(
'Hide state tool tip'
))
self
.
stateTooltip
.
move
(
self
.
stateTooltip
.
getSuitablePos
())
self
.
stateTooltip
.
show
()
examples/gallery/demo.py
浏览文件 @
0c04b4f6
...
...
@@ -26,14 +26,18 @@ app.setAttribute(Qt.AA_DontCreateNativeWidgetSiblings)
# internationalization
translator
=
QTranslator
()
galleryTranslator
=
QTranslator
()
language
=
cfg
.
get
(
cfg
.
language
)
if
language
==
Language
.
AUTO
:
translator
.
load
(
QLocale
.
system
(),
"app/resource/i18n/qfluentwidgets_"
)
galleryTranslator
.
load
(
QLocale
.
system
(),
"app/resource/i18n/gallery_"
)
elif
language
!=
Language
.
ENGLISH
:
translator
.
load
(
f
"app/resource/i18n/qfluentwidgets_
{
language
.
value
}
.qm"
)
galleryTranslator
.
load
(
f
"app/resource/i18n/gallery_
{
language
.
value
}
.qm"
)
app
.
installTranslator
(
translator
)
app
.
installTranslator
(
galleryTranslator
)
# create main window
w
=
MainWindow
()
...
...
examples/gallery/gallery.pro
0 → 100644
浏览文件 @
0c04b4f6
SOURCES
+=
app
/
view
/
main_window
/
main_window
.
py
\
app
/
view
/
setting_interface
.
py
\
app
/
view
/
basic_input_interface
.
py
\
app
/
view
/
dialog_interface
.
py
\
app
/
view
/
menu_interface
.
py
\
app
/
view
/
gallery_interface
.
py
\
app
/
view
/
status_info_interface
.
py
\
app
/
view
/
scroll_interface
.
py
\
app
/
common
/
translator
.
py
\
app
/
view
/
material_interface
.
py
\
app
/
view
/
layout_interface
.
py
\
TRANSLATIONS
+=
app
/
resource
/
i18n
/
gallery_zh
.
ts
\
app
/
resource
/
i18n
/
gallery_hk
.
ts
qfluentwidgets/components/navigation/navigation_panel.py
浏览文件 @
0c04b4f6
...
...
@@ -398,9 +398,9 @@ class NavigationHistory(QObject):
self
.
history
.
pop
()
if
self
.
history
:
self
.
items
[
self
.
history
[
-
1
]].
clicked
.
emit
()
self
.
items
[
self
.
history
[
-
1
]].
clicked
.
emit
(
False
)
else
:
if
self
.
defaultRouteKey
is
not
None
:
self
.
items
[
self
.
defaultRouteKey
].
clicked
.
emit
()
self
.
items
[
self
.
defaultRouteKey
].
clicked
.
emit
(
False
)
self
.
emptyChanged
.
emit
(
True
)
qfluentwidgets/components/navigation/navigation_widget.py
浏览文件 @
0c04b4f6
...
...
@@ -14,7 +14,7 @@ from ...common.icon import FluentIcon as FIF
class
NavigationWidget
(
QWidget
):
""" Navigation widget """
clicked
=
pyqtSignal
(
)
clicked
=
pyqtSignal
(
bool
)
# whether triggered by the user
EXPAND_WIDTH
=
312
def
__init__
(
self
,
isSelectable
:
bool
,
parent
=
None
):
...
...
@@ -42,7 +42,7 @@ class NavigationWidget(QWidget):
def
mouseReleaseEvent
(
self
,
e
):
self
.
isPressed
=
False
self
.
update
()
self
.
clicked
.
emit
()
self
.
clicked
.
emit
(
True
)
def
setCompacted
(
self
,
isCompacted
:
bool
):
""" set whether the widget is compacted """
...
...
qfluentwidgets/components/settings/setting_card.py
浏览文件 @
0c04b4f6
...
...
@@ -394,6 +394,6 @@ class ComboBoxSettingCard(SettingCard):
def
_onCurrentTextChanged
(
self
,
text
):
qconfig
.
set
(
self
.
configItem
,
self
.
textToOption
[
text
])
def
setValue
(
self
,
text
):
self
.
comboBox
.
setCurrentText
(
text
)
qconfig
.
set
(
self
.
configItem
,
self
.
textToOption
[
text
])
\ No newline at end of file
def
setValue
(
self
,
value
):
self
.
comboBox
.
setCurrentText
(
self
.
optionToText
[
value
])
qconfig
.
set
(
self
.
configItem
,
value
)
\ No newline at end of file
qfluentwidgets/components/widgets/label.py
浏览文件 @
0c04b4f6
...
...
@@ -130,9 +130,6 @@ class AcrylicLabel(QLabel):
def
setImage
(
self
,
imagePath
:
str
):
""" set the image to be blurred """
if
imagePath
==
self
.
imagePath
:
return
self
.
imagePath
=
imagePath
self
.
blurThread
.
blur
(
imagePath
,
self
.
blurRadius
,
self
.
maxBlurSize
)
...
...
qfluentwidgets/components/widgets/stacked_widget.py
浏览文件 @
0c04b4f6
# coding:utf-8
from
typing
import
List
from
dataclasses
import
dataclass
from
PyQt5.QtCore
import
(
QAbstractAnimation
,
QEasingCurve
,
QParallelAnimationGroup
,
QPoint
,
QPropertyAnimation
,
...
...
@@ -54,6 +55,15 @@ class OpacityAniStackedWidget(QStackedWidget):
super
().
setCurrentIndex
(
self
.
__nextIndex
)
@
dataclass
class
PopUpAniInfo
:
""" Pop up ani info """
widget
:
QWidget
deltaX
:
int
deltaY
:
int
ani
:
QPropertyAnimation
class
PopUpAniStackedWidget
(
QStackedWidget
):
""" Stacked widget with pop up animation """
...
...
@@ -62,13 +72,11 @@ class PopUpAniStackedWidget(QStackedWidget):
def
__init__
(
self
,
parent
=
None
):
super
().
__init__
(
parent
)
self
.
__widgetAni_list
=
[]
self
.
__nextIndex
=
None
self
.
__currentAniGroup
=
None
self
.
__previousWidget
=
None
self
.
__previousIndex
=
0
self
.
aniInfos
=
[]
# type: List[PopUpAniInfo]
self
.
_nextIndex
=
None
self
.
_ani
=
None
def
addWidget
(
self
,
widget
,
deltaX
:
int
=
0
,
deltaY
:
int
=
22
,
isNeedOpacityAni
=
False
):
def
addWidget
(
self
,
widget
,
deltaX
=
0
,
deltaY
=
76
):
""" add widget to window
Parameters
...
...
@@ -81,25 +89,17 @@ class PopUpAniStackedWidget(QStackedWidget):
deltaY: int
the y-axis offset from the beginning to the end of animation
isNeedOpacityAni: bool
need fade in and fade out animation or not
"""
super
().
addWidget
(
widget
)
popUpAni
=
QPropertyAnimation
(
widget
,
b
'pos'
)
aniGroup
=
QParallelAnimationGroup
(
self
)
aniGroup
.
addAnimation
(
popUpAni
)
self
.
__widgetAni_list
.
append
({
'widget'
:
widget
,
'deltaX'
:
deltaX
,
'deltaY'
:
deltaY
,
'aniGroup'
:
aniGroup
,
'popUpAni'
:
popUpAni
,
'isNeedOpacityAni'
:
isNeedOpacityAni
})
def
setCurrentIndex
(
self
,
index
:
int
,
isNeedPopOut
:
bool
=
False
,
isShowNextWidgetDirectly
:
bool
=
True
,
self
.
aniInfos
.
append
(
PopUpAniInfo
(
widget
=
widget
,
deltaX
=
deltaX
,
deltaY
=
deltaY
,
ani
=
QPropertyAnimation
(
widget
,
b
'pos'
),
))
def
setCurrentIndex
(
self
,
index
:
int
,
needPopOut
:
bool
=
False
,
showNextWidgetDirectly
:
bool
=
True
,
duration
:
int
=
250
,
easingCurve
=
QEasingCurve
.
OutQuad
):
""" set current window to display
...
...
@@ -111,7 +111,7 @@ class PopUpAniStackedWidget(QStackedWidget):
isNeedPopOut: bool
need pop up animation or not
isS
howNextWidgetDirectly: bool
s
howNextWidgetDirectly: bool
whether to show next widget directly when animation started
duration: int
...
...
@@ -126,66 +126,38 @@ class PopUpAniStackedWidget(QStackedWidget):
if
index
==
self
.
currentIndex
():
return
if
self
.
_
_currentAniGroup
and
self
.
__currentAniGroup
.
state
()
==
QAbstractAnimation
.
Running
:
if
self
.
_
ani
and
self
.
_ani
.
state
()
==
QAbstractAnimation
.
Running
:
return
# get the index of widget to be displayed
self
.
__nextIndex
=
index
self
.
__previousIndex
=
self
.
currentIndex
()
self
.
__previousWidget
=
self
.
currentWidget
()
self
.
__isNeedPopOut
=
isNeedPopOut
self
.
_nextIndex
=
index
# get animation
nextWidgetAni_dict
=
self
.
__widgetAni_list
[
index
]
currentWidgetAni_dict
=
self
.
__widgetAni_list
[
self
.
currentIndex
()]
self
.
__currentWidget
=
self
.
currentWidget
()
# type:QWidget
self
.
__nextWidget
=
nextWidgetAni_dict
[
'widget'
]
# type:QWidget
currentPopUpAni
=
currentWidgetAni_dict
[
'popUpAni'
]
nextPopUpAni
=
nextWidgetAni_dict
[
'popUpAni'
]
self
.
__isNextWidgetNeedOpAni
=
nextWidgetAni_dict
[
'isNeedOpacityAni'
]
self
.
__isCurrentWidgetNeedOpAni
=
currentWidgetAni_dict
[
'isNeedOpacityAni'
]
self
.
__currentAniGroup
=
currentWidgetAni_dict
[
'aniGroup'
]
if
isNeedPopOut
else
nextWidgetAni_dict
[
'aniGroup'
]
# type:QParallelAnimationGroup
# set opacity animation
if
self
.
__isNextWidgetNeedOpAni
:
nextOpacityEffect
=
QGraphicsOpacityEffect
(
self
)
self
.
__nextOpacityAni
=
QPropertyAnimation
(
nextOpacityEffect
,
b
'opacity'
)
self
.
__nextWidget
.
setGraphicsEffect
(
nextOpacityEffect
)
self
.
__currentAniGroup
.
addAnimation
(
self
.
__nextOpacityAni
)
self
.
__setAnimation
(
self
.
__nextOpacityAni
,
0
,
1
,
duration
)
if
self
.
__isCurrentWidgetNeedOpAni
:
currentOpacityEffect
=
QGraphicsOpacityEffect
(
self
)
self
.
__currentOpacityAni
=
QPropertyAnimation
(
currentOpacityEffect
,
b
'opacity'
)
self
.
__currentWidget
.
setGraphicsEffect
(
currentOpacityEffect
)
self
.
__currentAniGroup
.
addAnimation
(
self
.
__currentOpacityAni
)
self
.
__setAnimation
(
self
.
__currentOpacityAni
,
1
,
0
,
duration
)
if
isNeedPopOut
:
deltaX
=
currentWidgetAni_dict
[
'deltaX'
]
deltaY
=
currentWidgetAni_dict
[
'deltaY'
]
pos
=
self
.
__currentWidget
.
pos
()
+
QPoint
(
deltaX
,
deltaY
)
self
.
__setAnimation
(
currentPopUpAni
,
self
.
__currentWidget
.
pos
(),
pos
,
duration
,
easingCurve
)
self
.
__nextWidget
.
setVisible
(
isShowNextWidgetDirectly
)
nextAniInfo
=
self
.
aniInfos
[
index
]
currentAniInfo
=
self
.
aniInfos
[
self
.
currentIndex
()]
currentWidget
=
self
.
currentWidget
()
nextWidget
=
nextAniInfo
.
widget
ani
=
currentAniInfo
.
ani
if
needPopOut
else
nextAniInfo
.
ani
self
.
_ani
=
ani
if
needPopOut
:
deltaX
,
deltaY
=
currentAniInfo
.
deltaX
,
currentAniInfo
.
deltaY
pos
=
currentWidget
.
pos
()
+
QPoint
(
deltaX
,
deltaY
)
self
.
__setAnimation
(
ani
,
currentWidget
.
pos
(),
pos
,
duration
,
easingCurve
)
nextWidget
.
setVisible
(
showNextWidgetDirectly
)
else
:
deltaX
=
nextWidgetAni_dict
[
'deltaX'
]
deltaY
=
nextWidgetAni_dict
[
'deltaY'
]
pos
=
self
.
__nextWidget
.
pos
()
+
QPoint
(
deltaX
,
deltaY
)
self
.
__setAnimation
(
nextPopUpAni
,
pos
,
QPoint
(
self
.
__nextWidget
.
x
(),
self
.
y
()),
duration
,
easingCurve
)
deltaX
,
deltaY
=
nextAniInfo
.
deltaX
,
nextAniInfo
.
deltaY
pos
=
nextWidget
.
pos
()
+
QPoint
(
deltaX
,
deltaY
)
self
.
__setAnimation
(
ani
,
pos
,
QPoint
(
nextWidget
.
x
(),
self
.
y
()),
duration
,
easingCurve
)
super
().
setCurrentIndex
(
index
)
# start animation
self
.
__currentAniGroup
.
finished
.
connect
(
self
.
__aniFinishedSlot
)
self
.
__currentAniGroup
.
start
()
ani
.
finished
.
connect
(
self
.
__onAniFinished
)
ani
.
start
()
self
.
aniStart
.
emit
()
def
setCurrentWidget
(
self
,
widget
,
isNeedPopOut
:
bool
=
False
,
isS
howNextWidgetDirectly
:
bool
=
True
,
def
setCurrentWidget
(
self
,
widget
,
needPopOut
:
bool
=
False
,
s
howNextWidgetDirectly
:
bool
=
True
,
duration
:
int
=
250
,
easingCurve
=
QEasingCurve
.
OutQuad
):
""" set currect widget
...
...
@@ -197,7 +169,7 @@ class PopUpAniStackedWidget(QStackedWidget):
isNeedPopOut: bool
need pop up animation or not
isS
howNextWidgetDirectly: bool
s
howNextWidgetDirectly: bool
whether to show next widget directly when animation started
duration: int
...
...
@@ -206,34 +178,18 @@ class PopUpAniStackedWidget(QStackedWidget):
easingCurve: QEasingCurve
the interpolation mode of animation
"""
self
.
setCurrentIndex
(
self
.
indexOf
(
widget
),
isNeedPopOut
,
isS
howNextWidgetDirectly
,
duration
,
easingCurve
)
self
.
setCurrentIndex
(
self
.
indexOf
(
widget
),
needPopOut
,
s
howNextWidgetDirectly
,
duration
,
easingCurve
)
def
__setAnimation
(
self
,
ani
:
QPropertyAnimation
,
startValue
,
endValue
,
duration
,
easingCurve
=
QEasingCurve
.
Linear
):
def
__setAnimation
(
self
,
ani
,
startValue
,
endValue
,
duration
,
easingCurve
=
QEasingCurve
.
Linear
):
""" set the config of animation """
ani
.
setEasingCurve
(
easingCurve
)
ani
.
setStartValue
(
startValue
)
ani
.
setEndValue
(
endValue
)
ani
.
setDuration
(
duration
)
def
__
aniFinishedSlot
(
self
):
def
__
onAniFinished
(
self
):
""" animation finished slot """
# cancel previously opacity effects to prevent conflicts with the opacity effects of widgets
if
self
.
__isCurrentWidgetNeedOpAni
:
self
.
__currentWidget
.
setGraphicsEffect
(
None
)
self
.
__currentAniGroup
.
removeAnimation
(
self
.
__currentOpacityAni
)
if
self
.
__isNextWidgetNeedOpAni
:
self
.
__nextWidget
.
setGraphicsEffect
(
None
)
self
.
__currentAniGroup
.
removeAnimation
(
self
.
__nextOpacityAni
)
self
.
__currentAniGroup
.
disconnect
()
super
().
setCurrentIndex
(
self
.
__nextIndex
)
self
.
_ani
.
disconnect
()
super
().
setCurrentIndex
(
self
.
_nextIndex
)
self
.
aniFinished
.
emit
()
@
property
def
previousWidget
(
self
):
return
self
.
__previousWidget
@
property
def
previousIndex
(
self
):
return
self
.
__previousIndex
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录