From 500f4e41d3a72f5865aa489c89ad11b947fa54b7 Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Thu, 10 Aug 2023 12:57:31 +0200 Subject: Allow multiple custom layouts This merges the "Layouts" option with the "Custom layout" option. A custom layout becomes an item in the "Layouts" list among the other layouts. It's possible to add several custom layouts. Selecting the "Custom layout" item in the list opens a second dialog for entering the layout description. Layouts are serialized as JSON object and are decoded solely in the LayoutsPreference class. --- gen_layouts.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gen_layouts.py') diff --git a/gen_layouts.py b/gen_layouts.py index 44c3563..c2e6e8d 100644 --- a/gen_layouts.py +++ b/gen_layouts.py @@ -54,9 +54,9 @@ def generate_arrays(out, layouts): item.text = s elem.append(item) return elem - none_item = [ ("system", "@string/pref_layout_e_system") ] + system_item = [ ("system", "@string/pref_layout_e_system") ] custom_item = [ ("custom", "@string/pref_layout_e_custom") ] - values_items, entries_items = zip(*(none_item + layouts + custom_item)) # unzip + values_items, entries_items = zip(*(system_item + layouts + custom_item)) # unzip ids_items = map(lambda s: "@xml/%s" % s if s not in ["system", "custom"] else "-1", values_items) root = XML.Element("resources") root.append(XML.Comment(text="DO NOT EDIT. This file is generated, see gen_layouts.py.")) -- cgit v1.2.3