TData.py 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. # -*- coding:utf-8 -*-
  2. import os,sys,time
  3. from ssat_sdk.MenuTree3.TExcelParser import CExcelParser
  4. from ssat_sdk import getMenuTree3SelectedProjectCfgPath, getMenuTree3SelectedPExcelPath
  5. from UIT_tree import UITTree
  6. from UIT_FileManage import UITFileManage
  7. from UIT_log import error, debug, info
  8. from TConfig import TConfig
  9. DEBUG = True
  10. INFO =True
  11. ERROR = True
  12. class CTData():
  13. cls = "CTData"
  14. def __init__(self):
  15. ini_path = os.path.join(getMenuTree3SelectedProjectCfgPath(), "menutree.ini")
  16. self.tConfig = TConfig(ini_path)
  17. self.UITree = UITTree(self.tConfig)
  18. self.excelParser = CExcelParser(UITree=self.UITree)
  19. self.fileManage = UITFileManage()
  20. treeFileList = self.fileManage.getUITreeList()
  21. for excelFile in treeFileList:
  22. info(self.cls,"__init__","excelFile="+excelFile,INFO)
  23. self.addUITExcel(excelFile)
  24. '''
  25. 加载指定的UATree excel表格
  26. '''
  27. def addUITExcel(self, excelPath):
  28. self.excelParser.read_excel(excelPath)
  29. # 获取表格Value层级中,value_name下包含的value列表
  30. def getSubValueList(self, value_name):
  31. return self.UITree.getSubValueList(value_name)
  32. # 获取表格First~Sixth层级中,parent下包含的option列表
  33. def getSubOptionList(self, parent):
  34. return self.UITree.getSubOptionList(parent)
  35. # 获取表格Value层级中,value_name下的指定value的ocr列表
  36. def getValueTextList(self, value_name, value):
  37. return self.UITree.getValueTextList(value_name, value)
  38. # 获取表格First~Sixth层级中,parent下的指定option的ocr列表
  39. def getOptionTextList(self, parent, option):
  40. return self.UITree.getOptionTextList(parent, option)
  41. if __name__ == "__main__":
  42. tData = CTData()
  43. value_name = "source"
  44. subValueList = tData.getSubValueList(value_name)
  45. print u"获取Value层级中value_name为source下包含的value列表:", subValueList
  46. # 执行结果:[u'atv', u'dtv', u'tv', u'av', u'hdmi1', u'hdmi2', u'hdmi3', u'usb']
  47. parent = "picture"
  48. subOptionList = tData.getSubOptionList(parent)
  49. print u"获取First~Sixth层级中parent为picture下包含的value列表:", subOptionList
  50. # 执行结果:[u'picture_preset', u'backlight', u'overscan', u'content_type', u'screen_mode', u'advanced_settings_picture',u'picture_reset']
  51. value_name = "source"
  52. value = "atv"
  53. valueTextList = tData.getValueTextList(value_name, value)
  54. print u"获取表格Value层级中,value_name:source 下的value:atv 的ocr列表:", valueTextList
  55. # 执行结果:[u'tv', u'atv']
  56. parent = "picture"
  57. option = "picture_reset"
  58. optionTextList = tData.getOptionTextList(parent, option)
  59. print u"获取表格First~Sixth层级中,parent:picture 下的option:picture_reset的ocr列表:", optionTextList
  60. # 执行结果:[u'picture reset']
  61. print "pathParams:",tData.UITree.pathParams.paths
  62. print "valueParams:",tData.UITree.valueParams.values
  63. print "dialogParams:",tData.UITree.dialogParams.dialogs