1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-28 07:03:00 +08:00
This commit is contained in:
Gabor Kiss-Vamosi 2021-05-05 17:16:23 +02:00
commit 7cbf97afd0
12 changed files with 95 additions and 74 deletions

View File

@ -3,6 +3,9 @@ on:
push:
branches:
- master
env:
EM_VERSION: 2.0.4
EM_CACHE_FOLDER: 'emsdk-cache'
jobs:
build-and-deploy:
if: github.repository == 'lvgl/lvgl'
@ -17,11 +20,36 @@ jobs:
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install Doxygen
run: sudo apt-get install doxygen
- name: Cache Python packages
uses: actions/cache@v2
with:
# Cache the Python package environment, excluding pip and setuptools installed by setup-python
path: |
~/.cache/pip
${{ env.pythonLocation }}/bin/*
${{ env.pythonLocation }}/include
${{ env.pythonLocation }}/lib/python*/site-packages/*
!${{ env.pythonLocation }}/bin/pip*
!${{ env.pythonLocation }}/lib/python*/site-packages/pip*
!${{ env.pythonLocation }}/lib/python*/site-packages/setuptools*
key: ${{ env.pythonLocation }}
- name: Install Doxygen and Latex dependencies
run: sudo apt-get install doxygen texlive-xetex
- name: Install requirements
run: |
pip install --upgrade --upgrade-strategy eager sphinx recommonmark commonmark breathe sphinx-rtd-theme sphinx-markdown-tables sphinx-sitemap
- name: Setup Emscripten cache
id: cache-system-libraries
uses: actions/cache@v2
with:
path: ${{env.EM_CACHE_FOLDER}}
key: ${{env.EM_VERSION}}-${{ runner.os }}
- uses: mymindstorm/setup-emsdk@v9
with:
version: ${{env.EM_VERSION}}
actions-cache-folder: ${{env.EM_CACHE_FOLDER}}
- name: Build examples
run: scripts/build_html_examples.sh
- name: Build docs
run: docs/build.py
- name: Remove .doctrees

4
.gitignore vendored
View File

@ -8,5 +8,9 @@ scripts/cppcheck_res.txt
scripts/built_in_font/lv_font_*
docs/doxygen_html
docs/xml
docs/out_latex
docs/_static/built_lv_examples
docs/LVGL.pdf
out_html
__pycache__
/emscripten_builder

View File

@ -55,7 +55,6 @@ menu "LVGL configuration"
config LV_COLOR_CHROMA_KEY_HEX
hex "Images pixels with this color will not be drawn (if they are chroma keyed)."
depends on LV_COLOR_SCREEN_TRANSP
range 0x000000 0xFFFFFF
default 0x00FF00
help

View File

@ -16,16 +16,19 @@ class LvExample(Directive):
if self.arguments[2] == 'py':
paragraph_node = nodes.raw(text=f"Click to try in the simulator!<br/><a target='_blank' href='https://sim.lvgl.io/v7/micropython/ports/javascript/bundle_out/index.html?script_startup=https://raw.githubusercontent.com/lvgl/lv_examples/{env.config.example_commit_hash}/src/header.py&script=https://raw.githubusercontent.com/lvgl/lv_examples/{env.config.built_example_commit_hash}/{example_name}/{example_name}.py'><img alt='{example_name}' src='https://raw.githubusercontent.com/lvgl/lv_examples/{env.config.built_example_commit_hash}/{example_name}/{example_name}.png'/></a>", format='html')
else:
paragraph_node = nodes.raw(text=f"<iframe class='lv-example' src='../_static/built_lv_examples/{example_name}/?w=320&h=240'></iframe>", format='html')
paragraph_node = nodes.raw(text=f"<iframe class='lv-example' src='../../_static/built_lv_examples?example={example_name}&w=320&h=240'></iframe>", format='html')
toggle = nodes.container('', literal_block=False, classes=['toggle'])
header = nodes.container('', literal_block=False, classes=['header'])
toggle.append(header)
example_file = os.path.abspath("lv_examples/src/" + example_path + "." + self.arguments[2])
example_file = os.path.abspath("../examples/" + example_path + "." + self.arguments[2])
with open(example_file) as f:
contents = f.read()
literal_list = nodes.literal_block(contents, contents)
literal_list['language'] = self.arguments[2]
try:
with open(example_file) as f:
contents = f.read()
except FileNotFoundError:
contents = 'Error encountered while trying to open ' + example_file
literal_list = nodes.literal_block(contents, contents)
literal_list['language'] = self.arguments[2]
toggle.append(literal_list)
header.append(nodes.paragraph(text="code"))
if env.app.tags.has('html'):

View File

@ -57,12 +57,12 @@ cmd("cd ../scripts && doxygen Doxyfile")
# Silly workarond to include the more or less correct PDF download link in the PDF
#cmd("cp -f " + lang +"/latex/LVGL.pdf LVGL.pdf | true")
#cmd("sphinx-build -b latex . en/latex")
cmd("sphinx-build -b latex . out_latex")
# Generat PDF
#cmd("cd " + lang + "/latex && xelatex -interaction=batchmode *.tex")
# Copy the result PDF to the main diractory to make it avaiable for the HTML build
#cmd("cd " + lang + "/latex && cp -f LVGL.pdf ../../LVGL.pdf")
# Generate PDF
cmd("cd out_latex && xelatex -interaction=batchmode *.tex")
# Copy the result PDF to the main directory to make it avaiable for the HTML build
cmd("cd out_latex && cp -f LVGL.pdf ../LVGL.pdf")
# BULD HTML
cmd("sphinx-build -b html . ../out_html")

View File

@ -43,7 +43,7 @@ extensions = ['sphinx.ext.autodoc',
'sphinx_markdown_tables',
'breathe',
'sphinx_sitemap',
#'lv_example'
'lv_example'
]
# Add any paths that contain templates here, relative to this directory.
@ -67,7 +67,7 @@ master_doc = 'index'
# General information about the project.
project = 'LVGL'
copyright = '2020, LVGL LLC'
author = 'The community of LVGL'
author = 'LVGL community'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
@ -169,8 +169,6 @@ latex_elements = {
'preamble': r'''
\usepackage{fontspec}
\setmonofont{DejaVu Sans Mono}
\usepackage{xeCJK}
\setCJKmainfont{SimSun}
\usepackage{silence}
\WarningsOff*
''',
@ -181,7 +179,7 @@ latex_elements = {
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'LVGL.tex', 'LVGL Documentation ' + version,
'Contributors of LVGL', 'manual'),
'LVGL community', 'manual'),
]
@ -230,28 +228,3 @@ def setup(app):
app.add_transform(AutoStructify)
app.add_stylesheet('css/custom.css')
app.add_stylesheet('css/fontawesome.min.css')
# Attempt to checkout _static/built_lv_examples
"""
if not os.path.exists('_static/built_lv_examples'):
os.system('git clone https://github.com/lvgl/lv_examples.git _static/built_lv_examples')
os.system('git -C _static/built_lv_examples fetch origin')
out = subprocess.Popen(["git", "-C", "lv_examples", "rev-parse", "HEAD"],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
stdout,stderr = out.communicate()
example_commit_hash = stdout.decode("utf-8").strip()
search_command = ["git", "-C", "_static/built_lv_examples", "--no-pager", "log", "--pretty=format:'%H'", "--all", "-n", "1", f"--grep='Deploying to gh-pages from @ {example_commit_hash}'"]
log_output = subprocess.check_output(' '.join(search_command), shell=True).strip().decode("utf-8")
if len(log_output) == 0:
raise ValueError('lv_examples: cannot find corresponding deployed commit: ' + example_commit_hash)
built_example_commit_hash = log_output
os.system('git -C _static/built_lv_examples reset --hard')
os.system('git -C _static/built_lv_examples checkout ' + log_output)
"""

View File

@ -3,6 +3,11 @@
:github_url: |github_link_base|/index.md
```
```eval_rst
PDF version: :download:`LVGL.pdf <LVGL.pdf>`
```
# Welcome to the documentation of LVGL!
<img src="_static/img/home_banner.jpg" style="width:100%">

View File

@ -168,31 +168,6 @@ To describe opacity the `lv_opa_t` type is created as a wrapper to `uint8_t`. So
You can also use the `LV_OPA_*` defines in `lv_color_mix()` as a *ratio*.
### Built-in colors
The color module defines the most basic colors such as:
- ![#FFFFFF](https://placehold.it/15/ffffff/ffffff?text=+) `LV_COLOR_WHITE`
- ![#000000](https://placehold.it/15/000000/000000?text=+) `LV_COLOR_BLACK`
- ![#808080](https://placehold.it/15/808080/000000?text=+) `LV_COLOR_GRAY`
- ![#c0c0c0](https://placehold.it/15/c0c0c0/000000?text=+) `LV_COLOR_SILVER`
- ![#ff0000](https://placehold.it/15/ff0000/000000?text=+) `LV_COLOR_RED`
- ![#800000](https://placehold.it/15/800000/000000?text=+) `LV_COLOR_MAROON`
- ![#00ff00](https://placehold.it/15/00ff00/000000?text=+) `LV_COLOR_LIME`
- ![#008000](https://placehold.it/15/008000/000000?text=+) `LV_COLOR_GREEN`
- ![#808000](https://placehold.it/15/808000/000000?text=+) `LV_COLOR_OLIVE`
- ![#0000ff](https://placehold.it/15/0000ff/000000?text=+) `LV_COLOR_BLUE`
- ![#000080](https://placehold.it/15/000080/000000?text=+) `LV_COLOR_NAVY`
- ![#008080](https://placehold.it/15/008080/000000?text=+) `LV_COLOR_TEAL`
- ![#00ffff](https://placehold.it/15/00ffff/000000?text=+) `LV_COLOR_CYAN`
- ![#00ffff](https://placehold.it/15/00ffff/000000?text=+) `LV_COLOR_AQUA`
- ![#800080](https://placehold.it/15/800080/000000?text=+) `LV_COLOR_PURPLE`
- ![#ff00ff](https://placehold.it/15/ff00ff/000000?text=+) `LV_COLOR_MAGENTA`
- ![#ffa500](https://placehold.it/15/ffa500/000000?text=+) `LV_COLOR_ORANGE`
- ![#ffff00](https://placehold.it/15/ffff00/000000?text=+) `LV_COLOR_YELLOW`
as well as `LV_COLOR_WHITE` (fully white).
## API

View File

@ -29,12 +29,12 @@ void lv_example_style_1(void);
void lv_example_style_2(void);
void lv_example_style_3(void);
void lv_example_style_4(void);
void lv_example_style_5(void);
void lv_example_style_6(void);
//void lv_example_style_5(void);
//void lv_example_style_6(void);
void lv_example_style_7(void);
void lv_example_style_8(void);
void lv_example_style_9(void);
void lv_example_style_10(void);
//void lv_example_style_10(void);
void lv_example_style_11(void);
/**********************

View File

@ -4,13 +4,13 @@ C
Simple Arc
""""""""""""""""
.. lv_example:: widgets/arc/lv_arc_example_1
.. lv_example:: widgets/arc/lv_example_arc_1
:language: c
Loader with Arc
""""""""""""""""
.. lv_example:: widgets/arc/lv_arc_example_2
.. lv_example:: widgets/arc/lv_example_arc_2
:language: c
MicroPython

19
scripts/build_html_examples.sh Executable file
View File

@ -0,0 +1,19 @@
#!/bin/bash
set -e
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 ..
git submodule update --init -- lv_drivers
mkdir cmbuild
cd cmbuild
emcmake cmake .. -DLVGL_CHOSEN_DEMO=lv_example_noop
make -j$(nproc)
rm -rf CMakeFiles
cd ../..
cp -a emscripten_builder/cmbuild docs/_static/built_lv_examples

15
scripts/genexamplelist.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/bash
echo "/* Autogenerated */"
echo '#include <stddef.h>'
echo '#include "examplelist.h"'
TMPFILE=$(mktemp)
find examples -name \*.h | xargs grep -h "^void lv_example" | 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 "};"