Ejemplo n.º 1
0
    def __init__(self, co, opt, tran):
        self.name = co.getAttribute('name')
        self.agcdRef = co.getAttribute('agcdRef')
        self.codeMR = co.getAttribute('codeMR')
        if not self.codeMR:
            self.codeMR = self.name
        self.type = co.getAttribute('type')
        Mask = co.getElementsByTagName("Mask")
        if Mask:
            self.mask = Mask.item(0).getAttribute("value")
        Label = co.getElementsByTagName('Label')
        codetext = Label.item(0).getAttribute('codetext')
        defaultText = Label.item(0).getAttribute('defaultText')
        self.label = ''
        if codetext:
            if codetext in tran.keys():
                self.label = tran[codetext]
            elif defaultText:
                self.label = defaultText
        Prereq = co.getElementsByTagName('PrerequisiteMessage')
        if Prereq:
            codetext = Prereq.item(0).getAttribute('codetext')
            defaultText = Prereq.item(0).getAttribute('defaultText')
            self.prerequisite = ''
            if codetext:
                if codetext in tran.keys():
                    self.prerequisite = tran[codetext]
                elif defaultText:
                    self.prerequisite = defaultText
        scenario_tmp = co.getElementsByTagName('Scenario')
        if scenario_tmp:
            scenario_fc = scenario_tmp.item(0).firstChild
            if scenario_fc:
                self.scenario = scenario_fc.nodeValue
            else:
                self.scenario = ''
        self.datarefs = []
        CurrentInfo = co.getElementsByTagName('DataList')
        if CurrentInfo:
            for ci in CurrentInfo:
                DataRef = ci.getElementsByTagName('DataRef')
                if DataRef:
                    for dr in DataRef:
                        dataref = ecu_screen_dataref(dr)
                        self.datarefs.append(dataref)

        self.inputlist = {}
        InputList = co.getElementsByTagName('InputList')
        if InputList:
            for corIL in InputList:
                CorrespondanceIL = corIL.getElementsByTagName('Correspondance')
                if CorrespondanceIL:
                    for cil in CorrespondanceIL:
                        ivalue = cil.getAttribute('value')
                        codetext = cil.getAttribute('codetext')
                        defaultText = cil.getAttribute('defaultText')
                        itext = ''
                        if codetext:
                            if codetext in tran.keys():
                                itext = tran[codetext]
                            elif defaultText:
                                itext = defaultText
                            self.inputlist[ivalue] = itext

        self.caracter = {}
        Interpretation = co.getElementsByTagName('StatusInterpretation')
        if Interpretation:
            for corIT in Interpretation:
                CorrespondanceSI = corIT.getElementsByTagName('Correspondance')
                if CorrespondanceSI:
                    for co in CorrespondanceSI:
                        ivalue = co.getAttribute('value')
                        codetext = co.getAttribute('codetext')
                        defaultText = co.getAttribute('defaultText')
                        itext = ''
                        if codetext:
                            if codetext in tran.keys():
                                itext = tran[codetext]
                            elif defaultText:
                                itext = defaultText
                            self.caracter[ivalue] = itext

        if 'Command\\' + self.name not in opt.keys():
            return
        xmlstr = opt['Command\\' + self.name]
        odom = xml.dom.minidom.parseString(xmlstr.encode('utf-8'))
        odoc = odom.documentElement
        self.computation = ''
        self.serviceID = []
        ServiceID = odoc.getElementsByTagName('ServiceID')
        if ServiceID:
            for sid in ServiceID:
                self.serviceID.append(sid.getAttribute('name'))