f4d17450 |
#
# Copyright (C) 2015 vmware inc.
#
# Author: Mahmoud Bassiouny <mbassiouny@vmware.com>
import curses
from window import Window
from menu import Menu
from actionresult import ActionResult
class ConfirmWindow(Window):
|
1ec3a643 |
def __init__(self, height, width, maxy, maxx, menu_starty, message, info=False):
if info: |
c533b308 |
items = [('OK', self.exit_function, True)] |
1ec3a643 |
else: |
c533b308 |
items = [
('Yes', self.exit_function, True),
('No', self.exit_function, False)
]
self.menu = Menu(menu_starty, maxx, items, can_navigate_outside=False, horizontal=True) |
a672bd24 |
super(ConfirmWindow, self).__init__(height, width, maxy, maxx, 'Confirm', False, self.menu) |
c533b308 |
self.addstr(0, 0, message) |
f4d17450 |
def exit_function(self, yes):
return ActionResult(True, {'yes': yes}) |