def _select_custom_tree_control_item(self, win):
     try:
         pos = int(self.arg(1))
         text = self.arg(2)
         win.select_custom_tree_control_item(pos, text)
     except NotFoundException:
         Logger.add_error("Custom tree control #%d item %s not found" % (pos, text))
Exemplo n.º 2
0
 def click_mouse(self, position):
     try:
         self._send_lbutton_click_to_window(position)
         Logger.add_result("Mouse clicked at (%d, %d)" %
                           (position[0], position[1]))
     except NotFoundException:
         Logger.add_error("Mouse click failed")
Exemplo n.º 3
0
 def _enter_text(self, win):
     pos = int(self.arg(1))
     text = self.arg(2)
     try:
         win.enter_text(pos, text)
     except NotFoundException:
         Logger.add_error("Text control #%d not found" % pos)
Exemplo n.º 4
0
def MessageBox(*args, **kw):
    Logger.add_result("MessageBox '%s' opened" % args[1])
    wx.CallLater(TIME_TO_WAIT_FOR_DIALOG_TO_SHOW_IN_MILLISECONDS,
                 _explore_and_register)
    rv = wxMessageBox(*args, **kw)
    Logger.add_result("MessageBox '%s' closed" % args[1])
    return rv
Exemplo n.º 5
0
 def _enter_text(self, win):
     pos = int(self.arg(1))
     text = self.arg(2)
     try:
         win.enter_text(pos, text)
     except NotFoundException:
         Logger.add_error("Text control #%d not found" % pos)
Exemplo n.º 6
0
 def _click_button(self, win):
     name = self.arg(1)
     try:
         win.click_button(name)
     except NotFoundException:
         Logger.add_error("Button(%s) not found. hwnd=%d" %
                          (name, win.hwnd))
Exemplo n.º 7
0
def start_app(mymanuscript, path):
    global manuscript
    manuscript = mymanuscript
    wrap_wx_classes()
    Logger.header("Starting application %s" % os.path.basename(path))
    run_python_file([
        path,
    ])
Exemplo n.º 8
0
 def describe(self,frame):
     try:
         menu_bar = frame.GetMenuBar()
         if menu_bar is not None:
             self.describe_menu_bar(menu_bar)
             Logger.add(" ")
     except AttributeError:
         pass
 def _select_custom_tree_control_item(self, win):
     try:
         pos = int(self.arg(1))
         text = self.arg(2)
         win.select_custom_tree_control_item(pos, text)
     except NotFoundException:
         Logger.add_error("Custom tree control #%d item %s not found" %
                          (pos, text))
Exemplo n.º 10
0
 def describe(self, frame):
     try:
         menu_bar = frame.GetMenuBar()
         if menu_bar is not None:
             self.describe_menu_bar(menu_bar)
             Logger.add(" ")
     except AttributeError:
         pass
Exemplo n.º 11
0
 def _select_combobox_item(self, win):
     try:
         pos = int(self.arg(1))
         text = self.arg(2)
         win.select_combobox_item(pos, text)
     except NotFoundException:
         Logger.add_error("ComboBox control #%d item %s not found" %
                          (pos, text))
Exemplo n.º 12
0
 def register_dialog(self, win=None):
     if win is None:
         return
     self.windows.append(win)
     if not self.execution_started:
         Logger.add_instruction("Execution of instructions start")
         self.execution_started = True
         wx.CallLater(TIME_TO_WAIT_BEFORE_CONTINUING_IN_MILLISECONDS,
                      self.execute_next_instruction)
Exemplo n.º 13
0
 def describe_wxdialog_windows(self, win, level=0):
     try:
         for child in win.Children:
             child_id = child.GetId()
             margin = "%*.*s" % (level*3, level*3, "")
             Logger.add("   %s%4d  %-24.24s %-16.16s  '%s'" % (margin, child_id, child.GetClassName(), child.GetLabel(), child.GetName()))
             self.describe_wxdialog_windows(child, level+1)
     except AttributeError:
         Logger.add("   No children exiets")
         
Exemplo n.º 14
0
 def execute_next_instruction(self):
     try:
         instruction = self._next_instruction()
         self._display_instruction_in_popup_window(instruction)
         if instruction.comment:
             delay = 0
         else:
             # TODO: We have some timing problem so we can't set
             #       waiting time to 0. 40 seems to be ok,
             delay = max(40, self.args.timedelay() * 1000)
         wx.CallLater(delay, self._execute_instruction, instruction)
     except NoMoreInstructionsException:
         Logger.add("INSTRUCTION: None")
Exemplo n.º 15
0
 def describe_menu(self, menu, name):
     Logger.add(" ")
     Logger.add("   Menu: '%s'    Item count: %d" % (name, menu.MenuItemCount))
     Logger.add("        Id   Label                      Text")
     Logger.add("      ----   ------------------------   ---------------------")
     for item in menu.MenuItems:
         self.describe_menu_item(item)
         if item.SubMenu is not None and item.SubMenu.MenuItemCount > 0:
             self.describe_submenu(item.SubMenu)
Exemplo n.º 16
0
 def describe_menu(self, menu, name):
     Logger.add(" ")
     Logger.add("   Menu: '%s'    Item count: %d" %
                (name, menu.MenuItemCount))
     Logger.add("        Id   Label                      Text")
     Logger.add(
         "      ----   ------------------------   ---------------------")
     for item in menu.MenuItems:
         self.describe_menu_item(item)
         if item.SubMenu is not None and item.SubMenu.MenuItemCount > 0:
             self.describe_submenu(item.SubMenu)
Exemplo n.º 17
0
 def describe_wxdialog(self, win, level=0):
     if win is None:
         return
     try:
         if len(win.Children) == 0:
             return
     except AttributeError:
         return
     Logger.newline()
     Logger.header2("wx Description")
     Logger.add("   Id    Classname                Label             Name")
     Logger.add("   ----  ------------------------ ----------------  ----------------")
     self.describe_wxdialog_windows(win)
Exemplo n.º 18
0
def start_test(args, manuscript):
    if len(manuscript.filepaths) > 0:
        Logger.set_path(get_logpath(manuscript.filepaths[0]))
        Logger.set_log_dialog_descriptions(args.descriptions())
        Logger.add_section("Manuscript", str(manuscript))
        start_app(manuscript, args.program())
    else:
        print "The start script can't be found"
Exemplo n.º 19
0
 def execute(self, manuscript, win):
     # Everything ends here so we don't bother to call Instruction.execute
     manuscript.get_application_frame().Destroy()
     Logger.add_result("Application destroyed")
Exemplo n.º 20
0
 def _close_frame(self, win):
     win, name = self.find_win(win, "wxFrame", self.arg(1))
     try:
         win.Destroy()
     except NotFoundException:
         Logger.add_error("Frame(%s) not found" % name)
Exemplo n.º 21
0
 def Destroy(self, *args, **kw):
     self._shown = False
     Logger.add_close(self)
     wxFileDialog.Destroy(self, *args, **kw)
Exemplo n.º 22
0
 def Destroy(self, *args, **kw):
     self.shown = False
     Logger.add_result("Dialog '%s' closed" % self.GetLabel())
     wxColourDialog.Destroy(self, *args, **kw)
Exemplo n.º 23
0
 def Show(self, *args, **kw):
     self._shown = True
     Logger.add_open(self)
     self.call_when_win_shows(self._explore_and_register)
     super(PreviewFrame, self).Show(*args, **kw)
Exemplo n.º 24
0
 def Print(self, *args, **kw):
     self._shown = True
     Logger.add_open(self)
     self.call_when_win_shows(self._explore_and_register)
     super(Printer, self).Print(*args, **kw)
     self._shown = False
Exemplo n.º 25
0
 def _clik_mouse(self, win):
     pos = self._position(win)
     try:
         win.click_mouse(pos)
     except NotFoundException:
         Logger.add_error("Mouse click at (%d, %d) failed" % (pos[0], pos[1]))
Exemplo n.º 26
0
 def ShowModal(self):
     Logger.add_result("MessageDialog opened")
     wx.CallLater(TIME_TO_WAIT_FOR_DIALOG_TO_SHOW_IN_MILLISECONDS,
                  self._explore, MessageDialog.listener)
     super(MessageDialog, self).ShowModal()
Exemplo n.º 27
0
def start_app(mymanuscript, path):
    global manuscript
    manuscript = mymanuscript
    wrap_wx_classes()
    Logger.header("Starting application %s" % os.path.basename(path))
    run_python_file([path,])
Exemplo n.º 28
0
 def _hide_frame(self, win):
     try:
         win, name = self.find_win(win, "wxFrame", self.arg(1))
         win.Hide()
     except NotFoundException:
         Logger.add_error("Frame(%s) not found" % name)
Exemplo n.º 29
0
 def _close_frame(self, win):
     win, name = self.find_win(win, "wxFrame", self.arg(1))
     try:
         win.Destroy()
     except NotFoundException:
         Logger.add_error("Frame(%s) not found" % name)        
Exemplo n.º 30
0
 def __init__(self, *args, **kw):
     Logger.add_result("AboutBox opened")
     wx.CallLater(TIME_TO_WAIT_FOR_DIALOG_TO_SHOW_IN_MILLISECONDS, self._register_and_explore)
     wxAboutBox(*args, **kw)
Exemplo n.º 31
0
 def ShowModal(self):
     Logger.add_result("MessageDialog opened")
     wx.CallLater(TIME_TO_WAIT_FOR_DIALOG_TO_SHOW_IN_MILLISECONDS, 
                  self._explore, MessageDialog.listener)
     super(MessageDialog, self).ShowModal()
Exemplo n.º 32
0
 def click_mouse(self, position):
     try:
         self._send_lbutton_click_to_window(position)
         Logger.add_result("Mouse clicked at (%d, %d)" % (position[0], position[1]))
     except NotFoundException:
         Logger.add_error("Mouse click failed")
Exemplo n.º 33
0
 def _select_menu(self, win):
     try:
         item_id = self._find_menu_item_id(win)
         win.click_menu_item(item_id)   
     except NotFoundException:
         Logger.add_error("Menu not found")
Exemplo n.º 34
0
def MessageBox(*args, **kw):
    Logger.add_result("MessageBox '%s' opened" % args[1])
    wx.CallLater(TIME_TO_WAIT_FOR_DIALOG_TO_SHOW_IN_MILLISECONDS, _explore_and_register)
    rv =  wxMessageBox(*args, **kw)
    Logger.add_result("MessageBox '%s' closed" % args[1])
    return rv
Exemplo n.º 35
0
 def _hide_frame(self, win):
     try:
         win, name = self.find_win(win, "wxFrame", self.arg(1))
         win.Hide()
     except NotFoundException:
         Logger.add_error("Frame(%s) not found" % name)
Exemplo n.º 36
0
 def describe_children(self, hwnd):
     Logger.add("    hwnd     Classname                 Label")
     Logger.add("    -------  ------------------------  ------------------")
     children = win.get_children(hwnd)
     for hwnd, class_name, text in children:
         Logger.add("   %8d  %-24.24s  '%s'" % (hwnd, class_name, text))
Exemplo n.º 37
0
 def describe_window(self, hwnd):
     if hwnd == None:
         hwnd = win.get_active_window()
     Logger.header(" Window Description hwnd: %d Classname: '%s' Label: '%s'" % (hwnd, win.get_classname(hwnd), win.get_window_text))
     Logger.header2("Native Description")
     self.describe_children(hwnd)
Exemplo n.º 38
0
 def ShowModal(self):
     self._shown = True
     Logger.add_open(self)
     self.call_when_win_shows(self._explore_and_register)
     super(FileDialog, self).ShowModal()
Exemplo n.º 39
0
 def Destroy(self, *args, **kw):
     self.shown = False
     Logger.add_close(self)
     wxPageSetupDialog.Destroy(self, *args, **kw)
Exemplo n.º 40
0
 def ShowModal(self, *args, **kw):
     self.shown = True
     Logger.add_result("Dialog opened")
     wx.CallLater(TIME_TO_WAIT_FOR_DIALOG_TO_SHOW_IN_MILLISECONDS, self._register_and_explore)
     super(ColourDialog, self).ShowModal(*args, **kw)
Exemplo n.º 41
0
 def Destroy(self, *args, **kw):
     self._shown = False
     Logger.add_close(self)
     wxFileDialog.Destroy(self, *args, **kw)
Exemplo n.º 42
0
 def describe_menu_item(self, item):
     Logger.add("      %4d   %-24.24s  '%s' " % (item.Id, item.Label, item.Text) )
Exemplo n.º 43
0
 def setUp(self):
     Logger.set_path(os.path.join(os.path.dirname(__file__), "test.log"))
     self.instruction = create_instruction(EXIT_INSTRUCTION)
     self.win = WinMock()
     self.manuscript = Mock(Manuscript)
     self.manuscript.get_application_frame.return_value = self.win
Exemplo n.º 44
0
 def describe_submenu(self, submenu):
     Logger.add(" ")
     Logger.add("        Submenu Item count: %d" % (submenu.MenuItemCount))
     Logger.add("             Id   Label                      Text")
     Logger.add("           ----   ------------------------   ---------------------")
     for item in submenu.MenuItems:
         Logger.add("           %4d   %-24.24s  '%s' " % (item.Id, item.Label, item.Text) )
     Logger.add(" ")
Exemplo n.º 45
0
 def Destroy(self, *args, **kw):
     self._shown = False
     Logger.add_close(self)
     wxPreviewFrame.Destroy(self, *args, **kw)
Exemplo n.º 46
0
 def _close_dialog(self, win):
     win, name = self.find_win(win, "wxDialog", self.arg(1))
     try:
         win.EndModal(wx.ID_CANCEL)
     except:
         Logger.add_error("Dialog(%s) not found" % name)
Exemplo n.º 47
0
 def ShowModal(self):
     self._shown = True
     Logger.add_open(self)
     self.call_when_win_shows(self._explore_and_register)
     super(FileDialog, self).ShowModal()
Exemplo n.º 48
0
 def ShowModal(self, *args, **kw):
     self.shown = True
     Logger.add_result("Dialog opened")
     wx.CallLater(TIME_TO_WAIT_FOR_DIALOG_TO_SHOW_IN_MILLISECONDS,
                  self._register_and_explore)
     super(ColourDialog, self).ShowModal(*args, **kw)
Exemplo n.º 49
0
 def _close_dialog(self, win):
     win, name = self.find_win(win, "wxDialog", self.arg(1))
     try:
         win.EndModal(wx.ID_CANCEL)
     except:
         Logger.add_error("Dialog(%s) not found" % name)        
Exemplo n.º 50
0
 def Destroy(self, *args, **kw):
     self.shown = False
     Logger.add_result("Dialog '%s' closed" % self.GetLabel())
     wxColourDialog.Destroy(self, *args, **kw)
Exemplo n.º 51
0
 def describe_menu_bar(self, menu_bar):
     Logger.newline()
     Logger.header2("Menu Bar:  count = %d" % menu_bar.MenuCount)
     for menu, name in menu_bar.Menus:
         self.describe_menu(menu, name)
Exemplo n.º 52
0
 def Hide(self):
     self._shown = False
     Logger.add_close(self)
     super(Frame, self).Hide()