X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=musicsampler.kv;h=4a44069c03bf1154f023470ad59f2cafbaf3e63d;hb=8601cdd853f205bdbc83dd78220f5e99ab624b68;hp=17be1f538f96963b8c2edff1cbb187babbec8ac7;hpb=4b2d79ca27dcbb85465829595ad81cec5fc63983;p=perso%2FImmae%2FProjets%2FPython%2FMusicSampler.git diff --git a/musicsampler.kv b/musicsampler.kv index 17be1f5..4a44069 100644 --- a/musicsampler.kv +++ b/musicsampler.kv @@ -1,4 +1,5 @@ #:import math math +#:import h helpers : pad_col_sep: 0 if not self.pad_cols else self.parent.pad_x @@ -32,7 +33,7 @@ width: self.line_width Label: id: key_label - font_name: "fonts/Ubuntu-B.ttf" + font_name: h.path() + "fonts/Ubuntu-B.ttf" font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size)) color: 0, 0, 0, 1 text: self.parent.key_sym @@ -44,7 +45,7 @@ center_y: self.parent.y + self.parent.height - self.texture_size[1] /2 - 5 Label: id: key_description_title - font_name: "fonts/Ubuntu-Regular.ttf" + font_name: h.path() + "fonts/Ubuntu-Regular.ttf" font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size / 2)) color: 0, 0, 0, 1 text: self.parent.description_title @@ -55,7 +56,7 @@ center_y: self.parent.y + self.parent.height - self.texture_size[1] /2 - 5 Label: id: key_description - font_name: "fonts/Ubuntu-Regular.ttf" + font_name: h.path() + "fonts/Ubuntu-Regular.ttf" font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size / 2)) color: 0, 0, 0, 1 text: "\n".join(self.parent.description) @@ -93,6 +94,38 @@ play_list_y: self.border play_list_x: self.action_list_width + 2 * self.border + min_height: min(mock_symbola.height, mock_ubuntu_regular.height, mock_ubuntu_bold.height) + symbola_line_height: self.min_height / max(mock_symbola.height,1) + ubuntu_regular_line_height: self.min_height / max(mock_ubuntu_regular.height,1) + ubuntu_bold_line_height: self.min_height / max(mock_ubuntu_bold.height,1) + Label: + id: mock_symbola + font_name: h.path() + "fonts/Symbola.ttf" + font_size: math.ceil(2 * math.sqrt(self.parent.key_size or 10)) + color: 0, 0, 0, 0 + text: "A" + text_size: None, None + size_hint: None, None + size: self.texture_size + Label: + id: mock_ubuntu_regular + font_name: h.path() + "fonts/Ubuntu-Regular.ttf" + font_size: math.ceil(2 * math.sqrt(self.parent.key_size or 10)) + color: 0, 0, 0, 0 + text: "A" + text_size: None, None + size_hint: None, None + size: self.texture_size + Label: + id: mock_ubuntu_bold + font_name: h.path() + "fonts/Ubuntu-B.ttf" + font_size: math.ceil(2 * math.sqrt(self.parent.key_size or 10)) + color: 0, 0, 0, 0 + text: "A" + text_size: None, None + size_hint: None, None + size: self.texture_size + Mapping: id: Mapping pos: self.parent.mapping_x, self.parent.mapping_y @@ -119,9 +152,10 @@ Rectangle: pos: 0, 0 size: self.width, self.height + Label: id: action_list_title - font_name: "fonts/Ubuntu-B.ttf" + font_name: h.path() + "fonts/Ubuntu-B.ttf" font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size or 10)) color: 0, 0, 0, 1 text: self.parent.action_title @@ -132,9 +166,9 @@ size: self.texture_size[0], self.parent.height Label: id: action_list_icons - font_name: "fonts/Symbola.ttf" + font_name: h.path() + "fonts/Symbola.ttf" font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size or 10)) - line_height: 1.2 # FIXME: Donner la bonne taille de label + line_height: self.parent.parent.symbola_line_height or 1 color: 0, 0, 0, 1 text: "\n".join(map(lambda x: x[0], self.parent.action_list)) text_size: None, self.parent.height @@ -144,8 +178,9 @@ size: self.texture_size[0], self.parent.height - 3 * self.line_height * self.font_size Label: id: action_list_names - font_name: "fonts/Ubuntu-Regular.ttf" + font_name: h.path() + "fonts/Ubuntu-Regular.ttf" font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size or 10)) + line_height: self.parent.parent.ubuntu_regular_line_height or 1 color: 0, 0, 0, 1 text: "\n".join(map(lambda x: x[1], self.parent.action_list)) text_size: None, self.parent.height @@ -163,11 +198,12 @@ Rectangle: pos: 0, 0 size: self.width, self.height + Label: id: playlist_icons - font_name: "fonts/Symbola.ttf" + font_name: h.path() + "fonts/Symbola.ttf" font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size or 10)) - line_height: 1.2 # FIXME: Donner la bonne taille de label + line_height: self.parent.parent.symbola_line_height or 1 color: 0, 0, 0, 1 text: "\n".join(map(lambda x: x[0], self.parent.playlist)) text_size: None, self.parent.height @@ -177,7 +213,8 @@ size: self.texture_size[0], self.parent.height Label: id: playlist_names - font_name: "fonts/Ubuntu-Regular.ttf" # FIXME: Mettre en gras quand c'est en cours + font_name: h.path() + "fonts/Ubuntu-Regular.ttf" # FIXME: Mettre en gras quand c'est en cours + line_height: self.parent.parent.ubuntu_regular_line_height or 1 font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size or 10)) color: 0, 0, 0, 1 text: "\n".join(map(lambda x: x[1], self.parent.playlist))