Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--MANIFEST3
-rw-r--r--SliderPuzzleUI.py62
-rw-r--r--activity/activity.info2
-rw-r--r--locale/org.worldwideworkshop.olpc.SliderPuzzle.pot32
-rw-r--r--locale/pt/LC_MESSAGES/org.worldwideworkshop.olpc.SliderPuzzle.mobin1877 -> 1952 bytes
-rw-r--r--locale/pt/LC_MESSAGES/pt.po32
-rw-r--r--texts/lesson_plan.abw49
-rw-r--r--texts/lesson_plan_pt.abw50
-rw-r--r--toolbar.py133
10 files changed, 299 insertions, 66 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..f3d74a9
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+*.pyc
+*~
diff --git a/MANIFEST b/MANIFEST
index 1e9a7c0..f1993dd 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -3,6 +3,7 @@ SliderPuzzleUI.py
SliderPuzzleWidget.py
i18n.py
utils.py
+toolbar.py
icons/brazil.png
icons/china.svg
icons/circle-check.svg
@@ -82,3 +83,5 @@ images/jumbler starter pics/image_wpwa_h250_w250_lg.gif
images/jumbler starter pics/image_xxmrtwigxx_lg.gif
images/jumbler starter pics/thumb.gif
locale/pt/LC_MESSAGES/pt.po
+texts/lesson_plan.abw
+texts/lesson_plan_pt.abw
diff --git a/SliderPuzzleUI.py b/SliderPuzzleUI.py
index 440bfdf..99d499e 100644
--- a/SliderPuzzleUI.py
+++ b/SliderPuzzleUI.py
@@ -28,18 +28,16 @@ pygtk.require('2.0')
import gtk, gobject, pango
from utils import load_image
-from i18n import list_available_translations
+from toolbar import SliderToolbar
import logging
-import gettext
-import locale
from glob import glob
from SliderPuzzleWidget import SliderPuzzleWidget
from time import time
import os
try:
- from sugar.graphics.combobox import ComboBox
+ from sugar.activity import activity
from sugar.graphics import units
_inside_sugar = True
except:
@@ -379,6 +377,11 @@ class CategorySelector (gtk.ScrolledWindow):
tv, it = tree.get_selection().get_selected()
self.emit("selected", tv.get_value(it,0))
+#class PopupDialog (gtk.Dialog):
+# def __init__ (self, title=None, parent=None):
+# gtk.Dialog.__init__(self, title, parent,
+#
+
class SliderPuzzleUI:
def __init__(self, parent):
# Add our own icons here, needed for the translation flags
@@ -394,8 +397,14 @@ class SliderPuzzleUI:
self.window = parent
if _inside_sugar:
- self.update_toolbar()
+ toolbox = activity.ActivityToolbox(parent)
+ toolbar = SliderToolbar()
+ toolbox.add_toolbar(_('Slider Puzzle Toolbar'), toolbar)
+ toolbar.show()
+ parent.set_toolbox(toolbox)
+ toolbox.show()
else:
+ import gettext
gettext.bindtextdomain('org.worldwideworkshop.olpc.SliderPuzzle', 'locale')
gettext.textdomain('org.worldwideworkshop.olpc.SliderPuzzle')
bgcolor = gtk.gdk.color_parse("#DDDD40")
@@ -492,52 +501,15 @@ class SliderPuzzleUI:
# Push the gettext translator into the global namespace
del _
if _inside_sugar:
- self.do_select_language(self.tb_lang_select)
+ toolbar.set_language_callback(self.do_select_language)
+ #self.do_select_language(self.tb_lang_select)
+ pass
else:
_ = gettext.gettext
self.refresh_labels(True)
#self.timer.start()
-
- def update_toolbar (self):
- """ This method lists all available translations in a ComboBox widget.
- The first translation is English, for that is the 'no translation' language in the code."""
- self.translations = list_available_translations()
- logging.debug(self.translations)
- self.tb_lang_select = ComboBox()
- for i,x in enumerate(self.translations):
- self.tb_lang_select.append_item(i+1,gettext.gettext(x.name), x.image)
- self.tb_lang_select.connect('changed', self.do_select_language)
- # Attach the ComboBox to Sugar activity default toolbar
- toolbox = self.window.toolbox
- toolbar = toolbox.get_activity_toolbar()
- tool_item = gtk.ToolItem()
- tool_item.set_expand(False)
- tool_item.add(self.tb_lang_select)
- self.tb_lang_select.show()
- toolbar.insert(tool_item, 2)
- tool_item.show()
- self.tb_lang_select._icon_renderer.props.stock_size = 3
-
def do_select_language (self, combo, *args):
- if combo.get_active() > -1:
- self.translations[combo.get_active()].install()
- else:
- code, encoding = locale.getdefaultlocale()
- # Try to find the exact translation
- for i,t in enumerate(self.translations):
- if t.matches(code):
- combo.set_active(i)
- break
- if combo.get_active() < 0:
- # Failed, try to get the translation based only in the country
- for i,t in enumerate(self.translations):
- if t.matches(code, False):
- combo.set_active(i)
- break
- if combo.get_active() < 0:
- # nothing found, select first translation
- combo.set_active(0)
self.refresh_labels()
def refresh_labels (self, first_time=False):
diff --git a/activity/activity.info b/activity/activity.info
index 53d4c92..0572c6f 100644
--- a/activity/activity.info
+++ b/activity/activity.info
@@ -3,5 +3,5 @@ name = Slider Puzzle
service_name = org.worldwideworkshop.olpc.SliderPuzzle
class = SliderPuzzleActivity.SliderPuzzleActivity
icon = activity-sliderpuzzle
-activity_version = 0
+activity_version = 1
show_launcher = yes
diff --git a/locale/org.worldwideworkshop.olpc.SliderPuzzle.pot b/locale/org.worldwideworkshop.olpc.SliderPuzzle.pot
index f159bee..4531401 100644
--- a/locale/org.worldwideworkshop.olpc.SliderPuzzle.pot
+++ b/locale/org.worldwideworkshop.olpc.SliderPuzzle.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2007-05-29 00:36+0100\n"
+"POT-Creation-Date: 2007-05-31 00:30+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -20,39 +20,43 @@ msgstr ""
msgid "SliderPuzzle"
msgstr ""
-#: SliderPuzzleUI.py:433
+#: SliderPuzzleUI.py:402
+msgid "Slider Puzzle Toolbar"
+msgstr ""
+
+#: SliderPuzzleUI.py:450
msgid "My Own Picture"
msgstr ""
-#: SliderPuzzleUI.py:437
+#: SliderPuzzleUI.py:454
msgid "Solve"
msgstr ""
-#: SliderPuzzleUI.py:441
+#: SliderPuzzleUI.py:458
msgid "Jumble"
msgstr ""
-#: SliderPuzzleUI.py:450
+#: SliderPuzzleUI.py:467
msgid "Time: "
msgstr ""
-#: SliderPuzzleUI.py:541
+#: SliderPuzzleUI.py:517
msgid "Slider Puzzle Activity"
msgstr ""
-#: SliderPuzzleUI.py:580
+#: SliderPuzzleUI.py:566
msgid "Select Image Category"
msgstr ""
-#: SliderPuzzleUI.py:590
+#: SliderPuzzleUI.py:577
msgid "Image Files"
msgstr ""
-#: SliderPuzzleUI.py:592
+#: SliderPuzzleUI.py:579
msgid "Select Image File"
msgstr ""
-#: SliderPuzzleUI.py:605
+#: SliderPuzzleUI.py:592
msgid "Not a valid image file"
msgstr ""
@@ -151,3 +155,11 @@ msgstr ""
#: i18n.py:58
msgid "Turkish"
msgstr ""
+
+#: toolbar.py:74
+msgid "Lesson Plan"
+msgstr ""
+
+#: toolbar.py:79
+msgid "Dismiss"
+msgstr ""
diff --git a/locale/pt/LC_MESSAGES/org.worldwideworkshop.olpc.SliderPuzzle.mo b/locale/pt/LC_MESSAGES/org.worldwideworkshop.olpc.SliderPuzzle.mo
index fe2548f..c342076 100644
--- a/locale/pt/LC_MESSAGES/org.worldwideworkshop.olpc.SliderPuzzle.mo
+++ b/locale/pt/LC_MESSAGES/org.worldwideworkshop.olpc.SliderPuzzle.mo
Binary files differ
diff --git a/locale/pt/LC_MESSAGES/pt.po b/locale/pt/LC_MESSAGES/pt.po
index 547cea1..fa80699 100644
--- a/locale/pt/LC_MESSAGES/pt.po
+++ b/locale/pt/LC_MESSAGES/pt.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2007-05-29 00:36+0100\n"
+"POT-Creation-Date: 2007-05-31 00:30+0100\n"
"PO-Revision-Date: 2007-05-23 10:48+0100\n"
"Last-Translator: Carlos Neves <cn@sueste>\n"
"Language-Team: Portuguese <info@worldwideworkshop.org>\n"
@@ -21,40 +21,44 @@ msgstr ""
msgid "SliderPuzzle"
msgstr ""
-#: SliderPuzzleUI.py:433
+#: SliderPuzzleUI.py:402
+msgid "Slider Puzzle Toolbar"
+msgstr ""
+
+#: SliderPuzzleUI.py:450
msgid "My Own Picture"
msgstr "Minha Imagem"
-#: SliderPuzzleUI.py:437
+#: SliderPuzzleUI.py:454
msgid "Solve"
msgstr "Resolver"
-#: SliderPuzzleUI.py:441
+#: SliderPuzzleUI.py:458
msgid "Jumble"
msgstr "Baralhar"
-#: SliderPuzzleUI.py:450
+#: SliderPuzzleUI.py:467
msgid "Time: "
msgstr "Tempo: "
-#: SliderPuzzleUI.py:541
+#: SliderPuzzleUI.py:517
msgid "Slider Puzzle Activity"
msgstr ""
-#: SliderPuzzleUI.py:580
+#: SliderPuzzleUI.py:566
msgid "Select Image Category"
msgstr "Selecciona a Categoria das Imagens"
-#: SliderPuzzleUI.py:590
+#: SliderPuzzleUI.py:577
msgid "Image Files"
msgstr "Imagens"
-#: SliderPuzzleUI.py:592
+#: SliderPuzzleUI.py:579
#, fuzzy
msgid "Select Image File"
msgstr "Selecciona a Categoria das Imagens"
-#: SliderPuzzleUI.py:605
+#: SliderPuzzleUI.py:592
msgid "Not a valid image file"
msgstr "Imagem inválida"
@@ -154,5 +158,13 @@ msgstr "Sueco"
msgid "Turkish"
msgstr "Turco"
+#: toolbar.py:74
+msgid "Lesson Plan"
+msgstr "Plano de Ensino"
+
+#: toolbar.py:79
+msgid "Dismiss"
+msgstr "Fechar"
+
msgid "jumbler starter pics"
msgstr "Imagens iniciais do Jumbler"
diff --git a/texts/lesson_plan.abw b/texts/lesson_plan.abw
new file mode 100644
index 0000000..0c78a51
--- /dev/null
+++ b/texts/lesson_plan.abw
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE abiword PUBLIC "-//ABISOURCE//DTD AWML 1.0 Strict//EN" "http://www.abisource.com/awml.dtd">
+<abiword template="false" styles="unlocked" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:math="http://www.w3.org/1998/Math/MathML" xid-max="25" xmlns:dc="http://purl.org/dc/elements/1.1/" fileformat="1.0" xmlns:svg="http://www.w3.org/2000/svg" xmlns:awml="http://www.abisource.com/awml.dtd" xmlns="http://www.abisource.com/awml.dtd" xmlns:xlink="http://www.w3.org/1999/xlink" version="0.99.2" xml:space="preserve" props="dom-dir:ltr; document-footnote-restart-section:0; document-endnote-type:numeric; document-endnote-place-enddoc:1; document-endnote-initial:1; lang:en-US; document-endnote-restart-section:0; document-footnote-restart-page:0; document-footnote-type:numeric; document-footnote-initial:1; document-endnote-place-endsection:0">
+<!-- ======================================================================== -->
+<!-- This file is an AbiWord document. -->
+<!-- AbiWord is a free, Open Source word processor. -->
+<!-- More information about AbiWord is available at http://www.abisource.com/ -->
+<!-- You should not edit this file by hand. -->
+<!-- ======================================================================== -->
+
+<metadata>
+<m key="dc.format">application/x-abiword</m>
+<m key="abiword.generator">AbiWord</m>
+</metadata>
+<history version="4" edit-time="2352" last-saved="1180566808" uid="e6069688-0efd-11dc-8213-d43fcb623993">
+<version id="4" started="1180564755" uid="5fe4a9e0-0f03-11dc-8213-d43fcb623993" auto="0" top-xid="25"/>
+</history>
+<styles>
+<s type="P" name="Normal" followedby="Current Settings" props="font-family:Times New Roman; margin-top:0pt; color:000000; margin-left:0pt; text-position:normal; widows:2; font-style:normal; text-indent:0in; font-variant:normal; margin-right:0pt; lang:en-US; line-height:1.0; font-size:12pt; text-decoration:none; margin-bottom:0pt; font-weight:normal; bgcolor:transparent; text-align:left; font-stretch:normal"/>
+<s type="P" name="Heading 2" basedon="Normal" followedby="Normal" props="keep-with-next:1; margin-top:22pt; font-weight:bold; margin-bottom:3pt; font-family:DejaVu Sans; font-size:14pt"/>
+<s type="C" name="Endnote Reference" basedon="None" followedby="Current Settings" props="text-position:superscript; font-size:10pt"/>
+</styles>
+<pagesize pagetype="A5" orientation="landscape" width="210.000000" height="148.000000" units="mm" page-scale="1.000000"/>
+<section xid="24" props="page-margin-right:25.4mm; page-margin-footer:12.7mm; page-margin-header:12.7mm; page-margin-left:25.4mm; page-margin-top:25.4mm; page-margin-bottom:25.4mm">
+<p style="Normal" xid="25" props="text-align:center; dom-dir:ltr"><c props="font-weight:bold; font-size:24pt">A "Lorem ipsum" Lesson Plan</c></p>
+<p style="Normal" xid="20" props="text-align:left; dom-dir:ltr"></p>
+<p style="Heading 2" xid="21" props="text-align:center; dom-dir:ltr; orphans:0"><c props="color:ffffff; bgcolor:9f1fef">The standard Lorem Ipsum passage, used since the 1500s</c></p>
+<p style="Normal" xid="2" props="text-align:left; dom-dir:ltr"></p>
+<p style="Normal" xid="3" props="text-align:left; dom-dir:ltr">"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."</p>
+<p style="Normal" xid="4" props="text-align:left; dom-dir:ltr"></p>
+<p style="Heading 2" xid="5" props="text-align:center; dom-dir:ltr">Section 1.10.32 of "de Finibus Bonorum et Malorum", written by Cicero in 45 BC</p>
+<p style="Normal" xid="6" props="text-align:left; dom-dir:ltr"></p>
+<p style="Normal" xid="7" props="text-align:left; dom-dir:ltr">"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?"</p>
+<p style="Normal" xid="8" props="text-align:left; dom-dir:ltr"></p>
+<p style="Heading 2" xid="9" props="text-align:center; dom-dir:ltr">1914 translation by H. Rackham</p>
+<p style="Normal" xid="10" props="text-align:left; dom-dir:ltr"></p>
+<p style="Normal" xid="11" props="text-align:left; dom-dir:ltr">"But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?"</p>
+<p style="Normal" xid="12" props="text-align:left; dom-dir:ltr"></p>
+<p style="Heading 2" xid="13" props="text-align:center; dom-dir:ltr">Section 1.10.33 of "de Finibus Bonorum et Malorum", written by Cicero in 45 BC</p>
+<p style="Normal" xid="14" props="text-align:left; dom-dir:ltr"></p>
+<p style="Normal" xid="15" props="text-align:left; dom-dir:ltr">"At vero eos et accusamus et iusto odio dighttp://www.lipsum.com/nissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat."</p>
+<p style="Normal" xid="16" props="text-align:left; dom-dir:ltr"></p>
+<p style="Heading 2" xid="17" props="text-align:center; dom-dir:ltr">1914 translation by H. Rackham</p>
+<p style="Normal" xid="18" props="text-align:left; dom-dir:ltr"></p>
+<p style="Normal" xid="19" props="text-align:left; dom-dir:ltr">"On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains." </p>
+<p style="Normal" xid="22" props="text-align:left; dom-dir:ltr"></p>
+<p style="Normal" xid="23" props="text-align:left; dom-dir:ltr"><c style="Endnote Reference">This text stolen from http://www.lipsum.com without any authorization whatsoever!</c></p>
+</section>
+</abiword>
diff --git a/texts/lesson_plan_pt.abw b/texts/lesson_plan_pt.abw
new file mode 100644
index 0000000..cf94e2f
--- /dev/null
+++ b/texts/lesson_plan_pt.abw
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE abiword PUBLIC "-//ABISOURCE//DTD AWML 1.0 Strict//EN" "http://www.abisource.com/awml.dtd">
+<abiword template="false" styles="unlocked" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:math="http://www.w3.org/1998/Math/MathML" xid-max="25" xmlns:dc="http://purl.org/dc/elements/1.1/" fileformat="1.0" xmlns:svg="http://www.w3.org/2000/svg" xmlns:awml="http://www.abisource.com/awml.dtd" xmlns="http://www.abisource.com/awml.dtd" xmlns:xlink="http://www.w3.org/1999/xlink" version="0.99.2" xml:space="preserve" props="dom-dir:ltr; document-footnote-restart-section:0; document-endnote-type:numeric; document-endnote-place-enddoc:1; document-endnote-initial:1; lang:en-US; document-endnote-restart-section:0; document-footnote-restart-page:0; document-footnote-type:numeric; document-footnote-initial:1; document-endnote-place-endsection:0">
+<!-- ======================================================================== -->
+<!-- This file is an AbiWord document. -->
+<!-- AbiWord is a free, Open Source word processor. -->
+<!-- More information about AbiWord is available at http://www.abisource.com/ -->
+<!-- You should not edit this file by hand. -->
+<!-- ======================================================================== -->
+
+<metadata>
+<m key="dc.format">application/x-abiword</m>
+<m key="abiword.generator">AbiWord</m>
+</metadata>
+<history version="5" edit-time="2374" last-saved="1180566936" uid="e6069688-0efd-11dc-8213-d43fcb623993">
+<version id="4" started="1180564755" uid="5fe4a9e0-0f03-11dc-8213-d43fcb623993" auto="0" top-xid="25"/>
+<version id="5" started="1180566936" uid="ac92cb1e-0f03-11dc-8213-d43fcb623993" auto="0" top-xid="25"/>
+</history>
+<styles>
+<s type="P" name="Normal" followedby="Current Settings" props="font-weight:normal; font-family:Times New Roman; margin-top:0pt; color:000000; margin-left:0pt; bgcolor:transparent; widows:2; font-style:normal; text-indent:0in; text-position:normal; margin-bottom:0pt; lang:en-US; line-height:1.0; text-align:left; font-variant:normal; text-decoration:none; margin-right:0pt; font-size:12pt; font-stretch:normal"/>
+<s type="P" name="Heading 2" basedon="Normal" followedby="Normal" props="font-size:14pt; margin-top:22pt; font-weight:bold; margin-bottom:3pt; font-family:DejaVu Sans; keep-with-next:1"/>
+<s type="C" name="Endnote Reference" basedon="None" followedby="Current Settings" props="text-position:superscript; font-size:10pt"/>
+</styles>
+<pagesize pagetype="A5" orientation="landscape" width="210.000000" height="148.000000" units="mm" page-scale="1.000000"/>
+<section xid="24" props="page-margin-footer:12.7mm; page-margin-header:12.7mm; page-margin-right:25.4mm; page-margin-left:25.4mm; page-margin-top:25.4mm; page-margin-bottom:25.4mm">
+<p style="Normal" xid="25" props="text-align:center; dom-dir:ltr"><c props="font-weight:bold; font-size:24pt">Um Plano de Ensino "Lorem ipsum" </c></p>
+<p style="Normal" xid="20" props="text-align:left; dom-dir:ltr"></p>
+<p style="Heading 2" xid="21" props="text-align:center; dom-dir:ltr; orphans:0"><c props="color:ffffff; bgcolor:9f1fef">The standard Lorem Ipsum passage, used since the 1500s</c></p>
+<p style="Normal" xid="2" props="text-align:left; dom-dir:ltr"></p>
+<p style="Normal" xid="3" props="text-align:left; dom-dir:ltr">"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."</p>
+<p style="Normal" xid="4" props="text-align:left; dom-dir:ltr"></p>
+<p style="Heading 2" xid="5" props="text-align:center; dom-dir:ltr">Section 1.10.32 of "de Finibus Bonorum et Malorum", written by Cicero in 45 BC</p>
+<p style="Normal" xid="6" props="text-align:left; dom-dir:ltr"></p>
+<p style="Normal" xid="7" props="text-align:left; dom-dir:ltr">"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?"</p>
+<p style="Normal" xid="8" props="text-align:left; dom-dir:ltr"></p>
+<p style="Heading 2" xid="9" props="text-align:center; dom-dir:ltr">1914 translation by H. Rackham</p>
+<p style="Normal" xid="10" props="text-align:left; dom-dir:ltr"></p>
+<p style="Normal" xid="11" props="text-align:left; dom-dir:ltr">"But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?"</p>
+<p style="Normal" xid="12" props="text-align:left; dom-dir:ltr"></p>
+<p style="Heading 2" xid="13" props="text-align:center; dom-dir:ltr">Section 1.10.33 of "de Finibus Bonorum et Malorum", written by Cicero in 45 BC</p>
+<p style="Normal" xid="14" props="text-align:left; dom-dir:ltr"></p>
+<p style="Normal" xid="15" props="text-align:left; dom-dir:ltr">"At vero eos et accusamus et iusto odio dighttp://www.lipsum.com/nissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat."</p>
+<p style="Normal" xid="16" props="text-align:left; dom-dir:ltr"></p>
+<p style="Heading 2" xid="17" props="text-align:center; dom-dir:ltr">1914 translation by H. Rackham</p>
+<p style="Normal" xid="18" props="text-align:left; dom-dir:ltr"></p>
+<p style="Normal" xid="19" props="text-align:left; dom-dir:ltr">"On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains." </p>
+<p style="Normal" xid="22" props="text-align:left; dom-dir:ltr"></p>
+<p style="Normal" xid="23" props="text-align:left; dom-dir:ltr"><c style="Endnote Reference">This text stolen from http://www.lipsum.com without any authorization whatsoever!</c></p>
+</section>
+</abiword>
diff --git a/toolbar.py b/toolbar.py
new file mode 100644
index 0000000..59600a2
--- /dev/null
+++ b/toolbar.py
@@ -0,0 +1,133 @@
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+
+### toolbar.py
+### TODO: Describe
+### $Id: $
+###
+### author: Carlos Neves (cn (at) sueste.net)
+### (c) 2007 World Wide Workshop Foundation
+
+import gtk
+import gettext
+import locale
+import os
+import logging
+
+from i18n import list_available_translations
+
+
+from sugar.graphics.toolbutton import ToolButton
+from sugar.graphics.combobox import ComboBox
+from abiword import Canvas
+
+class LanguageComboBox (ComboBox):
+ def __init__ (self):
+ ComboBox.__init__(self)
+ self.translations = list_available_translations()
+ for i,x in enumerate(self.translations):
+ self.append_item(i+1,gettext.gettext(x.name), x.image)
+ self._icon_renderer.props.stock_size = 3
+ self.connect('changed', self.install)
+
+ def install (self, *args):
+ if self.get_active() > -1:
+ self.translations[self.get_active()].install()
+ else:
+ code, encoding = locale.getdefaultlocale()
+ # Try to find the exact translation
+ for i,t in enumerate(self.translations):
+ if t.matches(code):
+ self.set_active(i)
+ break
+ if self.get_active() < 0:
+ # Failed, try to get the translation based only in the country
+ for i,t in enumerate(self.translations):
+ if t.matches(code, False):
+ self.set_active(i)
+ break
+ if self.get_active() < 0:
+ # nothing found, select first translation
+ self.set_active(0)
+ # Allow for other callbacks
+ return False
+
+try:
+ from sugar.graphics.palette import Palette
+ class LessonPlan (Palette):
+ def __init__ (self):
+ Palette.__init__(self)
+ _ = gettext.gettext
+ #self.set_size_request(600,400)
+ self.set_primary_state(_('Lesson Plan'))
+ self._frame = gtk.Frame()
+ self._frame.show()
+ self.set_content(self._frame)
+
+ button_dismiss = gtk.Button(_('Dismiss'))
+ self.append_button(button_dismiss)
+ self._menu_bar.hide()
+
+ def popup (self):
+ logging.debug("POPUP")
+ canvas = Canvas()
+ canvas.set_size_request(600,400)
+ canvas.show()
+ self._frame.add(canvas)
+ Palette.popup(self)
+ # What file should we load?
+ code, encoding = locale.getdefaultlocale()
+ files = map(lambda x: os.path.join('texts', 'lesson_plan%s.abw' % x), ('_'+code.lower(), '_'+code.split('_')[0].lower(), ''))
+ files = filter(lambda x: os.path.exists(x), files)
+ canvas.load_file('file://%s/%s' % (os.getcwd(), files[0]))
+ canvas.view_online_layout()
+ canvas.zoom_width()
+ canvas.set_show_margin(False)
+
+ def hide (self):
+ logging.debug("HIDE")
+ self._frame.forall(lambda x: self._frame.remove(x))
+ Palette.hide(self)
+except:
+ LessonPlan = None
+
+class SliderToolbar(gtk.Toolbar):
+ def __init__(self):
+ gtk.Toolbar.__init__(self)
+ self.tb_lang_select = LanguageComboBox()
+ tool_item = gtk.ToolItem()
+ tool_item.set_expand(False)
+ tool_item.add(self.tb_lang_select)
+ self.tb_lang_select.show()
+ tool_item.show()
+
+ lesson_plan = ToolButton('format-justify-center')
+ lesson_plan.show()
+
+ if LessonPlan is not None:
+ lesson_plan.set_palette(LessonPlan())
+
+ self.insert(tool_item, -1)
+ self.insert(lesson_plan, -1)
+
+ def set_language_callback (self, cb, call_now=True):
+ self.tb_lang_select.connect('changed', cb)
+ if call_now:
+ self.tb_lang_select.install()
+ cb(self.tb_lang_select)
+
+
+