This commit is contained in:
ville rantanen
2021-10-13 15:21:01 +03:00
parent 7b433b717f
commit 2d33954d4c

View File

@@ -133,13 +133,13 @@ class bc:
return "\033[" + str(y) + ";" + str(x) + "H"
def posprint(self, y, x, s):
sys.stdout.write((self.pos(y, x) + str(s)).encode("utf-8"))
sys.stdout.write((self.pos(y, x) + str(s)))
def clear(self):
sys.stdout.write((self.CLR + self.pos(0, 0)).encode("utf-8"))
sys.stdout.write((self.CLR + self.pos(0, 0)))
def clear_to_end(self):
sys.stdout.write(self.CLREND.encode("utf-8"))
sys.stdout.write(self.CLREND)
def color_char(self, s):
for i, c in enumerate(self.color_keys):
@@ -154,7 +154,7 @@ class bc:
def end_drawing(opts):
if opts.zero_final:
sys.stdout.write(bc.Z.encode("utf-8"))
sys.stdout.write(bc.Z)
sys.exit(0)
@@ -299,9 +299,7 @@ u f u
; f U
; f U
====EOI
Outputs:'''.encode(
"utf-8"
)
Outputs:'''
return testimage.split("\n")
@@ -325,7 +323,7 @@ while True:
for row in f:
if not row:
end_drawing(opts)
row = row.decode("utf-8").rstrip("\n\r")
row = row.rstrip("\n\r")
if row.startswith(NEWIMAGE):
break
if row.startswith(ENDOFFILE):
@@ -379,7 +377,7 @@ while True:
for frame in colors:
try:
if frame[i][c] != " ":
sys.stdout.write(bc.color_char(frame[i][c]).encode("utf-8"))
sys.stdout.write(bc.color_char(frame[i][c]))
except IndexError:
pass
char = " "
@@ -388,9 +386,9 @@ while True:
continue
char = layer[i][c]
sys.stdout.write(char.encode("utf-8"))
sys.stdout.write(char)
if opts.color and opts.zero:
sys.stdout.write(bc.Z.encode("utf-8"))
sys.stdout.write(bc.Z)
sys.stdout.write("\n")
if pause > 0:
time.sleep(pause)