blob: 196aa88b921d06357d45052da024bcc1fb4a9c54 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
from .widimp import WidImp
from .inventory import Inventory
class Switcher(Inventory):
"""An area that can contain multiple widgets but only shows one at a time.
There is a function to switch between the displayed widgets.
"""
def __init__(self, widgets, initial=0):
Inventory.__init__(self, " ")
self.setInventory(widgets)
for wid in widgets:
wid.hidden = True
self.select(initial)
def doSelect(self, value):
self.getSelectedItem().hidden = True
self.selector = value
newWid = self.getSelectedItem()
newWid.hidden = False
newWid.change()
|