aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2016-07-27 19:32:38 +0200
committerIsmaël Bouya <ismael.bouya@normalesup.org>2016-07-27 19:44:09 +0200
commit35bde798b6cda13579337b0ec5a803fdd5eab19a (patch)
treef0cc63dfb2b64aafbd6477b4d239899b8c9dba3c
parentcfde9820184a3b70c70bcf396c396a4c64fa9a39 (diff)
downloadMusicSampler-35bde798b6cda13579337b0ec5a803fdd5eab19a.tar.gz
MusicSampler-35bde798b6cda13579337b0ec5a803fdd5eab19a.tar.zst
MusicSampler-35bde798b6cda13579337b0ec5a803fdd5eab19a.zip
Remove fonts from directory
-rw-r--r--documentation_fr.md12
-rw-r--r--fonts/Symbola.ttfbin2188952 -> 0 bytes
-rw-r--r--fonts/Ubuntu-B.ttfbin333612 -> 0 bytes
-rw-r--r--fonts/Ubuntu-Regular.ttfbin353824 -> 0 bytes
-rw-r--r--helpers/__init__.py34
-rw-r--r--helpers/sysfont.py224
-rw-r--r--music_sampler.kv38
-rw-r--r--music_sampler.py2
-rw-r--r--music_sampler.spec25
9 files changed, 310 insertions, 25 deletions
diff --git a/documentation_fr.md b/documentation_fr.md
index 622b054..8ba058d 100644
--- a/documentation_fr.md
+++ b/documentation_fr.md
@@ -8,14 +8,15 @@ Music Sampler est un lecteur de musique qui permet de pré-programmer des transi
8 8
9## Pré-requis et installation 9## Pré-requis et installation
10 10
11Il faut avoir ffmpeg d'installé. Pour cela, il faut installer le paquet `libav-tools` : 11- Il faut avoir ffmpeg d'installé. Pour cela, il faut installer le paquet `libav-tools` :
12 12
13 :::bash 13 ```
14 sudo apt-get install libav-tools 14 sudo apt-get install libav-tools
15 ```
15 16
16Si vous utilisez la version compilée de Music Sampler, il n'y a rien d'autre à installer. 17Si vous utilisez la version compilée de Music Sampler, il n'y a rien d'autre à installer.
17 18
18Pour utiliser les sources directement, les modules suivants sont requis: 19- Pour utiliser les sources directement, les modules suivants sont requis:
19 20
20| module | version minimale | commentaire | 21| module | version minimale | commentaire |
21| ----------- | ---------------- | -------------------------------- | 22| ----------- | ---------------- | -------------------------------- |
@@ -28,6 +29,11 @@ Pour utiliser les sources directement, les modules suivants sont requis:
28| transitions | 0.4.1 | | 29| transitions | 0.4.1 | |
29| PyYAML | 3.11 | | 30| PyYAML | 3.11 | |
30 31
32- Le programme utilise les polices "Symbola" et "Ubuntu" (Regular / Bold), qui doivent être disponibles.
33
34 ```
35 sudo apt-get install ttf-ancient-fonts ttf-ubuntu-font-family
36 ```
31 37
32## Version compilée 38## Version compilée
33 39
diff --git a/fonts/Symbola.ttf b/fonts/Symbola.ttf
deleted file mode 100644
index 51d9a88..0000000
--- a/fonts/Symbola.ttf
+++ /dev/null
Binary files differ
diff --git a/fonts/Ubuntu-B.ttf b/fonts/Ubuntu-B.ttf
deleted file mode 100644
index b173da2..0000000
--- a/fonts/Ubuntu-B.ttf
+++ /dev/null
Binary files differ
diff --git a/fonts/Ubuntu-Regular.ttf b/fonts/Ubuntu-Regular.ttf
deleted file mode 100644
index 45a038b..0000000
--- a/fonts/Ubuntu-Regular.ttf
+++ /dev/null
Binary files differ
diff --git a/helpers/__init__.py b/helpers/__init__.py
index f1a968b..4827e6c 100644
--- a/helpers/__init__.py
+++ b/helpers/__init__.py
@@ -6,9 +6,43 @@ import math
6import sounddevice as sd 6import sounddevice as sd
7import logging 7import logging
8 8
9from . import sysfont
10
9class Config: 11class Config:
10 pass 12 pass
11 13
14def find_font(name, style=sysfont.STYLE_NONE):
15 if getattr(sys, 'frozen', False):
16 font = sys._MEIPASS + "/fonts/{}_{}.ttf".format(name, style)
17 else:
18 font = sysfont.get_font(name, style=style)
19 if font is not None:
20 font = font[4]
21 return font
22
23def register_fonts():
24 from kivy.core.text import LabelBase
25
26 ubuntu_regular = find_font("Ubuntu", style=sysfont.STYLE_NORMAL)
27 ubuntu_bold = find_font("Ubuntu", style=sysfont.STYLE_BOLD)
28 symbola = find_font("Symbola")
29
30 if ubuntu_regular is None:
31 error_print("Font Ubuntu regular could not be found, please install it.")
32 sys.exit()
33 if symbola is None:
34 error_print("Font Symbola could not be found, please install it.")
35 sys.exit()
36 if ubuntu_bold is None:
37 warn_print("Font Ubuntu Bold could not be found.")
38
39 LabelBase.register(name="Ubuntu",
40 fn_regular=ubuntu_regular,
41 fn_bold=ubuntu_bold)
42 LabelBase.register(name="Symbola",
43 fn_regular=symbola)
44
45
12def path(): 46def path():
13 if getattr(sys, 'frozen', False): 47 if getattr(sys, 'frozen', False):
14 return sys._MEIPASS + "/" 48 return sys._MEIPASS + "/"
diff --git a/helpers/sysfont.py b/helpers/sysfont.py
new file mode 100644
index 0000000..f47693e
--- /dev/null
+++ b/helpers/sysfont.py
@@ -0,0 +1,224 @@
1# This file was imported from
2# https://bitbucket.org/marcusva/python-utils/overview
3# And slightly adapted
4
5"""OS-specific font detection."""
6import os
7import sys
8from subprocess import Popen, PIPE
9
10if sys.platform in ("win32", "cli"):
11 import winreg
12
13__all__ = ["STYLE_NORMAL", "STYLE_BOLD", "STYLE_ITALIC", "STYLE_LIGHT",
14 "init", "list_fonts", "get_fonts", "get_font"
15 ]
16
17# Font cache entries:
18# { family : [...,
19# (name, styles, fonttype, filename)
20# ...
21# ]
22# }
23__FONTCACHE = None
24
25
26STYLE_NONE = 0x00
27STYLE_NORMAL = 0x01
28STYLE_BOLD = 0x02
29STYLE_ITALIC = 0x04
30STYLE_LIGHT = 0x08
31STYLE_MEDIUM = 0x10
32
33def _add_font(family, name, styles, fonttype, filename):
34 """Adds a font to the internal font cache."""
35 global __FONTCACHE
36
37 if family not in __FONTCACHE:
38 __FONTCACHE[family] = []
39 __FONTCACHE[family].append((name, styles, fonttype, filename))
40
41
42def _cache_fonts_win32():
43 """Caches fonts on a Win32 platform."""
44 key = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts"
45 regfonts = []
46 try:
47 with winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, key) as fontkey:
48 idx = 0
49 enumval = winreg.EnumValue
50 rappend = regfonts.append
51 while True:
52 rappend(enumval(fontkey, idx)[:2])
53 idx += 1
54 except WindowsError:
55 pass
56
57 # TODO: integrate alias handling for fonts within the registry.
58 # TODO: Scan and index fonts from %SystemRoot%\\Fonts that are not in the
59 # registry
60
61 # Received all fonts from the registry.
62 for name, filename in regfonts:
63 fonttype = os.path.splitext(filename)[1][1:].lower()
64 if name.endswith("(TrueType)"):
65 name = name[:-10].strip()
66 if name.endswith("(All Res)"):
67 name = name[:-9].strip()
68 style = STYLE_NORMAL
69 if name.find(" Bold") >= 0:
70 style |= STYLE_BOLD
71 if name.find(" Italic") >= 0 or name.find(" Oblique") >= 0:
72 style |= STYLE_ITALIC
73
74 family = name
75 for rm in ("Bold", "Italic", "Oblique"):
76 family = family.replace(rm, "")
77 family = family.lower().strip()
78
79 fontpath = os.environ.get("SystemRoot", "C:\\Windows")
80 fontpath = os.path.join(fontpath, "Fonts")
81 if filename.find("\\") == -1:
82 # No path delimiter is given; we assume it to be a font in
83 # %SystemRoot%\Fonts
84 filename = os.path.join(fontpath, filename)
85 _add_font(family, name, style, fonttype, filename)
86
87
88def _cache_fonts_darwin():
89 """Caches fonts on Mac OS."""
90 raise NotImplementedError("Mac OS X support is not given yet")
91
92
93def _cache_fonts_fontconfig():
94 """Caches font on POSIX-alike platforms."""
95 try:
96 command = "fc-list : file family style fullname fullnamelang"
97 proc = Popen(command, stdout=PIPE, shell=True, stderr=PIPE)
98 pout = proc.communicate()[0]
99 output = pout.decode("utf-8")
100 except OSError:
101 return
102
103 for entry in output.split(os.linesep):
104 if entry.strip() == "":
105 continue
106 values = entry.split(":")
107 filename = values[0]
108
109 # get the font type
110 fname, fonttype = os.path.splitext(filename)
111 if fonttype == ".gz":
112 fonttype = os.path.splitext(fname)[1][1:].lower()
113 else:
114 fonttype = fonttype.lstrip(".").lower()
115
116 # get the font name
117 name = None
118 if len(values) > 3:
119 fullnames, fullnamelangs = values[3:]
120 langs = fullnamelangs.split(",")
121 try:
122 offset = langs.index("fullnamelang=en")
123 except ValueError:
124 offset = -1
125 if offset == -1:
126 try:
127 offset = langs.index("en")
128 except ValueError:
129 offset = -1
130 if offset != -1:
131 # got an english name, use that one
132 name = fullnames.split(",")[offset]
133 if name.startswith("fullname="):
134 name = name[9:]
135 if name is None:
136 if fname.endswith(".pcf") or fname.endswith(".bdf"):
137 name = os.path.basename(fname[:-4])
138 else:
139 name = os.path.basename(fname)
140 name = name.lower()
141
142 # family and styles
143 family = values[1].strip().lower()
144 stylevals = values[2].strip()
145 style = STYLE_NONE
146
147 if stylevals.find("Bold") >= 0:
148 style |= STYLE_BOLD
149 if stylevals.find("Light") >= 0:
150 style |= STYLE_LIGHT
151 if stylevals.find("Italic") >= 0 or stylevals.find("Oblique") >= 0:
152 style |= STYLE_ITALIC
153 if stylevals.find("Medium") >= 0:
154 style |= STYLE_MEDIUM
155 if style == STYLE_NONE:
156 style = STYLE_NORMAL
157 _add_font(family, name, style, fonttype, filename)
158
159
160def init():
161 """Initialises the internal font cache.
162
163 It does not need to be called explicitly.
164 """
165 global __FONTCACHE
166 if __FONTCACHE is not None:
167 return
168 __FONTCACHE = {}
169 if sys.platform in ("win32", "cli"):
170 _cache_fonts_win32()
171 elif sys.platform == "darwin":
172 _cache_fonts_darwin()
173 else:
174 _cache_fonts_fontconfig()
175
176
177def list_fonts():
178 """Returns an iterator over the cached fonts."""
179 if __FONTCACHE is None:
180 init()
181 if len(__FONTCACHE) == 0:
182 yield None
183 for family, entries in __FONTCACHE.items():
184 for fname, styles, fonttype, filename in entries:
185 yield (family, fname, styles, fonttype, filename)
186
187
188def get_fonts(name, style=STYLE_NONE, ftype=None):
189 """Retrieves all fonts matching the given family or font name."""
190 if __FONTCACHE is None:
191 init()
192 if len(__FONTCACHE) == 0:
193 return None
194
195 results = []
196 rappend = results.append
197
198 name = name.lower()
199 if ftype:
200 ftype = ftype.lower()
201
202 fonts = __FONTCACHE.get(name, [])
203 for fname, fstyles, fonttype, filename in fonts:
204 if ftype and fonttype != ftype:
205 # ignore font filetype mismatches
206 continue
207 if style == STYLE_NONE or fstyles == style:
208 rappend((name, fname, fstyles, fonttype, filename))
209
210 for family, fonts in __FONTCACHE.items():
211 for fname, fstyles, fonttype, filename in fonts:
212 if fname.lower() == name and filename not in results:
213 rappend((family, fname, fstyles, fonttype, filename))
214 return results
215
216
217def get_font(name, style=STYLE_NONE, ftype=None):
218 """Retrieves the best matching font file for the given name and
219 criteria.
220 """
221 retvals = get_fonts(name, style, ftype)
222 if len(retvals) > 0:
223 return retvals[0]
224 return None
diff --git a/music_sampler.kv b/music_sampler.kv
index fa38627..a18eb4e 100644
--- a/music_sampler.kv
+++ b/music_sampler.kv
@@ -40,7 +40,8 @@
40 width: self.line_width 40 width: self.line_width
41 Label: 41 Label:
42 id: key_label 42 id: key_label
43 font_name: h.path() + "fonts/Ubuntu-B.ttf" 43 font_name: "Ubuntu"
44 bold: True
44 font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size)) 45 font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size))
45 color: 0, 0, 0, 1 46 color: 0, 0, 0, 1
46 text: self.parent.key_sym 47 text: self.parent.key_sym
@@ -52,7 +53,7 @@
52 center_y: self.parent.y + self.parent.height - self.texture_size[1] /2 - 5 53 center_y: self.parent.y + self.parent.height - self.texture_size[1] /2 - 5
53 Label: 54 Label:
54 id: key_description_title 55 id: key_description_title
55 font_name: h.path() + "fonts/Ubuntu-Regular.ttf" 56 font_name: "Ubuntu"
56 font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size / 2)) 57 font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size / 2))
57 color: 0, 0, 0, 1 58 color: 0, 0, 0, 1
58 text: self.parent.description_title 59 text: self.parent.description_title
@@ -63,7 +64,7 @@
63 center_y: self.parent.y + self.parent.height - self.texture_size[1] /2 - 5 64 center_y: self.parent.y + self.parent.height - self.texture_size[1] /2 - 5
64 Label: 65 Label:
65 id: key_description 66 id: key_description
66 font_name: h.path() + "fonts/Ubuntu-Regular.ttf" 67 font_name: "Ubuntu"
67 font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size / 2)) 68 font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size / 2))
68 color: 0, 0, 0, 1 69 color: 0, 0, 0, 1
69 text: "\n".join(self.parent.description) 70 text: "\n".join(self.parent.description)
@@ -114,7 +115,7 @@
114 ubuntu_bold_line_height: self.min_height / max(mock_ubuntu_bold.height,1) 115 ubuntu_bold_line_height: self.min_height / max(mock_ubuntu_bold.height,1)
115 Label: 116 Label:
116 id: mock_symbola 117 id: mock_symbola
117 font_name: h.path() + "fonts/Symbola.ttf" 118 font_name: "Symbola"
118 font_size: math.ceil(2 * math.sqrt(self.parent.key_size or 10)) 119 font_size: math.ceil(2 * math.sqrt(self.parent.key_size or 10))
119 color: 0, 0, 0, 0 120 color: 0, 0, 0, 0
120 text: "A" 121 text: "A"
@@ -123,7 +124,7 @@
123 size: self.texture_size 124 size: self.texture_size
124 Label: 125 Label:
125 id: mock_ubuntu_regular 126 id: mock_ubuntu_regular
126 font_name: h.path() + "fonts/Ubuntu-Regular.ttf" 127 font_name: "Ubuntu"
127 font_size: math.ceil(2 * math.sqrt(self.parent.key_size or 10)) 128 font_size: math.ceil(2 * math.sqrt(self.parent.key_size or 10))
128 color: 0, 0, 0, 0 129 color: 0, 0, 0, 0
129 text: "A" 130 text: "A"
@@ -132,7 +133,8 @@
132 size: self.texture_size 133 size: self.texture_size
133 Label: 134 Label:
134 id: mock_ubuntu_bold 135 id: mock_ubuntu_bold
135 font_name: h.path() + "fonts/Ubuntu-B.ttf" 136 font_name: "Ubuntu"
137 bold: True
136 font_size: math.ceil(2 * math.sqrt(self.parent.key_size or 10)) 138 font_size: math.ceil(2 * math.sqrt(self.parent.key_size or 10))
137 color: 0, 0, 0, 0 139 color: 0, 0, 0, 0
138 text: "A" 140 text: "A"
@@ -172,7 +174,8 @@
172 size: self.width, self.height 174 size: self.width, self.height
173 Label: 175 Label:
174 id: key_list_first 176 id: key_list_first
175 font_name: h.path() + "fonts/Ubuntu-B.ttf" 177 font_name: "Ubuntu"
178 bold: True
176 font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size or 10)) 179 font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size or 10))
177 color: 0, 0, 0, 1 180 color: 0, 0, 0, 1
178 text: self.parent.first_key 181 text: self.parent.first_key
@@ -184,7 +187,7 @@
184 pos: 0, self.parent.height - self.height 187 pos: 0, self.parent.height - self.height
185 Label: 188 Label:
186 id: key_list_second 189 id: key_list_second
187 font_name: h.path() + "fonts/Ubuntu-Regular.ttf" 190 font_name: "Ubuntu"
188 font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size or 10)) 191 font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size or 10))
189 color: 0, 0, 0, 1 192 color: 0, 0, 0, 1
190 text: self.parent.second_key 193 text: self.parent.second_key
@@ -196,7 +199,7 @@
196 pos: 0, self.parent.height - key_list_first.height - self.height 199 pos: 0, self.parent.height - key_list_first.height - self.height
197 Label: 200 Label:
198 id: key_list_third 201 id: key_list_third
199 font_name: h.path() + "fonts/Ubuntu-Regular.ttf" 202 font_name: "Ubuntu"
200 font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size or 10)) 203 font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size or 10))
201 color: 0, 0, 0, 0.75 204 color: 0, 0, 0, 0.75
202 text: self.parent.third_key 205 text: self.parent.third_key
@@ -208,7 +211,7 @@
208 pos: 0, self.parent.height - key_list_first.height - key_list_second.height - self.height 211 pos: 0, self.parent.height - key_list_first.height - key_list_second.height - self.height
209 Label: 212 Label:
210 id: key_list_rest 213 id: key_list_rest
211 font_name: h.path() + "fonts/Ubuntu-Regular.ttf" 214 font_name: "Ubuntu"
212 font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size or 10)) 215 font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size or 10))
213 color: 0, 0, 0, 0.5 216 color: 0, 0, 0, 0.5
214 text: "\n".join(self.parent.keylist[3:]) 217 text: "\n".join(self.parent.keylist[3:])
@@ -230,7 +233,8 @@
230 233
231 Label: 234 Label:
232 id: action_list_title 235 id: action_list_title
233 font_name: h.path() + "fonts/Ubuntu-B.ttf" 236 font_name: "Ubuntu"
237 bold: True
234 font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size or 10)) 238 font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size or 10))
235 color: 0, 0, 0, 1 239 color: 0, 0, 0, 1
236 text: self.parent.action_title 240 text: self.parent.action_title
@@ -241,7 +245,7 @@
241 size: self.texture_size[0], self.parent.height 245 size: self.texture_size[0], self.parent.height
242 Label: 246 Label:
243 id: action_list_icons 247 id: action_list_icons
244 font_name: h.path() + "fonts/Symbola.ttf" 248 font_name: "Symbola"
245 font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size or 10)) 249 font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size or 10))
246 line_height: self.parent.parent.symbola_line_height or 1 250 line_height: self.parent.parent.symbola_line_height or 1
247 color: 0, 0, 0, 1 251 color: 0, 0, 0, 1
@@ -253,7 +257,7 @@
253 size: self.texture_size[0], self.parent.height - 3 * self.line_height * self.font_size 257 size: self.texture_size[0], self.parent.height - 3 * self.line_height * self.font_size
254 Label: 258 Label:
255 id: action_list_names 259 id: action_list_names
256 font_name: h.path() + "fonts/Ubuntu-Regular.ttf" 260 font_name: "Ubuntu"
257 font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size or 10)) 261 font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size or 10))
258 line_height: self.parent.parent.ubuntu_regular_line_height or 1 262 line_height: self.parent.parent.ubuntu_regular_line_height or 1
259 color: 0, 0, 0, 1 263 color: 0, 0, 0, 1
@@ -276,7 +280,7 @@
276 280
277 Label: 281 Label:
278 id: playlist_icons 282 id: playlist_icons
279 font_name: h.path() + "fonts/Symbola.ttf" 283 font_name: "Symbola"
280 font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size or 10)) 284 font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size or 10))
281 line_height: self.parent.parent.symbola_line_height or 1 285 line_height: self.parent.parent.symbola_line_height or 1
282 color: 0, 0, 0, 1 286 color: 0, 0, 0, 1
@@ -288,7 +292,7 @@
288 size: self.texture_size[0], self.parent.height 292 size: self.texture_size[0], self.parent.height
289 Label: 293 Label:
290 id: playlist_names 294 id: playlist_names
291 font_name: h.path() + "fonts/Ubuntu-Regular.ttf" # FIXME: Mettre en gras quand c'est en cours 295 font_name: "Ubuntu" # FIXME: Mettre en gras quand c'est en cours
292 line_height: self.parent.parent.ubuntu_regular_line_height or 1 296 line_height: self.parent.parent.ubuntu_regular_line_height or 1
293 font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size or 10)) 297 font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size or 10))
294 color: 0, 0, 0, 1 298 color: 0, 0, 0, 1
@@ -307,7 +311,7 @@
307 pos: self.pos 311 pos: self.pos
308 size: self.width, self.height 312 size: self.width, self.height
309 id: playlist_times 313 id: playlist_times
310 font_name: h.path() + "fonts/Ubuntu-Regular.ttf" 314 font_name: "Ubuntu"
311 line_height: self.parent.parent.ubuntu_regular_line_height or 1 315 line_height: self.parent.parent.ubuntu_regular_line_height or 1
312 font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size or 10)) 316 font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size or 10))
313 color: 0, 0, 0, 1 317 color: 0, 0, 0, 1
@@ -337,7 +341,7 @@
337 pos: self.width - self.key_size / 2, self.height - self.key_size /2 341 pos: self.width - self.key_size / 2, self.height - self.key_size /2
338 size: self.key_size / 3, self.key_size / 3 342 size: self.key_size / 3, self.key_size / 3
339 Label: 343 Label:
340 font_name: h.path() + "fonts/Ubuntu-Regular.ttf" 344 font_name: "Ubuntu"
341 font_size: math.ceil(2 * math.sqrt(self.parent.key_size or 10)) 345 font_size: math.ceil(2 * math.sqrt(self.parent.key_size or 10))
342 color: 0, 0, 0, 1 346 color: 0, 0, 0, 1
343 text: "volume: {}%".format(self.parent.master_volume) 347 text: "volume: {}%".format(self.parent.master_volume)
diff --git a/music_sampler.py b/music_sampler.py
index c10b634..f5df2bf 100644
--- a/music_sampler.py
+++ b/music_sampler.py
@@ -14,6 +14,8 @@ from kivy.lang import Builder
14from helpers.key import Key 14from helpers.key import Key
15from helpers.mapping import Mapping 15from helpers.mapping import Mapping
16 16
17helpers.register_fonts()
18
17class KeyList(RelativeLayout): 19class KeyList(RelativeLayout):
18 keylist = ListProperty([]) 20 keylist = ListProperty([])
19 first_key = StringProperty("") 21 first_key = StringProperty("")
diff --git a/music_sampler.spec b/music_sampler.spec
index 591a6cf..0d99dca 100644
--- a/music_sampler.spec
+++ b/music_sampler.spec
@@ -3,6 +3,11 @@ import os
3from kivy.tools.packaging.pyinstaller_hooks import get_deps_minimal,\ 3from kivy.tools.packaging.pyinstaller_hooks import get_deps_minimal,\
4 hookspath, runtime_hooks 4 hookspath, runtime_hooks
5 5
6import importlib.machinery
7sysfont = importlib.machinery\
8 .SourceFileLoader('sysfont', os.getcwd() + '/helpers/sysfont.py') \
9 .load_module()
10
6excluded_and_hidden_modules = get_deps_minimal( 11excluded_and_hidden_modules = get_deps_minimal(
7 video=None, 12 video=None,
8 camera=None, 13 camera=None,
@@ -22,16 +27,26 @@ pyinstaller_file = open(".pyinstaller_commit", "w")
22pyinstaller_file.write(commit_message) 27pyinstaller_file.write(commit_message)
23pyinstaller_file.close() 28pyinstaller_file.close()
24 29
30data = [
31 ('music_sampler.kv', '.'),
32 ('.pyinstaller_commit', '.')
33]
34
25a = Analysis(['music_sampler.py'], 35a = Analysis(['music_sampler.py'],
26 binaries=None, 36 binaries=None,
27 datas=[ 37 datas=data,
28 ('fonts/*', 'fonts'),
29 ('music_sampler.kv', '.'),
30 ('.pyinstaller_commit', '.')
31 ],
32 hookspath=hookspath(), 38 hookspath=hookspath(),
33 runtime_hooks=runtime_hooks(), 39 runtime_hooks=runtime_hooks(),
34 **excluded_and_hidden_modules) 40 **excluded_and_hidden_modules)
41
42for fontname, style in [("Ubuntu", sysfont.STYLE_NORMAL), ("Ubuntu", sysfont.STYLE_BOLD), ("Symbola", sysfont.STYLE_NONE)]:
43 font = sysfont.get_font(fontname, style=style)
44 a.datas.append((
45 'fonts/{}_{}.ttf'.format(fontname, style),
46 font[4],
47 'DATA'
48 ))
49
35pyz = PYZ(a.pure, a.zipped_data) 50pyz = PYZ(a.pure, a.zipped_data)
36 51
37# Single file 52# Single file