Skip to content

Commit f9ab568

Browse files
committed
Theme Preview Widget
1 parent 3c043b1 commit f9ab568

File tree

14 files changed

+598
-3
lines changed

14 files changed

+598
-3
lines changed

.settings/org.eclipse.core.resources.prefs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ encoding//Test/TestColorThief.py=utf-8
99
encoding//Test/TestDownProgress.py=utf-8
1010
encoding//Test/TestGitTree.py=utf-8
1111
encoding//Test/TestMainwindowStyle.py=utf-8
12+
encoding//Test/TestPreviewWidget.py=utf-8
1213
encoding//Test/TestPropertyAnimation.py=utf-8
1314
encoding//Test/TestRotateButton.py=utf-8
1415
encoding//Test/TestRubberBandButton.py=utf-8
@@ -25,6 +26,7 @@ encoding//Test/compilepy.py=utf-8
2526
encoding//UiFiles/Ui_ErrorDialog.py=utf-8
2627
encoding//UiFiles/Ui_LoginDialog.py=utf-8
2728
encoding//UiFiles/Ui_MainWindow.py=utf-8
29+
encoding//UiFiles/Ui_PreviewWidget.py=utf-8
2830
encoding//UiFiles/Ui_ScrollArea.py=utf-8
2931
encoding//UiFiles/Ui_SkinDialog.py=utf-8
3032
encoding//UiFiles/Ui_UpdateDialog.py=utf-8
@@ -53,6 +55,7 @@ encoding//Widgets/Dialogs/UpdateDialog.py=utf-8
5355
encoding//Widgets/FramelessWindow.py=utf-8
5456
encoding//Widgets/MainWindow.py=utf-8
5557
encoding//Widgets/MainWindowBase.py=utf-8
58+
encoding//Widgets/PreviewWidget.py=utf-8
5659
encoding//Widgets/Skins/ColourfulWidget.py=utf-8
5760
encoding//Widgets/Skins/PictureWidget.py=utf-8
5861
encoding//Widgets/Skins/SkinBaseWidget.py=utf-8

Resources/Themes/Dark/font.ttf

580 Bytes
Binary file not shown.

Resources/Themes/Dark/style.qss

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,55 @@ ToolTip > QLabel {
422422
background: rgba(225, 226, 227, 255);
423423
}
424424

425+
/*主题预览界面*/
426+
#FormPreviewWidget {
427+
border-radius: 4px;
428+
background: rgba(255, 255, 255, 240);
429+
}
430+
#buttonPreviewPrevious, #buttonPreviewNext, #buttonPreviewClose {
431+
min-width: 48px;
432+
max-width: 48px;
433+
min-height: 48px;
434+
max-height: 48px;
435+
color: rgb(181, 182, 185);
436+
font-family: "pyqtclient";
437+
font-size: 40px;
438+
border: none; /*无边框*/
439+
background: transparent; /*背景透明*/
440+
}
441+
#buttonPreviewPrevious:hover,#buttonPreviewNext:hover, #buttonPreviewClose:hover {
442+
color: rgb(118, 122, 126);
443+
}
444+
#buttonPreviewPrevious:pressed,#buttonPreviewNext:pressed, #buttonPreviewClose:pressed {
445+
color: rgb(27, 36, 42);
446+
}
447+
448+
#buttonPreviewPrevious {
449+
qproperty-text: "\5106";
450+
}
451+
#buttonPreviewNext {
452+
qproperty-text: "\5107";
453+
}
454+
#buttonPreviewClose {
455+
qproperty-text: "\5105";
456+
}
457+
#buttonPreviewApply {
458+
color: white;
459+
font-size: 20px;
460+
font-family: "微软雅黑";
461+
min-height: 35px;
462+
min-width: 120px;
463+
border: none;
464+
border-radius: 2px;
465+
background: rgb(46, 46, 46);
466+
}
467+
#buttonPreviewApply:hover {
468+
background: rgba(46, 46, 46, 200);
469+
}
470+
#buttonPreviewApply:pressed {
471+
background: rgba(46, 46, 46, 230);
472+
}
473+
425474
/*滚动条样式*/
426475
QScrollBar:vertical {
427476
background: transparent;

Resources/Themes/Default/font.ttf

580 Bytes
Binary file not shown.

Resources/Themes/Default/style.qss

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,55 @@ ToolTip > QLabel {
422422
background: rgba(225, 226, 227, 255);
423423
}
424424

425+
/*主题预览界面*/
426+
#FormPreviewWidget {
427+
border-radius: 4px;
428+
background: rgba(255, 255, 255, 240);
429+
}
430+
#buttonPreviewPrevious, #buttonPreviewNext, #buttonPreviewClose {
431+
min-width: 48px;
432+
max-width: 48px;
433+
min-height: 48px;
434+
max-height: 48px;
435+
color: rgb(181, 182, 185);
436+
font-family: "pyqtclient";
437+
font-size: 40px;
438+
border: none; /*无边框*/
439+
background: transparent; /*背景透明*/
440+
}
441+
#buttonPreviewPrevious:hover,#buttonPreviewNext:hover, #buttonPreviewClose:hover {
442+
color: rgb(118, 122, 126);
443+
}
444+
#buttonPreviewPrevious:pressed,#buttonPreviewNext:pressed, #buttonPreviewClose:pressed {
445+
color: rgb(27, 36, 42);
446+
}
447+
448+
#buttonPreviewPrevious {
449+
qproperty-text: "\5106";
450+
}
451+
#buttonPreviewNext {
452+
qproperty-text: "\5107";
453+
}
454+
#buttonPreviewClose {
455+
qproperty-text: "\5105";
456+
}
457+
#buttonPreviewApply {
458+
color: white;
459+
font-size: 20px;
460+
font-family: "微软雅黑";
461+
min-height: 35px;
462+
min-width: 120px;
463+
border: none;
464+
border-radius: 2px;
465+
background: rgb(39, 174, 97);
466+
}
467+
#buttonPreviewApply:hover {
468+
background: rgba(39, 174, 97, 200);
469+
}
470+
#buttonPreviewApply:pressed {
471+
background: rgba(39, 174, 97, 230);
472+
}
473+
425474
/*滚动条样式*/
426475
QScrollBar:vertical {
427476
background: transparent;

Resources/Themes/春节/font.ttf

580 Bytes
Binary file not shown.

Resources/Themes/春节/style.qss

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,55 @@ ToolTip > QLabel {
423423
background: rgba(225, 226, 227, 255);
424424
}
425425

426+
/*主题预览界面*/
427+
#FormPreviewWidget {
428+
border-radius: 4px;
429+
background: rgba(255, 255, 255, 240);
430+
}
431+
#buttonPreviewPrevious, #buttonPreviewNext, #buttonPreviewClose {
432+
min-width: 48px;
433+
max-width: 48px;
434+
min-height: 48px;
435+
max-height: 48px;
436+
color: rgb(181, 182, 185);
437+
font-family: "pyqtclient";
438+
font-size: 40px;
439+
border: none; /*无边框*/
440+
background: transparent; /*背景透明*/
441+
}
442+
#buttonPreviewPrevious:hover,#buttonPreviewNext:hover, #buttonPreviewClose:hover {
443+
color: rgb(118, 122, 126);
444+
}
445+
#buttonPreviewPrevious:pressed,#buttonPreviewNext:pressed, #buttonPreviewClose:pressed {
446+
color: rgb(27, 36, 42);
447+
}
448+
449+
#buttonPreviewPrevious {
450+
qproperty-text: "\5106";
451+
}
452+
#buttonPreviewNext {
453+
qproperty-text: "\5107";
454+
}
455+
#buttonPreviewClose {
456+
qproperty-text: "\5105";
457+
}
458+
#buttonPreviewApply {
459+
color: white;
460+
font-size: 20px;
461+
font-family: "微软雅黑";
462+
min-height: 35px;
463+
min-width: 120px;
464+
border: none;
465+
border-radius: 2px;
466+
background: rgb(200, 47, 10);
467+
}
468+
#buttonPreviewApply:hover {
469+
background: rgba(200, 47, 10, 200);
470+
}
471+
#buttonPreviewApply:pressed {
472+
background: rgba(200, 47, 10, 230);
473+
}
474+
426475
/*滚动条样式*/
427476
QScrollBar:vertical {
428477
background: transparent;

Test/TestPreviewWidget.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
4+
"""
5+
Created on 2019年1月30日
6+
@author: Irony
7+
@site: https://pyqt5.com https://github.com/892768447
8+
@email: 892768447@qq.com
9+
@file: Test.TestPreviewWidget
10+
@description:
11+
"""
12+
from PyQt5.QtCore import Qt
13+
from PyQt5.QtGui import QPixmap
14+
15+
from Utils.ThemeManager import ThemeManager
16+
from Widgets.PreviewWidget import PreviewWidget
17+
18+
19+
__Author__ = 'Irony'
20+
__Copyright__ = 'Copyright (c) 2019'
21+
22+
if __name__ == '__main__':
23+
import sys
24+
import os
25+
import cgitb
26+
os.chdir('../')
27+
sys.excepthook = cgitb.enable(1, None, 5, '')
28+
from PyQt5.QtWidgets import QApplication
29+
app = QApplication(sys.argv)
30+
ThemeManager.loadTheme()
31+
w = PreviewWidget()
32+
w.show()
33+
w.setTitle('Test')
34+
w.setPixmap(QPixmap(
35+
'Resources/Themes/Default/preview.png').scaledToWidth(400, Qt.SmoothTransformation))
36+
sys.exit(app.exec_())

0 commit comments

Comments
 (0)