def __update_input(self): mapping = defaultdict(lambda: None, {ConsoleKey.A:Snake.left,ConsoleKey.J:Snake.left, ConsoleKey.LeftArrow:Snake.left, ConsoleKey.D:Snake.right,ConsoleKey.L:Snake.right,ConsoleKey.RightArrow:Snake.right, ConsoleKey.W:Snake.up,ConsoleKey.I:Snake.up,ConsoleKey.UpArrow:Snake.up, ConsoleKey.S:Snake.down,ConsoleKey.K:Snake.down,ConsoleKey.DownArrow:Snake.down}) while True: self.last_input = mapping[Console.ReadKey(True).Key]
def _input_breakpoint(self, keyinfo): keyinfo2 = Console.ReadKey() if keyinfo2.Key in IPyDebugProcess._breakpointcmds: return IPyDebugProcess._breakpointcmds[keyinfo2.Key](self, keyinfo2) else: print "\nInvalid breakpoint command", str(keyinfo2.Key) return False
def _input(self): offset, sp = get_frame_location(self.active_thread.ActiveFrame) lines = self._get_file(sp.doc.URL) self._print_source_line(sp, lines) while True: print "ipydbg» ", keyinfo = Console.ReadKey() if keyinfo.Key in IPyDebugProcess._inputcmds: if IPyDebugProcess._inputcmds[keyinfo.Key](self, keyinfo): return else: print "\nPlease enter a valid command"
def WaitForSpaceBarKeyPress(): while True: keyInfo = Console.ReadKey(True) if keyInfo.Key == ConsoleKey.Spacebar: break return