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-1.0.0.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

gso-1.0.0-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for gso-1.0.0.tar.gz
Algorithm Hash digest
SHA256 f522d9b1dbcc00fce8265d819803e9da17139dae0946a7409552caa0458a12c0
MD5 85c24e8455c18d031be19e1756f35116
BLAKE2b-256 1baab69cec7a8822ff401be1dd7d15b0bafe0d3f8a7cb3344c133b57c30a1574

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for gso-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0588925ddd0156ff645a16c88fffc4f8eea30ea11fbd5a7b29acbfcb2cdf4cbd
MD5 500e5de44a8e8d143729e87709bca789
BLAKE2b-256 eb9c4d4e5db0c40cec0e0698a291c25e3bd37f988bfa9db01fcbb9497056227d

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