1 # -*- coding: utf-8 -*-
8 from pgu
.gui
import Table
9 from pgu
.gui
import Spacer
10 from pgu
.gui
import Label
11 from pgu
.gui
import Button
12 from pgu
.gui
import Switch
13 from pgu
.gui
import Select
14 from pgu
.gui
import CLICK
15 from pgu
.gui
import QUIT
17 from gui
.constants
import reversedReadabilityDict
, modeDict
21 Écran de démarrage de minwii
24 def __init__(self
,**params
):
25 Table
.__init
__(self
,**params
)
26 self
.spaceSize
= (100,100)
27 self
.font
= pygame
.font
.Font(None,70)
29 self
._initLocalListeners
()
34 self
.td(Spacer(*self
.spaceSize
))
37 # bouton pour browser de fichiers
39 self
.td(self
.createLabel("Chanson :"))
40 self
.browseButton
= Button(self
.createLabel("Choisir..."))
41 self
.td(self
.browseButton
,colspan
=2)
42 self
.songSwitch
= Switch(False)
43 self
.td(self
.songSwitch
)
46 self
.td(Spacer(*self
.spaceSize
))
50 self
.td(self
.createLabel("Niveau :"))
51 self
.modeSelect
= Select('easy')
52 for key
in modeDict
.keys() :
53 self
.modeSelect
.add(self
.createLabel(reversedReadabilityDict
[key
]),key
)
54 self
.td(self
.modeSelect
,colspan
=3)
57 self
.td(Spacer(*self
.spaceSize
))
61 self
.td(self
.createLabel("Joueurs :", self
.font
))
63 self
.activeWiimoteSwitches
= []
67 playerTable
.td(self
.createLabel(" %d " % (i
+1)))
68 self
.activeWiimoteSwitches
.append(s
)
69 self
.td(playerTable
,colspan
= 3)
72 self
.td(Spacer(*self
.spaceSize
))
74 # boutons jouer / quitter
76 self
.quitButton
= Button(self
.createLabel("Quitter"))
77 self
.td(self
.quitButton
)
78 self
.playButton
= Button(self
.createLabel("Jouer"))
79 self
.td(self
.playButton
,colspan
=3)
82 self
.td(Spacer(500,500))
84 def _initLocalListeners(self
) :
85 self
.quitButton
.connect(CLICK
, self
.exit
)
87 def exit(self
, data
=None) :
91 def createLabel(self
,text
,font
= None):
94 w
,h
= self
.font
.size(text
)
95 label
= Label(text
,width
=w
,height
=h
,font
= font
)