diff options
author | Jeremy Katz <katzj@redhat.com> | 2007-04-30 19:04:09 +0000 |
---|---|---|
committer | Jeremy Katz <katzj@redhat.com> | 2007-04-30 19:04:09 +0000 |
commit | 898453cc435f71279e3ed9ff042922ecd6321bfd (patch) | |
tree | 1750dcf7b222df5e6f07b60baddba1983f19715d /rescue.py | |
parent | ff72facaa0ff5e7278c2d698b73ad4ce7faf101c (diff) | |
download | anaconda-898453cc435f71279e3ed9ff042922ecd6321bfd.tar.gz anaconda-898453cc435f71279e3ed9ff042922ecd6321bfd.tar.xz anaconda-898453cc435f71279e3ed9ff042922ecd6321bfd.zip |
2007-04-30 Jeremy Katz <katzj@redhat.com>
* rescue.py (RescueInterface.messageWindow): Add support for
custom_buttons (#238261)
Diffstat (limited to 'rescue.py')
-rw-r--r-- | rescue.py | 36 |
1 files changed, 27 insertions, 9 deletions
@@ -40,20 +40,38 @@ class RescueInterface: def progressWindow(self, title, text, total): return ProgressWindow(self.screen, title, text, total) - def messageWindow(self, title, text, type = "ok"): - if type == "ok": - ButtonChoiceWindow(self.screen, _(title), _(text), - buttons = [ _("OK") ]) + def messageWindow(self, title, text, type = "ok", default = None, + custom_icon=None, custom_buttons=[]): + if type == "ok": + ButtonChoiceWindow(self.screen, title, text, + buttons=[TEXT_OK_BUTTON]) elif type == "yesno": - btnlist = [TEXT_YES_BUTTON, TEXT_NO_BUTTON] - rc = ButtonChoiceWindow(self.screen, _(title), _(text), - buttons=btnlist) + if default and default == "no": + btnlist = [TEXT_NO_BUTTON, TEXT_YES_BUTTON] + else: + btnlist = [TEXT_YES_BUTTON, TEXT_NO_BUTTON] + rc = ButtonChoiceWindow(self.screen, title, text, + buttons=btnlist) if rc == "yes": return 1 else: return 0 - else: - return OkCancelWindow(self.screen, _(title), _(text)) + elif type == "custom": + tmpbut = [] + for but in custom_buttons: + tmpbut.append(string.replace(but,"_","")) + + rc = ButtonChoiceWindow(self.screen, title, text, width=60, + buttons=tmpbut) + + idx = 0 + for b in tmpbut: + if string.lower(b) == rc: + return idx + idx = idx + 1 + return 0 + else: + return OkCancelWindow(self.screen, title, text) def __init__(self, screen): self.screen = screen |