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
2804d0d2
Commit
2804d0d2
authored
Jul 06, 2021
by
Zheng Yile
Browse files
尝试适应不同分辨率的屏幕
parent
d8008a73
Changes
7
Hide whitespace changes
Inline
Side-by-side
codiaclientgui/utils.py
View file @
2804d0d2
import
sys
import
sys
from
PyQt5.QtCore
import
Qt
,
QPropertyAnimation
,
pyqtSignal
,
pyqtProperty
,
QEasingCurve
from
PyQt5.QtCore
import
Qt
,
QPropertyAnimation
,
pyqtSignal
,
pyqtProperty
,
QEasingCurve
from
PyQt5.QtGui
import
QFont
,
QPalette
,
QBrush
,
QColor
,
QPainterPath
,
QPainter
,
QPen
from
PyQt5.QtGui
import
QFont
,
QPalette
,
QBrush
,
QColor
,
QPainterPath
,
QPainter
,
QPen
from
PyQt5.QtWidgets
import
QMessageBox
,
QPushButton
,
QLabel
,
QProgressBar
,
QListWidget
from
PyQt5.QtWidgets
import
QMessageBox
,
QPushButton
,
QLabel
,
QProgressBar
,
QListWidget
,
QDesktopWidget
Font
=
{
Font
=
{
'main'
:
QFont
(),
'main'
:
QFont
(),
...
@@ -346,3 +346,22 @@ def ErrorDisplay(error, _ErrorTranslate, knownErrorInfo: str = "错误", unknown
...
@@ -346,3 +346,22 @@ def ErrorDisplay(error, _ErrorTranslate, knownErrorInfo: str = "错误", unknown
QMessageBox
.
critical
(
None
,
knownErrorInfo
,
errorTranslate
,
QMessageBox
.
Ok
)
QMessageBox
.
critical
(
None
,
knownErrorInfo
,
errorTranslate
,
QMessageBox
.
Ok
)
else
:
else
:
QMessageBox
.
critical
(
None
,
unknownErrorInfo
,
str
(
error
),
QMessageBox
.
Ok
)
QMessageBox
.
critical
(
None
,
unknownErrorInfo
,
str
(
error
),
QMessageBox
.
Ok
)
def
AdjustWindowSize
(
window
):
screen
=
QDesktopWidget
().
screenGeometry
()
from
math
import
sqrt
BASE
=
sqrt
((
screen
.
width
()
*
screen
.
height
())
/
(
1920
*
1080
))
stack
=
window
.
children
()
while
len
(
stack
):
x
=
stack
.
pop
()
stack
.
extend
(
x
.
children
())
try
:
x
.
setGeometry
(
x
.
x
()
*
BASE
,
x
.
y
()
*
BASE
,
x
.
width
()
*
BASE
,
x
.
height
()
*
BASE
)
except
:
pass
window
.
setFixedSize
(
window
.
width
()
*
BASE
,
window
.
height
()
*
BASE
)
window
.
setWindowFlags
(
window
.
windowFlags
()
&
~
Qt
.
WindowMaximizeButtonHint
)
size
=
window
.
geometry
()
window
.
move
((
screen
.
width
()
-
size
.
width
())
/
2
,
(
screen
.
height
()
-
size
.
height
())
/
2
)
loginFunctions.py
View file @
2804d0d2
...
@@ -10,7 +10,7 @@ from codiaclient.network import _acquire_verification as _AcquireVerification
...
@@ -10,7 +10,7 @@ from codiaclient.network import _acquire_verification as _AcquireVerification
from
codiaclient.report
import
Error
as
codiaError
,
error_translate
from
codiaclient.report
import
Error
as
codiaError
,
error_translate
from
codiaclient.utils
import
cookie_decrypt
as
Decrypt
,
cookie_encrypt
as
Encrypt
from
codiaclient.utils
import
cookie_decrypt
as
Decrypt
,
cookie_encrypt
as
Encrypt
from
codiaclient.cachectrl
import
variables
as
cache_var
from
codiaclient.cachectrl
import
variables
as
cache_var
from
codiaclientgui.utils
import
Font
,
Style
,
ErrorDisplay
from
codiaclientgui.utils
import
Font
,
Style
,
ErrorDisplay
,
AdjustWindowSize
from
os
import
path
from
os
import
path
sessionPath
=
path
.
join
(
cache_var
[
'appDataPath'
],
".gui.cache"
)
sessionPath
=
path
.
join
(
cache_var
[
'appDataPath'
],
".gui.cache"
)
...
@@ -22,6 +22,7 @@ def LoginInit(callback = None):
...
@@ -22,6 +22,7 @@ def LoginInit(callback = None):
windowLogin
.
setFont
(
Font
[
"main"
])
windowLogin
.
setFont
(
Font
[
"main"
])
uiLogin
=
Ui_windowLogin
()
uiLogin
=
Ui_windowLogin
()
uiLogin
.
setupUi
(
windowLogin
)
uiLogin
.
setupUi
(
windowLogin
)
AdjustWindowSize
(
windowLogin
)
PasswordStoreRead
()
PasswordStoreRead
()
BeginLogin
(
callback
=
callback
)
BeginLogin
(
callback
=
callback
)
windowLogin
.
show
()
windowLogin
.
show
()
...
...
loginWindow.py
View file @
2804d0d2
...
@@ -16,17 +16,14 @@ class Ui_windowLogin(object):
...
@@ -16,17 +16,14 @@ class Ui_windowLogin(object):
windowLogin
.
setObjectName
(
"windowLogin"
)
windowLogin
.
setObjectName
(
"windowLogin"
)
windowLogin
.
resize
(
540
,
320
)
windowLogin
.
resize
(
540
,
320
)
windowLogin
.
setMinimumSize
(
QtCore
.
QSize
(
0
,
0
))
windowLogin
.
setMinimumSize
(
QtCore
.
QSize
(
0
,
0
))
windowLogin
.
setMaximumSize
(
QtCore
.
QSize
(
640
,
420
))
icon
=
QtGui
.
QIcon
()
icon
=
QtGui
.
QIcon
()
icon
.
addPixmap
(
QtGui
.
QPixmap
(
"favicon.ico"
),
QtGui
.
QIcon
.
Normal
,
QtGui
.
QIcon
.
Off
)
icon
.
addPixmap
(
QtGui
.
QPixmap
(
"favicon.ico"
),
QtGui
.
QIcon
.
Normal
,
QtGui
.
QIcon
.
Off
)
windowLogin
.
setWindowIcon
(
icon
)
windowLogin
.
setWindowIcon
(
icon
)
windowLogin
.
setWindowOpacity
(
1.0
)
windowLogin
.
setWindowOpacity
(
1.0
)
self
.
centralwidget
=
QtWidgets
.
QWidget
(
windowLogin
)
self
.
centralwidget
=
QtWidgets
.
QWidget
(
windowLogin
)
self
.
centralwidget
.
setMaximumSize
(
QtCore
.
QSize
(
640
,
360
))
self
.
centralwidget
.
setObjectName
(
"centralwidget"
)
self
.
centralwidget
.
setObjectName
(
"centralwidget"
)
self
.
frameLogin
=
QtWidgets
.
QFrame
(
self
.
centralwidget
)
self
.
frameLogin
=
QtWidgets
.
QFrame
(
self
.
centralwidget
)
self
.
frameLogin
.
setGeometry
(
QtCore
.
QRect
(
0
,
0
,
540
,
294
))
self
.
frameLogin
.
setGeometry
(
QtCore
.
QRect
(
0
,
0
,
540
,
294
))
self
.
frameLogin
.
setMaximumSize
(
QtCore
.
QSize
(
640
,
360
))
self
.
frameLogin
.
setFrameShape
(
QtWidgets
.
QFrame
.
NoFrame
)
self
.
frameLogin
.
setFrameShape
(
QtWidgets
.
QFrame
.
NoFrame
)
self
.
frameLogin
.
setFrameShadow
(
QtWidgets
.
QFrame
.
Raised
)
self
.
frameLogin
.
setFrameShadow
(
QtWidgets
.
QFrame
.
Raised
)
self
.
frameLogin
.
setObjectName
(
"frameLogin"
)
self
.
frameLogin
.
setObjectName
(
"frameLogin"
)
...
...
loginWindow.ui
View file @
2804d0d2
...
@@ -16,12 +16,6 @@
...
@@ -16,12 +16,6 @@
<height>
0
</height>
<height>
0
</height>
</size>
</size>
</property>
</property>
<property
name=
"maximumSize"
>
<size>
<width>
640
</width>
<height>
420
</height>
</size>
</property>
<property
name=
"windowTitle"
>
<property
name=
"windowTitle"
>
<string>
欢迎使用Codia——登录
</string>
<string>
欢迎使用Codia——登录
</string>
</property>
</property>
...
@@ -33,12 +27,6 @@
...
@@ -33,12 +27,6 @@
<double>
1.000000000000000
</double>
<double>
1.000000000000000
</double>
</property>
</property>
<widget
class=
"QWidget"
name=
"centralwidget"
>
<widget
class=
"QWidget"
name=
"centralwidget"
>
<property
name=
"maximumSize"
>
<size>
<width>
640
</width>
<height>
360
</height>
</size>
</property>
<widget
class=
"QFrame"
name=
"frameLogin"
>
<widget
class=
"QFrame"
name=
"frameLogin"
>
<property
name=
"geometry"
>
<property
name=
"geometry"
>
<rect>
<rect>
...
@@ -48,12 +36,6 @@
...
@@ -48,12 +36,6 @@
<height>
294
</height>
<height>
294
</height>
</rect>
</rect>
</property>
</property>
<property
name=
"maximumSize"
>
<size>
<width>
640
</width>
<height>
360
</height>
</size>
</property>
<property
name=
"frameShape"
>
<property
name=
"frameShape"
>
<enum>
QFrame::NoFrame
</enum>
<enum>
QFrame::NoFrame
</enum>
</property>
</property>
...
...
mainFunctions.py
View file @
2804d0d2
...
@@ -14,7 +14,7 @@ from codiaclient.network import get_pack, show_pack, start_pack, logined, get_ex
...
@@ -14,7 +14,7 @@ from codiaclient.network import get_pack, show_pack, start_pack, logined, get_ex
from
codiaclient.network
import
submit
,
get_data
from
codiaclient.network
import
submit
,
get_data
from
codiaclient.report
import
Error
as
codiaError
,
error_translate
from
codiaclient.report
import
Error
as
codiaError
,
error_translate
from
codiaclient.requests
import
variables
as
requests_var
from
codiaclient.requests
import
variables
as
requests_var
from
codiaclientgui.utils
import
QPalette
,
Font
,
Palette
,
Style
,
ErrorDisplay
,
NewListWidget
from
codiaclientgui.utils
import
QPalette
,
Font
,
Palette
,
Style
,
ErrorDisplay
,
NewListWidget
,
AdjustWindowSize
from
mainWindow
import
Ui_windowMain
from
mainWindow
import
Ui_windowMain
variables
=
{
variables
=
{
...
@@ -216,6 +216,7 @@ def MainInit(callback=None):
...
@@ -216,6 +216,7 @@ def MainInit(callback=None):
windowMain
.
setFont
(
Font
[
"main"
])
windowMain
.
setFont
(
Font
[
"main"
])
uiMain
=
Ui_windowMain
()
uiMain
=
Ui_windowMain
()
uiMain
.
setupUi
(
windowMain
)
uiMain
.
setupUi
(
windowMain
)
AdjustWindowSize
(
windowMain
)
BeginMain
(
callback
=
callback
)
BeginMain
(
callback
=
callback
)
windowMain
.
show
()
windowMain
.
show
()
GetPage
()
GetPage
()
...
...
mainWindow.py
View file @
2804d0d2
...
@@ -25,8 +25,6 @@ class Ui_windowMain(object):
...
@@ -25,8 +25,6 @@ class Ui_windowMain(object):
self
.
centralwidget
.
setObjectName
(
"centralwidget"
)
self
.
centralwidget
.
setObjectName
(
"centralwidget"
)
self
.
framePack
=
QtWidgets
.
QFrame
(
self
.
centralwidget
)
self
.
framePack
=
QtWidgets
.
QFrame
(
self
.
centralwidget
)
self
.
framePack
.
setGeometry
(
QtCore
.
QRect
(
0
,
0
,
1080
,
768
))
self
.
framePack
.
setGeometry
(
QtCore
.
QRect
(
0
,
0
,
1080
,
768
))
self
.
framePack
.
setMinimumSize
(
QtCore
.
QSize
(
1080
,
768
))
self
.
framePack
.
setMaximumSize
(
QtCore
.
QSize
(
1280
,
768
))
self
.
framePack
.
setFrameShape
(
QtWidgets
.
QFrame
.
NoFrame
)
self
.
framePack
.
setFrameShape
(
QtWidgets
.
QFrame
.
NoFrame
)
self
.
framePack
.
setFrameShadow
(
QtWidgets
.
QFrame
.
Raised
)
self
.
framePack
.
setFrameShadow
(
QtWidgets
.
QFrame
.
Raised
)
self
.
framePack
.
setObjectName
(
"framePack"
)
self
.
framePack
.
setObjectName
(
"framePack"
)
...
@@ -54,8 +52,6 @@ class Ui_windowMain(object):
...
@@ -54,8 +52,6 @@ class Ui_windowMain(object):
self
.
progressBarPack
.
setObjectName
(
"progressBarPack"
)
self
.
progressBarPack
.
setObjectName
(
"progressBarPack"
)
self
.
frameExercise
=
QtWidgets
.
QFrame
(
self
.
centralwidget
)
self
.
frameExercise
=
QtWidgets
.
QFrame
(
self
.
centralwidget
)
self
.
frameExercise
.
setGeometry
(
QtCore
.
QRect
(
0
,
0
,
1080
,
768
))
self
.
frameExercise
.
setGeometry
(
QtCore
.
QRect
(
0
,
0
,
1080
,
768
))
self
.
frameExercise
.
setMinimumSize
(
QtCore
.
QSize
(
1080
,
768
))
self
.
frameExercise
.
setMaximumSize
(
QtCore
.
QSize
(
1280
,
768
))
self
.
frameExercise
.
setFrameShape
(
QtWidgets
.
QFrame
.
NoFrame
)
self
.
frameExercise
.
setFrameShape
(
QtWidgets
.
QFrame
.
NoFrame
)
self
.
frameExercise
.
setFrameShadow
(
QtWidgets
.
QFrame
.
Raised
)
self
.
frameExercise
.
setFrameShadow
(
QtWidgets
.
QFrame
.
Raised
)
self
.
frameExercise
.
setObjectName
(
"frameExercise"
)
self
.
frameExercise
.
setObjectName
(
"frameExercise"
)
...
@@ -175,8 +171,6 @@ class Ui_windowMain(object):
...
@@ -175,8 +171,6 @@ class Ui_windowMain(object):
self
.
pushButtonHistoryBack
.
setObjectName
(
"pushButtonHistoryBack"
)
self
.
pushButtonHistoryBack
.
setObjectName
(
"pushButtonHistoryBack"
)
self
.
frameCode
=
QtWidgets
.
QFrame
(
self
.
centralwidget
)
self
.
frameCode
=
QtWidgets
.
QFrame
(
self
.
centralwidget
)
self
.
frameCode
.
setGeometry
(
QtCore
.
QRect
(
0
,
0
,
1080
,
768
))
self
.
frameCode
.
setGeometry
(
QtCore
.
QRect
(
0
,
0
,
1080
,
768
))
self
.
frameCode
.
setMinimumSize
(
QtCore
.
QSize
(
1080
,
768
))
self
.
frameCode
.
setMaximumSize
(
QtCore
.
QSize
(
1280
,
768
))
self
.
frameCode
.
setFrameShape
(
QtWidgets
.
QFrame
.
NoFrame
)
self
.
frameCode
.
setFrameShape
(
QtWidgets
.
QFrame
.
NoFrame
)
self
.
frameCode
.
setFrameShadow
(
QtWidgets
.
QFrame
.
Raised
)
self
.
frameCode
.
setFrameShadow
(
QtWidgets
.
QFrame
.
Raised
)
self
.
frameCode
.
setObjectName
(
"frameCode"
)
self
.
frameCode
.
setObjectName
(
"frameCode"
)
...
@@ -195,8 +189,6 @@ class Ui_windowMain(object):
...
@@ -195,8 +189,6 @@ class Ui_windowMain(object):
self
.
pushButtonCodeBack
.
setObjectName
(
"pushButtonCodeBack"
)
self
.
pushButtonCodeBack
.
setObjectName
(
"pushButtonCodeBack"
)
self
.
frameTestData
=
QtWidgets
.
QFrame
(
self
.
centralwidget
)
self
.
frameTestData
=
QtWidgets
.
QFrame
(
self
.
centralwidget
)
self
.
frameTestData
.
setGeometry
(
QtCore
.
QRect
(
0
,
0
,
1080
,
768
))
self
.
frameTestData
.
setGeometry
(
QtCore
.
QRect
(
0
,
0
,
1080
,
768
))
self
.
frameTestData
.
setMinimumSize
(
QtCore
.
QSize
(
1080
,
768
))
self
.
frameTestData
.
setMaximumSize
(
QtCore
.
QSize
(
1280
,
768
))
self
.
frameTestData
.
setFrameShape
(
QtWidgets
.
QFrame
.
NoFrame
)
self
.
frameTestData
.
setFrameShape
(
QtWidgets
.
QFrame
.
NoFrame
)
self
.
frameTestData
.
setFrameShadow
(
QtWidgets
.
QFrame
.
Raised
)
self
.
frameTestData
.
setFrameShadow
(
QtWidgets
.
QFrame
.
Raised
)
self
.
frameTestData
.
setObjectName
(
"frameTestData"
)
self
.
frameTestData
.
setObjectName
(
"frameTestData"
)
...
...
mainWindow.ui
View file @
2804d0d2
...
@@ -42,18 +42,6 @@
...
@@ -42,18 +42,6 @@
<height>
768
</height>
<height>
768
</height>
</rect>
</rect>
</property>
</property>
<property
name=
"minimumSize"
>
<size>
<width>
1080
</width>
<height>
768
</height>
</size>
</property>
<property
name=
"maximumSize"
>
<size>
<width>
1280
</width>
<height>
768
</height>
</size>
</property>
<property
name=
"frameShape"
>
<property
name=
"frameShape"
>
<enum>
QFrame::NoFrame
</enum>
<enum>
QFrame::NoFrame
</enum>
</property>
</property>
...
@@ -157,18 +145,6 @@
...
@@ -157,18 +145,6 @@
<height>
768
</height>
<height>
768
</height>
</rect>
</rect>
</property>
</property>
<property
name=
"minimumSize"
>
<size>
<width>
1080
</width>
<height>
768
</height>
</size>
</property>
<property
name=
"maximumSize"
>
<size>
<width>
1280
</width>
<height>
768
</height>
</size>
</property>
<property
name=
"frameShape"
>
<property
name=
"frameShape"
>
<enum>
QFrame::NoFrame
</enum>
<enum>
QFrame::NoFrame
</enum>
</property>
</property>
...
@@ -589,18 +565,6 @@
...
@@ -589,18 +565,6 @@
<height>
768
</height>
<height>
768
</height>
</rect>
</rect>
</property>
</property>
<property
name=
"minimumSize"
>
<size>
<width>
1080
</width>
<height>
768
</height>
</size>
</property>
<property
name=
"maximumSize"
>
<size>
<width>
1280
</width>
<height>
768
</height>
</size>
</property>
<property
name=
"frameShape"
>
<property
name=
"frameShape"
>
<enum>
QFrame::NoFrame
</enum>
<enum>
QFrame::NoFrame
</enum>
</property>
</property>
...
@@ -661,18 +625,6 @@
...
@@ -661,18 +625,6 @@
<height>
768
</height>
<height>
768
</height>
</rect>
</rect>
</property>
</property>
<property
name=
"minimumSize"
>
<size>
<width>
1080
</width>
<height>
768
</height>
</size>
</property>
<property
name=
"maximumSize"
>
<size>
<width>
1280
</width>
<height>
768
</height>
</size>
</property>
<property
name=
"frameShape"
>
<property
name=
"frameShape"
>
<enum>
QFrame::NoFrame
</enum>
<enum>
QFrame::NoFrame
</enum>
</property>
</property>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment