[Sugar-devel] [PATCH] FEATURE REQUEST : Write_to_journal_anytime

anubhav at seeta.in anubhav at seeta.in
Tue Nov 30 00:49:43 EST 2010


From: Anubhav Aggarwal <anubhav at seeta.in>

Now an icon is added in the palletes which calls a popup to enter the name
decscription and tags , this popup earlier came only at the closing of the
activity (http://wiki.sugarlabs.org/go/Features/Write_to_journal_anytime)
---
 src/sugar/activity/activity.py    |    7 +++++++
 src/sugar/activity/namingalert.py |    7 ++++++-
 2 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/src/sugar/activity/activity.py b/src/sugar/activity/activity.py
index 0bda2ea..1267ed2 100644
--- a/src/sugar/activity/activity.py
+++ b/src/sugar/activity/activity.py
@@ -359,6 +359,12 @@ class Activity(Window, gtk.Container):
 
         return jobject
 
+    def call_name_alert(self):
+        title_alert = NamingAlert(self, get_bundle_path())
+        title_alert.set_activity_status(status=True)
+        title_alert.set_transient_for(self.get_toplevel())
+        title_alert.show()
+
     def _set_up_sharing(self, mesh_instance, share_scope):
         # handle activity share/join
         logging.debug("*** Act %s, mesh instance %r, scope %s",
@@ -863,6 +869,7 @@ class Activity(Window, gtk.Container):
                 self._complete_close()
         else:
             title_alert = NamingAlert(self, get_bundle_path())
+            title_alert.set_activity_status(status = False)
             title_alert.set_transient_for(self.get_toplevel())
             title_alert.show()
             self.reveal()
diff --git a/src/sugar/activity/namingalert.py b/src/sugar/activity/namingalert.py
index 72db8dc..6531500 100644
--- a/src/sugar/activity/namingalert.py
+++ b/src/sugar/activity/namingalert.py
@@ -168,6 +168,7 @@ class NamingAlert(gtk.Window):
         self._description = None
         self._tags = None
 
+        self._activity_in_progress = False
         accel_group = gtk.AccelGroup()
         self.set_data('sugar-accel-group', accel_group)
         self.add_accel_group(accel_group)
@@ -207,6 +208,9 @@ class NamingAlert(gtk.Window):
         widget = self._title.get_property('widget')
         widget.grab_focus()
 
+    def set_activity_status(self, status=False):
+        self._activity_in_progress = status
+
     def _create_body(self):
         body = hippo.CanvasBox()
         body.props.orientation = hippo.ORIENTATION_VERTICAL
@@ -351,5 +355,6 @@ class NamingAlert(gtk.Window):
         self._activity.metadata['description'] = new_description
 
         self._activity.metadata['title_set_by_user'] = '1'
-        self._activity.close()
+        if not self._activity_in_progress:
+            self._activity.close()
         self.destroy()
-- 
1.7.0.4



More information about the Sugar-devel mailing list