391cb294426c65bfe1398d0c85eda539042ef64a
1 # -*- coding: utf-8 -*-
3 Écran de démarrage minwii.
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
18 from songfilebrowser
import FileOpenDialog
22 Écran de démarrage de minwii
25 def __init__(self
,**params
):
26 Table
.__init
__(self
,**params
)
27 self
.songPath
= params
.get('songPath', '.')
28 self
.spaceSize
= (100,100)
29 self
.font
= pygame
.font
.Font(None,70)
31 self
._initLocalListeners
()
36 self
.td(Spacer(*self
.spaceSize
))
39 # bouton pour browser de fichiers
41 self
.td(self
.createLabel("Chanson :"))
42 self
.browseButton
= Button(self
.createLabel("Choisir..."))
43 self
.td(self
.browseButton
,colspan
=2)
44 self
.songSwitch
= Switch(False)
45 self
.td(self
.songSwitch
)
48 self
.td(Spacer(*self
.spaceSize
))
52 self
.td(self
.createLabel("Niveau :"))
53 self
.modeSelect
= Select('easy')
54 for key
in modeDict
.keys() :
55 self
.modeSelect
.add(self
.createLabel(reversedReadabilityDict
[key
]),key
)
56 self
.td(self
.modeSelect
,colspan
=3)
59 self
.td(Spacer(*self
.spaceSize
))
63 self
.td(self
.createLabel("Joueurs :", self
.font
))
65 self
.activeWiimoteSwitches
= []
69 playerTable
.td(self
.createLabel(" %d " % (i
+1)))
70 self
.activeWiimoteSwitches
.append(s
)
71 self
.td(playerTable
,colspan
= 3)
74 self
.td(Spacer(*self
.spaceSize
))
76 # boutons jouer / quitter
78 self
.quitButton
= Button(self
.createLabel("Quitter"))
79 self
.td(self
.quitButton
)
80 self
.playButton
= Button(self
.createLabel("Jouer"))
81 self
.td(self
.playButton
,colspan
=3)
84 self
.td(Spacer(500,500))
86 def _initLocalListeners(self
) :
87 self
.browseButton
.connect(CLICK
, self
.open_file_browser
)
88 self
.quitButton
.connect(CLICK
, self
._exitHome
)
90 def _exitHome(self
, data
=None) :
93 def createLabel(self
,text
,font
= None):
96 w
,h
= self
.font
.size(text
)
97 label
= Label(text
,width
=w
,height
=h
,font
= font
)
100 def open_file_browser(self
):
101 dlg
= FileOpenDialog(self
.songPath
)
102 #d = MINWiiDialog(font = self.font,width = 800, height = 600,path = "../songs/smwis")
103 #d.connect(pguGui.CHANGE, self.handle_file_browser_closed, d)