示例#1
0
 def describe(self, win):
     if Logger.log_dialog_descriptions:
         hwnd = facade.get_active_window()
         if hwnd not in described_windows:
             described_windows.append(hwnd) 
             self.describe_wxdialog(win)
             self.describe_window(hwnd)
             MenuBarDescriber.describe(win)
示例#2
0
 def find_winwin_by_label(self, label):
     if label is not None:
         found_msg = "win Label (%s) found" % label
         hwnd = facade.get_active_window()
         winlbl = facade.get_window_text(hwnd)
         winlbl = winlbl.decode("utf-8")
         if winlbl == label:
             self.winctrl = hwnd
             raise Found(found_msg)
示例#3
0
 def call_when_win_shows(self, method):
     self._prev_win = None
     try:
         self._prev_win = self._active_window
     except:
         pass
     if self._prev_win is None:
         self._prev_win = facade.get_active_window()
     wx.CallLater(MILLISECONDS_TO_WAIT_FOR_DIALOG_TO_SHOW, self._wait_for_win_to_show, method)
示例#4
0
 def exit_application(self):
     try:
         win = wx.GetApp().GetTopWindow()
         if win:
             win.Destroy()
         facade.send_close_message_to_window(facade.get_active_window())
     finally:
         wx.GetApp().Exit()
         Logger.success(self.result_message("Application destroyed"))
示例#5
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")
示例#6
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
示例#7
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)
示例#8
0
 def _explore_subwindow(self):
     if self is not facade.get_active_window():
         self._explore()
     if self._shown:
         wx.CallLater(MILLISECONDS_TO_WAIT_FOR_DIALOG_TO_SHOW,
                      self._explore_subwindow)
示例#9
0
 def _explore_subwindow(self):
     if self is not facade.get_active_window():
         self._explore()
     if self._shown:
         wx.CallLater(MILLISECONDS_TO_WAIT_FOR_DIALOG_TO_SHOW, self._explore_subwindow)
示例#10
0
 def _wait_for_win_to_show(self, method):
     if self._prev_win == facade.get_active_window():
         wx.CallLater(MILLISECONDS_TO_WAIT_FOR_DIALOG_TO_SHOW, self._wait_for_win_to_show, method)
     else:
         method()
示例#11
0
 def set_active_window(self):
     self._active_window = facade.get_active_window()
示例#12
0
def get_dialog_label():
    return facade.get_window_text(facade.get_active_window()).decode("utf-8")