summaryrefslogtreecommitdiffstats
path: root/rescue.py
diff options
context:
space:
mode:
authorJeremy Katz <katzj@redhat.com>2007-04-30 19:04:09 +0000
committerJeremy Katz <katzj@redhat.com>2007-04-30 19:04:09 +0000
commit898453cc435f71279e3ed9ff042922ecd6321bfd (patch)
tree1750dcf7b222df5e6f07b60baddba1983f19715d /rescue.py
parentff72facaa0ff5e7278c2d698b73ad4ce7faf101c (diff)
downloadanaconda-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.py36
1 files changed, 27 insertions, 9 deletions
diff --git a/rescue.py b/rescue.py
index 175c88baf..8c430e44f 100644
--- a/rescue.py
+++ b/rescue.py
@@ -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