Advertisement
Guest User

Untitled

a guest
Jun 20th, 2013
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.85 KB | None | 0 0
  1.  
  2.     def _find(self, text):
  3.         # Used for debugging, searches the object tree for the first
  4.         # item containing the given text
  5.         self.found = None
  6.         self._walk(self.app, text)
  7.         print('Found: ')
  8.         print(self.found)
  9.         print(self.found.get_properties())
  10.  
  11.     def _walk(self, gtk_object, text):
  12.         if self.found:
  13.             return
  14.         prop = '%s' % gtk_object.get_properties()
  15.         if text in prop:
  16.             self.found = gtk_object
  17.         print "Searching through %s children" % len(gtk_object.get_children())
  18.         for c in gtk_object.get_children():
  19.             print "Checking %s" % c
  20.             if str(c).index("GtkWindow"):
  21.                 print "Walking %s" % c
  22.                 self._walk(c, text)
  23.             else:
  24.                 print "Returning %s" % c
  25.                 return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement