422 def popbuffer(self, labeled=False): |
422 def popbuffer(self, labeled=False): |
423 if self._colormode is None: |
423 if self._colormode is None: |
424 return super(colorui, self).popbuffer(labeled) |
424 return super(colorui, self).popbuffer(labeled) |
425 |
425 |
426 self._bufferstates.pop() |
426 self._bufferstates.pop() |
427 if labeled: |
427 return ''.join(self._buffers.pop()) |
428 return ''.join(self.label(a, label) for a, label |
|
429 in self._buffers.pop()) |
|
430 return ''.join(a for a, label in self._buffers.pop()) |
|
431 |
428 |
432 _colormode = 'ansi' |
429 _colormode = 'ansi' |
433 def write(self, *args, **opts): |
430 def write(self, *args, **opts): |
434 if self._colormode is None: |
431 if self._colormode is None: |
435 return super(colorui, self).write(*args, **opts) |
432 return super(colorui, self).write(*args, **opts) |
436 |
433 |
437 label = opts.get('label', '') |
434 label = opts.get('label', '') |
438 if self._buffers: |
435 if self._buffers: |
439 self._buffers[-1].extend([(str(a), label) for a in args]) |
436 if self._bufferapplylabels: |
|
437 self._buffers[-1].extend(self.label(str(a), label) |
|
438 for a in args) |
|
439 else: |
|
440 self._buffers[-1].extend(str(a) for a in args) |
440 elif self._colormode == 'win32': |
441 elif self._colormode == 'win32': |
441 for a in args: |
442 for a in args: |
442 win32print(a, super(colorui, self).write, **opts) |
443 win32print(a, super(colorui, self).write, **opts) |
443 else: |
444 else: |
444 return super(colorui, self).write( |
445 return super(colorui, self).write( |