Exemplo n.º 1
0
def loadXml(xmlPath):
	rules = []
	if(os.path.exists(xmlPath) == False):
		return 

	data = xml.parse(xmlPath)
	root = data.getroot()
	ruleList = root.find("rules")
	dirname = root.attrib['dirname']
	for val in ruleList:
		rule = CheckUnit()
		rule.mType = val.attrib["type"]
		rule.mRule = val.attrib["rule"]
		rule.mSrcName = val.attrib["src_excel_name"]
		rule.mSrcSheet = val.attrib["src_excel_sheet_name"]
		rule.mSrcTitle = val.attrib["src_excel_sheet_col"]
		rule.mDescName = val.attrib["des_excel_name"]
		rule.mDescSheet = val.attrib["des_excel_sheet_name"]
		rule.mDescTitle = val.attrib["des_excel_sheet_col"]
		rules.append(rule)

	ruleData = {
		'dirname' : dirname,
		'rules' : rules
	}

	return ruleData
Exemplo n.º 2
0
	def getRule(self, row):
		unit = CheckUnit()
		item = self.model.index(row, 0)
		unit.mType = unicode(self.model.data(item).toString().toUtf8(), 'utf-8', 'ignore')
		item = self.model.index(row, 1)
		unit.mSrcName =  unicode(self.model.data(item).toString().toUtf8(), 'utf-8', 'ignore')
		item = self.model.index(row, 2)
		unit.mSrcSheet =  unicode(self.model.data(item).toString().toUtf8(), 'utf-8', 'ignore')
		item = self.model.index(row, 3)
		unit.mSrcTitle =  unicode(self.model.data(item).toString().toUtf8(), 'utf-8', 'ignore')
		item = self.model.index(row, 4)
		unit.mDescName =  unicode(self.model.data(item).toString().toUtf8(), 'utf-8', 'ignore')
		item = self.model.index(row, 5)
		unit.mDescSheet =  unicode(self.model.data(item).toString().toUtf8(), 'utf-8', 'ignore')
		item = self.model.index(row, 6)
		unit.mDescTitle =  unicode(self.model.data(item).toString().toUtf8(), 'utf-8', 'ignore')
		item = self.model.index(row, 7)
		unit.mRule = unicode(self.model.data(item).toString().toUtf8(), 'utf-8', 'ignore')
		return unit
Exemplo n.º 3
0
def loadXml(xmlPath):
    rules = []
    if (os.path.exists(xmlPath) == False):
        return

    data = xml.parse(xmlPath)
    root = data.getroot()
    ruleList = root.find("rules")
    dirname = root.attrib['dirname']
    for val in ruleList:
        rule = CheckUnit()
        rule.mType = val.attrib["type"]
        rule.mRule = val.attrib["rule"]
        rule.mSrcName = val.attrib["src_excel_name"]
        rule.mSrcSheet = val.attrib["src_excel_sheet_name"]
        rule.mSrcTitle = val.attrib["src_excel_sheet_col"]
        rule.mDescName = val.attrib["des_excel_name"]
        rule.mDescSheet = val.attrib["des_excel_sheet_name"]
        rule.mDescTitle = val.attrib["des_excel_sheet_col"]
        rules.append(rule)

    ruleData = {'dirname': dirname, 'rules': rules}

    return ruleData