forked from dfilimon/Jeopy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PlayerAdminDialog.py
40 lines (32 loc) · 1.05 KB
/
PlayerAdminDialog.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
"""
AdminDialog (PlayerAdminDialog) is the dialog used to view connecting players and
start the game.
Only displays the PlayerTable (in its admin 'view') and a 'ban' button that doesn't
do anything yet.
Its startGame signal triggers the actual start of the game.
"""
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PlayerTableWidget import PlayerTable
class PlayerAdminDialog(QDialog):
startGame = pyqtSignal()
"""
emitted when the game actually starts, connection in AdminGui.py
"""
def __init__(self, parent = None):
super(PlayerAdminDialog, self).__init__(parent)
self.setupGui()
def setupGui(self):
layout = QVBoxLayout()
table = PlayerTable(['Nickname', 'IP', 'Status', 'Score'], 'ban')
layout.addWidget(table)
button = QPushButton('Start Game')
button.clicked.connect(self.startGame.emit)
layout.addWidget(button)
self.setLayout(layout)
def playerAdminTable(self):
return self.layout().itemAt(0).widget()
def addPlayer(self, player):
self.playerAdminTable().addPlayer(player)
self.adjustSize()
self.layout().activate()