init Files
This commit is contained in:
1357
libraries/lvgl/scripts/LVGLImage.py
Executable file
1357
libraries/lvgl/scripts/LVGLImage.py
Executable file
File diff suppressed because it is too large
Load Diff
19
libraries/lvgl/scripts/build_html_examples.sh
Executable file
19
libraries/lvgl/scripts/build_html_examples.sh
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
|
||||
CURRENT_REF="$(git rev-parse HEAD)"
|
||||
rm -rf emscripten_builder
|
||||
git clone https://github.com/lvgl/lv_sim_emscripten.git emscripten_builder
|
||||
scripts/genexamplelist.sh > emscripten_builder/examplelist.c
|
||||
cd emscripten_builder
|
||||
git submodule update --init -- lvgl
|
||||
cd lvgl
|
||||
git checkout $CURRENT_REF
|
||||
cd ..
|
||||
mkdir cmbuild
|
||||
cd cmbuild
|
||||
emcmake cmake .. -DLVGL_CHOSEN_DEMO=lv_example_noop -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
|
||||
emmake make -j$(nproc)
|
||||
rm -rf CMakeFiles
|
||||
cd ../..
|
||||
cp -a emscripten_builder/cmbuild docs/_static/built_lv_examples
|
||||
BIN
libraries/lvgl/scripts/built_in_font/DejaVuSans.ttf
Normal file
BIN
libraries/lvgl/scripts/built_in_font/DejaVuSans.ttf
Normal file
Binary file not shown.
Binary file not shown.
BIN
libraries/lvgl/scripts/built_in_font/Montserrat-Medium.ttf
Normal file
BIN
libraries/lvgl/scripts/built_in_font/Montserrat-Medium.ttf
Normal file
Binary file not shown.
BIN
libraries/lvgl/scripts/built_in_font/SimSun.woff
Normal file
BIN
libraries/lvgl/scripts/built_in_font/SimSun.woff
Normal file
Binary file not shown.
62
libraries/lvgl/scripts/built_in_font/built_in_font_gen.py
Executable file
62
libraries/lvgl/scripts/built_in_font/built_in_font_gen.py
Executable file
@@ -0,0 +1,62 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
from argparse import RawTextHelpFormatter
|
||||
import os
|
||||
import sys
|
||||
|
||||
parser = argparse.ArgumentParser(description="""Create fonts for LVGL including the built-in symbols. lv_font_conv needs to be installed. See https://github.com/lvgl/lv_font_conv
|
||||
Example: python built_in_font_gen.py --size 16 -o lv_font_roboto_16.c --bpp 4 -r 0x20-0x7F""", formatter_class=RawTextHelpFormatter)
|
||||
parser.add_argument('-s', '--size',
|
||||
type=int,
|
||||
metavar = 'px',
|
||||
nargs='?',
|
||||
help='Size of the font in px')
|
||||
parser.add_argument('--bpp',
|
||||
type=int,
|
||||
metavar = '1,2,4',
|
||||
nargs='?',
|
||||
help='Bit per pixel')
|
||||
parser.add_argument('-r', '--range',
|
||||
nargs='+',
|
||||
metavar = 'start-end',
|
||||
default=['0x20-0x7F,0xB0,0x2022'],
|
||||
help='Ranges and/or characters to include. Default is 0x20-7F (ASCII). E.g. -r 0x20-0x7F, 0x200, 324')
|
||||
parser.add_argument('--symbols',
|
||||
nargs='+',
|
||||
metavar = 'sym',
|
||||
default=[''],
|
||||
help=u'Symbols to include. E.g. -s ÁÉŐ'.encode('utf-8'))
|
||||
parser.add_argument('--font',
|
||||
metavar = 'file',
|
||||
nargs='?',
|
||||
default='Montserrat-Medium.ttf',
|
||||
help='A TTF or WOFF file')
|
||||
parser.add_argument('-o', '--output',
|
||||
nargs='?',
|
||||
metavar='file',
|
||||
help='Output file name. E.g. my_font_20.c')
|
||||
parser.add_argument('--compressed', action='store_true',
|
||||
help='Compress the bitmaps')
|
||||
parser.add_argument('--subpx', action='store_true',
|
||||
help='3 times wider letters for sub pixel rendering')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.compressed == False:
|
||||
compr = "--no-compress --no-prefilter"
|
||||
else:
|
||||
compr = ""
|
||||
|
||||
if len(args.symbols[0]) != 0:
|
||||
args.symbols[0] = "--symbols " + args.symbols[0]
|
||||
|
||||
subpx = ""
|
||||
if args.subpx: subpx = "--lcd"
|
||||
|
||||
#Built in symbols
|
||||
syms = "61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650"
|
||||
|
||||
#Run the command (Add degree and bullet symbol)
|
||||
cmd = "lv_font_conv {} {} --bpp {} --size {} --font {} -r {} {} --font FontAwesome5-Solid+Brands+Regular.woff -r {} --format lvgl -o {} --force-fast-kern-format".format(subpx, compr, args.bpp, args.size, args.font, args.range[0], args.symbols[0], syms, args.output)
|
||||
os.system(cmd)
|
||||
91
libraries/lvgl/scripts/built_in_font/generate_all.py
Executable file
91
libraries/lvgl/scripts/built_in_font/generate_all.py
Executable file
@@ -0,0 +1,91 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
|
||||
print("Generating 8 px")
|
||||
os.system("./built_in_font_gen.py --size 8 -o lv_font_montserrat_8.c --bpp 4")
|
||||
|
||||
print("\nGenerating 10 px")
|
||||
os.system("./built_in_font_gen.py --size 10 -o lv_font_montserrat_10.c --bpp 4")
|
||||
|
||||
print("\nGenerating 12 px")
|
||||
os.system("./built_in_font_gen.py --size 12 -o lv_font_montserrat_12.c --bpp 4")
|
||||
|
||||
print("\nGenerating 14 px")
|
||||
os.system("./built_in_font_gen.py --size 14 -o lv_font_montserrat_14.c --bpp 4")
|
||||
|
||||
print("\nGenerating 16 px")
|
||||
os.system("./built_in_font_gen.py --size 16 -o lv_font_montserrat_16.c --bpp 4")
|
||||
|
||||
print("\nGenerating 18 px")
|
||||
os.system("./built_in_font_gen.py --size 18 -o lv_font_montserrat_18.c --bpp 4")
|
||||
|
||||
print("\nGenerating 20 px")
|
||||
os.system("./built_in_font_gen.py --size 20 -o lv_font_montserrat_20.c --bpp 4")
|
||||
|
||||
print("\nGenerating 22 px")
|
||||
os.system("./built_in_font_gen.py --size 22 -o lv_font_montserrat_22.c --bpp 4")
|
||||
|
||||
print("\nGenerating 24 px")
|
||||
os.system("./built_in_font_gen.py --size 24 -o lv_font_montserrat_24.c --bpp 4")
|
||||
|
||||
print("\nGenerating 26 px")
|
||||
os.system("./built_in_font_gen.py --size 26 -o lv_font_montserrat_26.c --bpp 4")
|
||||
|
||||
print("\nGenerating 28 px")
|
||||
os.system("./built_in_font_gen.py --size 28 -o lv_font_montserrat_28.c --bpp 4")
|
||||
|
||||
print("\nGenerating 30 px")
|
||||
os.system("./built_in_font_gen.py --size 30 -o lv_font_montserrat_30.c --bpp 4")
|
||||
|
||||
print("\nGenerating 32 px")
|
||||
os.system("./built_in_font_gen.py --size 32 -o lv_font_montserrat_32.c --bpp 4")
|
||||
|
||||
print("\nGenerating 34 px")
|
||||
os.system("./built_in_font_gen.py --size 34 -o lv_font_montserrat_34.c --bpp 4")
|
||||
|
||||
print("\nGenerating 36 px")
|
||||
os.system("./built_in_font_gen.py --size 36 -o lv_font_montserrat_36.c --bpp 4")
|
||||
|
||||
print("\nGenerating 38 px")
|
||||
os.system("./built_in_font_gen.py --size 38 -o lv_font_montserrat_38.c --bpp 4")
|
||||
|
||||
print("\nGenerating 40 px")
|
||||
os.system("./built_in_font_gen.py --size 40 -o lv_font_montserrat_40.c --bpp 4")
|
||||
|
||||
print("\nGenerating 42 px")
|
||||
os.system("./built_in_font_gen.py --size 42 -o lv_font_montserrat_42.c --bpp 4")
|
||||
|
||||
print("\nGenerating 44 px")
|
||||
os.system("./built_in_font_gen.py --size 44 -o lv_font_montserrat_44.c --bpp 4")
|
||||
|
||||
print("\nGenerating 46 px")
|
||||
os.system("./built_in_font_gen.py --size 46 -o lv_font_montserrat_46.c --bpp 4")
|
||||
|
||||
print("\nGenerating 48 px")
|
||||
os.system("./built_in_font_gen.py --size 48 -o lv_font_montserrat_48.c --bpp 4")
|
||||
|
||||
print("\nGenerating 12 px subpx")
|
||||
os.system("./built_in_font_gen.py --size 12 -o lv_font_montserrat_12_subpx.c --bpp 4 --subpx")
|
||||
|
||||
print("\nGenerating 28 px compressed")
|
||||
os.system("./built_in_font_gen.py --size 28 -o lv_font_montserrat_28_compressed.c --bpp 4 --compressed")
|
||||
|
||||
print("\nGenerating 16 px Hebrew, Persian")
|
||||
os.system("./built_in_font_gen.py --size 16 -o lv_font_dejavu_16_persian_hebrew.c --bpp 4 --font DejaVuSans.ttf -r 0x20-0x7f,0x5d0-0x5ea,0x600-0x6FF,0xFB50-0xFDFF,0xFE70-0xFEFF")
|
||||
|
||||
print("\nGenerating 14 px CJK")
|
||||
os.system(u"./built_in_font_gen.py --size 14 -o lv_font_simsun_14_cjk.c --bpp 4 --font SimSun.woff -r 0x20-0x7f --symbols (),盗提陽帯鼻画輕ッ冊ェル写父ぁフ結想正四O夫源庭場天續鳥れ講猿苦階給了製守8祝己妳薄泣塩帰ぺ吃変輪那着仍嗯爭熱創味保字宿捨準查達肯ァ薬得査障該降察ね網加昼料等図邪秋コ態品屬久原殊候路願楽確針上被怕悲風份重歡っ附ぷ既4黨價娘朝凍僅際洋止右航よ专角應酸師個比則響健昇豐筆歷適修據細忙跟管長令家ザ期般花越ミ域泳通些油乏ラ。營ス返調農叫樹刊愛間包知把ヤ貧橋拡普聞前ジ建当繰ネ送習渇用補ィ覺體法遊宙ョ酔余利壊語くつ払皆時辺追奇そ們只胸械勝住全沈力光ん深溝二類北面社值試9和五勵ゃ貿幾逐打課ゲて領3鼓辦発評1渉詳暇込计駄供嘛郵頃腦反構絵お容規借身妻国慮剛急乗静必議置克土オ乎荷更肉還混古渡授合主離條値決季晴東大尚央州が嗎験流先医亦林田星晩拿60旅婦量為痛テ孫う環友況玩務其ぼち揺坐一肩腰犯タょ希即果ぶ物練待み高九找やヶ都グ去」サ、气仮雑酒許終企笑録形リ銀切ギ快問滿役単黄集森毎實研喜蘇司鉛洲川条媽ノ才兩話言雖媒出客づ卻現異故り誌逮同訊已視本題ぞを横開音第席費持眾怎選元退限ー賽処喝就残無いガ多ケ沒義遠歌隣錢某雪析嬉採自透き側員予ゼ白婚电へ顯呀始均畫似懸格車騒度わ親店週維億締慣免帳電甚來園浴ゅ愈京と杯各海怒ぜ排敗挙老買7極模実紀ヒ携隻告シ並屋這孩讓質ワブ富賃争康由辞マ火於短樣削弟材注節另室ダ招擁ぃ若套底波行勤關著泊背疲狭作念推ぐ民貸祖介說ビ代温契你我レ入描變再札ソ派頭智遅私聽舉灣山伸放直安ト誕煙付符幅ふ絡她届耳飲忘参革團仕様載ど歩獲嫌息の汚交興魚指資雙與館初学年幸史位柱族走括び考青也共腕Lで販擔理病イ今逃當寺猫邊菓係ム秘示解池影ド文例斷曾事茶寫明科桃藝売便え導禁財飛替而亡到し具空寝辛業ウ府セ國何基菜厳市努張缺雲根外だ断万砂ゴ超使台实ぽ礼最慧算軟界段律像夕丈窓助刻月夏政呼ぴざ擇趣除動従涼方勉名線対存請子氏將5少否諸論美感或西者定食御表は參歳緑命進易性錯房も捕皿判中觀戦ニ緩町ピ番ず金千ろ?不た象治関ャ每看徒卒統じ手範訪押座步号ベ旁以母すほ密減成往歲件緒読歯效院种七謂凝濃嵌震喉繼クュ拭死円2積水欲如ポにさ寒道區精啦姐ア聯能足及停思壓2春且メ裏株官答概黒過氷柿戻厚ぱ党祭織引計け委暗複誘港バ失下村較続神ぇ尤強秀膝兒来績十書済化服破新廠1紹您情半式產系好教暑早め樂地休協良な哪常要揮周かエ麗境働避護ンツ香夜太見設非改広聲他検求危清彼經未在起葉控靴所差內造寄南望尺換向展備眠點完約ぎ裡分説申童優伝島机須塊日立拉,鉄軽單気信很転識支布数紙此迎受心輸坊モ處「訳三曇兄野顔戰增ナ伊列又髪両有取左毛至困吧昔赤狀相夠整別士経頼然簡ホ会發隨営需脱ヨば接永居冬迫圍甘醫誰部充消連弱宇會咲覚姉麼的増首统帶糖朋術商担移景功育庫曲總劃牛程駅犬報ロ學責因パ嚴八世後平負公げ曜陸專午之閉ぬ談ご災昨冷職悪謝對它近射敢意運船臉局難什産頗!球真記ま但蔵究制機案湖臺ひ害券男留内木驗雨施種特復句末濟キ色訴依せ百型る石牠討呢时任執飯歐宅組傳配小活ゆべ暖ズ漸站素らボ束価チ浅回女片独妹英目從認生違策僕楚ペ米こ掛む爸六状落漢プ投カ校做啊洗声探あ割体項履触々訓技ハ低工映是標速善点人デ口次可廿节宵植树端阳旦腊妇费愚劳动儿军师庆圣诞闰".encode('utf-8'))
|
||||
|
||||
print("\nGenerating 16 px CJK")
|
||||
os.system(u"./built_in_font_gen.py --size 16 -o lv_font_simsun_16_cjk.c --bpp 4 --font SimSun.woff -r 0x20-0x7f --symbols (),盗提陽帯鼻画輕ッ冊ェル写父ぁフ結想正四O夫源庭場天續鳥れ講猿苦階給了製守8祝己妳薄泣塩帰ぺ吃変輪那着仍嗯爭熱創味保字宿捨準查達肯ァ薬得査障該降察ね網加昼料等図邪秋コ態品屬久原殊候路願楽確針上被怕悲風份重歡っ附ぷ既4黨價娘朝凍僅際洋止右航よ专角應酸師個比則響健昇豐筆歷適修據細忙跟管長令家ザ期般花越ミ域泳通些油乏ラ。營ス返調農叫樹刊愛間包知把ヤ貧橋拡普聞前ジ建当繰ネ送習渇用補ィ覺體法遊宙ョ酔余利壊語くつ払皆時辺追奇そ們只胸械勝住全沈力光ん深溝二類北面社值試9和五勵ゃ貿幾逐打課ゲて領3鼓辦発評1渉詳暇込计駄供嘛郵頃腦反構絵お容規借身妻国慮剛急乗静必議置克土オ乎荷更肉還混古渡授合主離條値決季晴東大尚央州が嗎験流先医亦林田星晩拿60旅婦量為痛テ孫う環友況玩務其ぼち揺坐一肩腰犯タょ希即果ぶ物練待み高九找やヶ都グ去」サ、气仮雑酒許終企笑録形リ銀切ギ快問滿役単黄集森毎實研喜蘇司鉛洲川条媽ノ才兩話言雖媒出客づ卻現異故り誌逮同訊已視本題ぞを横開音第席費持眾怎選元退限ー賽処喝就残無いガ多ケ沒義遠歌隣錢某雪析嬉採自透き側員予ゼ白婚电へ顯呀始均畫似懸格車騒度わ親店週維億締慣免帳電甚來園浴ゅ愈京と杯各海怒ぜ排敗挙老買7極模実紀ヒ携隻告シ並屋這孩讓質ワブ富賃争康由辞マ火於短樣削弟材注節另室ダ招擁ぃ若套底波行勤關著泊背疲狭作念推ぐ民貸祖介說ビ代温契你我レ入描變再札ソ派頭智遅私聽舉灣山伸放直安ト誕煙付符幅ふ絡她届耳飲忘参革團仕様載ど歩獲嫌息の汚交興魚指資雙與館初学年幸史位柱族走括び考青也共腕Lで販擔理病イ今逃當寺猫邊菓係ム秘示解池影ド文例斷曾事茶寫明科桃藝売便え導禁財飛替而亡到し具空寝辛業ウ府セ國何基菜厳市努張缺雲根外だ断万砂ゴ超使台实ぽ礼最慧算軟界段律像夕丈窓助刻月夏政呼ぴざ擇趣除動従涼方勉名線対存請子氏將5少否諸論美感或西者定食御表は參歳緑命進易性錯房も捕皿判中觀戦ニ緩町ピ番ず金千ろ?不た象治関ャ每看徒卒統じ手範訪押座步号ベ旁以母すほ密減成往歲件緒読歯效院种七謂凝濃嵌震喉繼クュ拭死円2積水欲如ポにさ寒道區精啦姐ア聯能足及停思壓2春且メ裏株官答概黒過氷柿戻厚ぱ党祭織引計け委暗複誘港バ失下村較続神ぇ尤強秀膝兒来績十書済化服破新廠1紹您情半式產系好教暑早め樂地休協良な哪常要揮周かエ麗境働避護ンツ香夜太見設非改広聲他検求危清彼經未在起葉控靴所差內造寄南望尺換向展備眠點完約ぎ裡分説申童優伝島机須塊日立拉,鉄軽單気信很転識支布数紙此迎受心輸坊モ處「訳三曇兄野顔戰增ナ伊列又髪両有取左毛至困吧昔赤狀相夠整別士経頼然簡ホ会發隨営需脱ヨば接永居冬迫圍甘醫誰部充消連弱宇會咲覚姉麼的増首统帶糖朋術商担移景功育庫曲總劃牛程駅犬報ロ學責因パ嚴八世後平負公げ曜陸專午之閉ぬ談ご災昨冷職悪謝對它近射敢意運船臉局難什産頗!球真記ま但蔵究制機案湖臺ひ害券男留内木驗雨施種特復句末濟キ色訴依せ百型る石牠討呢时任執飯歐宅組傳配小活ゆべ暖ズ漸站素らボ束価チ浅回女片独妹英目從認生違策僕楚ペ米こ掛む爸六状落漢プ投カ校做啊洗声探あ割体項履触々訓技ハ低工映是標速善点人デ口次可廿节宵植树端阳旦腊妇费愚劳动儿军师庆圣诞闰".encode('utf-8'))
|
||||
|
||||
print("\nGenerating 8 px unscii")
|
||||
os.system("lv_font_conv --no-compress --no-prefilter --bpp 1 --size 8 --font unscii-8.ttf -r 0x20-0x7F --format lvgl -o lv_font_unscii_8.c --force-fast-kern-format")
|
||||
|
||||
print("\nGenerating 16 px unscii")
|
||||
os.system("lv_font_conv --no-compress --no-prefilter --bpp 1 --size 16 --font unscii-8.ttf -r 0x20-0x7F --format lvgl -o lv_font_unscii_16.c --force-fast-kern-format")
|
||||
|
||||
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_*.c')
|
||||
os.system('astyle --ignore-exclude-errors --options=../code-format.cfg "lv_font_*.c"')
|
||||
os.system('mv lv_font_*.c ../../src/font/')
|
||||
BIN
libraries/lvgl/scripts/built_in_font/unscii-8.ttf
Normal file
BIN
libraries/lvgl/scripts/built_in_font/unscii-8.ttf
Normal file
Binary file not shown.
122
libraries/lvgl/scripts/changelog-template.hbs
Normal file
122
libraries/lvgl/scripts/changelog-template.hbs
Normal file
@@ -0,0 +1,122 @@
|
||||
{{#each releases}}
|
||||
`{{title}} <{{href}}>`__ {{niceDate}}
|
||||
---------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
Breaking Changes
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
{{#commit-list merges heading='' message='BREAKING CHANGE'}}
|
||||
- .. warning: {{message}} `{{id}} <{{href}}>`__
|
||||
{{/commit-list}}
|
||||
{{#commit-list commits heading='' message='BREAKING CHANGE'}}
|
||||
- .. warning: {{subject}} `{{shorthash}} <{{href}}>`__
|
||||
{{/commit-list}}
|
||||
{{#commit-list fixes heading='' message='BREAKING CHANGE'}}
|
||||
- **{{commit.subject}}** `{{commit.shorthash}} <{{commit.href}}>`__
|
||||
{{/commit-list}}
|
||||
|
||||
Architectural
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
{{#commit-list merges heading='' message='^arch' exclude='BREAKING CHANGE'}}
|
||||
- **{{message}}** `{{id}} <{{href}}>`__
|
||||
{{/commit-list}}
|
||||
{{#commit-list commits heading='' message='^arch' exclude='BREAKING CHANGE'}}
|
||||
- **{{subject}}** `{{shorthash}} <{{href}}>`__
|
||||
{{/commit-list}}
|
||||
{{#commit-list fixes heading='' message='^arch' exclude='BREAKING CHANGE'}}
|
||||
- **{{commit.subject}}** `{{commit.shorthash}} <{{commit.href}}>`__
|
||||
{{/commit-list}}
|
||||
|
||||
New Features
|
||||
~~~~~~~~~~~~
|
||||
|
||||
{{#commit-list merges heading='' message='^feat' exclude='BREAKING CHANGE'}}
|
||||
- **{{message}}** `{{id}} <{{href}}>`__
|
||||
{{/commit-list}}
|
||||
{{#commit-list commits heading='' message='^feat' exclude='BREAKING CHANGE'}}
|
||||
- **{{subject}}** `{{shorthash}} <{{href}}>`__
|
||||
{{/commit-list}}
|
||||
{{#commit-list fixes heading='' message='^feat' exclude='BREAKING CHANGE'}}
|
||||
- **{{commit.subject}}** `{{commit.shorthash}} <{{commit.href}}>`__
|
||||
{{/commit-list}}
|
||||
|
||||
Performance
|
||||
~~~~~~~~~~~
|
||||
|
||||
{{#commit-list merges heading='' message='^perf' exclude='BREAKING CHANGE'}}
|
||||
- **{{message}}** `{{id}} <{{href}}>`__
|
||||
{{/commit-list}}
|
||||
{{#commit-list commits heading='' message='^perf' exclude='BREAKING CHANGE'}}
|
||||
- **{{subject}}** `{{shorthash}} <{{href}}>`__
|
||||
{{/commit-list}}
|
||||
{{#commit-list fixes heading='' message='^perf' exclude='BREAKING CHANGE'}}
|
||||
- **{{commit.subject}}** `{{commit.shorthash}} <{{commit.href}}>`__
|
||||
{{/commit-list}}
|
||||
|
||||
Fixes
|
||||
~~~~~
|
||||
|
||||
{{#commit-list merges heading='' message='^fix' exclude='(^fix conflict|^fix warning|BREAKING CHANGE)'}}
|
||||
- **{{message}}** `{{id}} <{{href}}>`__
|
||||
{{/commit-list}}
|
||||
{{#commit-list commits heading='' message='^fix' exclude='(^fix conflict|^fix warning|BREAKING CHANGE)'}}
|
||||
- **{{subject}}** `{{shorthash}} <{{href}}>`__
|
||||
{{/commit-list}}
|
||||
{{#commit-list fixes heading='' message='^fix' exclude='(^fix conflict|^fix warning|BREAKING CHANGE)'}}
|
||||
- **{{commit.subject}}** `{{commit.shorthash}} <{{commit.href}}>`__
|
||||
{{/commit-list}}
|
||||
|
||||
Examples
|
||||
~~~~~~~~
|
||||
|
||||
{{#commit-list merges heading='' message='^example'}}
|
||||
- **{{message}}** `{{id}} <({{href}})>`__
|
||||
{{/commit-list}}
|
||||
{{#commit-list commits heading='' message='^example'}}
|
||||
- **{{subject}}** `{{shorthash}} <{{href}}>`__
|
||||
{{/commit-list}}
|
||||
{{#commit-list fixes heading='' message='^example'}}
|
||||
- **{{commit.subject}}** `{{commit.shorthash}} <{{commit.href}}>`__
|
||||
{{/commit-list}}
|
||||
|
||||
Docs
|
||||
~~~~
|
||||
|
||||
{{#commit-list merges heading='' message='^docs'}}
|
||||
- **{{message}}** `{{id}} <{{href}}>`__
|
||||
{{/commit-list}}
|
||||
{{#commit-list commits heading='' message='^docs'}}
|
||||
- **{{subject}}** `{{shorthash}} <{{href}}>`__
|
||||
{{/commit-list}}
|
||||
{{#commit-list fixes heading='' message='^docs'}}
|
||||
- **{{commit.subject}}** `{{commit.shorthash}} <{{commit.href}}>`__
|
||||
{{/commit-list}}
|
||||
|
||||
CI and tests
|
||||
~~~~~~~~~~~~
|
||||
|
||||
{{#commit-list merges heading='' message='(^ci|^test)'}}
|
||||
- **{{message}}** `{{id}} <{{href}}>`__
|
||||
{{/commit-list}}
|
||||
{{#commit-list commits heading='' message='(^ci|^test)'}}
|
||||
- **{{subject}}** `{{shorthash }} <{{href}}>`__
|
||||
{{/commit-list}}
|
||||
{{#commit-list fixes heading='' message='(^ci|^test)'}}
|
||||
- **{{commit.subject}}** `{{commit.shorthash}} <{{commit.href}}>`__
|
||||
{{/commit-list}}
|
||||
|
||||
Others
|
||||
~~~~~~
|
||||
|
||||
{{#commit-list merges heading='' exclude='(^fix|^feat|^perf|^docs|^example|^ci|^test)'}}
|
||||
- **{{message}}** `{{id }} <{{href}}>`__
|
||||
{{/commit-list}}
|
||||
{{#commit-list commits heading='' exclude='(^fix|^feat|^perf|^docs|^example|^ci|^test)'}}
|
||||
- **{{subject}}** `{{shorthash }} <{{href}}>`__
|
||||
{{/commit-list}}
|
||||
{{#commit-list fixes heading='' exclude='(^fix|^feat|^perf|^docs|^example|^ci|^test)'}}
|
||||
- **{{commit.subject}}** `{{commit.shorthash}} <{{commit.href}}>`__
|
||||
{{/commit-list}}
|
||||
|
||||
{{/each}}
|
||||
16
libraries/lvgl/scripts/changelog_gen.sh
Executable file
16
libraries/lvgl/scripts/changelog_gen.sh
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
# Generate CHANGELOG_LAST.md from changes since the last version tag. (vx.y.z-dev tags are ignored)
|
||||
# CHANGELOG_LAST.md can be edited manually if required and manually added to docs/CHANGELOG.md
|
||||
#
|
||||
# Requirements:
|
||||
# npm install -g auto-changelog
|
||||
#
|
||||
# Usage:
|
||||
# changelog-gen <next-version>
|
||||
#
|
||||
# Example: if the latest version is v5.6.7 the following can be used for bugfix, minor or major versions:
|
||||
# changelog-gen v5.6.8
|
||||
# changelog-gen v5.7.0
|
||||
# changelog-gen v6.0.0
|
||||
|
||||
auto-changelog -t changelog-template.hbs -l false --latest-version $1 --unreleased-only --tag-pattern ^v[0-9]+.[0-9]+.[0-9]+$ -o CHANGELOG_LAST.rst
|
||||
51
libraries/lvgl/scripts/code-format.cfg
Normal file
51
libraries/lvgl/scripts/code-format.cfg
Normal file
@@ -0,0 +1,51 @@
|
||||
--style=kr
|
||||
--indent=spaces=4
|
||||
--indent-classes
|
||||
--indent-switches
|
||||
--indent-cases
|
||||
--indent-preproc-block
|
||||
--indent-preproc-define
|
||||
--indent-col1-comments
|
||||
--pad-oper
|
||||
--unpad-paren
|
||||
--align-pointer=middle
|
||||
--align-reference=middle
|
||||
--convert-tabs
|
||||
--max-code-length=120
|
||||
--break-after-logical
|
||||
--break-closing-braces
|
||||
--attach-closing-while
|
||||
--min-conditional-indent=0
|
||||
--max-continuation-indent=120
|
||||
--mode=c
|
||||
--lineend=linux
|
||||
--suffix=none
|
||||
--preserve-date
|
||||
--formatted
|
||||
--ignore-exclude-errors
|
||||
--ignore-exclude-errors-x
|
||||
--exclude=assets
|
||||
--exclude=test_assets
|
||||
--exclude=test_fonts
|
||||
--exclude=../src/lv_conf_internal.h
|
||||
--exclude=../src/core/lv_obj_style_gen.c
|
||||
--exclude=../src/core/lv_obj_style_gen.h
|
||||
--exclude=../src/libs/gif/gifdec.c
|
||||
--exclude=../src/libs/gif/gifdec.h
|
||||
--exclude=../src/libs/lodepng/lodepng.c
|
||||
--exclude=../src/libs/lodepng/lodepng.h
|
||||
--exclude=../src/libs/qrcode/qrcodegen.c
|
||||
--exclude=../src/libs/qrcode/qrcodegen.h
|
||||
--exclude=../src/libs/tjpgd/tjpgd.c
|
||||
--exclude=../src/libs/tjpgd/tjpgd.h
|
||||
--exclude=../src/libs/tjpgd/tjpgdcnf.h
|
||||
--exclude=../src/libs/thorvg
|
||||
--exclude=../src/libs/lz4
|
||||
--exclude=../src/others/vg_lite_tvg/vg_lite.h
|
||||
--exclude=../tests/unity/unity.c
|
||||
--exclude=../tests/unity/unity_internals.h
|
||||
--exclude=../tests/unity/unity_support.c
|
||||
--exclude=../tests/unity/unity_support.h
|
||||
--exclude=../tests/test_images
|
||||
--exclude=../tests/build_test_defheap
|
||||
--exclude=../tests/build_test_sysheap
|
||||
19
libraries/lvgl/scripts/code-format.py
Executable file
19
libraries/lvgl/scripts/code-format.py
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
|
||||
script_dir = os.path.realpath(__file__)
|
||||
script_dir = os.path.dirname(script_dir)
|
||||
cfg_file = os.path.join(script_dir, 'code-format.cfg')
|
||||
|
||||
print("\nFormatting demos")
|
||||
os.system(f'astyle --options={cfg_file} --recursive "{script_dir}/../demos/*.c,*.cpp,*.h"')
|
||||
|
||||
print("\nFormatting examples")
|
||||
os.system(f'astyle --options={cfg_file} --recursive "{script_dir}/../examples/*.c,*.cpp,*.h"')
|
||||
|
||||
print("Formatting src")
|
||||
os.system(f'astyle --options={cfg_file} --recursive "{script_dir}/../src/*.c,*.cpp,*.h"')
|
||||
|
||||
print("\nFormatting tests")
|
||||
os.system(f'astyle --options={cfg_file} --recursive "{script_dir}/../tests/*.c,*.cpp,*.h"')
|
||||
3
libraries/lvgl/scripts/cppcheck_run.sh
Executable file
3
libraries/lvgl/scripts/cppcheck_run.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
cppcheck -j8 --template="{severity}\t{file}:{line}\t{id}: {message}" --enable=all ../src/ --output-file=cppcheck_res.txt --suppress=unusedFunction --suppress=preprocessorErrorDirective --force
|
||||
11
libraries/lvgl/scripts/filetohex.py
Executable file
11
libraries/lvgl/scripts/filetohex.py
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env python3
|
||||
import sys
|
||||
|
||||
with open(sys.argv[1], 'r') as file:
|
||||
s = file.read()
|
||||
|
||||
b = bytearray()
|
||||
b.extend(map(ord, s))
|
||||
|
||||
for a in b: print(hex(a), end =", ")
|
||||
|
||||
4
libraries/lvgl/scripts/find_version.sh
Executable file
4
libraries/lvgl/scripts/find_version.sh
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 || exit ; pwd -P )"
|
||||
sed -n '/LVGL_VERSION_MAJOR/ {N;s@#define \+LVGL_VERSION_M.... \+@@g;s@\n@.@p}' "$SCRIPTPATH/../lv_version.h"
|
||||
172
libraries/lvgl/scripts/gen_json/create_fake_lib_c.py
Normal file
172
libraries/lvgl/scripts/gen_json/create_fake_lib_c.py
Normal file
File diff suppressed because one or more lines are too long
378
libraries/lvgl/scripts/gen_json/gen_json.py
Normal file
378
libraries/lvgl/scripts/gen_json/gen_json.py
Normal file
@@ -0,0 +1,378 @@
|
||||
import os
|
||||
import sys
|
||||
import argparse
|
||||
import shutil
|
||||
import tempfile
|
||||
import json
|
||||
import subprocess
|
||||
import threading
|
||||
|
||||
base_path = os.path.abspath(os.path.dirname(__file__))
|
||||
sys.path.insert(0, base_path)
|
||||
|
||||
project_path = os.path.abspath(os.path.join(base_path, '..', '..'))
|
||||
docs_path = os.path.join(project_path, 'docs')
|
||||
sys.path.insert(0, docs_path)
|
||||
|
||||
import create_fake_lib_c # NOQA
|
||||
import pycparser_monkeypatch # NOQA
|
||||
import pycparser # NOQA
|
||||
|
||||
DEVELOP = False
|
||||
|
||||
|
||||
class STDOut:
|
||||
def __init__(self):
|
||||
self._stdout = sys.stdout
|
||||
sys.__stdout__ = self
|
||||
sys.stdout = self
|
||||
|
||||
def write(self, data):
|
||||
pass
|
||||
|
||||
def __getattr__(self, item):
|
||||
if item in self.__dict__:
|
||||
return self.__dict__[item]
|
||||
|
||||
return getattr(self._stdout, item)
|
||||
|
||||
def reset(self):
|
||||
sys.stdout = self._stdout
|
||||
|
||||
|
||||
temp_directory = tempfile.mkdtemp(suffix='.lvgl_json')
|
||||
|
||||
|
||||
def run(output_path, lvgl_config_path, output_to_stdout, target_header, filter_private, *compiler_args):
|
||||
# stdout = STDOut()
|
||||
|
||||
pycparser_monkeypatch.FILTER_PRIVATE = filter_private
|
||||
|
||||
# The thread is to provide an indication that things are being processed.
|
||||
# There are long periods where nothing gets output to the screen and this
|
||||
# is to let the user know that it is still working.
|
||||
if not output_to_stdout:
|
||||
event = threading.Event()
|
||||
|
||||
def _do():
|
||||
while not event.is_set():
|
||||
event.wait(1)
|
||||
sys.stdout.write('.')
|
||||
sys.stdout.flush()
|
||||
|
||||
print()
|
||||
|
||||
t = threading.Thread(target=_do)
|
||||
t.daemon = True
|
||||
t.start()
|
||||
|
||||
lvgl_path = project_path
|
||||
lvgl_src_path = os.path.join(lvgl_path, 'src')
|
||||
temp_lvgl = os.path.join(temp_directory, 'lvgl')
|
||||
target_header_base_name = (
|
||||
os.path.splitext(os.path.split(target_header)[-1])[0]
|
||||
)
|
||||
|
||||
try:
|
||||
os.mkdir(temp_lvgl)
|
||||
shutil.copytree(lvgl_src_path, os.path.join(temp_lvgl, 'src'))
|
||||
shutil.copyfile(os.path.join(lvgl_path, 'lvgl.h'), os.path.join(temp_lvgl, 'lvgl.h'))
|
||||
|
||||
pp_file = os.path.join(temp_directory, target_header_base_name + '.pp')
|
||||
|
||||
if lvgl_config_path is None:
|
||||
lvgl_config_path = os.path.join(lvgl_path, 'lv_conf_template.h')
|
||||
|
||||
with open(lvgl_config_path, 'rb') as f:
|
||||
data = f.read().decode('utf-8').split('\n')
|
||||
|
||||
for i, line in enumerate(data):
|
||||
if line.startswith('#if 0'):
|
||||
data[i] = '#if 1'
|
||||
else:
|
||||
for item in (
|
||||
'LV_USE_LOG',
|
||||
'LV_USE_OBJ_ID',
|
||||
'LV_USE_OBJ_ID_BUILTIN',
|
||||
'LV_USE_FLOAT',
|
||||
'LV_USE_BIDI',
|
||||
'LV_USE_LODEPNG',
|
||||
'LV_USE_LIBPNG',
|
||||
'LV_USE_BMP',
|
||||
'LV_USE_TJPGD',
|
||||
'LV_USE_LIBJPEG_TURBO',
|
||||
'LV_USE_GIF',
|
||||
'LV_BIN_DECODER_RAM_LOAD',
|
||||
'LV_USE_RLE',
|
||||
'LV_USE_QRCODE',
|
||||
'LV_USE_BARCODE',
|
||||
'LV_USE_TINY_TTF',
|
||||
'LV_USE_GRIDNAV',
|
||||
'LV_USE_FRAGMENT',
|
||||
'LV_USE_IMGFONT',
|
||||
'LV_USE_SNAPSHOT',
|
||||
'LV_USE_FREETYPE'
|
||||
):
|
||||
if line.startswith(f'#define {item} '):
|
||||
data[i] = f'#define {item} 1'
|
||||
break
|
||||
|
||||
with open(os.path.join(temp_directory, 'lv_conf.h'), 'wb') as f:
|
||||
f.write('\n'.join(data).encode('utf-8'))
|
||||
else:
|
||||
src = lvgl_config_path
|
||||
dst = os.path.join(temp_directory, 'lv_conf.h')
|
||||
shutil.copyfile(src, dst)
|
||||
|
||||
include_dirs = [temp_directory, project_path]
|
||||
|
||||
if sys.platform.startswith('win'):
|
||||
import get_sdl2
|
||||
|
||||
try:
|
||||
import pyMSVC # NOQA
|
||||
except ImportError:
|
||||
sys.stderr.write(
|
||||
'\nThe pyMSVC library is missing, '
|
||||
'please run "pip install pyMSVC" to install it.\n'
|
||||
)
|
||||
sys.stderr.flush()
|
||||
sys.exit(-500)
|
||||
|
||||
env = pyMSVC.setup_environment() # NOQA
|
||||
cpp_cmd = ['cl', '/std:c11', '/nologo', '/P']
|
||||
output_pp = f'/Fi"{pp_file}"'
|
||||
sdl2_include, _ = get_sdl2.get_sdl2(temp_directory)
|
||||
include_dirs.append(sdl2_include)
|
||||
include_path_env_key = 'INCLUDE'
|
||||
|
||||
elif sys.platform.startswith('darwin'):
|
||||
include_path_env_key = 'C_INCLUDE_PATH'
|
||||
cpp_cmd = [
|
||||
'clang', '-std=c11', '-E', '-DINT32_MIN=0x80000000',
|
||||
]
|
||||
output_pp = f' >> "{pp_file}"'
|
||||
else:
|
||||
include_path_env_key = 'C_INCLUDE_PATH'
|
||||
cpp_cmd = [
|
||||
'gcc', '-std=c11', '-E', '-Wno-incompatible-pointer-types',
|
||||
]
|
||||
output_pp = f' >> "{pp_file}"'
|
||||
|
||||
fake_libc_path = create_fake_lib_c.run(temp_directory)
|
||||
|
||||
if include_path_env_key not in os.environ:
|
||||
os.environ[include_path_env_key] = ''
|
||||
|
||||
os.environ[include_path_env_key] = (
|
||||
f'{fake_libc_path}{os.pathsep}{os.environ[include_path_env_key]}'
|
||||
)
|
||||
|
||||
if 'PATH' not in os.environ:
|
||||
os.environ['PATH'] = ''
|
||||
|
||||
os.environ['PATH'] = (
|
||||
f'{fake_libc_path}{os.pathsep}{os.environ["PATH"]}'
|
||||
)
|
||||
|
||||
cpp_cmd.extend(compiler_args)
|
||||
cpp_cmd.extend([
|
||||
'-DLV_LVGL_H_INCLUDE_SIMPLE',
|
||||
'-DLV_CONF_INCLUDE_SIMPLE',
|
||||
'-DLV_USE_DEV_VERSION'
|
||||
])
|
||||
|
||||
cpp_cmd.extend(['-DPYCPARSER', f'"-I{fake_libc_path}"'])
|
||||
cpp_cmd.extend([f'"-I{item}"' for item in include_dirs])
|
||||
cpp_cmd.append(f'"{target_header}"')
|
||||
|
||||
if sys.platform.startswith('win'):
|
||||
cpp_cmd.insert(len(cpp_cmd) - 2, output_pp)
|
||||
else:
|
||||
cpp_cmd.append(output_pp)
|
||||
|
||||
cpp_cmd = ' '.join(cpp_cmd)
|
||||
|
||||
p = subprocess.Popen(
|
||||
cpp_cmd,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
env=os.environ,
|
||||
shell=True
|
||||
)
|
||||
out, err = p.communicate()
|
||||
exit_code = p.returncode
|
||||
|
||||
if not os.path.exists(pp_file):
|
||||
sys.stdout.write(out.decode('utf-8').strip() + '\n')
|
||||
sys.stdout.write('EXIT CODE: ' + str(exit_code) + '\n')
|
||||
sys.stderr.write(err.decode('utf-8').strip() + '\n')
|
||||
sys.stdout.flush()
|
||||
sys.stderr.flush()
|
||||
|
||||
raise RuntimeError('Unknown Failure')
|
||||
|
||||
with open(pp_file, 'r') as f:
|
||||
pp_data = f.read()
|
||||
|
||||
cparser = pycparser.CParser()
|
||||
ast = cparser.parse(pp_data, target_header)
|
||||
|
||||
ast.setup_docs(temp_directory)
|
||||
|
||||
if not output_to_stdout and output_path is None:
|
||||
# stdout.reset()
|
||||
|
||||
if not DEVELOP:
|
||||
shutil.rmtree(temp_directory)
|
||||
|
||||
return ast
|
||||
|
||||
elif output_to_stdout:
|
||||
# stdout.reset()
|
||||
print(json.dumps(ast.to_dict(), indent=4))
|
||||
else:
|
||||
if not os.path.exists(output_path):
|
||||
os.makedirs(output_path)
|
||||
|
||||
output_path = os.path.join(output_path, target_header_base_name + '.json')
|
||||
|
||||
with open(output_path, 'w') as f:
|
||||
f.write(json.dumps(ast.to_dict(), indent=4))
|
||||
|
||||
# stdout.reset()
|
||||
|
||||
if not output_to_stdout:
|
||||
event.set() # NOQA
|
||||
t.join() # NOQA
|
||||
except Exception as err:
|
||||
if not output_to_stdout:
|
||||
event.set() # NOQA
|
||||
t.join() # NOQA
|
||||
|
||||
print()
|
||||
try:
|
||||
print(cpp_cmd) # NOQA
|
||||
print()
|
||||
except: # NOQA
|
||||
pass
|
||||
|
||||
for key, value in os.environ.items():
|
||||
print(key + ':', value)
|
||||
|
||||
print()
|
||||
import traceback
|
||||
|
||||
traceback.print_exc()
|
||||
print()
|
||||
|
||||
exceptions = [
|
||||
ArithmeticError,
|
||||
AssertionError,
|
||||
AttributeError,
|
||||
EOFError,
|
||||
FloatingPointError,
|
||||
GeneratorExit,
|
||||
ImportError,
|
||||
IndentationError,
|
||||
IndexError,
|
||||
KeyError,
|
||||
KeyboardInterrupt,
|
||||
LookupError,
|
||||
MemoryError,
|
||||
NameError,
|
||||
NotImplementedError,
|
||||
OverflowError,
|
||||
ReferenceError,
|
||||
RuntimeError,
|
||||
StopIteration,
|
||||
SyntaxError,
|
||||
TabError,
|
||||
SystemExit,
|
||||
TypeError,
|
||||
UnboundLocalError,
|
||||
UnicodeError,
|
||||
UnicodeEncodeError,
|
||||
UnicodeDecodeError,
|
||||
UnicodeTranslateError,
|
||||
ValueError,
|
||||
ZeroDivisionError,
|
||||
SystemError
|
||||
]
|
||||
|
||||
if isinstance(err, OSError):
|
||||
error = err.errno
|
||||
else:
|
||||
if type(err) in exceptions:
|
||||
error = ~exceptions.index(type(err))
|
||||
else:
|
||||
error = -100
|
||||
else:
|
||||
error = 0
|
||||
|
||||
if DEVELOP:
|
||||
print('temporary file path:', temp_directory)
|
||||
else:
|
||||
shutil.rmtree(temp_directory)
|
||||
|
||||
sys.exit(error)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser('-')
|
||||
parser.add_argument(
|
||||
'--output-path',
|
||||
dest='output_path',
|
||||
help=(
|
||||
'output directory for JSON file. If one is not '
|
||||
'supplied then it will be output stdout'
|
||||
),
|
||||
action='store',
|
||||
default=None
|
||||
)
|
||||
parser.add_argument(
|
||||
'--lvgl-config',
|
||||
dest='lv_conf',
|
||||
help=(
|
||||
'path to lv_conf.h (including file name), if this is not set then '
|
||||
'a config file will be generated that has everything turned on.'
|
||||
),
|
||||
action='store',
|
||||
default=None
|
||||
)
|
||||
parser.add_argument(
|
||||
'--develop',
|
||||
dest='develop',
|
||||
help='this option leaves the temporary folder in place.',
|
||||
action='store_true',
|
||||
)
|
||||
parser.add_argument(
|
||||
"--target-header",
|
||||
dest="target_header",
|
||||
help=(
|
||||
"path to a custom header file. When using this to supply a custom"
|
||||
"header file you MUST insure that any LVGL includes are done so "
|
||||
"they are relitive to the LVGL repository root folder.\n\n"
|
||||
'#include "src/lvgl_private.h"\n\n'
|
||||
"If you have includes to header files that are not LVGL then you "
|
||||
"will need to add the include locations for those header files "
|
||||
"when running this script. It is done using the same manner that "
|
||||
"is used when calling a C compiler\n\n"
|
||||
"You need to provide the absolute path to the header file when "
|
||||
"using this feature."
|
||||
),
|
||||
action="store",
|
||||
default=os.path.join(temp_directory, "lvgl", "lvgl.h")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--filter-private',
|
||||
dest='filter_private',
|
||||
help='Internal Use',
|
||||
action='store_true',
|
||||
)
|
||||
|
||||
args, extra_args = parser.parse_known_args()
|
||||
|
||||
DEVELOP = args.develop
|
||||
|
||||
run(args.output_path, args.lv_conf, args.output_path is None, args.target_header, args.filter_private, *extra_args)
|
||||
66
libraries/lvgl/scripts/gen_json/get_sdl2.py
Normal file
66
libraries/lvgl/scripts/gen_json/get_sdl2.py
Normal file
@@ -0,0 +1,66 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import zipfile
|
||||
import io
|
||||
import os
|
||||
|
||||
|
||||
SDL2_URL = 'https://github.com/libsdl-org/SDL/releases/download/release-2.26.5/SDL2-devel-2.26.5-VC.zip' # NOQA
|
||||
|
||||
|
||||
def get_path(name: str, p: str) -> str:
|
||||
for file in os.listdir(p):
|
||||
file = os.path.join(p, file)
|
||||
|
||||
if file.endswith(name):
|
||||
return file
|
||||
|
||||
if os.path.isdir(file):
|
||||
if res := get_path(name, file):
|
||||
return res
|
||||
|
||||
|
||||
def get_sdl2(path, url=SDL2_URL):
|
||||
import requests # NOQA
|
||||
|
||||
stream = io.BytesIO()
|
||||
|
||||
with requests.get(url, stream=True) as r:
|
||||
r.raise_for_status()
|
||||
|
||||
content_length = int(r.headers['Content-Length'])
|
||||
chunks = 0
|
||||
# print()
|
||||
# sys.stdout.write('\r' + str(chunks) + '/' + str(content_length))
|
||||
# sys.stdout.flush()
|
||||
|
||||
for chunk in r.iter_content(chunk_size=1024):
|
||||
stream.write(chunk)
|
||||
chunks += len(chunk)
|
||||
# sys.stdout.write('\r' + str(chunks) + '/' + str(content_length))
|
||||
# sys.stdout.flush()
|
||||
|
||||
# print()
|
||||
stream.seek(0)
|
||||
zf = zipfile.ZipFile(stream)
|
||||
|
||||
for z_item in zf.infolist():
|
||||
for ext in ('.h', '.dll', '.lib'):
|
||||
if not z_item.filename.endswith(ext):
|
||||
continue
|
||||
|
||||
zf.extract(z_item, path=path)
|
||||
break
|
||||
|
||||
include_path = get_path('include', path)
|
||||
lib_path = get_path('lib\\x64', path)
|
||||
dll_path = get_path('SDL2.dll', lib_path)
|
||||
|
||||
sdl_include_path = os.path.split(include_path)[0]
|
||||
if not os.path.exists(os.path.join(sdl_include_path, 'SDL2')):
|
||||
os.rename(include_path, os.path.join(sdl_include_path, 'SDL2'))
|
||||
|
||||
zf.close()
|
||||
stream.close()
|
||||
|
||||
return os.path.abspath(sdl_include_path), dll_path
|
||||
1694
libraries/lvgl/scripts/gen_json/pycparser_monkeypatch.py
Normal file
1694
libraries/lvgl/scripts/gen_json/pycparser_monkeypatch.py
Normal file
File diff suppressed because it is too large
Load Diff
16
libraries/lvgl/scripts/gen_json/requirements.txt
Normal file
16
libraries/lvgl/scripts/gen_json/requirements.txt
Normal file
@@ -0,0 +1,16 @@
|
||||
pycparser>=2.22
|
||||
pyMSVC>=0.5.3; platform_system == "Windows"
|
||||
Sphinx
|
||||
breathe
|
||||
imagesize
|
||||
importlib-metadata
|
||||
sphinx-rtd-theme
|
||||
sphinx-sitemap
|
||||
sphinxcontrib-applehelp
|
||||
sphinxcontrib-devhelp
|
||||
sphinxcontrib-htmlhelp
|
||||
sphinxcontrib-jsmath
|
||||
sphinxcontrib-qthelp
|
||||
sphinxcontrib-serializinghtml
|
||||
sphinx-rtd-dark-mode
|
||||
typing-extensions
|
||||
121
libraries/lvgl/scripts/generate_lv_conf.py
Executable file
121
libraries/lvgl/scripts/generate_lv_conf.py
Executable file
@@ -0,0 +1,121 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import re
|
||||
import argparse
|
||||
|
||||
DIR_SCRIPTS = os.path.dirname(__file__)
|
||||
REPO_ROOT = os.path.join(DIR_SCRIPTS, "..")
|
||||
DIR_CWD = os.getcwd()
|
||||
|
||||
|
||||
def fatal(msg):
|
||||
print()
|
||||
print("ERROR! " + msg)
|
||||
exit(1)
|
||||
|
||||
|
||||
def get_args():
|
||||
parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter, description=""
|
||||
"Update the configuration file of your existing project based on default parameters and latest LVGL template. Eg.:\n"
|
||||
" python3 generate_lv_conf.py ./src \n"
|
||||
" python3 generate_lv_conf.py --template modules/lvgl/lv_conf_template.h ./my_config_folder"
|
||||
)
|
||||
|
||||
parser.add_argument('--template', type=str, default=REPO_ROOT, nargs='?',
|
||||
help='Path of "lv_conf_template.h" file or the folder containing it\n(optional, 1 folder above the python script by default)')
|
||||
|
||||
parser.add_argument('--config', type=str, default=None, nargs='?',
|
||||
help='Path of "lv_conf.h" file (optional)')
|
||||
|
||||
parser.add_argument('--defaults', type=str, default=None, nargs='?',
|
||||
help='Path of "lv_conf.defaults" file (optional)')
|
||||
|
||||
parser.add_argument('target', metavar='target', type=str, default=DIR_CWD, nargs='?',
|
||||
help='Folder containing "lv_conf.h" and "lv_conf.defaults" files\n(optional, current work folder by default)')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
if os.path.isdir(args.template):
|
||||
args.template = os.path.join(args.template, "lv_conf_template.h")
|
||||
|
||||
if not args.config:
|
||||
args.config = os.path.join(args.target, "lv_conf.h")
|
||||
|
||||
if not args.defaults:
|
||||
args.defaults = os.path.join(args.target, "lv_conf.defaults")
|
||||
|
||||
if not os.path.exists(args.template):
|
||||
fatal(f"Template file not found at {args.template}")
|
||||
if not os.path.exists(args.config):
|
||||
fatal(f"User config file not found at {args.config}")
|
||||
if not os.path.exists(args.defaults):
|
||||
fatal(f"User defaults not found at {args.defaults}")
|
||||
|
||||
return args
|
||||
|
||||
|
||||
def parse_defaults(path: str):
|
||||
defaults = {}
|
||||
|
||||
with open(path, 'r', encoding='utf-8') as file:
|
||||
for line in file.readlines():
|
||||
if len(line.strip()) == 0 or line.startswith('#'):
|
||||
continue
|
||||
groups = re.search(r'([A-Z0-9_]+)\s+(.+)', line).groups()
|
||||
defaults[groups[0]] = groups[1]
|
||||
|
||||
return defaults
|
||||
|
||||
|
||||
def generate_config(path_destination: str, path_source: str, defaults: dict):
|
||||
with open(path_source, 'r', encoding='utf-8') as f_src:
|
||||
src_lines = f_src.readlines()
|
||||
|
||||
keys_used = set()
|
||||
dst_lines = []
|
||||
|
||||
for src_line in src_lines:
|
||||
res = re.search(r'#define\s+([A-Z0-9_]+)\s+(.+)', src_line)
|
||||
key = res.groups()[0] if res else None
|
||||
|
||||
if key in defaults.keys():
|
||||
value = defaults[key]
|
||||
pattern = r'(#define\s+[A-Z0-9_]+\s+)(.+)'
|
||||
repl = r'\g<1>' + value
|
||||
dst_line, _ = re.subn(pattern, repl, src_line)
|
||||
|
||||
if not dst_line:
|
||||
fatal(f"Failed to apply key '{key}' to line '{src_line}'")
|
||||
|
||||
print(f"Applying: {key} = {value}")
|
||||
keys_used.add(key)
|
||||
elif 'Set it to "1" to enable content' in src_line:
|
||||
dst_line = '#if 1 /*Content enable*/'
|
||||
else:
|
||||
dst_line = src_line
|
||||
|
||||
dst_lines.append(dst_line)
|
||||
|
||||
if len(keys_used) != len(defaults):
|
||||
unused_keys = [k for k in defaults.keys() if k not in keys_used]
|
||||
fatal('The following keys are deprecated:\n ' + '\n '.join(unused_keys))
|
||||
|
||||
with open(path_destination, 'w', encoding='utf-8') as f_dst:
|
||||
for dst_line in dst_lines:
|
||||
f_dst.write(dst_line)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
args = get_args()
|
||||
|
||||
print("Template:", args.template)
|
||||
print("User config:", args.config)
|
||||
print("User defaults:", args.defaults)
|
||||
|
||||
defaults = parse_defaults(args.defaults)
|
||||
print(f"Loaded {len(defaults)} defaults")
|
||||
|
||||
generate_config(args.config, args.template, defaults)
|
||||
print()
|
||||
print('New config successfully generated!')
|
||||
15
libraries/lvgl/scripts/genexamplelist.sh
Executable file
15
libraries/lvgl/scripts/genexamplelist.sh
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
echo "/* Autogenerated */"
|
||||
echo '#include <stddef.h>'
|
||||
echo '#include "examplelist.h"'
|
||||
TMPFILE=$(mktemp)
|
||||
find examples demos -name \*.h | xargs grep -hE "^void lv_(example|demo)" | sed 's/(/ /g' | awk '{print $2}' > $TMPFILE
|
||||
cat $TMPFILE | while read -r line; do
|
||||
echo "extern void ${line}(void);"
|
||||
done
|
||||
echo "const struct lv_ci_example lv_ci_example_list[] = {"
|
||||
cat $TMPFILE | while read -r line; do
|
||||
echo " { \"$line\", $line },";
|
||||
done
|
||||
echo " { NULL, NULL }"
|
||||
echo "};"
|
||||
31
libraries/lvgl/scripts/image_viewer.py
Executable file
31
libraries/lvgl/scripts/image_viewer.py
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env python3
|
||||
from LVGLImage import LVGLImage
|
||||
import argparse
|
||||
import logging
|
||||
import os
|
||||
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
|
||||
parser = argparse.ArgumentParser(description="LVGL Binary Image Viewer")
|
||||
parser.add_argument("file", help="the .bin image file")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
name, ext = os.path.splitext(args.file)
|
||||
if ext != ".bin":
|
||||
raise ValueError("Only support LVGL .bin image file")
|
||||
|
||||
output = name + ".png"
|
||||
img = LVGLImage().from_bin(args.file)
|
||||
img.to_png(output)
|
||||
logging.info(f"convert {args.file} to {output}")
|
||||
|
||||
if os.name == "posix":
|
||||
os.system(f"open {output}")
|
||||
else:
|
||||
try:
|
||||
from PIL import Image
|
||||
except ImportError:
|
||||
raise ImportError("Need pillow package, do `pip3 install pillow`")
|
||||
image = Image.open(output)
|
||||
image.show(title=output)
|
||||
10
libraries/lvgl/scripts/infer_run.sh
Executable file
10
libraries/lvgl/scripts/infer_run.sh
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# https://github.com/facebook/infer
|
||||
#
|
||||
# Install:
|
||||
# VERSION=0.17.0; \
|
||||
# curl -sSL "https://github.com/facebook/infer/releases/download/v$VERSION/infer-linux64-v$VERSION.tar.xz" \
|
||||
# | sudo tar -C /opt -xJ && \
|
||||
# sudoln -s "/opt/infer-linux64-v$VERSION/bin/infer" /usr/local/bin/infer
|
||||
|
||||
infer run -- make -j8
|
||||
4
libraries/lvgl/scripts/install-prerequisites.bat
Normal file
4
libraries/lvgl/scripts/install-prerequisites.bat
Normal file
@@ -0,0 +1,4 @@
|
||||
vcpkg install vcpkg-tool-ninja libpng freetype opengl glfw3 glew
|
||||
if %errorlevel% neq 0 exit /b %errorlevel%
|
||||
pip install pypng lz4 kconfiglib
|
||||
if %errorlevel% neq 0 exit /b %errorlevel%
|
||||
17
libraries/lvgl/scripts/install-prerequisites.sh
Executable file
17
libraries/lvgl/scripts/install-prerequisites.sh
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Install Linux package prerequisites needed for LVGL development
|
||||
# and testing. Some less-common development packages are not included
|
||||
# here, such as MicroPython and PC simulator packages.
|
||||
#
|
||||
# Note: This script is run by the CI workflows.
|
||||
sudo dpkg --add-architecture i386
|
||||
sudo apt update
|
||||
sudo apt install gcc gcc-multilib g++-multilib ninja-build \
|
||||
libpng-dev libjpeg-turbo8-dev libfreetype6-dev \
|
||||
libglew-dev libglfw3-dev libsdl2-dev \
|
||||
libpng-dev:i386 libjpeg-dev:i386 libfreetype6-dev:i386 \
|
||||
ruby-full gcovr cmake python3 pngquant libinput-dev libxkbcommon-dev \
|
||||
libdrm-dev pkg-config wayland-protocols libwayland-dev libwayland-bin \
|
||||
libwayland-dev:i386 libxkbcommon-dev:i386
|
||||
pip3 install pypng lz4 kconfiglib
|
||||
16
libraries/lvgl/scripts/install_astyle.sh
Executable file
16
libraries/lvgl/scripts/install_astyle.sh
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Check if the script is being run as root
|
||||
if [ "$(id -u)" -ne 0 ]; then
|
||||
echo "This script must be run as root or with sudo" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm -rf astyle
|
||||
git clone https://github.com/lvgl/astyle.git
|
||||
cd astyle/build/gcc
|
||||
git checkout v3.4.12
|
||||
make -j
|
||||
make install
|
||||
cd ../../..
|
||||
rm -rf astyle
|
||||
140
libraries/lvgl/scripts/jpg_to_sjpg.py
Executable file
140
libraries/lvgl/scripts/jpg_to_sjpg.py
Executable file
@@ -0,0 +1,140 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
##################################################################
|
||||
# sjpeg converter script version 1.0
|
||||
# Dependencies: (PYTHON-3)
|
||||
##################################################################
|
||||
SJPG_FILE_FORMAT_VERSION = "V1.00" #
|
||||
JPEG_SPLIT_HEIGHT = 16
|
||||
##################################################################
|
||||
import math, os, sys, time
|
||||
from PIL import Image
|
||||
|
||||
|
||||
OUTPUT_FILE_NAME = ""
|
||||
INPUT_FILE = ""
|
||||
|
||||
|
||||
if len(sys.argv) == 2:
|
||||
INPUT_FILE = sys.argv[1]
|
||||
OUTPUT_FILE_NAME = INPUT_FILE.split("/")[-1].split("\\")[-1].split(".")[0]
|
||||
else:
|
||||
print("usage:\n\t python " + sys.argv[0] + " input_file.jpg")
|
||||
sys.exit(0)
|
||||
|
||||
try:
|
||||
im = Image.open(INPUT_FILE)
|
||||
except:
|
||||
print("\nFile not found!")
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
print("\nConversion started...\n")
|
||||
start_time = time.time()
|
||||
width, height = im.size
|
||||
|
||||
print("Input:")
|
||||
print("\t" + INPUT_FILE)
|
||||
print("\tRES = " + str(width) + " x " + str(height) + '\n')
|
||||
|
||||
|
||||
lenbuf = []
|
||||
block_size = JPEG_SPLIT_HEIGHT;
|
||||
splits = math.ceil(height/block_size)
|
||||
|
||||
c_code = '''//LVGL SJPG C ARRAY\n#include "lvgl/lvgl.h"\n\nconst uint8_t ''' + OUTPUT_FILE_NAME + '''_map[] = {\n'''
|
||||
|
||||
sjpeg_data = bytearray()
|
||||
sjpeg = bytearray()
|
||||
|
||||
|
||||
row_remaining = height;
|
||||
for i in range(splits):
|
||||
if row_remaining < block_size:
|
||||
crop = im.crop((0, i*block_size, width, row_remaining + i*block_size))
|
||||
else:
|
||||
crop = im.crop((0, i*block_size, width, block_size + i*block_size))
|
||||
|
||||
row_remaining = row_remaining - block_size;
|
||||
crop.save(str(i)+".jpg", quality=90)
|
||||
|
||||
|
||||
|
||||
|
||||
for i in range(splits):
|
||||
f = open(str(i)+".jpg", "rb")
|
||||
a = f.read()
|
||||
f.close()
|
||||
sjpeg_data = sjpeg_data + a
|
||||
lenbuf.append(len(a))
|
||||
|
||||
header = bytearray()
|
||||
|
||||
#4 BYTES
|
||||
header = header + bytearray("_SJPG__".encode("UTF-8"));
|
||||
|
||||
#6 BYTES VERSION
|
||||
header = header + bytearray(("\x00" + SJPG_FILE_FORMAT_VERSION + "\x00").encode("UTF-8"));
|
||||
|
||||
#WIDTH 2 BYTES
|
||||
header = header + width.to_bytes(2, byteorder='little');
|
||||
|
||||
#HEIGHT 2 BYTES
|
||||
header = header + height.to_bytes(2, byteorder='little');
|
||||
|
||||
#NUMBER OF ITEMS 2 BYTES
|
||||
header = header + splits.to_bytes(2, byteorder='little');
|
||||
|
||||
#NUMBER OF ITEMS 2 BYTES
|
||||
header = header + int(JPEG_SPLIT_HEIGHT).to_bytes(2, byteorder='little');
|
||||
|
||||
for item_len in lenbuf:
|
||||
# WIDTH 2 BYTES
|
||||
header = header + item_len.to_bytes(2, byteorder='little');
|
||||
|
||||
|
||||
data = bytearray()
|
||||
|
||||
sjpeg = header + sjpeg_data;
|
||||
|
||||
if 1:
|
||||
for i in range(len(lenbuf)):
|
||||
os.remove(str(i) + ".jpg")
|
||||
|
||||
|
||||
f = open(OUTPUT_FILE_NAME+".sjpg","wb");
|
||||
f.write(sjpeg)
|
||||
f.close()
|
||||
|
||||
new_line_threshold = 0
|
||||
for i in range(len(sjpeg)):
|
||||
c_code = c_code + "\t" + str(hex(sjpeg[i])) + ","
|
||||
new_line_threshold = new_line_threshold + 1
|
||||
if (new_line_threshold >= 16):
|
||||
c_code = c_code + "\n"
|
||||
new_line_threshold = 0
|
||||
|
||||
|
||||
c_code = c_code + "\n};\n\nlv_image_dsc_t "
|
||||
c_code = c_code + OUTPUT_FILE_NAME + " = {\n"
|
||||
c_code = c_code + "\t.header.always_zero = 0,\n"
|
||||
c_code = c_code + "\t.header.w = " + str(width) + ",\n"
|
||||
c_code = c_code + "\t.header.h = " + str(height) + ",\n"
|
||||
c_code = c_code + "\t.data_size = " + str(len(sjpeg)) + ",\n"
|
||||
c_code = c_code + "\t.header.cf = LV_IMG_CF_RAW,\n"
|
||||
c_code = c_code + "\t.data = " + OUTPUT_FILE_NAME+"_map" + ",\n};"
|
||||
|
||||
|
||||
f = open(OUTPUT_FILE_NAME + '.c', 'w')
|
||||
f.write(c_code)
|
||||
f.close()
|
||||
|
||||
|
||||
time_taken = (time.time() - start_time)
|
||||
|
||||
print("Output:")
|
||||
print("\tTime taken = " + str(round(time_taken,2)) + " sec")
|
||||
print("\tbin size = " + str(round(len(sjpeg)/1024, 1)) + " KB" )
|
||||
print("\t" + OUTPUT_FILE_NAME + ".sjpg\t(bin file)" + "\n\t" + OUTPUT_FILE_NAME + ".c\t\t(c array)")
|
||||
|
||||
print("\nAll good!")
|
||||
29
libraries/lvgl/scripts/kconfig_verify.py
Normal file
29
libraries/lvgl/scripts/kconfig_verify.py
Normal file
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
|
||||
try:
|
||||
import kconfiglib
|
||||
except ImportError:
|
||||
print("Need kconfiglib package, do `pip3 install kconfiglib`")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def verify_kconfig(kconfig_file):
|
||||
kconf = kconfiglib.Kconfig(kconfig_file)
|
||||
|
||||
if kconf.warnings:
|
||||
print("Warnings found:")
|
||||
for warning in kconf.warnings:
|
||||
print(warning)
|
||||
sys.exit(1)
|
||||
else:
|
||||
print("No warnings found.")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) != 2:
|
||||
print("Usage: python check_kconfig.py <Kconfig_file>")
|
||||
sys.exit(1)
|
||||
|
||||
verify_kconfig(sys.argv[1])
|
||||
229
libraries/lvgl/scripts/lv_conf_internal_gen.py
Executable file
229
libraries/lvgl/scripts/lv_conf_internal_gen.py
Executable file
@@ -0,0 +1,229 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
'''
|
||||
Generates lv_conf_internal.h from lv_conf_template.h to provide default values
|
||||
'''
|
||||
|
||||
import os
|
||||
import sys
|
||||
import re
|
||||
|
||||
SCRIPT_DIR = os.path.dirname(__file__)
|
||||
LV_CONF_TEMPLATE = os.path.join(SCRIPT_DIR, "..", "lv_conf_template.h")
|
||||
LV_CONF_INTERNAL = os.path.join(SCRIPT_DIR, "..", "src", "lv_conf_internal.h")
|
||||
|
||||
if sys.version_info < (3,6,0):
|
||||
print("Python >=3.6 is required", file=sys.stderr)
|
||||
exit(1)
|
||||
|
||||
fin = open(LV_CONF_TEMPLATE)
|
||||
fout = open(LV_CONF_INTERNAL, "w", newline='')
|
||||
|
||||
fout.write(
|
||||
'''/**
|
||||
* GENERATED FILE, DO NOT EDIT IT!
|
||||
* @file lv_conf_internal.h
|
||||
* Make sure all the defines of lv_conf.h have a default value
|
||||
**/
|
||||
|
||||
#ifndef LV_CONF_INTERNAL_H
|
||||
#define LV_CONF_INTERNAL_H
|
||||
/* clang-format off */
|
||||
|
||||
/*Config options*/
|
||||
#define LV_OS_NONE 0
|
||||
#define LV_OS_PTHREAD 1
|
||||
#define LV_OS_FREERTOS 2
|
||||
#define LV_OS_CMSIS_RTOS2 3
|
||||
#define LV_OS_RTTHREAD 4
|
||||
#define LV_OS_WINDOWS 5
|
||||
#define LV_OS_MQX 6
|
||||
#define LV_OS_CUSTOM 255
|
||||
|
||||
#define LV_STDLIB_BUILTIN 0
|
||||
#define LV_STDLIB_CLIB 1
|
||||
#define LV_STDLIB_MICROPYTHON 2
|
||||
#define LV_STDLIB_RTTHREAD 3
|
||||
#define LV_STDLIB_CUSTOM 255
|
||||
|
||||
#define LV_DRAW_SW_ASM_NONE 0
|
||||
#define LV_DRAW_SW_ASM_NEON 1
|
||||
#define LV_DRAW_SW_ASM_HELIUM 2
|
||||
#define LV_DRAW_SW_ASM_CUSTOM 255
|
||||
|
||||
/* Handle special Kconfig options */
|
||||
#ifndef LV_KCONFIG_IGNORE
|
||||
#include "lv_conf_kconfig.h"
|
||||
#ifdef CONFIG_LV_CONF_SKIP
|
||||
#define LV_CONF_SKIP
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*If "lv_conf.h" is available from here try to use it later.*/
|
||||
#ifdef __has_include
|
||||
#if __has_include("lv_conf.h")
|
||||
#ifndef LV_CONF_INCLUDE_SIMPLE
|
||||
#define LV_CONF_INCLUDE_SIMPLE
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*If lv_conf.h is not skipped include it*/
|
||||
#if !defined(LV_CONF_SKIP) || defined(LV_CONF_PATH)
|
||||
#ifdef LV_CONF_PATH /*If there is a path defined for lv_conf.h use it*/
|
||||
#define __LV_TO_STR_AUX(x) #x
|
||||
#define __LV_TO_STR(x) __LV_TO_STR_AUX(x)
|
||||
#include __LV_TO_STR(LV_CONF_PATH)
|
||||
#undef __LV_TO_STR_AUX
|
||||
#undef __LV_TO_STR
|
||||
#elif defined(LV_CONF_INCLUDE_SIMPLE) /*Or simply include lv_conf.h is enabled*/
|
||||
#include "lv_conf.h"
|
||||
#else
|
||||
#include "../../lv_conf.h" /*Else assume lv_conf.h is next to the lvgl folder*/
|
||||
#endif
|
||||
#if !defined(LV_CONF_H) && !defined(LV_CONF_SUPPRESS_DEFINE_CHECK)
|
||||
/* #include will sometimes silently fail when __has_include is used */
|
||||
/* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80753 */
|
||||
#pragma message("Possible failure to include lv_conf.h, please read the comment in this file if you get errors")
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_LV_COLOR_DEPTH
|
||||
#define LV_KCONFIG_PRESENT
|
||||
#endif
|
||||
|
||||
/*----------------------------------
|
||||
* Start parsing lv_conf_template.h
|
||||
-----------------------------------*/
|
||||
'''
|
||||
)
|
||||
|
||||
started = 0
|
||||
|
||||
for line in fin.read().splitlines():
|
||||
if not started:
|
||||
if '#define LV_CONF_H' in line:
|
||||
started = 1
|
||||
continue
|
||||
else:
|
||||
continue
|
||||
|
||||
if '/*--END OF LV_CONF_H--*/' in line: break
|
||||
|
||||
#Is there a #define in this line?
|
||||
r = re.search(r'^([\s]*)#[\s]*(undef|define)[\s]+([^\s]+).*$', line) # \s means any white space character
|
||||
|
||||
if r:
|
||||
indent = r[1]
|
||||
|
||||
name = r[3]
|
||||
name = re.sub('\(.*?\)', '', name, 1) #remove parentheses from macros. E.g. MY_FUNC(5) -> MY_FUNC
|
||||
|
||||
line = re.sub('[\s]*', '', line, 1)
|
||||
|
||||
#If the value should be 1 (enabled) by default use a more complex structure for Kconfig checks because
|
||||
#if a not defined CONFIG_... value should be interpreted as 0 and not the LVGL default
|
||||
is_one = re.search(r'#[\s]*define[\s]*[A-Z0-9_]+[\s]+1([\s]*$|[\s]+)', line)
|
||||
if is_one:
|
||||
#1. Use the value if already set from lv_conf.h or anything else (i.e. do nothing)
|
||||
#2. In Kconfig environment use the CONFIG_... value if set, else use 0
|
||||
#3. In not Kconfig environment use the LVGL's default value
|
||||
|
||||
fout.write(
|
||||
f'{indent}#ifndef {name}\n'
|
||||
f'{indent} #ifdef LV_KCONFIG_PRESENT\n'
|
||||
f'{indent} #ifdef CONFIG_{name.upper()}\n'
|
||||
f'{indent} #define {name} CONFIG_{name.upper()}\n'
|
||||
f'{indent} #else\n'
|
||||
f'{indent} #define {name} 0\n'
|
||||
f'{indent} #endif\n'
|
||||
f'{indent} #else\n'
|
||||
f'{indent} {line}\n'
|
||||
f'{indent} #endif\n'
|
||||
f'{indent}#endif\n'
|
||||
)
|
||||
else:
|
||||
#1. Use the value if already set from lv_conf.h or anything else (i.e. do nothing)
|
||||
#2. Use the Kconfig value if set
|
||||
#3. Use the LVGL's default value
|
||||
|
||||
fout.write(
|
||||
f'{indent}#ifndef {name}\n'
|
||||
f'{indent} #ifdef CONFIG_{name.upper()}\n'
|
||||
f'{indent} #define {name} CONFIG_{name.upper()}\n'
|
||||
f'{indent} #else\n'
|
||||
f'{indent} {line}\n'
|
||||
f'{indent} #endif\n'
|
||||
f'{indent}#endif\n'
|
||||
)
|
||||
|
||||
elif re.search('^ *typedef .*;.*$', line):
|
||||
continue #ignore typedefs to avoid redeclaration
|
||||
else:
|
||||
fout.write(f'{line}\n')
|
||||
|
||||
fout.write(
|
||||
'''
|
||||
|
||||
/*----------------------------------
|
||||
* End of parsing lv_conf_template.h
|
||||
-----------------------------------*/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
LV_EXPORT_CONST_INT(LV_DPI_DEF);
|
||||
LV_EXPORT_CONST_INT(LV_DRAW_BUF_STRIDE_ALIGN);
|
||||
LV_EXPORT_CONST_INT(LV_DRAW_BUF_ALIGN);
|
||||
#endif
|
||||
|
||||
#undef LV_KCONFIG_PRESENT
|
||||
|
||||
/*Set some defines if a dependency is disabled*/
|
||||
#if LV_USE_LOG == 0
|
||||
#define LV_LOG_LEVEL LV_LOG_LEVEL_NONE
|
||||
#define LV_LOG_TRACE_MEM 0
|
||||
#define LV_LOG_TRACE_TIMER 0
|
||||
#define LV_LOG_TRACE_INDEV 0
|
||||
#define LV_LOG_TRACE_DISP_REFR 0
|
||||
#define LV_LOG_TRACE_EVENT 0
|
||||
#define LV_LOG_TRACE_OBJ_CREATE 0
|
||||
#define LV_LOG_TRACE_LAYOUT 0
|
||||
#define LV_LOG_TRACE_ANIM 0
|
||||
#endif /*LV_USE_LOG*/
|
||||
|
||||
#if LV_USE_SYSMON == 0
|
||||
#define LV_USE_PERF_MONITOR 0
|
||||
#define LV_USE_MEM_MONITOR 0
|
||||
#endif /*LV_USE_SYSMON*/
|
||||
|
||||
#ifndef LV_USE_LZ4
|
||||
#define LV_USE_LZ4 (LV_USE_LZ4_INTERNAL || LV_USE_LZ4_EXTERNAL)
|
||||
#endif
|
||||
|
||||
#ifndef LV_USE_THORVG
|
||||
#define LV_USE_THORVG (LV_USE_THORVG_INTERNAL || LV_USE_THORVG_EXTERNAL)
|
||||
#endif
|
||||
|
||||
#if LV_USE_OS
|
||||
#if (LV_USE_FREETYPE || LV_USE_THORVG) && LV_DRAW_THREAD_STACK_SIZE < (32 * 1024)
|
||||
#warning "Increase LV_DRAW_THREAD_STACK_SIZE to at least 32KB for FreeType or ThorVG."
|
||||
#endif
|
||||
|
||||
#if defined(LV_DRAW_THREAD_STACKSIZE) && !defined(LV_DRAW_THREAD_STACK_SIZE)
|
||||
#warning "LV_DRAW_THREAD_STACKSIZE was renamed to LV_DRAW_THREAD_STACK_SIZE. Please update lv_conf.h or run menuconfig again."
|
||||
#define LV_DRAW_THREAD_STACK_SIZE LV_DRAW_THREAD_STACKSIZE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*If running without lv_conf.h add typedefs with default value*/
|
||||
#ifdef LV_CONF_SKIP
|
||||
#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) /*Disable warnings for Visual Studio*/
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#endif
|
||||
#endif /*defined(LV_CONF_SKIP)*/
|
||||
|
||||
#endif /*LV_CONF_INTERNAL_H*/
|
||||
'''
|
||||
)
|
||||
|
||||
fin.close()
|
||||
fout.close()
|
||||
217
libraries/lvgl/scripts/properties.py
Executable file
217
libraries/lvgl/scripts/properties.py
Executable file
@@ -0,0 +1,217 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import re
|
||||
import argparse
|
||||
from collections import defaultdict
|
||||
|
||||
|
||||
style_properties_type = {
|
||||
"LV_STYLE_BG_COLOR": "LV_PROPERTY_TYPE_COLOR",
|
||||
"LV_STYLE_BG_GRAD_COLOR": "LV_PROPERTY_TYPE_COLOR",
|
||||
"LV_STYLE_BG_IMAGE_SRC": "LV_PROPERTY_TYPE_IMGSRC",
|
||||
"LV_STYLE_BG_IMAGE_RECOLOR": "LV_PROPERTY_TYPE_COLOR",
|
||||
"LV_STYLE_BORDER_COLOR": "LV_PROPERTY_TYPE_COLOR",
|
||||
"LV_STYLE_OUTLINE_COLOR": "LV_PROPERTY_TYPE_COLOR",
|
||||
"LV_STYLE_SHADOW_COLOR": "LV_PROPERTY_TYPE_COLOR",
|
||||
"LV_STYLE_IMAGE_RECOLOR": "LV_PROPERTY_TYPE_COLOR",
|
||||
"LV_STYLE_ARCH_IMAGE_SRC": "LV_PROPERTY_TYPE_IMGSRC",
|
||||
"LV_STYLE_ARCH_COLOR": "LV_PROPERTY_TYPE_COLOR",
|
||||
"LV_STYLE_TEXT_COLOR": "LV_PROPERTY_TYPE_COLOR",
|
||||
"LV_STYLE_TEXT_FONT": "LV_PROPERTY_TYPE_FONT",
|
||||
"LV_STYLE_LINE_COLOR": "LV_PROPERTY_TYPE_COLOR",
|
||||
}
|
||||
|
||||
|
||||
class Property:
|
||||
def __init__(self, widget, name, type, index, id):
|
||||
self.widget = widget
|
||||
self.name = name
|
||||
self.type = type
|
||||
self.index = index
|
||||
self.id = id
|
||||
|
||||
|
||||
def find_headers(directory):
|
||||
if os.path.isfile(directory):
|
||||
yield directory
|
||||
return
|
||||
|
||||
for root, dirs, files in os.walk(directory):
|
||||
for file in files:
|
||||
if file.endswith('.h'):
|
||||
yield os.path.join(root, file)
|
||||
|
||||
|
||||
def read_widget_properties(directory):
|
||||
|
||||
def match_properties(file_path):
|
||||
pattern = r'^\s*LV_PROPERTY_ID\((\w+),\s*(\w+),\s*(\w+),\s*(\d+)\)'
|
||||
with open(file_path, 'r') as file:
|
||||
for line in file.readlines():
|
||||
match = re.match(pattern, line)
|
||||
if match:
|
||||
id = f"LV_PROPERTY_{match.group(1).upper()}_{match.group(2).upper()}"
|
||||
yield Property(
|
||||
match.group(1).lower(),
|
||||
match.group(2).lower(), match.group(3), match.group(4),
|
||||
id)
|
||||
|
||||
def match_styles(file_path):
|
||||
pattern = r'^\s+LV_STYLE_(\w+)\s*=\s*(\d+),'
|
||||
with open(file_path, 'r') as file:
|
||||
for line in file.readlines():
|
||||
match = re.match(pattern, line)
|
||||
if match:
|
||||
name = match.group(1).upper()
|
||||
id = f"LV_PROPERTY_STYLE_{name}"
|
||||
yield Property("style",
|
||||
match.group(1).lower(), "style",
|
||||
match.group(2), id)
|
||||
|
||||
properties_by_widget = defaultdict(list)
|
||||
for file_path in find_headers(directory):
|
||||
for property in match_properties(file_path):
|
||||
properties_by_widget[property.widget].append(property)
|
||||
|
||||
for property in match_styles(file_path):
|
||||
properties_by_widget[property.widget].append(property)
|
||||
|
||||
for widget, properties in properties_by_widget.items():
|
||||
# sort properties by property name
|
||||
properties.sort(key=lambda x: x.name)
|
||||
properties_by_widget[widget] = properties
|
||||
|
||||
return properties_by_widget
|
||||
|
||||
|
||||
def write_widget_properties(output, properties_by_widget):
|
||||
# Open header file for update.
|
||||
with open(f'{output}/lv_obj_property_names.h', "w") as header:
|
||||
header.write(f'''
|
||||
/**
|
||||
* @file lv_obj_property_names.h
|
||||
* GENERATED FILE, DO NOT EDIT IT!
|
||||
*/
|
||||
#ifndef LV_OBJ_PROPERTY_NAMES_H
|
||||
#define LV_OBJ_PROPERTY_NAMES_H
|
||||
|
||||
#include "../../misc/lv_types.h"
|
||||
|
||||
#if LV_USE_OBJ_PROPERTY && LV_USE_OBJ_PROPERTY_NAME
|
||||
|
||||
''')
|
||||
|
||||
for widget in sorted(properties_by_widget.keys()):
|
||||
properties = properties_by_widget[widget]
|
||||
file_name = f'lv_{widget}_properties.c'
|
||||
output_file = f'{output}/{file_name}'
|
||||
|
||||
count = len(properties)
|
||||
if widget == 'style':
|
||||
include = "lv_style_properties.h"
|
||||
guard = None
|
||||
elif widget == "obj":
|
||||
include = "../../core/lv_obj.h"
|
||||
guard = None
|
||||
else:
|
||||
include = f'../{widget}/lv_{widget}.h'
|
||||
guard = f"#if LV_USE_{widget.upper()}"
|
||||
|
||||
with open(output_file, 'w') as f:
|
||||
f.write(f'''
|
||||
/**
|
||||
* GENERATED FILE, DO NOT EDIT IT!
|
||||
* @file {file_name}
|
||||
*/
|
||||
|
||||
#include "{include}"
|
||||
|
||||
#if LV_USE_OBJ_PROPERTY && LV_USE_OBJ_PROPERTY_NAME
|
||||
|
||||
{guard if guard else ""}
|
||||
/**
|
||||
* {widget.capitalize() + ' widget' if widget != 'style' else 'Style'} property names, name must be in order.
|
||||
* Generated code from properties.py
|
||||
*/
|
||||
/* *INDENT-OFF* */
|
||||
const lv_property_name_t lv_{widget}_property_names[{count}] = {{
|
||||
''')
|
||||
|
||||
for property in properties:
|
||||
name = property.name
|
||||
name_str = '"' + name + '",'
|
||||
f.write(f" {{{name_str :25} {property.id},}},\n")
|
||||
|
||||
f.write('};\n')
|
||||
if guard:
|
||||
f.write(f"#endif /*LV_USE_{widget.upper()}*/\n\n")
|
||||
f.write("/* *INDENT-ON* */\n")
|
||||
f.write('#endif\n')
|
||||
header.write(
|
||||
f' extern const lv_property_name_t lv_{widget}_property_names[{count}];\n'
|
||||
)
|
||||
header.write('#endif\n')
|
||||
header.write('#endif\n')
|
||||
|
||||
|
||||
def write_style_header(output, properties_by_widget):
|
||||
properties = properties_by_widget['style']
|
||||
|
||||
output_file = f'{output}/lv_style_properties.h'
|
||||
|
||||
with open(output_file, 'w') as f:
|
||||
f.write(f'''
|
||||
/**
|
||||
* GENERATED FILE, DO NOT EDIT IT!
|
||||
* @file lv_style_properties.h
|
||||
*/
|
||||
#ifndef LV_STYLE_PROPERTIES_H
|
||||
#define LV_STYLE_PROPERTIES_H
|
||||
|
||||
#include "../../core/lv_obj_property.h"
|
||||
#if LV_USE_OBJ_PROPERTY
|
||||
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
enum {{
|
||||
''')
|
||||
|
||||
for property in properties:
|
||||
name = property.name
|
||||
id_type = style_properties_type.get(f"LV_STYLE_{name.upper()}",
|
||||
"LV_PROPERTY_TYPE_INT")
|
||||
f.write(
|
||||
f" LV_PROPERTY_ID(STYLE, {name.upper() + ',' :25} {id_type+',' :28} LV_STYLE_{name.upper()}),\n"
|
||||
)
|
||||
|
||||
f.write('};\n\n')
|
||||
f.write('#endif\n')
|
||||
f.write('#endif\n')
|
||||
|
||||
|
||||
def main(directory, output):
|
||||
property = read_widget_properties(directory)
|
||||
write_widget_properties(output, property)
|
||||
write_style_header(output, property)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(
|
||||
description='Search files and filter lines.')
|
||||
parser.add_argument('-d', '--directory',
|
||||
help='Directory to lvgl root path')
|
||||
parser.add_argument(
|
||||
'-o', '--output', help='Folders to write generated properties for all widgets.')
|
||||
args = parser.parse_args()
|
||||
|
||||
# default directory is the lvgl root path of where this script sits
|
||||
if args.directory is None:
|
||||
args.directory = os.path.join(os.path.dirname(__file__), "../")
|
||||
|
||||
if args.output is None:
|
||||
args.output = os.path.join(args.directory, "src/widgets/property/")
|
||||
|
||||
# create output directory if it doesn't exist
|
||||
os.makedirs(args.output, exist_ok=True)
|
||||
|
||||
main(args.directory, args.output)
|
||||
725
libraries/lvgl/scripts/style_api_gen.py
Executable file
725
libraries/lvgl/scripts/style_api_gen.py
Executable file
@@ -0,0 +1,725 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
props = [
|
||||
{'section': 'Size and position', 'dsc':'Properties related to size, position, alignment and layout of the objects.' },
|
||||
{'name': 'WIDTH',
|
||||
'style_type': 'num', 'var_type': 'int32_t' , 'default':'Widget dependent', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
|
||||
'dsc': "Sets the width of object. Pixel, percentage and `LV_SIZE_CONTENT` values can be used. Percentage values are relative to the width of the parent's content area."},
|
||||
|
||||
{'name': 'MIN_WIDTH',
|
||||
'style_type': 'num', 'var_type': 'int32_t' , 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
|
||||
'dsc': "Sets a minimal width. Pixel and percentage values can be used. Percentage values are relative to the width of the parent's content area."},
|
||||
|
||||
{'name': 'MAX_WIDTH',
|
||||
'style_type': 'num', 'var_type': 'int32_t' , 'default':'LV_COORD_MAX', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
|
||||
'dsc': "Sets a maximal width. Pixel and percentage values can be used. Percentage values are relative to the width of the parent's content area."},
|
||||
|
||||
{'name': 'HEIGHT',
|
||||
'style_type': 'num', 'var_type': 'int32_t' , 'default':'Widget dependent', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
|
||||
'dsc': "Sets the height of object. Pixel, percentage and `LV_SIZE_CONTENT` can be used. Percentage values are relative to the height of the parent's content area."},
|
||||
|
||||
{'name': 'MIN_HEIGHT',
|
||||
'style_type': 'num', 'var_type': 'int32_t' , 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
|
||||
'dsc': "Sets a minimal height. Pixel and percentage values can be used. Percentage values are relative to the width of the parent's content area."},
|
||||
|
||||
{'name': 'MAX_HEIGHT',
|
||||
'style_type': 'num', 'var_type': 'int32_t' , 'default':'LV_COORD_MAX', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
|
||||
'dsc': "Sets a maximal height. Pixel and percentage values can be used. Percentage values are relative to the height of the parent's content area."},
|
||||
|
||||
{'name': 'LENGTH',
|
||||
'style_type': 'num', 'var_type': 'int32_t' , 'default':'0', 'inherited': 0, 'layout': 0, 'ext_draw': 1,
|
||||
'dsc': "Its meaning depends on the type of the widget. For example in case of lv_scale it means the length of the ticks."},
|
||||
|
||||
{'name': 'X',
|
||||
'style_type': 'num', 'var_type': 'int32_t' , 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
|
||||
'dsc': "Set the X coordinate of the object considering the set `align`. Pixel and percentage values can be used. Percentage values are relative to the width of the parent's content area."},
|
||||
|
||||
{'name': 'Y',
|
||||
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
|
||||
'dsc': "Set the Y coordinate of the object considering the set `align`. Pixel and percentage values can be used. Percentage values are relative to the height of the parent's content area."},
|
||||
|
||||
{'name': 'ALIGN',
|
||||
'style_type': 'num', 'var_type': 'lv_align_t', 'default':'`LV_ALIGN_DEFAULT`', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
|
||||
'dsc': "Set the alignment which tells from which point of the parent the X and Y coordinates should be interpreted. The possible values are: `LV_ALIGN_DEFAULT`, `LV_ALIGN_TOP_LEFT/MID/RIGHT`, `LV_ALIGN_BOTTOM_LEFT/MID/RIGHT`, `LV_ALIGN_LEFT/RIGHT_MID`, `LV_ALIGN_CENTER`. `LV_ALIGN_DEFAULT` means `LV_ALIGN_TOP_LEFT` with LTR base direction and `LV_ALIGN_TOP_RIGHT` with RTL base direction."},
|
||||
|
||||
{'name': 'TRANSFORM_WIDTH',
|
||||
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 1,
|
||||
'dsc': "Make the object wider on both sides with this value. Pixel and percentage (with `lv_pct(x)`) values can be used. Percentage values are relative to the object's width." },
|
||||
|
||||
{'name': 'TRANSFORM_HEIGHT',
|
||||
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 1,
|
||||
'dsc': "Make the object higher on both sides with this value. Pixel and percentage (with `lv_pct(x)`) values can be used. Percentage values are relative to the object's height." },
|
||||
|
||||
{'name': 'TRANSLATE_X',
|
||||
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
|
||||
'dsc': "Move the object with this value in X direction. Applied after layouts, aligns and other positioning. Pixel and percentage (with `lv_pct(x)`) values can be used. Percentage values are relative to the object's width." },
|
||||
|
||||
{'name': 'TRANSLATE_Y',
|
||||
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
|
||||
'dsc': "Move the object with this value in Y direction. Applied after layouts, aligns and other positioning. Pixel and percentage (with `lv_pct(x)`) values can be used. Percentage values are relative to the object's height." },
|
||||
|
||||
{'name': 'TRANSFORM_SCALE_X',
|
||||
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 1,
|
||||
'dsc': "Zoom an objects horizontally. The value 256 (or `LV_SCALE_NONE`) means normal size, 128 half size, 512 double size, and so on" },
|
||||
|
||||
{'name': 'TRANSFORM_SCALE_Y',
|
||||
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 1,
|
||||
'dsc': "Zoom an objects vertically. The value 256 (or `LV_SCALE_NONE`) means normal size, 128 half size, 512 double size, and so on" },
|
||||
|
||||
{'name': 'TRANSFORM_ROTATION',
|
||||
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 1,
|
||||
'dsc': "Rotate an objects. The value is interpreted in 0.1 degree units. E.g. 450 means 45 deg."},
|
||||
|
||||
{'name': 'TRANSFORM_PIVOT_X',
|
||||
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "Set the pivot point's X coordinate for transformations. Relative to the object's top left corner'"},
|
||||
|
||||
{'name': 'TRANSFORM_PIVOT_Y',
|
||||
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "Set the pivot point's Y coordinate for transformations. Relative to the object's top left corner'"},
|
||||
|
||||
{'name': 'TRANSFORM_SKEW_X',
|
||||
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 1,
|
||||
'dsc': "Skew an object horizontally. The value is interpreted in 0.1 degree units. E.g. 450 means 45 deg."},
|
||||
|
||||
{'name': 'TRANSFORM_SKEW_Y',
|
||||
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 1,
|
||||
'dsc': "Skew an object vertically. The value is interpreted in 0.1 degree units. E.g. 450 means 45 deg."},
|
||||
|
||||
{'section': 'Padding', 'dsc' : "Properties to describe spacing between the parent's sides and the children and among the children. Very similar to the padding properties in HTML."},
|
||||
{'name': 'PAD_TOP',
|
||||
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
|
||||
'dsc': "Sets the padding on the top. It makes the content area smaller in this direction."},
|
||||
|
||||
{'name': 'PAD_BOTTOM',
|
||||
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
|
||||
'dsc': "Sets the padding on the bottom. It makes the content area smaller in this direction."},
|
||||
|
||||
{'name': 'PAD_LEFT',
|
||||
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
|
||||
'dsc': "Sets the padding on the left. It makes the content area smaller in this direction."},
|
||||
|
||||
{'name': 'PAD_RIGHT',
|
||||
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
|
||||
'dsc': "Sets the padding on the right. It makes the content area smaller in this direction."},
|
||||
|
||||
{'name': 'PAD_ROW',
|
||||
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
|
||||
'dsc': "Sets the padding between the rows. Used by the layouts."},
|
||||
|
||||
{'name': 'PAD_COLUMN',
|
||||
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
|
||||
'dsc': "Sets the padding between the columns. Used by the layouts."},
|
||||
|
||||
{'section': 'Margin', 'dsc' : "Properties to describe spacing around an object. Very similar to the margin properties in HTML."},
|
||||
{'name': 'MARGIN_TOP',
|
||||
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
|
||||
'dsc': "Sets the margin on the top. The object will keep this space from its siblings in layouts. "},
|
||||
|
||||
{'name': 'MARGIN_BOTTOM',
|
||||
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
|
||||
'dsc': "Sets the margin on the bottom. The object will keep this space from its siblings in layouts."},
|
||||
|
||||
{'name': 'MARGIN_LEFT',
|
||||
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
|
||||
'dsc': "Sets the margin on the left. The object will keep this space from its siblings in layouts."},
|
||||
|
||||
{'name': 'MARGIN_RIGHT',
|
||||
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
|
||||
'dsc': "Sets the margin on the right. The object will keep this space from its siblings in layouts."},
|
||||
|
||||
{'section': 'Background', 'dsc':'Properties to describe the background color and image of the objects.' },
|
||||
{'name': 'BG_COLOR',
|
||||
'style_type': 'color', 'var_type': 'lv_color_t', 'default':'`0xffffff`', 'inherited': 0, 'layout': 0, 'ext_draw': 0, 'filtered': 1,
|
||||
'dsc': "Set the background color of the object."},
|
||||
|
||||
{'name': 'BG_OPA',
|
||||
'style_type': 'num', 'var_type': 'lv_opa_t', 'default':'`LV_OPA_TRANSP`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "Set the opacity of the background. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency."},
|
||||
|
||||
{'name': 'BG_GRAD_COLOR',
|
||||
'style_type': 'color', 'var_type': 'lv_color_t', 'default':'`0x000000`', 'inherited': 0, 'layout': 0, 'ext_draw': 0, 'filtered': 1,
|
||||
'dsc': "Set the gradient color of the background. Used only if `grad_dir` is not `LV_GRAD_DIR_NONE`"},
|
||||
|
||||
{'name': 'BG_GRAD_DIR',
|
||||
'style_type': 'num', 'var_type': 'lv_grad_dir_t', 'default':'`LV_GRAD_DIR_NONE`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "Set the direction of the gradient of the background. The possible values are `LV_GRAD_DIR_NONE/HOR/VER`."},
|
||||
|
||||
{'name': 'BG_MAIN_STOP',
|
||||
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "Set the point from which the background color should start for gradients. 0 means to top/left side, 255 the bottom/right side, 128 the center, and so on"},
|
||||
|
||||
{'name': 'BG_GRAD_STOP',
|
||||
'style_type': 'num', 'var_type': 'int32_t', 'default':255, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "Set the point from which the background's gradient color should start. 0 means to top/left side, 255 the bottom/right side, 128 the center, and so on"},
|
||||
|
||||
{'name': 'BG_MAIN_OPA',
|
||||
'style_type': 'num', 'var_type': 'lv_opa_t', 'default':255, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "Set the opacity of the first gradient color"},
|
||||
|
||||
{'name': 'BG_GRAD_OPA',
|
||||
'style_type': 'num', 'var_type': 'lv_opa_t', 'default':255, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "Set the opacity of the second gradient color"},
|
||||
|
||||
{'name': 'BG_GRAD',
|
||||
'style_type': 'ptr', 'var_type': 'const lv_grad_dsc_t *', 'default':'`NULL`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "Set the gradient definition. The pointed instance must exist while the object is alive. NULL to disable. It wraps `BG_GRAD_COLOR`, `BG_GRAD_DIR`, `BG_MAIN_STOP` and `BG_GRAD_STOP` into one descriptor and allows creating gradients with more colors too. If it's set other gradient related properties will be ignored'"},
|
||||
|
||||
{'name': 'BG_IMAGE_SRC',
|
||||
'style_type': 'ptr', 'var_type': 'const void *', 'default':'`NULL`', 'inherited': 0, 'layout': 0, 'ext_draw': 1,
|
||||
'dsc': "Set a background image. Can be a pointer to `lv_image_dsc_t`, a path to a file or an `LV_SYMBOL_...`"},
|
||||
|
||||
{'name': 'BG_IMAGE_OPA',
|
||||
'style_type': 'num', 'var_type': 'lv_opa_t', 'default':'`LV_OPA_COVER`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "Set the opacity of the background image. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency."},
|
||||
|
||||
{'name': 'BG_IMAGE_RECOLOR',
|
||||
'style_type': 'color', 'var_type': 'lv_color_t', 'default':'`0x000000`', 'inherited': 0, 'layout': 0, 'ext_draw': 0, 'filtered': 1,
|
||||
'dsc': "Set a color to mix to the background image."},
|
||||
|
||||
{'name': 'BG_IMAGE_RECOLOR_OPA',
|
||||
'style_type': 'num', 'var_type': 'lv_opa_t', 'default':'`LV_OPA_TRANSP`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "Set the intensity of background image recoloring. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means no mixing, 255, `LV_OPA_100` or `LV_OPA_COVER` means full recoloring, other values or LV_OPA_10, LV_OPA_20, etc are interpreted proportionally."},
|
||||
|
||||
{'name': 'BG_IMAGE_TILED',
|
||||
'style_type': 'num', 'var_type': 'bool', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "If enabled the background image will be tiled. The possible values are `true` or `false`."},
|
||||
|
||||
{'section': 'Border', 'dsc':'Properties to describe the borders' },
|
||||
{'name': 'BORDER_COLOR',
|
||||
'style_type': 'color', 'var_type': 'lv_color_t', 'default':'`0x000000`', 'inherited': 0, 'layout': 0, 'ext_draw': 0, 'filtered': 1,
|
||||
'dsc': "Set the color of the border"},
|
||||
|
||||
{'name': 'BORDER_OPA',
|
||||
'style_type': 'num', 'var_type': 'lv_opa_t' , 'default':'`LV_OPA_COVER`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "Set the opacity of the border. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency."},
|
||||
|
||||
{'name': 'BORDER_WIDTH',
|
||||
'style_type': 'num', 'var_type': 'int32_t' , 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
|
||||
'dsc': "Set the width of the border. Only pixel values can be used."},
|
||||
|
||||
{'name': 'BORDER_SIDE',
|
||||
'style_type': 'num', 'var_type': 'lv_border_side_t', 'default':'`LV_BORDER_SIDE_NONE`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "Set only which side(s) the border should be drawn. The possible values are `LV_BORDER_SIDE_NONE/TOP/BOTTOM/LEFT/RIGHT/INTERNAL`. OR-ed values can be used as well, e.g. `LV_BORDER_SIDE_TOP | LV_BORDER_SIDE_LEFT`."},
|
||||
|
||||
{'name': 'BORDER_POST',
|
||||
'style_type': 'num', 'var_type': 'bool' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "Sets whether the border should be drawn before or after the children are drawn. `true`: after children, `false`: before children"},
|
||||
|
||||
{'section': 'Outline', 'dsc':'Properties to describe the outline. It\'s like a border but drawn outside of the rectangles.' },
|
||||
{'name': 'OUTLINE_WIDTH',
|
||||
'style_type': 'num', 'var_type': 'int32_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 1,
|
||||
'dsc': "Set the width of the outline in pixels. "},
|
||||
|
||||
{'name': 'OUTLINE_COLOR',
|
||||
'style_type': 'color', 'var_type': 'lv_color_t' , 'default':'`0x000000`', 'inherited': 0, 'layout': 0, 'ext_draw': 0, 'filtered': 1,
|
||||
'dsc': "Set the color of the outline."},
|
||||
|
||||
{'name': 'OUTLINE_OPA',
|
||||
'style_type': 'num', 'var_type': 'lv_opa_t' , 'default':'`LV_OPA_COVER`', 'inherited': 0, 'layout': 0, 'ext_draw': 1,
|
||||
'dsc': "Set the opacity of the outline. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency."},
|
||||
|
||||
{'name': 'OUTLINE_PAD',
|
||||
'style_type': 'num', 'var_type': 'int32_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 1,
|
||||
'dsc': "Set the padding of the outline, i.e. the gap between object and the outline."},
|
||||
|
||||
{'section': 'Shadow', 'dsc':'Properties to describe the shadow drawn under the rectangles.' },
|
||||
{'name': 'SHADOW_WIDTH',
|
||||
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 1,
|
||||
'dsc': "Set the width of the shadow in pixels. The value should be >= 0."},
|
||||
|
||||
{'name': 'SHADOW_OFFSET_X',
|
||||
'style_type': 'num', 'var_type': 'int32_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 1,
|
||||
'dsc': "Set an offset on the shadow in pixels in X direction. "},
|
||||
|
||||
{'name': 'SHADOW_OFFSET_Y',
|
||||
'style_type': 'num', 'var_type': 'int32_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 1,
|
||||
'dsc': "Set an offset on the shadow in pixels in Y direction. "},
|
||||
|
||||
{'name': 'SHADOW_SPREAD',
|
||||
'style_type': 'num', 'var_type': 'int32_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 1,
|
||||
'dsc': "Make the shadow calculation to use a larger or smaller rectangle as base. The value can be in pixel to make the area larger/smaller"},
|
||||
|
||||
{'name': 'SHADOW_COLOR',
|
||||
'style_type': 'color', 'var_type': 'lv_color_t' , 'default':'`0x000000`', 'inherited': 0, 'layout': 0, 'ext_draw': 0, 'filtered': 1,
|
||||
'dsc': "Set the color of the shadow"},
|
||||
|
||||
{'name': 'SHADOW_OPA',
|
||||
'style_type': 'num', 'var_type': 'lv_opa_t' , 'default':'`LV_OPA_COVER`', 'inherited': 0, 'layout': 0, 'ext_draw': 1,
|
||||
'dsc': "Set the opacity of the shadow. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency."},
|
||||
|
||||
{'section': 'Image', 'dsc':'Properties to describe the images' },
|
||||
{'name': 'IMAGE_OPA',
|
||||
'style_type': 'num', 'var_type': 'lv_opa_t' , 'default':'`LV_OPA_COVER`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "Set the opacity of an image. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency."},
|
||||
|
||||
{'name': 'IMAGE_RECOLOR',
|
||||
'style_type': 'color', 'var_type': 'lv_color_t', 'default':'`0x000000`', 'inherited': 0, 'layout': 0, 'ext_draw': 0, 'filtered': 1,
|
||||
'dsc': "Set color to mixt to the image."},
|
||||
|
||||
{'name': 'IMAGE_RECOLOR_OPA',
|
||||
'style_type': 'num', 'var_type': 'lv_opa_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "Set the intensity of the color mixing. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency."},
|
||||
|
||||
{'section': 'Line', 'dsc':'Properties to describe line-like objects' },
|
||||
{'name': 'LINE_WIDTH',
|
||||
'style_type': 'num', 'var_type': 'int32_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 1,
|
||||
'dsc': "Set the width of the lines in pixel."},
|
||||
|
||||
{'name': 'LINE_DASH_WIDTH',
|
||||
'style_type': 'num', 'var_type': 'int32_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "Set the width of dashes in pixel. Note that dash works only on horizontal and vertical lines"},
|
||||
|
||||
{'name': 'LINE_DASH_GAP',
|
||||
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "Set the gap between dashes in pixel. Note that dash works only on horizontal and vertical lines"},
|
||||
|
||||
{'name': 'LINE_ROUNDED',
|
||||
'style_type': 'num', 'var_type': 'bool' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "Make the end points of the lines rounded. `true`: rounded, `false`: perpendicular line ending "},
|
||||
|
||||
{'name': 'LINE_COLOR',
|
||||
'style_type': 'color', 'var_type': 'lv_color_t' , 'default':'`0x000000`', 'inherited': 0, 'layout': 0, 'ext_draw': 0, 'filtered': 1,
|
||||
'dsc': "Set the color of the lines."},
|
||||
|
||||
{'name': 'LINE_OPA',
|
||||
'style_type': 'num', 'var_type': 'lv_opa_t' , 'default':'`LV_OPA_COVER`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "Set the opacity of the lines."},
|
||||
|
||||
{'section': 'Arc', 'dsc':'TODO' },
|
||||
{'name': 'ARC_WIDTH',
|
||||
'style_type': 'num', 'var_type': 'int32_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 1,
|
||||
'dsc': "Set the width (thickness) of the arcs in pixel."},
|
||||
|
||||
{'name': 'ARC_ROUNDED',
|
||||
'style_type': 'num', 'var_type': 'bool' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "Make the end points of the arcs rounded. `true`: rounded, `false`: perpendicular line ending "},
|
||||
|
||||
{'name': 'ARC_COLOR',
|
||||
'style_type': 'color', 'var_type': 'lv_color_t', 'default':'`0x000000`', 'inherited': 0, 'layout': 0, 'ext_draw': 0, 'filtered': 1,
|
||||
'dsc': "Set the color of the arc."},
|
||||
|
||||
{'name': 'ARC_OPA',
|
||||
'style_type': 'num', 'var_type': 'lv_opa_t' , 'default':'`LV_OPA_COVER`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "Set the opacity of the arcs."},
|
||||
|
||||
{'name': 'ARC_IMAGE_SRC',
|
||||
'style_type': 'ptr', 'var_type': 'const void *', 'default':'`NULL`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "Set an image from which the arc will be masked out. It's useful to display complex effects on the arcs. Can be a pointer to `lv_image_dsc_t` or a path to a file"},
|
||||
|
||||
{'section': 'Text', 'dsc':'Properties to describe the properties of text. All these properties are inherited.' },
|
||||
{'name': 'TEXT_COLOR',
|
||||
'style_type': 'color', 'var_type': 'lv_color_t', 'default':'`0x000000`', 'inherited': 1, 'layout': 0, 'ext_draw': 0, 'filtered': 1,
|
||||
'dsc': "Sets the color of the text."},
|
||||
|
||||
{'name': 'TEXT_OPA',
|
||||
'style_type': 'num', 'var_type': 'lv_opa_t', 'default':'`LV_OPA_COVER`', 'inherited': 1, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "Set the opacity of the text. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency."},
|
||||
|
||||
{'name': 'TEXT_FONT',
|
||||
'style_type': 'ptr', 'var_type': 'const lv_font_t *', 'default':'`LV_FONT_DEFAULT`', 'inherited': 1, 'layout': 1, 'ext_draw': 0,
|
||||
'dsc': "Set the font of the text (a pointer `lv_font_t *`). "},
|
||||
|
||||
{'name': 'TEXT_LETTER_SPACE',
|
||||
'style_type': 'num', 'var_type': 'int32_t' , 'default':0, 'inherited': 1, 'layout': 1, 'ext_draw': 0,
|
||||
'dsc': "Set the letter space in pixels"},
|
||||
|
||||
{'name': 'TEXT_LINE_SPACE',
|
||||
'style_type': 'num', 'var_type': 'int32_t' , 'default':0, 'inherited': 1, 'layout': 1, 'ext_draw': 0,
|
||||
'dsc': "Set the line space in pixels."},
|
||||
|
||||
{'name': 'TEXT_DECOR',
|
||||
'style_type': 'num', 'var_type': 'lv_text_decor_t' , 'default':'`LV_TEXT_DECOR_NONE`', 'inherited': 1, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "Set decoration for the text. The possible values are `LV_TEXT_DECOR_NONE/UNDERLINE/STRIKETHROUGH`. OR-ed values can be used as well." },
|
||||
|
||||
{'name': 'TEXT_ALIGN',
|
||||
'style_type': 'num', 'var_type': 'lv_text_align_t' , 'default':'`LV_TEXT_ALIGN_AUTO`', 'inherited': 1, 'layout': 1, 'ext_draw': 0,
|
||||
'dsc': "Set how to align the lines of the text. Note that it doesn't align the object itself, only the lines inside the object. The possible values are `LV_TEXT_ALIGN_LEFT/CENTER/RIGHT/AUTO`. `LV_TEXT_ALIGN_AUTO` detect the text base direction and uses left or right alignment accordingly"},
|
||||
|
||||
{'section': 'Miscellaneous', 'dsc':'Mixed properties for various purposes.' },
|
||||
{'name': 'RADIUS',
|
||||
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "Set the radius on every corner. The value is interpreted in pixel (>= 0) or `LV_RADIUS_CIRCLE` for max. radius"},
|
||||
|
||||
{'name': 'CLIP_CORNER',
|
||||
'style_type': 'num', 'var_type': 'bool', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "Enable to clip the overflowed content on the rounded corner. Can be `true` or `false`." },
|
||||
|
||||
{'name': 'OPA',
|
||||
'style_type': 'num', 'var_type': 'lv_opa_t', 'default':'`LV_OPA_COVER`', 'inherited': 1, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "Scale down all opacity values of the object by this factor. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency." },
|
||||
|
||||
{'name': 'OPA_LAYERED',
|
||||
'style_type': 'num', 'var_type': 'lv_opa_t', 'default':'`LV_OPA_COVER`', 'inherited': 1, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "First draw the object on the layer, then scale down layer opacity factor. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency." },
|
||||
|
||||
{'name': 'COLOR_FILTER_DSC',
|
||||
'style_type': 'ptr', 'var_type': 'const lv_color_filter_dsc_t *', 'default':'`NULL`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "Mix a color to all colors of the object." },
|
||||
|
||||
{'name': 'COLOR_FILTER_OPA',
|
||||
'style_type': 'num', 'var_type': 'lv_opa_t' , 'default':'`LV_OPA_TRANSP`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "The intensity of mixing of color filter."},
|
||||
|
||||
{'name': 'ANIM',
|
||||
'style_type': 'ptr', 'var_type': 'const lv_anim_t *', 'default':'`NULL`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "The animation template for the object's animation. Should be a pointer to `lv_anim_t`. The animation parameters are widget specific, e.g. animation time could be the E.g. blink time of the cursor on the text area or scroll time of a roller. See the widgets' documentation to learn more."},
|
||||
|
||||
{'name': 'ANIM_DURATION',
|
||||
'style_type': 'num', 'var_type': 'uint32_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "The animation duration in milliseconds. Its meaning is widget specific. E.g. blink time of the cursor on the text area or scroll time of a roller. See the widgets' documentation to learn more."},
|
||||
|
||||
{'name': 'TRANSITION',
|
||||
'style_type': 'ptr', 'var_type': 'const lv_style_transition_dsc_t *' , 'default':'`NULL`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "An initialized `lv_style_transition_dsc_t` to describe a transition."},
|
||||
|
||||
{'name': 'BLEND_MODE',
|
||||
'style_type': 'num', 'var_type': 'lv_blend_mode_t' , 'default':'`LV_BLEND_MODE_NORMAL`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "Describes how to blend the colors to the background. The possible values are `LV_BLEND_MODE_NORMAL/ADDITIVE/SUBTRACTIVE/MULTIPLY`"},
|
||||
|
||||
{'name': 'LAYOUT',
|
||||
'style_type': 'num', 'var_type': 'uint16_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
|
||||
'dsc': "Set the layout if the object. The children will be repositioned and resized according to the policies set for the layout. For the possible values see the documentation of the layouts."},
|
||||
|
||||
{'name': 'BASE_DIR',
|
||||
'style_type': 'num', 'var_type': 'lv_base_dir_t', 'default':'`LV_BASE_DIR_AUTO`', 'inherited': 1, 'layout': 1, 'ext_draw': 0,
|
||||
'dsc': "Set the base direction of the object. The possible values are `LV_BIDI_DIR_LTR/RTL/AUTO`."},
|
||||
|
||||
{'name': 'BITMAP_MASK_SRC',
|
||||
'style_type': 'ptr', 'var_type': 'const void *', 'default':'`NULL`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "If set a layer will be created for the widget and the layer will be masked with this A8 bitmap mask."},
|
||||
|
||||
{'name': 'ROTARY_SENSITIVITY',
|
||||
'style_type': 'num', 'var_type': 'uint32_t', 'default':'`256`', 'inherited': 1, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "Adjust the sensitivity for rotary encoders in 1/256 unit. It means, 128: slow down the rotary to half, 512: speeds up to double, 256: no change"},
|
||||
|
||||
{'section': 'Flex', 'dsc':'Flex layout properties.', 'guard':'LV_USE_FLEX'},
|
||||
|
||||
|
||||
{'name': 'FLEX_FLOW',
|
||||
'style_type': 'num', 'var_type': 'lv_flex_flow_t', 'default':'`LV_FLEX_FLOW_NONE`', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
|
||||
'dsc': "Defines in which direct the flex layout should arrange the children"},
|
||||
|
||||
|
||||
{'name': 'FLEX_MAIN_PLACE',
|
||||
'style_type': 'num', 'var_type': 'lv_flex_align_t', 'default':'`LV_FLEX_ALIGN_NONE`', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
|
||||
'dsc': "Defines how to align the children in the direction of flex flow"},
|
||||
|
||||
|
||||
{'name': 'FLEX_CROSS_PLACE',
|
||||
'style_type': 'num', 'var_type': 'lv_flex_align_t', 'default':'`LV_FLEX_ALIGN_NONE`', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
|
||||
'dsc': "Defines how to align the children perpendicular to the direction of flex flow"},
|
||||
|
||||
|
||||
{'name': 'FLEX_TRACK_PLACE',
|
||||
'style_type': 'num', 'var_type': 'lv_flex_align_t', 'default':'`LV_FLEX_ALIGN_NONE`', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
|
||||
'dsc': "Defines how to align the tracks of the flow"},
|
||||
|
||||
{'name': 'FLEX_GROW',
|
||||
'style_type': 'num', 'var_type': 'uint8_t', 'default':'`LV_FLEX_ALIGN_ROW`', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
|
||||
'dsc': "Defines how much space to take proportionally from the free space of the object's track"},
|
||||
|
||||
|
||||
|
||||
{'section': 'Grid', 'dsc':'Grid layout properties.', 'guard':'LV_USE_GRID'},
|
||||
|
||||
|
||||
{'name': 'GRID_COLUMN_DSC_ARRAY',
|
||||
'style_type': 'ptr', 'var_type': 'const int32_t *', 'default':'`NULL`', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
|
||||
'dsc': "An array to describe the columns of the grid. Should be LV_GRID_TEMPLATE_LAST terminated"},
|
||||
|
||||
{'name': 'GRID_COLUMN_ALIGN',
|
||||
'style_type': 'num', 'var_type': 'lv_grid_align_t', 'default':'`LV_GRID_ALIGN_START`', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
|
||||
'dsc': "Defines how to distribute the columns"},
|
||||
|
||||
|
||||
{'name': 'GRID_ROW_DSC_ARRAY',
|
||||
'style_type': 'ptr', 'var_type': 'const int32_t *', 'default':'`NULL`', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
|
||||
'dsc': "An array to describe the rows of the grid. Should be LV_GRID_TEMPLATE_LAST terminated"},
|
||||
|
||||
{'name': 'GRID_ROW_ALIGN',
|
||||
'style_type': 'num', 'var_type': 'lv_grid_align_t', 'default':'`LV_GRID_ALIGN_START`', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
|
||||
'dsc': "Defines how to distribute the rows."},
|
||||
|
||||
{'name': 'GRID_CELL_COLUMN_POS',
|
||||
'style_type': 'num', 'var_type': 'int32_t', 'default':'`LV_GRID_ALIGN_START`', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
|
||||
'dsc': "Set the column in which the object should be placed"},
|
||||
|
||||
{'name': 'GRID_CELL_X_ALIGN',
|
||||
'style_type': 'num', 'var_type': 'lv_grid_align_t', 'default':'`LV_GRID_ALIGN_START`', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
|
||||
'dsc': "Set how to align the object horizontally."},
|
||||
|
||||
{'name': 'GRID_CELL_COLUMN_SPAN',
|
||||
'style_type': 'num', 'var_type': 'int32_t', 'default':'`LV_GRID_ALIGN_START`', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
|
||||
'dsc': "Set how many columns the object should span. Needs to be >= 1"},
|
||||
|
||||
{'name': 'GRID_CELL_ROW_POS',
|
||||
'style_type': 'num', 'var_type': 'int32_t', 'default':'`LV_GRID_ALIGN_START`', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
|
||||
'dsc': "Set the row in which the object should be placed"},
|
||||
|
||||
{'name': 'GRID_CELL_Y_ALIGN',
|
||||
'style_type': 'num', 'var_type': 'lv_grid_align_t', 'default':'`LV_GRID_ALIGN_START`', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
|
||||
'dsc': "Set how to align the object vertically."},
|
||||
|
||||
{'name': 'GRID_CELL_ROW_SPAN',
|
||||
'style_type': 'num', 'var_type': 'int32_t', 'default':'`LV_GRID_ALIGN_START`', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
|
||||
'dsc': "Set how many rows the object should span. Needs to be >= 1"},
|
||||
]
|
||||
|
||||
|
||||
def style_get_cast(style_type, var_type):
|
||||
cast = ""
|
||||
if style_type != 'color':
|
||||
cast = "(" + var_type + ")"
|
||||
return cast
|
||||
|
||||
|
||||
def obj_style_get(p):
|
||||
if 'section' in p: return
|
||||
|
||||
cast = style_get_cast(p['style_type'], p['var_type'])
|
||||
print("static inline " + p['var_type'] + " lv_obj_get_style_" + p['name'].lower() +"(const lv_obj_t * obj, lv_part_t part)")
|
||||
print("{")
|
||||
print(" lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_" + p['name'] + ");")
|
||||
print(" return " + cast + "v." + p['style_type'] + ";")
|
||||
print("}")
|
||||
print("")
|
||||
|
||||
if 'filtered' in p and p['filtered']:
|
||||
print("static inline " + p['var_type'] + " lv_obj_get_style_" + p['name'].lower() +"_filtered(const lv_obj_t * obj, lv_part_t part)")
|
||||
print("{")
|
||||
print(" lv_style_value_t v = lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_" + p['name'] + "));")
|
||||
print(" return " + cast + "v." + p['style_type'] + ";")
|
||||
print("}")
|
||||
print("")
|
||||
|
||||
|
||||
|
||||
def style_set_cast(style_type):
|
||||
cast = ""
|
||||
if style_type == 'num':
|
||||
cast = "(int32_t)"
|
||||
return cast
|
||||
|
||||
|
||||
def style_set_c(p):
|
||||
if 'section' in p: return
|
||||
|
||||
cast = style_set_cast(p['style_type'])
|
||||
print("")
|
||||
print("void lv_style_set_" + p['name'].lower() +"(lv_style_t * style, "+ p['var_type'] +" value)")
|
||||
print("{")
|
||||
print(" lv_style_value_t v = {")
|
||||
print(" ." + p['style_type'] +" = " + cast + "value")
|
||||
print(" };")
|
||||
print(" lv_style_set_prop(style, LV_STYLE_" + p['name'] +", v);")
|
||||
print("}")
|
||||
|
||||
|
||||
def style_set_h(p):
|
||||
if 'section' in p: return
|
||||
|
||||
print("void lv_style_set_" + p['name'].lower() +"(lv_style_t * style, "+ p['var_type'] +" value);")
|
||||
|
||||
|
||||
def local_style_set_c(p):
|
||||
if 'section' in p: return
|
||||
|
||||
cast = style_set_cast(p['style_type'])
|
||||
print("")
|
||||
print("void lv_obj_set_style_" + p['name'].lower() + "(lv_obj_t * obj, " + p['var_type'] +" value, lv_style_selector_t selector)")
|
||||
print("{")
|
||||
print(" lv_style_value_t v = {")
|
||||
print(" ." + p['style_type'] +" = " + cast + "value")
|
||||
print(" };")
|
||||
print(" lv_obj_set_local_style_prop(obj, LV_STYLE_" + p['name'] +", v, selector);")
|
||||
print("}")
|
||||
|
||||
|
||||
def local_style_set_h(p):
|
||||
if 'section' in p: return
|
||||
print("void lv_obj_set_style_" + p['name'].lower() + "(lv_obj_t * obj, " + p['var_type'] +" value, lv_style_selector_t selector);")
|
||||
|
||||
|
||||
def style_const_set(p):
|
||||
if 'section' in p: return
|
||||
|
||||
cast = style_set_cast(p['style_type'])
|
||||
print("")
|
||||
print("#define LV_STYLE_CONST_" + p['name'] + "(val) \\")
|
||||
print(" { \\")
|
||||
print(" .prop = LV_STYLE_" + p['name'] + ", .value = { ." + p['style_type'] +" = " + cast + "val } \\")
|
||||
print(" }")
|
||||
|
||||
|
||||
def docs(p):
|
||||
if "section" in p:
|
||||
print("")
|
||||
print(p['section'])
|
||||
print("-" * len(p['section']))
|
||||
print("")
|
||||
print(p['dsc'])
|
||||
return
|
||||
|
||||
if "default" not in p: return
|
||||
|
||||
d = str(p["default"])
|
||||
|
||||
i = "No"
|
||||
if p["inherited"]: i = "Yes"
|
||||
|
||||
l = "No"
|
||||
if p["layout"]: l = "Yes"
|
||||
|
||||
e = "No"
|
||||
if p["ext_draw"]: e = "Yes"
|
||||
|
||||
li_style = "style='display:inline-block; margin-right: 20px; margin-left: 0px"
|
||||
|
||||
dsc = p['dsc']
|
||||
|
||||
print("")
|
||||
print(p["name"].lower())
|
||||
print("~" * len(p["name"].lower()))
|
||||
print("")
|
||||
print(dsc)
|
||||
|
||||
|
||||
print("")
|
||||
print(".. raw:: html")
|
||||
print("")
|
||||
print(" <ul>")
|
||||
print(" <li " + li_style + "'><strong>Default</strong> " + d + "</li>")
|
||||
print(" <li " + li_style + "'><strong>Inherited</strong> " + i + "</li>")
|
||||
print(" <li " + li_style + "'><strong>Layout</strong> " + l + "</li>")
|
||||
print(" <li " + li_style + "'><strong>Ext. draw</strong> " + e + "</li>")
|
||||
print(" </ul>")
|
||||
|
||||
def guard_proc(p):
|
||||
global guard
|
||||
if 'section' in p:
|
||||
if guard:
|
||||
guard_close()
|
||||
if 'guard' in p:
|
||||
guard = p['guard']
|
||||
print(f"#if {guard}")
|
||||
|
||||
def guard_close():
|
||||
global guard
|
||||
if guard:
|
||||
print(f"#endif /*{guard}*/\n")
|
||||
guard = ""
|
||||
|
||||
base_dir = os.path.abspath(os.path.dirname(__file__))
|
||||
sys.stdout = open(base_dir + '/../src/core/lv_obj_style_gen.h', 'w')
|
||||
|
||||
|
||||
HEADING = f'''
|
||||
/*
|
||||
**********************************************************************
|
||||
* DO NOT EDIT
|
||||
* This file is automatically generated by "{os.path.split(__file__)[-1]}"
|
||||
**********************************************************************
|
||||
*/
|
||||
|
||||
'''
|
||||
|
||||
print(HEADING)
|
||||
print('#ifndef LV_OBJ_STYLE_GEN_H')
|
||||
print('#define LV_OBJ_STYLE_GEN_H')
|
||||
print()
|
||||
print('''\
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
''')
|
||||
print("#include \"../misc/lv_area.h\"")
|
||||
print("#include \"../misc/lv_style.h\"")
|
||||
print("#include \"../core/lv_obj_style.h\"")
|
||||
print("#include \"../misc/lv_types.h\"")
|
||||
print()
|
||||
|
||||
guard = ""
|
||||
for p in props:
|
||||
guard_proc(p)
|
||||
obj_style_get(p)
|
||||
guard_close()
|
||||
|
||||
for p in props:
|
||||
guard_proc(p)
|
||||
local_style_set_h(p)
|
||||
guard_close()
|
||||
|
||||
print()
|
||||
print('''\
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
''')
|
||||
|
||||
print('#endif /* LV_OBJ_STYLE_GEN_H */')
|
||||
|
||||
sys.stdout = open(base_dir + '/../src/core/lv_obj_style_gen.c', 'w')
|
||||
|
||||
print(HEADING)
|
||||
print("#include \"lv_obj.h\"")
|
||||
print()
|
||||
|
||||
for p in props:
|
||||
guard_proc(p)
|
||||
local_style_set_c(p)
|
||||
guard_close()
|
||||
|
||||
sys.stdout = open(base_dir + '/../src/misc/lv_style_gen.c', 'w')
|
||||
|
||||
print(HEADING)
|
||||
print("#include \"lv_style.h\"")
|
||||
print()
|
||||
|
||||
for p in props:
|
||||
guard_proc(p)
|
||||
style_set_c(p)
|
||||
guard_close()
|
||||
|
||||
sys.stdout = open(base_dir + '/../src/misc/lv_style_gen.h', 'w')
|
||||
|
||||
print(HEADING)
|
||||
print('#ifndef LV_STYLE_GEN_H')
|
||||
print('#define LV_STYLE_GEN_H')
|
||||
print()
|
||||
print('''\
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
''')
|
||||
|
||||
for p in props:
|
||||
guard_proc(p)
|
||||
style_set_h(p)
|
||||
guard_close()
|
||||
|
||||
for p in props:
|
||||
guard_proc(p)
|
||||
style_const_set(p)
|
||||
guard_close()
|
||||
|
||||
print()
|
||||
print('''\
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
''')
|
||||
print('#endif /* LV_STYLE_GEN_H */')
|
||||
|
||||
sys.stdout = open(base_dir + '/../docs/overview/style-props.rst', 'w')
|
||||
|
||||
print('================')
|
||||
print('Style properties')
|
||||
print('================')
|
||||
|
||||
for p in props:
|
||||
docs(p)
|
||||
45
libraries/lvgl/scripts/trace_filter.py
Executable file
45
libraries/lvgl/scripts/trace_filter.py
Executable file
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
MARK_LIST = ['tracing_mark_write']
|
||||
|
||||
|
||||
def get_arg():
|
||||
parser = argparse.ArgumentParser(description='Filter a log file to a trace file.')
|
||||
parser.add_argument('log_file', metavar='log_file', type=str,
|
||||
help='The input log file to process.')
|
||||
parser.add_argument('trace_file', metavar='trace_file', type=str, nargs='?',
|
||||
help='The output trace file. If not provided, defaults to \'<log_file>.systrace\'.')
|
||||
|
||||
args = parser.parse_args()
|
||||
return args
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
args = get_arg()
|
||||
|
||||
if not args.trace_file:
|
||||
log_file = Path(args.log_file)
|
||||
args.trace_file = log_file.with_suffix('.systrace').as_posix()
|
||||
|
||||
print('log_file :', args.log_file)
|
||||
print('trace_file:', args.trace_file)
|
||||
|
||||
with open(args.log_file, 'r') as f:
|
||||
content = f.read()
|
||||
|
||||
# compile regex pattern
|
||||
pattern = re.compile(r'(^.+-[0-9]+\s\[[0-9]]\s[0-9]+\.[0-9]+:\s('
|
||||
+ "|".join(MARK_LIST)
|
||||
+ r'):\s[B|E]\|[0-9]+\|.+$)', re.M)
|
||||
|
||||
matches = pattern.findall(content)
|
||||
|
||||
# write to args.trace_file
|
||||
with open(args.trace_file, 'w') as f:
|
||||
f.write('# tracer: nop\n#\n')
|
||||
for match in matches:
|
||||
f.write(match[0] + '\n')
|
||||
176
libraries/lvgl/scripts/update_version.py
Executable file
176
libraries/lvgl/scripts/update_version.py
Executable file
@@ -0,0 +1,176 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import re
|
||||
import argparse
|
||||
|
||||
|
||||
def get_arg():
|
||||
parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter, description=""
|
||||
"Apply the specified version to affected source files. Eg.:\n"
|
||||
" python3 update_version.py 9.1.2-dev\n"
|
||||
" python3 update_version.py 9.2.0"
|
||||
)
|
||||
parser.add_argument('version', metavar='version', type=str,
|
||||
help='The version to apply')
|
||||
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
class Version:
|
||||
RE_PATTERN = r"(\d+)\.(\d+)\.(\d+)(-[\w\d]+)?"
|
||||
|
||||
def __init__(self, user_input: str):
|
||||
|
||||
if not re.match(r'^' + self.RE_PATTERN + r'$', user_input):
|
||||
raise Exception(f"Invalid version format: {user_input}")
|
||||
|
||||
groups = re.search(self.RE_PATTERN, user_input).groups()
|
||||
|
||||
self.major = groups[0]
|
||||
self.minor = groups[1]
|
||||
self.patch = groups[2]
|
||||
self.info = groups[3].lstrip('-') if groups[3] else ""
|
||||
|
||||
self.is_release = len(self.info) == 0
|
||||
self.as_string = user_input
|
||||
|
||||
def __str__(self):
|
||||
return self.as_string
|
||||
|
||||
|
||||
class RepoFileVersionReplacer:
|
||||
DIR_SCRIPTS = os.path.dirname(__file__)
|
||||
DIR_REPO_ROOT = os.path.join(DIR_SCRIPTS, "..")
|
||||
|
||||
def __init__(self, relative_path_segments: list[str], expected_occurrences: int):
|
||||
self.path_relative = os.path.join(*relative_path_segments)
|
||||
self.path = os.path.join(self.DIR_REPO_ROOT, self.path_relative)
|
||||
self.expected_occurrences = expected_occurrences
|
||||
|
||||
def applyVersionToLine(self, line: str, version: Version) -> str | None:
|
||||
return None
|
||||
|
||||
def applyVersion(self, version: Version):
|
||||
with open(self.path, 'r', encoding='utf-8') as file:
|
||||
lines = file.readlines()
|
||||
|
||||
occurrences = 0
|
||||
for i, line in enumerate(lines):
|
||||
line_with_version = self.applyVersionToLine(line, version)
|
||||
if line_with_version:
|
||||
lines[i] = line_with_version
|
||||
occurrences += 1
|
||||
|
||||
# not perfect, but will catch obvious pitfalls
|
||||
if occurrences != self.expected_occurrences:
|
||||
raise Exception(f"Bad lines in {self.path_relative}")
|
||||
|
||||
with open(self.path, 'w', encoding='utf-8') as file:
|
||||
file.writelines(lines)
|
||||
|
||||
|
||||
class PrefixReplacer(RepoFileVersionReplacer):
|
||||
|
||||
def __init__(self, relative_path_segments: list[str], prefix: str, expected_occurrences=1):
|
||||
super().__init__(relative_path_segments, expected_occurrences)
|
||||
self.prefix = prefix
|
||||
|
||||
def applyVersionToLine(self, line: str, version: Version):
|
||||
pattern = r'(' + re.escape(self.prefix) + ')' + Version.RE_PATTERN
|
||||
repl = r'\g<1>' + str(version)
|
||||
replaced, n = re.subn(pattern, repl, line)
|
||||
return replaced if n > 0 else None
|
||||
|
||||
|
||||
class MacroReplacer(RepoFileVersionReplacer):
|
||||
def __init__(self, relative_path_segments: list[str]):
|
||||
super().__init__(relative_path_segments, 4)
|
||||
|
||||
def applyVersionToLine(self, line: str, version: Version):
|
||||
targets = {
|
||||
'LVGL_VERSION_MAJOR': version.major,
|
||||
'LVGL_VERSION_MINOR': version.minor,
|
||||
'LVGL_VERSION_PATCH': version.patch,
|
||||
'LVGL_VERSION_INFO': version.info,
|
||||
}
|
||||
|
||||
for key, val in targets.items():
|
||||
pattern = self.getPattern(key)
|
||||
repl = self.getReplacement(val)
|
||||
replaced, n = re.subn(pattern, repl, line)
|
||||
if n > 0:
|
||||
return replaced
|
||||
|
||||
return None
|
||||
|
||||
def getPattern(self, key: str):
|
||||
return r'(^#define ' + key + r' +).+'
|
||||
|
||||
def getReplacement(self, val: str):
|
||||
if not val.isnumeric():
|
||||
val = f'"{val}"'
|
||||
|
||||
return r'\g<1>' + val
|
||||
|
||||
|
||||
class CmakeReplacer(MacroReplacer):
|
||||
def getPattern(self, key: str):
|
||||
return r'(^set\(' + key + r' +")([^"]*)(.+)'
|
||||
|
||||
def getReplacement(self, val: str):
|
||||
return r'\g<1>' + val + r'\g<3>'
|
||||
|
||||
class KconfigReplacer(RepoFileVersionReplacer):
|
||||
"""Replace version info in Kconfig file"""
|
||||
|
||||
def __init__(self, relative_path_segments: list[str]):
|
||||
super().__init__(relative_path_segments, 3)
|
||||
|
||||
def applyVersionToLine(self, line: str, version: Version):
|
||||
targets = {
|
||||
'LVGL_VERSION_MAJOR': version.major,
|
||||
'LVGL_VERSION_MINOR': version.minor,
|
||||
'LVGL_VERSION_PATCH': version.patch,
|
||||
}
|
||||
|
||||
for key, val in targets.items():
|
||||
pattern = self.getPattern(key)
|
||||
repl = self.getReplacement(val)
|
||||
replaced, n = re.subn(pattern, repl, line)
|
||||
if n > 0:
|
||||
return replaced
|
||||
|
||||
return None
|
||||
def getPattern(self, key: str):
|
||||
# Match the version fields in Kconfig file
|
||||
return rf'(^\s+default\s+)(\d+) # ({key})'
|
||||
|
||||
def getReplacement(self, val: str):
|
||||
# Replace the version value
|
||||
return r'\g<1>' + val + r' # \g<3>'
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
args = get_arg()
|
||||
|
||||
version = Version(args.version)
|
||||
print(f"Applying version {version} to:")
|
||||
|
||||
targets = [
|
||||
MacroReplacer(['lv_version.h']),
|
||||
CmakeReplacer(['env_support', 'cmake', 'version.cmake']),
|
||||
PrefixReplacer(['lv_conf_template.h'], 'Configuration file for v'),
|
||||
KconfigReplacer(['Kconfig']),
|
||||
]
|
||||
|
||||
if version.is_release:
|
||||
targets.extend([
|
||||
PrefixReplacer(['library.json'], '"version": "'),
|
||||
PrefixReplacer(['library.properties'], 'version='),
|
||||
PrefixReplacer(['Kconfig'], 'Kconfig file for LVGL v'),
|
||||
])
|
||||
|
||||
for target in targets:
|
||||
print(f" - {target.path_relative}")
|
||||
target.applyVersion(version)
|
||||
Reference in New Issue
Block a user