changeset 2457:49aa1e3a90b8

jp (base): added exitCb generic callback to display a message and quit
author Goffi <goffi@goffi.org>
date Tue, 12 Dec 2017 00:11:27 +0100
parents 83f9b9ff1a54
children 4841ad6a5db4
files frontends/src/jp/base.py
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/frontends/src/jp/base.py	Tue Dec 12 00:09:39 2017 +0100
+++ b/frontends/src/jp/base.py	Tue Dec 12 00:11:27 2017 +0100
@@ -779,6 +779,16 @@
             raise exceptions.InternalError(_(u'trying to use output when use_output has not been set'))
         return self.host.output(output_type, self.args.output, self.extra_outputs, data)
 
+    def exitCb(self, msg=None):
+        """generic callback for success
+
+        optionally print a message, and quit
+        msg(None, unicode): if not None, print this message
+        """
+        if msg is not None:
+            self.disp(msg)
+        self.host.quit(C.EXIT_OK)
+
     def errback(self, failure_, msg=None, exit_code=C.EXIT_ERROR):
         """generic callback for errbacks