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))
예제 #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")
예제 #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)
예제 #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
예제 #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)
예제 #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))
예제 #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,
    ])
예제 #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))
예제 #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
예제 #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))
예제 #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)
예제 #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")
         
예제 #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")
예제 #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)
예제 #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)
예제 #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)
예제 #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"
예제 #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")
예제 #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)
예제 #21
0
 def Destroy(self, *args, **kw):
     self._shown = False
     Logger.add_close(self)
     wxFileDialog.Destroy(self, *args, **kw)
예제 #22
0
 def Destroy(self, *args, **kw):
     self.shown = False
     Logger.add_result("Dialog '%s' closed" % self.GetLabel())
     wxColourDialog.Destroy(self, *args, **kw)
예제 #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)
예제 #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
예제 #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]))
 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()
예제 #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,])
예제 #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)
예제 #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)        
예제 #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)
예제 #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()
예제 #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")
예제 #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")
예제 #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
예제 #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)
예제 #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))
예제 #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)
예제 #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()
예제 #39
0
 def Destroy(self, *args, **kw):
     self.shown = False
     Logger.add_close(self)
     wxPageSetupDialog.Destroy(self, *args, **kw)
예제 #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)
예제 #41
0
 def Destroy(self, *args, **kw):
     self._shown = False
     Logger.add_close(self)
     wxFileDialog.Destroy(self, *args, **kw)
예제 #42
0
 def describe_menu_item(self, item):
     Logger.add("      %4d   %-24.24s  '%s' " % (item.Id, item.Label, item.Text) )
예제 #43
0
파일: exit.py 프로젝트: leonardcj/Time-Line
 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
예제 #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(" ")
예제 #45
0
 def Destroy(self, *args, **kw):
     self._shown = False
     Logger.add_close(self)
     wxPreviewFrame.Destroy(self, *args, **kw)
예제 #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)
예제 #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()
예제 #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)
예제 #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)        
예제 #50
0
 def Destroy(self, *args, **kw):
     self.shown = False
     Logger.add_result("Dialog '%s' closed" % self.GetLabel())
     wxColourDialog.Destroy(self, *args, **kw)
예제 #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)
예제 #52
0
 def Hide(self):
     self._shown = False
     Logger.add_close(self)
     super(Frame, self).Hide()