Skip to main content

Provides simple interfaces that helps manage and centralize application state.

Project description

Global State Observer

GSO is an open-source Python library for managing state. It provides simple interfaces that application data objects and UI elements can easily implement to facilitate syncing them together. It is based on the Observer pattern, and it is inspired by Redux.js.

GSO was originally designed to be used with GUIs built using PySide/PyQt, but it should work with any class-based UI thanks to its abstractness.

How to use

  • UI elements should implement the Observer interface, and override the notify(action) method, to update their UI state based on the action.

  • Application state should be encapsulated in a class called State. It should hold all observable pieces of data and have a single method: dispatch(action).

  • The dispatch(action) method on the State class should be called from the UI elements as a result of a user interaction.

  • An Action is an object that describes a UI event that is fired with the intent of changing application state.

  • An observable piece of data is any value (or collection of values) in the application state that UI elements depend on.

  • Any piece of observable data should be encapsulated in a class that implements the Observable interface, and have any number of methods for updating its values.

  • Every update method on an observable piece of data should use the protected member _value in updating, and the protected method of the Observable interface: notify(action), to notify all the attached observers with the update.

  • UI elements should observe the observable pieces of data they depend on, this should be done by calling the attach_observer(observer) method on Observables and passing the UI elements as arguments.

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

gso-0.0.1.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

gso-0.0.1-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file gso-0.0.1.tar.gz.

File metadata

  • Download URL: gso-0.0.1.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for gso-0.0.1.tar.gz
Algorithm Hash digest
SHA256 a053ecdc45d140f14d39eec00da6df0562be5b2f64220b4d65c3ad2bdec11604
MD5 c7d64cce0559eb20e63f6e18bbebdec2
BLAKE2b-256 8dcb05ddbf5b16e9ae1b823330db0c72d3860a1ad7ed6d664dcb014e16558554

See more details on using hashes here.

File details

Details for the file gso-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: gso-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for gso-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 80a7c9e44f9bbb3e34ab7d1a2c7c1febd330319739baf8c5da83494f8a082e57
MD5 aeb9c82ab904d9afefec78af76c9b296
BLAKE2b-256 9f600eb600bb7138f38745500276ae566792caa34bdc4ea6bdcaa2c2ca642dba

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