]> git.ipfire.org Git - people/ms/bricklayer.git/commitdiff
pakfire: Configure confirm callback
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 9 May 2022 10:31:44 +0000 (10:31 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 9 May 2022 10:31:44 +0000 (10:31 +0000)
This can be used by Pakfire to have the user confirm an operation.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/python/__init__.py
src/python/tui.py

index 96658ee03b5bbb9a314579df6aefcfc8df5dba80..db3741dec6a75a3c09777eb2a69319a17e17f9b8 100644 (file)
@@ -241,6 +241,10 @@ class Bricklayer(object):
                """
                        Calls Pakfire and has it load its configuration
                """
+               kwargs |= {
+                       "confirm_callback" : self.tui._confirm,
+               }
+
                return pakfire.Pakfire(self.root, arch=self.arch,
                        conf="/etc/pakfire/distros/ipfire3.conf", **kwargs)
 
index c37e73c527fea29715492eb0b43845dad66e108d..1078d326d1f8c52b0e0b65b5e221a996ad2b35c7 100644 (file)
@@ -181,6 +181,15 @@ class Tui(object):
                return self.message(title, text, buttons=buttons,
                        height=height, width=width, help=help)
 
+       def _confirm(self, message, question):
+               """
+                       Wrapper to confirm for Pakfire
+               """
+               return self.confirm(
+                       title=_("Attention"),
+                       text="%s\n\n%s" % (message, question),
+               )
+
        def progress(self, title, text, max_value=None, height=None, width=60, help=None):
                return ProgressWindow(self, title, text, max_value=max_value,
                        height=height, width=width, help=help)