forked from cosmicr/startrek1971
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathConsole.py
40 lines (32 loc) · 1.02 KB
/
Console.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from PyTrek.AbsDisplay import abs_display
from PyTrek.Points import *
class Con(abs_display):
'''
The best place to start is by encapsulating the default
display. Will add screen metadata for it all, later.
'''
def __init__(self):
super().__init__(abs_display.ST_CONSOLE)
def display(self, message = ''):
print(message)
def read(self, prompt=''):
return input(prompt)
def read_double(self, prompt):
text = input(prompt)
try:
value = float(text)
return value
except:
pass
return False
def read_sector(self, prompt= "Helm: sector 1-64, speed 1.0-9.0?"):
text = input(prompt + ': ')
return WarpDest.parse(text)
def read_xypos(self, prompt= "Helm: a-h, 1-8?"):
text = input(prompt + ': ')
return SubDest.parse(text)
if __name__ == '__main__':
con = Con()
con.display("Testing!")
con.show_banner(["Testing, too!"])
con.show_banner(["Testing", " .......... too!"])