X-Git-Url: https://svn.cri.ensmp.fr/git/minwii.git/blobdiff_plain/f223b232a3718ef4546bad705f9d06b50cae6fe6..0907833e1d87414215c13952336e2e8069042d31:/src/app/widgets.py diff --git a/src/app/widgets.py b/src/app/widgets.py index e70ce5d..ab6763f 100755 --- a/src/app/widgets.py +++ b/src/app/widgets.py @@ -5,9 +5,80 @@ widgets minwii. $Id$ $URL$ """ -from pgu.gui import Table +from pgu.gui import Table, Spacer, Label, Button, Switch, Select +import pygame +from gui.constants import reversedReadabilityDict, modeDict class Home(Table) : + """ + Écran de démarrage de minwii + """ + def __init__(self,**params): Table.__init__(self,**params) + self.spaceSize = (100,100) + self.font = pygame.font.Font(None,70) + self._fill() + + + def _fill(self): + self.tr() + self.td(Spacer(*self.spaceSize)) + + + # bouton pour browser de fichiers + self.tr() + self.td(self.createLabel("Chanson :")) + self.browseButton = Button(self.createLabel("Choisir...")) + self.td(self.browseButton,colspan=2) + self.songSwitch = Switch(False) + self.td(self.songSwitch) + + self.tr() + self.td(Spacer(*self.spaceSize)) + + # choix du niveau + self.tr() + self.td(self.createLabel("Niveau :")) + self.modeSelect = Select('easy') + for key in modeDict.keys() : + self.modeSelect.add(self.createLabel(reversedReadabilityDict[key]),key) + self.td(self.modeSelect,colspan=3) + + self.tr() + self.td(Spacer(*self.spaceSize)) + + # choix des wiimotes + self.tr() + self.td(self.createLabel("Joueurs :", self.font)) + playerTable = Table() + self.activeWiimoteSwitches = [] + for i in range(4): + s = Switch(False) + playerTable.td(s) + playerTable.td(self.createLabel(" %d " % (i+1))) + self.activeWiimoteSwitches.append(s) + self.td(playerTable,colspan = 3) + + self.tr() + self.td(Spacer(*self.spaceSize)) + + # boutons jouer / quitter + self.tr() + self.quitButton = Button(self.createLabel("Quitter")) + self.td(self.quitButton) + self.goButton = Button(self.createLabel("Jouer")) + self.td(self.goButton,colspan=3) + + self.tr() + self.td(Spacer(500,500)) + + def createLabel(self,text,font = None): + if font == None : + font = self.font + w,h = self.font.size(text) + label = Label(text,width=w,height=h,font = font) + return(label) + + \ No newline at end of file