فهرست منبع

删除无用文件。

scbc.sat2 5 سال پیش
والد
کامیت
1a04bb861e

+ 0 - 78
ssat_sdk/MenuTree3/TData.py

@@ -1,78 +0,0 @@
-# -*- coding:utf-8 -*-
-import os,sys,time
-#from ssat_sdk.MenuTree3.TExcelParser import CExcelParser
-# 测试路径;
-from 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

+ 0 - 264
ssat_sdk/MenuTree3/TFocus.py

@@ -1,264 +0,0 @@
-# -*- coding:utf-8 -*-
-from ssat_sdk import getMenuTree3SelectedPExcelPath
-
-from ssat_sdk.picture.RGB import RGBColor
-from ssat_sdk.picture.color_space import CIEluvCaculator
-from ssat_sdk.picture.feature_detect import FeatureDetect
-from ssat_sdk.picture.image_util import *
-
-import os
-import sys
-import time
-import numpy as np
-import cv2 as cv
-import json
-from ssat_sdk.MenuTree3.TConfig import TConfig
-from ssat_sdk.MenuTree3.TExcelParser import CExcelParser
-
-g_level = ['First', 'Second', 'Third', 'Fourth', 'Fifth', 'Sixth',
-           'Seventh', 'Eighth', 'Ninth', 'Tenth', 'Eleventh', 'Twelfth']
-
-
-class TFocus():
-    def __init__(self, project_path, uitRunner=None, screen=[1920, 1080], icon_shape=[1920, 1080]):
-        self.params_path = project_path
-        self.rgbColor = RGBColor()
-        self.CIE = CIEluvCaculator()
-        self.feature_detect = FeatureDetect()
-        self.xlsparser = uitRunner.uitPathManage
-        # icon分辨率width*height;
-        self.icon_shape = icon_shape
-        # 当前屏幕分辨率;
-        self.screen = screen
-        # 比率;
-        self.rate = self.icon_shape[0] / self.screen[0]
-
-    def findFocusByIcon(self, src_pic, icon_pic,
-                        dcfg={"offset": 20, "minPeri": 0, "maxPeri": 0, "minArea": 0, "maxArea": 0, "morphology": []}):
-        iconImg = cv.imread(icon_pic)
-        # 获取小图平均bgr值;
-        bgr = self.rgbColor.getAvgBGR(iconImg)
-        print "findFocusByIcon,bgr:%s, src_pic=%s, icon_pic=%s, dcfg=%s" % (
-            str(bgr), src_pic, icon_pic, str(dcfg))
-        if dcfg.has_key("morphology"):
-            morphology = dcfg["morphology"]
-        else:
-            morphology = []
-        return self.feature_detect.findCurrentFoucsByColor(
-            src_pic,
-            [],
-            bgr,
-            dcfg["offset"],
-            dcfg["minPeri"],
-            dcfg["maxPeri"],
-            dcfg["minArea"],
-            dcfg["maxArea"],
-            morphology)
-
-    # 文本颜色焦点区域查找;
-    def findFramelessBoxByIcon(self, src_pic, icon_pic, offset=20):
-        iconImg = cv.imread(icon_pic)
-        # 获取小图平均bgr值;
-        bgr = self.rgbColor.getAvgBGR(iconImg)
-        print "findFramelessBoxByIcon,bgr:%s, src_pic=%s, icon_pic=%s, offset=%s" % (
-            str(bgr), src_pic, icon_pic, str(offset))
-        return self.feature_detect.findFramelessFocusByColor(src_pic, [], bgr, offset)
-
-    '''
-        在传入的图片上,查找指定小图片bgr颜色框矩形区域,返回矩形区域的坐标
-        :param bigPic:图片路径
-        :param level:excel层次
-        :param first_parent:大部分情况下是根菜单;少部分情况是当前option的parent;
-        :return rectArea:矩形区域和区域图像内容
-        '''
-
-    def findRectByIcon(self, bigPic, level, first_parent, option=""):
-        print "level:", level
-        print "first_parent:", first_parent
-        if option.__len__() == 0:
-            icon_path = os.path.join(self.params_path, "icon\\", str(
-                first_parent) + "." + str(level) + ".png")
-        else:
-            icon_path = os.path.join(self.params_path, "icon\\", str(
-                first_parent) + "." + str(level) + "_" + option + ".png")
-        print "icon_path_option=", icon_path
-        if os.path.exists(icon_path) is False:
-            icon_path = os.path.join(self.params_path, "icon\\", str(
-                first_parent) + "." + str(level) + ".png")
-            print "icon_path=", icon_path
-            if os.path.exists(icon_path) is False:
-                icon_path = os.path.join(self.params_path, "icon\\", str(
-                    first_parent) + "." + str('First') + ".png")
-                print "icon_path_First=", icon_path
-                if os.path.exists(icon_path) is False:
-                    return False, []
-        # 获取配置文件值;
-        dcfg = {"offset": 20, "minPeri": 0,
-                "maxPeri": 0, "minArea": 0, "maxArea": 0}
-        ini_path = os.path.join(self.params_path, "menutree.ini")
-        if os.path.exists(ini_path) is True:
-            tconfig = TConfig(ini_path)
-            if tconfig.has_option(level, first_parent):
-                dcfg = tconfig.get_dict(tconfig.get_value(level, first_parent))
-
-        dcfg['minPeri'] = self.rate * dcfg['minPeri']
-        dcfg['maxPeri'] = self.rate * dcfg['maxPeri']
-        dcfg['minArea'] = pow(self.rate, 2) * dcfg['minArea']
-        dcfg['maxArea'] = pow(self.rate, 2) * dcfg['maxArea']
-        if "morphology" not in dcfg:
-            dcfg["morphology"] = []
-        return self.findFocusByIcon(bigPic, icon_path, dcfg)
-
-    '''
-    获取option配置信息;
-    '''
-
-    def getOptionConfig(self, cur_option, is_value_sheet=False):
-        # 获取Option的others字段信息;
-        if self.xlsparser is None:
-            self.xlsparser = CExcelParser(getMenuTree3SelectedPExcelPath())
-            # 读取excel并解析出内容;
-            self.xlsparser.read_excel()
-        # 获取option的路径表;
-        pp = self.xlsparser.get_option_paths(cur_option)
-        if pp.__len__() == 0:
-            print 'getOptionConfig.get_option_paths(%s) is null' % (cur_option)
-            return False, {"icon_path": "", "dcfg": {}, "dir_path": ""}
-
-        # 获取first_parent;
-        first_parent = pp[g_level[0]]['parent']
-        # 当前option所在level;
-        cur_level = g_level[pp.__len__() - 1]
-        # 当前父路径;
-        cur_parent = pp[cur_level]['parent']
-        if is_value_sheet is True:
-            cur_level = 'value'
-        # print first_parent, cur_level, cur_parent, cur_option
-
-        # 获取配置文件值;
-        dcfg = {}
-        ini_path = os.path.join(self.params_path, "menutree.ini")
-        tconfig = TConfig(ini_path)
-        # 首先找当前路径图;
-        icon_path = os.path.join(self.params_path, "icon\\", str(
-            cur_parent) + "." + str(cur_level) + "_" + cur_option + ".png")
-        icon_dir_path = os.path.join(self.params_path, "icon\\", str(
-            cur_parent) + "." + str(cur_level) + "_" + cur_option + ".dir.png")
-        dcfg = tconfig.get_value_dict(cur_level, cur_parent + '.' + cur_option)
-        print u"trying icon:%s"%icon_path
-        print u"trying dcfg:get_value_dict(%s, %s)"%(cur_level, cur_parent + '.' + cur_option)
-        # icon路径;
-        if os.path.exists(icon_path) is False:
-            print u'图标优先级0:[cur_parent].[cur_level]_[cur_option].png=%s is null' % (
-                icon_path)
-            # 当前次路径图;
-            icon_path = os.path.join(self.params_path, "icon\\", str(
-                cur_parent) + "." + str(cur_level) + ".png")
-            icon_dir_path = os.path.join(self.params_path, "icon\\", str(
-                cur_parent) + "." + str(cur_level) + ".dir.png")
-            dcfg = tconfig.get_value_dict(cur_level, cur_parent)
-            print u"trying icon:%s" % icon_path
-            print u"trying dcfg:get_value_dict(%s, %s)" % (cur_level, cur_parent)
-            if os.path.exists(icon_path) is False:
-                print u'图标优先级1:[cur_parent].[cur_level].png=%s is null' % (
-                    icon_path)
-                # first层;
-                icon_path = os.path.join(self.params_path, "icon\\", str(
-                    first_parent) + "." + str(cur_level) + "_" + cur_option + ".png")
-                icon_dir_path = os.path.join(self.params_path, "icon\\", str(
-                    first_parent) + "." + str(cur_level) + "_" + cur_option + ".dir.png")
-                dcfg = tconfig.get_value_dict(
-                    cur_level, first_parent + '.' + cur_option)
-                print u"trying icon:%s" % icon_path
-                print u"trying dcfg:get_value_dict(%s, %s)" % (cur_level, first_parent + '.' + cur_option)
-                if os.path.exists(icon_path) is False:
-                    print u'图标优先级2:[first_parent].[cur_level]_[cur_option].png=%s is null' % (
-                        icon_path)
-                    # first层次路径图;
-                    icon_path = os.path.join(self.params_path, "icon\\", str(
-                        first_parent) + "." + str(cur_level) + ".png")
-                    icon_dir_path = os.path.join(self.params_path, "icon\\", str(
-                        first_parent) + "." + str(cur_level) + ".dir.png")
-                    dcfg = tconfig.get_value_dict(cur_level, first_parent)
-                    print u"trying icon:%s" % icon_path
-                    print u"trying dcfg:get_value_dict(%s, %s)" % (cur_level, first_parent)
-                    if os.path.exists(icon_path) is False:
-                        print u'图标优先级3:[first_parent].[cur_level].png =%s is null' % (
-                            icon_path)
-                # endif;
-            # endif;
-        # endif;
-
-        if dcfg.__len__() == 0:
-            dcfg = {"offset": 20, "minPeri": 0,
-                    "maxPeri": 0, "minArea": 0, "maxArea": 0, "morphology": []}
-            print u"get dcfg fail!Using default para!"
-
-        if os.path.exists(icon_path) is False:
-            print 'getOptionConfig:current use icon_path=%s is null' % (
-                icon_path)
-            return False, {"icon_path": "", "dcfg": {}, "dir_path": ""}
-        print u"实际使用的icon图片路径icon_path:%s, 实际使用INI配置:%s" % (
-            str(icon_path), str(dcfg))
-
-        # 返回路径;
-        return True, {"icon_path": icon_path, "dcfg": dcfg, "dir_path": icon_dir_path}
-
-    def findRectByIcon2(self, src_pic, cur_option, is_value_sheet=False):
-        # 获取参数;
-        result, opcfg = self.getOptionConfig(cur_option, is_value_sheet)
-        if result is False:
-            return False, []
-
-        icon_path = opcfg['icon_path']
-        dcfg = opcfg['dcfg']
-        dcfg['minPeri'] = self.rate * dcfg['minPeri']
-        dcfg['maxPeri'] = self.rate * dcfg['maxPeri']
-        dcfg['minArea'] = pow(self.rate, 2) * dcfg['minArea']
-        dcfg['maxArea'] = pow(self.rate, 2) * dcfg['maxArea']
-        print u"实际使用的聚焦参数字典dcfg:%s" % str(dcfg)
-        if "morphology" not in dcfg:
-            dcfg["morphology"] = []
-
-        return self.findFocusByIcon(src_pic, icon_path, dcfg)
-
-
-def rgb2hsv(r, g, b):
-    r, g, b = r / 255.0, g / 255.0, b / 255.0
-    mx = max(r, g, b)
-    mn = min(r, g, b)
-    df = mx - mn
-    # h值
-    if mx == mn:
-        h = 0
-    elif mx == r and g >= b:
-        h = (60 * (g - b) / df) % 360
-    elif mx == r and g < b:
-        h = (60 * ((g - b) / df) + 360) % 360
-    elif mx == g:
-        h = (60 * ((b - r) / df) + 120) % 360
-    elif mx == b:
-        h = (60 * ((r - g) / df) + 240) % 360
-    # s值
-    if mx == 0:
-        s = 0
-    else:
-        s = df / mx * 255
-    # v值
-    v = mx * 255
-    # 返回;
-    return h, s, v
-
-
-if __name__ == "__main__":
-    # print '\n\n====>\n', pow(10, 2)
-    tFocus = TFocus(r"D:\SAT\resource\MenuTree\MS6586\ISDB")
-    tFocus.getOptionConfig('backlight', True)
-    tFocus.findRectByIcon2('', 'backlight')  # lock
-    if 0:
-        bigPic_2 = r"D:\CH01.JPG"
-        icon = r"D:\SAT\resource\MenuTree\mi\AM950_IND_V27N\result.png"
-        result, contourRect = tFocus.findRectByIcon(bigPic_2, 'Third', 'lock')
-        print "__name__,rect:", result, contourRect
-        if result is True:
-            saveCropPic(bigPic_2, icon, contourRect)

+ 0 - 41
ssat_sdk/MenuTree3/UIT_FileManage.py

@@ -1,41 +0,0 @@
-# -*- 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

+ 0 - 213
ssat_sdk/MenuTree3/UIT_PathManage.py

@@ -1,213 +0,0 @@
-# -*- coding:utf-8 -*-
-from TData import CTData
-from UIT_tree import UITTree
-from UIT_treeConstant import TreeConst
-from ssat_sdk.utils.string_util import strcmp
-from UIT_log import error,info,debug
-import os, sys, time
-from collections import OrderedDict
-
-DEBUG = True
-INFO = True
-ERROR = True
-g_level = TreeConst.G_LEVEL
-class UITPathManage():
-    def __init__(self, uitData):
-        self.uitData = uitData
-        self.valueParams = self.uitData.UITree.valueParams
-        self.pathParams = self.uitData.UITree.pathParams
-
-    def get_menu_paths(self, option, value):
-        if type(option) == str:
-            option = unicode(option)
-        if type(value) == str:
-            value = unicode(value)
-        # pp必须不排序;
-        vp, pp = {}, OrderedDict()
-        if option in self.valueParams.values:
-            vp = {"option": option, "value": value, "enter_key": self.valueParams.values[option]["enter_key"],
-                  "move_key": self.valueParams.values[option]["move_key"]}
-            # 找到value对应的ocr;
-            for item in self.valueParams.values[option]["value"]:
-                if "range(" in item["value"]:
-                    vp["value_for_ocr"] = item["value_for_ocr"].split(';')
-                    break
-                elif item["value"].lower() == value.lower():
-                    vp["value_for_ocr"] = item["value_for_ocr"].split(';')
-                    break
-
-        # 首先,字典不排序,需要倒序;
-        paths = reversed(self.pathParams.paths)
-        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() == option.lower():
-                        pp[level] = {
-                            "parent": parent,
-                            "move_key": self.pathParams.paths[level][parent][TreeConst.Option_MoveKey],
-                            "enter_key": self.pathParams.paths[level][parent][TreeConst.Option_EnterKey],
-                            "others": self.pathParams.paths[level][parent][TreeConst.Option_Others],
-                            "option": item[TreeConst.Option_Name],
-                            "option_for_ocr": item[TreeConst.Option_ForOCR].split(';'),
-                            "option_move_key": item[TreeConst.Option_MoveKey],
-                            "option_enter_key": item[TreeConst.Option_EnterKey],
-                            "option_others": item[TreeConst.Option_Others]
-                        }
-                        option = parent
-                        found = True
-                        break
-                if found:
-                    break
-                else:
-                    if parent == option:
-                        for item in self.pathParams.paths[level][parent]["value"]:
-                            # print item
-                            if item["option"].lower() == value.lower():
-                                pp[level] = {
-                                    "parent": parent,
-                                    "move_key": self.pathParams.paths[level][parent][TreeConst.Option_MoveKey],
-                                    "enter_key": self.pathParams.paths[level][parent][TreeConst.Option_EnterKey],
-                                    "others": self.pathParams.paths[level][parent][TreeConst.Option_Others],
-                                    "option": item[TreeConst.Option_Name],
-                                    "option_for_ocr": item[TreeConst.Option_ForOCR].split(';'),
-                                    "option_move_key": item[TreeConst.Option_MoveKey],
-                                    "option_enter_key": item[TreeConst.Option_EnterKey],
-                                    "option_others": item[TreeConst.Option_Others]
-                                }
-                                option = parent
-                                found = True
-                                break
-                            # endif
-                        # endfor
-                        break
-                    # endif
-        # 需要对path倒序使用;
-        return vp, pp
-
-    def get_option_paths(self, option):
-        # pp必须不排序;
-        pp = OrderedDict()
-        # 首先,字典不排序,需要倒序;
-        paths = reversed(self.pathParams.paths)
-        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() == option.lower():
-                        pp[level] = {
-                            "parent": parent,
-                            "move_key": self.pathParams.paths[level][parent][TreeConst.Option_MoveKey],
-                            "enter_key": self.pathParams.paths[level][parent][TreeConst.Option_EnterKey],
-                            "others": self.pathParams.paths[level][parent][TreeConst.Option_Others],
-                            "option": item[TreeConst.Option_Name],
-                            "option_for_ocr": item[TreeConst.Option_ForOCR].split(';'),
-                            "option_move_key": item[TreeConst.Option_MoveKey],
-                            "option_enter_key": item[TreeConst.Option_EnterKey],
-                            "option_others": item[TreeConst.Option_Others]
-                        }
-                        option = parent
-                        found = True
-                        break
-                if found:
-                    break
-                else:
-                    if parent == option:
-                        for item in self.pathParams.paths[level][parent]["value"]:
-                            # print item
-                            if item["option"].lower() == option.lower():
-                                pp[level] = {
-                                    "parent": parent,
-                                    "move_key": self.pathParams.paths[level][parent][TreeConst.Option_MoveKey],
-                                    "enter_key": self.pathParams.paths[level][parent][TreeConst.Option_EnterKey],
-                                    "others": self.pathParams.paths[level][parent][TreeConst.Option_Others],
-                                    "option": item[TreeConst.Option_Name],
-                                    "option_for_ocr": item[TreeConst.Option_ForOCR].split(';'),
-                                    "option_move_key": item[TreeConst.Option_MoveKey],
-                                    "option_enter_key": item[TreeConst.Option_EnterKey],
-                                    "option_others": item[TreeConst.Option_Others]
-                                }
-                                option = parent
-                                found = True
-                                break
-                            # endif
-                        # endfor
-                        break
-                    # endif
-            # endfor
-        # endfor
-        # 需要对path倒序使用;
-        # dict_pp = OrderedDict()
-        # # 逆序路径key;
-        # revpp = reversed(pp)
-        # for path in revpp:
-        #     dict_pp[path] = {"parent": pp[path]['parent'],"move_key": pp[path]['move_key'],"enter_key": pp[path]['enter_key'],"others":pp[path]['others'],"option": pp[path]['option'],"option_for_ocr": pp[path]['option_for_ocr']}
-        # # 返回逆序后的结果;
-        # return dict_pp
-        return pp
-
-    def checkOptionPath(self, optionName):
-        optionPath = ""
-        optionPathResult = "Fail"
-        path_params = self.get_option_paths(optionName)
-        # 如果传入的option不存在则直接返回
-        if path_params.__len__() <= 0:
-            optionPathResult = "NoExit"
-            optionPath = u"表格中不存在到达Option:   %s   的路径" % str(optionName)
-            return optionPath, optionPathResult
-        else:
-            optionPath = str(path_params)
-            # 逆序路径key;
-            revpp = reversed(path_params)
-            level_count = 0
-            for level in revpp:
-                if str(level) == str(g_level[level_count]):
-                    level_count = level_count + 1
-                else:
-                    # 如果执行路径不是按照First、Second......执行则返回执行出错
-                    return optionPath, optionPathResult
-            optionPathResult = "Pass"
-            return optionPath, optionPathResult
-
-    def checkRunOptionPath(self, path_params):
-        optionPathResult = "Fail"
-        # 如果传入的option不存在则直接返回
-        if path_params.__len__() <= 0:
-            optionPathResult = "NoExit"
-            return optionPathResult
-        else:
-            optionPath = str(path_params)
-            # 逆序路径key;
-            revpp = reversed(path_params)
-            level_count = 0
-            for level in revpp:
-                if str(level) == str(g_level[level_count]):
-                    level_count = level_count + 1
-                else:
-                    # 如果执行路径不是按照First、Second......执行则返回执行出错
-                    return optionPathResult
-            optionPathResult = "Pass"
-            return optionPathResult
-
-if __name__ == "__main__":
-    uiData = CTData()
-    pathManage = UITPathManage(uiData)
-    vp,pp = pathManage.get_menu_paths("hdmi1","hdmi1")
-    vp,pp = pathManage.get_menu_paths("dynamic_contrast","on")
-    print "vp:", vp
-    print "pp:",pp
-    chkPP=pathManage.checkRunOptionPath(pp)
-    print "check pp:",chkPP
-
-    pp = pathManage.get_option_paths("dynamic_contrast")
-    print "pp:",pp
-    chkPP = pathManage.checkRunOptionPath(pp)
-    print "check pp:",chkPP
-
-    optionPath, optionPathResult = pathManage.checkOptionPath("dynamic_contrast")
-    print "optionPath:",optionPath
-    print "optionPathResult:", optionPathResult

+ 0 - 23
ssat_sdk/MenuTree3/UIT_log.py

@@ -1,23 +0,0 @@
-# -*- coding:utf-8 -*-
-import os, sys, time
-from ssat_sdk.utils.LoggingUtil import printLog
-
-TAG = "UITree:"
-DEBUG = True
-INFO = True
-ERROR = True
-
-def debug(cls, fun, msg, enable):
-    if DEBUG and enable:
-        pstr = "Debug:" + TAG + cls + "[" + fun + "]" + msg
-        printLog(pstr)
-
-def info(cls, fun, msg, enable):
-    if INFO and enable:
-        pstr = "Info:" + TAG + cls + "[" + fun + "]" + msg
-        printLog(pstr)
-
-def error(cls, fun, msg, enable):
-    if ERROR and enable:
-        pstr = "Error:" + TAG + cls + "[" + fun + "]" + msg
-        printLog(pstr)

+ 0 - 18
ssat_sdk/MenuTree3/UIT_runner.py

@@ -1,18 +0,0 @@
-# -*- coding:utf-8 -*-
-import os, sys, time
-from UIT_runnerCommand import UITRunnerCommand
-from UIT_PathManage import UITPathManage
-from TData import CTData
-from UIT_log import error, debug, info
-
-DEBUG = True
-INFO =True
-ERROR = True
-class UITRunner():
-    cls = "UATRunner"
-    def __init__(self):
-        self.uitData = CTData()
-        self.uitPathManage = UITPathManage(self.uitData)
-        self.runnerCmd = UITRunnerCommand(self.uitPathManage)
-        # setOptionValue之后需要一个退回的pathlist来退出菜单
-        self.executedPath = []

+ 0 - 27
ssat_sdk/MenuTree3/UIT_runnerCommand.py

@@ -1,27 +0,0 @@
-# -*- coding:utf-8 -*-
-import cv2 as cv
-
-from UIT_log import error,debug,info
-from ssat_sdk.utils import  string_util
-from ssat_sdk.tv_operator import TvOperator
-
-from ssat_sdk.device_manage.capturecard_manager import CCardManager
-from ssat_sdk.sat_environment import getSATTmpDIR
-from ssat_sdk.pic_tool import ImageCMP
-from ssat_sdk.ocr_convert import OCRConvert
-from ssat_sdk.utils.string_util import strcmp, getDigitFromString
-import os, sys, time
-
-DEBUG = True
-INFO =True
-ERROR = True
-
-class UITRunnerCommand():
-    cls = "UATRunnerCommand"
-    def __init__(self, uitPathManage):
-        self.uitPathManage = uitPathManage
-        self.tvOperator = TvOperator()
-
-        self.CC = CCardManager()
-        self.imgCMP = ImageCMP()
-        self.ocrConvert = OCRConvert()

+ 0 - 390
ssat_sdk/MenuTree3/UIT_tree.py

@@ -1,390 +0,0 @@
-# -*- coding:utf-8 -*-
-from collections import OrderedDict
-from ssat_sdk.utils.string_util import strToList
-from UIT_log import error,info,debug
-from UIT_treeConstant import TreeConst
-from TConfig import TConfig
-DEBUG = True
-INFO = True
-ERROR = True
-
-g_level = TreeConst.G_LEVEL
-
-
-def parseMoveKey(keyStr):
-    return strToList(keyStr,";")
-
-class CPathParams():
-    cls = "CPathParams"
-    def __init__(self):
-        self.paths = OrderedDict()
-
-    def addParent(self,level, pDict):
-        if level not in self.paths:
-            self.paths[level] = {}
-        # endif
-        pDict["value"]=[]
-        pDict[TreeConst.Option_MoveKey] = parseMoveKey(pDict[TreeConst.Option_MoveKey])
-        # print "CPathParams,addParent:", pDict
-        if pDict[TreeConst.Parent_Name] in self.paths:
-            error(self.cls, "addParent", "Parent %s conflict."%(pDict[TreeConst.Parent_Name]),ERROR)
-        self.paths[level][pDict[TreeConst.Parent_Name]] = pDict
-
-    def addOption(self,level, pDict):
-        # print "CPathParams,addOption:", pDict
-        if level in self.paths:
-            if pDict[TreeConst.Parent_Name] in self.paths[level]:
-                if pDict[TreeConst.Option_Name].__len__() > 0:
-                    self.paths[level][pDict[TreeConst.Parent_Name]]["value"].append(pDict)
-            else:
-                error(self.cls, "addOption", "Parent %s not exist." % (pDict[TreeConst.Parent_Name]), ERROR)
-        else:
-            error(self.cls, "addOption", "Level %s not exist." % (level), ERROR)
-
-class CValueParams():
-    cls = "CValueParams"
-    def __init__(self):
-        self.values = OrderedDict()
-
-    def addParent(self, pDict):
-        if pDict[TreeConst.Value_Name] in self.values:
-            error(self.cls, "addParent", "Parent %s conflict."%(pDict[TreeConst.Value_Name]),ERROR)
-        pDict["value"]=[]
-        pDict[TreeConst.Value_MoveKey] = parseMoveKey(pDict[TreeConst.Value_MoveKey])
-        # print "CValueParams,addParent:", pDict
-        self.values[pDict[TreeConst.Value_Name]] = pDict
-
-    def addOption(self, pDict):
-        # print "CValueParams,addOption:", pDict
-        if pDict[TreeConst.Value_Name] in self.values:
-            if pDict[TreeConst.Value_Value].__len__() > 0:
-                self.values[pDict[TreeConst.Value_Name]]["value"].append(pDict)
-        else:
-            error(self.cls, "addOption", "Parent %s not exist." % (pDict[TreeConst.Value_Name]), ERROR)
-
-class CDialogParams():
-    cls = "CDialogParams"
-    def __init__(self):
-        self.dialogs = OrderedDict()
-
-    def addParent(self,level, pDict):
-        # endif
-        if pDict[TreeConst.Parent_Name] in self.dialogs:
-            error(self.cls, "addParent","Parent %s conflict."%(pDict[TreeConst.Parent_Name]), ERROR)
-        pDict["value"] = []
-        pDict[TreeConst.Option_MoveKey] = parseMoveKey(pDict[TreeConst.Option_MoveKey])
-        # print "CDialogParams,addParent:", pDict
-        self.dialogs[pDict[TreeConst.Parent_Name]] = pDict
-
-    def addOption(self,level,pDict):
-        # print "CDialogParams,addOption:", pDict
-        if pDict[TreeConst.Parent_Name] in self.dialogs:
-            if pDict[TreeConst.Option_Name].__len__() > 0:
-                self.dialogs[pDict[TreeConst.Parent_Name]]["value"].append(pDict)
-        else:
-            error(self.cls, "addOption","Parent %s not exist.", ERROR)
-
-class UITTree():
-    def __init__(self,tConfig):
-        self.pathParams = CPathParams()
-        self.valueParams = CValueParams()
-        self.dialogParams = CDialogParams()
-        self.tConfig = tConfig
-        self.cls = "UITTree"
-
-    # 获取键对值
-    def get_pair_values(self, name, option=True):
-        if type(name) == str:
-            name = unicode(name)
-        pairs = []
-        if option is True:
-            find = False
-            for level in self.pathParams.paths:
-                for item in self.pathParams.paths[level]:
-                    if item.lower() == name.lower():
-                        find = True
-                        for item in self.pathParams.paths[level][name]["value"]:
-                            pairs.append({item['option']: item['option_for_ocr'].split(';')})
-                        break
-                # endfor
-                if find is True:
-                    break
-            # endfor
-        else:
-            if name in self.valueParams.values:
-                for item in self.valueParams.values[name]["value"]:
-                    pairs.append({item['value']: item['value_for_ocr'].split(';')})
-        # endif
-        return pairs
-
-    # 获取指定层级的path或value的xxx_for_ocr列表;
-    def get_ocr_list(self, level, name, option, is_option=True):
-        if type(name) == str:
-            name = unicode(name)
-        if type(option) == str:
-            option = unicode(option)
-        list_ocr = []
-        if is_option is True:
-            find = False
-            for item in self.pathParams.paths[level]:
-                if item.lower() == name.lower():
-                    find = True
-                    for item in self.pathParams.paths[level][name]["value"]:
-                        if str(option).lower() != str(item["option"]).lower():
-                            list_ocr.append(item['option_for_ocr'].split(';'))
-                    break
-            # endfor
-        else:
-            if name in self.valueParams.values:
-                for item in self.valueParams.values[name]["value"]:
-                    list_ocr.append(item['value_for_ocr'].split(';'))
-        # endif
-        return list_ocr
-
-    # 获取指定value_name所在菜单项的全部同级菜单项ocr列表;
-    def get_parent_ocr_list(self, option):
-        # 编码转换;
-        if type(option) == str:
-            option = unicode(option)
-
-        found = False
-        list_ocr = []
-        # 首先,字典不排序,需要倒序;
-        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():
-                        found = True
-                        break
-                # endfor
-                # 找到退出;
-                if found is True:
-                    break
-            # endfor
-            # 找到退出;
-            if found is True:
-                break
-        # endfor
-
-        # 遍历value列表;
-        if found is True:
-            for val in self.pathParams.paths[level][parent]["value"]:
-                list_ocr.extend(val['option_for_ocr'].split(';'))
-        # 按长度排序;
-        list_ocr.sort(key=lambda i: len(i), reverse=True)
-        # 返回结果;
-        return list_ocr
-
-    # 当value_sheet = False,表示获取path表里的option层级的所有option_for_ocr:option
-    # 当value_sheet = True,表示获取value表里的value_name层级的所有value_for_ocr:value
-    def get_parent_ocr_dict(self, option, value_sheet=False):
-        print "get_parent_ocr_dict.option:", option
-        # 编码转换;
-        if type(option) == str:
-            option = unicode(option)
-
-        found = False
-        dict_ocr = {}
-        list_ocr = []
-        if value_sheet is False:
-            # 首先,字典不排序,需要倒序;
-            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():
-                            found = True
-                            break
-                    # endfor
-                    # 找到退出;
-                    if found is True:
-                        break
-                # endfor
-                # 找到退出;
-                if found is True:
-                    break
-
-            # 遍历value列表;
-            if found is True:
-                for val in self.pathParams.paths[level][parent]["value"]:
-                    list_ocr = val['option_for_ocr'].split(';')
-                    for ocr in list_ocr:
-                        dict_ocr[ocr.lower()] = val['option']
-        else:
-            if option in self.valueParams.values:
-                for val in self.valueParams.values[option]["value"]:
-                    list_ocr = val['value_for_ocr'].split(';')
-                    for ocr in list_ocr:
-                        dict_ocr[ocr.lower()] = val['value']
-
-        print 'unsorted=', dict_ocr
-        # 按长度排序;
-        list_ocr = sorted(dict_ocr.keys(), key=lambda key: len(key), reverse=True)
-        dict_reuslt = OrderedDict()
-        for ocr in list_ocr:
-            dict_reuslt[ocr] = dict_ocr[ocr]
-        # 返回结果;
-        return dict_reuslt
-
-    def get_option_ocr(self, option):
-        # 编码转换;
-        if type(option) == str:
-            option = unicode(option)
-
-        found = False
-        list_ocr = []
-        # 首先,字典不排序,需要倒序;
-        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():
-                        list_ocr = vals['option_for_ocr'].split(';')
-                        found = True
-                        break
-                # endfor
-                # 找到退出;
-                if found is True:
-                    break
-            # endfor
-            # 找到退出;
-            if found is True:
-                break
-        # endfor
-        # 返回结果;
-        return list_ocr
-
-    def get_value(self, option, value=""):
-        # 编码转换;
-        if type(option) == str:
-            option = unicode(option)
-        xlsValue = self.valueParams.values[option]["value"]
-        valueList = []
-        valueOcrList = []
-        for item in xlsValue:
-            valueList.append(item["value"])
-            valueOcrList.append(item["value_for_ocr"])
-        vp = {}
-        if option in self.valueParams.values:
-            vp = {"option": option, "value": valueList, "value_for_ocr": valueOcrList,
-                  "enter_key": self.valueParams.values[option]["enter_key"],
-                  "move_key": self.valueParams.values[option]["move_key"],
-                  "others": self.valueParams.values[option]['others']}
-            # 找到value对应的ocr;
-            if value != "":
-                vp["value"] = value
-                for item in self.valueParams.values[option]["value"]:
-                    if "range(" in item["value"]:
-                        vp["value_for_ocr"] = item["value_for_ocr"].split(';')
-                        break
-                    elif item["value"].lower() == value.lower():
-                        vp["value_for_ocr"] = item["value_for_ocr"].split(';')
-                        break
-                # endfor
-            # endif
-        # endif
-        # 返回结果;
-        return vp
-
-    # 获取option层级内容;
-    def get_option(self, option):
-        # 编码转换;
-        if type(option) == str:
-            option = unicode(option)
-
-        found = False
-        layers = 0
-        dict_option = {}
-        # 首先,字典不排序,需要倒序;
-        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['option_ocr'] = vals['option_for_ocr'].split(';')
-                            dict_option['option_move_key'] = vals['option_move_key']
-                            dict_option['option_enter_key'] = vals['option_enter_key']
-                            dict_option['option_others'] = vals['option_others']
-                        option = parent
-                        layers += 1  # 层数;
-                        break
-                # endfor
-            # endfor
-        # endfor
-        if found is True:
-            dict_option['layers'] = layers
-            # first层次的parent名称;
-            dict_option['first_parent'] = option
-        # 返回结果;
-        return found, dict_option
-
-    # 获取表格Value层级中,value_name下包含的value列表
-    def getSubValueList(self, value_name):
-        valueList = []
-        if self.valueParams.values.has_key(value_name):
-            # print parser.valueParams.values["source"]
-            # print parser.valueParams.values["source"]["value"]
-            valueDictList = self.valueParams.values[value_name]["value"]
-            for valueDict in valueDictList:
-                valueList.append(valueDict["value"])
-        # print "valueList:", valueList, type(valueList)
-        if valueList.__len__() == 1 and "range(" in valueList[0]:
-            value_for_ocr_low = str(valueList[0]).lower()
-            str_num = value_for_ocr_low.replace("range", "")
-            list_num = eval(str_num)
-            min_num = list_num[0]
-            max_num = list_num[1]
-            return [min_num, max_num]
-
-        return valueList
-
-    # 获取表格First~Sixth层级中,parent下包含的option列表
-    def getSubOptionList(self, parent):
-        optionList = []
-        paths = self.pathParams.paths
-        for level in paths:
-            if paths[level].has_key(parent):
-                optionDictList = paths[level][parent]["value"]
-                for optionDict in optionDictList:
-                    optionList.append(optionDict["option"])
-        # print "optionList:", optionList, type(optionList)
-        return optionList
-
-    # 获取表格Value层级中,value_name下的value的ocr列表
-    def getValueTextList(self, value_name, value):
-        valueTextList = []
-        if self.valueParams.values.has_key(value_name):
-            # print parser.valueParams.values["source"]
-            # print parser.valueParams.values["source"]["value"]
-            valueDictList = self.valueParams.values[value_name]["value"]
-            for valueDict in valueDictList:
-                if valueDict["value"] == value:
-                    value_for_ocr = valueDict["value_for_ocr"]
-                    # print "value_for_ocr:", value_for_ocr, type(value_for_ocr)
-                    valueTextList = value_for_ocr.split(';')
-
-        # print "valueTextList:", valueTextList, type(valueTextList)
-        return valueTextList
-
-    # 获取表格First~Sixth层级中,parent下的option的ocr列表
-    def getOptionTextList(self, parent, option):
-        optionTextList = []
-        paths = self.pathParams.paths
-        for level in paths:
-            if paths[level].has_key(parent):
-                optionDictList = paths[level][parent]["value"]
-                for optionDict in optionDictList:
-                    if optionDict["option"] == option:
-                        option_for_ocr = optionDict["option_for_ocr"]
-                        # print "option_for_ocr:", option_for_ocr, type(option_for_ocr)
-                        optionTextList = option_for_ocr.split(';')
-        # print "optionList:", optionTextList, type(optionTextList)
-        return optionTextList

+ 0 - 25
ssat_sdk/MenuTree3/UIT_treeConstant.py

@@ -1,25 +0,0 @@
-# -*- coding:utf-8 -*-
-import os, sys, time
-
-class TreeConst():
-    G_LEVEL = ['First', 'Second', 'Third', 'Fourth', 'Fifth', 'Sixth', 'Seventh', 'Eighth', 'Ninth', 'Tenth',
-               'Eleventh', 'Twelfth']
-    Parent_Name = u'parent'
-    Parent_ShortKey = u'shortcut_key'
-    Parent_ToParentKey = u'toparent_key'
-    Parent_Layout = u'layout'
-    Option_Name = u'option'
-    Option_ForOCR = u'option_for_ocr'
-    Option_MoveKey = u'move_key'
-    Option_EnterKey = u'enter_key'
-    Option_Others = u'others'
-    Value_Name = u'value_name'
-    Value_Value = u'value'
-    Value_ForOCR = u'value_for_ocr'
-    Value_MoveKey = u'move_key'
-    Value_EnterKey = u'enter_key'
-    Value_Others = u'others'
-    FLevel_Params=[Parent_Name, Parent_ShortKey, Parent_ToParentKey, Parent_Layout, Option_Name, Option_ForOCR, Option_MoveKey, Option_EnterKey, Option_Others]
-    NLevel_Params=[Parent_Name, Parent_ToParentKey, Parent_Layout, Option_Name, Option_ForOCR, Option_MoveKey, Option_EnterKey, Option_Others]
-    VLevel_Params=[Value_Name, Value_Value, Value_ForOCR, Value_MoveKey,Value_EnterKey, Value_Others]
-    DLevel_Params = NLevel_Params