Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/activity.py
diff options
context:
space:
mode:
authorC. Scott Ananian <cscott@laptop.org>2007-12-13 06:19:32 (GMT)
committer C. Scott Ananian <cscott@laptop.org>2007-12-13 06:32:22 (GMT)
commit5a9175af5a762d2d7659f49ddf0b913c7a608f91 (patch)
treee216d8b94f23e13ac84920bc300bdef8e97e41c7 /activity.py
parentf44e80b62925d4f033ed051df67025eae58406e3 (diff)
Fix UI for 'keep as bundle' button.
Diffstat (limited to 'activity.py')
-rw-r--r--activity.py28
1 files changed, 19 insertions, 9 deletions
diff --git a/activity.py b/activity.py
index 1200b93..2e76ebe 100644
--- a/activity.py
+++ b/activity.py
@@ -35,6 +35,8 @@ from sugar.activity.activity import Activity, ActivityToolbox, get_bundle_path
from sugar.presence import presenceservice
from sugar.presence.tubeconn import TubeConnection
+from sugar.graphics.icon import Icon
+from sugar.graphics.menuitem import MenuItem
from sugar.graphics.toolbutton import ToolButton
@@ -61,14 +63,19 @@ class PippyActivity(Activity):
# Top toolbar with share and close buttons:
toolbox = ActivityToolbox(self)
- # add 'make bundle' button.
- at = toolbox.get_activity_toolbar()
- # XXX: shouldn't reuse document-save; we need a distinctive icon.
- self._make = ToolButton('document-save')
- self._make.set_tooltip(_('Save as Activity'))
- self._make.connect('clicked', self.makebutton_cb)
- toolbox.get_activity_toolbar().insert(self._make, 4)
- self._make.show()
+ # add 'make bundle' entry to 'keep' palette.
+ palette = toolbox.get_activity_toolbar().keep.get_palette()
+ # XXX: should clear out old palette entries?
+ menu_item = MenuItem(_('As Pippy Document'))
+ menu_item.set_image(Icon(file=('%s/activity/activity-pippy.svg' % get_bundle_path()), icon_size=gtk.ICON_SIZE_MENU))
+ menu_item.connect('activate', self.keepbutton_cb)
+ palette.menu.append(menu_item)
+ menu_item.show()
+ menu_item = MenuItem(_('As Activity Bundle'))
+ menu_item.set_image(Icon(file=('%s/skel/activity/activity-icon.svg' % get_bundle_path()), icon_size=gtk.ICON_SIZE_MENU))
+ menu_item.connect('activate', self.makebutton_cb)
+ palette.menu.append(menu_item)
+ menu_item.show()
self.set_toolbox(toolbox)
toolbox.show()
@@ -246,7 +253,10 @@ class PippyActivity(Activity):
def stopbutton_cb(self, button):
os.kill(self._pid, SIGTERM)
- def makebutton_cb(self, button):
+ def keepbutton_cb(self, __):
+ self.copy()
+
+ def makebutton_cb(self, __):
from shutil import copytree, copy2, rmtree
from tempfile import mkdtemp
from sugar import profile