From: Michael Tremer Date: Mon, 9 May 2022 10:31:44 +0000 (+0000) Subject: pakfire: Configure confirm callback X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=944006df7056815e45457a91b0f818c3a79870f4;p=people%2Fms%2Fbricklayer.git pakfire: Configure confirm callback This can be used by Pakfire to have the user confirm an operation. Signed-off-by: Michael Tremer --- diff --git a/src/python/__init__.py b/src/python/__init__.py index 96658ee..db3741d 100644 --- a/src/python/__init__.py +++ b/src/python/__init__.py @@ -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) diff --git a/src/python/tui.py b/src/python/tui.py index c37e73c..1078d32 100644 --- a/src/python/tui.py +++ b/src/python/tui.py @@ -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)