projects
/
portage.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a845cae
)
JobStatusDisplay: add a _set_width() method
author
Zac Medico
<zmedico@gentoo.org>
Sat, 23 Oct 2010 22:55:36 +0000
(15:55 -0700)
committer
Zac Medico
<zmedico@gentoo.org>
Sat, 23 Oct 2010 22:55:36 +0000
(15:55 -0700)
pym/_emerge/JobStatusDisplay.py
patch
|
blob
|
history
diff --git
a/pym/_emerge/JobStatusDisplay.py
b/pym/_emerge/JobStatusDisplay.py
index 200e196b5bfc3c40ec7ce3de18768baf53612314..d3d330d304bbd3cea26bed1bce61083a6819f98d 100644
(file)
--- a/
pym/_emerge/JobStatusDisplay.py
+++ b/
pym/_emerge/JobStatusDisplay.py
@@
-47,11
+47,6
@@
class JobStatusDisplay(object):
object.__setattr__(self, "_displayed", False)
object.__setattr__(self, "_last_display_time", 0)
object.__setattr__(self, "_displayed", False)
object.__setattr__(self, "_last_display_time", 0)
- width = portage.output.get_term_size()[1]
- if width <= 0 or width > 80:
- width = 80
- object.__setattr__(self, "width", width)
- object.__setattr__(self, "_jobs_column_width", width - 32)
self.reset()
isatty = os.environ.get('TERM') != 'dumb' and \
self.reset()
isatty = os.environ.get('TERM') != 'dumb' and \
@@
-68,6
+63,20
@@
class JobStatusDisplay(object):
if not isinstance(v, basestring):
self._term_codes[k] = v.decode(encoding, 'replace')
if not isinstance(v, basestring):
self._term_codes[k] = v.decode(encoding, 'replace')
+ if self._isatty:
+ width = portage.output.get_term_size()[1]
+ else:
+ width = 80
+ self._set_width(width)
+
+ def _set_width(self, width):
+ if width == getattr(self, 'width', None):
+ return
+ if width <= 0 or width > 80:
+ width = 80
+ object.__setattr__(self, "width", width)
+ object.__setattr__(self, "_jobs_column_width", width - 32)
+
@property
def out(self):
"""Use a lazy reference to sys.stdout, in case the API consumer has
@property
def out(self):
"""Use a lazy reference to sys.stdout, in case the API consumer has