diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2016-06-19 22:44:54 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2016-06-19 22:44:54 +0200 |
commit | 23b7e0e5daf024e87d967ede3dfe6777a07e7469 (patch) | |
tree | 066f4d4c1678ac4ce4f441d042b36b30818c9597 /helpers | |
parent | b86db9f1679c855c2d39a0b116f846d271271a2c (diff) | |
download | MusicSampler-23b7e0e5daf024e87d967ede3dfe6777a07e7469.tar.gz MusicSampler-23b7e0e5daf024e87d967ede3dfe6777a07e7469.tar.zst MusicSampler-23b7e0e5daf024e87d967ede3dfe6777a07e7469.zip |
Fix threading problems with ipython
Diffstat (limited to 'helpers')
-rw-r--r-- | helpers/key.py | 8 | ||||
-rw-r--r-- | helpers/mapping.py | 2 | ||||
-rw-r--r-- | helpers/music_file.py | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/helpers/key.py b/helpers/key.py index 9a6cb3b..e9e485d 100644 --- a/helpers/key.py +++ b/helpers/key.py | |||
@@ -72,7 +72,7 @@ class Key: | |||
72 | ) | 72 | ) |
73 | 73 | ||
74 | def set_description(self, description): | 74 | def set_description(self, description): |
75 | self.description = description | 75 | self.description = [str(desc) for desc in description] |
76 | 76 | ||
77 | def set_color(self, color): | 77 | def set_color(self, color): |
78 | self.custom_color = tuple(color) | 78 | self.custom_color = tuple(color) |
@@ -97,7 +97,7 @@ class Key: | |||
97 | self.surface.blit(text, (5,5)) | 97 | self.surface.blit(text, (5,5)) |
98 | 98 | ||
99 | is_first_line = True | 99 | is_first_line = True |
100 | offset = 11 + text_police.get_linesize() | 100 | offset = 11 + text_police.get_linesize() - 4 |
101 | first_line_offset = 18 | 101 | first_line_offset = 18 |
102 | for description in self.description: | 102 | for description in self.description: |
103 | text = text_police.render(description, True, (0,0,0)) | 103 | text = text_police.render(description, True, (0,0,0)) |
@@ -105,8 +105,8 @@ class Key: | |||
105 | self.surface.blit(text, (first_line_offset, 9)) | 105 | self.surface.blit(text, (first_line_offset, 9)) |
106 | is_first_line = False | 106 | is_first_line = False |
107 | else: | 107 | else: |
108 | self.surface.blit(text, (5, offset)) | 108 | self.surface.blit(text, (3, offset)) |
109 | offset += text_police.get_linesize() | 109 | offset += text_police.get_linesize() - 4 |
110 | 110 | ||
111 | background_surface.blit(self.surface, self.position) | 111 | background_surface.blit(self.surface, self.position) |
112 | self.draw_lock.release() | 112 | self.draw_lock.release() |
diff --git a/helpers/mapping.py b/helpers/mapping.py index ee5623a..84e9941 100644 --- a/helpers/mapping.py +++ b/helpers/mapping.py | |||
@@ -130,7 +130,7 @@ class Mapping: | |||
130 | should_redraw_key = key.draw(self.background) | 130 | should_redraw_key = key.draw(self.background) |
131 | 131 | ||
132 | if should_redraw_key: | 132 | if should_redraw_key: |
133 | threading.Thread(target = key.poll_redraw, args = [self.background]).start() | 133 | threading.Thread(name = "MSPollRedraw", target = key.poll_redraw, args = [self.background]).start() |
134 | self.blit() | 134 | self.blit() |
135 | 135 | ||
136 | def blit(self): | 136 | def blit(self): |
diff --git a/helpers/music_file.py b/helpers/music_file.py index b834104..5101f7f 100644 --- a/helpers/music_file.py +++ b/helpers/music_file.py | |||
@@ -10,7 +10,7 @@ class MusicFile: | |||
10 | self.sound = None | 10 | self.sound = None |
11 | 11 | ||
12 | self.loaded = False | 12 | self.loaded = False |
13 | threading.Thread(target = self.load_sound, args = [lock]).start() | 13 | threading.Thread(name = "MSMusicLoad", target = self.load_sound, args = [lock]).start() |
14 | 14 | ||
15 | def load_sound(self, lock): | 15 | def load_sound(self, lock): |
16 | lock.acquire() | 16 | lock.acquire() |