Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLionel LASKE <llaske@c2s.fr>2011-11-14 21:14:44 (GMT)
committer Lionel LASKE <llaske@c2s.fr>2011-11-14 21:14:44 (GMT)
commit129a7b6ba90bb201cf1a7ac97f100da81ec86d7f (patch)
treeae7ee6529b6b49d04c060909ac1627aef44977ef
First version
-rw-r--r--COPYING340
-rw-r--r--MANIFEST14
-rw-r--r--activity.py168
-rw-r--r--activity/activity.info7
-rw-r--r--activity/roots-icon.svg413
-rw-r--r--setup.py21
-rw-r--r--src/__init__.py0
-rw-r--r--src/const.py12
-rw-r--r--src/guid.py27
-rw-r--r--src/partialdate.py9
-rw-r--r--src/person.py156
-rw-r--r--src/union.py105
-rw-r--r--sugardummy.py36
13 files changed, 1308 insertions, 0 deletions
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..623b625
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,340 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ 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 Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/MANIFEST b/MANIFEST
new file mode 100644
index 0000000..f8afdfa
--- /dev/null
+++ b/MANIFEST
@@ -0,0 +1,14 @@
+sugardummy.py
+setup.py
+activity.py
+MANIFEST
+COPYING
+src/union.py
+src/person.py
+src/partialdate.py
+src/guid.py
+src/const.py
+src/__init__.py
+po/HelloWorld.pot
+activity/roots-icon.svg
+activity/activity.info
diff --git a/activity.py b/activity.py
new file mode 100644
index 0000000..be240e1
--- /dev/null
+++ b/activity.py
@@ -0,0 +1,168 @@
+# Base import
+import gtk
+import logging
+from gettext import gettext as _
+
+# Local import
+from src.person import Person
+from src.person import persons
+from src.union import Union
+import src.const as const
+
+
+# Sugar import
+try:
+ from sugar.activity import activity
+ const.inSugar = True
+except ImportError:
+ from sugardummy import *
+ const.inSugar = False
+
+
+
+
+
+class RootsActivity(activity.Activity):
+
+ def __init__(self, handle):
+ "Set up the activity."
+
+ # Sugar init
+ activity.Activity.__init__(self, handle)
+
+ # Create toolbox
+ toolbox = activity.ActivityToolbox(self)
+ self.set_toolbox(toolbox)
+ toolbox.show()
+
+ # Create sample data
+ self.tree = self.init_family()
+ self.tree.compute_draw(500, 50)
+
+ # Create drawing area
+ self.area = gtk.DrawingArea()
+ self.area.set_size_request(600, 300)
+ 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)
+ self.area.connect("button_release_event", self.release_button)
+ self.area.connect("motion_notify_event", self.mouse_move)
+ self.moving = False
+
+ # Draw
+ self.box = gtk.VBox(False)
+ self.box.pack_start(self.area, True, True, 0)
+ self.set_canvas(self.box)
+ self.show_all()
+ self.area.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.ARROW))
+
+
+ def init_family(self):
+ "Init a sample tree"
+ l = Person("Lucien", "M")
+ a = Person("Annick", "F")
+ u = Union(l, a)
+
+ d = Person("Dominique", "M")
+ u.append_child(d)
+ au = Person("Anne", "F")
+ u.append_child(au)
+ m = Person("Madeleine", "F")
+ u.append_child(m)
+
+ jp = Person("Jean-Pierre", "M")
+ j = Person("Julie", "F")
+ up = Union(jp, j)
+ up.append_child(l)
+ c = Person("Christian", "M")
+ up.append_child(c)
+
+ ub = Union(Person("Jonathan", "M"), j)
+ ub.append_child(Person("Charlie", "F"))
+
+ rs = Person("Renee", "F")
+ vm = Person("Vivien", "M")
+ urv = Union(vm, rs)
+ urv.append_child(j)
+
+ jr = Person("Jean-Rene", "M")
+ ua = Union(jr, Person("Micheline", "F"))
+ ua.append_child(a)
+ i = Person("Irene", "F")
+ ua.append_child(i)
+ ui = Union(Person("Nathan", "M"), i)
+ ui.append_child(Person("Marie", "F"))
+ ui.append_child(Person("Noel", "M"))
+ ui.append_child(Person("Thierry", "M"))
+
+ uc = Union(c, Person("Clarah", "F"))
+ uc.append_child(Person("Sandrine", "F"))
+ uc2 = Union(c, Person("Vivianne", "F"))
+ uc2.append_child(Person("Pierre", "M"))
+ uc2.append_child(Person("Camille", "F"))
+
+ return vm
+
+
+ def area_expose_cb(self, area, event):
+ "Draw tree event"
+ gc = self.area.window.cairo_create()
+ pc = self.create_pango_context()
+ self.tree.draw(gc, pc)
+ gc.stroke()
+
+
+ def press_button(self, widget, event):
+ "Mouse button clicked, detail a person or start the moving mode"
+
+ # Look if click in a person
+ for p in persons:
+ # Found one, show detail
+ if p.point_inside(event.x, event.y):
+ print p.name
+ self.moving = False
+ return
+
+ # Not found, pass in moving mode
+ self.movingStart = (event.x, event.y)
+ self.moving = True
+ self.area.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.FLEUR))
+
+
+ def mouse_move(self, widget, event):
+ "Mouse move event, in moving mode translate draw if in moving mode else change cursor on person"
+
+ # In moving mode ?
+ if self.moving:
+ # Compute translation
+ (dx, dy) = (event.x-self.movingStart[0], event.y-self.movingStart[1])
+ for p in persons:
+ p.translate(dx, dy)
+ self.movingStart = (event.x, event.y)
+
+ # Redraw
+ self.area.queue_draw_area(0, 0, self.area.allocation.width, self.area.allocation.height)
+
+ else:
+ # Look if a person is under the cursor
+ for p in persons:
+ # Found one, change cursor
+ if p.point_inside(event.x, event.y):
+ self.area.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.HAND1))
+ return
+
+ # Not found, set standard cursor
+ self.area.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.ARROW))
+
+
+ def release_button(self, widget, event):
+ "Mouse button released, stop moving mode"
+
+ self.area.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.ARROW))
+ self.moving = False
+
+
+# Dummy call to allow running on Windows
+if not const.inSugar:
+ RootsActivity(0)
+ gtk.main() \ No newline at end of file
diff --git a/activity/activity.info b/activity/activity.info
new file mode 100644
index 0000000..12d3c5b
--- /dev/null
+++ b/activity/activity.info
@@ -0,0 +1,7 @@
+[Activity]
+name = Roots
+activity_version = 1
+bundle_id = org.olpcfrance.Roots
+exec = sugar-activity activity.RootsActivity
+icon = roots-icon
+license = GPLv2+
diff --git a/activity/roots-icon.svg b/activity/roots-icon.svg
new file mode 100644
index 0000000..9b5f136
--- /dev/null
+++ b/activity/roots-icon.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/setup.py b/setup.py
new file mode 100644
index 0000000..c24196e
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,21 @@
+#!/usr/bin/env python
+
+# Copyright (C) 2009, Simon Schampijer
+#
+# 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
+
+from sugar.activity import bundlebuilder
+
+bundlebuilder.start()
diff --git a/src/__init__.py b/src/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/__init__.py
diff --git a/src/const.py b/src/const.py
new file mode 100644
index 0000000..ce68a6d
--- /dev/null
+++ b/src/const.py
@@ -0,0 +1,12 @@
+class _const:
+ "Class to represent global constants"
+ class ConstError(TypeError): pass
+
+ def __setattr__(self, name, value):
+ if self.__dict__.has_key(name):
+ raise self.ConstError, "Can't rebind const(%s)"%name
+ self.__dict__[name]=value
+
+import sys
+sys.modules[__name__]=_const()
+
diff --git a/src/guid.py b/src/guid.py
new file mode 100644
index 0000000..d163137
--- /dev/null
+++ b/src/guid.py
@@ -0,0 +1,27 @@
+# Guid class
+class Guid:
+ "Class used to generate unique identifier"
+
+ class __impl:
+ "Singleton class"
+ def __init__(self):
+ "Constructor, init reference count"
+ self.count=0
+
+ def newid(self):
+ "Generate a new id"
+ self.count = self.count+1
+ return self.count
+
+ __instance=None
+
+ def __init__(self):
+ "Constructor, create Singleton if don't exist"
+ if Guid.__instance is None:
+ Guid.__instance = Guid.__impl()
+
+ self.__dict__['_Guid__instance'] = Guid.__instance
+
+ def __getattr__(self, attr):
+ "Pass attr retrieving to Singleton"
+ return getattr(self.__instance, attr) \ No newline at end of file
diff --git a/src/partialdate.py b/src/partialdate.py
new file mode 100644
index 0000000..8d558b8
--- /dev/null
+++ b/src/partialdate.py
@@ -0,0 +1,9 @@
+
+class PartialDate:
+ "Class to represent an incomplete (missing Month or Day) or unknown date"
+
+ def __init__(self, year=None, month=None, day=None):
+ "Constructor, nothing is need"
+ self.year = year
+ self.month = month
+ self.day = day \ No newline at end of file
diff --git a/src/person.py b/src/person.py
new file mode 100644
index 0000000..a318266
--- /dev/null
+++ b/src/person.py
@@ -0,0 +1,156 @@
+from guid import Guid
+from partialdate import PartialDate
+import pango
+import const
+
+
+# Constants
+const._person_width = 80
+const._person_height = 30
+const._person_wmargin = 6
+const._person_hmargin = 16
+const._male_color = (0, 0, 255)
+const._female_color = (255, 0, 0)
+const._person_font = pango.FontDescription('Arial 8')
+
+
+# Set of person
+persons = []
+
+
+
+# Person class
+class Person:
+ "Class to represent a person in the tree"
+
+ def __init__(self, name, sex):
+ "Constructor: build"
+ self.id = Guid().newid()
+ self.name = name
+ self.birthdate = PartialDate()
+ self.deathdate = PartialDate()
+ if sex == 'M' or sex == 'm':
+ self.sex = 'M'
+ else:
+ self.sex = 'F'
+ self.parents = None
+ self.unions = []
+ (self.x, self.y) = (-1, -1)
+ persons.append(self)
+
+
+ def append_union(self, union):
+ "Add an union"
+ self.unions.append(union)
+
+
+ def tostring(self, level=1):
+ "Translate to a formatted string, tree is horizontal"
+ str = 'P{0}\n'.format(self.id)
+ if self.unions == []:
+ str += '\t'*level + self.name + " " + self.sex
+ else:
+ for u in self.unions:
+ if self.sex == 'M':
+ opposite = u.mum
+ else:
+ opposite = u.dad
+ str += '\t'*level + self.name + " " + self.sex + '\n+' + '\t'*level + opposite.name + " " + opposite.sex + '\n'
+ str += u.tostring(level)
+
+ return str
+
+
+ def size_to_draw(self):
+ "Compute size to draw the person an its subtree"
+ if self.unions == []:
+ return 1
+ totlen = 0
+ for u in self.unions:
+ totlen = totlen + u.size_to_draw()
+ return totlen
+
+
+ def point_inside(self, x, y):
+ "Test if point is inside the drawing"
+ return x >= self.x and x <= self.x+const._person_width and y >= self.y and y <= self.y+const._person_height
+
+
+ def draw_node(self, gc, pc):
+ "Draw a person"
+
+ # draw border
+ if self.sex == 'M':
+ gc.set_source_rgb(*const._male_color)
+ else:
+ gc.set_source_rgb(*const._female_color)
+ gc.rectangle(self.x, self.y, const._person_width, const._person_height)
+ gc.stroke()
+
+ # draw text
+ layout = pango.Layout(pc)
+ layout.set_width(const._person_width*pango.SCALE)
+ layout.set_text(self.name)
+ layout.set_alignment(pango.ALIGN_CENTER)
+ layout.set_wrap(pango.WRAP_WORD)
+ layout.set_font_description(const._person_font)
+ gc.move_to(self.x, self.y)
+ gc.show_layout(layout)
+
+
+ def compute_draw(self, x, y):
+ "Compute person and its subtree draw starting at origin"
+
+ # Set person position
+ (self.x, self.y) = (x, y)
+ if self.unions != []:
+ # Set union position
+ for i, u in enumerate(self.unions):
+ # Next union
+ if i != 0:
+ size = u.size_to_draw()
+ x = x + (size*const._person_width+size*const._person_wmargin)/2
+
+ # Set conjoint position
+ if self.sex == 'M':
+ opposite = u.mum
+ else:
+ opposite = u.dad
+ (opposite.x, opposite.y) = (x + const._person_width+const._person_wmargin, y)
+
+ # Set the union and childs of this union
+ u.compute_draw(x+const._person_width+(const._person_wmargin/2), y+const._person_height+const._person_hmargin)
+
+ # Shift right
+ size = u.size_to_draw()
+ x = x + (size*const._person_width+size*const._person_wmargin)/2
+
+
+ def translate(self, dx, dy):
+ "Translate coordinate"
+ self.x = self.x + dx
+ self.y = self.y + dy
+
+
+ def draw(self, gc, pc):
+ "Draw person and its subtree in the graphical context"
+
+ # Draw person
+ self.draw_node(gc, pc)
+ if self.unions != []:
+ # Draw union
+ for i, u in enumerate(self.unions):
+ # Draw conjoint
+ if self.sex == 'M':
+ opposite = u.mum
+ else:
+ opposite = u.dad
+ opposite.draw_node(gc, pc)
+
+ # Draw the union and childs of this union
+ u.draw(gc, pc, i)
+
+
+
+
+
diff --git a/src/union.py b/src/union.py
new file mode 100644
index 0000000..afb7e47
--- /dev/null
+++ b/src/union.py
@@ -0,0 +1,105 @@
+from guid import Guid
+from partialdate import PartialDate
+import const
+
+
+# Constants
+const._union_color = (0, 0, 0)
+
+
+# Union class
+class Union:
+ "Class to process union between two persons"
+
+ def __init__(self, dad, mum):
+ "Constructor, init dad, mum and childs"
+ self.id = Guid().newid()
+ self.dad = dad
+ dad.append_union(self)
+ self.mum = mum
+ mum.append_union(self)
+ self.uniondate = PartialDate()
+ self.childs = []
+
+
+ def append_child(self, child):
+ "Append a child born from the union"
+ self.childs.append(child)
+ child.parents = self
+
+
+ def tostring(self, level=1):
+ "Translate to a formatted string, tree is horizontal"
+ str = 'U{0}\n'.format(self.id)
+ for c in self.childs:
+ str += c.tostring(level+1) + '\n'
+
+ return str
+
+
+ def size_to_draw(self):
+ "Compute size to draw the union an its subtree"
+ totlen = 0
+ if self.childs == []:
+ return 3
+ for c in self.childs:
+ totlen = totlen + c.size_to_draw()
+ return max(3,totlen)
+
+
+ def compute_draw(self, x, y):
+ "Compute union subtree position"
+
+ # Compute childs size
+ size = 0
+ for c in self.childs:
+ size = size + c.size_to_draw()
+
+ # Compute origin
+ if len(self.childs) == 1:
+ x = x - (const._person_width)/2
+ else:
+ x = x - (size*const._person_width+(size-1)*const._person_wmargin)/2
+
+ # Draw each child
+ for c in self.childs:
+ # Draw the child
+ c.compute_draw(x, y)
+ size = c.size_to_draw()
+ x = x + (size*const._person_width+size*const._person_wmargin)
+
+
+ def draw(self, gc, pc, unionnumber):
+ "Draw person and its subtree in the graphical context"
+
+ # Draw link between parents
+ if self.dad.x < self.mum.x:
+ (left, right) = (self.dad, self.mum)
+ if (unionnumber != 0):
+ left = left.unions[unionnumber-1].mum
+ else:
+ (left, right) = (self.mum, self.dad)
+ if (unionnumber != 0):
+ left = left.unions[unionnumber-1].dad
+ gc.move_to(left.x+const._person_width, left.y+(const._person_height/2))
+ gc.line_to(right.x, right.y+(const._person_height/2))
+ gc.set_source_rgb(*const._union_color)
+ gc.stroke()
+
+ # Compute childs size
+ size = 0
+ for c in self.childs:
+ size = size + c.size_to_draw()
+
+ # Draw each child
+ for c in self.childs:
+ # Draw the child
+ c.draw(gc, pc)
+
+ # Draw link to child
+ gc.move_to(right.x-(const._person_wmargin/2), right.y+(const._person_height/2))
+ gc.line_to(right.x-(const._person_wmargin/2), right.y+const._person_height+(const._person_hmargin/2))
+ gc.line_to(c.x+(const._person_width/2), right.y+const._person_height+(const._person_hmargin/2))
+ gc.line_to(c.x+(const._person_width/2), c.y)
+ gc.set_source_rgb(*const._union_color)
+ gc.stroke() \ No newline at end of file
diff --git a/sugardummy.py b/sugardummy.py
new file mode 100644
index 0000000..21288c2
--- /dev/null
+++ b/sugardummy.py
@@ -0,0 +1,36 @@
+
+import gtk
+
+# Dummy class for Sugar
+class activity:
+
+ # Dummy class for Activity
+ class Activity:
+
+ def __init__(self, handle):
+ self.window = gtk.Window()
+ self.window.set_title("Roots")
+ self.window.connect("destroy", gtk.main_quit)
+
+ def set_canvas(self, canvas):
+ self.window.add(canvas)
+
+ def show_all(self):
+ self.window.show_all()
+
+ def create_pango_context(self):
+ return gtk.Widget.create_pango_context(self.window)
+
+ def set_toolbox(self, toolbox):
+ pass
+
+
+ # Dummy class for Toolbox
+ class ActivityToolbox:
+
+ def __init__(self, window):
+ pass
+
+ def show(self):
+ pass
+ \ No newline at end of file