Skip to main content

Kivy application library on steroids

Project description

Kaki - Advanced application library for Kivy

This library enhance Kivy frameworks with opiniated features such as:

  • Auto reloading kv or py (watchdog required, limited to some uses cases)
  • Idle detection support
  • Foreground lock (windows only)

Example

This is a bootstrap that will:

  • automatically declare the module live.ui (live/ui.py) as a provider for the widget UI
  • build the application widget, and show it to a window

If the bootstrap is started with the environment variable DEBUG=1, it will start a watchdog, and listen for changes, according to AUTORELOADER_PATHS. When something changes, the current application widget will be cleared out, and a new one will be instanciated, after reloading.

from kaki.app import App
from kivy.factory import Factory

class Live(App):
    CLASSES = {
        "UI": "live.ui"
    }
    AUTORELOADER_PATHS = [
        (".", {"recursive": True}),
    ]
    def build_app(self):
        return Factory.UI()

Live().run()

Application class configuration

#: Control either we activate debugging in the app or not
#: Defaults depend if "DEBUG" exists in os.environ
DEBUG = "DEBUG" in os.environ

#: If true, it will require the foreground lock on windows
FOREGROUND_LOCK = False

#: List of KV files under management for auto reloader
KV_FILES = []

#: List of path to watch for autoreloading
AUTORELOADER_PATHS = [
    # (".", {"recursive": False}),
]

#: List of extensions to ignore
AUTORELOADER_IGNORE_PATTERNS = [
    "*.pyc", "*__pycache__*"]

#: Factory classes managed by kaki
CLASSES = {}

#: Idle detection (if True, event on_idle/on_wakeup will be fired)
#: Rearming idle can also be done with rearm_idle()
IDLE_DETECTION = False

#: Default idle timeout
IDLE_TIMEOUT = 60

#: Raise error
#: When the DEBUG is activated, it will raise any error instead
#: of showing it on the screen. If you still want to show the error
#: when not in DEBUG, put this to False
RAISE_ERROR = True

Idle Management

If configuration IDLE_DETECTION is True, then it will automatically listen for touch down/move. When no event happen, after IDLE_TIMEOUT seconds, it will trigger the on_idle event on the application class. As soon as a touch event occurs, on_wakeup event will be triggered on the application class.

If you are playing video on want to not trigger the idle detection, use rearm_idle on the application class to rearm the detection from 0 seconds.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kaki-0.1.5.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

kaki-0.1.5-py2.py3-none-any.whl (7.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file kaki-0.1.5.tar.gz.

File metadata

  • Download URL: kaki-0.1.5.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.25.1 requests-toolbelt/0.9.1 urllib3/1.26.6 tqdm/4.61.2 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.5

File hashes

Hashes for kaki-0.1.5.tar.gz
Algorithm Hash digest
SHA256 4fcab3fdd1564f54fec8b3016a6585f7f2ad960f16ee074c94482e06f0fb113e
MD5 bddf6e2626dadf2a9556f7843a19b624
BLAKE2b-256 244537597de76c7a24266a4386c74da9cbef08c423c55d001fb8a876400d88ea

See more details on using hashes here.

File details

Details for the file kaki-0.1.5-py2.py3-none-any.whl.

File metadata

  • Download URL: kaki-0.1.5-py2.py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.25.1 requests-toolbelt/0.9.1 urllib3/1.26.6 tqdm/4.61.2 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.5

File hashes

Hashes for kaki-0.1.5-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 26205363dd178bc679bef9448ce1b9c5091bb4c41b7fd02dfa749a0952eed74b
MD5 d36e25c43e675bcc99570a36d13f75f4
BLAKE2b-256 ea2a28873b51a912c814dc8e5b266333221da30287ab4cd9c5c0c1af883e7940

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page