def _initUi(self): """初始UI""" self.setupUi(self) # 隐藏还原按钮 self.buttonNormal.setVisible(False) # 隐藏目录树的滑动条 self.treeViewCatalogs.verticalScrollBar().setVisible(False) # 加载主题 ThemeManager.loadTheme() # 加载鼠标样式 ThemeManager.loadCursor(self.widgetMain) ThemeManager.setPointerCursors([ self.buttonHead, # 主界面头像 self.buttonSearch, # 主界面搜索按钮 self.buttonGithub, # Github按钮 self.buttonQQ, # QQ按钮 self.buttonGroup, # 群按钮 self.buttonBackToUp, # 返回顶部按钮 self.buttonHome # 显示主页readme ]) # 安装事件过滤器用于还原鼠标样式 self.widgetMain.installEventFilter(self) # 绑定返回顶部提示框 ToolTip.bind(self.buttonBackToUp) ToolTip.bind(self.buttonHome) # 头像提示控件 ToolTip.bind(self.buttonHead)
def __init__(self, *args, **kwargs): super(Window, self).__init__(*args, **kwargs) self.setAttribute(Qt.WA_TranslucentBackground, True) self.setWindowFlags(self.windowFlags() | Qt.FramelessWindowHint) self.setupUi(self) t = time() ThemeManager.loadTheme() print(time() - t) ThemeManager.loadCursor(self) ThemeManager.loadCursor(self.buttonHead, ThemeManager.CursorPointer)
def _initStyle(self): colourful = Setting.value('colourful') if colourful: ThemeManager.loadFont() if isinstance(colourful, QColor): ThemeManager.loadColourfulTheme(colourful) else: # json数据转渐变 ThemeManager.loadColourfulTheme( GradientUtils.toGradient(colourful)) else: ThemeManager.loadTheme()
def __init__(self, *args, **kwargs): super(Window, self).__init__(*args, **kwargs) self.setAttribute(Qt.WA_TranslucentBackground, True) self.setWindowFlags(self.windowFlags() | Qt.FramelessWindowHint) self.setupUi(self) self.buttonClose.clicked.connect(self.close) self.buttonMaximum.clicked.connect(self.showMaximized) self.buttonMinimum.clicked.connect(self.showMinimized) self.buttonNormal.clicked.connect(self.showNormal) t = time() ThemeManager.loadTheme() print(time() - t) ThemeManager.loadCursor(self) ThemeManager.loadCursor(self.buttonHead, ThemeManager.CursorPointer)
def _initUi(self): """初始UI""" self.setupUi(self) # 隐藏还原按钮 self.buttonNormal.setVisible(False) # 隐藏目录树的滑动条 self.treeViewCatalogs.verticalScrollBar().setVisible(False) # 加载鼠标样式 ThemeManager.loadCursor(self.widgetMain) ThemeManager.setPointerCursors([ self.buttonHead, # 主界面头像 self.buttonClear, # 主界面清空按钮 self.buttonGithub, # Github按钮 self.buttonQQ, # QQ按钮 self.buttonGroup, # 群按钮 self.buttonBackToUp, # 返回顶部按钮 self.buttonHome # 显示主页readme ]) # 安装事件过滤器用于还原鼠标样式 self.widgetMain.installEventFilter(self) # 绑定返回顶部提示框 ToolTip.bind(self.buttonBackToUp) ToolTip.bind(self.buttonHome) # 头像提示控件 ToolTip.bind(self.buttonHead) # 加载主题 colourful = Setting.value('colourful') picture = Setting.value('picture', '', str) AppLog.debug('colourful: %s', str(colourful)) AppLog.debug('picture: %s', picture) if picture: ThemeManager.loadFont() ThemeManager.loadPictureTheme(picture) elif colourful: ThemeManager.loadFont() if isinstance(picture, QColor): ThemeManager.loadColourfulTheme(colourful) else: # json数据转渐变 ThemeManager.loadColourfulTheme( GradientUtils.toGradient(colourful)) else: ThemeManager.loadTheme()
@site: https://pyqt5.com https://github.com/892768447 @email: [email protected] @file: Test.TestPreviewWidget @description: """ from PyQt5.QtCore import Qt from PyQt5.QtGui import QPixmap from Utils.ThemeManager import ThemeManager from Widgets.Skins.PreviewWidget import PreviewWidget __Author__ = 'Irony' __Copyright__ = 'Copyright (c) 2019' if __name__ == '__main__': import sys import os import cgitb os.chdir('../') sys.excepthook = cgitb.enable(1, None, 5, '') from PyQt5.QtWidgets import QApplication app = QApplication(sys.argv) ThemeManager.loadTheme() w = PreviewWidget() w.show() w.setTitle('Test') w.setPixmap( QPixmap('Resources/Themes/Default/preview.png').scaledToWidth( 400, Qt.SmoothTransformation)) sys.exit(app.exec_())