+ 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 = ""
+ #print "id:", id
+ if attrs.has_key('nextstep'):
+ nextstep = str(attrs.get('nextstep'))
+ else:
+ nextstep = None
+ if attrs.has_key('timeout'):
+ timeout = int(attrs.get('timeout'))
+ else:
+ timeout = None
+ if attrs.has_key('timeoutaction'):
+ timeoutaction = str(attrs.get('timeoutaction'))
+ else:
+ timeoutaction = 'nextpage'
+
+ if attrs.has_key('timeoutstep'):
+ timeoutstep = str(attrs.get('timeoutstep'))
+ else:
+ timeoutstep = ''
+ self.wizard[self.lastStep] = {"id": id, "condition": "", "text": "", "timeout": timeout, "timeoutaction": timeoutaction, "timeoutstep": timeoutstep, "list": [], "config": {"screen": None, "args": None, "type": "" }, "code": "", "codeafter": "", "code_async": "", "codeafter_async": "", "nextstep": nextstep}
+ elif (name == "text"):
+ self.wizard[self.lastStep]["text"] = str(attrs.get('value')).replace("\\n", "\n")
+ elif (name == "displaytext"):
+ self.wizard[self.lastStep]["displaytext"] = str(attrs.get('value')).replace("\\n", "\n")
+ elif (name == "list"):
+ if (attrs.has_key('type')):
+ if attrs["type"] == "dynamic":
+ self.wizard[self.lastStep]["dynamiclist"] = attrs.get("source")
+ #self.wizard[self.lastStep]["list"].append(("Hallo", "test"))
+ if (attrs.has_key("evaluation")):
+ #print "evaluation"
+ self.wizard[self.lastStep]["listevaluation"] = attrs.get("evaluation")
+ if (attrs.has_key("onselect")):
+ self.wizard[self.lastStep]["onselect"] = attrs.get("onselect")
+ elif (name == "listentry"):
+ self.wizard[self.lastStep]["list"].append((str(attrs.get('caption')), str(attrs.get('step'))))
+ elif (name == "config"):
+ type = str(attrs.get('type'))
+ self.wizard[self.lastStep]["config"]["type"] = type
+ if type == "ConfigList" or type == "standalone":
+ try:
+ exec "from Screens." + str(attrs.get('module')) + " import *"
+ except:
+ exec "from " + 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'))
+ elif type == "dynamic":
+ self.wizard[self.lastStep]["config"]["source"] = str(attrs.get('source'))
+ if (attrs.has_key('evaluation')):
+ self.wizard[self.lastStep]["config"]["evaluation"] = str(attrs.get('evaluation'))
+ elif (name == "code"):
+ self.async_code = attrs.has_key('async') and str(attrs.get('async')) == "yes"
+ 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.async_code:
+ if self.codeafter:
+ self.wizard[self.lastStep]["codeafter_async"] = self.wizard[self.lastStep]["codeafter_async"].strip()
+ else:
+ self.wizard[self.lastStep]["code_async"] = self.wizard[self.lastStep]["code_async"].strip()
+ else:
+ 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()
+ elif name == 'step':
+ #print "Step number", self.lastStep, ":", self.wizard[self.lastStep]
+ pass
+
+ def characters(self, ch):
+ if self.currContent == "code":
+ if self.async_code:
+ if self.codeafter:
+ self.wizard[self.lastStep]["codeafter_async"] = self.wizard[self.lastStep]["codeafter_async"] + ch
+ else:
+ self.wizard[self.lastStep]["code_async"] = self.wizard[self.lastStep]["code_async"] + ch
+ else:
+ 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):