Skip to contentSkip to conversation

knotty: Correctly handle multiple line items

PATCH In review Richard Purdie 2 participants 3 messages Mar 6, 2022 – Mar 7, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 knotty: Correctly handle multiple line items

Currently the footer code doesn't quite handle multiline items correct. Fix this to do so.

---
 lib/bb/ui/knotty.py | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
lib/bb/ui/knotty.py +9 -3
index 528b8a0760..1bcdc0023a 100644
@@ -292,9 +292,9 @@ class TerminalFilter(object):
                 progress = 0
             content = self.main_progress.update(progress)
             print('')
-        lines = 1 + int(len(content) / (self.columns + 1))
+        lines = self.getlines(content)
         if self.quiet == 0:
-            for tasknum, task in enumerate(tasks[:(self.rows - 2)]):
+            for tasknum, task in enumerate(tasks[:(self.rows - 1 - lines)]):
                 if isinstance(task, tuple):
                     pbar, progress, rate, start_time = task
                     if not pbar.start_time:
@@ -311,11 +311,17 @@ class TerminalFilter(object):
                 else:
                     content = "%s: %s" % (tasknum, task)
                     print(content)
-                lines = lines + 1 + int(len(content) / (self.columns + 1))
+                lines = lines + self.getlines(content)
         self.footer_present = lines
         self.lastpids = runningpids[:]
         self.lastcount = self.helper.tasknumber_current
 
+    def getlines(self, content):
+        lines = 0
+        for line in content.split("\n"):
+            lines = lines + 1 + int(len(line) / (self.columns + 1))
+        return lines
+
     def finish(self):
         if self.stdinbackup:
             fd = sys.stdin.fileno()
Signature · 1 line
2.32.0
#1 lore raw

PATCH 2/2 knotty: Improve setscene task display

There is general agreement the current display of the total setscene and executed full tasks is confusing. Fixing it is tricky to be clear to new users whilst not wasting screen real estate for experienced users and not compromisng features like the progress bar.

As a compromise, move the setscene total to the previous line making the status display a two line summary for interactive terminals. This makes it clear what two of the numbers represent (setscene task) whilst separating this out from the other items.

Also tweak the non-interactive output to use a comma as a separator, the use of the forward slash was a poor choice.

---
 lib/bb/ui/knotty.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
lib/bb/ui/knotty.py +3 -3
index 1bcdc0023a..b02e59c1fe 100644
@@ -276,11 +276,11 @@ class TerminalFilter(object):
             print(content)
         else:
             if self.quiet:
-                content = "Running tasks (%s of %s/%s of %s)" % (self.helper.setscene_current, self.helper.setscene_total, self.helper.tasknumber_current, self.helper.tasknumber_total)
+                content = "Running tasks (%s of %s, %s of %s)" % (self.helper.setscene_current, self.helper.setscene_total, self.helper.tasknumber_current, self.helper.tasknumber_total)
             elif not len(activetasks):
-                content = "No currently running tasks (%s of %s/%s of %s)" % (self.helper.setscene_current, self.helper.setscene_total, self.helper.tasknumber_current, self.helper.tasknumber_total)
+                content = "Setscene tasks: %s of %s\nNo currently running tasks (%s of %s)" % (self.helper.setscene_current, self.helper.setscene_total, self.helper.tasknumber_current, self.helper.tasknumber_total)
             else:
-                content = "Currently %2s running tasks (%s of %s/%s of %s)" % (len(activetasks), self.helper.setscene_current, self.helper.setscene_total, self.helper.tasknumber_current, self.helper.tasknumber_total)
+                content = "Setscene tasks: %s of %s\nCurrently %2s running tasks (%s of %s)" % (self.helper.setscene_current, self.helper.setscene_total, len(activetasks), self.helper.tasknumber_current, self.helper.tasknumber_total)
             maxtask = self.helper.tasknumber_total
             if not self.main_progress or self.main_progress.maxval != maxtask:
                 widgets = [' ', progressbar.Percentage(), ' ', progressbar.Bar()]
Signature · 1 line
2.32.0
#2 lore raw

Re: [bitbake-devel] [PATCH 2/2] knotty: Improve setscene task display

Hi Richard,

The following patch on master next is very different from this one
https://git.yoctoproject.org/poky/commit/?h=master-next&id=4639952adfe139d91899cf9a58a9f165bfbfef58

Jose

Richard Purdie <[email protected]> escreveu no dia domingo, 6/03/2022 à(s) 13:35:

Quoted 69 lines

There is general agreement the current display of the total setscene and executed full tasks is confusing. Fixing it is tricky to be clear to new users whilst not wasting screen real estate for experienced users and not compromisng features like the progress bar.

As a compromise, move the setscene total to the previous line making the status display a two line summary for interactive terminals. This makes it clear what two of the numbers represent (setscene task) whilst separating this out from the other items.

Also tweak the non-interactive output to use a comma as a separator, the use of the forward slash was a poor choice.

---
 lib/bb/ui/knotty.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
lib/bb/ui/knotty.py +1 -2
index 1bcdc0023a..b02e59c1fe 100644
@@ -276,11 +276,11 @@ class TerminalFilter(object):
             print(content)
         else:
             if self.quiet:
-                content = "Running tasks (%s of %s/%s of %s)" %
 (self.helper.setscene_current, self.helper.setscene_total,
 self.helper.tasknumber_current, self.helper.tasknumber_total)
+                content = "Running tasks (%s of %s, %s of %s)" %
 (self.helper.setscene_current, self.helper.setscene_total,
 self.helper.tasknumber_current, self.helper.tasknumber_total)
             elif not len(activetasks):
-                content = "No currently running tasks (%s of %s/%s of
 %s)" % (self.helper.setscene_current, self.helper.setscene_total,

self.helper.tasknumber_current, self.helper.tasknumber_total)
+ content = "Setscene tasks: %s of %s\nNo currently running
tasks (%s of %s)" % (self.helper.setscene_current, self.helper.setscene_total, self.helper.tasknumber_current, self.helper.tasknumber_total)
else:
- content = "Currently %2s running tasks (%s of %s/%s of
%s)" % (len(activetasks), self.helper.setscene_current, self.helper.setscene_total, self.helper.tasknumber_current, self.helper.tasknumber_total)
+ content = "Setscene tasks: %s of %s\nCurrently %2s
running tasks (%s of %s)" % (self.helper.setscene_current, self.helper.setscene_total, len(activetasks), self.helper.tasknumber_current, self.helper.tasknumber_total)
maxtask = self.helper.tasknumber_total
if not self.main_progress or self.main_progress.maxval !=
maxtask:

                 widgets = [' ', progressbar.Percentage(), ' ',

progressbar.Bar()]
--
2.32.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#13417):
https://lists.openembedded.org/g/bitbake-devel/message/13417
Mute This Topic: https://lists.openembedded.org/mt/89588749/5052612
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Signature · 3 lines
Best regards,

José Quaresma