Introduce observable collections
New Features
- New observable collections.
ObservableList[S]lets you collect stuff in a list which you can observe for changes.ValueList[S]lets you addValue[S], of which changes you will also be notified when observing the collection - Also Added
ObservableIntList,IntValueList,ObservableStrListandStrValueList, which provide useful helper methods Variable[S]not hasset_delay_notify, a context manager which allows you to set a value, but not have its listeners notified immediately- New classes
ValuesObservableandValuesEvent, which allows observing iterables, either as anIterableor as each individual element - Added
emit_lazymethod to allEvents, allowing you to create values, only when the event really is listened to Observables now have variousmapmethods, to map to other observers from other Observables with a mapping function. Events will know if all their observers are themselves unobservedObservables and not emit even then.Value[S]s can now additionally be observed with functions that take two parameters. In that case, the first is the new value and the second is the old value
Improvements
- Deriving
Values from otherValues will return a Constant if it is derived from only constants Constantare now equal to each other if their value is equal
Bug fixes
None
Breaking Changes
Value[S]s are no longerObservablethemselves. Instead, they now provide aobservableproperty- Renamed
Value[S].is_dependent_ontoValue[S].is_derived_from