Skip to content

Commit 374c96f

Browse files
committed
Festival Preview
1 parent adf59b0 commit 374c96f

File tree

3 files changed

+60
-0
lines changed

3 files changed

+60
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ encoding//Test/RunCode.py=utf-8
88
encoding//Test/SlotsByName.py=utf-8
99
encoding//Test/TestColorThief.py=utf-8
1010
encoding//Test/TestDownProgress.py=utf-8
11+
encoding//Test/TestFestivalStyle.py=utf-8
1112
encoding//Test/TestGitTree.py=utf-8
1213
encoding//Test/TestGradientUtils.py=utf-8
1314
encoding//Test/TestLoadGradientFile.py=utf-8
-578 KB
Binary file not shown.

Test/TestFestivalStyle.py

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
4+
"""
5+
Created on 2019年1月18日
6+
@author: Irony
7+
@site: https://pyqt5.com https://github.com/892768447
8+
@email: 892768447@qq.com
9+
@file: Test.TestFestivalStyle
10+
@description:
11+
"""
12+
from time import time
13+
14+
from PyQt5.QtCore import Qt
15+
from PyQt5.QtWidgets import QWidget, QListWidget
16+
17+
from UiFiles.Ui_MainWindow import Ui_FormMainWindow
18+
from Utils.ThemeManager import ThemeManager
19+
20+
21+
__Author__ = "Irony"
22+
__Copyright__ = "Copyright (c) 2019"
23+
24+
25+
class Window(QWidget, Ui_FormMainWindow):
26+
27+
def __init__(self, *args, **kwargs):
28+
super(Window, self).__init__(*args, **kwargs)
29+
self.setAttribute(Qt.WA_TranslucentBackground, True)
30+
self.setWindowFlags(self.windowFlags() | Qt.FramelessWindowHint)
31+
self.setupUi(self)
32+
t = time()
33+
ThemeManager.loadTheme()
34+
print(time() - t)
35+
ThemeManager.loadCursor(self)
36+
ThemeManager.loadCursor(self.buttonHead, ThemeManager.CursorPointer)
37+
38+
39+
if __name__ == '__main__':
40+
import sys
41+
import os
42+
os.chdir('../')
43+
from PyQt5.QtWidgets import QApplication
44+
app = QApplication(sys.argv)
45+
w = Window()
46+
w.resize(800, 770)
47+
w.show()
48+
49+
lw = QListWidget()
50+
lw.show()
51+
lw.addItems(os.listdir('Resources/Images/Festival'))
52+
53+
def setStyle(item):
54+
path = os.path.join('Resources/Images/Festival', item.text(), 'background.jpg')
55+
if os.path.isfile(path):
56+
ThemeManager.loadPictureTheme(path)
57+
lw.itemClicked.connect(setStyle)
58+
59+
sys.exit(app.exec_())

0 commit comments

Comments
 (0)