diff options
author | Florian Schmaus <flow@gentoo.org> | 2024-08-31 10:38:51 +0200 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2024-09-11 02:38:59 +0100 |
commit | 225e574108549ac85dd743bfbc0c3d5e2e740c60 (patch) | |
tree | f77ad2b1ac50a51156046fb7ea3bd4eeef8f4672 | |
parent | JobStatusDisplay: fix setting the default width to 100 (diff) | |
download | portage-225e574108549ac85dd743bfbc0c3d5e2e740c60.tar.gz portage-225e574108549ac85dd743bfbc0c3d5e2e740c60.tar.bz2 portage-225e574108549ac85dd743bfbc0c3d5e2e740c60.zip |
JobStatusDisplay: introduce max_display_width variable
Values that belong together and may only be changed at the same time
should be combined in a common constant. So let's do this.
Signed-off-by: Florian Schmaus <flow@gentoo.org>
Closes: https://github.com/gentoo/portage/pull/1377
Signed-off-by: Sam James <sam@gentoo.org>
-rw-r--r-- | lib/_emerge/JobStatusDisplay.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/_emerge/JobStatusDisplay.py b/lib/_emerge/JobStatusDisplay.py index 6506aed7d..57495c5ae 100644 --- a/lib/_emerge/JobStatusDisplay.py +++ b/lib/_emerge/JobStatusDisplay.py @@ -16,6 +16,9 @@ from _emerge.getloadavg import getloadavg class JobStatusDisplay: + # Used as maximum display width and default fallback value. + max_display_width = 100 + _bound_properties = ("curval", "failed", "running") # Don't update the display unless at least this much @@ -65,14 +68,14 @@ class JobStatusDisplay: if self._isatty: width = portage.output.get_term_size()[1] else: - width = 100 + width = self.max_display_width self._set_width(width) def _set_width(self, width): if width == getattr(self, "width", None): return - if width <= 0 or width > 100: - width = 100 + if width <= 0 or width > self.max_display_width: + width = self.max_display_width object.__setattr__(self, "width", width) object.__setattr__(self, "_jobs_column_width", width - 32) |