X-Git-Url: https://scm.cri.ensmp.fr/git/minwii.git/blobdiff_plain/4396434d14a166c6b2d9569517779fc718915dea..6b0b3c12e74171acf85694f61a2814082af8d7ca:/src/minwii/widgets/home.py diff --git a/src/minwii/widgets/home.py b/src/minwii/widgets/home.py index 429342b..10aa9d6 100755 --- a/src/minwii/widgets/home.py +++ b/src/minwii/widgets/home.py @@ -49,10 +49,12 @@ class Home(object, Table) : self.nwiimotes = params.get('nwiimotes', 0) self.songFile = params.get('songFile', '') self.spaceSize = (100,100) - self.font = pygame.font.Font(None,70) + self.font = pygame.font.Font(None,90) self._fill() self.selectedPlayMode = params.get('playMode', 'NORMAL') + self.displayNotes = params.get('displayNotes', True) self.selectedWiimoteIndex = params.get('wiimoteIndex', 0) + self.exitApp = False self._initLocalListeners() @@ -67,18 +69,27 @@ class Home(object, Table) : self.tr() caption = '' if not self.songFile else FileOpenDialog.getSongTitle(self.songFile) - self.songTitle = self.createLabel(caption) + self.songTitle = self.createLabel(caption, font=pygame.font.Font(None,60)) st = STYLE_RIGHT_COL.copy() del st['padding_top'] self.td(self.songTitle, style = st) - # choix du niveau + # choix du mode de jeu self.tr() - self.td(self.createLabel("Niveau :"), style=STYLE_LEFT_COL) + self.td(self.createLabel("Mode :"), style=STYLE_LEFT_COL) self.modeSelect = Select('NORMAL') for k, caption in PLAYING_MODES : self.modeSelect.add(self.createLabel(caption), k) self.td(self.modeSelect,colspan=3, style=STYLE_RIGHT_COL) + + # affichage / masquage des noms de notes + self.tr() + self.td(self.createLabel("Notes :"), style=STYLE_LEFT_COL) + self.displayNotesSelect = Select(True) + for k, caption in ((True, 'Oui'), (False, 'Non')) : + self.displayNotesSelect.add(self.createLabel(caption), k) + self.td(self.displayNotesSelect, style=STYLE_RIGHT_COL) + # choix des wiimotes self.tr() @@ -86,7 +97,7 @@ class Home(object, Table) : playerTable = Table() self.selectedWiimote = Group(name='selectedWiimote', value=0) - for i in range(self.nwiimotes): + for i in range(self.nwiimotes - 1): r = Radio(self.selectedWiimote, i) playerTable.td(r) playerTable.td(self.createLabel(" %d " % (i+1))) @@ -96,7 +107,7 @@ class Home(object, Table) : self.tr() self.quitButton = Button(self.createLabel("Quitter")) self.td(self.quitButton, style={'padding_top' : 50}) - self.playButton = Button(self.createLabel("Jouer"), disabled=not self.songFile) + self.playButton = Button(self.createLabel("Jouer")) self.td(self.playButton, style={'padding_top' : 50}) @property @@ -106,6 +117,19 @@ class Home(object, Table) : @selectedPlayMode.setter def selectedPlayMode(self, value) : self.modeSelect.value = value + if self.selectedPlayMode != 'IMPRO' and \ + not self.songFile : + self.playButton.disabled = True + else : + self.playButton.disabled = False + + @property + def displayNotes(self) : + return self.displayNotesSelect.value + + @displayNotes.setter + def displayNotes(self, value) : + self.displayNotesSelect.value = value @property def selectedWiimoteIndex(self) : @@ -119,6 +143,13 @@ class Home(object, Table) : self.browseButton.connect(CLICK, self.open_file_browser) self.quitButton.connect(CLICK, self._exitApp) self.playButton.connect(CLICK, self._exitHome) + self.modeSelect.connect(CHANGE, self._changeModeCB) + + def _changeModeCB(self) : + if self.selectedPlayMode == 'IMPRO' : + self.playButton.disabled = False + elif not self.songFile : + self.playButton.disabled = True def _exitApp(self, data=None) : self.exitApp = True @@ -144,7 +175,7 @@ class Home(object, Table) : if dlg.value and os.path.isfile(dlg.value): self.remove(self.songTitle) title = FileOpenDialog.getSongTitle(dlg.value) - self.songTitle = self.createLabel(title) + self.songTitle = self.createLabel(title, font= pygame.font.Font(None,60)) self.td(self.songTitle, col=1, row=1, style=STYLE_RIGHT_COL) self.songFile = dlg.value self.playButton.disabled = False