Pythonista UI constraints driven by the Key Value Observing (KVO) protocol
Project description
Pythonista UI constraints driven by the Key Value Observing (KVO) protocol
History
First version of UI constraints for Pythonista were created as a wrapper around Apple NSLayoutConstraint class. While functional, it suffered from the same restrictions as the underlying Apple class, and was somewhat inconvenient to develop with, due to the "either frames or constraints" mindset and some mystical crashes.
Second version was built on top of the scripter, utilizing the ui.View
update
method that gets called several times a second. Constraints could now be designed freely, and this version acted as an excellent proof of concept. There was the obvious performance concern due to the constraints being checked constantly, even if nothing was happening in the UI – easily few thousand small checks per second for a realistic UI.
This version replaces the update
method with the KVO (Key Value Observing) protocol, running the constraint checks only when the position or the frame of the view changes. Thus we avoid the performance overhead while retaining the freedom of custom constraints.
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
Hashes for pythonista-anchors-2020.7.23.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b423c4a6d048b54aa3679d413b3563e95bafa6539bbc5b816f5ec4f318d778b |
|
MD5 | 9a956b3ec98ec9e2ae810935d667b5f5 |
|
BLAKE2b-256 | 85f621d7cb4f319a710ea8a6d426dc36d847b31b61a73ea8b288c4613ce0c9ad |
Hashes for pythonista_anchors-2020.7.23-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 01be9a3ccd9ad9c7fb79c0dea1225c8179bece5d8b914a358319d8dce74e87a6 |
|
MD5 | bc25c1c62277f4f9a7a1bd3283b66737 |
|
BLAKE2b-256 | b7d06ece42bd316dcd2da5032b9bc69ed37c09bf86e8b31b3ef05a498bdc828b |