New tags for skip, write, and draw; options for parsing and drawing.

This commit is contained in:
Sergey Vartanov 2015-08-01 01:19:22 +03:00
parent feb073032a
commit e2cc8d8a14
4 changed files with 158 additions and 67 deletions

13
ui.py
View file

@ -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")