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 widgetUI
- 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file kaki-0.1.7.tar.gz
.
File metadata
- Download URL: kaki-0.1.7.tar.gz
- Upload date:
- Size: 8.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 39e868b86a55fe3e97e421d7414ebe86e6431f8fca1206383c5b519e1014ba14 |
|
MD5 | e0794e9822e7424906534fc2469df745 |
|
BLAKE2b-256 | 027d10cbf89d603743fd0e71e6a4ab3226dea840fba96b95895fa1dd57aec737 |
File details
Details for the file kaki-0.1.7-py2.py3-none-any.whl
.
File metadata
- Download URL: kaki-0.1.7-py2.py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2916a4fc0d7aa351e28f97be4eff9ae983cd192a2e8e078fbd0a92a55f0a2ae2 |
|
MD5 | fb1167c102f9b67b538c7da56a12159e |
|
BLAKE2b-256 | bdff54647ebbd3e079523a4407269e49933409b04de11aee57dea1f2fa4385c3 |