123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- # -*- coding:utf-8 -*-
- import os
- from collections import OrderedDict
- from UIT_PathManage import UITPathManage
- from ssat_sdk.MenuTree3.BaseLog import CBaseLog
- from ssat_sdk.MenuTree3.TExcelParser import CExcelParser
- from ssat_sdk.utils.string_util import strToList
- from xlsConst import xlsConst as xlsc
- def parseMoveKey(keyStr):
- return strToList(keyStr,";")
- g_level = ['First', 'Second', 'Third', 'Fourth', 'Fifth', 'Sixth',
- 'Seventh', 'Eighth', 'Ninth', 'Tenth', 'Eleventh', 'Twelfth']
- class CPathParams(CBaseLog):
- def __init__(self):
- self.paths = OrderedDict()
- def addParent(self,level, pDict):
- if level not in self.paths:
- self.paths[level] = {}
- # endif
- pDict["value"]=[]
- pDict[xlsc.move_key] = parseMoveKey(pDict[xlsc.move_key])
- if pDict[xlsc.parent] in self.paths:
- self.error("Parent %s conflict."%(pDict[xlsc.parent]))
- self.paths[level][pDict[xlsc.parent]] = pDict
- def addOption(self,level, pDict):
- if level in self.paths:
- if pDict[xlsc.parent] in self.paths[level]:
- if pDict[xlsc.option].__len__() > 0:
- self.paths[level][pDict[xlsc.parent]]["value"].append(pDict)
- else:
- self.error("Parent %s not exist." % (pDict[xlsc.parent]))
- else:
- self.error("Level %s not exist." % (level))
- class CValueParams(CBaseLog):
- def __init__(self):
- self.values = OrderedDict()
- def addParent(self, pDict):
- if pDict[xlsc.value_name] in self.values:
- self.error("Parent %s conflict."%(pDict[xlsc.value_name]))
- pDict["value"]=[]
- pDict[xlsc.move_key] = parseMoveKey(pDict[xlsc.move_key])
- self.values[pDict[xlsc.value_name]] = pDict
- def addOption(self, pDict):
- if pDict[xlsc.value_name] in self.values:
- if pDict[xlsc.value].__len__() > 0:
- self.values[pDict[xlsc.value_name]]["value"].append(pDict)
- else:
- self.error("Parent %s not exist." % (pDict[xlsc.value_name]))
- class CDialogParams(CBaseLog):
- def __init__(self):
- self.dialogs = OrderedDict()
- def addParent(self,level, pDict):
- # endif
- if pDict[xlsc.parent] in self.dialogs:
- self.error("Parent %s conflict."%(pDict[xlsc.parent]))
- pDict["value"] = []
- pDict[xlsc.move_key] = parseMoveKey(pDict[xlsc.move_key])
- self.dialogs[pDict[xlsc.parent]] = pDict
- def addOption(self,level,pDict):
- if pDict[xlsc.parent] in self.dialogs:
- if pDict[xlsc.option].__len__() > 0:
- self.dialogs[pDict[xlsc.parent]]["value"].append(pDict)
- else:
- self.error("Parent %s not exist." % pDict[xlsc.parent])
- # 注意:所有不对外暴露的变量和函数需要私有化,以明确哪些接口和参数是对外的。
- # 这样便于后期维护时,根据对外的变量和函数来做处理。
- class COptionExcel(CBaseLog):
- def __init__(self, exData):
- self.__excelParse = CExcelParser()
- self.__exData = exData
- self.__pathParams = CPathParams()
- self.__valueParams = CValueParams()
- self.__dialogParams = CDialogParams()
- # 加载已知表格;
- def loadExcel(self):
- pass
- # 加载其他表格;
- def addExcel(self, xlsPath):
- pass
- if __name__ == "__main__":
- pass
|