projects
/
minwii.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Ajout de « À la claire fontaine ».
[minwii.git]
/
src
/
minwii
/
widgets
/
home.py
diff --git
a/src/minwii/widgets/home.py
b/src/minwii/widgets/home.py
index
c5d1ff5
..
429342b
100755
(executable)
--- 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}
'padding_left' : 20}
-class Home(Table) :
+class Home(
object,
Table) :
"""
Écran de démarrage de minwii
"""
"""
Écran de démarrage de minwii
"""
@@
-47,10
+47,12
@@
class Home(Table) :
Table.__init__(self,**params)
self.songPath = params.get('songPath', '.')
self.nwiimotes = params.get('nwiimotes', 0)
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.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()
self._initLocalListeners()
@@
-64,7
+66,8
@@
class Home(Table) :
self.td(self.browseButton,colspan=2, style = STYLE_RIGHT_COL)
self.tr()
self.td(self.browseButton,colspan=2, style = STYLE_RIGHT_COL)
self.tr()
- self.songTitle = self.createLabel(u' ')
+ caption = '' if not self.songFile else FileOpenDialog.getSongTitle(self.songFile)
+ self.songTitle = self.createLabel(caption)
st = STYLE_RIGHT_COL.copy()
del st['padding_top']
self.td(self.songTitle, style = st)
st = STYLE_RIGHT_COL.copy()
del st['padding_top']
self.td(self.songTitle, style = st)
@@
-93,12
+96,24
@@
class Home(Table) :
self.tr()
self.quitButton = Button(self.createLabel("Quitter"))
self.td(self.quitButton, style={'padding_top' : 50})
self.tr()
self.quitButton = Button(self.createLabel("Quitter"))
self.td(self.quitButton, style={'padding_top' : 50})
- self.playButton = Button(self.createLabel("Jouer"), disabled=
Tru
e)
+ self.playButton = Button(self.createLabel("Jouer"), disabled=
not self.songFil
e)
self.td(self.playButton, style={'padding_top' : 50})
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
@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)
def _initLocalListeners(self) :
self.browseButton.connect(CLICK, self.open_file_browser)
@@
-128,7
+143,8
@@
class Home(Table) :
def handle_file_browser_closed(self, dlg) :
if dlg.value and os.path.isfile(dlg.value):
self.remove(self.songTitle)
def handle_file_browser_closed(self, dlg) :
if dlg.value and os.path.isfile(dlg.value):
self.remove(self.songTitle)
- self.songTitle = self.createLabel(os.path.basename(dlg.value))
+ title = FileOpenDialog.getSongTitle(dlg.value)
+ self.songTitle = self.createLabel(title)
self.td(self.songTitle, col=1, row=1, style=STYLE_RIGHT_COL)
self.songFile = dlg.value
self.playButton.disabled = False
self.td(self.songTitle, col=1, row=1, style=STYLE_RIGHT_COL)
self.songFile = dlg.value
self.playButton.disabled = False