diff --git a/.github/workflows/compile_docs.yml b/.github/workflows/compile_docs.yml index 1b3dcdb5a..3df3829e5 100644 --- a/.github/workflows/compile_docs.yml +++ b/.github/workflows/compile_docs.yml @@ -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 diff --git a/.gitignore b/.gitignore index 6ffdc9de5..ebdfb3f26 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/Kconfig b/Kconfig index 56691a9c4..65b9918b4 100644 --- a/Kconfig +++ b/Kconfig @@ -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 diff --git a/docs/_ext/lv_example.py b/docs/_ext/lv_example.py index 9e0cde96a..4e5557d44 100644 --- a/docs/_ext/lv_example.py +++ b/docs/_ext/lv_example.py @@ -16,16 +16,19 @@ class LvExample(Directive): if self.arguments[2] == 'py': paragraph_node = nodes.raw(text=f"Click to try in the simulator!
{example_name}", format='html') else: - paragraph_node = nodes.raw(text=f"", format='html') + paragraph_node = nodes.raw(text=f"", 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'): diff --git a/docs/build.py b/docs/build.py index 3919be80c..a1db5c1a1 100755 --- a/docs/build.py +++ b/docs/build.py @@ -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") diff --git a/docs/conf.py b/docs/conf.py index e8bda51ee..ab2ad52e2 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -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) - """ diff --git a/docs/index.md b/docs/index.md index 0f8e3845f..8f540e71b 100644 --- a/docs/index.md +++ b/docs/index.md @@ -3,6 +3,11 @@ :github_url: |github_link_base|/index.md ``` +```eval_rst + +PDF version: :download:`LVGL.pdf ` +``` + # Welcome to the documentation of LVGL! diff --git a/docs/overview/display.md b/docs/overview/display.md index 64c1fb2bc..b049c931f 100644 --- a/docs/overview/display.md +++ b/docs/overview/display.md @@ -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 diff --git a/examples/styles/lv_example_style.h b/examples/styles/lv_example_style.h index d2fe3493e..39b007dca 100644 --- a/examples/styles/lv_example_style.h +++ b/examples/styles/lv_example_style.h @@ -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); /********************** diff --git a/examples/widgets/arc/index.rst b/examples/widgets/arc/index.rst index 8c8474555..ef4b5d5b9 100644 --- a/examples/widgets/arc/index.rst +++ b/examples/widgets/arc/index.rst @@ -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 diff --git a/scripts/build_html_examples.sh b/scripts/build_html_examples.sh new file mode 100755 index 000000000..d8da85cff --- /dev/null +++ b/scripts/build_html_examples.sh @@ -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 diff --git a/scripts/genexamplelist.sh b/scripts/genexamplelist.sh new file mode 100755 index 000000000..a52049925 --- /dev/null +++ b/scripts/genexamplelist.sh @@ -0,0 +1,15 @@ +#!/bin/bash +echo "/* Autogenerated */" +echo '#include ' +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 "};"