All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Kjellerstedt <pkj@axis.com>
To: <bitbake-devel@lists.openembedded.org>
Subject: [PATCH 2/3] knotty.py: Give the setscene tasks their own progress bar
Date: Mon, 7 Mar 2022 14:36:19 +0100	[thread overview]
Message-ID: <20220307133620.12404-2-pkj@axis.com> (raw)
In-Reply-To: <20220307133620.12404-1-pkj@axis.com>

From: Peter Kjellerstedt <peter.kjellerstedt@axis.com>

In commit 8055ec36 (knotty: Improve setscene task display) the setscene
tasks got their own line in the task output. However, the progress bar
code does not handle newlines in its widgets, so the length of the
setscene line was included when calculating how much space is available
for the progress bar of the running tasks, making it much too short.

Instead of trying to teach the progress bar code to handle newlines,
give the setscene tasks their own progress bar.

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
---
 bitbake/lib/bb/ui/knotty.py | 34 ++++++++++++++++++++++------------
 1 file changed, 22 insertions(+), 12 deletions(-)

diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py
index a520895da2..179cea43fa 100644
--- a/bitbake/lib/bb/ui/knotty.py
+++ b/bitbake/lib/bb/ui/knotty.py
@@ -204,6 +204,7 @@ class TerminalFilter(object):
         for h in handlers:
             h.addFilter(InteractConsoleLogFilter(self))
 
+        self.setscene_progress = None
         self.main_progress = None
 
     def clearFooter(self):
@@ -278,25 +279,34 @@ class TerminalFilter(object):
                 content += ':'
             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)
-            elif not len(activetasks):
-                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 = "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)
+            content = ''
+            curtask = self.helper.setscene_current
+            maxtask = self.helper.setscene_total
+            msg = "Setscene tasks (%s of %s)" % (curtask, maxtask)
+            if not self.setscene_progress or self.setscene_progress.maxval != maxtask:
+                widgets = [' ', progressbar.Percentage(), ' ', progressbar.Bar()]
+                self.setscene_progress = BBProgress("Setscene tasks", maxtask, widgets=widgets, resize_handler=self.sigwinch_handle)
+                self.setscene_progress.start(False)
+            self.setscene_progress.setmessage(msg)
+            content += self.setscene_progress.update(curtask) + "\n"
+            print('')
+
+            curtask = self.helper.tasknumber_current
             maxtask = self.helper.tasknumber_total
+            if not len(activetasks):
+                msg = "No running tasks (%s of %s)" % (curtask, maxtask)
+            else:
+                msg = "%2s running tasks (%s of %s)" % (len(activetasks), curtask, maxtask)
             if not self.main_progress or self.main_progress.maxval != maxtask:
                 widgets = [' ', progressbar.Percentage(), ' ', progressbar.Bar()]
                 self.main_progress = BBProgress("Running tasks", maxtask, widgets=widgets, resize_handler=self.sigwinch_handle)
                 self.main_progress.start(False)
-            self.main_progress.setmessage(content)
-            progress = self.helper.tasknumber_current - 1
-            if progress < 0:
-                progress = 0
-            content = self.main_progress.update(progress)
+            self.main_progress.setmessage(msg)
+            progress = max(0, curtask - 1)
+            content += self.main_progress.update(progress)
             print('')
         lines = self.getlines(content)
-        if self.quiet == 0:
+        if not self.quiet:
             for tasknum, task in enumerate(tasks[:(self.rows - 1 - lines)]):
                 if isinstance(task, tuple):
                     pbar, progress, rate, start_time = task


  reply	other threads:[~2022-03-07 13:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-07 13:36 [PATCH 1/3] knotty.py: Improve the message while waiting for running tasks to finish Peter Kjellerstedt
2022-03-07 13:36 ` Peter Kjellerstedt [this message]
2022-03-07 15:48   ` [bitbake-devel] [PATCH 2/3] knotty.py: Give the setscene tasks their own progress bar Richard Purdie
2022-03-07 16:00     ` Peter Kjellerstedt
2022-03-07 13:36 ` [PATCH 3/3] knotty.py: Separate the display of main tasks from running tasks Peter Kjellerstedt
2022-03-07 15:46   ` [bitbake-devel] " Richard Purdie
2022-03-07 16:01     ` Peter Kjellerstedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220307133620.12404-2-pkj@axis.com \
    --to=pkj@axis.com \
    --cc=bitbake-devel@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.