def read(self, node): nodes = node.childNodes for node in nodes: if node.nodeType == xml.dom.Node.ELEMENT_NODE: if node.nodeName == 'count': continue varNode = node.getElementsByTagName('varName') curNode = node.getElementsByTagName('current') key = re.findall(r'\D+', node.nodeName)[0].upper() + self.__suffix + '%s' %(re.findall(r'\d+', node.nodeName)[0]) data = ClkData() if len(varNode): data.set_varName(varNode[0].childNodes[0].nodeValue) #if len(curNode): #data.set_current(curNode[0].childNodes[0].nodeValue) ModuleObj.set_data(self, key, data) return True
def get_cfgInfo(self): cp = ConfigParser.ConfigParser(allow_no_value=True) cp.read(ModuleObj.get_figPath()) count = string.atoi(cp.get('CLK_BUF', 'CLK_BUF_COUNT')) self.__count = count ops = cp.options('CLK_BUF') for op in ops: if op == 'clk_buf_count': self.__count = string.atoi(cp.get('CLK_BUF', op)) ClkData._count = string.atoi(cp.get('CLK_BUF', op)) continue value = cp.get('CLK_BUF', op) var_list = value.split(':') data = ClkData() data.set_curList(var_list[2:]) data.set_defVarName(string.atoi(var_list[0])) data.set_defCurrent(string.atoi(var_list[1])) key = op[16:].upper() ModuleObj.set_data(self, key, data)