|
| 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