f4d17450 |
#!/usr/bin/python2
#
# Copyright (C) 2015 vmware inc.
#
# Author: Mahmoud Bassiouny <mbassiouny@vmware.com>
import curses
from window import Window
from readtext import ReadText
class WindowStringReader(object): |
3c4cf0da |
def __init__(self, maxy, maxx, height, width, field, confirmation_err_msg, echo_char, accepted_chars, validation_fn, conversion_fn, title, display_string, inputy, install_config, default_string = None): |
f4d17450 |
self.title = title
self.display_string = display_string |
3c4cf0da |
self.install_config = install_config |
f4d17450 |
self.inputy = inputy
self.width = width
self.height = height
self.maxx = maxx
self.maxy = maxy
self.startx = (self.maxx - self.width) / 2
self.starty = (self.maxy - self.height) / 2
self.window = Window(self.height, self.width, self.maxy, self.maxx, self.title, True) |
3c4cf0da |
self.read_text = ReadText(maxy, maxx, self.window.content_window(), self.inputy, install_config, field, confirmation_err_msg, echo_char, accepted_chars, validation_fn, conversion_fn, default_string) |
f4d17450 |
self.window.set_action_panel(self.read_text)
self.window.addstr(0, 0, self.display_string)
def get_user_string(self, params):
return self.window.do_action() |