コード例 #1
0
ファイル: unity3d_poco.py プロジェクト: kaluluosi/Poco
 def __init__(self, client):
     self.client = client
     self.support_vr = False
     try:
         self.support_vr = self.client.call("isVrSupported")
     except InvalidOperationException:
         raise InvalidOperationException('VR not supported')
コード例 #2
0
    def scroll(self, direction='vertical', percent=1, duration=2.0):
        # 重写Win下的Scroll函数,percent代表滑动滚轮多少次,正数为向上滑,负数为向下滑,direction无用,只能上下滚
        if direction not in ('vertical', 'horizontal'):
            raise ValueError(
                'Argument `direction` should be one of "vertical" or "horizontal". Got {}'
                .format(repr(direction)))
        if direction is 'horizontal':
            raise InvalidOperationException(
                "Windows does not support horizontal scrolling currently")

        return self.agent.input.scroll(direction, percent, duration)
コード例 #3
0
    def setattr(self, name, val):
        """
        Change the attribute value of the UI element. Not all attributes can be casted to text. If changing the
        immutable attributes or attributes which do not exist, the InvalidOperationException exception is raised.

        Args:
            name: attribute name
            val: new attribute value to cast

        Raises:
            InvalidOperationException: when it fails to set the attribute on UI element
        """

        nodes = self._do_query(multiple=False)
        try:
            return self.poco.agent.hierarchy.setAttr(nodes, name, val)
        except UnableToSetAttributeException as e:
            raise InvalidOperationException('"{}" of "{}"'.format(str(e), self))