mirror of
https://github.com/enzet/map-machine.git
synced 2025-06-03 11:21:49 +02:00
New tags for skip, write, and draw; options for parsing and drawing.
This commit is contained in:
parent
feb073032a
commit
e2cc8d8a14
4 changed files with 158 additions and 67 deletions
13
ui.py
13
ui.py
|
@ -6,15 +6,20 @@ Author: Sergey Vartanov (me@enzet.ru).
|
|||
|
||||
import sys
|
||||
|
||||
|
||||
def write_line(number, total):
|
||||
length = 20
|
||||
parts = length * 8
|
||||
boxes = [' ', '▏', '▎', '▍', '▌', '▋', '▊', '▉']
|
||||
|
||||
if number == -1:
|
||||
print ('%3s' % '100') + ' % ░' + (length * '░') + '░'
|
||||
print ('%3s' % '100') + ' % █' + (length * '█') + '█'
|
||||
elif number % 1000 == 0:
|
||||
p = number / float(total)
|
||||
l = int(p * length)
|
||||
print ('%3s' % str(int(p * 1000) / 10)) + ' % ░' + (l * '░') + \
|
||||
((length - l) * ' ') + '░'
|
||||
l = int(p * parts)
|
||||
fl = l / 8
|
||||
pr = int(l - fl * 8)
|
||||
print ('%3s' % str(int(p * 1000) / 10)) + ' % █' + (fl * '█') + \
|
||||
boxes[pr] + ((length - fl - 1) * ' ') + '█'
|
||||
sys.stdout.write("\033[F")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue