Commit 4993c521 authored by Zheng Yile's avatar Zheng Yile
Browse files

Optimize font

parent ff947ba7
import datetime
from re import search
from PyQt5.QtCore import Qt, QSize
from PyQt5.QtGui import QPalette, QBrush, QColor
from PyQt5.QtWidgets import QHBoxLayout, QLabel, QVBoxLayout
from PyQt5.QtWidgets import QListWidgetItem, QWidget, QListWidget
from PyQt5.QtWidgets import QMessageBox
import functionWindow
from utils import *
from codiaclient.network import *
Palette = {
"green": QPalette(),
"red": QPalette(),
}
greenBrush = QBrush(QColor(80, 160, 30))
greenBrush.setStyle(Qt.SolidPattern)
Palette['green'].setBrush(QPalette.Active, QPalette.Text, greenBrush)
redBrush = QBrush(QColor(160, 0, 30))
redBrush.setStyle(Qt.SolidPattern)
Palette['red'].setBrush(QPalette.Active, QPalette.Text, redBrush)
def functionWindow_init(ui: functionWindow.Ui_functionWindow, nickname='UNDEFINED', verified=True):
pack_list = get_pack(lastcnt=12)
......@@ -50,12 +40,16 @@ def getpackwidget(data: dict):
else:
label_finish = QLabel('未完成')
label_finish.setPalette(Palette['red'])
label_hasdone_total = QLabel('已完成/总计: {}/{}'.format(hasdone, total))
else:
label_finish = QLabel('无权限')
label_finish.setPalette(Palette['gray'])
label_hasdone_total = QLabel('')
layout_main.addWidget(label_finish)
layout_main.setStretchFactor(label_finish, 1)
label_name = QLabel(data['name'])
label_start = QLabel('开始时间')
label_end = QLabel('截止时间')
label_hasdone_total = QLabel('已完成/总计: {}/{}'.format(hasdone, total))
layout_right_up.addWidget(label_name)
layout_right_up.addWidget(label_start)
layout_right_up.addWidget(label_end)
......@@ -65,15 +59,15 @@ def getpackwidget(data: dict):
layout_right_down.addWidget(label_hasdone_total)
layout_right_down.setStretchFactor(label_hasdone_total, 4)
if data['due']:
end = (datetime.datetime.strptime(data['due'].replace('T', " ")[:-5], "%Y-%m-%d %H:%M:%S")
+ datetime.timedelta(hours=8)).strftime("%Y-%m-%d %H:%M:%S")
else:
end = '无限制'
end = (datetime.datetime.strptime(search(r"^[^.]*", data['due'].replace('T', " ")).group(), "%Y-%m-%d %H:%M:%S")
+ datetime.timedelta(hours = 8)).strftime("%Y-%m-%d %H:%M:%S")
else: end = '无限制'
if data['createdAt']:
start = (datetime.datetime.strptime(data['createdAt'].replace('T', " ")[:-5], "%Y-%m-%d %H:%M:%S")
+ datetime.timedelta(hours=8)).strftime("%Y-%m-%d %H:%M:%S")
else:
start = '无限制'
start = (datetime.datetime.strptime(search(r"^[^.]*", data['createdAt'].replace('T', " ")).group(), "%Y-%m-%d %H:%M:%S")
+ datetime.timedelta(hours = 8)).strftime("%Y-%m-%d %H:%M:%S")
else: start = '无限制'
label_start_time = QLabel(start)
label_end_time = QLabel(end)
layout_right_down.addWidget(label_start_time)
......
......@@ -37,7 +37,6 @@ def BeginLogin():
raise
return False
else:
loginusernickname = logined()[1]
try:
with open('config.sav', 'wb') as configfile:
if LoginUi.checkBox.isChecked():
......@@ -56,16 +55,22 @@ def BeginLogin():
configfile.write(b64encode(config))
except Exception as e:
QMessageBox.critical(None, '未知错误', str(e), QMessageBox.Ok)
if not variables['me']['verified']:
verified = False
return False
else:
verified = True
FunctionUi.setupUi(FunctionWindow)
MainFunctions.functionWindow_init(FunctionUi, loginusernickname, verified)
LoginWindow.hide()
FunctionWindow.show()
return True
BeginFunction()
return True
def BeginFunction():
loginusernickname = logined()[1]
verified = bool(variables['me']['verified'])
FunctionUi.setupUi(FunctionWindow)
MainFunctions.functionWindow_init(FunctionUi, loginusernickname, verified)
from utils import Font
FunctionWindow.setFont(Font['main'])
LoginWindow.hide()
FunctionWindow.show()
# 获取重置密码的验证码
def GetCheck():
......@@ -109,6 +114,9 @@ def ShowReset():
def TaskInit():
report_var['allow_error_deg'] = 1
from utils import Font
LoginWindow.setFont(Font['main'])
LoginUi.pushButtonLogin.clicked.connect(BeginLogin)
LoginUi.lineEdit0Password.setEchoMode(QLineEdit.Password)
LoginUi.pushButtonGoReset.clicked.connect(ShowReset)
......
from PyQt5.QtGui import QFont, QPalette, QBrush, QColor
from PyQt5.QtCore import Qt
Font = {
'main': QFont(),
}
Palette = {
"green": QPalette(),
"red": QPalette(),
"gray": QPalette(),
}
import sys
if sys.platform == 'win32': Font['main'].setFamily("Microsoft YaHei")
elif sys.platform == 'darwin': Font['main'].setFamily("Apple UI")
else: Font['main'].setFamily("SimSun")
Font['main'].setPointSize(10)
greenBrush = QBrush(QColor(80, 160, 30))
greenBrush.setStyle(Qt.SolidPattern)
Palette['green'].setBrush(QPalette.Active, QPalette.Text, greenBrush)
greenBrush = QBrush(QColor(80, 160, 30))
greenBrush.setStyle(Qt.SolidPattern)
Palette['green'].setBrush(QPalette.Inactive, QPalette.Text, greenBrush)
greenBrush = QBrush(QColor(120, 120, 120))
greenBrush.setStyle(Qt.SolidPattern)
Palette['green'].setBrush(QPalette.Disabled, QPalette.Text, greenBrush)
redBrush = QBrush(QColor(160, 0, 30))
redBrush.setStyle(Qt.SolidPattern)
Palette['red'].setBrush(QPalette.Active, QPalette.Text, redBrush)
redBrush = QBrush(QColor(160, 0, 30))
redBrush.setStyle(Qt.SolidPattern)
Palette['red'].setBrush(QPalette.Inactive, QPalette.Text, redBrush)
redBrush = QBrush(QColor(120, 120, 120))
redBrush.setStyle(Qt.SolidPattern)
Palette['red'].setBrush(QPalette.Disabled, QPalette.Text, redBrush)
grayBrush = QBrush(QColor(150, 151, 152))
grayBrush.setStyle(Qt.SolidPattern)
Palette['gray'].setBrush(QPalette.Active, QPalette.Text, grayBrush)
grayBrush = QBrush(QColor(150, 151, 152))
grayBrush.setStyle(Qt.SolidPattern)
Palette['gray'].setBrush(QPalette.Inactive, QPalette.Text, grayBrush)
grayBrush = QBrush(QColor(120, 120, 120))
grayBrush.setStyle(Qt.SolidPattern)
Palette['gray'].setBrush(QPalette.Disabled, QPalette.Text, grayBrush)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment