projects
/
minwii.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
typo--
[minwii.git]
/
src
/
minwii
/
widgets
/
home.py
diff --git
a/src/minwii/widgets/home.py
b/src/minwii/widgets/home.py
index
44c101f
..
8a671bc
100755
(executable)
--- a/
src/minwii/widgets/home.py
+++ b/
src/minwii/widgets/home.py
@@
-66,15
+66,15
@@
class Home(object, 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()
- caption =
os.path.basenam
e(self.songFile)
+ caption =
'' if not self.songFile else FileOpenDialog.getSongTitl
e(self.songFile)
self.songTitle = self.createLabel(caption)
st = STYLE_RIGHT_COL.copy()
del st['padding_top']
self.td(self.songTitle, style = st)
self.songTitle = self.createLabel(caption)
st = STYLE_RIGHT_COL.copy()
del st['padding_top']
self.td(self.songTitle, style = st)
- # choix du
nivea
u
+ # choix du
mode de je
u
self.tr()
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.modeSelect = Select('NORMAL')
for k, caption in PLAYING_MODES :
self.modeSelect.add(self.createLabel(caption), k)
@@
-86,7
+86,7
@@
class Home(object, Table) :
playerTable = Table()
self.selectedWiimote = Group(name='selectedWiimote', value=0)
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)))
r = Radio(self.selectedWiimote, i)
playerTable.td(r)
playerTable.td(self.createLabel(" %d " % (i+1)))
@@
-96,7
+96,7
@@
class Home(object, 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=not self.songFile
)
+ self.playButton = Button(self.createLabel("Jouer"))
self.td(self.playButton, style={'padding_top' : 50})
@property
self.td(self.playButton, style={'padding_top' : 50})
@property
@@
-106,6
+106,11
@@
class Home(object, Table) :
@selectedPlayMode.setter
def selectedPlayMode(self, value) :
self.modeSelect.value = value
@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 selectedWiimoteIndex(self) :
@property
def selectedWiimoteIndex(self) :
@@
-119,6
+124,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.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
def _exitApp(self, data=None) :
self.exitApp = True
@@
-143,7
+155,8
@@
class Home(object, 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