|
@@ -17,21 +17,21 @@ class COptionConfig(TConfig, CBaseLog):
|
|
|
def __init__(self, menuTreeDir, pathManager):
|
|
|
self.__pathManager = pathManager
|
|
|
if self.__pathManager is None:
|
|
|
- self.error("路径参数错误:None")
|
|
|
+ self.error(u"路径参数错误:None")
|
|
|
# 状态:False表示路径值失败;
|
|
|
self.status = False
|
|
|
# menuTree目录;
|
|
|
self.__uiTreeDir = menuTreeDir
|
|
|
# 判断是否为目录;
|
|
|
if not os.path.isdir(self.__uiTreeDir):
|
|
|
- self.error("%s 不是menuTree目录" % self.__uiTreeDir)
|
|
|
+ self.error(u"%s 不是menuTree目录" % self.__uiTreeDir)
|
|
|
# 判断目录是否存在;
|
|
|
if not os.path.exists(self.__uiTreeDir):
|
|
|
- self.error("menuTree(%s)目录不存在" % self.__uiTreeDir)
|
|
|
+ self.error(u"menuTree(%s)目录不存在" % self.__uiTreeDir)
|
|
|
# 判断配置文件是否存在;
|
|
|
self.__configPath = os.path.join(self.__uiTreeDir, "menutree.ini")
|
|
|
if not os.path.exists(self.__configPath):
|
|
|
- self.error("menutree配置文件不存在:%s" % self.__configPath)
|
|
|
+ self.error(u"menutree配置文件不存在:%s" % self.__configPath)
|
|
|
self.status = True
|
|
|
# 初始化父类;
|
|
|
TConfig.__init__(self, self.__configPath)
|
|
@@ -51,7 +51,7 @@ class COptionConfig(TConfig, CBaseLog):
|
|
|
waitTime = float(self.get_value("waitTime", optionName))
|
|
|
except Exception:
|
|
|
waitTime = 1.0
|
|
|
- self.error("获取%s界面的等待界面时间失败,使用默认值1.0s" % str(parent))
|
|
|
+ self.error(u"获取%s界面的等待界面时间失败,使用默认值1.0s" % str(parent))
|
|
|
return waitTime
|
|
|
|
|
|
# 获取阀值字典;
|
|
@@ -75,7 +75,7 @@ class COptionConfig(TConfig, CBaseLog):
|
|
|
paths = self.__pathManager.get_option_paths(optionName)
|
|
|
# 判断路径节点是否空;
|
|
|
if paths.__len__() == 0:
|
|
|
- self.error("当前【%s】的路径节点空,使用默认的配置值%s" % (optionName, def_cfg))
|
|
|
+ self.error(u"当前【%s】的路径节点空,使用默认的配置值%s" % (optionName, def_cfg))
|
|
|
return False, def_cfg
|
|
|
|
|
|
# 获取first parent;
|
|
@@ -97,22 +97,22 @@ class COptionConfig(TConfig, CBaseLog):
|
|
|
# 首配图片判断是否存在,不存在取用次配图片路径;
|
|
|
if not os.path.exists(icon_path):
|
|
|
# 使用次配图片,父级配图;
|
|
|
- self.warn("Option(%s)首配图片不存在:%s" % (optionName, icon_path))
|
|
|
+ self.warn(u"Option(%s)首配图片不存在:%s" % (optionName, icon_path))
|
|
|
icon_path = os.path.join(self.__uiTreeDir, "icon\\" + cur_parent + "." + cur_level + ".png")
|
|
|
icon_dir_path = os.path.join(self.__uiTreeDir, "icon\\" + cur_parent + "." + cur_level + ".dir.png")
|
|
|
opc_cfg = self.get_value_dict(cur_level, cur_parent)
|
|
|
- self.warn("Option(%s)首配图片不存在,尝试使用次配图(%s):%s,配置%s" % (optionName, cur_parent, icon_path, opc_cfg))
|
|
|
+ self.warn(u"Option(%s)首配图片不存在,尝试使用次配图(%s):%s,配置%s" % (optionName, cur_parent, icon_path, opc_cfg))
|
|
|
# 如果次配都不存在,使用顶层配图;
|
|
|
if not os.path.exists(icon_path):
|
|
|
- self.warn("Option(%s)次配图片不存在:%s" % (optionName, icon_path))
|
|
|
+ self.warn(u"Option(%s)次配图片不存在:%s" % (optionName, icon_path))
|
|
|
# 使用顶层配图(first parent)
|
|
|
icon_path = os.path.join(self.__uiTreeDir, "icon\\" + first_parent + "." + cur_level + "_" + optionName + ".png")
|
|
|
icon_dir_path = os.path.join(self.__uiTreeDir, "icon\\" + first_parent + "." + cur_level + "_" + optionName + ".dir.png")
|
|
|
opc_cfg = self.get_value_dict(cur_level, first_parent)
|
|
|
- self.warn("Option(%s)次配图片不存在,尝试使用顶层配图(%s):%s,配置%s" % (optionName, first_parent, icon_path, opc_cfg))
|
|
|
+ self.warn(u"Option(%s)次配图片不存在,尝试使用顶层配图(%s):%s,配置%s" % (optionName, first_parent, icon_path, opc_cfg))
|
|
|
# 如果顶层配图不存在,退出;
|
|
|
if not os.path.exists(icon_path):
|
|
|
- self.error("%s对应的顶层菜单配图不存在%s,使用默认配置%s" % (optionName, icon_path, def_cfg))
|
|
|
+ self.error(u"%s对应的顶层菜单配图不存在%s,使用默认配置%s" % (optionName, icon_path, def_cfg))
|
|
|
return False, def_cfg
|
|
|
# endif
|
|
|
# endif
|
|
@@ -139,11 +139,11 @@ class COptionConfig(TConfig, CBaseLog):
|
|
|
paths = self.__pathManager.get_option_paths(optionName)
|
|
|
# 判断路径节点是否空;
|
|
|
if paths.__len__() == 0:
|
|
|
- self.error("当前【%s】的路径节点空,将使用默认的ocr配置%s" % (optionName, def_orc))
|
|
|
+ self.error(u"当前【%s】的路径节点空,将使用默认的ocr配置%s" % (optionName, def_orc))
|
|
|
else:
|
|
|
# 如果状态False,退出;
|
|
|
if self.status is False:
|
|
|
- self.warn("配置文件(%s)不存在,%s使用默认的ocr配置%s" % (self.__configPath, optionName, def_orc))
|
|
|
+ self.warn(u"配置文件(%s)不存在,%s使用默认的ocr配置%s" % (self.__configPath, optionName, def_orc))
|
|
|
else:
|
|
|
# 读取指定的ocr配置信息;
|
|
|
for i in range(g_level.index(paths.__len__() - 1), -1, -1):
|
|
@@ -153,26 +153,26 @@ class COptionConfig(TConfig, CBaseLog):
|
|
|
# 是否有当前option的ocr配置;
|
|
|
if self.has_option(cur_level, optionName + '.ocr'):
|
|
|
ocr_dict = self.get_dict(self.get_value(cur_level, optionName + '.ocr'))
|
|
|
- self.warn("%s使用自身的ocr配置%s" % (optionName, ocr_dict))
|
|
|
+ self.warn(u"%s使用自身的ocr配置%s" % (optionName, ocr_dict))
|
|
|
break
|
|
|
# 如果option本身没有配置,获取其父节点的配置;
|
|
|
if self.has_option(cur_level, cur_parent + '.ocr'):
|
|
|
ocr_dict = self.get_dict(self.get_value(cur_level, cur_parent + '.ocr'))
|
|
|
- self.warn("%s使用父节点%s的ocr配置%s" % (optionName, cur_parent, ocr_dict))
|
|
|
+ self.warn(u"%s使用父节点%s的ocr配置%s" % (optionName, cur_parent, ocr_dict))
|
|
|
break
|
|
|
# 如果option父级没有配置,则获取顶层配置(first parent);
|
|
|
if self.has_option(cur_level, first_parent + '.ocr'):
|
|
|
ocr_dict = self.get_dict(self.get_value(cur_level, first_parent + '.ocr'))
|
|
|
- self.warn("%s使用顶层节点%s的ocr配置%s" % (optionName, first_parent, ocr_dict))
|
|
|
+ self.warn(u"%s使用顶层节点%s的ocr配置%s" % (optionName, first_parent, ocr_dict))
|
|
|
break
|
|
|
# end-for
|
|
|
# end-if
|
|
|
# end-if
|
|
|
if ocr_dict.__len__() == 0:
|
|
|
ocr_dict = def_orc
|
|
|
- self.warn("无有效的ocr配置,将使用默认的ocr配置%s" % def_orc)
|
|
|
+ self.warn(u"无有效的ocr配置,将使用默认的ocr配置%s" % def_orc)
|
|
|
|
|
|
- self.info("%s使用的ocr配置=%s" % (optionName, ocr_dict))
|
|
|
+ self.info(u"%s使用的ocr配置=%s" % (optionName, ocr_dict))
|
|
|
|
|
|
return ocr_dict
|
|
|
|