diff src/browser/libervia_main.py @ 628:66a547539185 frontends_multi_profiles

browser_side: implements showDialog
author souliane <souliane@mailoo.org>
date Sun, 22 Feb 2015 21:57:24 +0100
parents 9092e624bb27
children 7113d40533d6
line wrap: on
line diff
--- a/src/browser/libervia_main.py	Sun Feb 22 21:56:40 2015 +0100
+++ b/src/browser/libervia_main.py	Sun Feb 22 21:57:24 2015 +0100
@@ -944,6 +944,20 @@
             self.warning_popup = panels.WarningPopup()
         self.warning_popup.showWarning(type_, msg)
 
+    def showDialog(self, message, title="", type_="info", answer_cb=None, answer_data=None):
+        if type_ == 'info':
+            popup = dialog.InfoDialog(unicode(title), unicode(message), callback=answer_cb)
+        elif type_ == 'error':
+            popup = dialog.InfoDialog(unicode(title), unicode(message), callback=answer_cb)
+        elif type_ == 'yes/no':
+            popup = dialog.ConfirmDialog(lambda answer: answer_cb(answer, answer_data),
+                                         text=unicode(message), title=unicode(title))
+            popup.cancel_button.setText(_("No"))
+        else:
+            popup = dialog.InfoDialog(unicode(title), unicode(message), callback=answer_cb)
+            log.error(_('unmanaged dialog type: %s'), type_)
+        popup.show()
+
 
 if __name__ == '__main__':
     app = SatWebFrontend()