MCPcopy Create free account
hub / github.com/dtmilano/AndroidViewClient / populateViewTree

Method populateViewTree

src/com/dtmilano/android/culebron.py:646–683  ·  view source on GitHub ↗

Populates the View tree.

(self, view)

Source from the content-addressed store, hash-verified

644 self.viewDetails.set(view)
645
646 def populateViewTree(self, view):
647 '''
648 Populates the View tree.
649 '''
650
651 print('culebron.populateViewTree: getting unique id for %s' % view.__class__.__name__, file=sys.stderr)
652 if type(view) == WindowHierarchy:
653 print('culebron.populateViewTree: skipping HierarchyView', file=sys.stderr)
654 return
655 else:
656 print('culebron.populateViewTree: %s' % type(view), file=sys.stderr)
657
658 parent_unique_id = ''
659 try:
660 vuid = view.getUniqueId()
661 text = view.__smallStr__()
662 parent = view.getParent()
663 is_target = view.isTarget()
664 if parent:
665 parent_unique_id = parent.getUniqueId()
666 except AttributeError:
667 vuid = view.unique_id
668 # FIXME
669 # is_target = view.is_target
670 is_target = False
671 text = view.text
672 parent = view.parent
673 if parent:
674 # FIXME:
675 # parent is an int
676 # parent_unique_id = parent.unique_id
677 parent_unique_id = 0
678 if parent is None:
679 self.viewTree.insert('', tkinter.END, vuid, text=text)
680 else:
681 self.viewTree.insert(parent_unique_id, tkinter.END, vuid, text=text, tags=('ttk'))
682 self.viewTree.set(vuid, 'T', '*' if is_target else ' ')
683 self.viewTree.tag_bind('ttk', '<1>', self.viewTreeItemClicked)
684
685 def findTargets(self):
686 ''&#x27;

Callers

nothing calls this directly

Calls 7

getUniqueIdMethod · 0.80
__smallStr__Method · 0.80
getParentMethod · 0.80
isTargetMethod · 0.80
insertMethod · 0.80
tag_bindMethod · 0.80
setMethod · 0.45

Tested by

no test coverage detected