def get_exit_code(result): if result is True: Logger.add("Exit with test success") return 0 else: Logger.add("Exit with test failure") return 1
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 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)
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)
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))
def describe_wxdialog_windows(self, win, level=0): msg = "" if len(win.Children) == 0: return margin = "%*.*s" % (level * 3, level * 3, "") if level > 0: Logger.add(" ") Logger.add(" %sClassName: %s" % (margin, win.ClassName)) Logger.add(" %sId Classname Label Name" % margin) Logger.add(" %s---- ------------------------ ------------------------ ----------------" % margin) try: for child in win.Children: child_id = child.GetId() msg = " %s%4d %-24.24s %-24.24s '%s'" % (margin, child_id, child.GetClassName(), child.GetLabel(), child.GetName()) Logger.add(msg) self.describe_wxdialog_windows(child, level + 1) except AttributeError: Logger.add(" No children exists") except Exception, ex: pass
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(" ")
def describe_menu_item(self, item): Logger.add(" %4d %-24.24s '%s' " % (item.Id, item.Label, item.Text))
def Destroy(self, *args, **kw): Logger.add("Destroy called") self._shown = False Logger.add_close(self) wxFrame.Destroy(self, *args, **kw)
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(" ")