From 8601cdd853f205bdbc83dd78220f5e99ab624b68 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Isma=C3=ABl=20Bouya?= Date: Sun, 26 Jun 2016 17:42:09 +0200 Subject: [PATCH 1/1] Factorise font mocks --- musicsampler.kv | 99 ++++++++++++++++++------------------------------- 1 file changed, 36 insertions(+), 63 deletions(-) diff --git a/musicsampler.kv b/musicsampler.kv index 137b7bd..4a44069 100644 --- a/musicsampler.kv +++ b/musicsampler.kv @@ -94,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 @@ -113,7 +145,6 @@ size: self.parent.play_list_width, self.parent.play_list_height : - min_height: min(action_list_mock_symbola.height, action_list_mock_ubuntu_regular.height, action_list_mock_ubuntu_bold.height) size_hint: None, None canvas: Color: @@ -121,35 +152,6 @@ Rectangle: pos: 0, 0 size: self.width, self.height - # FIXME: déplacer ça dans Screen? - Label: - id: action_list_mock_symbola - font_name: h.path() + "fonts/Symbola.ttf" - font_size: math.ceil(2 * math.sqrt(self.parent.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: action_list_mock_ubuntu_regular - font_name: h.path() + "fonts/Ubuntu-Regular.ttf" - font_size: math.ceil(2 * math.sqrt(self.parent.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: action_list_mock_ubuntu_bold - 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, 0 - text: "A" - text_size: None, None - size_hint: None, None - size: self.texture_size - Label: id: action_list_title @@ -166,7 +168,7 @@ id: action_list_icons font_name: h.path() + "fonts/Symbola.ttf" font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size or 10)) - line_height: self.parent.min_height / max(action_list_mock_symbola.height,1) + 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 @@ -178,7 +180,7 @@ id: action_list_names 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.min_height / max(action_list_mock_ubuntu_regular.height,1) + 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 @@ -189,7 +191,6 @@ size: self.texture_size[0], self.parent.height - 3 * self.line_height * self.font_size : - min_height: min(playlist_mock_symbola.height, playlist_mock_ubuntu_regular.height, playlist_mock_ubuntu_bold.height) size_hint: None, None canvas: Color: @@ -197,40 +198,12 @@ Rectangle: pos: 0, 0 size: self.width, self.height - Label: - id: playlist_mock_symbola - font_name: h.path() + "fonts/Symbola.ttf" - font_size: math.ceil(2 * math.sqrt(self.parent.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: playlist_mock_ubuntu_regular - font_name: h.path() + "fonts/Ubuntu-Regular.ttf" - font_size: math.ceil(2 * math.sqrt(self.parent.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: playlist_mock_ubuntu_bold - 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, 0 - text: "A" - text_size: None, None - size_hint: None, None - size: self.texture_size - Label: id: playlist_icons font_name: h.path() + "fonts/Symbola.ttf" font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size or 10)) - line_height: self.parent.min_height / max(playlist_mock_symbola.height,1) + 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 @@ -241,7 +214,7 @@ Label: id: playlist_names font_name: h.path() + "fonts/Ubuntu-Regular.ttf" # FIXME: Mettre en gras quand c'est en cours - line_height: self.parent.min_height / max(playlist_mock_ubuntu_regular.height,1) + 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)) -- 2.41.0