Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Zheng Yile
codiaclient
Commits
918eaa25
Commit
918eaa25
authored
Jul 06, 2021
by
曹高翔
Browse files
修正跨平台时出现的分辨率问题
parent
78d5d7cb
Changes
9
Hide whitespace changes
Inline
Side-by-side
codiaclient/cachectrl.py
View file @
918eaa25
...
...
@@ -14,6 +14,7 @@ variables = {
from
os
import
environ
,
path
,
makedirs
from
sys
import
platform
if
platform
==
'darwin'
:
variables
[
'appDataPath'
]
=
"~/Library/codiaclient"
elif
platform
==
'win32'
:
...
...
@@ -22,6 +23,7 @@ if not path.exists(variables['appDataPath']):
makedirs
(
variables
[
'appDataPath'
])
variables
[
'sessionPath'
]
=
path
.
join
(
variables
[
'appDataPath'
],
".cache"
)
def
cache_for_login
(
userdic
,
passwd
,
cookie
=
None
,
passwd_store_on
=
0
):
file
=
variables
[
'sessionPath'
]
if
not
variables
[
'cache_on'
]:
...
...
codiaclient/network.py
View file @
918eaa25
...
...
@@ -43,6 +43,7 @@ login_base_headers = {
'user-agent'
:
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36 Edg/90.0.818.46'
,
}
def
post
(
url
,
headers
,
data
,
timeout
=
5
):
headers
[
'content-length'
]
=
str
(
len
(
data
))
if
type
(
data
)
==
str
:
data
=
data
.
encode
(
'utf-8'
)
...
...
@@ -64,6 +65,7 @@ def post(url, headers, data, timeout=5):
else
:
return
res
def
client_login
(
args
=
None
,
username
=
None
,
password
=
None
,
cookie
=
None
):
if
args
:
username
=
args
.
username
...
...
@@ -154,6 +156,7 @@ def client_login(args=None, username=None, password=None, cookie=None):
else
:
report
(
'No username or cookie specified.'
,
3
)
def
logined
(
reportUnverified
:
bool
=
True
):
headers
=
coding_base_headers
.
copy
()
data
=
json
.
dumps
({
...
...
@@ -192,6 +195,7 @@ def logined(reportUnverified: bool = True):
return
"UNMATCHED"
,
res_data
[
'data'
][
'me'
][
'displayName'
]
return
"SUCCESS"
,
res_data
[
'data'
][
'me'
][
'displayName'
]
def
login
(
username
,
passwd
):
report
(
'Try login.'
)
res
=
_login
(
username
,
passwd
)
...
...
@@ -202,6 +206,7 @@ def login(username, passwd):
report
(
'Login succeeded.({})'
.
format
(
res
[
'displayName'
]))
return
True
def
register
(
username
,
passwd
,
email
=
None
):
headers
=
login_base_headers
.
copy
()
if
not
email
:
email
=
input
(
"Input your email:"
)
...
...
@@ -236,6 +241,7 @@ mutation signup($login: String!, $password: String!, $email: String!) {
return
False
return
res_data
[
'data'
][
'signup'
][
'user'
]
def
change_password
(
identifier
=
None
,
vercode
=
None
,
passwd
=
None
,
passwordconfirm
=
None
):
import
getpass
headers
=
login_base_headers
.
copy
()
...
...
@@ -317,6 +323,7 @@ mutation passwordChange($newPassword: String!, $verifyToken: String) {
return
False
return
passwd
def
_acquire_verification
(
identifier
=
None
):
headers
=
login_base_headers
.
copy
()
if
not
identifier
:
identifier
=
input
(
"Input your email/phone:"
)
...
...
@@ -357,12 +364,14 @@ mutation acquireVerification($identifier: String!, $type: VerificationType!) {
return
None
,
False
return
identifier
,
res_data
[
'data'
][
'acquireVerification'
]
def
submit
(
eid
,
pid
,
lang
,
solutioncode
):
if
pid
:
return
_submit_from_pack
(
eid
,
pid
,
lang
,
solutioncode
)
else
:
return
_submit_not_from_pack
(
eid
,
lang
,
solutioncode
)
def
get_data
(
eid
,
pid
,
before
=
None
,
after
=
None
,
cnt
=
None
):
if
not
cnt
:
if
pid
:
...
...
@@ -384,12 +393,14 @@ def get_data(eid, pid, before=None, after=None, cnt=None):
res
.
reverse
()
return
res
def
get_exercise
(
eid
,
pid
,
lang
,
feedback
=
'dict'
):
if
pid
:
return
_get_exercise_from_pack
(
eid
,
pid
,
lang
,
feedback
)
else
:
return
_get_exercise_not_from_pack
(
eid
,
lang
,
feedback
)
def
get_pack
(
before
=
None
,
after
=
None
,
cnt
=
None
):
if
cnt
==
None
:
cnt
=
8
if
type
(
cnt
)
==
str
:
...
...
@@ -454,6 +465,7 @@ query publicExercisePacks({queryargs}) {{
except
:
return
False
def
show_pack
(
pid
):
headers
=
coding_base_headers
.
copy
()
data
=
json
.
dumps
({
...
...
@@ -491,6 +503,7 @@ query pack($pid: ID!) {
if
not
res
:
return
False
return
json
.
loads
(
res
.
text
)[
'data'
][
'node'
]
def
start_pack
(
pid
):
if
show_pack
(
pid
)[
'viewerStatus'
][
'ongoing'
]:
report
(
"This pack is already ongoing."
,
1
)
...
...
@@ -539,6 +552,7 @@ mutation startSession($pid: ID!, $code: String) {
except
:
return
False
def
_login
(
username
,
passwd
):
headers
=
login_base_headers
.
copy
()
data
=
json
.
dumps
({
...
...
@@ -578,6 +592,7 @@ mutation login($username: String!, $password: String!) {
cookie
=
coding_base_headers
[
'cookie'
],
passwd_store_on
=
variables
[
'passwd_store_on'
])
return
res_data
[
'data'
][
'login'
][
'user'
]
def
_submit_from_pack
(
eid
,
pid
,
lang
,
solutioncode
):
headers
=
coding_base_headers
.
copy
()
data
=
json
.
dumps
({
...
...
@@ -601,6 +616,7 @@ mutation ($eid: ID!, $pid: ID, $lang: Language!, $sol: String!, $a: JSONObject)
if
not
res
:
return
False
return
json
.
loads
(
res
.
text
)
def
_submit_not_from_pack
(
eid
,
lang
,
solutioncode
):
headers
=
coding_base_headers
.
copy
()
data
=
json
.
dumps
({
...
...
@@ -623,6 +639,7 @@ mutation ($eid: ID!, $pid: ID, $lang: Language!, $sol: String!, $a: JSONObject)
if
not
res
:
return
False
return
json
.
loads
(
res
.
text
)
def
_get_data_not_from_pack
(
eid
,
before
=
None
,
after
=
None
,
cnt
=
None
):
if
cnt
==
None
:
cnt
=
1
if
type
(
cnt
)
==
str
:
...
...
@@ -693,6 +710,7 @@ query codingExercise({queryargs}) {{
except
:
return
False
def
_get_data_from_pack
(
eid
,
pid
,
before
=
None
,
after
=
None
,
cnt
=
None
):
if
cnt
==
None
:
cnt
=
1
if
type
(
cnt
)
==
str
:
...
...
@@ -772,6 +790,7 @@ query codingExercise({queryargs}) {{
except
:
return
False
def
_get_exercise_not_from_pack
(
eid
,
lang
,
feedback
=
'dict'
):
headers
=
coding_base_headers
.
copy
()
data
=
json
.
dumps
({
...
...
@@ -861,6 +880,7 @@ query codingExercise($eid: ID!, $lang: Language!) {
else
:
return
None
def
_get_exercise_from_pack
(
eid
,
pid
,
lang
,
feedback
=
'dict'
):
headers
=
coding_base_headers
.
copy
()
data
=
json
.
dumps
({
...
...
codiaclientgui/utils.py
View file @
918eaa25
import
sys
from
PyQt5.QtCore
import
Qt
,
QPropertyAnimation
,
pyqtSignal
,
pyqtProperty
,
QEasingCurve
from
PyQt5.QtGui
import
QFont
,
QPalette
,
QBrush
,
QColor
,
QPainterPath
,
QPainter
,
QPen
from
PyQt5.QtWidgets
import
QMessageBox
,
QPushButton
,
QLabel
,
QProgressBar
,
QListWidget
,
QDesktopWidget
...
...
@@ -43,7 +44,8 @@ if sys.platform == 'win32':
Font
[
'main'
].
setPointSize
(
10
)
Font
[
'status'
].
setFamily
(
"KaiTi"
)
Font
[
'status'
].
setPointSize
(
10
)
Style
[
'progressBar'
]
=
"QProgressBar { max-height: 12px; border: none; border-radius: 6px; text-align: center; background-color: #FFFFFF } QProgressBar::chunk { border: none; border-radius: 6px; background: qlineargradient(spread: pad, x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #05A01E, stop: 1 #75C090) }"
Style
[
'progressBar'
]
=
"QProgressBar { max-height: 12px; border: none; border-radius: 6px; text-align: center; background-color: #FFFFFF } QProgressBar::chunk { border: none; border-radius: 6px; background: qlineargradient(spread: pad, x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #05A01E, stop: 1 #75C090) }"
elif
sys
.
platform
==
'darwin'
:
Font
[
'main'
].
setFamily
(
"PingFang SC"
)
Font
[
'main'
].
setPointSize
(
13
)
...
...
@@ -88,6 +90,7 @@ Palette[QPalette.Text]['darkblue'].setBrush(QPalette.Inactive, QPalette.Text, da
darkblueBrush
.
setColor
(
Color
[
'disabled'
])
Palette
[
QPalette
.
Text
][
'darkblue'
].
setBrush
(
QPalette
.
Disabled
,
QPalette
.
Text
,
darkblueBrush
)
class
MyObject
(
QLabel
):
defaultColor
=
Color
[
'white'
]
hoverColor
=
QColor
(
227
,
240
,
255
)
...
...
@@ -110,6 +113,7 @@ class MyObject(QLabel):
palette
.
setBrush
(
QPalette
.
Inactive
,
self
.
Coloring
,
QBrush
(
self
.
defaultColor
))
self
.
setPalette
(
palette
)
self
.
nowColor
=
col
color
=
pyqtProperty
(
QColor
,
fset
=
setColor
)
def
link
(
self
,
linkedObject
):
...
...
@@ -188,16 +192,18 @@ class MyObject(QLabel):
for
x
in
self
.
Anime
:
self
.
Anime
[
x
].
stop
()
self
.
Anime
[
'leave'
].
start
()
class
_NewPushButtonBorder
(
MyObject
):
def
__init__
(
self
,
*
args
,
defaultColor
:
QColor
,
hoverColor
:
QColor
,
pressColor
:
QColor
,
r
:
float
,
d
:
float
,
actualParent
=
None
,
**
kargs
):
def
__init__
(
self
,
*
args
,
defaultColor
:
QColor
,
hoverColor
:
QColor
,
pressColor
:
QColor
,
r
:
float
,
d
:
float
,
actualParent
=
None
,
**
kargs
):
super
(
_NewPushButtonBorder
,
self
).
__init__
(
*
args
,
**
kargs
)
self
.
Coloring
=
QPalette
.
Base
self
.
defaultColor
=
defaultColor
self
.
hoverColor
=
hoverColor
self
.
pressColor
=
pressColor
self
.
link
(
actualParent
)
self
.
r
=
r
# 圆角半径
self
.
d
=
d
# 边框宽度
self
.
r
=
r
# 圆角半径
self
.
d
=
d
# 边框宽度
self
.
Anime
[
'load'
].
setDuration
(
1
)
self
.
Anime
[
'load'
].
setEndValue
(
self
.
defaultColor
)
self
.
Anime
[
'load'
].
setEasingCurve
(
QEasingCurve
.
OutCubic
)
...
...
@@ -217,9 +223,12 @@ class _NewPushButtonBorder(MyObject):
r
=
color
.
red
()
//
2
g
=
color
.
green
()
//
2
b
=
color
.
blue
()
//
2
if
b
>=
g
and
b
>=
r
:
b
=
color
.
blue
()
//
1.6
elif
r
>=
g
and
r
>=
b
:
r
=
color
.
red
()
//
1.6
elif
g
>=
b
and
g
>=
r
:
g
=
color
.
green
()
//
1.6
if
b
>=
g
and
b
>=
r
:
b
=
color
.
blue
()
//
1.6
elif
r
>=
g
and
r
>=
b
:
r
=
color
.
red
()
//
1.6
elif
g
>=
b
and
g
>=
r
:
g
=
color
.
green
()
//
1.6
return
QColor
(
r
,
g
,
b
)
def
paintEvent
(
self
,
e
):
...
...
@@ -251,9 +260,12 @@ class _NewPushButtonBorder(MyObject):
path
.
lineTo
(
y
,
x
-
r
)
self
.
borderPath
=
path
class
_NewPushButton
(
MyObject
):
showed
=
False
def
__init__
(
self
,
*
args
,
defaultColor
:
QColor
=
MyObject
.
defaultColor
,
hoverColor
:
QColor
=
MyObject
.
hoverColor
,
pressColor
:
QColor
=
MyObject
.
pressColor
,
r
=
None
,
d
=
None
,
**
kargs
):
def
__init__
(
self
,
*
args
,
defaultColor
:
QColor
=
MyObject
.
defaultColor
,
hoverColor
:
QColor
=
MyObject
.
hoverColor
,
pressColor
:
QColor
=
MyObject
.
pressColor
,
r
=
None
,
d
=
None
,
**
kargs
):
super
(
_NewPushButton
,
self
).
__init__
(
*
args
,
**
kargs
)
self
.
r
=
r
self
.
d
=
d
...
...
@@ -294,13 +306,16 @@ class _NewPushButton(MyObject):
if
not
self
.
r
:
self
.
r
=
self
.
height
()
/
2
-
1
if
not
self
.
d
:
self
.
d
=
1.5
self
.
link
(
_NewPushButtonBorder
(
r
=
self
.
r
,
d
=
self
.
d
,
defaultColor
=
self
.
defaultColor
,
hoverColor
=
self
.
hoverColor
,
pressColor
=
self
.
pressColor
,
parent
=
self
.
parent
(),
actualParent
=
self
))
self
.
link
(
_NewPushButtonBorder
(
r
=
self
.
r
,
d
=
self
.
d
,
defaultColor
=
self
.
defaultColor
,
hoverColor
=
self
.
hoverColor
,
pressColor
=
self
.
pressColor
,
parent
=
self
.
parent
(),
actualParent
=
self
))
self
.
linkedObject
.
setGeometry
(
self
.
x
(),
self
.
y
(),
self
.
width
(),
self
.
height
())
self
.
linkedObject
.
show
()
self
.
setGeometry
(
self
.
x
()
+
self
.
r
,
self
.
y
()
+
self
.
d
*
2
,
self
.
width
()
-
self
.
r
*
2
,
self
.
height
()
-
self
.
d
*
4
)
self
.
setGeometry
(
self
.
x
()
+
self
.
r
,
self
.
y
()
+
self
.
d
*
2
,
self
.
width
()
-
self
.
r
*
2
,
self
.
height
()
-
self
.
d
*
4
)
self
.
raise_
()
super
(
_NewPushButton
,
self
).
LoadAnime
()
class
_NewProgressBar
(
QProgressBar
):
def
setValue
(
self
,
value
):
QPropertyAnimation
(
self
,
b
"value"
)
...
...
@@ -324,13 +339,16 @@ class _NewProgressBar(QProgressBar):
self
.
Anime
[
'progress'
].
setDuration
(
1500
)
self
.
Anime
[
'progress'
].
setEasingCurve
(
QEasingCurve
.
OutQuart
)
class
_NewListWidget
(
QListWidget
):
def
addItem
(
self
,
item
):
item
.
setBackground
(
Color
[[
'white'
,
'lightgray'
][
self
.
count
()
%
2
]])
super
(
_NewListWidget
,
self
).
addItem
(
item
)
def
__init__
(
self
,
*
args
,
**
kargs
):
super
(
_NewListWidget
,
self
).
__init__
(
*
args
,
**
kargs
)
if
sys
.
platform
==
'win32'
:
NewPushButton
=
_NewPushButton
elif
sys
.
platform
==
'darwin'
:
...
...
@@ -340,6 +358,7 @@ else:
NewProgressBar
=
_NewProgressBar
NewListWidget
=
_NewListWidget
def
ErrorDisplay
(
error
,
_ErrorTranslate
,
knownErrorInfo
:
str
=
"错误"
,
unknownErrorInfo
:
str
=
"未知错误"
):
errorTranslate
=
_ErrorTranslate
(
error
)
if
errorTranslate
:
...
...
@@ -347,13 +366,18 @@ def ErrorDisplay(error, _ErrorTranslate, knownErrorInfo: str = "错误", unknown
else
:
QMessageBox
.
critical
(
None
,
unknownErrorInfo
,
str
(
error
),
QMessageBox
.
Ok
)
def
AdjustWindowInit
()
->
int
:
global
screen
,
screenBASE
from
math
import
sqrt
screen
=
QDesktopWidget
().
screenGeometry
()
screenBASE
=
sqrt
((
screen
.
width
()
*
screen
.
height
())
/
(
1920
*
1080
))
if
sys
.
platform
==
'darwin'
:
screenBASE
=
1
else
:
screenBASE
=
sqrt
((
screen
.
width
()
*
screen
.
height
())
/
(
1920
*
1080
))
return
screenBASE
def
AdjustWindowSize
(
window
)
->
None
:
global
screen
,
screenBASE
stack
=
window
.
children
()
...
...
@@ -368,5 +392,4 @@ def AdjustWindowSize(window) -> None:
window
.
setWindowFlags
(
window
.
windowFlags
()
&
~
Qt
.
WindowMaximizeButtonHint
)
size
=
window
.
geometry
()
window
.
move
((
screen
.
width
()
-
size
.
width
())
/
2
,
(
screen
.
height
()
-
size
.
height
())
/
2
)
(
screen
.
height
()
-
size
.
height
())
/
2
)
loginFunctions.py
View file @
918eaa25
from
os
import
path
from
PyQt5.QtCore
import
QThread
,
pyqtSignal
from
PyQt5.QtWidgets
import
QMainWindow
,
QApplication
from
PyQt5.QtWidgets
import
QMessageBox
,
QLineEdit
from
loginWindow
import
Ui_windowLogin
from
codiaclient
import
report_var
from
codiaclient.cachectrl
import
variables
as
cache_var
from
codiaclient.network
import
*
from
codiaclient.network
import
_acquire_verification
as
_AcquireVerification
from
codiaclient.report
import
Error
as
codiaError
,
error_translate
from
codiaclient.utils
import
cookie_decrypt
as
Decrypt
,
cookie_encrypt
as
Encrypt
from
codiaclient.cachectrl
import
variables
as
cache_var
from
codiaclientgui.utils
import
Font
,
Style
,
ErrorDisplay
,
AdjustWindowSize
from
loginWindow
import
Ui_windowLogin
from
os
import
path
sessionPath
=
path
.
join
(
cache_var
[
'appDataPath'
],
".gui.cache"
)
# 初始化任务,新建一个登录窗体和对应的ui
def
LoginInit
(
callback
=
None
):
def
LoginInit
(
callback
=
None
):
global
windowLogin
,
uiLogin
windowLogin
=
QMainWindow
()
windowLogin
.
setFont
(
Font
[
"main"
])
...
...
@@ -24,11 +25,12 @@ def LoginInit(callback = None):
uiLogin
.
setupUi
(
windowLogin
)
AdjustWindowSize
(
windowLogin
)
PasswordStoreRead
()
BeginLogin
(
callback
=
callback
)
BeginLogin
(
callback
=
callback
)
windowLogin
.
show
()
# 初始化任务,为登陆窗口信号绑定槽函数
def
BeginLogin
(
callback
=
None
):
def
BeginLogin
(
callback
=
None
):
QApplication
.
processEvents
()
report_var
[
"allow_error_deg"
]
=
1
...
...
@@ -57,7 +59,8 @@ def BeginLogin(callback = None):
uiLogin
.
frameRegister
.
hide
()
uiLogin
.
frameReset
.
hide
()
#登录客户端的网络通信
# 登录客户端的网络通信
class
_ClientLogin
(
QThread
):
infoSignal
=
pyqtSignal
()
errorSignal
=
pyqtSignal
(
codiaError
)
...
...
@@ -73,21 +76,26 @@ class _ClientLogin(QThread):
self
.
wait
()
def
run
(
self
):
try
:
client_login
(
username
=
self
.
username
,
password
=
self
.
password
)
except
codiaError
as
e
:
self
.
errorSignal
.
emit
(
e
)
else
:
self
.
infoSignal
.
emit
()
try
:
client_login
(
username
=
self
.
username
,
password
=
self
.
password
)
except
codiaError
as
e
:
self
.
errorSignal
.
emit
(
e
)
else
:
self
.
infoSignal
.
emit
()
#登录客户端的多线程准备
def
ClientLogin
(
username
,
password
,
InfoRecv
=
lambda
:
None
,
ErrorRecv
=
lambda
:
None
):
# 登录客户端的多线程准备
def
ClientLogin
(
username
,
password
,
InfoRecv
=
lambda
:
None
,
ErrorRecv
=
lambda
:
None
):
global
threadClientLogin
threadClientLogin
=
_ClientLogin
(
username
=
username
,
password
=
password
)
threadClientLogin
=
_ClientLogin
(
username
=
username
,
password
=
password
)
threadClientLogin
.
infoSignal
.
connect
(
InfoRecv
)
threadClientLogin
.
errorSignal
.
connect
(
ErrorRecv
)
uiLogin
.
progressBarLogin
.
setValue
(
90
)
threadClientLogin
.
start
()
# 开始进行登录操作
def
Login
(
callback
=
None
):
def
Login
(
callback
=
None
):
loginUsername
=
uiLogin
.
lineEditLoginUsername
.
text
()
loginPassword
=
uiLogin
.
lineEditLoginPassword
.
text
()
if
not
uiLogin
.
lineEditLoginUsername
.
text
():
...
...
@@ -102,6 +110,7 @@ def Login(callback = None):
uiLogin
.
pushButtonLoginGoRegister
.
hide
()
uiLogin
.
progressBarLogin
.
setValue
(
0
)
uiLogin
.
progressBarLogin
.
show
()
def
ErrorRecv
(
e
:
codiaError
):
ErrorDisplay
(
e
,
error_translate
,
"登录失败"
)
uiLogin
.
progressBarLogin
.
hide
()
...
...
@@ -136,7 +145,9 @@ def Login(callback = None):
windowLogin
.
hide
()
callback
and
callback
()
windowLogin
.
close
()
ClientLogin
(
username
=
loginUsername
,
password
=
loginPassword
,
InfoRecv
=
LoginInfoRecv
,
ErrorRecv
=
ErrorRecv
)
ClientLogin
(
username
=
loginUsername
,
password
=
loginPassword
,
InfoRecv
=
LoginInfoRecv
,
ErrorRecv
=
ErrorRecv
)
# 获取重置密码的验证码
def
AcquireVerification
():
...
...
@@ -189,8 +200,8 @@ def Register():
QMessageBox
.
critical
(
None
,
"错误"
,
"两次输入的密码不相同, 请重新输入。"
,
QMessageBox
.
Ok
)
return
try
:
res
=
register
(
username
=
uiLogin
.
lineEditRegisterUsername
.
text
(),
passwd
=
uiLogin
.
lineEditRegisterPassword
.
text
(),
email
=
uiLogin
.
lineEditRegisterUserphone
.
text
())
res
=
register
(
username
=
uiLogin
.
lineEditRegisterUsername
.
text
(),
passwd
=
uiLogin
.
lineEditRegisterPassword
.
text
(),
email
=
uiLogin
.
lineEditRegisterUserphone
.
text
())
except
codiaError
as
e
:
ErrorDisplay
(
e
,
error_translate
,
"注册失败"
)
else
:
...
...
@@ -217,9 +228,9 @@ def Reset():
QMessageBox
.
critical
(
None
,
"错误"
,
"两次输入的密码不相同, 请重新输入。"
,
QMessageBox
.
Ok
)
return
try
:
change_password
(
identifier
=
uiLogin
.
lineEditResetAccount
.
text
(),
vercode
=
uiLogin
.
lineEditResetCheckNum
.
text
(),
passwd
=
uiLogin
.
lineEditResetNewPassword
.
text
(),
passwordconfirm
=
uiLogin
.
lineEditResetCheckNewPassword
.
text
())
change_password
(
identifier
=
uiLogin
.
lineEditResetAccount
.
text
(),
vercode
=
uiLogin
.
lineEditResetCheckNum
.
text
(),
passwd
=
uiLogin
.
lineEditResetNewPassword
.
text
(),
passwordconfirm
=
uiLogin
.
lineEditResetCheckNewPassword
.
text
())
except
codiaError
as
e
:
ErrorDisplay
(
e
,
error_translate
)
else
:
...
...
@@ -240,6 +251,7 @@ def ResetReturn():
uiLogin
.
frameLogin
.
show
()
uiLogin
.
frameReset
.
hide
()
# 从缓存中读取`记住密码`相关配置
def
PasswordStoreRead
():
from
base64
import
b64decode
...
...
loginWindow.py
View file @
918eaa25
...
...
@@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'loginWindow.ui'
#
# Created by: PyQt5 UI code generator 5.15.
2
# Created by: PyQt5 UI code generator 5.15.
4
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
...
...
@@ -15,7 +15,6 @@ class Ui_windowLogin(object):
def
setupUi
(
self
,
windowLogin
):
windowLogin
.
setObjectName
(
"windowLogin"
)
windowLogin
.
resize
(
540
,
320
)
windowLogin
.
setMinimumSize
(
QtCore
.
QSize
(
0
,
0
))
icon
=
QtGui
.
QIcon
()
icon
.
addPixmap
(
QtGui
.
QPixmap
(
"favicon.ico"
),
QtGui
.
QIcon
.
Normal
,
QtGui
.
QIcon
.
Off
)
windowLogin
.
setWindowIcon
(
icon
)
...
...
@@ -35,7 +34,7 @@ class Ui_windowLogin(object):
self
.
checkBox
.
setObjectName
(
"checkBox"
)
self
.
label
=
QtWidgets
.
QLabel
(
self
.
frameLogin
)
self
.
label
.
setGeometry
(
QtCore
.
QRect
(
50
,
70
,
160
,
30
))
self
.
label
.
setAlignment
(
QtCore
.
Qt
.
AlignRight
|
QtCore
.
Qt
.
AlignTrailing
|
QtCore
.
Qt
.
AlignVCenter
)
self
.
label
.
setAlignment
(
QtCore
.
Qt
.
AlignRight
|
QtCore
.
Qt
.
AlignTrailing
|
QtCore
.
Qt
.
AlignVCenter
)
self
.
label
.
setIndent
(
10
)
self
.
label
.
setObjectName
(
"label"
)
self
.
lineEditLoginUsername
=
QtWidgets
.
QLineEdit
(
self
.
frameLogin
)
...
...
@@ -46,7 +45,7 @@ class Ui_windowLogin(object):
self
.
lineEditLoginUsername
.
setObjectName
(
"lineEditLoginUsername"
)
self
.
label_2
=
QtWidgets
.
QLabel
(
self
.
frameLogin
)
self
.
label_2
.
setGeometry
(
QtCore
.
QRect
(
50
,
110
,
160
,
30
))
self
.
label_2
.
setAlignment
(
QtCore
.
Qt
.
AlignRight
|
QtCore
.
Qt
.
AlignTrailing
|
QtCore
.
Qt
.
AlignVCenter
)
self
.
label_2
.
setAlignment
(
QtCore
.
Qt
.
AlignRight
|
QtCore
.
Qt
.
AlignTrailing
|
QtCore
.
Qt
.
AlignVCenter
)
self
.
label_2
.
setIndent
(
10
)
self
.
label_2
.
setObjectName
(
"label_2"
)
self
.
lineEditLoginPassword
=
QtWidgets
.
QLineEdit
(
self
.
frameLogin
)
...
...
@@ -97,17 +96,17 @@ class Ui_windowLogin(object):
self
.
lineEditRegisterCheckPassword
.
setObjectName
(
"lineEditRegisterCheckPassword"
)
self
.
label_3
=
QtWidgets
.
QLabel
(
self
.
frameRegister
)
self
.
label_3
.
setGeometry
(
QtCore
.
QRect
(
50
,
70
,
160
,
30
))
self
.
label_3
.
setAlignment
(
QtCore
.
Qt
.
AlignRight
|
QtCore
.
Qt
.
AlignTrailing
|
QtCore
.
Qt
.
AlignVCenter
)
self
.
label_3
.
setAlignment
(
QtCore
.
Qt
.
AlignRight
|
QtCore
.
Qt
.
AlignTrailing
|
QtCore
.
Qt
.
AlignVCenter
)
self
.
label_3
.
setIndent
(
10
)
self
.
label_3
.
setObjectName
(
"label_3"
)
self
.
label_4
=
QtWidgets
.
QLabel
(
self
.
frameRegister
)
self
.
label_4
.
setGeometry
(
QtCore
.
QRect
(
50
,
110
,
160
,
30
))
self
.
label_4
.
setAlignment
(
QtCore
.
Qt
.
AlignRight
|
QtCore
.
Qt
.
AlignTrailing
|
QtCore
.
Qt
.
AlignVCenter
)
self
.
label_4
.
setAlignment
(
QtCore
.
Qt
.
AlignRight
|
QtCore
.
Qt
.
AlignTrailing
|
QtCore
.
Qt
.
AlignVCenter
)
self
.
label_4
.
setIndent
(
10
)
self
.
label_4
.
setObjectName
(
"label_4"
)
self
.
label_5
=
QtWidgets
.
QLabel
(
self
.
frameRegister
)
self
.
label_5
.
setGeometry
(
QtCore
.
QRect
(
50
,
30
,
160
,
30
))
self
.
label_5
.
setAlignment
(
QtCore
.
Qt
.
AlignRight
|
QtCore
.
Qt
.
AlignTrailing
|
QtCore
.
Qt
.
AlignVCenter
)
self
.
label_5
.
setAlignment
(
QtCore
.
Qt
.
AlignRight
|
QtCore
.
Qt
.
AlignTrailing
|
QtCore
.
Qt
.
AlignVCenter
)
self
.
label_5
.
setIndent
(
10
)
self
.
label_5
.
setObjectName
(
"label_5"
)
self
.
lineEditRegisterUserphone
=
QtWidgets
.
QLineEdit
(
self
.
frameRegister
)
...
...
@@ -118,7 +117,7 @@ class Ui_windowLogin(object):
self
.
lineEditRegisterUserphone
.
setObjectName
(
"lineEditRegisterUserphone"
)
self
.
label_6
=
QtWidgets
.
QLabel
(
self
.
frameRegister
)
self
.
label_6
.
setGeometry
(
QtCore
.
QRect
(
50
,
150
,
160
,
30
))
self
.
label_6
.
setAlignment
(
QtCore
.
Qt
.
AlignRight
|
QtCore
.
Qt
.
AlignTrailing
|
QtCore
.
Qt
.
AlignVCenter
)
self
.
label_6
.
setAlignment
(
QtCore
.
Qt
.
AlignRight
|
QtCore
.
Qt
.
AlignTrailing
|
QtCore
.
Qt
.
AlignVCenter
)
self
.
label_6
.
setIndent
(
10
)
self
.
label_6
.
setObjectName
(
"label_6"
)
self
.
lineEditRegisterUsername
=
QtWidgets
.
QLineEdit
(
self
.
frameRegister
)
...
...
@@ -140,12 +139,12 @@ class Ui_windowLogin(object):
self
.
pushButtonReset
.
setObjectName
(
"pushButtonReset"
)
self
.
label_7
=
QtWidgets
.
QLabel
(
self
.
frameReset
)
self
.
label_7
.
setGeometry
(
QtCore
.
QRect
(
60
,
30
,
150
,
30
))
self
.
label_7
.
setAlignment
(
QtCore
.
Qt
.
AlignRight
|
QtCore
.
Qt
.
AlignTrailing
|
QtCore
.
Qt
.
AlignVCenter
)
self
.
label_7
.
setAlignment
(
QtCore
.
Qt
.
AlignRight
|
QtCore
.
Qt
.
AlignTrailing
|
QtCore
.
Qt
.
AlignVCenter
)
self
.
label_7
.
setIndent
(
10
)
self
.
label_7
.
setObjectName
(
"label_7"
)
self
.
label_8
=
QtWidgets
.
QLabel
(
self
.
frameReset
)
self
.
label_8
.
setGeometry
(
QtCore
.
QRect
(
60
,
150
,
150
,
30
))
self
.
label_8
.
setAlignment
(
QtCore
.
Qt
.
AlignRight
|
QtCore
.
Qt
.
AlignTrailing
|
QtCore
.
Qt
.
AlignVCenter
)
self
.
label_8
.
setAlignment
(
QtCore
.
Qt
.
AlignRight
|
QtCore
.
Qt
.
AlignTrailing
|
QtCore
.
Qt
.
AlignVCenter
)
self
.
label_8
.
setIndent
(
10
)
self
.
label_8
.
setObjectName
(
"label_8"
)
self
.
lineEditResetCheckNewPassword
=
QtWidgets
.
QLineEdit
(
self
.
frameReset
)
...
...
@@ -156,7 +155,7 @@ class Ui_windowLogin(object):
self
.
lineEditResetCheckNewPassword
.
setObjectName
(
"lineEditResetCheckNewPassword"
)
self
.
label_9
=
QtWidgets
.
QLabel
(
self
.
frameReset
)
self
.
label_9
.
setGeometry
(
QtCore
.
QRect
(
60
,
70
,
150
,
30
))
self
.
label_9
.
setAlignment
(
QtCore
.
Qt
.
AlignRight
|
QtCore
.
Qt
.
AlignTrailing
|
QtCore
.
Qt
.
AlignVCenter
)
self
.
label_9
.
setAlignment
(
QtCore
.
Qt
.
AlignRight
|
QtCore
.
Qt
.
AlignTrailing
|
QtCore
.
Qt
.
AlignVCenter
)
self
.
label_9
.
setIndent
(
10
)
self
.
label_9
.
setObjectName
(
"label_9"
)
self
.
lineEditResetCheckNum
=
QtWidgets
.
QLineEdit
(
self
.
frameReset
)
...
...
@@ -175,7 +174,7 @@ class Ui_windowLogin(object):
self
.
lineEditResetAccount
.
setObjectName
(
"lineEditResetAccount"
)
self
.
label_10
=
QtWidgets
.
QLabel
(
self
.
frameReset
)
self
.
label_10
.
setGeometry
(
QtCore
.
QRect
(
60
,
110
,
150
,
30
))
self
.
label_10
.
setAlignment
(
QtCore
.
Qt
.
AlignRight
|
QtCore
.
Qt
.
AlignTrailing
|
QtCore
.
Qt
.
AlignVCenter
)
self
.
label_10
.
setAlignment
(
QtCore
.
Qt
.
AlignRight
|
QtCore
.
Qt
.
AlignTrailing
|
QtCore
.
Qt
.
AlignVCenter
)
self
.
label_10
.
setIndent
(
10
)
self
.
label_10
.
setObjectName
(
"label_10"
)
self
.
lineEditResetNewPassword
=
QtWidgets
.
QLineEdit
(
self
.
frameReset
)
...
...
@@ -195,10 +194,10 @@ class Ui_windowLogin(object):
self
.
frameLogin
.
raise_
()
windowLogin
.
setCentralWidget
(
self
.
centralwidget
)
self
.
menuBar
=
QtWidgets
.
QMenuBar
(
windowLogin
)
self
.
menuBar
.
setGeometry
(
QtCore
.
QRect
(
0
,
0
,
540
,
2
6
))
self
.
menuBar
.
setGeometry
(
QtCore
.
QRect
(
0
,
0
,
540
,
2
4
))
self
.
menuBar
.
setObjectName
(
"menuBar"
)
self
.
menu
=
QtWidgets
.
QMenu
(
self
.
menuBar
)
self
.
menu
.
setGeometry
(
QtCore
.
QRect
(
270
,
156
,
1
37
,
78
))
self
.
menu
.
setGeometry
(
QtCore
.
QRect
(
270
,
156
,
1
20
,
62
))
self
.
menu
.
setObjectName
(
"menu"
)
windowLogin
.
setMenuBar
(
self
.
menuBar
)
self
.
actions
=
QtWidgets
.
QAction
(
windowLogin
)
...
...
@@ -242,4 +241,6 @@ class Ui_windowLogin(object):
self
.
action
.
setText
(
_translate
(
"windowLogin"
,
"关于"
))
self
.
actionsd
.
setText
(
_translate
(
"windowLogin"
,
"登陆"
))
self
.
action_2
.
setText
(
_translate
(
"windowLogin"
,
"关于"
))
from
codiaclientgui.utils
import
NewProgressBar
,
NewPushButton
loginWindow.ui
View file @
918eaa25
...
...
@@ -10,12 +10,6 @@
<height>
320
</height>
</rect>
</property>
<property
name=
"minimumSize"
>
<size>
<width>
0
</width>
<height>
0
</height>
</size>
</property>
<property
name=
"windowTitle"
>
<string>
欢迎使用Codia——登录
</string>
</property>
...
...
@@ -576,7 +570,7 @@
<x>
0
</x>
<y>
0
</y>
<width>
540
</width>
<height>
2
6
</height>
<height>
2
4
</height>
</rect>
</property>
<widget
class=
"QMenu"
name=
"menu"
>
...
...
@@ -584,8 +578,8 @@
<rect>
<x>
270
</x>
<y>
156
</y>
<width>
1
37
</width>
<height>
78
</height>
<width>
1
20
</width>
<height>
62
</height>
</rect>
</property>
<property
name=
"title"
>
...
...
main.py
View file @
918eaa25
...
...
@@ -2,14 +2,14 @@ import sys
from
PyQt5.QtWidgets
import
QApplication
from
mainFunctions
import
MainInit
from
loginFunctions
import
LoginInit
from
codiaclientgui.utils
import
AdjustWindowInit
from
loginFunctions
import
LoginInit