summaryrefslogtreecommitdiffstats
path: root/rescue.py
diff options
context:
space:
mode:
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