|
@@ -616,24 +616,43 @@ class COptionExcel(CBaseLog):
|
|
|
paths = reversed(self.__pathParams.paths)
|
|
|
for level in paths:
|
|
|
for parent in self.__pathParams.paths[level]:
|
|
|
- for vals in self.__pathParams.paths[level][parent]["value"]:
|
|
|
- if vals['option'].lower() == option.lower():
|
|
|
- if dict_option.__len__() == 0:
|
|
|
- found = True
|
|
|
- dict_option['level'] = level
|
|
|
- dict_option['parent'] = parent
|
|
|
- dict_option['others'] = self.__pathParams.paths[level][parent]['others']
|
|
|
- dict_option['enter_key'] = self.__pathParams.paths[level][parent]['enter_key']
|
|
|
- dict_option['move_key'] = self.__pathParams.paths[level][parent]['move_key']
|
|
|
- dict_option['back_key'] = '' # 预留;
|
|
|
- dict_option['option_ocr'] = vals['option_for_ocr'].split(';')
|
|
|
- dict_option['option_move_key'] = vals['move_key']
|
|
|
- dict_option['option_enter_key'] = vals['enter_key']
|
|
|
- dict_option['option_others'] = vals['others']
|
|
|
- dict_option['layers'] = g_level.index(level)
|
|
|
- option = parent
|
|
|
- break
|
|
|
- # endfor
|
|
|
+ # 如果找到的是顶层信息(如source).
|
|
|
+ if level == "First" and parent.lower() == optionName.lower():
|
|
|
+ found = True
|
|
|
+ dict_option['level'] = level
|
|
|
+ dict_option['parent'] = parent
|
|
|
+ dict_option['others'] = self.__pathParams.paths[level][parent]['others']
|
|
|
+ dict_option['enter_key'] = self.__pathParams.paths[level][parent]['enter_key']
|
|
|
+ dict_option['move_key'] = self.__pathParams.paths[level][parent]['move_key']
|
|
|
+ # 根节点没有以下信息,置空。
|
|
|
+ dict_option['back_key'] = '' # 预留;
|
|
|
+ dict_option['option_ocr'] = []
|
|
|
+ dict_option['option_move_key'] = []
|
|
|
+ dict_option['option_enter_key'] = []
|
|
|
+ dict_option['option_others'] = []
|
|
|
+ dict_option['layers'] = g_level.index(level)
|
|
|
+ option = parent
|
|
|
+ break
|
|
|
+ else:
|
|
|
+ for vals in self.__pathParams.paths[level][parent]["value"]:
|
|
|
+ if vals['option'].lower() == option.lower():
|
|
|
+ if dict_option.__len__() == 0:
|
|
|
+ found = True
|
|
|
+ dict_option['level'] = level
|
|
|
+ dict_option['parent'] = parent
|
|
|
+ dict_option['others'] = self.__pathParams.paths[level][parent]['others']
|
|
|
+ dict_option['enter_key'] = self.__pathParams.paths[level][parent]['enter_key']
|
|
|
+ dict_option['move_key'] = self.__pathParams.paths[level][parent]['move_key']
|
|
|
+ dict_option['back_key'] = '' # 预留;
|
|
|
+ dict_option['option_ocr'] = vals['option_for_ocr'].split(';')
|
|
|
+ dict_option['option_move_key'] = vals['move_key']
|
|
|
+ dict_option['option_enter_key'] = vals['enter_key']
|
|
|
+ dict_option['option_others'] = vals['others']
|
|
|
+ dict_option['layers'] = g_level.index(level)
|
|
|
+ option = parent
|
|
|
+ break
|
|
|
+ # endfor
|
|
|
+ # endif
|
|
|
# endfor
|
|
|
# endfor
|
|
|
if found is True:
|
|
@@ -710,9 +729,7 @@ class COptionExcel(CBaseLog):
|
|
|
for level in paths:
|
|
|
found = False
|
|
|
for parent in self.__pathParams.paths[level]:
|
|
|
- # print parent,self.pathParams.paths[level][parent],'\r\n'
|
|
|
for item in self.__pathParams.paths[level][parent]["value"]:
|
|
|
- # print item
|
|
|
if item["option"].lower() == optionName.lower():
|
|
|
pp[level] = {
|
|
|
"parent": parent,
|
|
@@ -731,26 +748,20 @@ class COptionExcel(CBaseLog):
|
|
|
if found:
|
|
|
break
|
|
|
else:
|
|
|
- if parent == optionName:
|
|
|
- for item in self.__pathParams.paths[level][parent]["value"]:
|
|
|
- # print item
|
|
|
- if item["option"].lower() == optionName.lower():
|
|
|
- pp[level] = {
|
|
|
+ if level == "First" and parent == optionName:
|
|
|
+ pp[level] = {
|
|
|
"parent": parent,
|
|
|
"move_key": self.__pathParams.paths[level][parent][xlsc.move_key],
|
|
|
"enter_key": self.__pathParams.paths[level][parent][xlsc.enter_key],
|
|
|
"others": self.__pathParams.paths[level][parent][xlsc.others],
|
|
|
- "option": item[xlsc.option],
|
|
|
- "option_for_ocr": item[xlsc.option_for_ocr].split(';'),
|
|
|
- "option_move_key": item[xlsc.move_key],
|
|
|
- "option_enter_key": item[xlsc.enter_key],
|
|
|
- "option_others": item[xlsc.others]
|
|
|
- }
|
|
|
- optionName = parent
|
|
|
- found = True
|
|
|
- break
|
|
|
- # endif
|
|
|
- # endfor
|
|
|
+ # 根结点没有以下信息,置空;
|
|
|
+ "option": parent,
|
|
|
+ "option_for_ocr": [],
|
|
|
+ "option_move_key": [],
|
|
|
+ "option_enter_key": [],
|
|
|
+ "option_others": []
|
|
|
+ }
|
|
|
+ found = True
|
|
|
break
|
|
|
# endif
|
|
|
# endfor
|
|
@@ -830,7 +841,7 @@ if __name__ == "__main__":
|
|
|
exData = CExtraData()
|
|
|
opxls = COptionExcel(exData)
|
|
|
# print json.dumps(opxls.pathParams.paths)
|
|
|
- # print "getOptionAllChildItemName", opxls.getOptionAllChildItemName('picture')
|
|
|
+ # print "getOptionAllChildItemName", opxls.getOptionAllChildItemName('source')
|
|
|
# print "getOptionAllChildItemTextList1d", opxls.getOptionAllChildItemTextList1d('picture')
|
|
|
# print "getOptionAllChildItemTextList2d", opxls.getOptionAllChildItemTextList2d('picture')
|
|
|
# print "getOptionAllChildItemMap", opxls.getOptionAllChildItemMap('picture')
|
|
@@ -838,14 +849,14 @@ if __name__ == "__main__":
|
|
|
# print u"getOptionAllSiblingItemDict", opxls.getOptionAllSiblingItemDict('picture')
|
|
|
# print u"getOptionAllSiblingItemTextList1d", opxls.getOptionAllSiblingItemTextList1d('picture')
|
|
|
# print u"getOptionText", opxls.getOptionText('picture')
|
|
|
- # print "getOptionValueInfo", opxls.getOptionValueInfo('picture')
|
|
|
- # print "getOptionValueText", opxls.getOptionValueText('picture', 'sharpness')
|
|
|
- print "getOptionValueText", opxls.getOptionValueText('picture_preset', 'movie')
|
|
|
- # print "getOptionInfo", opxls.getOptionInfo('sharpness')
|
|
|
- # print "getOptionAllValueName", opxls.getOptionAllValueName('r_gain')
|
|
|
+ # print "getOptionValueInfo", opxls.getOptionValueInfo('source')
|
|
|
+ # print "getOptionValueText", opxls.getOptionValueText('source', 'atv')
|
|
|
+ # print "getOptionValueText", opxls.getOptionValueText('source', 'dtv')
|
|
|
+ print "getOptionInfo", opxls.getOptionInfo('source')
|
|
|
+ print "getOptionAllValueName", opxls.getOptionAllValueName('source')
|
|
|
##########################################
|
|
|
- # paths = opxls.getOptionPaths('sharpness')
|
|
|
- # print "getOptionPaths", paths
|
|
|
+ paths = opxls.getOptionPaths('source')
|
|
|
+ print "getOptionPaths", paths
|
|
|
# print "checkOptionPaths", opxls.checkOptionPaths('sharpness')
|
|
|
# print "checkOptionPaths", opxls.checkOptionPaths(opxls.getOptionPaths('sharpness'))
|
|
|
# print "getOptionPathsAndValue", opxls.getOptionPathsAndValue('picture', 'sharpness')
|