Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalter Bender <walter.bender@gmail.com>2012-04-13 15:09:07 (GMT)
committer Walter Bender <walter.bender@gmail.com>2012-04-13 15:09:07 (GMT)
commit9bf53cbe6570acfaed47ed90059ff7a58613156f (patch)
treeb0e53e88b5c5dbd07ba0537a6ae2b2dd91d2b53f
parentf74f00591af8789d5694d868155ac5a96c872232 (diff)
add alert when saves are complete
-rw-r--r--TurtleArtActivity.py24
1 files changed, 19 insertions, 5 deletions
diff --git a/TurtleArtActivity.py b/TurtleArtActivity.py
index 8c4dcc9..b486435 100644
--- a/TurtleArtActivity.py
+++ b/TurtleArtActivity.py
@@ -40,7 +40,7 @@ except ImportError:
HAS_TOOLBARBOX = False
from sugar.graphics.toolbutton import ToolButton
from sugar.graphics.radiotoolbutton import RadioToolButton
-from sugar.graphics.alert import ConfirmationAlert
+from sugar.graphics.alert import ConfirmationAlert, NotifyAlert
from sugar.graphics import style
from sugar.datastore import datastore
from sugar import profile
@@ -178,7 +178,8 @@ class TurtleArtActivity(activity.Activity):
os.remove(html_file)
else:
os.remove(tar_file)
- return
+
+ self._notify_successful_save(title=_('Save as HTML'))
def do_save_as_logo_cb(self, button):
''' Write UCB logo code to datastore. '''
@@ -197,7 +198,7 @@ class TurtleArtActivity(activity.Activity):
os.remove(logo_code_path)
gobject.timeout_add(250, self.save_as_logo.set_icon, 'logo-saveoff')
- return
+ self._notify_successful_save(title=_('Save as Logo'))
def do_load_ta_project_cb(self, button):
''' Load a project from the Journal. '''
@@ -234,7 +235,7 @@ class TurtleArtActivity(activity.Activity):
self.tw.save_as_image()
gobject.timeout_add(250, self.save_as_image.set_icon, 'image-saveoff')
- return
+ self._notify_successful_save(title=_('Save as image'))
def do_keep_cb(self, button):
''' Save a snapshot of the project to the Journal. '''
@@ -250,7 +251,7 @@ class TurtleArtActivity(activity.Activity):
datastore.write(dsobject)
dsobject.destroy()
os.remove(tmpfile)
- return
+ self._notify_successful_save(title=_('Save snapshot'))
# Main/palette toolbar button callbacks
@@ -1256,3 +1257,16 @@ in order to use the plugin.'))
box.pack_start(button_and_label)
button_and_label.show()
return button
+
+ def _notify_successful_save(self, title='', msg=''):
+ ''' Notify user when saves are completed '''
+
+ def _notification_alert_response_cb(alert, response_id, self):
+ self.remove_alert(alert)
+
+ alert = NotifyAlert()
+ alert.props.title = title
+ alert.connect('response', _notification_alert_response_cb, self)
+ alert.props.msg = msg
+ self.add_alert(alert)
+ alert.show()