0
|
1 |
# Copyright 2000-2004 Michael Hudson mwh@python.net
|
|
2 |
#
|
|
3 |
# All Rights Reserved
|
|
4 |
#
|
|
5 |
#
|
|
6 |
# Permission to use, copy, modify, and distribute this software and
|
|
7 |
# its documentation for any purpose is hereby granted without fee,
|
|
8 |
# provided that the above copyright notice appear in all copies and
|
|
9 |
# that both that copyright notice and this permission notice appear in
|
|
10 |
# supporting documentation.
|
|
11 |
#
|
|
12 |
# THE AUTHOR MICHAEL HUDSON DISCLAIMS ALL WARRANTIES WITH REGARD TO
|
|
13 |
# THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
14 |
# AND FITNESS, IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL,
|
|
15 |
# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
|
|
16 |
# RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
|
|
17 |
# CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
|
18 |
# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
19 |
|
|
20 |
class Event:
|
|
21 |
"""An Event. `evt' is 'key' or somesuch."""
|
|
22 |
|
|
23 |
def __init__(self, evt, data, raw=''):
|
|
24 |
self.evt = evt
|
|
25 |
self.data = data
|
|
26 |
self.raw = raw
|
|
27 |
|
|
28 |
def __repr__(self):
|
|
29 |
return 'Event(%r, %r)'%(self.evt, self.data)
|
|
30 |
|
|
31 |
class Console:
|
|
32 |
"""Attributes:
|
|
33 |
|
|
34 |
screen,
|
|
35 |
height,
|
|
36 |
width,
|
|
37 |
"""
|
|
38 |
|
|
39 |
def refresh(self, screen, xy):
|
|
40 |
pass
|
|
41 |
|
|
42 |
def prepare(self):
|
|
43 |
pass
|
|
44 |
|
|
45 |
def restore(self):
|
|
46 |
pass
|
|
47 |
|
|
48 |
def move_cursor(self, x, y):
|
|
49 |
pass
|
|
50 |
|
|
51 |
def set_cursor_vis(self, vis):
|
|
52 |
pass
|
|
53 |
|
|
54 |
def getheightwidth(self):
|
|
55 |
"""Return (height, width) where height and width are the height
|
|
56 |
and width of the terminal window in characters."""
|
|
57 |
pass
|
|
58 |
|
|
59 |
def get_event(self, block=1):
|
|
60 |
"""Return an Event instance. Returns None if |block| is false
|
|
61 |
and there is no event pending, otherwise waits for the
|
|
62 |
completion of an event."""
|
|
63 |
pass
|
|
64 |
|
|
65 |
def beep(self):
|
|
66 |
pass
|
|
67 |
|
|
68 |
def clear(self):
|
|
69 |
"""Wipe the screen"""
|
|
70 |
pass
|
|
71 |
|
|
72 |
def finish(self):
|
|
73 |
"""Move the cursor to the end of the display and otherwise get
|
|
74 |
ready for end. XXX could be merged with restore? Hmm."""
|
|
75 |
pass
|
|
76 |
|
|
77 |
def flushoutput(self):
|
|
78 |
"""Flush all output to the screen (assuming there's some
|
|
79 |
buffering going on somewhere)."""
|
|
80 |
pass
|
|
81 |
|
|
82 |
def forgetinput(self):
|
|
83 |
"""Forget all pending, but not yet processed input."""
|
|
84 |
pass
|
|
85 |
|
|
86 |
def getpending(self):
|
|
87 |
"""Return the characters that have been typed but not yet
|
|
88 |
processed."""
|
|
89 |
pass
|
|
90 |
|
|
91 |
def wait(self):
|
|
92 |
"""Wait for an event."""
|
|
93 |
pass
|