예제 #1
0
 def describe_children(self, hwnd):
     Logger.add("    hwnd     Classname                 ScreenPos    Label")
     Logger.add("    -------  ------------------------  ------------ ------------------")
     children = facade.get_children(hwnd)
     for hwnd, class_name, text in children:
         rect = facade.get_window_rect(hwnd)
         Logger.add("   %8d  %-24.24s  (%4d, %4d) '%s'" % (hwnd, class_name, rect[0], rect[1], text))
예제 #2
0
 def describe_window(self, hwnd=None):
     if facade.has_win_implementation():
         try:
             nbr_of_children = len(facade.get_children(hwnd))
             if hwnd is None:
                 hwnd = facade.get_active_window()
             rect = facade.get_window_rect(hwnd)
             Logger.bold_header("Window Description \n   hwnd:            %d \n   Classname:       '%s' \n   Label:           '%s'\n   Nbr of children: %d\n   Position:        (%d, %d)\n   Size:            (%d, %d)" % (
                 hwnd, facade.get_classname(hwnd), facade.get_window_text(hwnd), nbr_of_children, rect[0], rect[1], rect[2], rect[3]))
             Logger.header2("Native Description")
             self.describe_children(hwnd)
         except Exception, ex:
             Logger.add_error("Native windows description failed")
예제 #3
0
 def find_win_ctrl_by_pos(self, parent, wx_classname, pos):
     if wx_classname is not None and pos is not None:
         found_msg = "win order (%d) found for class(%s)" % (pos, facade.wx_to_win_classname(wx_classname))
         inx = 0
         try:
             hwnd = facade.get_active_window()
             children = facade.get_children(hwnd)
         except:
             return
         win_classname = facade.wx_to_win_classname(wx_classname)
         for hwnd, class_name, _ in children:
             if class_name == win_classname:
                 if inx == pos - 1:
                     self.winctrl = hwnd
                     raise Found(found_msg)
                 else:
                     inx += 1
예제 #4
0
 def find_win_ctrl_by_label(self, parent, label):
     if label is not None:
         found_msg = "win Label (%s) found" % label
         try:
             hwnd = facade.get_active_window()
             children = facade.get_children(hwnd)
         except:
             return
         for hwnd, _, winlbl in children:
             if winlbl == label:
                 self.winctrl = hwnd
                 raise Found(found_msg)
             # Try with elipses
             elif winlbl == label + "...":
                 self.winctrl = hwnd
                 raise Found(found_msg)
             # Try with accelerator
             else:
                 for i in range(len(label)):
                     lbl = label[0:i] + "&" + label[i:]
                     if winlbl == lbl:
                         self.winctrl = hwnd
                         raise Found(found_msg)