BACKGROUND_LAYER = 0
FOREGROUND_LAYER = 1
CURSOR_LAYER = 2
-PLAYING_MODES = {'EASY':0
- ,'NORMAL':1
- ,'ADVANCED':2
- ,'EXPERT':3}
+PLAYING_MODES = (('EASY' , u'Facile'),
+ ('NORMAL' , u'Normal'),
+ ('ADVANCED', u'Avancé'),
+ ('EXPERT' , u'Expert'))
+
+
+
+PLAYING_MODES_DICT = dict([(v[0], i) for i, v in enumerate(PLAYING_MODES)])
def hls_to_rgba_8bits(h, l, s, a=1) :
#convert to rgb ranging from 0 to 255
from eventutils import EventDispatcher
from musicxml import musicXml2Song
from config import SONG_FILE_PATH
-from time import sleep
+from globals import PLAYING_MODES_DICT
class MinWii(object):
instrumentDescription = selector.selectedInstrument
# lancement du lecteur / clavier
- song = musicXml2Song(home.songFile)
+ songFile = home.songFile
+ playMode = home.modeSelect.value
+ playMode = PLAYING_MODES_DICT[playMode]
+ song = musicXml2Song(songFile)
bank, preset = instrumentDescription['bank'], instrumentDescription['preset']
synth.program_select(0, bank, preset)
- playingScreen = SongPlayingScreen(synth, song)
+ playingScreen = SongPlayingScreen(synth, song, mode=playMode)
playingScreen.run()
pygame.event.clear()
EventDispatcher.reset()
from pgu.gui import QUIT
from pgu.gui import CHANGE
import pygame
-from gui.constants import reversedReadabilityDict, modeDict
+from globals import PLAYING_MODES
from songfilebrowser import FileOpenDialog
import os.path
# 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.modeSelect = Select('EASY')
+ for k, caption in PLAYING_MODES :
+ self.modeSelect.add(self.createLabel(caption), k)
self.td(self.modeSelect,colspan=3)
self.tr()
self.tr()
self.quitButton = Button(self.createLabel("Quitter"))
self.td(self.quitButton)
- self.playButton = Button(self.createLabel("Jouer"))
+ self.playButton = Button(self.createLabel("Jouer"), disabled=True)
self.td(self.playButton,colspan=3)
self.tr()
def handle_file_browser_closed(self, dlg) :
if dlg.value and os.path.isfile(dlg.value):
self.songFile = dlg.value
+ self.playButton.disabled = False
\ No newline at end of file
from globals import BACKGROUND_LAYER
from globals import CURSOR_LAYER
-from globals import PLAYING_MODES
+from globals import PLAYING_MODES_DICT
class _PlayingScreenBase(pygame.sprite.LayeredDirty, EventHandlerMixin) :
class SongPlayingScreen(_PlayingScreenBase) :
- def __init__(self, synth, song, mode=PLAYING_MODES['EASY']) :
+ def __init__(self, synth, song, mode=PLAYING_MODES_DICT['EASY']) :
super(SongPlayingScreen, self).__init__(synth, song.distinctNotes)
self.song = song
self.quarterNoteDuration = song.quarterNoteDuration
self.currentColumn = None
self.noteIterator = self.song.iterNotes()
self.displayNext()
- if mode == PLAYING_MODES['NORMAL'] :
+ if mode == PLAYING_MODES_DICT['NORMAL'] :
EventDispatcher.addEventListener(events.COLDOWN, self.handleColumnDown)
EventDispatcher.addEventListener(events.COLUP, self.handleColumnUp)
- elif mode == PLAYING_MODES['EASY'] :
+ elif mode == PLAYING_MODES_DICT['EASY'] :
EventDispatcher.addEventListener(events.COLOVER, self.handleColumnOver)