import sys
def help(screen, text):
- ButtonChoiceWindow(screen, "Help", text)
+ raise ValueError, "foo"
+ ButtonChoiceWindow(screen, "Help", text, help = "Help on help")
t = TextboxReflowed(25, "Some text which needs to be wrapped at a good place.")
li = Listbox(5, width = 20, returnExit = 1)
lbcw = ListboxChoiceWindow(screen, 'Title 2',
'Choose one item from the list below:',
- ('One', 'Two', 'Three', 'Four', 'Five'), default = 2)
+ ('One', 'Two', 'Three', 'Four', 'Five'), default = 2,
+ help = "Help for a listbox")
sg = Grid(2, 3)
sg.setField(b, 0, 0, anchorLeft = 1)
return None
-class GridForm(Grid):
+class GridFormHelp(Grid):
- def __init__(self, screen, title, *args):
+ def __init__(self, screen, title, help, *args):
self.screen = screen
self.title = title
- self.form = Form()
+ self.form = Form(help)
self.childList = []
self.form_created = 0
args = list(args)
def setCurrent (self, co):
self.form.setCurrent (co)
+class GridForm(GridFormHelp):
+
+ def __init__(self, screen, title, *args):
+ myargs = (self, screen, title, None) + args
+ apply(GridFormHelp.__init__, myargs)
+
class CheckboxTree(Widget):
def append(self, text, item = None, selected = 0):
self.addItem(text, (snackArgs['append'], ), item, selected)
def ListboxChoiceWindow(screen, title, text, items,
buttons = ('Ok', 'Cancel'),
- width = 40, scroll = 0, height = -1, default = None):
+ width = 40, scroll = 0, height = -1, default = None,
+ help = None):
if (height == -1): height = len(items)
bb = ButtonBar(screen, buttons)
if (default != None):
l.setCurrent (default)
- g = GridForm(screen, title, 1, 3)
+ g = GridFormHelp(screen, title, help, 1, 3)
g.add(t, 0, 0)
g.add(l, 0, 1, padding = (0, 1, 0, 1))
g.add(bb, 0, 2, growx = 1)
def ButtonChoiceWindow(screen, title, text,
buttons = [ 'Ok', 'Cancel' ],
- width = 40, x = None, y = None):
+ width = 40, x = None, y = None, help = None):
bb = ButtonBar(screen, buttons)
t = TextboxReflowed(width, text, maxHeight = screen.height - 12)
- g = GridForm(screen, title, 1, 2)
+ g = GridFormHelp(screen, title, help, 1, 2)
g.add(t, 0, 0, padding = (0, 0, 0, 1))
g.add(bb, 0, 1, growx = 1)
return bb.buttonPressed(g.runOnce(x, y))
def EntryWindow(screen, title, text, prompts, allowCancel = 1, width = 40,
- entryWidth = 20, buttons = [ 'Ok', 'Cancel' ]):
+ entryWidth = 20, buttons = [ 'Ok', 'Cancel' ], help = None):
bb = ButtonBar(screen, buttons);
t = TextboxReflowed(width, text)
count = count + 1
entryList.append(e)
- g = GridForm(screen, title, 1, 3)
+ g = GridFormHelp(screen, title, help, 1, 3)
g.add(t, 0, 0, padding = (0, 0, 0, 1))
g.add(sg, 0, 1, padding = (0, 0, 0, 1))