self.screen = SCREEN_HOME
exit, songFile, playMode, displayNotes, wiimoteIndex = \
self.selectSongAndOptions(songFile, playMode, displayNotes, wiimoteIndex)
- if exit : break
+ if exit :
+ WT.quit()
+ break
self.screen = SCREEN_INSTRUMENTS
self.selectedPlayMode = params.get('playMode', 'NORMAL')
self.displayNotes = params.get('displayNotes', True)
self.selectedWiimoteIndex = params.get('wiimoteIndex', 0)
+ self.exitApp = False
self._initLocalListeners()
style = {}
if iw > ih :
style['width'] = PICTURE_ITEM_SIZE
- style['height'] = PICTURE_ITEM_SIZE * float(ih) / iw
+ style['height'] = int(round(PICTURE_ITEM_SIZE * float(ih) / iw))
else :
style['heigth'] = PICTURE_ITEM_SIZE
- style['width'] = PICTURE_ITEM_SIZE * float(iw) / ih
+ style['width'] = int(round(PICTURE_ITEM_SIZE * float(iw) / ih))
img = basic.Image(img, style=style)
else :
def selectWiimote(self, wiimoteIndex) :
self.selectedWiimoteIndex = wiimoteIndex
-# for i in range(self.actual_nmotes) :
-# wm = self.wiimotes[i]
-# if i == wiimoteIndex :
-# self.do(wiiuse.set_ir, wm, 1)
-# self.do(wiiuse.set_ir_vres, wm, *self.screenResolution)
-# if self.position == 'ABOVE' :
-# position = wiiuse.IR_ABOVE
-# elif self.position == 'BELOW' :
-# position = wiiuse.IR_BELOW
-# else :
-# position = wiiuse.IR_ABOVE
-# self.do(wiiuse.set_ir_position, wm, position)
-# # TODO aspect ratio
-# #self.do(wiiuse.set_aspect_ratio, wm, aspect)
-#
-# else :
-# self.do(wiiuse.set_ir, wm, 0)
def do(self, func, *args):
'''Run the function in the thread handling the wiimote'''
def quit(self):
'''Go away.'''
- for i in range(self.nmotes):
- wiiuse.set_leds(self.wiimotes[i], 0)
- wiiuse.disconnect(self.wiimotes[i])
+ # TODO will crash if self.nmotes > 4
+ # for i in range(self.nmotes):
+ # wiiuse.set_leds(self.wiimotes[i], 0)
+ # wiiuse.disconnect(self.wiimotes[i])
self.go = False
def get_count(self):