Alex Lourie has uploaded a new change for review.

Change subject: packaging: Fix text aligned not properly for long strings.
......................................................................

packaging: Fix text aligned not properly for long strings.

During the upgrade process we display the stages of of upgrade.
When strings are longer than 70 chars the text doesn't align
correctly. This patch fixes the issue by taking into cosideration
only the last part of a multiline string.

Bug-Url: https://bugzilla.redhat.com/882689
Change-Id: Id242e8a247ae720b3aeb37f40004241dfc3920de
Signed-off-by: Alex Lourie <[email protected]>
---
M packaging/fedora/setup/engine-upgrade.py
1 file changed, 13 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/94/12194/1

diff --git a/packaging/fedora/setup/engine-upgrade.py 
b/packaging/fedora/setup/engine-upgrade.py
index 03e9a5b..04b3b54 100755
--- a/packaging/fedora/setup/engine-upgrade.py
+++ b/packaging/fedora/setup/engine-upgrade.py
@@ -576,6 +576,19 @@
 def runFunc(funcList, dispString):
     sys.stdout.write("%s..." % dispString)
     sys.stdout.flush()
+    if len(dispString) > 69:
+        # Split by lines (\n), and work with last part (may be empty string):
+        dispString = dispString.split('\n')[-1]
+
+        # If last chunk is still long add termination at the END
+        # and aling text on the next line:
+        if len(dispString) > 69:
+            sys.stdout.write("\n")
+            sys.stdout.flush()
+
+        # dispString is now simply next line, so it is empty.
+        dispString = ''
+
     spaceLen = basedefs.SPACE_LEN - len(dispString)
     try:
         for func in funcList:


--
To view, visit http://gerrit.ovirt.org/12194
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id242e8a247ae720b3aeb37f40004241dfc3920de
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Alex Lourie <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to