comparison 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
comparison
equal deleted inserted replaced
627:30180021f203 628:66a547539185
942 """ 942 """
943 if not hasattr(self, "warning_popup"): 943 if not hasattr(self, "warning_popup"):
944 self.warning_popup = panels.WarningPopup() 944 self.warning_popup = panels.WarningPopup()
945 self.warning_popup.showWarning(type_, msg) 945 self.warning_popup.showWarning(type_, msg)
946 946
947 def showDialog(self, message, title="", type_="info", answer_cb=None, answer_data=None):
948 if type_ == 'info':
949 popup = dialog.InfoDialog(unicode(title), unicode(message), callback=answer_cb)
950 elif type_ == 'error':
951 popup = dialog.InfoDialog(unicode(title), unicode(message), callback=answer_cb)
952 elif type_ == 'yes/no':
953 popup = dialog.ConfirmDialog(lambda answer: answer_cb(answer, answer_data),
954 text=unicode(message), title=unicode(title))
955 popup.cancel_button.setText(_("No"))
956 else:
957 popup = dialog.InfoDialog(unicode(title), unicode(message), callback=answer_cb)
958 log.error(_('unmanaged dialog type: %s'), type_)
959 popup.show()
960
947 961
948 if __name__ == '__main__': 962 if __name__ == '__main__':
949 app = SatWebFrontend() 963 app = SatWebFrontend()
950 app.onModuleLoad() 964 app.onModuleLoad()