X-Git-Url: https://svn.cri.ensmp.fr/git/minwii.git/blobdiff_plain/5e2c28ffb37d613169726d87d858250305439566..dec65f326821db9871750e207cdd5c430632f3b3:/src/minwii/widgets/home.py?ds=sidebyside diff --git a/src/minwii/widgets/home.py b/src/minwii/widgets/home.py index 8f145b4..44c101f 100755 --- a/src/minwii/widgets/home.py +++ b/src/minwii/widgets/home.py @@ -34,7 +34,7 @@ STYLE_RIGHT_COL = {#'border_right' : 2, 'padding_left' : 20} -class Home(Table) : +class Home(object, Table) : """ Écran de démarrage de minwii """ @@ -47,18 +47,16 @@ class Home(Table) : Table.__init__(self,**params) self.songPath = params.get('songPath', '.') self.nwiimotes = params.get('nwiimotes', 0) - self.songFile = None + self.songFile = params.get('songFile', '') self.spaceSize = (100,100) self.font = pygame.font.Font(None,70) self._fill() + self.selectedPlayMode = params.get('playMode', 'NORMAL') + self.selectedWiimoteIndex = params.get('wiimoteIndex', 0) self._initLocalListeners() def _fill(self): - #self.tr() - #self.td(Spacer(*self.spaceSize)) - - # bouton pour browser de fichiers self.tr() st = STYLE_LEFT_COL.copy() @@ -68,7 +66,8 @@ class Home(Table) : self.td(self.browseButton,colspan=2, style = STYLE_RIGHT_COL) self.tr() - self.songTitle = self.createLabel(u'bonjour le monde !') + caption = os.path.basename(self.songFile) + self.songTitle = self.createLabel(caption) st = STYLE_RIGHT_COL.copy() del st['padding_top'] self.td(self.songTitle, style = st) @@ -97,12 +96,24 @@ class Home(Table) : self.tr() self.quitButton = Button(self.createLabel("Quitter")) self.td(self.quitButton, style={'padding_top' : 50}) - self.playButton = Button(self.createLabel("Jouer"), disabled=True) + self.playButton = Button(self.createLabel("Jouer"), disabled=not self.songFile) self.td(self.playButton, style={'padding_top' : 50}) + @property + def selectedPlayMode(self) : + return self.modeSelect.value + + @selectedPlayMode.setter + def selectedPlayMode(self, value) : + self.modeSelect.value = value + @property def selectedWiimoteIndex(self) : return self.selectedWiimote.value + + @selectedWiimoteIndex.setter + def selectedWiimoteIndex(self, value) : + self.selectedWiimote.value = value def _initLocalListeners(self) : self.browseButton.connect(CLICK, self.open_file_browser)