Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksey 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)
commita5c9f6aac0c9432944e276fb2034dbf90ced8b87 (patch)
treecf94cd69e13e37d687ece418aff8b0884a2f3e76
parent3d1643c508a6eb6c947afe112ce333a6f0ef278d (diff)
Share shared.py between cartoon-builder, flipsticks and infoslicer
-rw-r--r--shared.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/shared.py b/shared.py
index c1977f9..c0d59f5 100644
--- a/shared.py
+++ b/shared.py
@@ -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)