def start_editor(self):
try:
# draw the top bar
top_bar = 'Editing ' + self.file.name + ' [press Ctrl+G to save and close]'
i = len(top_bar)
while i < self.scr_width:
top_bar += ' '
i += 1
self.scr.addstr(0, 0, top_bar, curses.A_REVERSE)
self.scr.refresh()
# let the user edit th efile
box = Textbox(self.text_win)
box.edit()
# get the file contents
self.file_text = box.gather()
finally:
# return to the game
curses.endwin()
gc.clear()
self.file.content = self.file_text
评论列表
文章目录