Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--AbiWordActivity.py18
-rw-r--r--activity/activity.info2
-rw-r--r--icons/save-as-html.svg128
-rw-r--r--icons/save-as-pdf.svg155
-rw-r--r--icons/save-as-rtf.svg155
-rw-r--r--icons/save-as-txt.svg182
-rwxr-xr-xsetup.py1
-rw-r--r--widgets.py33
8 files changed, 644 insertions, 30 deletions
diff --git a/AbiWordActivity.py b/AbiWordActivity.py
index 09543dd..a21f819 100644
--- a/AbiWordActivity.py
+++ b/AbiWordActivity.py
@@ -48,7 +48,7 @@ from toolbar import TextToolbar
from toolbar import ListToolbar
from toolbar import InsertToolbar
from toolbar import ParagraphToolbar
-from widgets import ExportButton
+from widgets import ExportButtonFactory
logger = logging.getLogger('write-activity')
@@ -66,15 +66,14 @@ class AbiWordActivity(activity.Activity):
toolbar_box = ToolbarBox()
- activity_button = ActivityToolbarButton(self)
+ self.activity_button = ActivityToolbarButton(self)
+ toolbar_box.toolbar.insert(self.activity_button, -1)
separator = gtk.SeparatorToolItem()
separator.show()
- activity_button.props.page.insert(separator, 2)
- export_button = ExportButton(self, self.abiword_canvas)
- export_button.show()
- activity_button.props.page.insert(export_button, 2)
- toolbar_box.toolbar.insert(activity_button, 0)
+ self.activity_button.props.page.insert(separator, 2)
+ ExportButtonFactory(self, self.abiword_canvas)
+ self.activity_button.show()
edit_toolbar = ToolbarButton()
edit_toolbar.props.page = EditToolbar(self, toolbar_box)
@@ -431,9 +430,8 @@ class AbiWordActivity(activity.Activity):
self.abiword_canvas.save('file://' + file_path,
self.metadata['mime_type'], '')
- self.metadata['fulltext'] = \
- self.abiword_canvas.get_content(extension_or_mimetype=".txt") \
- [:3000]
+ self.metadata['fulltext'] = self.abiword_canvas.get_content(
+ extension_or_mimetype=".txt")[:3000]
def _is_plain_text(self, mime_type):
# These types have 'text/plain' in their mime_parents but we need
diff --git a/activity/activity.info b/activity/activity.info
index 398e0ae..05616cc 100644
--- a/activity/activity.info
+++ b/activity/activity.info
@@ -3,7 +3,7 @@ name = Write
bundle_id = org.laptop.AbiWordActivity
exec = sugar-activity AbiWordActivity.AbiWordActivity
icon = activity-write
-activity_version = 75
+activity_version = 76
show_launcher = 1
mime_types = text/rtf;text/plain;application/x-abiword;text/x-xml-abiword;application/msword;application/rtf;application/xhtml+xml;text/html;application/vnd.oasis.opendocument.text
license = GPLv2+
diff --git a/icons/save-as-html.svg b/icons/save-as-html.svg
new file mode 100644
index 0000000..92f1fd2
--- /dev/null
+++ b/icons/save-as-html.svg
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/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"><metadata
+ id="metadata25"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
+ id="defs33">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ </defs><g
+ transform="translate(-24.072147,0)"
+ id="g3014"><g
+ transform="matrix(1.1623273,0,0,1.1623273,5.8946433,-8.9787622)"
+ id="g3116"
+ style="fill:none;stroke:#ffffff;stroke-width:2.15085721;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"><polygon
+ points="39.811,18.343 39.811,38.42 18.435,38.42 18.435,10.583 32.046,10.583 "
+ id="polygon3118"
+ style="fill:none;stroke:#ffffff;stroke-width:2.15085721;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /><polyline
+ id="polyline3120"
+ points="39.811,18.343 32.046,18.343 32.046,10.583 "
+ style="fill:none;stroke:#ffffff;stroke-width:2.15085721;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><g
+ transform="matrix(1.1623273,0,0,1.1623273,5.8946433,-8.9787622)"
+ id="g3122"
+ style="fill:none;stroke:#ffffff;stroke-opacity:1"><circle
+ cx="29.122999"
+ cy="28.4"
+ r="6.4689999"
+ id="circle3124"
+ style="fill:none;stroke:#ffffff;stroke-opacity:1" /><g
+ id="g3126"
+ style="fill:none;stroke:#ffffff;stroke-opacity:1"><path
+ d="m 29.124,21.932 c 0,0 3.596,2.971 3.596,6.492 0,3.523 -3.596,6.445 -3.596,6.445"
+ id="path3128"
+ style="fill:none;stroke:#ffffff;stroke-width:0.97500002;stroke-opacity:1" /><path
+ d="m 29.124,21.932 c 0,0 -3.642,2.728 -3.642,6.492 0,3.765 3.642,6.445 3.642,6.445"
+ id="path3130"
+ style="fill:none;stroke:#ffffff;stroke-width:0.97500002;stroke-opacity:1" /><line
+ style="fill:none;stroke:#ffffff;stroke-width:0.97500002;stroke-opacity:1"
+ x1="29.124001"
+ x2="29.124001"
+ y1="21.931999"
+ y2="34.868999"
+ id="line3132" /><line
+ style="fill:none;stroke:#ffffff;stroke-width:0.97500002;stroke-opacity:1"
+ x1="22.653999"
+ x2="35.591"
+ y1="28.4"
+ y2="28.4"
+ id="line3134" /></g></g></g><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:#ffffff;stroke-opacity:1"><g
+ id="g4310"
+ style="fill:none;stroke:#ffffff;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:#ffffff;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:#ffffff;stroke-opacity:1"><g
+ id="g4316"
+ style="fill:none;stroke:#ffffff;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:#ffffff;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:#ffffff;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:#ffffff;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:#ffffff;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:#ffffff;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:#ffffff;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:#ffffff;stroke-width:2.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g></g></g></svg> \ No newline at end of file
diff --git a/icons/save-as-pdf.svg b/icons/save-as-pdf.svg
new file mode 100644
index 0000000..a1c6af8
--- /dev/null
+++ b/icons/save-as-pdf.svg
@@ -0,0 +1,155 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/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"><metadata
+ id="metadata25"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
+ id="defs33">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</defs><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:#ffffff;stroke-opacity:1"><g
+ id="g4310"
+ style="fill:none;stroke:#ffffff;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:#ffffff;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:#ffffff;stroke-opacity:1"><g
+ id="g4316"
+ style="fill:none;stroke:#ffffff;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:#ffffff;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:#ffffff;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:#ffffff;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:#ffffff;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:#ffffff;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:#ffffff;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:#ffffff;stroke-width:2.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g></g></g>
+<g
+ id="g4428"><g
+ transform="matrix(0.75578519,0,0,0.75578519,-4.9396196,-1.2911009)"
+ id="g3152"
+ style="fill:none;stroke:#ffffff;stroke-opacity:1;display:inline">
+ <g
+ id="g3154"
+ style="fill:none;stroke:#ffffff;stroke-opacity:1">
+ <polygon
+ points="10.932,48.914 10.932,6.088 31.874,6.088 43.818,18.027 43.818,48.914 "
+ id="polygon3156"
+ style="fill:none;stroke:#ffffff;stroke-width:3.5;stroke-opacity:1" />
+ <polyline
+ id="polyline3158"
+ points="43.818,18.027 31.874,18.027 31.874,6.088 "
+ style="fill:none;stroke:#ffffff;stroke-width:3.5;stroke-opacity:1" />
+ </g>
+ </g><line
+ id="line3160"
+ y2="19.133682"
+ y1="19.133682"
+ x2="22.929958"
+ x1="8.5700407"
+ display="inline"
+ style="fill:none;stroke:#ffffff;stroke-width:2.64524817;stroke-opacity:1;display:inline" /><line
+ id="line3162"
+ y2="24.424179"
+ y1="24.424179"
+ x2="22.929958"
+ x1="8.5700407"
+ display="inline"
+ style="fill:none;stroke:#ffffff;stroke-width:2.64524817;stroke-opacity:1;display:inline" /><line
+ id="line3164"
+ y2="29.714676"
+ y1="29.714676"
+ x2="22.929958"
+ x1="8.5700407"
+ display="inline"
+ style="fill:none;stroke:#ffffff;stroke-width:2.64524817;stroke-opacity:1;display:inline" /></g><text
+ x="1.12676"
+ y="50.289673"
+ id="text4437"
+ xml:space="preserve"
+ style="font-size:13px;font-style:normal;font-weight:bold;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans Bold"><tspan
+ x="1.12676"
+ y="50.289673"
+ id="tspan4439">PDF</tspan></text>
+</svg> \ No newline at end of file
diff --git a/icons/save-as-rtf.svg b/icons/save-as-rtf.svg
new file mode 100644
index 0000000..0e8d81c
--- /dev/null
+++ b/icons/save-as-rtf.svg
@@ -0,0 +1,155 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/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"><metadata
+ id="metadata25"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
+ id="defs33">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</defs><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:#ffffff;stroke-opacity:1"><g
+ id="g4310"
+ style="fill:none;stroke:#ffffff;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:#ffffff;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:#ffffff;stroke-opacity:1"><g
+ id="g4316"
+ style="fill:none;stroke:#ffffff;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:#ffffff;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:#ffffff;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:#ffffff;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:#ffffff;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:#ffffff;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:#ffffff;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:#ffffff;stroke-width:2.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g></g></g>
+<g
+ id="g4428"><g
+ transform="matrix(0.75578519,0,0,0.75578519,-4.9396196,-1.2911009)"
+ id="g3152"
+ style="fill:none;stroke:#ffffff;stroke-opacity:1;display:inline">
+ <g
+ id="g3154"
+ style="fill:none;stroke:#ffffff;stroke-opacity:1">
+ <polygon
+ points="10.932,48.914 10.932,6.088 31.874,6.088 43.818,18.027 43.818,48.914 "
+ id="polygon3156"
+ style="fill:none;stroke:#ffffff;stroke-width:3.5;stroke-opacity:1" />
+ <polyline
+ id="polyline3158"
+ points="43.818,18.027 31.874,18.027 31.874,6.088 "
+ style="fill:none;stroke:#ffffff;stroke-width:3.5;stroke-opacity:1" />
+ </g>
+ </g><line
+ id="line3160"
+ y2="19.133682"
+ y1="19.133682"
+ x2="22.929958"
+ x1="8.5700407"
+ display="inline"
+ style="fill:none;stroke:#ffffff;stroke-width:2.64524817;stroke-opacity:1;display:inline" /><line
+ id="line3162"
+ y2="24.424179"
+ y1="24.424179"
+ x2="22.929958"
+ x1="8.5700407"
+ display="inline"
+ style="fill:none;stroke:#ffffff;stroke-width:2.64524817;stroke-opacity:1;display:inline" /><line
+ id="line3164"
+ y2="29.714676"
+ y1="29.714676"
+ x2="22.929958"
+ x1="8.5700407"
+ display="inline"
+ style="fill:none;stroke:#ffffff;stroke-width:2.64524817;stroke-opacity:1;display:inline" /></g><text
+ x="2.1184082"
+ y="50.041759"
+ id="text4437"
+ xml:space="preserve"
+ style="font-size:13px;font-style:normal;font-weight:bold;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans Bold"><tspan
+ x="2.1184082"
+ y="50.041759"
+ id="tspan4439">RTF</tspan></text>
+</svg> \ No newline at end of file
diff --git a/icons/save-as-txt.svg b/icons/save-as-txt.svg
new file mode 100644
index 0000000..e60c753
--- /dev/null
+++ b/icons/save-as-txt.svg
@@ -0,0 +1,182 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.1"
+ width="55"
+ height="55"
+ viewBox="0 0 55 55"
+ id="svg2"
+ xml:space="preserve"
+ inkscape:version="0.48.1 r9760"
+ sodipodi:docname="save-as-txt.svg"><sodipodi:namedview
+ pagecolor="#000000"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="1"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1210"
+ inkscape:window-height="923"
+ id="namedview3278"
+ showgrid="false"
+ inkscape:zoom="12.101065"
+ inkscape:cx="11.565779"
+ inkscape:cy="24.916843"
+ inkscape:window-x="431"
+ inkscape:window-y="103"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="svg2"
+ showguides="true"
+ inkscape:guide-bbox="true" /><metadata
+ id="metadata25"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
+ id="defs33">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</defs><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:#ffffff;stroke-opacity:1"><g
+ id="g4310"
+ style="fill:none;stroke:#ffffff;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:#ffffff;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:#ffffff;stroke-opacity:1"><g
+ id="g4316"
+ style="fill:none;stroke:#ffffff;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:#ffffff;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:#ffffff;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:#ffffff;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:#ffffff;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:#ffffff;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:#ffffff;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:#ffffff;stroke-width:2.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g></g></g>
+<g
+ id="g4428"><g
+ transform="matrix(0.75578519,0,0,0.75578519,-4.9396196,-1.2911009)"
+ id="g3152"
+ style="fill:none;stroke:#ffffff;stroke-opacity:1;display:inline">
+ <g
+ id="g3154"
+ style="fill:none;stroke:#ffffff;stroke-opacity:1">
+ <polygon
+ points="43.818,48.914 10.932,48.914 10.932,6.088 31.874,6.088 43.818,18.027 "
+ id="polygon3156"
+ style="fill:none;stroke:#ffffff;stroke-width:3.5;stroke-opacity:1" />
+ <polyline
+ id="polyline3158"
+ points="43.818,18.027 31.874,18.027 31.874,6.088 "
+ style="fill:none;stroke:#ffffff;stroke-width:3.5;stroke-opacity:1" />
+ </g>
+ </g><line
+ id="line3160"
+ y2="19.133682"
+ y1="19.133682"
+ x2="22.929958"
+ x1="8.5700407"
+ display="inline"
+ style="fill:none;stroke:#ffffff;stroke-width:2.64524817;stroke-opacity:1;display:inline" /><line
+ id="line3162"
+ y2="24.424179"
+ y1="24.424179"
+ x2="22.929958"
+ x1="8.5700407"
+ display="inline"
+ style="fill:none;stroke:#ffffff;stroke-width:2.64524817;stroke-opacity:1;display:inline" /><line
+ id="line3164"
+ y2="29.714676"
+ y1="29.714676"
+ x2="22.929958"
+ x1="8.5700407"
+ display="inline"
+ style="fill:none;stroke:#ffffff;stroke-width:2.64524817;stroke-opacity:1;display:inline" /></g><text
+ xml:space="preserve"
+ style="font-size:13px;font-style:normal;font-weight:bold;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans Bold"
+ x="1.8180218"
+ y="50.041759"
+ id="text4437"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan4439"
+ x="1.8180218"
+ y="50.041759">TXT</tspan></text>
+</svg> \ No newline at end of file
diff --git a/setup.py b/setup.py
index fae74b8..530f97c 100755
--- a/setup.py
+++ b/setup.py
@@ -19,4 +19,3 @@
from sugar.activity import bundlebuilder
bundlebuilder.start()
-
diff --git a/widgets.py b/widgets.py
index 0a525bf..b79dbf7 100644
--- a/widgets.py
+++ b/widgets.py
@@ -69,7 +69,7 @@ class FontCombo(ComboBox):
if not self._has_custom_fonts:
# add a separator to seperate the non-available fonts from
# the available ones
- self._fonts.append('') # ugly
+ self._fonts.append('') # ugly
self.append_separator()
self._has_custom_fonts = True
# add the new font
@@ -79,7 +79,7 @@ class FontCombo(ComboBox):
model = self.get_model()
num_children = model.iter_n_children(None)
logger.debug('Number of fonts in the list: %d', num_children)
- font_index = num_children-1
+ font_index = num_children - 1
# activate the found font
if (font_index > -1):
@@ -159,47 +159,44 @@ class AbiButton(RadioToolButton):
self.handler_unblock(self._toggled_handler)
-class ExportButton(ToolButton):
+class ExportButtonFactory():
_EXPORT_FORMATS = [{'mime_type': 'application/rtf',
'title': _('Rich Text (RTF)'),
+ 'icon':'save-as-rtf',
'jpostfix': _('RTF'),
'exp_props': ''},
{'mime_type': 'text/html',
'title': _('Hypertext (HTML)'),
+ 'icon':'save-as-html',
'jpostfix': _('HTML'),
'exp_props': 'html4:yes; declare-xml:no; ' \
'embed-css:yes; embed-images:yes;'},
{'mime_type': 'text/plain',
'title': _('Plain Text (TXT)'),
+ 'icon':'save-as-txt',
'jpostfix': _('TXT'),
'exp_props': ''},
{'mime_type': 'application/pdf',
'title': _('Portable Document Format (PDF)'),
+ 'icon':'save-as-pdf',
'jpostfix': _('PDF'),
'exp_props': ''}]
def __init__(self, activity, abi):
- ToolButton.__init__(self, 'document-save')
- self.props.tooltip = _('Export')
- self.props.label = _('Export')
+ toolbar = activity.activity_button.props.page
for i in self._EXPORT_FORMATS:
- menu_item = MenuItem(i['title'])
- menu_item.connect('activate', self.__activate_cb, activity, abi, i)
- self.props.palette.menu.append(menu_item)
- menu_item.show()
-
- def do_clicked(self):
- if self.props.palette.is_up():
- self.props.palette.popdown(immediate=True)
- else:
- self.props.palette.popup(immediate=True, state=Palette.SECONDARY)
-
- def __activate_cb(self, menu_item, activity, abi, format):
+ button = ToolButton(i['icon'])
+ button.set_tooltip(i['title'])
+ button.connect('clicked', self.__clicked_cb, activity, abi, i)
+ toolbar.insert(button, -1)
+ button.show()
+
+ def __clicked_cb(self, menu_item, activity, abi, format):
logger.debug('exporting file: %r' % format)
exp_props = format['exp_props']