projects
/
minwii.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
debug--
[minwii.git]
/
src
/
minwii
/
widgets
/
home.py
diff --git
a/src/minwii/widgets/home.py
b/src/minwii/widgets/home.py
index
e1f95c4
..
c5d1ff5
100755
(executable)
--- a/
src/minwii/widgets/home.py
+++ b/
src/minwii/widgets/home.py
@@
-21,12
+21,29
@@
from minwii.globals import PLAYING_MODES
from songfilebrowser import FileOpenDialog
import os.path
from songfilebrowser import FileOpenDialog
import os.path
+STYLE_LEFT_COL = {#'border_right' : 2,
+ #'border_left' : 2,
+ 'align' : 1,
+ 'padding_top' : 30,
+ 'padding_right' : 10}
+
+STYLE_RIGHT_COL = {#'border_right' : 2,
+ #'border_left' : 2,
+ 'align' : -1,
+ 'padding_top' : 30,
+ 'padding_left' : 20}
+
+
class Home(Table) :
"""
Écran de démarrage de minwii
"""
def __init__(self,**params):
class Home(Table) :
"""
Écran de démarrage de minwii
"""
def __init__(self,**params):
+ style = {'valign' : 0,
+ 'width' : pygame.display.get_surface().get_width(),
+ 'height' : pygame.display.get_surface().get_height()}
+ params['style'] = style
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)
@@
-38,35
+55,31
@@
class Home(Table) :
def _fill(self):
def _fill(self):
- self.tr()
- self.td(Spacer(*self.spaceSize))
-
-
# bouton pour browser de fichiers
self.tr()
# bouton pour browser de fichiers
self.tr()
- self.td(self.createLabel("Chanson :"))
+ st = STYLE_LEFT_COL.copy()
+ st['valign'] = -1
+ self.td(self.createLabel("Chanson :"), rowspan=2, style = st)
self.browseButton = Button(self.createLabel("Choisir..."))
self.browseButton = Button(self.createLabel("Choisir..."))
- self.td(self.browseButton,colspan=2)
- self.songSwitch = Switch(False)
- self.td(self.songSwitch)
+ self.td(self.browseButton,colspan=2, style = STYLE_RIGHT_COL)
self.tr()
self.tr()
- self.td(Spacer(*self.spaceSize))
+ self.songTitle = self.createLabel(u' ')
+ st = STYLE_RIGHT_COL.copy()
+ del st['padding_top']
+ self.td(self.songTitle, style = st)
# choix du niveau
self.tr()
# choix du niveau
self.tr()
- self.td(self.createLabel("Niveau :"))
+ self.td(self.createLabel("Niveau :")
, 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)
- self.td(self.modeSelect,colspan=3)
-
- self.tr()
- self.td(Spacer(*self.spaceSize))
+ self.td(self.modeSelect,colspan=3, style=STYLE_RIGHT_COL)
# choix des wiimotes
self.tr()
# choix des wiimotes
self.tr()
- self.td(self.createLabel("Wiimote :", self.font))
+ self.td(self.createLabel("Wiimote :", self.font)
, style=STYLE_LEFT_COL
)
playerTable = Table()
self.selectedWiimote = Group(name='selectedWiimote', value=0)
playerTable = Table()
self.selectedWiimote = Group(name='selectedWiimote', value=0)
@@
-74,20
+87,14
@@
class Home(Table) :
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)))
- self.td(playerTable,colspan = 3)
-
- self.tr()
- self.td(Spacer(*self.spaceSize))
+ self.td(playerTable, style=STYLE_RIGHT_COL)
# boutons jouer / quitter
self.tr()
self.quitButton = Button(self.createLabel("Quitter"))
# boutons jouer / quitter
self.tr()
self.quitButton = Button(self.createLabel("Quitter"))
- self.td(self.quitButton)
+ self.td(self.quitButton
, style={'padding_top' : 50}
)
self.playButton = Button(self.createLabel("Jouer"), disabled=True)
self.playButton = Button(self.createLabel("Jouer"), disabled=True)
- self.td(self.playButton,colspan=3)
-
- self.tr()
- self.td(Spacer(500,500))
+ self.td(self.playButton, style={'padding_top' : 50})
@property
def selectedWiimoteIndex(self) :
@property
def selectedWiimoteIndex(self) :
@@
-120,6
+127,9
@@
class Home(Table) :
def handle_file_browser_closed(self, dlg) :
if dlg.value and os.path.isfile(dlg.value):
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))
+ self.td(self.songTitle, col=1, row=1, style=STYLE_RIGHT_COL)
self.songFile = dlg.value
self.playButton.disabled = False
self.songFile = dlg.value
self.playButton.disabled = False