MCPcopy Index your code
hub / github.com/AirtestProject/Poco / UIObjectProxy

Class UIObjectProxy

poco/proxy.py:77–891  ·  view source on GitHub ↗

UI Proxy class that represents the UI element on target device. Any action performing on this instance is handled by Poco. It is not necessary to initialize this object manually. See ``QueryCondition`` for more details about how to select the UI elements. Args: poco: the p

Source from the content-addressed store, hash-verified

75
76
77class UIObjectProxy(object):
78 """
79 UI Proxy class that represents the UI element on target device.
80
81 Any action performing on this instance is handled by Poco. It is not necessary to initialize this object manually.
82 See ``QueryCondition`` for more details about how to select the UI elements.
83
84 Args:
85 poco: the poco instance
86 name: query condition of "name" attribute, i.e. the UI element(s) with ``name`` name will be selected
87 attrs: other query expressions except for the ``name``
88
89 See Also:
90 :py:meth:`select UI element(s) by poco <poco.pocofw.Poco.__call__>`
91 """
92
93 def __init__(self, poco, name=None, **attrs):
94 # query object in tuple
95 self.query = build_query(name, **attrs)
96 self.poco = poco
97
98 # this flag is introduced to improve the performance, it is set if multiple UI elements are selected and
99 # it does not affect the selection result
100 # 上一次选择是否是多选,如果不是多选但需要访问所有UI elements时会进行重新选择。
101 self._query_multiple = False
102
103 # true or false whether the corresponding UI elements of this UI proxy (self) have been selected
104 # 此UI proxy是否已经查找到对应的UI elements了
105 self._evaluated = False
106
107 # the proxy object of UI elements, migh be `node` or `[nodes]`, the proxy type is specified by
108 # `self._nodes_proxy_is_list`
109 # 可能是远程node代理,也可能是远程[node]代理, 由`self._nodes_proxy_is_list`指定是何种proxy类型
110 self._nodes = None
111 self._nodes_proxy_is_list = True
112
113 # use only for caching some proxies of sorted nodes in `self.__getitem__`
114 # 仅用于__getitem__时保存好已排序的child代理对象
115 self._sorted_children = None
116
117 # focus point of the UI element, see `CoordinateSystem` for more details
118 # 相对于包围盒的focus point定义,用于touch/swipe/drag操作的局部相对定位
119 self._focus = None
120
121 def child(self, name=None, **attrs):
122 """
123 Select the direct child(ren) from the UI element(s) given by the query expression, see ``QueryCondition`` for
124 more details about the selectors.
125
126 Args:
127 name: query expression of attribute "name", i.e. the UI elements with ``name`` name will be selected
128 attrs: other query expression except for the ``name``
129
130 Returns:
131 :py:class:`UIObjectProxy <poco.proxy.UIObjectProxy>`: a new UI proxy object representing the child(ren) of
132 current UI element(s)
133 """
134

Callers 7

__call__Method · 0.85
childMethod · 0.85
offspringMethod · 0.85
siblingMethod · 0.85
parentMethod · 0.85
__getitem__Method · 0.85
__iter__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected