Skip to content

Commit dc94e8a

Browse files
committed
💄
1 parent 5e46993 commit dc94e8a

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

terminedia.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
import termios, fcntl, sys, os
1+
import fcntl, os, sys, termios
22
import threading
33
import time
44

55
from contextlib import contextmanager
66
from enum import Enum
77
from math import ceil
88

9+
910
__version__ = "0.1.0"
1011
__author__ = "João S. O. Bueno"
1112

@@ -23,11 +24,11 @@ def realtime_keyb():
2324
flags_save = fcntl.fcntl(fd, fcntl.F_GETFL)
2425
attrs_save = termios.tcgetattr(fd)
2526
# make raw - the way to do this comes from the termios(3) man page.
26-
attrs = list(attrs_save) # copy the stored version to update
27+
attrs = list(attrs_save) # copy the stored version to update
2728
# iflag
2829
attrs[0] &= ~(termios.IGNBRK | termios.BRKINT | termios.PARMRK
2930
| termios.ISTRIP | termios.INLCR | termios. IGNCR
30-
| termios.ICRNL | termios.IXON )
31+
| termios.ICRNL | termios.IXON)
3132
# oflag
3233
attrs[1] &= ~termios.OPOST
3334
# cflag
@@ -49,7 +50,7 @@ def realtime_keyb():
4950
def inkey(break_=True):
5051
keycode = ""
5152
while True:
52-
c = sys.stdin.read(1) # returns a single character
53+
c = sys.stdin.read(1) # returns a single character
5354
if not c:
5455
break
5556
if c == "\x03" and break_:
@@ -71,10 +72,10 @@ def testkeys():
7172
time.sleep(0.3)
7273

7374

74-
7575
DEFAULT_BG = 0xfffe
7676
DEFAULT_FG = 0xffff
7777

78+
7879
class Directions(Enum):
7980
UP = (0, -1)
8081
RIGHT = (1, 0)
@@ -137,6 +138,7 @@ def get_at(cls, pos, data):
137138

138139
BlockChars = BlockChars()
139140

141+
140142
class ScreenCommands:
141143

142144
def print(self, *args, sep='', end='', flush=True):
@@ -414,6 +416,7 @@ def test_lines(scr):
414416
'%': (1, 0.7, 0),
415417
}
416418

419+
417420
def main():
418421
with realtime_keyb(), Screen() as scr:
419422
test_lines(scr.high)
@@ -429,7 +432,7 @@ def main():
429432
scr.context.color = DEFAULT_FG
430433
scr.high.draw.blit((160, 25), shape1)
431434

432-
scr[0, scr.height -1] = ' '
435+
scr[0, scr.height - 1] = ' '
433436

434437
result = scr.high.get_at((150, 5)), scr.high.get_at((149, 5))
435438
while True:

0 commit comments

Comments
 (0)