def process(self): if self.f == None: # Failed to open the file editor.SetActive(editor.mainmenu) return True self.editpad.refresh() char = self.editpad.getch() if char == ord('q'): editor.SetActive(editor.mainmenu) elif char == curses.KEY_UP: self.editpad.scroll(-1) elif char == curses.KEY_DOWN: self.editpad.scroll(1) elif char == ord('g'): t = Textbox(self.textwin, "Goto Line: ") val = t.gettext() self.editpad.goto(val) elif char >= ord('0') and char <= ord('9'): val = char - ord('0') self.editpad.activate_plugin(val) elif char == ord('`'): self.editpad.activate_plugin(-1) elif char == ord('\n'): self.editpad.set_preview() elif char == ord('x'): self.editpad.unset_preview() return True
class SelectFileWin(object): def __init__(self): window = unbedwin(editor.mainwin, 5, 10) self.textbox = Textbox(window, "File Path: ") def process(self): val = self.textbox.gettext() f = FileWin(val) editor.SetActive(f) return True def exit(self): self.textbox.clear()