diff options
author | Zac Medico <zmedico@gentoo.org> | 2010-01-02 21:10:05 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-01-02 21:10:05 +0000 |
commit | 37e96ac953259ad0d0f2b21e6c830b6efbc4a3a7 (patch) | |
tree | aa324631976f9c2dfd13929458399f5f4eed5eea | |
parent | 5e45e7e941a6d15bee9afe0d567bba9e5571f26c (diff) | |
download | portage-37e96ac953259ad0d0f2b21e6c830b6efbc4a3a7.tar.gz portage-37e96ac953259ad0d0f2b21e6c830b6efbc4a3a7.tar.bz2 portage-37e96ac953259ad0d0f2b21e6c830b6efbc4a3a7.zip |
Use get_term_size() to adjust to current terminal width. Thanks to Dror Levin
<spatz@g.0> for the initial patch.
svn path=/main/trunk/; revision=15156
-rw-r--r-- | pym/_emerge/JobStatusDisplay.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/pym/_emerge/JobStatusDisplay.py b/pym/_emerge/JobStatusDisplay.py index cfc0bfa91..dfc766d26 100644 --- a/pym/_emerge/JobStatusDisplay.py +++ b/pym/_emerge/JobStatusDisplay.py @@ -22,7 +22,6 @@ if sys.hexversion >= 0x3000000: class JobStatusDisplay(object): _bound_properties = ("curval", "failed", "running") - _jobs_column_width = 48 # Don't update the display unless at least this much # time has passed, in units of seconds. @@ -48,7 +47,12 @@ class JobStatusDisplay(object): object.__setattr__(self, "_changed", False) object.__setattr__(self, "_displayed", False) object.__setattr__(self, "_last_display_time", 0) - object.__setattr__(self, "width", 80) + + 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 = hasattr(self.out, "isatty") and self.out.isatty() |