- commit
- a3ab4ecc5eaff63a31fbacdd86dd7fab8e77df60
- parent
- ff31820a9442da499a6834fca7e232ef7078a73c
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2020-07-11 15:49
revert title support - non-standard (xterm extension) - not that necessary
Diffstat
| M | boon.py | 30 | +++++++----------------------- |
1 files changed, 7 insertions, 23 deletions
diff --git a/boon.py b/boon.py
@@ -80,19 +80,8 @@ def fullscreen(): 80 80 sys.stdout.flush() 81 81 82 8283 -1 @contextmanager84 -1 def title(s):85 -1 sys.stdout.write('\033]2;%s\a' % s)86 -1 sys.stdout.flush()87 -1 try:88 -1 yield89 -1 finally:90 -1 sys.stdout.write('\033]2;%s\a' % '')91 -1 sys.stdout.flush()92 -193 -194 83 def getch():95 -1 # NOTE: bytes might contain more than one key-1 84 # NOTE: result might contain more than one key 96 85 fd = sys.stdin.fileno() 97 86 try: 98 87 r, _w, _e = select.select([fd], [], [], 0.5) @@ -111,8 +100,6 @@ def cursor_move(x, y): 111 100 112 101 113 102 class App:114 -1 title = ''115 -1116 103 def __init__(self): 117 104 self.old_lines = [] 118 105 signal.signal(signal.SIGWINCH, self.on_resize) @@ -139,13 +126,12 @@ class App: 139 126 140 127 def run(self): 141 128 with fullscreen():142 -1 with title(self.title):143 -1 self.on_resize()144 -1 while True:145 -1 key = getch()146 -1 if key:147 -1 self.on_key(key)148 -1 self.update()-1 129 self.on_resize() -1 130 while True: -1 131 key = getch() -1 132 if key: -1 133 self.on_key(key) -1 134 self.update() 149 135 150 136 def render(self): 151 137 return [] @@ -155,8 +141,6 @@ class App: 155 141 156 142 157 143 class Example(App):158 -1 title = 'Example'159 -1160 144 def __init__(self): 161 145 super().__init__() 162 146 self.keys = ['f', 'b', 'z']