def writehr(self, label=None): if label: label = unicode(label) sys.stderr.write( t.black(u'·' * 4) + shade('{') + label + shade('}') + t.black(u'·' * (t.width - (6 + len(label)) - 1)) + '\n') else: sys.stderr.write(t.black(u'·' * (t.width - 1) + '\n'))
def writehr(self, label=None): width = t.width or 80 if label: label = unicode(label) sys.stderr.write(t.black(u'·' * 4) + shade('{') + label + shade('}') + t.black(u'·' * (width - (6+len(label)) - 1)) + '\n') else: sys.stderr.write(t.black(u'·' * (width-1) + '\n'))
def write(threads, prefix='', rewind=True, append=None, debug=False, profile=False): t_cnt = len(threads) for id, thread in threads: if thread.is_alive(): _line = ''.join((t.black('({})'.format(id)), ' ', t.bold(t.white('+')), ' ', thread.name, ' ', thread.transform.get_unicode_stats(debug=debug, profile=profile), ' ', )) else: _line = t.black(''.join( ('({})'.format(id), ' - ', thread.name, ' ', thread.transform.get_unicode_stats(debug=debug, profile=profile), ' ', ))) print prefix + _line + t.clear_eol if append: # todo handle multiline print ' `->', ' '.join(u'{0}: {1}'.format(t.bold(t.white(k)), v) for k, v in append), t.clear_eol t_cnt += 1 if rewind: print t.clear_eol print t.move_up * (t_cnt + 2)
def shade(v): return t.black(t.bold(v))