We need to better handle screen height, decrease the default value because of serial consoles and do a better job when counting printed and missing lines.
Vratislav Podzimek (2): Improve how we set the default screen height in text mode (#1184378) Fix the line counting when printing long widgets
pyanaconda/constants_text.py | 3 +++ pyanaconda/ui/tui/simpleline/base.py | 17 +++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-)
We can either use given value or try to use the $LINES environment variable or use the default which should be 24 lines because that's what serial consoles use (see the bug).
Signed-off-by: Vratislav Podzimek vpodzime@redhat.com --- pyanaconda/constants_text.py | 3 +++ pyanaconda/ui/tui/simpleline/base.py | 13 +++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/pyanaconda/constants_text.py b/pyanaconda/constants_text.py index 750a984..9fb5e03 100644 --- a/pyanaconda/constants_text.py +++ b/pyanaconda/constants_text.py @@ -56,3 +56,6 @@ TEXT_NO_BUTTON = Translator(TEXT_NO_STR, TEXT_NO_CHECK) # Make the return calls from the UIScreen input() function more clear INPUT_PROCESSED = None INPUT_DISCARDED = False + +# default screen height in number of lines (24 lines is the default for serial consoles) +DEFAULT_SCREEN_HEIGHT = 24 diff --git a/pyanaconda/ui/tui/simpleline/base.py b/pyanaconda/ui/tui/simpleline/base.py index 6371b93..3d9b8b1 100644 --- a/pyanaconda/ui/tui/simpleline/base.py +++ b/pyanaconda/ui/tui/simpleline/base.py @@ -22,6 +22,7 @@ __all__ = ["App", "UIScreen", "Widget"]
import sys +import os import Queue import getpass import threading @@ -30,6 +31,7 @@ from pyanaconda.threads import threadMgr, AnacondaThread from pyanaconda.ui.communication import hubQ from pyanaconda import constants, iutil from pyanaconda.i18n import _, N_, C_ +from pyanaconda.constants_text import DEFAULT_SCREEN_HEIGHT
RAW_INPUT_LOCK = threading.Lock()
@@ -491,17 +493,24 @@ class UIScreen(object): # title line of the screen title = u"Screen.."
- def __init__(self, app, screen_height = 25): + def __init__(self, app, screen_height=0): """ :param app: reference to application main class :type app: instance of class App
:param screen_height: height of the screen (useful for printing long widgets) + or 0 to use the default :type screen_height: int """
self._app = app - self._screen_height = screen_height + + if screen_height > 0: + self._screen_height = screen_height + elif "LINES" in os.environ: + self._screen_height = os.environ["LINES"] + else: + self._screen_height = DEFAULT_SCREEN_HEIGHT
# list that holds the content to be printed out self._window = []
So that there are no gaps (missing lines).
Related: rhbz#1184378 Signed-off-by: Vratislav Podzimek vpodzime@redhat.com --- pyanaconda/ui/tui/simpleline/base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pyanaconda/ui/tui/simpleline/base.py b/pyanaconda/ui/tui/simpleline/base.py index 3d9b8b1..c4fe736 100644 --- a/pyanaconda/ui/tui/simpleline/base.py +++ b/pyanaconda/ui/tui/simpleline/base.py @@ -572,10 +572,10 @@ class UIScreen(object): # prompt (2 lines) for line in lines[pos:]: print(line) - pos += self._screen_height - 1 + pos += self._screen_height - 2 else: # print part with a prompt to continue - for line in lines[pos:(pos + self._screen_height - 2)]: + for line in lines[pos:(pos + self._screen_height - 1)]: print(line) self._app.raw_input(_("Press ENTER to continue")) pos += self._screen_height - 1
On Fri, Jun 26, 2015 at 08:55:57AM +0200, Vratislav Podzimek wrote:
We need to better handle screen height, decrease the default value because of serial consoles and do a better job when counting printed and missing lines.
Vratislav Podzimek (2): Improve how we set the default screen height in text mode (#1184378) Fix the line counting when printing long widgets
pyanaconda/constants_text.py | 3 +++ pyanaconda/ui/tui/simpleline/base.py | 17 +++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-)
-- 2.1.0
Ack
anaconda-patches@lists.fedorahosted.org