log des paramètres de l'application (début).
[minwii.git] / src / app / event_pprinters.py
1 # -*- coding: utf-8 -*-
2 """
3 formatage des événements
4
5 $Id$
6 $URL$
7 """
8
9 from events import eventNames
10 import sys
11 self = sys.modules[__name__]
12
13 def log_NOTEON(e):
14 return ''
15
16 def log_NOTEOFF(e):
17 return ''
18
19 def log_NOTEEND(e):
20 return ''
21
22 def log_COLSTATECHANGE(e):
23 col = e.column
24 tone = col.tone
25 return u'%2d %5s %3s %3s %s' % \
26 (col.index, col.state, tone.midi, tone.name, e.syllabus)
27
28 def _log_col(e) :
29 """ formate l'événement
30 - etat
31 - index de colonne
32 - hauteur midi
33 - nom de la note /A-G[#b]?/
34 """
35 col = e.column
36 tone = col.tone
37 pos = e.pos
38 return u'%2d %5s %3s %3s %r' % \
39 (col.index, col.state, tone.midi, tone.name, pos)
40
41 log_COLDOWN = log_COLUP = log_COLOVER = _log_col
42
43 def log_default(e) :
44 return ''
45 return str(e)
46
47 pprinters = {}
48 for type, name in eventNames.items() :
49 f = getattr(self, 'log_%s' % name, log_default)
50 pprinters[type] = f
51
52 __all__ = ('pprinters')