+ def startElement(self, name, attrs):
+ print "startElement", name
+ self.currContent = name
+ if (name == "step"):
+ self.lastStep += 1
+ if attrs.has_key('id'):
+ id = str(attrs.get('id'))
+ else:
+ id = ""
+ if attrs.has_key('nextstep'):
+ nextstep = str(attrs.get('nextstep'))
+ else:
+ nextstep = None
+ self.wizard[self.lastStep] = {"id": id, "condition": "", "text": "", "list": [], "config": {"screen": None, "args": None, "type": "" }, "code": "", "codeafter": "", "nextstep": nextstep}
+ elif (name == "text"):
+ self.wizard[self.lastStep]["text"] = string.replace(str(attrs.get('value')), "\\n", "\n")
+ elif (name == "listentry"):
+ self.wizard[self.lastStep]["list"].append((str(attrs.get('caption')), str(attrs.get('step'))))
+ elif (name == "config"):
+ exec "from Screens." + str(attrs.get('module')) + " import *"
+ self.wizard[self.lastStep]["config"]["screen"] = eval(str(attrs.get('screen')))
+ if (attrs.has_key('args')):
+ print "has args"
+ self.wizard[self.lastStep]["config"]["args"] = str(attrs.get('args'))
+ self.wizard[self.lastStep]["config"]["type"] = str(attrs.get('type'))
+ elif (name == "code"):
+ if attrs.has_key('pos') and str(attrs.get('pos')) == "after":
+ self.codeafter = True
+ else:
+ self.codeafter = False
+ elif (name == "condition"):
+ pass
+ def endElement(self, name):
+ self.currContent = ""
+ if name == 'code':
+ if self.codeafter:
+ self.wizard[self.lastStep]["codeafter"] = self.wizard[self.lastStep]["codeafter"].strip()
+ else:
+ self.wizard[self.lastStep]["code"] = self.wizard[self.lastStep]["code"].strip()
+ elif name == 'condition':
+ self.wizard[self.lastStep]["condition"] = self.wizard[self.lastStep]["condition"].strip()
+
+ def characters(self, ch):
+ if self.currContent == "code":
+ if self.codeafter:
+ self.wizard[self.lastStep]["codeafter"] = self.wizard[self.lastStep]["codeafter"] + ch
+ else:
+ self.wizard[self.lastStep]["code"] = self.wizard[self.lastStep]["code"] + ch
+ elif self.currContent == "condition":
+ self.wizard[self.lastStep]["condition"] = self.wizard[self.lastStep]["condition"] + ch
+ def __init__(self, session, showSteps = True, showStepSlider = True, showList = True, showConfig = True):