diff options
-rw-r--r-- | fonts/Symbola.ttf (renamed from Symbola.ttf) | bin | 2188952 -> 2188952 bytes | |||
-rw-r--r-- | fonts/Ubuntu-Regular.ttf (renamed from Ubuntu-Regular.ttf) | bin | 353824 -> 353824 bytes | |||
-rw-r--r-- | helpers/__init__.py | 1 | ||||
-rw-r--r-- | helpers/font.py | 10 | ||||
-rw-r--r-- | helpers/key.py | 15 | ||||
-rw-r--r-- | music_sampler.py | 8 | ||||
-rw-r--r-- | music_sampler.spec | 3 |
7 files changed, 18 insertions, 19 deletions
diff --git a/Symbola.ttf b/fonts/Symbola.ttf index 51d9a88..51d9a88 100644 --- a/Symbola.ttf +++ b/fonts/Symbola.ttf | |||
Binary files differ | |||
diff --git a/Ubuntu-Regular.ttf b/fonts/Ubuntu-Regular.ttf index 45a038b..45a038b 100644 --- a/Ubuntu-Regular.ttf +++ b/fonts/Ubuntu-Regular.ttf | |||
Binary files differ | |||
diff --git a/helpers/__init__.py b/helpers/__init__.py index b3ab1eb..0e29f5d 100644 --- a/helpers/__init__.py +++ b/helpers/__init__.py | |||
@@ -2,6 +2,7 @@ | |||
2 | from .music_file import * | 2 | from .music_file import * |
3 | from .mapping import * | 3 | from .mapping import * |
4 | from .lock import * | 4 | from .lock import * |
5 | from .font import * | ||
5 | import yaml | 6 | import yaml |
6 | 7 | ||
7 | def parse_config(mapping): | 8 | def parse_config(mapping): |
diff --git a/helpers/font.py b/helpers/font.py new file mode 100644 index 0000000..83999ef --- /dev/null +++ b/helpers/font.py | |||
@@ -0,0 +1,10 @@ | |||
1 | import os | ||
2 | import pygame | ||
3 | import sys | ||
4 | |||
5 | def font(size, font = "Ubuntu-Regular"): | ||
6 | if getattr(sys, 'frozen', False): | ||
7 | return pygame.font.Font(sys._MEIPASS + "/fonts/" + font + ".ttf", size) | ||
8 | else: | ||
9 | path = os.path.dirname(os.path.realpath(__file__)) | ||
10 | return pygame.font.Font(path + "/../fonts/" + font + ".ttf", size) | ||
diff --git a/helpers/key.py b/helpers/key.py index 57fdef1..e643dc2 100644 --- a/helpers/key.py +++ b/helpers/key.py | |||
@@ -1,5 +1,6 @@ | |||
1 | from .rounded_rect import * | 1 | from .rounded_rect import * |
2 | from .action import * | 2 | from .action import * |
3 | from .font import font | ||
3 | import time | 4 | import time |
4 | import sys | 5 | import sys |
5 | import pygame | 6 | import pygame |
@@ -19,7 +20,6 @@ class Key: | |||
19 | default_inner_color = (255, 255, 255) | 20 | default_inner_color = (255, 255, 255) |
20 | mapped_inner_color = ( 0, 255, 0) | 21 | mapped_inner_color = ( 0, 255, 0) |
21 | mapped_unready_inner_color = ( 0, 255, 0, 100) | 22 | mapped_unready_inner_color = ( 0, 255, 0, 100) |
22 | #mapped_unready_inner_color = (255, 165, 0) | ||
23 | 23 | ||
24 | def __init__(self, mapping, draw_lock, key_name, key_sym, top, left, width = 48, height = 48, disabled = False): | 24 | def __init__(self, mapping, draw_lock, key_name, key_sym, top, left, width = 48, height = 48, disabled = False): |
25 | self.draw_lock = draw_lock | 25 | self.draw_lock = draw_lock |
@@ -89,12 +89,8 @@ class Key: | |||
89 | 89 | ||
90 | self.surface = self.square(all_actions_ready).surface() | 90 | self.surface = self.square(all_actions_ready).surface() |
91 | 91 | ||
92 | if getattr(sys, 'frozen', False): | 92 | police = font(14) |
93 | police = pygame.font.Font(sys._MEIPASS + "/Ubuntu-Regular.ttf", 14) | 93 | text_police = font(10) |
94 | text_police = pygame.font.Font(sys._MEIPASS + "/Ubuntu-Regular.ttf", 10) | ||
95 | else: | ||
96 | police = pygame.font.Font("Ubuntu-Regular.ttf", 14) | ||
97 | text_police = pygame.font.Font("Ubuntu-Regular.ttf", 10) | ||
98 | 94 | ||
99 | police.set_bold(True) | 95 | police.set_bold(True) |
100 | text = police.render(self.key_sym, True, (0,0,0)) | 96 | text = police.render(self.key_sym, True, (0,0,0)) |
@@ -151,10 +147,7 @@ class Key: | |||
151 | self.draw_lock.acquire() | 147 | self.draw_lock.acquire() |
152 | surface = pygame.Surface((690, 250)).convert() | 148 | surface = pygame.Surface((690, 250)).convert() |
153 | surface.fill((250, 250, 250)) | 149 | surface.fill((250, 250, 250)) |
154 | if getattr(sys, 'frozen', False): | 150 | police = font(14) |
155 | police = pygame.font.Font(sys._MEIPASS + "/Ubuntu-Regular.ttf", 14) | ||
156 | else: | ||
157 | police = pygame.font.Font("Ubuntu-Regular.ttf", 14) | ||
158 | 151 | ||
159 | offset = 0 | 152 | offset = 0 |
160 | police.set_bold(True) | 153 | police.set_bold(True) |
diff --git a/music_sampler.py b/music_sampler.py index ff04fd1..8ebfaa3 100644 --- a/music_sampler.py +++ b/music_sampler.py | |||
@@ -56,12 +56,8 @@ while 1: | |||
56 | threading.Thread(name = "MSClic", target=key.list_actions, args = [screen]).start() | 56 | threading.Thread(name = "MSClic", target=key.list_actions, args = [screen]).start() |
57 | 57 | ||
58 | draw_lock.acquire() | 58 | draw_lock.acquire() |
59 | if getattr(sys, 'frozen', False): | 59 | police = helpers.font(14) |
60 | icon_police = pygame.font.Font(sys._MEIPASS + "/Symbola.ttf", 19) | 60 | icon_police = helpers.font(14, font = "Symbola") |
61 | police = pygame.font.Font(sys._MEIPASS + "/Ubuntu-Regular.ttf", 14) | ||
62 | else: | ||
63 | icon_police = pygame.font.Font("Symbola.ttf", 19) | ||
64 | police = pygame.font.Font("Ubuntu-Regular.ttf", 14) | ||
65 | 61 | ||
66 | surface = pygame.Surface((208, 250)).convert() | 62 | surface = pygame.Surface((208, 250)).convert() |
67 | surface.fill((250, 250, 250)) | 63 | surface.fill((250, 250, 250)) |
diff --git a/music_sampler.spec b/music_sampler.spec index a60c546..912edb7 100644 --- a/music_sampler.spec +++ b/music_sampler.spec | |||
@@ -6,8 +6,7 @@ a = Analysis(['music_sampler.py'], | |||
6 | binaries=None, | 6 | binaries=None, |
7 | datas=[ | 7 | datas=[ |
8 | ('config.yml', '.'), | 8 | ('config.yml', '.'), |
9 | ('Ubuntu-Regular.ttf', '.'), | 9 | ('fonts/*', 'fonts') |
10 | ('Symbola.ttf', '.') | ||
11 | ], | 10 | ], |
12 | hiddenimports=[ | 11 | hiddenimports=[ |
13 | 'six', | 12 | 'six', |