diff options
author | Rafael Ortiz <rafael@activitycentral.com> | 2011-10-07 15:03:21 (GMT) |
---|---|---|
committer | Rafael Ortiz <rafael@activitycentral.com> | 2011-10-07 15:03:21 (GMT) |
commit | 1a908d3cf564351de9606cf01ec6a33ffa9e7222 (patch) | |
tree | 3c81f51927ab88c79ba18dc9f254149154900185 | |
parent | d928b8d4695d82678e6a8c90d5836eea1a8548c6 (diff) |
Fix for export button + icons (Manu QuiƱones)
-rw-r--r-- | icons/pippy-create_bundle.svg | 34 | ||||
-rw-r--r-- | icons/pippy-export_doc.svg | 81 | ||||
-rw-r--r-- | icons/pippy-export_example.svg | 49 | ||||
-rw-r--r-- | pippy_app.py | 57 |
4 files changed, 192 insertions, 29 deletions
diff --git a/icons/pippy-create_bundle.svg b/icons/pippy-create_bundle.svg new file mode 100644 index 0000000..b5d0a26 --- /dev/null +++ b/icons/pippy-create_bundle.svg @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [ + <!ENTITY fill_color "#FFFFFF"> + <!ENTITY stroke_color "#010101"> +]> +<svg + xmlns="http://www.w3.org/2000/svg" + version="1.1" + width="55" + height="55" + viewBox="0 0 55 55" + id="svg2" + xml:space="preserve"><rect + width="29.497099" + height="29.497099" + x="-28.68516" + y="32.139339" + transform="matrix(0.83456543,-0.55090883,0.83456543,0.55090883,0,0)" + id="rect3936" + style="fill:&fill_color;;fill-opacity:1;stroke:&stroke_color;;stroke-width:3.64991689;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" /><g + transform="translate(0,-2)" + id="g4709"><path + d="m 28.090497,40.381834 c 3.974667,-0.06221 9.878139,-1.753708 9.878139,-6.911631 0,-5.73755 -4.497322,-6.751378 -6.645938,-7.265877 -2.341015,-0.560569 -4.551388,-0.765446 -4.645545,-1.7177 -0.161426,-1.632578 0.768742,-2.268447 2.619566,-2.268447 0,0 4.402457,2.26367 8.142826,0.457274 1.05398,-0.509016 2.942197,-2.884533 2.942197,-4.523303 0,-1.639388 -6.094837,-3.533985 -7.944332,-3.533985 -1.850824,0 -3.424821,2.377206 -3.424821,2.377206 -3.700318,0 -7.401302,3.278776 -7.401302,6.557553 0,3.278158 3.417627,6.165937 7.653709,6.85261 1.962616,0.318142 3.729994,1.076753 3.3563,3.065286 -0.303435,1.614661 -1.696316,2.770905 -5.258386,2.736319 -2.749295,-0.02669 -6.417645,0.138525 -8.840139,-1.714654 -1.314772,-1.005784 -1.146531,-3.578075 -1.146531,-3.578075 0,0 -3.4034,0.162415 -2.757976,3.376412 0.965274,4.806741 6.251099,6.204027 13.472233,6.091012 z" + id="path2474" + style="fill:&fill_color;;stroke:&stroke_color;;stroke-width:2.5;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /><path + d="M 37.438881,22.676071 C 35.697593,22.498722 33.050146,21.440194 32.481887,19.572788" + id="path2476" + style="fill:&fill_color;;stroke:&stroke_color;;stroke-width:1.5;stroke-linecap:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /><circle + cx="35.805" + cy="10.96" + r="1.676" + transform="matrix(0.3489205,0,0,0.32478716,20.448838,13.620467)" + id="circle2478" + style="fill:&fill_color;;stroke:&stroke_color;;stroke-width:3.42034841;stroke-miterlimit:4;stroke-dasharray:none" /></g></svg>
\ No newline at end of file diff --git a/icons/pippy-export_doc.svg b/icons/pippy-export_doc.svg new file mode 100644 index 0000000..b8e8c86 --- /dev/null +++ b/icons/pippy-export_doc.svg @@ -0,0 +1,81 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [ + <!ENTITY fill_color "#FFFFFF"> + <!ENTITY stroke_color "#010101"> +]> +<svg + xmlns="http://www.w3.org/2000/svg" + version="1.1" + width="55" + height="55" + viewBox="0 0 55 55" + id="svg2" + xml:space="preserve"><g + id="g3830"><g + transform="matrix(0.55205508,0,0,0.55205508,75.618464,18.235971)" + id="g4382"><g + transform="translate(-80.093659,12.220029)" + id="g4308" + style="fill:none;stroke:&fill_color;;stroke-opacity:1"> + <g + id="g4310" + style="fill:none;stroke:&fill_color;;stroke-opacity:1"> + <path + d="m 6.736,49.002 h 24.52 c 2.225,0 3.439,-1.447 3.439,-3.441 v -27.28 c 0,-1.73 -1.732,-3.441 -3.439,-3.441 h -4.389" + id="path4312" + style="fill:none;stroke:&fill_color;;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" /> + </g> + </g><g + transform="translate(-80.093659,12.220029)" + id="g4314" + style="fill:none;stroke:&fill_color;;stroke-opacity:1"> + <g + id="g4316" + style="fill:none;stroke:&fill_color;;stroke-opacity:1"> + <path + d="m 26.867,38.592 c 0,1.836 -1.345,3.201 -3.441,4.047 L 6.736,49.002 V 14.84 l 16.69,-8.599 c 2.228,-0.394 3.441,0.84 3.441,2.834 v 29.517 z" + id="path4318" + style="fill:none;stroke:&fill_color;;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" /> + </g> + </g><path + d="m -70.669659,54.827029 c 0,0 -1.351,-0.543 -2.702,-0.543 -1.351,0 -2.703,0.543 -2.703,0.543" + id="path4320" + style="fill:none;stroke:&fill_color;;stroke-width:2.25;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" /><path + d="m -70.669659,44.226029 c 0,0 -1.239,-0.543 -2.815,-0.543 -1.577,0 -2.59,0.543 -2.59,0.543" + id="path4322" + style="fill:none;stroke:&fill_color;;stroke-width:2.25;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" /><path + d="m -70.669659,33.898029 c 0,0 -1.125,-0.544 -2.927,-0.544 -1.802,0 -2.478,0.544 -2.478,0.544" + id="path4324" + style="fill:none;stroke:&fill_color;;stroke-width:2.25;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" /><line + id="line4326" + y2="23.725029" + y1="58.753029" + x2="-66.884659" + x1="-66.884659" + style="fill:none;stroke:&fill_color;;stroke-width:2.25;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" /></g><g + transform="matrix(1,0,0,-1,-30.386573,49.171266)" + id="g4770"><g + transform="translate(34.0803,-1006.42)" + id="g4772"><polyline + id="polyline4774" + points="51.562,15.306 41.17,16.188 42.053,5.794" + style="fill:none;stroke:&fill_color;;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round" + transform="matrix(-0.469241,0.469241,-0.469241,-0.469241,66.2906,1019.03)" /><path + d="m 39.363241,1033.1291 -0.05636,9.9115 -8.750608,0.067" + id="path4776" + style="fill:none;stroke:&fill_color;;stroke-width:2.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g></g></g><g + transform="translate(-11.834288,-11.628123)" + id="g4709" + style="fill:none;stroke:&fill_color;"><path + d="m 28.090497,40.381834 c 3.974667,-0.06221 9.878139,-1.753708 9.878139,-6.911631 0,-5.73755 -4.497322,-6.751378 -6.645938,-7.265877 -2.341015,-0.560569 -4.551388,-0.765446 -4.645545,-1.7177 -0.161426,-1.632578 0.768742,-2.268447 2.619566,-2.268447 0,0 4.402457,2.26367 8.142826,0.457274 1.05398,-0.509016 2.942197,-2.884533 2.942197,-4.523303 0,-1.639388 -6.094837,-3.533985 -7.944332,-3.533985 -1.850824,0 -3.424821,2.377206 -3.424821,2.377206 -3.700318,0 -7.401302,3.278776 -7.401302,6.557553 0,3.278158 3.417627,6.165937 7.653709,6.85261 1.962616,0.318142 3.729994,1.076753 3.3563,3.065286 -0.303435,1.614661 -1.696316,2.770905 -5.258386,2.736319 -2.749295,-0.02669 -6.417645,0.138525 -8.840139,-1.714654 -1.314772,-1.005784 -1.146531,-3.578075 -1.146531,-3.578075 0,0 -3.4034,0.162415 -2.757976,3.376412 0.965274,4.806741 6.251099,6.204027 13.472233,6.091012 z" + id="path2474-6" + style="fill:none;stroke:&fill_color;;stroke-width:2.5;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /><path + d="M 37.438881,22.676071 C 35.697593,22.498722 33.050146,21.440194 32.481887,19.572788" + id="path2476-1" + style="fill:none;stroke:&fill_color;;stroke-width:1.5;stroke-linecap:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /><circle + cx="35.805" + cy="10.96" + r="1.676" + transform="matrix(0.3489205,0,0,0.32478716,20.448838,13.620467)" + id="circle2478-8" + style="fill:none;stroke:&fill_color;;stroke-width:3.42034841;stroke-miterlimit:4;stroke-dasharray:none" /></g></svg>
\ No newline at end of file diff --git a/icons/pippy-export_example.svg b/icons/pippy-export_example.svg new file mode 100644 index 0000000..014460b --- /dev/null +++ b/icons/pippy-export_example.svg @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [ + <!ENTITY fill_color "#FFFFFF"> + <!ENTITY stroke_color "#010101"> +]> +<svg + xmlns="http://www.w3.org/2000/svg" + version="1.1" + width="55" + height="55" + viewBox="0 0 55 55" + id="Icon" + xml:space="preserve" + style="overflow:visible"><path + d="m 32.650926,41.465729 -0.178723,-6.054254 m 16.273438,18.071841 -22.029101,0.266685 -0.110174,-11.99109 5.851406,-6.358972 21.25789,0 -0.110174,12.124478 z M 26.71654,41.892254 l 21.478233,0.266685 0.33052,10.924347 m -0.306426,-11.052011 5.531132,-6.638311" + id="path3806" + style="fill:none;stroke:&fill_color;;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" /><circle + cx="35.805" + cy="10.96" + r="1.676" + transform="matrix(0.66385342,0,0,0.61793751,-2.1883406,-1.1658202)" + id="circle2478" + style="fill:none;stroke-width:3.42034841;stroke-miterlimit:4;stroke-dasharray:none" /><g + transform="matrix(1,0,0,-1,-30.386574,49.171266)" + id="g4770"><g + transform="translate(34.0803,-1006.42)" + id="g4772"><polyline + transform="matrix(-0.469241,0.469241,-0.469241,-0.469241,66.2906,1019.03)" + style="fill:none;stroke:&fill_color;;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round" + points="51.562,15.306 41.17,16.188 42.053,5.794" + id="polyline4774" /><path + d="m 39.363241,1033.1291 -0.05636,9.9115 -8.750608,0.067" + id="path4776" + style="fill:none;stroke:&fill_color;;stroke-width:2.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g></g><g + transform="translate(-11.83429,-11.628123)" + id="g4709" + style="fill:none;stroke:&fill_color;"><path + d="m 28.090497,40.381834 c 3.974667,-0.06221 9.878139,-1.753708 9.878139,-6.911631 0,-5.73755 -4.497322,-6.751378 -6.645938,-7.265877 -2.341015,-0.560569 -4.551388,-0.765446 -4.645545,-1.7177 -0.161426,-1.632578 0.768742,-2.268447 2.619566,-2.268447 0,0 4.402457,2.26367 8.142826,0.457274 1.05398,-0.509016 2.942197,-2.884533 2.942197,-4.523303 0,-1.639388 -6.094837,-3.533985 -7.944332,-3.533985 -1.850824,0 -3.424821,2.377206 -3.424821,2.377206 -3.700318,0 -7.401302,3.278776 -7.401302,6.557553 0,3.278158 3.417627,6.165937 7.653709,6.85261 1.962616,0.318142 3.729994,1.076753 3.3563,3.065286 -0.303435,1.614661 -1.696316,2.770905 -5.258386,2.736319 -2.749295,-0.02669 -6.417645,0.138525 -8.840139,-1.714654 -1.314772,-1.005784 -1.146531,-3.578075 -1.146531,-3.578075 0,0 -3.4034,0.162415 -2.757976,3.376412 0.965274,4.806741 6.251099,6.204027 13.472233,6.091012 z" + id="path2474-6" + style="fill:none;stroke:&fill_color;;stroke-width:2.5;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /><path + d="M 37.438881,22.676071 C 35.697593,22.498722 33.050146,21.440194 32.481887,19.572788" + id="path2476-1" + style="fill:none;stroke:&fill_color;;stroke-width:1.5;stroke-linecap:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /><circle + cx="35.805" + cy="10.96" + r="1.676" + transform="matrix(0.3489205,0,0,0.32478716,20.448838,13.620467)" + id="circle2478-8" + style="fill:none;stroke:&fill_color;;stroke-width:3.42034841;stroke-miterlimit:4;stroke-dasharray:none" /></g></svg>
\ No newline at end of file diff --git a/pippy_app.py b/pippy_app.py index 47618d1..f8d4ae5 100644 --- a/pippy_app.py +++ b/pippy_app.py @@ -72,38 +72,37 @@ class PippyActivity(ViewSourceActivity, groupthink.sugar_tools.GroupActivity): def initialize_display(self): self._logger = logging.getLogger('pippy-activity') - # Top toolbar with share and close buttons: + # Activity toolbar with title input, share button and export buttons: if OLD_TOOLBAR: activity_toolbar = self.toolbox.get_activity_toolbar() else: activity_toolbar = self.activity_button.page - # add 'make bundle' entry to 'keep' palette. - palette = activity_toolbar.keep.get_palette() - # XXX: should clear out old palette entries? - from sugar.graphics.menuitem import MenuItem - from sugar.graphics.icon import Icon - menu_item = MenuItem(_('As Pippy Document')) - menu_item.set_image(Icon(file=('%s/activity/activity-icon.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/activity/activity-default.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() - - menu_item = MenuItem(_('As Pippy Example')) # pippy example option - menu_item.set_image(Icon(file=('%s/activity/activity-icon.svg' % get_bundle_path()), icon_size=gtk.ICON_SIZE_MENU)) - menu_item.connect('activate', self.saveexamplebutton_cb) - palette.menu.append(menu_item) - menu_item.show() + # Hide keep button for Sugar versions prior to 0.94: + activity_toolbar.keep.hide() + + separator = gtk.SeparatorToolItem() + separator.show() + activity_toolbar.insert(separator, -1) + + export_doc_button = ToolButton('pippy-export_doc') + export_doc_button.set_tooltip(_("Export as Pippy Document")) + export_doc_button.connect('clicked', self._export_document_cb) + export_doc_button.show() + activity_toolbar.insert(export_doc_button, -1) + + export_example_button = ToolButton('pippy-export_example') + export_example_button.set_tooltip(_("Export as Pippy Example")) + export_example_button.connect('clicked', self._export_example_cb) + export_example_button.show() + activity_toolbar.insert(export_example_button, -1) + + create_bundle_button = ToolButton('pippy-create_bundle') + create_bundle_button.set_tooltip(_("Create Activity Bundle")) + create_bundle_button.connect('clicked', self._create_bundle_cb) + create_bundle_button.show() + activity_toolbar.insert(create_bundle_button, -1) self._edit_toolbar = activity.EditToolbar() @@ -424,10 +423,10 @@ class PippyActivity(ViewSourceActivity, groupthink.sugar_tools.GroupActivity): except: pass # process must already be dead. - def keepbutton_cb(self, __): + def _export_document_cb(self, __): self.copy() - def makebutton_cb(self, __): + def _create_bundle_cb(self, __): from shutil import copytree, copy2, rmtree from tempfile import mkdtemp # get the name of this pippy program. @@ -474,7 +473,7 @@ class PippyActivity(ViewSourceActivity, groupthink.sugar_tools.GroupActivity): rmtree(app_temp, ignore_errors=True) # clean up! raise - def saveexamplebutton_cb(self, __): + def _export_example_cb(self, __): # get the name of this pippy program. title = self.metadata['title'] if title == _('Pippy Activity'): |