@@ -90,23 +90,20 @@ def __repr__(self) -> str:
9090 Returns:
9191 A string that represents the object tree with detailed Node values.
9292 """
93- string = "{}Role={}, Name={}, VAN={}, Desc={}, Ancestry={}, St={}, Sts={}, at x={}:y={} w={} h={}; indexInParent={}; cc={}; vcc={}" .format (
94- ' ' * self .ancestry ,
95- repr (self .context_info .role ),
96- repr (self .context_info .name ),
97- repr (self .virtual_accessible_name ),
98- repr (self .ancestry ),
99- repr (self .context_info .description ),
100- repr (self .state ),
101- repr (self .context_info .states ),
102- self .context_info .x ,
103- self .context_info .y ,
104- self .context_info .width ,
105- self .context_info .height ,
106- self .context_info .indexInParent ,
107- self .context_info .childrenCount ,
108- self .visible_children_count
109- )
93+ string = (f"{ '| ' * self .ancestry } "
94+ f"role:{ self .context_info .role } ; "
95+ f"name:{ self .context_info .name } ; "
96+ f"virtual_accessible_name:{ self .virtual_accessible_name } ; "
97+ f"description:{ self .context_info .description } ; "
98+ f"ancestry:{ self .ancestry } ; "
99+ f"state:{ self .state } ; "
100+ f"states={ self .context_info .states } ; "
101+ f"at x:{ self .context_info .x } y:{ self .context_info .y } ; "
102+ f"width:{ self .context_info .width } ; "
103+ f"height:{ self .context_info .height } ; "
104+ f"indexInParent:{ self .context_info .indexInParent } ; "
105+ f"childrenCount:{ self .context_info .childrenCount } ; "
106+ f"visible_children_count:{ self .visible_children_count } " )
110107 for parser in self ._parsers :
111108 string += f"{ parser } "
112109 for child in self .children :
@@ -118,26 +115,33 @@ def __str__(self) -> str:
118115 Returns:
119116 A string of Node values.
120117 """
121- string = "Role={}, Name={}, VAN={}, ancestry={}, Desc={}, St={}, Sts={}, at x={}:y={} w={} h={}; indexInParent={}; cc={}; vcc={}" .format (
122- repr (self .context_info .role ),
123- repr (self .context_info .name ),
124- repr (self .virtual_accessible_name ),
125- repr (self .ancestry ),
126- repr (self .context_info .description ),
127- repr (self .state ),
128- repr (self .context_info .states ),
129- self .context_info .x ,
130- self .context_info .y ,
131- self .context_info .width ,
132- self .context_info .height ,
133- self .context_info .indexInParent ,
134- self .context_info .childrenCount ,
135- self .visible_children_count
136- )
118+ string = (f"role:{ self .context_info .role } , "
119+ f"name:{ self .context_info .name } , "
120+ f"virtual_accessible_name:{ self .virtual_accessible_name } ; "
121+ f"description:{ self .context_info .description } ; "
122+ f"ancestry:{ self .ancestry } ; "
123+ f"state:{ self .state } ; "
124+ f"states={ self .context_info .states } ; "
125+ f"at x:{ self .context_info .x } y:{ self .context_info .y } ; "
126+ f"width:{ self .context_info .width } ; "
127+ f"height:{ self .context_info .height } ; "
128+ f"indexInParent:{ self .context_info .indexInParent } ; "
129+ f"childrenCount:{ self .context_info .childrenCount } ; "
130+ f"visible_children_count:{ self .visible_children_count } " )
137131 for parser in self ._parsers :
138132 string += "{}" .format (parser )
139133 return string
140134
135+ def get_library_locator_tree_as_text (self ):
136+ """
137+ Returns node info in library locator format.
138+ """
139+ string = (f"{ '| ' * self .ancestry } role:{ self .context_info .role } and name:{ self .context_info .name } and "
140+ f"description:{ self .context_info .description } and indexInParent:{ self .context_info .indexInParent } " )
141+ for child in self .children :
142+ string += f"\n { child .get_library_locator_tree_as_text ()} "
143+ return string
144+
141145 def traverse (self ):
142146 yield self
143147 for child in self .children :
@@ -269,6 +273,9 @@ def __repr__(self) -> str:
269273 def __str__ (self ):
270274 return f"{ self .root } "
271275
276+ def get_library_locator_tree_as_text (self ):
277+ return self .root .get_library_locator_tree_as_text ()
278+
272279 @retry_callback
273280 def _property_change_cp (self , source : JavaObject , property : str , old_value : str , new_value : str ) -> None :
274281 with self ._lock :
0 commit comments