diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2016-06-19 01:13:41 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2016-06-19 01:13:41 +0200 |
commit | ba9ea93a0f52178d24a606fddc2acc5dc85b7ff2 (patch) | |
tree | 0a2b43561b84eefed07ecb83de1ecf4fad428532 /helpers/key.py | |
parent | e5e6409426e3eb1918318973372568081e6d9dd6 (diff) | |
download | MusicSampler-ba9ea93a0f52178d24a606fddc2acc5dc85b7ff2.tar.gz MusicSampler-ba9ea93a0f52178d24a606fddc2acc5dc85b7ff2.tar.zst MusicSampler-ba9ea93a0f52178d24a606fddc2acc5dc85b7ff2.zip |
enhancing locks
Diffstat (limited to 'helpers/key.py')
-rw-r--r-- | helpers/key.py | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/helpers/key.py b/helpers/key.py index 2e4a313..6997e70 100644 --- a/helpers/key.py +++ b/helpers/key.py | |||
@@ -112,9 +112,32 @@ class Key: | |||
112 | 112 | ||
113 | self.mapping.finished_running(self, start_time) | 113 | self.mapping.finished_running(self, start_time) |
114 | 114 | ||
115 | def list_actions(self, surface): | 115 | def list_actions(self, screen): |
116 | # FIXME: Todo | 116 | action_descriptions = [action.description() for action in self.actions] |
117 | print("bouh", self.key_sym) | 117 | print("actions linked to key {}:".format(self.key_sym)) |
118 | surface.fill((255, 0, 0)) | 118 | print("\t" + "\n\t".join(action_descriptions)) |
119 | self.draw_lock.acquire() | ||
120 | surface = pygame.Surface((800, 250)).convert() | ||
121 | surface.fill((250, 250, 250)) | ||
122 | if getattr(sys, 'frozen', False): | ||
123 | police = pygame.font.Font(sys._MEIPASS + "/Ubuntu-Regular.ttf", 14) | ||
124 | else: | ||
125 | police = pygame.font.Font("Ubuntu-Regular.ttf", 14) | ||
126 | |||
127 | offset = 0 | ||
128 | police.set_bold(True) | ||
129 | text = police.render("actions linked to key {}:".format(self.key_sym), True, (0,0,0)) | ||
130 | surface.blit(text, (0, offset)) | ||
131 | offset += police.get_linesize() | ||
132 | |||
133 | police.set_bold(False) | ||
134 | for description in action_descriptions: | ||
135 | text = police.render(description, True, (0,0,0)) | ||
136 | surface.blit(text, (0, offset)) | ||
137 | offset += police.get_linesize() | ||
138 | |||
139 | screen.blit(surface, (10, 330)) | ||
140 | pygame.display.flip() | ||
141 | self.draw_lock.release() | ||
119 | 142 | ||
120 | 143 | ||