class Action:
action_types = [
+ 'command',
'pause',
'play',
- 'run',
'stop',
'volume',
'wait',
def run(self, callback):
getattr(self, self.action)(callback, **self.arguments)
- def stop(self, callback, musique = None, fade_out = 0):
+ def command(self, callback, command = "", **kwargs):
+ pass
+
+ def pause(self, callback, music = None, **kwargs):
+ pass
+
+ def play(self, callback,
+ music = None,
+ fade_in = 0,
+ restart_if_running = False,
+ volume = 100,
+ **kwargs):
+ pass
+
+ def stop(self, callback, music = None, fade_out = 0, **kwargs):
print('stopping')
return callback()
+ def volume(self, callback, music = None, value = 100, **kwargs):
+ pass
+
+ def wait(self, callback, time = 0, **kwargs):
+ pass
+
class Key:
row_positions = {
'first': 5,
if len(self.actions) > 0:
self.actions[0].run(self.next_action)
- def find_from_unicode(key_sym):
+ def list_actions(self, surface):
+ print("bouh", self.key_sym)
+ surface.fill((255, 0, 0))
+
+ def find_by_key_num(key_num):
+ if key_num in Mapping.KEYS:
+ return Mapping.KEYS[key_num]
+ return None
+
+ def find_by_collidepoint(position):
+ for key in Mapping.KEYS:
+ if Mapping.KEYS[key].collidepoint(position):
+ return Mapping.KEYS[key]
+ return None
+
+ def find_by_unicode(key_sym):
for key in Mapping.KEYS:
if Mapping.KEYS[key].key_sym == key_sym:
return Mapping.KEYS[key]
seen_files = {}
for mapped_key in config['keys']:
- key = Key.find_from_unicode(mapped_key)
+ key = Key.find_by_unicode(mapped_key)
if key is None:
continue
if filename not in seen_files:
seen_files[filename] = MusicFile.new(filename)
- action_args['file'] = seen_files[filename]
+ action_args['music'] = seen_files[filename]
else:
action_args[argument] = action[action_name][argument]