PedalPi - PluginsManager - Util

pluginsmanager.util.observable_list.ObservableList

class pluginsmanager.util.observable_list.ObservableList(lista=None)[source]

Detects changes in list.

In append, in remove and in setter, the observer is callable with changes details

Based in https://www.pythonsheets.com/notes/python-basic.html#emulating-a-list

__contains__(item)[source]

See __contains__ list

__delitem__(sliced)[source]

See __delitem__ list method

Calls observer self.observer(UpdateType.DELETED, item, index) where item is self[index]

__iter__()[source]

See __iter__ list

__repr__()[source]

See __repr__ list

__setitem__(index, val)[source]

See __setitem__ list method

Calls observer self.observer(UpdateType.UPDATED, item, index) if val != self[index]

__str__()[source]

See __repr__ list

__weakref__

list of weak references to the object (if defined)

append(item)[source]

See append list method

Calls observer self.observer(UpdateType.CREATED, item, index) where index is item position

insert(index, x)[source]

See insert list method

Calls observer self.observer(UpdateType.CREATED, item, index)

pop(index=None)[source]

Remove the item at the given position in the list, and return it. If no index is specified, a.pop() removes and returns the last item in the list.

Parameters:index (int) – element index that will be removed
Returns:item removed
remove(item)[source]

See remove list method

Calls observer self.observer(UpdateType.DELETED, item, index) where index is item position