]> git.ipfire.org Git - people/ms/bricklayer.git/commitdiff
pakfire: Use new status callback feature
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 9 May 2022 16:13:10 +0000 (16:13 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 9 May 2022 16:13:10 +0000 (16:13 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/python/step.py
src/python/tui.py

index e1c8a0a24857e1b722c56a4809551016a456b743..3d2417b4b76b05b2ec9abc24dbbdb64298120a2e 100644 (file)
@@ -75,11 +75,11 @@ class Step(object):
                # Set up Pakfire
                with self.tui.progress(title, _("Installing packages..."), max_value=100) as t:
                        # Create a new Pakfire instance
-                       p = self.bricklayer.setup_pakfire(**t.callbacks)
+                       p = self.bricklayer.setup_pakfire()
 
                        try:
                                # Install packages
-                               p.install(packages)
+                               p.install(packages, status_callback=t.status)
 
                        # Abort on any dependencies problems
                        except pakfire.errors.DependencyError as e:
index 1078d326d1f8c52b0e0b65b5e221a996ad2b35c7..82e2d50505410c5c1e3df2b8da41e8c5d6e22dfd 100644 (file)
@@ -411,22 +411,19 @@ class ProgressWindowCallbacks(object):
                        self.window.scale.set(value)
                        self.window.tui.refresh()
 
-       def status(self, text):
+       def message(self, text):
                """
                        Updates the text in the textbox
                """
                self.window.textbox.setText(text)
                self.window.tui.refresh()
 
-       @property
-       def callbacks(self):
-               """
-                       Returns callbacks that can be passed to Pakfire
-               """
-               return {
-                       "status_callback"   : self.status,
-                       "progress_callback" : self.progress,
-               }
+       def status(self, progress, message):
+               if progress:
+                       self.progress(progress)
+
+               if message:
+                       self.message(message)
 
 
 class PasswordWindow(ButtonsWindow):