c8a51b416f
Add an interface that allows arbitrary objects to store/retrieve arbitrary key/value pairs. This will be used for different purposes in the future: * Config class(es) can store user-defined parameters for modules * Widgets can store state * ??? see #23
18 lines
411 B
Python
18 lines
411 B
Python
"""Store interface
|
|
|
|
Allows arbitrary classes to offer a simple get/set
|
|
store interface by deriving from the Store class in
|
|
this module
|
|
"""
|
|
|
|
class Store(object):
|
|
def __init__(self):
|
|
self._data = {}
|
|
|
|
def set(self, key, value):
|
|
self._data[key] = value
|
|
|
|
def get(self, key, default=None):
|
|
return self._data.get(key, default)
|
|
|
|
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|