consolebase.py 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. class baseconsole(object):
  2. def __init__(self):
  3. pass
  4. def bell(self):
  5. raise NotImplementedError
  6. def pos(self, x=None, y=None):
  7. """Move or query the window cursor."""
  8. raise NotImplementedError
  9. def size(self):
  10. raise NotImplementedError
  11. def rectangle(self, rect, attr=None, fill=" "):
  12. """Fill Rectangle."""
  13. raise NotImplementedError
  14. def write_scrolling(self, text, attr=None):
  15. """write text at current cursor position while watching for scrolling.
  16. If the window scrolls because you are at the bottom of the screen
  17. buffer, all positions that you are storing will be shifted by the
  18. scroll amount. For example, I remember the cursor position of the
  19. prompt so that I can redraw the line but if the window scrolls,
  20. the remembered position is off.
  21. This variant of write tries to keep track of the cursor position
  22. so that it will know when the screen buffer is scrolled. It
  23. returns the number of lines that the buffer scrolled.
  24. """
  25. raise NotImplementedError
  26. def getkeypress(self):
  27. """Return next key press event from the queue, ignoring others."""
  28. raise NotImplementedError
  29. def write(self, text):
  30. raise NotImplementedError
  31. def page(self, attr=None, fill=" "):
  32. """Fill the entire screen."""
  33. raise NotImplementedError
  34. def isatty(self):
  35. return True
  36. def flush(self):
  37. pass