12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- # -*- coding:utf-8 -*-
- import os,sys,time
- from ssat_sdk.MenuTree3.TExcelParser import CExcelParser
- from ssat_sdk import getMenuTree3SelectedProjectCfgPath, getMenuTree3SelectedPExcelPath
- from UIT_tree import UITTree
- from UIT_FileManage import UITFileManage
- from UIT_log import error, debug, info
- from TConfig import TConfig
- DEBUG = True
- INFO =True
- ERROR = True
- class CTData():
- cls = "CTData"
- def __init__(self):
- ini_path = os.path.join(getMenuTree3SelectedProjectCfgPath(), "menutree.ini")
- self.tConfig = TConfig(ini_path)
- self.UITree = UITTree(self.tConfig)
- self.excelParser = CExcelParser(UITree=self.UITree)
- self.fileManage = UITFileManage()
- treeFileList = self.fileManage.getUITreeList()
- for excelFile in treeFileList:
- info(self.cls,"__init__","excelFile="+excelFile,INFO)
- self.addUITExcel(excelFile)
- '''
- 加载指定的UATree excel表格
- '''
- def addUITExcel(self, excelPath):
- self.excelParser.read_excel(excelPath)
- # 获取表格Value层级中,value_name下包含的value列表
- def getSubValueList(self, value_name):
- return self.UITree.getSubValueList(value_name)
- # 获取表格First~Sixth层级中,parent下包含的option列表
- def getSubOptionList(self, parent):
- return self.UITree.getSubOptionList(parent)
- # 获取表格Value层级中,value_name下的指定value的ocr列表
- def getValueTextList(self, value_name, value):
- return self.UITree.getValueTextList(value_name, value)
- # 获取表格First~Sixth层级中,parent下的指定option的ocr列表
- def getOptionTextList(self, parent, option):
- return self.UITree.getOptionTextList(parent, option)
- if __name__ == "__main__":
- tData = CTData()
- value_name = "source"
- subValueList = tData.getSubValueList(value_name)
- print u"获取Value层级中value_name为source下包含的value列表:", subValueList
- # 执行结果:[u'atv', u'dtv', u'tv', u'av', u'hdmi1', u'hdmi2', u'hdmi3', u'usb']
- parent = "picture"
- subOptionList = tData.getSubOptionList(parent)
- print u"获取First~Sixth层级中parent为picture下包含的value列表:", subOptionList
- # 执行结果:[u'picture_preset', u'backlight', u'overscan', u'content_type', u'screen_mode', u'advanced_settings_picture',u'picture_reset']
- value_name = "source"
- value = "atv"
- valueTextList = tData.getValueTextList(value_name, value)
- print u"获取表格Value层级中,value_name:source 下的value:atv 的ocr列表:", valueTextList
- # 执行结果:[u'tv', u'atv']
- parent = "picture"
- option = "picture_reset"
- optionTextList = tData.getOptionTextList(parent, option)
- print u"获取表格First~Sixth层级中,parent:picture 下的option:picture_reset的ocr列表:", optionTextList
- # 执行结果:[u'picture reset']
- print "pathParams:",tData.UITree.pathParams.paths
- print "valueParams:",tData.UITree.valueParams.values
- print "dialogParams:",tData.UITree.dialogParams.dialogs
|