本文整理汇总了Python中org.sikuli.script.Region类的典型用法代码示例。如果您正苦于以下问题:Python Region类的具体用法?Python Region怎么用?Python Region使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Region类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, *args):
if len(args)==4:
JRegion.__init__(self, args[0], args[1], args[2], args[3])
elif len(args)==1:
JRegion.__init__(self, args[0])
else:
raise Exception("Wrong number of parameters of Region's contructor")
示例2: wait
def wait(self, target, timeout=None):
if isinstance(target, int) or isinstance(target, long):
target = float(target)
if timeout == None:
return JRegion.wait(self, target)
else:
return JRegion.wait(self, target, timeout)
示例3: type
def type(self, *args):
if len(args) == 1:
return JRegion.type(self, None, args[0], 0)
if len(args) == 2:
if __builtin__.type(args[1]) is types.IntType:
return JRegion.type(self, None, args[0], args[1])
else:
return JRegion.type(self, args[0], args[1], 0)
return JRegion.type(self, args[0], args[1], args[2])
示例4: wait
def wait(self, target, timeout=None):
if isinstance(target, int) or isinstance(target, long) or isinstance(target, float):
time.sleep(target)
return
if timeout == None:
ret = JRegion.wait(self, target)
else:
ret = JRegion.wait(self, target, timeout)
return ret
示例5: wait
def wait(self, target, timeout=None):
ttype = __builtin__.type(target)
if ttype is types.IntType or ttype is types.FloatType:
time.sleep(target)
return
if timeout == None:
ret = JRegion.wait(self, target)
else:
ret = JRegion.wait(self, target, timeout)
return ret
示例6: __init__
def __init__(self, *args):
if DEBUG: print "**IN*** Jython INIT Region"
if len(args)==4:
JRegion.__init__(self, args[0], args[1], args[2], args[3])
elif len(args)==1:
JRegion.__init__(self, args[0])
else:
raise Exception("Wrong number of parameters of Region's contructor")
self.setScriptingType("JythonRegion")
self._global_funcs = None
if DEBUG: print "**OUT** Jython INIT Region"
示例7: onChange
def onChange(self, arg1, arg2=None):
t_arg1 = __builtin__.type(arg1)
if t_arg1 is types.IntType:
min_size = arg1
handler = arg2
else:
min_size = None
handler = arg1
class AnonyObserver(SikuliEventAdapter):
def targetChanged(self, event):
handler(event)
if min_size != None:
return JRegion.onChange(self, min_size, AnonyObserver())
return JRegion.onChange(self, AnonyObserver())
示例8: click
def click(self, target, modifiers=0):
try:
return SikuliRegion.click(self, target, modifiers)
except FindFailed, e:
self.log.html_img("Find Filed", "images/" + getFilename(target))
self.log.screenshot(msg="Region", region=(self.getX(), self.getY(), self.getW(), self.getH()))
raise e
示例9: dragDrop
def dragDrop(self,src, dest, modifiers=0):
try:
return SikuliRegion.dragDrop(self,src, dest, modifiers)
except FindFailed, e:
self.log.html_img("Find Filed", getFilename(src)+" or " + getFilename(src))
self.log.screenshot(msg="Region", region=(self.getX(), self.getY(), self.getW(), self.getH()))
raise e
示例10: doubleclick
def doubleclick(self,target,modifiers=0):
addFoundImage(getFilename(target))
try:
return SikuliRegion.doubleClick(self, target, modifiers)
except FindFailed, e:
self.log.html_img("Find Filed", getFilename(target)) #"images/" + getFilename(target))
self.log.screenshot(msg="Region", region=(self.getX(), self.getY(), self.getW(), self.getH()))
raise e
示例11: mouseMove
def mouseMove(self,target):
addFoundImage(getFilename(target))
try:
return SikuliRegion.mouseMove(self,target)
except FindFailed, e:
self.log.html_img("Find Filed", getFilename(target)) #"images/" + getFilename(target))
self.log.screenshot(msg="Region", region=(self.getX(), self.getY(), self.getW(), self.getH()))
raise e
示例12: onChange
def onChange(self, arg1, arg2=None):
if isinstance(arg1, int):
min_size = arg1
handler = arg2
else:
if (arg2 != None):
raise Exception("onChange: Invalid parameters set")
min_size = None
handler = arg1
class AnonyObserver(SikuliEventAdapter):
def targetChanged(self, event):
handler(event)
if min_size != None:
return JRegion.onChange(self, min_size, AnonyObserver())
return JRegion.onChange(self, AnonyObserver())
示例13: paste
def paste(self, *args):
if len(args) == 1:
target = None
s = args[0]
elif len(args) == 2:
target = args[0]
s = args[1]
if isinstance(s, types.StringType):
s = java.lang.String(s, "utf-8")
return JRegion.paste(self, target, s)
示例14: _adjustRegion
def _adjustRegion(r_, offset = (0,0), expand=(0,0,0,0)):
r = Region(r_)
# Offset
(dx,dy) = offset
r.x += dx
r.y += dy
# Expansion
if isinstance(expand, tuple):
(dt,dl,db,dr) = expand
else:
(dt,dl,db,dr) = (expand,expand,expand,expand)
r.x -= dl
r.y -= dt
r.w = r.w + dl + dr
r.h = r.h + dt + db
return r
示例15: testToJythonRegion
def testToJythonRegion(self):
jr = JRegion(0, 0, 100, 100)
pyr = JRegion.toJythonRegion(jr)
self.assertEqual(jr.x, pyr.x)
self.assertEqual(jr.y, pyr.y)
self.assertEqual(jr.w, pyr.w)
self.assertEqual(jr.h, pyr.h)
try:
with jr:
self.fail("should not happen: __exit__ is not defined in Java.")
except AttributeError,e:
pass