# -*- coding:utf-8 -*- from ssat_sdk.sat_environment import getMenuTree3SelectedProjectCfgPath,getMenuTree3SelectedPExcelPath,getMenuTree3SelectedTvExcelPath from UIT_log import debug,info,error import os, sys, time DEBUG = True INFO = True ERROR = True class UITFileManage(): cls="UITFileManage" def __init__(self): self.UITreeDir = getMenuTree3SelectedProjectCfgPath() info(self.cls, "__init__", "UITreeDir:" + str(self.UITreeDir), INFO) # excel路径,根据界面选择的项目来确定; # 非tv表格 self.xlspath = getMenuTree3SelectedPExcelPath() # tv表格 self.tv_xlspath = getMenuTree3SelectedTvExcelPath() info(self.cls, "__init__", u"构建CTMenu对象!非tv表格路径:%s" % str(self.xlspath),INFO) info(self.cls, "__init__", u"tv表格路径:%s" % str(self.tv_xlspath),INFO) # print "self.xlspath :", self.xlspath def getUITreeList(self): fileList = os.listdir(self.UITreeDir) treeList = [] treeList.append(self.xlspath) treeList.append(self.tv_xlspath) for filePath in fileList: if filePath.lower().startswith("uitree") and (filePath.lower().endswith(".xls") or filePath.lower().endswith(".xlsx")): treeList.append(os.path.join(self.UITreeDir, filePath)) return treeList def getKeyCodeFile(self): fileList = os.listdir(self.UITreeDir) keyCodeFile = None for filePath in fileList: if filePath.lower() == "eventkey_code.xlsx": keyCodeFile = os.path.join(self.UITreeDir, filePath) break return keyCodeFile