diff options
author | Aleksey Lim <alsroot@member.fsf.org> | 2009-03-27 15:53:13 (GMT) |
---|---|---|
committer | Aleksey Lim <alsroot@member.fsf.org> | 2009-03-27 15:53:13 (GMT) |
commit | a5c9f6aac0c9432944e276fb2034dbf90ced8b87 (patch) | |
tree | cf94cd69e13e37d687ece418aff8b0884a2f3e76 | |
parent | 3d1643c508a6eb6c947afe112ce333a6f0ef278d (diff) |
Share shared.py between cartoon-builder, flipsticks and infoslicer
-rw-r--r-- | shared.py | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -12,12 +12,14 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +import gtk import logging import telepathy from gobject import property, SIGNAL_RUN_FIRST, TYPE_PYOBJECT from sugar.activity.activity import Activity from sugar.presence.sugartubeconn import SugarTubeConnection +from sugar.graphics.alert import ConfirmationAlert, NotifyAlert NEW_INSTANCE = 0 RESUME_INSTANCE = 1 @@ -114,6 +116,28 @@ class CanvasActivity(Activity): def write_file(self, filepath): self.save_instance(filepath) + def notify_alert(self, title, msg): + alert = NotifyAlert(title=title, msg=msg) + + def response(alert, response_id, self): + self.remove_alert(alert) + + alert.connect('response', response, self) + alert.show_all() + self.add_alert(alert) + + def confirmation_alert(self, title, msg, cb, *cb_args): + alert = ConfirmationAlert(title=title, msg=msg) + + def response(alert, response_id, self, cb, *cb_args): + self.remove_alert(alert) + if response_id is gtk.RESPONSE_OK: + cb(*cb_args) + + alert.connect('response', response, self, cb, *cb_args) + alert.show_all() + self.add_alert(alert) + class SharedActivity(CanvasActivity): def __init__(self, canvas, service, *args): CanvasActivity.__init__(self, canvas, *args) |