|
@@ -1,5 +1,6 @@
|
|
|
|
|
|
import os
|
|
|
+from enum import Enum
|
|
|
from BaseLog import CBaseLog
|
|
|
from ExtraData import CExtraData
|
|
|
from OptionExcel import COptionExcel
|
|
@@ -44,6 +45,13 @@ def strSplit(text):
|
|
|
return ret
|
|
|
|
|
|
|
|
|
+
|
|
|
+class VType(Enum):
|
|
|
+ SelectType = 0
|
|
|
+ InputType = 1
|
|
|
+ RangeType = 2
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
class COptionAction(CBaseLog):
|
|
@@ -83,6 +91,9 @@ class COptionAction(CBaseLog):
|
|
|
self.__optionValueText = ""
|
|
|
|
|
|
self.getCurOptionInfo()
|
|
|
+
|
|
|
+ self.__isEnterKeyInValue = False
|
|
|
+ self.__valueType = VType.SelectType
|
|
|
|
|
|
@property
|
|
|
def pos(self):
|
|
@@ -105,6 +116,7 @@ class COptionAction(CBaseLog):
|
|
|
参数:无
|
|
|
返回:截图路径;
|
|
|
'''
|
|
|
+
|
|
|
def takePicture(self):
|
|
|
img = os.path.join(getSATTmpDIR(), "menutree_runpath.png")
|
|
|
COptionAction.__ccard.takePicture(img)
|
|
@@ -145,6 +157,7 @@ class COptionAction(CBaseLog):
|
|
|
参数:
|
|
|
返回:
|
|
|
'''
|
|
|
+
|
|
|
def inputUnlock(self, stdText, password=''):
|
|
|
|
|
|
self.sendKey("ok")
|
|
@@ -182,6 +195,7 @@ class COptionAction(CBaseLog):
|
|
|
|
|
|
注意:对应以前的dealOthers函数。
|
|
|
'''
|
|
|
+
|
|
|
def dealPasswordBox(self):
|
|
|
parentOption = ''
|
|
|
if self.isOnValueSheet():
|
|
@@ -259,7 +273,7 @@ class COptionAction(CBaseLog):
|
|
|
|
|
|
if isValueSheet:
|
|
|
curLevel = 'value'
|
|
|
- curParent = self.__optionPaths[g_level[self.__pos-1]]['parent']
|
|
|
+ curParent = self.__optionPaths[g_level[self.__pos - 1]]['parent']
|
|
|
curOption = self.__optionValueInfo['option']
|
|
|
curOthers = self.__optionValueInfo['others']
|
|
|
else:
|
|
@@ -307,7 +321,8 @@ class COptionAction(CBaseLog):
|
|
|
ocrThreshold, curOthers['marquee'],
|
|
|
isNumberText, isValueSheet)
|
|
|
else:
|
|
|
- return self.__getStaticPicText(self.takePicture(), curOption, optionTextList, siblingTextList, ocrConfigList,
|
|
|
+ return self.__getStaticPicText(self.takePicture(), curOption, optionTextList, siblingTextList,
|
|
|
+ ocrConfigList,
|
|
|
ocrThreshold,
|
|
|
isNumberText, isValueSheet)
|
|
|
|
|
@@ -318,6 +333,7 @@ class COptionAction(CBaseLog):
|
|
|
返回:Boolean.
|
|
|
|
|
|
'''
|
|
|
+
|
|
|
def isOnTargetOption(self):
|
|
|
return True if self.__pos == (self.__optionPaths.__len__() - 1) else False
|
|
|
|
|
@@ -403,6 +419,25 @@ class COptionAction(CBaseLog):
|
|
|
backKey = self.__curOptionInfo['back_key']
|
|
|
else:
|
|
|
backKey = self.__optionValueInfo['back_key']
|
|
|
+
|
|
|
+ if not self.__isEnterKeyInValue:
|
|
|
+
|
|
|
+ self.__isEnterKeyInValue = True
|
|
|
+ self.info(u"进入了value表但未按enter key, 值类型=%s" % str(self.__valueType))
|
|
|
+ if self.__valueType == VType.SelectType:
|
|
|
+
|
|
|
+ self.back2ParentNode(False)
|
|
|
+ elif self.__valueType == VType.InputType:
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ elif self.__valueType == VType.RangeType:
|
|
|
+
|
|
|
+ self.back2ParentNode(False)
|
|
|
|
|
|
if backKey.__len__() == 0:
|
|
|
self.sendKey('return', 1, 1)
|
|
@@ -446,6 +481,7 @@ class COptionAction(CBaseLog):
|
|
|
|
|
|
a移动到p4上,完成了v1设置后,a.back2ParentNode()后,此时如果要操作b并设置v2,就要b.SetCurPos(a.pos).
|
|
|
'''
|
|
|
+
|
|
|
def setCurPos(self, pos):
|
|
|
if pos < 0 or pos > self.__optionPaths.__len__():
|
|
|
self.error(u"pos值[%d]超出路径范围:[0-%d]" % (pos, self.__optionPaths.__len__()))
|
|
@@ -486,14 +522,14 @@ class COptionAction(CBaseLog):
|
|
|
|
|
|
|
|
|
|
|
|
- valueType = 0
|
|
|
+ self.__valueType = VType.SelectType
|
|
|
|
|
|
isNumberText = self.isNumberText(valueText)
|
|
|
|
|
|
if isNumberText:
|
|
|
if moveKey[0] == 'input':
|
|
|
|
|
|
- valueType = 1
|
|
|
+ self.__valueType = VType.InputType
|
|
|
|
|
|
optionValue = self.__optionValue
|
|
|
if type(optionValue) == int or type(optionValue) == float:
|
|
@@ -503,14 +539,14 @@ class COptionAction(CBaseLog):
|
|
|
self.sendKey(chList, 1, duration)
|
|
|
else:
|
|
|
|
|
|
- valueType = 2
|
|
|
+ self.__valueType = VType.RangeType
|
|
|
|
|
|
num = int(self.__optionValue) - int(self.__optionValueText)
|
|
|
|
|
|
self.sendKey(moveKey[1] if num > 0 else moveKey[0], abs(num), duration)
|
|
|
elif moveKey[0] == 'input':
|
|
|
|
|
|
- valueType = 1
|
|
|
+ self.__valueType = VType.InputType
|
|
|
|
|
|
chList = list(self.__optionValue)
|
|
|
self.sendKey(chList, 1, duration)
|
|
@@ -519,24 +555,10 @@ class COptionAction(CBaseLog):
|
|
|
if enterKey != 'default':
|
|
|
self.info(u"value节点具有enter key")
|
|
|
self.sendKey(enterKey, 1, 0.1)
|
|
|
+ self.__isEnterKeyInValue = True
|
|
|
|
|
|
|
|
|
|
|
|
- else:
|
|
|
- if valueType == 0:
|
|
|
-
|
|
|
- self.back2ParentNode(False)
|
|
|
- elif valueType == 1:
|
|
|
- pass
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- elif valueType == 2:
|
|
|
-
|
|
|
- self.back2ParentNode(False)
|
|
|
|
|
|
'''
|
|
|
函数:获取当前层级的目标option详细信息.
|
|
@@ -569,6 +591,7 @@ class COptionAction(CBaseLog):
|
|
|
参数:无
|
|
|
返回:Boolean, 检测正常返回True
|
|
|
'''
|
|
|
+
|
|
|
def checkRunOptionPath(self):
|
|
|
outData = self.__optionExcel.checkOptionPaths(self.__optionPaths)
|
|
|
if str(outData[1]) == 'NoExit':
|
|
@@ -587,6 +610,7 @@ class COptionAction(CBaseLog):
|
|
|
textList value_for_ocr或option_for_ocr数组
|
|
|
返回:Boolean, 如果是range(xx,xx)类型返回True.
|
|
|
'''
|
|
|
+
|
|
|
def isNumberText(self, textList):
|
|
|
|
|
|
isNumberText = False
|
|
@@ -840,6 +864,7 @@ class COptionAction(CBaseLog):
|
|
|
参数:
|
|
|
返回:
|
|
|
'''
|
|
|
+
|
|
|
def getPathLength(self):
|
|
|
if self.__optionPaths is None:
|
|
|
self.error(u"路径空,返回0")
|