aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2013-09-11 12:34:49 +0200
committerMattias Andrée <maandree@operamail.com>2013-09-11 12:34:53 +0200
commit04b3493f4bc31cd0dd61cd6f3f479908116794f7 (patch)
treee4a32b41426dbab1e911372131aa97767c413200
parentmake redrawers optional (diff)
downloadpytagomacs-04b3493f4bc31cd0dd61cd6f3f479908116794f7.tar.gz
pytagomacs-04b3493f4bc31cd0dd61cd6f3f479908116794f7.tar.bz2
pytagomacs-04b3493f4bc31cd0dd61cd6f3f479908116794f7.tar.xz
saver must return whether the save was successful or not
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r--src/editor.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/editor.py b/src/editor.py
index a782e6d..f2fc1cc 100644
--- a/src/editor.py
+++ b/src/editor.py
@@ -421,7 +421,7 @@ class TextArea():
'''
Execute text reading
- @param saver:()→void Save method
+ @param saver:()→bool Save method
@param preredrawer:()?→void Method to call before redrawing screen
@param postredrawer:()?→void Method to call after redaring screen
'''
@@ -572,10 +572,12 @@ class TextArea():
last = ''
for row in range(0, len(self.lines)):
self.datamap[self.lines[row].name] = self.lines[row].text
- saver()
- modified = False
- update_status()
- self.alert('Saved')
+ if saver():
+ modified = False
+ update_status()
+ self.alert('Saved')
+ else:
+ self.alert('Failed to save!')
elif d == ctrl('C'):
break
else:
@@ -642,7 +644,7 @@ class TextArea():
def phonysaver():
- pass
+ return True
print('\033[H\033[2J')
old_stty = Popen('stty --save'.split(' '), stdout = PIPE).communicate()[0]
old_stty = old_stty.decode('utf-8', 'error')[:-1]