Exemple #1
0
 def handle_read(self, c):
     if self.popup:
         ret = self.popup.handle_read(c)
         if self.popup and self.popup.closed():
             self.pop_popup()
         self.refresh()
         return ret
     return BaseInputPane.handle_read(self, c)
 def handle_read(self, c):
     if self.popup:
         ret = self.popup.handle_read(c)
         if self.popup and self.popup.closed():
             self.pop_popup()
         self.refresh()
         return ret
     return BaseInputPane.handle_read(self, c)
Exemple #3
0
 def handle_read(self, c):
     if c == curses.KEY_UP:
         self.move_active_up(1)
     elif c == curses.KEY_DOWN:
         self.move_active_down(1)
     elif self.allow_resize and c in [ord('+'), ord('-')]:
         width = self.visible_content_pane_width + (1 if c == ord('+') else - 1)
         self.on_resize(width)
     else:
         return BaseInputPane.handle_read(self, c)
     return util.ReadState.READ
Exemple #4
0
 def handle_read(self, c):
     if c == curses.KEY_UP:
         self.move_active_up(1)
     elif c == curses.KEY_DOWN:
         self.move_active_down(1)
     elif self.allow_resize and c in [ord('+'), ord('-')]:
         width = self.visible_content_pane_width + (1 if c == ord('+') else
                                                    -1)
         self.on_resize(width)
     else:
         return BaseInputPane.handle_read(self, c)
     return util.ReadState.READ
Exemple #5
0
    def handle_read(self, c):
        ret = BaseInputPane.handle_read(self, c)
        if ret != util.ReadState.IGNORED:
            return ret

        if c in [curses.KEY_ENTER, util.KEY_ENTER2]:
            if self.close_cb:
                self._handle_callback(state_changed=False, close=False)
                util.safe_curs_set(util.Curser.INVISIBLE)
            return util.ReadState.READ
        elif c == util.KEY_ESC:  # close on esc, no action
            self._handle_callback(state_changed=False, close=True)
            self.close(None)
            return util.ReadState.READ

        self.refresh()
        return util.ReadState.READ
Exemple #6
0
    def handle_read(self, c):
        if c in [curses.KEY_ENTER, util.KEY_ENTER2]:
            for k, v in self.get_values().items():
                if v['active']:
                    if self.selection_cb(
                            k, **dict(self.cb_args, data=self.cb_arg)):
                        self.close(None)
            return util.ReadState.READ
        else:
            ret = BaseInputPane.handle_read(self, c)
            if ret != util.ReadState.IGNORED:
                return ret
            ret = Popup.handle_read(self, c)
            if ret != util.ReadState.IGNORED:
                if self.selection_cb(None):
                    self.close(None)
                return ret

            if self.input_cb:
                self.input_cb(c)

        self.refresh()
        return util.ReadState.IGNORED
Exemple #7
0
 def handle_read(self, c):
     ret = BaseInputPane.handle_read(self, c)
     if ret != util.ReadState.IGNORED:
         return ret
     return Popup.handle_read(self, c)