Add new QML-based emoji picker (work in progress)
This is necessary to support having a picker within QML. Eventually, this should replace the existing widget-based one.
This commit is contained in:
parent
8984661187
commit
ee4dcef90f
16 changed files with 15558 additions and 4710 deletions
|
|
@ -14,8 +14,9 @@ class Emoji(object):
|
|||
def generate_code(emojis, category):
|
||||
tmpl = Template('''
|
||||
const std::vector<Emoji> emoji::Provider::{{ category }} = {
|
||||
// {{ category.capitalize() }}
|
||||
{%- for e in emoji %}
|
||||
Emoji{QString::fromUtf8("{{ e.code }}"), "{{ e.shortname }}"},
|
||||
{QString::fromUtf8("{{ e.code }}"), "{{ e.shortname }}", emoji::Emoji::Category::{{ category.capitalize() }}},
|
||||
{%- endfor %}
|
||||
};
|
||||
''')
|
||||
|
|
@ -23,6 +24,19 @@ const std::vector<Emoji> emoji::Provider::{{ category }} = {
|
|||
d = dict(category=category, emoji=emojis)
|
||||
print(tmpl.render(d))
|
||||
|
||||
def generate_qml_list(**kwargs):
|
||||
tmpl = Template('''
|
||||
const QVector<Emoji> emoji::Provider::emoji = {
|
||||
{%- for c in kwargs.items() %}
|
||||
// {{ c[0].capitalize() }}
|
||||
{%- for e in c[1] %}
|
||||
{QString::fromUtf8("{{ e.code }}"), "{{ e.shortname }}", emoji::Emoji::Category::{{ c[0].capitalize() }}},
|
||||
{%- endfor %}
|
||||
{%- endfor %}
|
||||
};
|
||||
''')
|
||||
d = dict(kwargs=kwargs)
|
||||
print(tmpl.render(d))
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) < 2:
|
||||
|
|
@ -87,3 +101,4 @@ if __name__ == '__main__':
|
|||
generate_code(objects, 'objects')
|
||||
generate_code(symbols, 'symbols')
|
||||
generate_code(flags, 'flags')
|
||||
generate_qml_list(people=people, nature=nature, food=food, activity=activity, travel=travel, objects=objects, symbols=symbols, flags=flags)
|
||||
Loading…
Add table
Add a link
Reference in a new issue