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.
This commit is contained in:
Jules Aguillon
2023-08-10 12:57:31 +02:00
parent 8611dbcfa0
commit 500f4e41d3
21 changed files with 194 additions and 107 deletions

View File

@@ -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."))