Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use generated loading pages #110

Merged
merged 2 commits into from
Jun 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ dmypy.json

# ignores specific to this project.
*.whl
src/*.dist-info
src/kolibri_app/assets
# generated files
tmpenv
whl
Expand Down
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,17 @@ install-whl:
# This doesn't exist in 0.15, so don't error if it doesn't exist.
echo "3.3.1" > kolibrisrc/kolibri/dist/importlib_resources/version.txt || true

loading-pages: needs-version
PYTHONPATH=$$PYTHONPATH:./kolibrisrc python -m kolibri manage loadingpage --output-dir src/kolibri_app/assets --version-text "${KOLIBRI_VERSION}-${APP_VERSION}"

get-whl: clean-whl
# The eval and shell commands here are evaluated when the recipe is parsed, so we put the cleanup
# into a prerequisite make step, in order to ensure they happen prior to the download.
$(eval DLFILE = $(shell wget --content-disposition -P whl/ "${whl}" 2>&1 | grep "Saving to: " | sed 's/Saving to: ‘//' | sed 's/’//'))
$(eval WHLFILE = $(shell echo "${DLFILE}" | sed "s/\?.*//"))
[ "${DLFILE}" = "${WHLFILE}" ] || mv "${DLFILE}" "${WHLFILE}"
$(MAKE) install-whl whl="${WHLFILE}"
$(MAKE) loading-pages

dependencies:
PYINSTALLER_COMPILE_BOOTLOADER=1 pip3 install -r build_requires.txt --no-binary pyinstaller
Expand Down Expand Up @@ -109,3 +113,7 @@ notarize-dmg: needs-version
$(MAKE) guard-MAC_NOTARIZE_USERNAME
$(MAKE) guard-MAC_NOTARIZE_PASSWORD
./notarize-dmg.sh "./dist/kolibri-${KOLIBRI_VERSION}-${APP_VERSION}.dmg"


run-dev:
PYTHONPATH=$$PYTHONPATH:./kolibrisrc python -m kolibri_app
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Once you have downloaded and installed the Kolibri whl file, run `make pyinstall

#### Running the app from source

`python -m kolibri_app`
`make run-dev`

#### Creating a native app for testing

Expand Down
340 changes: 0 additions & 340 deletions src/kolibri_app/assets/_load-ar.html

This file was deleted.

340 changes: 0 additions & 340 deletions src/kolibri_app/assets/_load-bg.html

This file was deleted.

340 changes: 0 additions & 340 deletions src/kolibri_app/assets/_load-bn.html

This file was deleted.

340 changes: 0 additions & 340 deletions src/kolibri_app/assets/_load-en_US.html

This file was deleted.

340 changes: 0 additions & 340 deletions src/kolibri_app/assets/_load-es_ES.html

This file was deleted.

340 changes: 0 additions & 340 deletions src/kolibri_app/assets/_load-fa.html

This file was deleted.

340 changes: 0 additions & 340 deletions src/kolibri_app/assets/_load-fr.html

This file was deleted.

340 changes: 0 additions & 340 deletions src/kolibri_app/assets/_load-fv.html

This file was deleted.

340 changes: 0 additions & 340 deletions src/kolibri_app/assets/_load-gu_IN.html

This file was deleted.

340 changes: 0 additions & 340 deletions src/kolibri_app/assets/_load-hi.html

This file was deleted.

340 changes: 0 additions & 340 deletions src/kolibri_app/assets/_load-ko.html

This file was deleted.

340 changes: 0 additions & 340 deletions src/kolibri_app/assets/_load-la.html

This file was deleted.

340 changes: 0 additions & 340 deletions src/kolibri_app/assets/_load-mr.html

This file was deleted.

340 changes: 0 additions & 340 deletions src/kolibri_app/assets/_load-my.html

This file was deleted.

340 changes: 0 additions & 340 deletions src/kolibri_app/assets/_load-ny.html

This file was deleted.

340 changes: 0 additions & 340 deletions src/kolibri_app/assets/_load-pt_BR.html

This file was deleted.

340 changes: 0 additions & 340 deletions src/kolibri_app/assets/_load-sw_TZ.html

This file was deleted.

340 changes: 0 additions & 340 deletions src/kolibri_app/assets/_load-te.html

This file was deleted.

340 changes: 0 additions & 340 deletions src/kolibri_app/assets/_load-tl.html

This file was deleted.

340 changes: 0 additions & 340 deletions src/kolibri_app/assets/_load-ur_PK.html

This file was deleted.

340 changes: 0 additions & 340 deletions src/kolibri_app/assets/_load-vi.html

This file was deleted.

340 changes: 0 additions & 340 deletions src/kolibri_app/assets/_load-yo.html

This file was deleted.

340 changes: 0 additions & 340 deletions src/kolibri_app/assets/_load.html

This file was deleted.

Binary file removed src/kolibri_app/assets/launch-image.png
Binary file not shown.
Binary file removed src/kolibri_app/assets/loading-spinner.gif
Binary file not shown.
4 changes: 2 additions & 2 deletions src/kolibri_app/i18n.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
)

if not languages:
languages = ["en_US"]
languages = ["en"]

nelangs = []
for lang in languages:
Expand Down Expand Up @@ -50,7 +50,7 @@
# trigger the exception handling fallback if locale_info doesn't have a language key.
if "language" not in locale_info:
# Fallback to English and if we fail to find any language catalogs.
locale_info["language"] = "en_US"
locale_info["language"] = "en"
_ = t.gettext

logging.debug("Locale info = {}".format(locale_info))
11 changes: 6 additions & 5 deletions src/kolibri_app/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from io import BytesIO

import wx
from django.utils.translation.trans_real import to_language
from wx import html2

from kolibri_app.constants import APP_NAME
Expand All @@ -17,21 +18,21 @@

html2.WebView.MSWSetEmulationLevel(html2.WEBVIEWIE_EMU_IE11)

LOADER_PAGE_TEMPLATE = "_load-{}.html"
LOADER_PAGE = "loading.html"


class LoadingHandler(wx.html2.WebViewHandler):
def __init__(self):
wx.html2.WebViewHandler.__init__(self, "loading")
lang_id = locale_info["language"]
lang_id = to_language(locale_info["language"])
asset_files = files("kolibri_app") / "assets"
loader_page = asset_files / LOADER_PAGE_TEMPLATE.format(lang_id)
loader_page = asset_files / lang_id / LOADER_PAGE
if not loader_page.is_file():
lang_id = lang_id.split("-")[0]
loader_page = asset_files / LOADER_PAGE_TEMPLATE.format(lang_id)
loader_page = asset_files / lang_id / LOADER_PAGE
if not loader_page.is_file():
# if we can't find anything in the given language, default to the English loading page.
loader_page = asset_files / LOADER_PAGE_TEMPLATE.format("en_US")
loader_page = asset_files / "en" / LOADER_PAGE
with loader_page.open("rb") as f:
self.loader_page = f.read()

Expand Down