def __init__(self, title, input_title, min_chars=0, dim=False): """ :param title: the string used in the application heading :param input_title: the name of the input string being captured (e.g. Password) :param min_chars: minimum number of characters for a valid string (default: 8) :param dim: optimize for a smaller screen (True/False) """ self._input_title = input_title self._min_chars = min_chars self.small_display = dim self.def_keys = [] self.frame = self.setup_frame(title, input_title) self.pop_up = self.setup_popup("Error") # Create the main view, overlaying the popup widget with the main view view = Overlay(self.pop_up, self.frame, 'center', None, 'middle', None) self.view = view
def _update_overlay(self, size, focus): canv = self._original_widget.render(size, focus=focus) self._cache_original_canvas = canv # imperfect performance hack pop_up = canv.get_pop_up() if pop_up: left, top, ( w, overlay_width, overlay_height) = pop_up if self._pop_up != w: self._pop_up = w self._current_widget = Overlay(w, self._original_widget, ('fixed left', left), overlay_width, ('fixed top', top), overlay_height) else: self._current_widget.set_overlay_parameters( ('fixed left', left), overlay_width, ('fixed top', top), overlay_height) else: self._pop_up = None self._current_widget = self._original_widget