def keypress(self, char):
        """ returns theme_id, save_theme
            return_id
              0-..  : id in self._theme
              -1    : end or canel
              -2    : go no
            save_them
              True  : theme is to be saved in config
              False : theme is not to be saved in config
        """
        if char in (curses.KEY_ENTER, ord('\n'),
                ord('\r'), ord('l'),
                curses.KEY_RIGHT):
            self._applied_theme = self._selection
            self._applied_theme_name = self._themes[self._selection][0]
            #if self.changed_from_config:
            #    self._config_theme = self._selection
            #    self._config_theme_name = self._themes[self._selection][0]
            self.refresh()
            return self._selection, False
        elif char in (ord(' '), ord('s')):
            self._applied_theme = self._selection
            self._applied_theme_name = self._themes[self._selection][0]
            if not self.changed_from_config:
                self._config_theme = self._selection
                self._config_theme_name = self._themes[self._selection][0]
            if char == ord('s'):
                # close window
                curses.ungetch('q')
            else:
                self.refresh()
            return self._selection, True
        elif char in (curses.KEY_UP, ord('k')):
            self.jumpnr = ''
            self._go_up()
        elif char in (curses.KEY_DOWN, ord('j')):
            self.jumpnr = ''
            self._go_down()
        elif char in (curses.KEY_HOME, ord('g')):
            self.jumpnr = ''
            self._go_home()
        elif char in (curses.KEY_END, ord('G')):
            if self.jumpnr == '':
                self._go_end()
            else:
                num = int(self.jumpnr) - 1
                if num >= 0:
                    self.selection = num
                    self.jumpnr = ''
        elif char in (curses.KEY_NPAGE, ):
            self.jumpnr = ''
            sel = self._selection + self._page_jump
            if self._selection == len(self._themes) - 1:
                sel = 0
            elif sel >= len(self._themes):
                sel = len(self._themes) - 1
            self.selection = sel
        elif char in (curses.KEY_PPAGE, ):
            self.jumpnr = ''
            sel = self._selection - self._page_jump
            if self._selection == 0:
                sel = len(self._themes) - 1
            elif sel < 0:
                sel = 0
            self.selection = sel
        elif char in map(ord,map(str,range(0,10))):
            self.jumpnr += chr(char)
        elif char in (curses.KEY_EXIT, 27, ord('q'), ord('h'), curses.KEY_LEFT):
            self.jumpnr = ''
            self._win.nodelay(True)
            char = self._win.getch()
            self._win.nodelay(False)
            if char == -1:
                """ ESCAPE """
                if not self.changed_from_config:
                    if self._applied_theme_name != self._config_theme_name:
                        if logger.isEnabledFor(logging.INFO):
                            logger.info('Restoring saved theme: {}'.format(self._config_theme_name))
                        self._theme.readAndApplyTheme(self._config_theme_name)
                        self._applied_theme = self._config_theme
                        self._applied_theme_name = self._config_theme_name
                self.selection = -1
                return -1, False
        return -2, False
returns theme_id, save_theme
            return_id
              0-..  : id in self._theme
              -1    : end or canel
              -2    : go no
            save_them
              True  : theme is to be saved in config
              False : theme is not to be saved in config