Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PR-Baby-A18
Babyfut
Commits
7b29a21e
Commit
7b29a21e
authored
Sep 29, 2018
by
Antoine Lima
Browse files
Auth2P and leaderboard modules
parent
41ec7952
Changes
8
Hide whitespace changes
Inline
Side-by-side
.gitignore
View file @
7b29a21e
/__pycache__/
*/__pycache__/
*/*.log
*/*_ui.py
...
...
main.py
View file @
7b29a21e
...
...
@@ -21,7 +21,7 @@ class MainWin(QtWidgets.QMainWindow):
self
.
ui
=
Ui_MainWindow
()
self
.
ui
.
setupUi
(
self
)
self
.
modules
=
[
MenuModule
,
GameModule
,
OptionsModule
]
self
.
modules
=
[
MenuModule
,
GameModule
,
OptionsModule
,
AuthModule
,
LeaderboardModule
]
for
mod
in
self
.
modules
:
self
.
ui
.
panels
.
addWidget
(
mod
(
self
))
...
...
modules/auth.py
0 → 100644
View file @
7b29a21e
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 18 18:34:40 2018
@author: Antoine Lima, Leo Reynaert, Domitille Jehenne
"""
import
logging
from
PyQt5.QtCore
import
QTime
from
module
import
Module
import
modules
from
ui.auth2p_ui
import
Ui_Form
as
Auth2pWidget
class
AuthModule
(
Module
):
def
__init__
(
self
,
parent
):
super
().
__init__
(
parent
,
Auth2pWidget
())
self
.
ui
.
btnDone
.
clicked
.
connect
(
self
.
ui_handleClick_btnDone
)
self
.
ui
.
btnCancel
.
clicked
.
connect
(
self
.
ui_handleClick_btnCancel
)
def
load
(
self
):
logging
.
debug
(
'Loading AuthModule'
)
def
unload
(
self
):
logging
.
debug
(
'Unloading AuthModule'
)
def
other
(
self
,
**
kwargs
):
logging
.
debug
(
'Other AuthModule'
)
def
ui_handleClick_btnCancel
(
self
):
self
.
switchModule
(
modules
.
MenuModule
)
def
ui_handleClick_btnDone
(
self
):
self
.
switchModule
(
modules
.
GameModule
)
modules/leaderboard.py
0 → 100644
View file @
7b29a21e
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 18 18:34:40 2018
@author: Antoine Lima, Leo Reynaert, Domitille Jehenne
"""
import
logging
from
PyQt5.QtCore
import
QTime
from
module
import
Module
import
modules
from
ui.leaderboard_ui
import
Ui_Form
as
LeaderboardWidget
class
LeaderboardModule
(
Module
):
def
__init__
(
self
,
parent
):
super
().
__init__
(
parent
,
LeaderboardWidget
())
self
.
ui
.
btnExit
.
clicked
.
connect
(
self
.
ui_handleClick_btnExit
)
def
load
(
self
):
logging
.
debug
(
'Loading LeaderboardModule'
)
def
unload
(
self
):
logging
.
debug
(
'Unloading LeaderboardModule'
)
def
other
(
self
,
**
kwargs
):
logging
.
debug
(
'Other LeaderboardModule'
)
def
ui_handleClick_btnExit
(
self
):
self
.
switchModule
(
modules
.
MenuModule
)
modules/menu.py
View file @
7b29a21e
...
...
@@ -17,11 +17,12 @@ class MenuModule(Module):
super
().
__init__
(
parent
,
MenuWidget
())
# Button connections
self
.
ui
.
btnStart2p
.
clicked
.
connect
(
self
.
ui_handleClick_btnStart
)
self
.
ui
.
btnStartParty
.
clicked
.
connect
(
self
.
ui_handleClick_btnStart
)
self
.
ui
.
btnStartLeague
.
clicked
.
connect
(
self
.
ui_handleClick_btnStart
)
self
.
ui
.
btnOptions
.
clicked
.
connect
(
self
.
ui_handleClick_btnOptions
)
self
.
ui
.
btnExit
.
clicked
.
connect
(
self
.
ui_handleClick_btnExit
)
self
.
ui
.
btnStart2p
.
clicked
.
connect
(
lambda
:
self
.
switchModule
(
modules
.
AuthModule
))
self
.
ui
.
btnStartParty
.
clicked
.
connect
(
lambda
:
self
.
switchModule
(
modules
.
GameModule
))
self
.
ui
.
btnStartLeague
.
clicked
.
connect
(
lambda
:
self
.
switchModule
(
modules
.
GameModule
))
self
.
ui
.
btnLeaderboard
.
clicked
.
connect
(
lambda
:
self
.
switchModule
(
modules
.
LeaderboardModule
))
self
.
ui
.
btnOptions
.
clicked
.
connect
(
lambda
:
self
.
switchModule
(
modules
.
OptionsModule
))
self
.
ui
.
btnExit
.
clicked
.
connect
(
self
.
ui_handleClick_btnExit
)
def
load
(
self
):
logging
.
debug
(
'Loading MenuModule'
)
...
...
@@ -32,13 +33,6 @@ class MenuModule(Module):
def
other
(
self
,
**
kwargs
):
logging
.
debug
(
'Other MenuModule'
)
def
ui_handleClick_btnStart
(
self
):
logging
.
debug
(
'start'
)
self
.
switchModule
(
modules
.
GameModule
)
def
ui_handleClick_btnOptions
(
self
):
self
.
switchModule
(
modules
.
OptionsModule
)
def
ui_handleClick_btnExit
(
self
):
logging
.
debug
(
'exit
'
)
logging
.
info
(
'Closing..
'
)
self
.
parent_win
.
close
()
modules/options.py
View file @
7b29a21e
...
...
@@ -41,9 +41,9 @@ class OptionsModule(Module):
def
ui_handleClick_btnSave
(
self
):
if
self
.
ui
.
options
.
cellWidget
(
0
,
1
).
currentText
().
lower
()
==
'true'
:
self
.
parent
W
in
.
showFullScreen
()
self
.
parent
_w
in
.
showFullScreen
()
else
:
self
.
parent
W
in
.
showNormal
()
self
.
parent
_w
in
.
showNormal
()
self
.
switchModule
(
modules
.
MenuModule
)
...
...
ui/auth2p.ui
0 → 100644
View file @
7b29a21e
<?xml version="1.0" encoding="UTF-8"?>
<ui
version=
"4.0"
>
<class>
Form
</class>
<widget
class=
"QWidget"
name=
"Form"
>
<property
name=
"geometry"
>
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
1280
</width>
<height>
720
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
<string>
Form
</string>
</property>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout"
>
<item>
<widget
class=
"QLabel"
name=
"label_5"
>
<property
name=
"minimumSize"
>
<size>
<width>
0
</width>
<height>
32
</height>
</size>
</property>
<property
name=
"font"
>
<font>
<pointsize>
40
</pointsize>
<weight>
75
</weight>
<bold>
true
</bold>
</font>
</property>
<property
name=
"text"
>
<string>
Identify yourselves!
</string>
</property>
<property
name=
"alignment"
>
<set>
Qt::AlignBottom|Qt::AlignHCenter
</set>
</property>
</widget>
</item>
<item>
<widget
class=
"QLabel"
name=
"label_6"
>
<property
name=
"font"
>
<font>
<pointsize>
20
</pointsize>
<italic>
true
</italic>
</font>
</property>
<property
name=
"text"
>
<string>
Use the table's RFID reader with your card.
</string>
</property>
<property
name=
"alignment"
>
<set>
Qt::AlignHCenter|Qt::AlignTop
</set>
</property>
</widget>
</item>
<item>
<spacer
name=
"verticalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Vertical
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
20
</width>
<height>
40
</height>
</size>
</property>
</spacer>
</item>
<item>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout"
>
<item>
<spacer
name=
"horizontalSpacer_6"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
40
</width>
<height>
20
</height>
</size>
</property>
</spacer>
</item>
<item>
<spacer
name=
"horizontalSpacer_2"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
40
</width>
<height>
20
</height>
</size>
</property>
</spacer>
</item>
<item>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout_3"
>
<item>
<widget
class=
"QLabel"
name=
"imgP1"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Preferred"
vsizetype=
"Preferred"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
<property
name=
"minimumSize"
>
<size>
<width>
300
</width>
<height>
300
</height>
</size>
</property>
<property
name=
"maximumSize"
>
<size>
<width>
300
</width>
<height>
300
</height>
</size>
</property>
<property
name=
"text"
>
<string/>
</property>
<property
name=
"pixmap"
>
<pixmap
resource=
"assets.qrc"
>
:/ui/img/placeholder_head.jpg
</pixmap>
</property>
<property
name=
"scaledContents"
>
<bool>
true
</bool>
</property>
</widget>
</item>
<item>
<spacer
name=
"verticalSpacer_4"
>
<property
name=
"orientation"
>
<enum>
Qt::Vertical
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
20
</width>
<height>
40
</height>
</size>
</property>
</spacer>
</item>
<item>
<widget
class=
"QLabel"
name=
"lblP1"
>
<property
name=
"minimumSize"
>
<size>
<width>
0
</width>
<height>
32
</height>
</size>
</property>
<property
name=
"font"
>
<font>
<pointsize>
25
</pointsize>
</font>
</property>
<property
name=
"text"
>
<string>
Player 1
</string>
</property>
<property
name=
"alignment"
>
<set>
Qt::AlignCenter
</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer
name=
"horizontalSpacer_8"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
40
</width>
<height>
20
</height>
</size>
</property>
</spacer>
</item>
<item>
<widget
class=
"QLabel"
name=
"label_7"
>
<property
name=
"font"
>
<font>
<pointsize>
26
</pointsize>
</font>
</property>
<property
name=
"text"
>
<string>
vs.
</string>
</property>
</widget>
</item>
<item>
<spacer
name=
"horizontalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
40
</width>
<height>
20
</height>
</size>
</property>
</spacer>
</item>
<item>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout_4"
>
<item>
<widget
class=
"QLabel"
name=
"imgP1_2"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Preferred"
vsizetype=
"Preferred"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
<property
name=
"minimumSize"
>
<size>
<width>
300
</width>
<height>
300
</height>
</size>
</property>
<property
name=
"maximumSize"
>
<size>
<width>
300
</width>
<height>
300
</height>
</size>
</property>
<property
name=
"text"
>
<string/>
</property>
<property
name=
"pixmap"
>
<pixmap
resource=
"assets.qrc"
>
:/ui/img/placeholder_head.jpg
</pixmap>
</property>
<property
name=
"scaledContents"
>
<bool>
true
</bool>
</property>
</widget>
</item>
<item>
<spacer
name=
"verticalSpacer_2"
>
<property
name=
"orientation"
>
<enum>
Qt::Vertical
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
20
</width>
<height>
100
</height>
</size>
</property>
</spacer>
</item>
<item>
<widget
class=
"QLabel"
name=
"lblP2"
>
<property
name=
"minimumSize"
>
<size>
<width>
0
</width>
<height>
32
</height>
</size>
</property>
<property
name=
"font"
>
<font>
<pointsize>
25
</pointsize>
</font>
</property>
<property
name=
"text"
>
<string>
Player 2
</string>
</property>
<property
name=
"alignment"
>
<set>
Qt::AlignCenter
</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer
name=
"horizontalSpacer_9"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
40
</width>
<height>
20
</height>
</size>
</property>
</spacer>
</item>
<item>
<spacer
name=
"horizontalSpacer_7"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
40
</width>
<height>
20
</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer
name=
"verticalSpacer_3"
>
<property
name=
"orientation"
>
<enum>
Qt::Vertical
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
20
</width>
<height>
40
</height>
</size>
</property>
</spacer>
</item>
<item>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_2"
>
<item>
<spacer
name=
"horizontalSpacer_4"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
40
</width>
<height>
20
</height>
</size>
</property>
</spacer>
</item>
<item>
<spacer
name=
"horizontalSpacer_5"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
40
</width>
<height>
20
</height>
</size>
</property>
</spacer>
</item>
<item>
<spacer
name=
"horizontalSpacer_3"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
40
</width>
<height>
20
</height>
</size>
</property>
</spacer>
</item>
<item>
<widget
class=
"QPushButton"
name=
"btnDone"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Expanding"
vsizetype=
"Expanding"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
<property
name=
"text"
>
<string>
Done
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QPushButton"
name=
"btnCancel"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Expanding"
vsizetype=
"Preferred"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
<property
name=
"minimumSize"
>
<size>
<width>
0
</width>
<height>
32
</height>
</size>
</property>
<property
name=
"text"
>
<string>
Cancel
</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources>
<include
location=
"assets.qrc"
/>
</resources>
<connections/>
</ui>
ui/leaderboard.ui
0 → 100644
View file @
7b29a21e
<?xml version="1.0" encoding="UTF-8"?>
<ui
version=
"4.0"
>
<class>
Form
</class>
<widget
class=
"QWidget"
name=
"Form"
>
<property
name=
"geometry"
>
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
1280
</width>
<height>
720
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
<string>
Form
</string>
</property>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout"
>
<item>
<widget
class=
"QLabel"
name=
"label_3"
>
<property
name=
"font"
>
<font>
<pointsize>
45
</pointsize>
</font>
</property>
<property
name=
"text"
>
<string>
Leadderboard
</string>
</property>
<property
name=
"alignment"
>
<set>
Qt::AlignCenter
</set>
</property>
</widget>
</item>
<item>
<spacer
name=
"verticalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Vertical
</enum>
</property>
<property
name=
"sizeType"
>
<enum>
QSizePolicy::Preferred
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
20
</width>
<height>
40
</height>
</size>
</property>
</spacer>
</item>
<item>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout"
>
<item>
<spacer
name=
"horizontalSpacer_5"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"sizeType"
>
<enum>
QSizePolicy::Preferred
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
40
</width>
<height>
20
</height>
</size>
</property>
</spacer>
</item>
<item>
<widget
class=
"QLabel"
name=
"label"
>
<property
name=
"font"
>
<font>
<pointsize>
20
</pointsize>
</font>
</property>
<property
name=
"text"
>
<string>
Sort By
</string>
</property>
</widget>
</item>
<item>
<spacer
name=
"horizontalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"sizeType"
>
<enum>
QSizePolicy::Preferred
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
40
</width>
<height>
20
</height>
</size>
</property>
</spacer>
</item>
<item>
<spacer
name=
"horizontalSpacer_4"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"sizeType"
>
<enum>
QSizePolicy::Preferred
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
40
</width>
<height>
20
</height>
</size>