Example #1
0
 def loadUserTheme(cls, theme='Default'):
     """加载主题目录里的主题
     :param cls:
     :param theme:        文件夹名字
     """
     Setting.setValue('theme', theme)
     cls.loadTheme()
Example #2
0
 def onLoginSuccessed(self, uid, name):
     AppLog.debug('onLoginSuccessed')
     self._isLogin = False
     self.buttonLogin.showWaiting(False)
     self.setEnabled(True)
     # 用账号密码实例化github访问对象
     account = self.lineEditAccount.text().strip()
     password = self.lineEditPassword.text().strip()
     Constants._Account = account
     Constants._Password = password
     Constants._Username = name
     # 储存账号密码
     Setting.setValue('account', account)
     if account not in self._accounts:
         # 更新账号数组
         self._accounts[account] = [
             uid, base64.b85encode(password.encode()).decode()]
         Setting.setValue('accounts', self._accounts)
     self.accept()
Example #3
0
 def closeEvent(self, event):
     # 储存窗口位置
     Setting.setValue('geometry', self.saveGeometry())
     super(MainWindow, self).closeEvent(event)
Example #4
0
 def on_buttonPreviewApply_clicked(self):
     """设置主题
     """
     if self._which == self.Theme:
         ThemeManager.loadUserTheme(
             os.path.basename(os.path.dirname(self._poc)))
         Setting.setValue('picture', None)
         Setting.setValue('colourful', None)
     elif self._which == self.Color:
         ThemeManager.loadColourfulTheme(self._poc)
         if isinstance(self._poc, QColor):
             Setting.setValue('colourful', self._poc)
         else:
             # 渐变需要转成字典数据
             Setting.setValue('colourful', GradientUtils.toJson(self._poc))
         Setting.setValue('picture', None)
     elif self._which == self.Picture:
         ThemeManager.loadPictureTheme(self._poc)
         Setting.setValue('colourful', None)
         Setting.setValue('picture', self._poc.replace('\\', '/'))
Example #5
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on 2019年1月9日
@author: Irony
@site: https://pyqt5.com https://github.com/892768447
@email: [email protected]
@file: Test.TestSetting
@description: 
"""
import os

from PyQt5.QtCore import QVariant

from Utils.CommonUtil import Setting

__Author__ = """By: Irony
QQ: 892768447
Email: [email protected]"""
__Copyright__ = "Copyright (c) 2019 Irony"
__Version__ = "Version 1.0"

os.chdir('../')

print(Setting.value('accounts', [], QVariant))

Setting.setValue('accounts', ['*****@*****.**'])

print(Setting.value('accounts', [], QVariant))