diff options
author | Lionel LASKE <llaske@c2s.fr> | 2011-12-29 15:14:57 (GMT) |
---|---|---|
committer | Lionel LASKE <llaske@c2s.fr> | 2011-12-29 15:14:57 (GMT) |
commit | 02a6079af2c2335382e21c78203758f8f5a11e36 (patch) | |
tree | 1013418e7011dafe51ad46271ca9a075aee4de17 | |
parent | bc27e3c88d2dc1cf83e3a0552424d45a02b74ef6 (diff) |
Add full Napoleon sample, handle mime type, redo localisation
-rw-r--r-- | MANIFEST | 13 | ||||
-rw-r--r-- | activity.py | 47 | ||||
-rw-r--r-- | activity/activity.info | 1 | ||||
-rw-r--r-- | activity/application-x-roots-activity.svg | 413 | ||||
-rw-r--r-- | activity/mimetypes.xml | 7 | ||||
-rw-r--r-- | images/napo_p1.jpg | bin | 0 -> 10260 bytes | |||
-rw-r--r-- | images/napo_p10.jpg | bin | 0 -> 11477 bytes | |||
-rw-r--r-- | images/napo_p11.jpg | bin | 0 -> 8559 bytes | |||
-rw-r--r-- | images/napo_p2.jpg | bin | 0 -> 13494 bytes | |||
-rw-r--r-- | images/napo_p3.jpg | bin | 0 -> 15895 bytes | |||
-rw-r--r-- | images/napo_p4.jpg | bin | 0 -> 15267 bytes | |||
-rw-r--r-- | images/napo_p5.jpg | bin | 0 -> 12369 bytes | |||
-rw-r--r-- | images/napo_p6.jpg | bin | 0 -> 8138 bytes | |||
-rw-r--r-- | images/napo_p7.jpg | bin | 0 -> 11420 bytes | |||
-rw-r--r-- | images/napo_p8.jpg | bin | 0 -> 12811 bytes | |||
-rw-r--r-- | images/napo_p9.jpg | bin | 0 -> 9347 bytes | |||
-rw-r--r-- | po/POTFILES.in | 1 | ||||
-rw-r--r-- | po/fr.po | 137 | ||||
-rw-r--r-- | src/tree.py | 50 | ||||
-rw-r--r-- | sugardummy.py | 37 |
20 files changed, 645 insertions, 61 deletions
@@ -4,6 +4,8 @@ vboxcolor.py COPYING activity/roots-icon.svg activity/activity.info +activity/application-x-roots-activity.svg +activity/mimetypes.xml src/union.py src/person.py src/tree.py @@ -20,6 +22,17 @@ images/addchild.svg images/addparent.svg images/addunion.svg images/delete.svg +images/napo_p1.jpg +images/napo_p2.jpg +images/napo_p3.jpg +images/napo_p4.jpg +images/napo_p5.jpg +images/napo_p6.jpg +images/napo_p7.jpg +images/napo_p8.jpg +images/napo_p9.jpg +images/napo_p10.jpg +images/napo_p11.jpg locale/fr/activity.linfo locale/fr/LC_MESSAGES/org.olpcfrance.Roots.mo po/fr.po diff --git a/activity.py b/activity.py index 7b8767a..a799da6 100644 --- a/activity.py +++ b/activity.py @@ -1,3 +1,6 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + # Base import import gtk import pango @@ -18,6 +21,7 @@ import src.const as const try: from sugar.activity import activity from sugar.graphics.toolbutton import ToolButton + from sugar.presence import presenceservice from gtk import Toolbar const.inSugar = True except ImportError: @@ -26,8 +30,8 @@ except ImportError: # Init position -const.tree_initx = 200 -const.tree_inity = 200 +const.tree_initx = (875 - const._person_width) / 2 +const.tree_inity = (780 - const._person_height) / 2 const.bg_color = (0.7, 0.7, 0.7) @@ -40,6 +44,10 @@ _consolehandler.setFormatter(logging.Formatter("%(asctime)s - %(name)s - %(level _logger.addHandler(_consolehandler) +# Init presence +presenceService = presenceservice.get_instance() +buddyName = presenceService.get_owner().props.nick + # Activity class class RootsActivity(activity.Activity): @@ -74,7 +82,7 @@ class RootsActivity(activity.Activity): tool.connect('clicked', self.sample1) toolbarsample.insert(tool, -1) tool = ToolButton('sample2') - tool.set_tooltip(_('Napoleon')) + tool.set_tooltip(_('Napoléon')) tool.connect('clicked', self.sample2) toolbarsample.insert(tool, -1) toolbox.add_toolbar(_('Samples'), toolbarsample) @@ -84,7 +92,7 @@ class RootsActivity(activity.Activity): # Create drawing area self.zoomlevel = 0 self.area = gtk.DrawingArea() - self.area.set_size_request(750, 600) + self.area.set_size_request(875, 780) self.area.set_events(gtk.gdk.BUTTON_PRESS_MASK|gtk.gdk.BUTTON_RELEASE_MASK|gtk.gdk.BUTTON_MOTION_MASK|gtk.gdk.POINTER_MOTION_MASK) self.area.connect("expose_event", self.area_expose_cb) self.area.connect("button_press_event", self.press_button) @@ -94,9 +102,9 @@ class RootsActivity(activity.Activity): # Create detail view self.fixed = VBoxColor(const.bg_color) - self.fixed.set_size_request(200, 300) + self.fixed.set_size_request(325, 780) self.imagezone = gtk.DrawingArea() - self.imagezone.set_size_request(200, 240) # WARNING: Should preserve the 1/3 ratio + self.imagezone.set_size_request(325, 240) self.imagezone.set_events(gtk.gdk.BUTTON_PRESS_MASK|gtk.gdk.BUTTON_RELEASE_MASK) self.imagezone.connect("expose_event", self.image_expose) self.imagezone.connect("button_press_event", self.image_release_button) @@ -118,13 +126,13 @@ class RootsActivity(activity.Activity): scrolled.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) scrolled.set_border_width(2) self.detail_description = gtk.TextView() - self.detail_description.set_wrap_mode(True) + self.detail_description.set_wrap_mode(gtk.WRAP_WORD) self.detail_description.set_size_request(200, 100) self.detail_description.set_cursor_visible(True) self.detail_description.get_buffer().connect("changed", self.description_changed) scrolled.add(self.detail_description) self.fixed.pack_start(scrolled, False, False, 5) - self.detail_btnaddparent = self.create_button(_("Add parent"), "images/addparent.svg", self.addparent_clicked) + self.detail_btnaddparent = self.create_button(_("Add parents"), "images/addparent.svg", self.addparent_clicked) self.detail_btnaddbrother = self.create_button(_("Add brother/sister"), "images/addbrother.svg", self.addbrother_clicked) self.detail_btnaddunion = self.create_button(_("Add union"), "images/addunion.svg", self.addunion_clicked) self.detail_btnaddchild = self.create_button(_("Add child"), "images/addchild.svg", self.addchild_clicked) @@ -142,7 +150,7 @@ class RootsActivity(activity.Activity): # Create empty tree self.tree = None self.selected = None - self.init_tree(empty_tree()) + self.init_tree(empty_tree(buddyName)) # Show all self.show_all() @@ -195,6 +203,7 @@ class RootsActivity(activity.Activity): self.detail_name.set_sensitive(False) self.detail_description.set_sensitive(False) self.detail_name.set_text("") + self.detail_description.get_buffer().set_text("") self.detail_chkmale.set_active(True) self.detail_chkmale.set_sensitive(False) self.detail_chkfemale.set_sensitive(False) @@ -453,12 +462,12 @@ class RootsActivity(activity.Activity): text = _("Click a person to edit it") else: text = _("Click here to paste an image") - metrics = pc.get_metrics(self.imagezone.get_style().font_desc) - w = pango.PIXELS(metrics.get_approximate_char_width() * len(text)) layout = pango.Layout(pc) layout.set_text(text) + layout.set_width(rect.width*pango.SCALE) + layout.set_alignment(pango.ALIGN_CENTER) gc.set_source_rgb(0, 0, 0) - gc.move_to((rect.width - w)/2, y + image.get_height()) + gc.move_to(0, y + image.get_height()) gc.show_layout(layout) @@ -487,15 +496,23 @@ class RootsActivity(activity.Activity): # Match image to rectangle rect = self.imagezone.allocation - if image.get_width() > rect.width or image.get_height() > rect.height: - image = image.scale_simple(rect.width, rect.height, gtk.gdk.INTERP_HYPER) + image_width = image.get_width() + image_height = image.get_height() + if image_width > rect.width or image_height > rect.height: + if image_width > image_height: + target_width = rect.width + target_height = (image_height * target_width) / image_width + else: + target_height = rect.height + target_width = (image_width * target_height) / image_height + image = image.scale_simple(target_width, target_height, gtk.gdk.INTERP_HYPER) self.selected.image = image self.redraw() def emptytree(self, event): "Init with an empty tree" - self.init_tree(empty_tree()) + self.init_tree(empty_tree(buddyName)) def sample1(self, event): diff --git a/activity/activity.info b/activity/activity.info index 12d3c5b..cecef06 100644 --- a/activity/activity.info +++ b/activity/activity.info @@ -4,4 +4,5 @@ activity_version = 1 bundle_id = org.olpcfrance.Roots exec = sugar-activity activity.RootsActivity icon = roots-icon +mime_types = application/x-roots-activity; license = GPLv2+ diff --git a/activity/application-x-roots-activity.svg b/activity/application-x-roots-activity.svg new file mode 100644 index 0000000..9b5f136 --- /dev/null +++ b/activity/application-x-roots-activity.svg @@ -0,0 +1,413 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [ + <!ENTITY stroke_color "#666666"> + <!ENTITY fill_color "#FFFFFF"> +]> +<!-- 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" + width="68.75" + height="68.75" + id="svg2" + version="1.1" + inkscape:version="0.48.1 " + sodipodi:docname="roots-icon.svg"> + <defs + id="defs4"> + <clipPath + id="clipPath62" + clipPathUnits="userSpaceOnUse"> + <path + id="path64" + d="M 14.31427,13.05071 21.25893,9.041206 40.36538,42.13454 33.42072,46.14405 14.31427,13.05071 z" + inkscape:connector-curvature="0" /> + </clipPath> + <clipPath + id="clipPath52" + clipPathUnits="userSpaceOnUse"> + <path + id="path54" + d="M 14.31427,13.05071 21.25893,9.041206 40.36538,42.13454 33.42072,46.14405 14.31427,13.05071 z" + inkscape:connector-curvature="0" /> + </clipPath> + <clipPath + id="clipPath40" + clipPathUnits="userSpaceOnUse"> + <path + id="path42" + d="M 14.31427,13.0507 21.25893,9.041206 40.36538,42.13454 33.42072,46.14404 14.31427,13.0507 z" + inkscape:connector-curvature="0" /> + </clipPath> + <clipPath + id="clipPath30" + clipPathUnits="userSpaceOnUse"> + <path + id="path32" + d="M 14.31427,13.05071 21.25893,9.041206 40.36538,42.13454 33.42072,46.14405 14.31427,13.05071 z" + inkscape:connector-curvature="0" /> + </clipPath> + <clipPath + id="clipPath18" + clipPathUnits="userSpaceOnUse"> + <path + id="path20" + d="M 0,0 55,0 55,55 0,55 0,0 z" + inkscape:connector-curvature="0" /> + </clipPath> + </defs> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="&stroke_color;" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="7.919596" + inkscape:cx="32.157579" + inkscape:cy="28.978292" + inkscape:document-units="px" + inkscape:current-layer="layer1" + showgrid="false" + inkscape:window-width="1280" + inkscape:window-height="738" + inkscape:window-x="-8" + inkscape:window-y="-8" + inkscape:window-maximized="1" + fit-margin-top="0" + fit-margin-left="0" + fit-margin-right="0" + fit-margin-bottom="0" /> + <metadata + id="metadata7"> + <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 /> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Calque 1" + inkscape:groupmode="layer" + id="layer1" + transform="translate(-276.47321,-453.92468)"> + <g + id="g12" + transform="matrix(1.25,0,0,-1.25,305.625,526.58093)" /> + <g + id="g14" + transform="matrix(1.25,0,0,-1.25,276.41071,522.58093)"> + <g + id="g16" + clip-path="url(#clipPath18)"> + <g + id="g22" + transform="matrix(1,0,0,-1,5,49.875)"> + <path + inkscape:connector-curvature="0" + d="M 45,22.5 C 45,34.84314 34.8431,45 22.5,45 10.1569,45 0,34.84314 0,22.5 0,10.15686 10.1569,0 22.5,0 34.8431,0 45,10.15686 45,22.5 z" + style="fill:none;stroke:&stroke_color;;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none" + id="path24" /> + </g> + </g> + </g> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 310.47321,490.81753 -4.28571,5.35715 -2.85714,3.21428 -3.92857,3.92857" + id="path3074" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 302.00508,490.16956 -3.57143,7.5 -5,0.35715" + id="path3076" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 310.42857,491.21932 5,6.42858 -1.07143,6.42857 -3.57143,3.21428" + id="path3078" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 315.42857,497.6479 6.78571,3.57142" + id="path3080" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 305.42857,497.29075 0.71428,7.14286 -2.5,1.78571" + id="path3082" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 306.5,504.79075 z" + id="path3084" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 306.14285,504.79075 1.07143,2.5" + id="path3086" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:1.10000002;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + d="m 314.48341,504.1594 2.5,3.57143" + id="path3088" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 318.89539,499.41194 1.07143,5.71429" + id="path3090" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:1.20000005;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + d="m 321.5,492.29075 0.35714,4.28571" + id="path3092" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:1.20000005;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + d="m 310.45024,490.92345 1.07143,6.78571" + id="path3094" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 305.3023,488.46678 -1.07143,5" + id="path3096" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 297.92857,496.93361 z" + id="path3098" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 329.35714,493.71932 z" + id="path3100" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 298.43365,497.31242 -1.07143,4.28571" + id="path3102" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:1.20000005;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + d="m 316.85714,488.36218 -1.07143,5" + id="path3104" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:1.20000005;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + d="m 328.28571,494.43361 5,1.07143" + id="path3106" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 310.70757,484.19199 6.31345,4.67195 4.67196,3.6618 6.81853,1.89404 0.75761,4.04061" + id="path3892" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:3.94342852;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + d="m 310.96011,485.32206 0,-3.43179" + id="path3894" + inkscape:connector-curvature="0" + inkscape:transform-center-y="1.1607143" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + d="m 309.57115,484.19199 -8.08123,5.55583" + id="path3906" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 312.6016,484.9496 5.55584,4.79822" + id="path3908" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 301.48992,489.49529 -6.31345,-1.51523" + id="path3912" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:0.60000002;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + d="m 317.9049,489.49529 5.55584,-0.25254" + id="path3914" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + d="m 321.44044,500.8595 2.52538,3.283" + id="path3916" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:0.30000001;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + d="m 322.19805,500.8595 4.04061,1.26269" + id="path3918" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:0.2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + d="m 322.45059,489.24275 1.76777,2.52538" + id="path3920" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + d="m 290.98793,492.52574 -4.04062,0" + id="path3922" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:0.2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + d="m 311.33041,497.0995 1.76777,2.52538" + id="path3920-8" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:0.2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + d="m 300.25898,502.09949 1.76777,2.52538" + id="path3920-6" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:0.2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + d="m 300.0804,494.24235 1.76777,2.52538" + id="path3920-9" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:0.09295908;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + d="m 312.07677,498.1174 -0.61784,1.56099" + id="path3920-4" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:0.34130254;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + d="m 299.27404,490.563 -3.76236,3.45551" + id="path3920-85" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:0.2021358;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + d="m 311.30791,497.4577 -2.29438,1.98753" + id="path3920-68" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:0.13046195;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + d="m 301.2098,495.85937 -1.11605,1.70206" + id="path3920-81" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:0.264;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + d="m 315.61285,505.65277 -1.61855,1.84741" + id="path3920-7" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:0.30000001;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + d="m 304.71429,490.86218 2.5,1.42857" + id="path3991" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:0.2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + d="m 323.82143,501.21932 0.35714,1.60715" + id="path3993" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:0.1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + d="m 296.72322,492.82647 0.3125,1.65178" + id="path3995" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:0.2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + d="m 288.375,492.69254 -0.40178,1.47321" + id="path3997" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:0.40000001;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + d="m 311.5,497.11218 -1.42857,5.40179" + id="path3999" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:0.2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + d="m 310.5625,500.50504 1.20536,1.875" + id="path4001" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:0.30000001;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + d="m 305.33929,500.7729 -2.09822,1.91964" + id="path4003" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + d="m 316.1875,491.17468 2.14286,2.5" + id="path4005" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:0.2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + d="m 317.66072,492.91575 -0.3125,1.07143" + id="path4007" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:0.1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + d="m 296.23214,493.49611 -0.17857,2.00893" + id="path4009" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:0.30000001;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + d="m 321.90179,494.88004 2.8125,1.42857" + id="path4013" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:0.2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + d="m 323.73215,495.77289 0,1.29465" + id="path4015" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:0.1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + d="m 323.28572,490.37111 2.36607,0.13393" + id="path4017" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:0.1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + d="m 324.58036,490.41575 0.53571,0.625" + id="path4019" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:0.2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + d="m 317.4375,492.29075 1.60714,0.3125" + id="path4021" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:0.30000001;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + d="m 330.96429,495.1479 0.49107,2.63392" + id="path4023" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:0.1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + d="m 331.23214,496.26397 1.38393,0.58035" + id="path4025" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:0.1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + d="m 325.02679,501.57647 0.44643,1.65178" + id="path4027" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:0.1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + d="m 325.25,502.42468 0.58036,0.13393" + id="path4029" + inkscape:connector-curvature="0" /> + <rect + style="fill:&fill_color;;stroke:&stroke_color;;stroke-width:0.89999998;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + id="rect4031" + width="15.714286" + height="8.9285717" + x="302.57144" + y="472.84818" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 310.31332,485.17277 -7.70241,4.67195 -10.73287,1.89404 -2.14658,3.15673" + id="path3083" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:&stroke_color;;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 34.092648,30.995549 -0.126269,7.071068" + id="path3085" + inkscape:connector-curvature="0" + transform="translate(276.47321,453.92468)" /> + </g> +</svg> diff --git a/activity/mimetypes.xml b/activity/mimetypes.xml new file mode 100644 index 0000000..1543110 --- /dev/null +++ b/activity/mimetypes.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info"> + <mime-type type="application/x-roots-activity"> + <comment xml:lang="en">Roots Activity</comment> + <glob pattern="*.roots"/> + </mime-type> +</mime-info>
\ No newline at end of file diff --git a/images/napo_p1.jpg b/images/napo_p1.jpg Binary files differnew file mode 100644 index 0000000..42b2e1b --- /dev/null +++ b/images/napo_p1.jpg diff --git a/images/napo_p10.jpg b/images/napo_p10.jpg Binary files differnew file mode 100644 index 0000000..691c5c2 --- /dev/null +++ b/images/napo_p10.jpg diff --git a/images/napo_p11.jpg b/images/napo_p11.jpg Binary files differnew file mode 100644 index 0000000..5cf6fa9 --- /dev/null +++ b/images/napo_p11.jpg diff --git a/images/napo_p2.jpg b/images/napo_p2.jpg Binary files differnew file mode 100644 index 0000000..10df401 --- /dev/null +++ b/images/napo_p2.jpg diff --git a/images/napo_p3.jpg b/images/napo_p3.jpg Binary files differnew file mode 100644 index 0000000..3d0df6d --- /dev/null +++ b/images/napo_p3.jpg diff --git a/images/napo_p4.jpg b/images/napo_p4.jpg Binary files differnew file mode 100644 index 0000000..6da365e --- /dev/null +++ b/images/napo_p4.jpg diff --git a/images/napo_p5.jpg b/images/napo_p5.jpg Binary files differnew file mode 100644 index 0000000..b0f6bad --- /dev/null +++ b/images/napo_p5.jpg diff --git a/images/napo_p6.jpg b/images/napo_p6.jpg Binary files differnew file mode 100644 index 0000000..1b31a35 --- /dev/null +++ b/images/napo_p6.jpg diff --git a/images/napo_p7.jpg b/images/napo_p7.jpg Binary files differnew file mode 100644 index 0000000..2b7747a --- /dev/null +++ b/images/napo_p7.jpg diff --git a/images/napo_p8.jpg b/images/napo_p8.jpg Binary files differnew file mode 100644 index 0000000..d929862 --- /dev/null +++ b/images/napo_p8.jpg diff --git a/images/napo_p9.jpg b/images/napo_p9.jpg Binary files differnew file mode 100644 index 0000000..96dbaac --- /dev/null +++ b/images/napo_p9.jpg diff --git a/po/POTFILES.in b/po/POTFILES.in index cf2abd2..2b3689f 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,2 +1,3 @@ encoding: UTF-8 activity.py +src/tree.py @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-12-21 22:55+0200\n" -"PO-Revision-Date: 2011-12-21 23:05+0200\n" +"POT-Creation-Date: 2011-12-28 22:55+0200\n" +"PO-Revision-Date: 2011-12-28 23:05+0200\n" "Last-Translator: user <lionel@olpc-france.org>\n" "Language-Team: French\n" "MIME-Version: 1.0\n" @@ -16,74 +16,143 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" -#: activity/activity.info:2 -msgid "Roots" -msgstr "Racines" - -#: activity.py:43 +#: activity.py:65 msgid "Zoom out" -msgstr "Zoom avant" +msgstr "Zoom arrière" -#: activity.py:44 +#: activity.py:66 msgid "<ctrl>minus" msgstr "<ctrl>moins" -#: activity.py:48 +#: activity.py:70 msgid "Zoom in" -msgstr "Zoom arrière" +msgstr "Zoom avant" -#: activity.py:49 +#: activity.py:71 msgid "<ctrl>equal" msgstr "<ctrl>égal" -#: activity.py:52 +#: activity.py:74 msgid "View" -msgstr "Vue" +msgstr "Affichage" -#: activity.py:55 +#: activity.py:77 msgid "Empty tree" msgstr "Arbre vide" -#: activity.py:59 +#: activity.py:81 msgid "Test" msgstr "Test" -#: activity.py:63 -msgid "Napoleon" +#: activity.py:85 +msgid "Napoléon" msgstr "Napoléon" -#: activity.py:66 +#: activity.py:88 msgid "Samples" msgstr "Exemples" -#: activity.py:84 -msgid "Name:" -msgstr "Nom:" - -#: activity.py:89 +#: activity.py:118 msgid "Male" msgstr "Mâle" -#: activity.py:92 +#: activity.py:121 msgid "Female" msgstr "Femelle" -#: activity.py:95 -msgid "Add parent" -msgstr "Ajouter parent" +#: activity.py:135 +msgid "Add parents" +msgstr "Ajouter parents" -#: activity.py:97 +#: activity.py:136 +msgid "Add brother/sister" +msgstr "Ajouter frère/soeur" + +#: activity.py:137 msgid "Add union" msgstr "Ajouter union" -#: activity.py:99 +#: activity.py:138 msgid "Add child" msgstr "Ajouter enfant" -#: activity.py:101 +#: activity.py:139 msgid "Delete" msgstr "Supprimer" -#: activity.py:147 -msgid "Click one a node to select it" -msgstr "Cliquer sur un noeud pour le sélectionner" +#: activity.py:462 +msgid "Click a person to edit it" +msgstr "Cliquer sur une personne pour la modifier" + +#: activity.py:464 +msgid "Click here to paste an image" +msgstr "Cliquer ici pour coller une image" + +#: src/tree.py:407 +msgid "" +"(1746-1785) This young Corsican aristocrat studied law in Italy and Corsica." +msgstr "(1746-1785) Jeune noble corse, il étudie le droit en Italie et en Corse." + +#: src/tree.py:410 +msgid "" +"(1750-1836) She married very young, at 14 years old. In Corsica, she was " +"known as the 'little marvel', famed for her beauty far and wide." +msgstr "(1750-1836) Mariée très jeune, à 14 ans, on l'appelle 'la petite mervielle' car sa beauté est reconnue de tous." + +#: src/tree.py:414 +msgid "" +"(1769-1821) He was born on 15 August 1769 in Ajaccio, Corsica. At the age of " +"10, he left Corsica with his older brother Joseph to study at the Ecole " +"Militaire in Paris." +msgstr "(1769-1821) Né le 15 août 1769 à Ajaccio en Corse, il quitte la Corse à 10 ans avec son frère Joseph pour faire des études à l'Ecole Militaire à Paris." + +#: src/tree.py:417 +msgid "" +"(1778-1846) While still a child, Louis joined his brother Napoleon in Paris. " +"He accompanied his brother on his early military campaigns and became King " +"of Holland at the age of 28." +msgstr "(1778-1846) Enfant, Louis rejoint son frère Napoléon à Paris. Il l'accompagne dans ses campagnes et devient roi de Hollande à 28 ans." + +#: src/tree.py:422 +msgid "" +"(1763-1814) She was born in Martinique and arrived in Paris at the age of " +"16. Her first hushband Alexandre de Beauharnais was guillotined during the " +"French Revolution." +msgstr "(1763-1814) Née à la Martinique elle arrive à Paris à 16 ans et épouse son premier mari Alexandre de Beauharnais guillotiné pendant la Révolution." + +#: src/tree.py:426 +msgid "" +"(1791-1847) She was daughter of the king of Austria and became Napoleon's " +"second wife." +msgstr "(1791-1847) Fille du roi d'Autriche, c'est la deuxième épouse de Napoléon." + +#: src/tree.py:431 +msgid "" +"(1811-1832) When the French Empire fell once and for all, he followed his " +"mother to Austria and died at a very young age, only 21 years old." +msgstr "(1811-1832) Il est censé reigner à la suite de son père mais à la chute de l'Empire, il suit sa mère en Autriche où il meurt très jeune à 21 ans" + +#: src/tree.py:436 +msgid "" +"(1783-1837) She had a gift for music and wrote and composed romantic songs. " +"She married Louis and became Queen of Holland." +msgstr "(1783-1837) Douée pour la musique elle écrit et compose des chansons. En épousant Louis, elle devient reine de Hollande." + +#: src/tree.py:440 +msgid "" +"(1808-1873) He had to spend a large part of his childhood in Switzerland " +"with his mother. He became officer then president in 1848." +msgstr "(1808-1873) Exilé en Suisse avec sa mère, il devient officier puis est élu président en France en 1848." + +#: src/tree.py:445 +msgid "" +"(1826-1920) Daughter of a Spanish count, she became Empress through her " +"marriage in 1853." +msgstr "(1826-1920) Fille d'un comte espagnol, elle devient impératrice par son mariage en 1853." + +#: src/tree.py:449 +msgid "" +"(1856-1879) When the French army was beaten by the Prussian army, he had to " +"leave France. He chose to become a soldier for the English and was killed in " +"South Africa." +msgstr "(1856-1879) Une fois son père battu par l'armée prussienne, il quitte la France pour devenir soldat anglais et est tué en Afrique du Sud." diff --git a/src/tree.py b/src/tree.py index e8183a3..189b712 100644 --- a/src/tree.py +++ b/src/tree.py @@ -1,8 +1,12 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + # Base import import pickle import tempfile import os import gtk +from gettext import gettext as _ # Local import from person import Person @@ -333,9 +337,9 @@ class Tree: # Create the samples family -def empty_tree(): +def empty_tree(xoOwner): tree = Tree() - tree.root = tree.Person("", "M") + tree.root = tree.Person(xoOwner, "M") tree.root.isroot = True return tree @@ -367,19 +371,19 @@ def sample_family1(): ub = tree.Union(jo, j) ub.append_child(tree.Person("Charlie", "F")) - rs = tree.Person("Renee", "F") + rs = tree.Person("Renée", "F") vm = tree.Person("Vivien", "M") urv = tree.Union(vm, rs) urv.append_child(j) - jr = tree.Person("Jean-Rene", "M") + jr = tree.Person("Jean-René", "M") ua = tree.Union(jr, tree.Person("Micheline", "F")) ua.append_child(a) - i = tree.Person("Irene", "F") + i = tree.Person("Irène", "F") ua.append_child(i) ui = tree.Union(tree.Person("Nathan", "M"), i) ui.append_child(tree.Person("Marie", "F")) - ui.append_child(tree.Person("Noel", "M")) + ui.append_child(tree.Person("Noël", "M")) ui.append_child(tree.Person("Thierry", "M")) uc = tree.Union(c, tree.Person("Clarah", "F")) @@ -399,29 +403,51 @@ def sample_family1(): def sample_family2(): # Napoleon family tree = Tree() - tree.root = p1 = tree.Person("Chales-Marie Bonaparte", "M") + tree.root = p1 = tree.Person("Charles-Marie Bonaparte", "M") + p1.description = _("(1746-1785) This young Corsican aristocrat studied law in Italy and Corsica.") + p1.image = gtk.gdk.pixbuf_new_from_file("images/napo_p1.jpg") p2 = tree.Person("Letizia Ramolino", "F") + p2.description = _("(1750-1836) She married very young, at 14 years old. In Corsica, she was known as the 'little marvel', famed for her beauty far and wide.") + p2.image = gtk.gdk.pixbuf_new_from_file("images/napo_p2.jpg") u1 = tree.Union(p2, p1) - p4 = tree.Person("Napoleon", "M") + p4 = tree.Person("Napoléon Ier", "M") + p4.description = _("(1769-1821) He was born on 15 August 1769 in Ajaccio, Corsica. At the age of 10, he left Corsica with his older brother Joseph to study at the Ecole Militaire in Paris.") + p4.image = gtk.gdk.pixbuf_new_from_file("images/napo_p4.jpg") p6 = tree.Person("Louis Bonaparte", "M") + p6.description = _("(1778-1846) While still a child, Louis joined his brother Napoleon in Paris. He accompanied his brother on his early military campaigns and became King of Holland at the age of 28.") + p6.image = gtk.gdk.pixbuf_new_from_file("images/napo_p6.jpg") u1.append_child(p4) u1.append_child(p6) - p3 = tree.Person("Josephine", "F") + p3 = tree.Person("Joséphine", "F") + p3.description = _("(1763-1814) She was born in Martinique and arrived in Paris at the age of 16. Her first hushband Alexandre de Beauharnais was guillotined during the French Revolution.") + p3.image = gtk.gdk.pixbuf_new_from_file("images/napo_p3.jpg") u2 = tree.Union(p4, p3) p5 = tree.Person("Marie-Louise d'Autriche", "F") + p5.description = _("(1791-1847) She was daughter of the king of Austria and became Napoleon's second wife.") + p5.image = gtk.gdk.pixbuf_new_from_file("images/napo_p5.jpg") u3 = tree.Union(p4, p5) - p10 = tree.Person("Napoleon II", "M") + p10 = tree.Person("Napoléon II", "M") + p10.description = _("(1811-1832) When the French Empire fell once and for all, he followed his mother to Austria and died at a very young age, only 21 years old.") + p10.image = gtk.gdk.pixbuf_new_from_file("images/napo_p10.jpg") u3.append_child(p10) p7 = tree.Person("Hortense de Beauharnais", "F") + p7.description = _("(1783-1837) She had a gift for music and wrote and composed romantic songs. She married Louis and became Queen of Holland.") + p7.image = gtk.gdk.pixbuf_new_from_file("images/napo_p7.jpg") u4 = tree.Union(p6, p7) - p8 = tree.Person("Napoleon III", "M") + p8 = tree.Person("Napoléon III", "M") + p8.description = _("(1808-1873) He had to spend a large part of his childhood in Switzerland with his mother. He became officer then president in 1848.") + p8.image = gtk.gdk.pixbuf_new_from_file("images/napo_p8.jpg") u4.append_child(p8) p9 = tree.Person("Eugenie de Palafox-Guzman", "F") + p9.description = _("(1826-1920) Daughter of a Spanish count, she became Empress through her marriage in 1853.") + p9.image = gtk.gdk.pixbuf_new_from_file("images/napo_p9.jpg") u5 = tree.Union(p8, p9) - p11 = tree.Person("Louis Napoleon", "M") + p11 = tree.Person("Louis Napoléon", "M") + p11.description = _("(1856-1879) When the French army was beaten by the Prussian army, he had to leave France. He chose to become a soldier for the English and was killed in South Africa.") + p11.image = gtk.gdk.pixbuf_new_from_file("images/napo_p11.jpg") u5.append_child(p11) tree.root.isroot = True diff --git a/sugardummy.py b/sugardummy.py index 5ebea5e..58f8151 100644 --- a/sugardummy.py +++ b/sugardummy.py @@ -12,6 +12,7 @@ class activity: def __init__(self, handle): self.window = gtk.Window() + self.window.set_size_request(1200, 900) self.window.set_title("Roots") self.window.connect("destroy", self.on_close) self.metadata = {} @@ -33,6 +34,7 @@ class activity: def set_toolbox(self, toolbox): self._toolbox = toolbox + self._toolbox.set_size_request(1200, 120) def read_file(self, file_path): pass @@ -92,4 +94,39 @@ class ToolButton: def connect(self, event, callback): self.methods[event] = callback + +# Dummy class for presence +class PresenceService: + "Class used to generate unique identifier" + + class __impl: + "Singleton class" + def __init__(self): + self.props = Props() + + def get_instance(self): + return self + + def get_owner(self): + return self + + __instance=None + + def __init__(self): + "Constructor, create Singleton if don't exist" + if PresenceService.__instance is None: + PresenceService.__instance = PresenceService.__impl() + + self.__dict__['_PresenceService__instance'] = PresenceService.__instance + + def __getattr__(self, attr): + "Pass attr retrieving to Singleton" + return getattr(self.__instance, attr) + +# Dummy class for presence props +class Props: + + def __init__(self): + self.nick = "XO name" +presenceservice = PresenceService() |