Ticket #3157: 0001-Pippy-fix-for-export-buttons.patch
File 0001-Pippy-fix-for-export-buttons.patch, 16.6 KB (added by manuq, 12 years ago) |
---|
-
new file icons/pippy-create_bundle.svg
From 2adc473dac81dd794f337d250cf3d49798808056 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Qui=C3=B1ones?= <manuq@laptop.org> Date: Thu, 6 Oct 2011 22:06:26 -0300 Subject: [PATCH] Pippy: fix for export buttons MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is for bug #3157 . The buttons were placed in a palette, drop-down menu, in the Keep button. But as the Keep button is hidden since Sugar 0.94, Pippy wasn't able to export anymore. This patch adds the buttons in the activity toolbar, and the design is according to the latest design decisions, using Turtle Block's export buttons as reference. Signed-off-by: Manuel Quiñones <manuq@laptop.org> --- icons/pippy-create_bundle.svg | 34 +++++++++++++++++ icons/pippy-export_doc.svg | 81 ++++++++++++++++++++++++++++++++++++++++ icons/pippy-export_example.svg | 49 ++++++++++++++++++++++++ pippy_app.py | 57 ++++++++++++++-------------- 4 files changed, 192 insertions(+), 29 deletions(-) create mode 100644 icons/pippy-create_bundle.svg create mode 100644 icons/pippy-export_doc.svg create mode 100644 icons/pippy-export_example.svg diff --git a/icons/pippy-create_bundle.svg b/icons/pippy-create_bundle.svg new file mode 100644 index 0000000..b5d0a26
- + 1 <?xml version="1.0" encoding="UTF-8"?> 2 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [ 3 <!ENTITY fill_color "#FFFFFF"> 4 <!ENTITY stroke_color "#010101"> 5 ]> 6 <svg 7 xmlns="http://www.w3.org/2000/svg" 8 version="1.1" 9 width="55" 10 height="55" 11 viewBox="0 0 55 55" 12 id="svg2" 13 xml:space="preserve"><rect 14 width="29.497099" 15 height="29.497099" 16 x="-28.68516" 17 y="32.139339" 18 transform="matrix(0.83456543,-0.55090883,0.83456543,0.55090883,0,0)" 19 id="rect3936" 20 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 21 transform="translate(0,-2)" 22 id="g4709"><path 23 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" 24 id="path2474" 25 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 26 d="M 37.438881,22.676071 C 35.697593,22.498722 33.050146,21.440194 32.481887,19.572788" 27 id="path2476" 28 style="fill:&fill_color;;stroke:&stroke_color;;stroke-width:1.5;stroke-linecap:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /><circle 29 cx="35.805" 30 cy="10.96" 31 r="1.676" 32 transform="matrix(0.3489205,0,0,0.32478716,20.448838,13.620467)" 33 id="circle2478" 34 style="fill:&fill_color;;stroke:&stroke_color;;stroke-width:3.42034841;stroke-miterlimit:4;stroke-dasharray:none" /></g></svg> 35 No newline at end of file -
new file icons/pippy-export_doc.svg
diff --git a/icons/pippy-export_doc.svg b/icons/pippy-export_doc.svg new file mode 100644 index 0000000..b8e8c86
- + 1 <?xml version="1.0" encoding="UTF-8"?> 2 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [ 3 <!ENTITY fill_color "#FFFFFF"> 4 <!ENTITY stroke_color "#010101"> 5 ]> 6 <svg 7 xmlns="http://www.w3.org/2000/svg" 8 version="1.1" 9 width="55" 10 height="55" 11 viewBox="0 0 55 55" 12 id="svg2" 13 xml:space="preserve"><g 14 id="g3830"><g 15 transform="matrix(0.55205508,0,0,0.55205508,75.618464,18.235971)" 16 id="g4382"><g 17 transform="translate(-80.093659,12.220029)" 18 id="g4308" 19 style="fill:none;stroke:&fill_color;;stroke-opacity:1"> 20 <g 21 id="g4310" 22 style="fill:none;stroke:&fill_color;;stroke-opacity:1"> 23 <path 24 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" 25 id="path4312" 26 style="fill:none;stroke:&fill_color;;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" /> 27 </g> 28 </g><g 29 transform="translate(-80.093659,12.220029)" 30 id="g4314" 31 style="fill:none;stroke:&fill_color;;stroke-opacity:1"> 32 <g 33 id="g4316" 34 style="fill:none;stroke:&fill_color;;stroke-opacity:1"> 35 <path 36 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" 37 id="path4318" 38 style="fill:none;stroke:&fill_color;;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" /> 39 </g> 40 </g><path 41 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" 42 id="path4320" 43 style="fill:none;stroke:&fill_color;;stroke-width:2.25;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" /><path 44 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" 45 id="path4322" 46 style="fill:none;stroke:&fill_color;;stroke-width:2.25;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" /><path 47 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" 48 id="path4324" 49 style="fill:none;stroke:&fill_color;;stroke-width:2.25;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" /><line 50 id="line4326" 51 y2="23.725029" 52 y1="58.753029" 53 x2="-66.884659" 54 x1="-66.884659" 55 style="fill:none;stroke:&fill_color;;stroke-width:2.25;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" /></g><g 56 transform="matrix(1,0,0,-1,-30.386573,49.171266)" 57 id="g4770"><g 58 transform="translate(34.0803,-1006.42)" 59 id="g4772"><polyline 60 id="polyline4774" 61 points="51.562,15.306 41.17,16.188 42.053,5.794" 62 style="fill:none;stroke:&fill_color;;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round" 63 transform="matrix(-0.469241,0.469241,-0.469241,-0.469241,66.2906,1019.03)" /><path 64 d="m 39.363241,1033.1291 -0.05636,9.9115 -8.750608,0.067" 65 id="path4776" 66 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 67 transform="translate(-11.834288,-11.628123)" 68 id="g4709" 69 style="fill:none;stroke:&fill_color;"><path 70 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" 71 id="path2474-6" 72 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 73 d="M 37.438881,22.676071 C 35.697593,22.498722 33.050146,21.440194 32.481887,19.572788" 74 id="path2476-1" 75 style="fill:none;stroke:&fill_color;;stroke-width:1.5;stroke-linecap:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /><circle 76 cx="35.805" 77 cy="10.96" 78 r="1.676" 79 transform="matrix(0.3489205,0,0,0.32478716,20.448838,13.620467)" 80 id="circle2478-8" 81 style="fill:none;stroke:&fill_color;;stroke-width:3.42034841;stroke-miterlimit:4;stroke-dasharray:none" /></g></svg> 82 No newline at end of file -
new file icons/pippy-export_example.svg
diff --git a/icons/pippy-export_example.svg b/icons/pippy-export_example.svg new file mode 100644 index 0000000..014460b
- + 1 <?xml version="1.0" encoding="UTF-8"?> 2 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [ 3 <!ENTITY fill_color "#FFFFFF"> 4 <!ENTITY stroke_color "#010101"> 5 ]> 6 <svg 7 xmlns="http://www.w3.org/2000/svg" 8 version="1.1" 9 width="55" 10 height="55" 11 viewBox="0 0 55 55" 12 id="Icon" 13 xml:space="preserve" 14 style="overflow:visible"><path 15 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" 16 id="path3806" 17 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 18 cx="35.805" 19 cy="10.96" 20 r="1.676" 21 transform="matrix(0.66385342,0,0,0.61793751,-2.1883406,-1.1658202)" 22 id="circle2478" 23 style="fill:none;stroke-width:3.42034841;stroke-miterlimit:4;stroke-dasharray:none" /><g 24 transform="matrix(1,0,0,-1,-30.386574,49.171266)" 25 id="g4770"><g 26 transform="translate(34.0803,-1006.42)" 27 id="g4772"><polyline 28 transform="matrix(-0.469241,0.469241,-0.469241,-0.469241,66.2906,1019.03)" 29 style="fill:none;stroke:&fill_color;;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round" 30 points="51.562,15.306 41.17,16.188 42.053,5.794" 31 id="polyline4774" /><path 32 d="m 39.363241,1033.1291 -0.05636,9.9115 -8.750608,0.067" 33 id="path4776" 34 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 35 transform="translate(-11.83429,-11.628123)" 36 id="g4709" 37 style="fill:none;stroke:&fill_color;"><path 38 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" 39 id="path2474-6" 40 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 41 d="M 37.438881,22.676071 C 35.697593,22.498722 33.050146,21.440194 32.481887,19.572788" 42 id="path2476-1" 43 style="fill:none;stroke:&fill_color;;stroke-width:1.5;stroke-linecap:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /><circle 44 cx="35.805" 45 cy="10.96" 46 r="1.676" 47 transform="matrix(0.3489205,0,0,0.32478716,20.448838,13.620467)" 48 id="circle2478-8" 49 style="fill:none;stroke:&fill_color;;stroke-width:3.42034841;stroke-miterlimit:4;stroke-dasharray:none" /></g></svg> 50 No newline at end of file -
pippy_app.py
diff --git a/pippy_app.py b/pippy_app.py index 5ee8ff8..6729813 100644
a b class PippyActivity(ViewSourceActivity, groupthink.sugar_tools.GroupActivity): 72 72 def initialize_display(self): 73 73 self._logger = logging.getLogger('pippy-activity') 74 74 75 # Top toolbar with share and closebuttons:75 # Activity toolbar with title input, share button and export buttons: 76 76 77 77 if OLD_TOOLBAR: 78 78 activity_toolbar = self.toolbox.get_activity_toolbar() 79 79 else: 80 80 activity_toolbar = self.activity_button.page 81 81 82 # add 'make bundle' entry to 'keep' palette. 83 palette = activity_toolbar.keep.get_palette() 84 # XXX: should clear out old palette entries? 85 from sugar.graphics.menuitem import MenuItem 86 from sugar.graphics.icon import Icon 87 menu_item = MenuItem(_('As Pippy Document')) 88 menu_item.set_image(Icon(file=('%s/activity/activity-icon.svg' % 89 get_bundle_path()), 90 icon_size=gtk.ICON_SIZE_MENU)) 91 menu_item.connect('activate', self.keepbutton_cb) 92 palette.menu.append(menu_item) 93 menu_item.show() 94 menu_item = MenuItem(_('As Activity Bundle')) 95 menu_item.set_image(Icon(file=('%s/activity/activity-default.svg' % 96 get_bundle_path()), 97 icon_size=gtk.ICON_SIZE_MENU)) 98 menu_item.connect('activate', self.makebutton_cb) 99 palette.menu.append(menu_item) 100 menu_item.show() 101 102 menu_item = MenuItem(_('As Pippy Example')) # pippy example option 103 menu_item.set_image(Icon(file=('%s/activity/activity-icon.svg' % get_bundle_path()), icon_size=gtk.ICON_SIZE_MENU)) 104 menu_item.connect('activate', self.saveexamplebutton_cb) 105 palette.menu.append(menu_item) 106 menu_item.show() 82 # Hide keep button for Sugar versions prior to 0.94: 83 activity_toolbar.keep.hide() 84 85 separator = gtk.SeparatorToolItem() 86 separator.show() 87 activity_toolbar.insert(separator, -1) 88 89 export_doc_button = ToolButton('pippy-export_doc') 90 export_doc_button.set_tooltip(_("Export as Pippy Document")) 91 export_doc_button.connect('clicked', self._export_document_cb) 92 export_doc_button.show() 93 activity_toolbar.insert(export_doc_button, -1) 94 95 export_example_button = ToolButton('pippy-export_example') 96 export_example_button.set_tooltip(_("Export as Pippy Example")) 97 export_example_button.connect('clicked', self._export_example_cb) 98 export_example_button.show() 99 activity_toolbar.insert(export_example_button, -1) 100 101 create_bundle_button = ToolButton('pippy-create_bundle') 102 create_bundle_button.set_tooltip(_("Create Activity Bundle")) 103 create_bundle_button.connect('clicked', self._create_bundle_cb) 104 create_bundle_button.show() 105 activity_toolbar.insert(create_bundle_button, -1) 107 106 108 107 self._edit_toolbar = activity.EditToolbar() 109 108 … … class PippyActivity(ViewSourceActivity, groupthink.sugar_tools.GroupActivity): 417 416 except: 418 417 pass # process must already be dead. 419 418 420 def keepbutton_cb(self, __):419 def _export_document_cb(self, __): 421 420 self.copy() 422 421 423 def makebutton_cb(self, __):422 def _create_bundle_cb(self, __): 424 423 from shutil import copytree, copy2, rmtree 425 424 from tempfile import mkdtemp 426 425 # get the name of this pippy program. … … class PippyActivity(ViewSourceActivity, groupthink.sugar_tools.GroupActivity): 467 466 rmtree(app_temp, ignore_errors=True) # clean up! 468 467 raise 469 468 470 def saveexamplebutton_cb(self, __):469 def _export_example_cb(self, __): 471 470 # get the name of this pippy program. 472 471 title = self.metadata['title'] 473 472 if title == _('Pippy Activity'):