iblviewer.collection
Classes
- class Collection[source]
Bases:
collections.OrderedDict
- current = None
- current_key_id = 0
- targets = []
- set_current(target)[source]
Set the current data
- Parameters
key_or_id – A valid key or an int or the data
object itself
- next(loop=False)[source]
Set the next data as current one
- Parameters
loop – Whether looping is enabled, which means that if next value is out of range, we start back at 0
- previous(loop=False)[source]
Set the previous data as current one
- Parameters
loop – Whether looping is enabled, which means that if previous value is out of range, we go to -1 in a backward loop
- store(data, data_id=None, replace_existing=True, set_current=False)[source]
Store a data
- Parameters
data – data instance
data_id – data id, a unique string if possible. If it’s not a unique string, it will be appended a number so that it’s unique.
replace_existing – Whether any existing data with the same id is replaced or not
set_current – Whether the newly stored data is set as the current one
- Returns
The new data_id or None