Added logic, still need to test.

This commit is contained in:
Michael Lazar
2016-06-23 18:30:58 -07:00
parent b64ee6fa94
commit 33257ac3d1
5 changed files with 99 additions and 63 deletions

View File

@@ -10,6 +10,7 @@ from kitchen.text.display import textual_width
from . import docs
from .objects import Controller, Color, Command
from .exceptions import TemporaryFileError
def logged_in(f):
@@ -217,16 +218,20 @@ class Page(object):
self.term.flash()
return
text = self.term.open_editor(info)
if text == content:
self.term.show_notification('Canceled')
return
with self.term.open_editor(info) as text:
if text == content:
self.term.show_notification('Canceled')
return
with self.term.loader('Editing', delay=0):
data['object'].edit(text)
time.sleep(2.0)
if self.term.loader.exception is None:
self.refresh_content()
else:
raise TemporaryFileError()
with self.term.loader('Editing', delay=0):
data['object'].edit(text)
time.sleep(2.0)
if self.term.loader.exception is None:
self.refresh_content()
@PageController.register(Command('INBOX'))
@logged_in