Standardise on ReportUtils fallback methods for baptism and burial dates in lieu of birth and death dates. Also some PEP8 fixes.
svn: r11716
This commit is contained in:
		@@ -9,6 +9,7 @@
 | 
			
		||||
#    Copyright (C) 2007       Johan Gonqvist <johan.gronqvist@gmail.com>
 | 
			
		||||
#    Contributions by Lorenzo Cappelletti <lorenzo.cappelletti@email.it>
 | 
			
		||||
#    Copyright (C) 2008       Stephane Charette <stephanecharette@gmail.com>
 | 
			
		||||
#    Copyright (C) 2009       Gary Burton
 | 
			
		||||
#
 | 
			
		||||
# 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
 | 
			
		||||
@@ -99,7 +100,8 @@ class RelGraphReport(Report):
 | 
			
		||||
        url        - Whether to include URLs.
 | 
			
		||||
        inclimg    - Include images or not
 | 
			
		||||
        imgpos     - Image position, above/beside name
 | 
			
		||||
        color      - Whether to use outline, colored outline or filled color in graph
 | 
			
		||||
        color      - Whether to use outline, colored outline or filled color
 | 
			
		||||
                     in graph
 | 
			
		||||
        dashed     - Whether to use dashed lines for non-birth relationships.
 | 
			
		||||
        use_roundedcorners - Whether to use rounded corners for females
 | 
			
		||||
        """
 | 
			
		||||
@@ -129,7 +131,8 @@ class RelGraphReport(Report):
 | 
			
		||||
        self.includeurl = menu.get_option_by_name('url').get_value()
 | 
			
		||||
        self.includeimg = menu.get_option_by_name('includeImages').get_value()
 | 
			
		||||
        self.imgpos     = menu.get_option_by_name('imageOnTheSide').get_value()
 | 
			
		||||
        self.use_roundedcorners = menu.get_option_by_name('useroundedcorners').get_value()
 | 
			
		||||
        self.use_roundedcorners = \
 | 
			
		||||
           menu.get_option_by_name('useroundedcorners').get_value()
 | 
			
		||||
        self.adoptionsdashed = menu.get_option_by_name('dashed').get_value()
 | 
			
		||||
        self.show_families = menu.get_option_by_name('showfamily').get_value()
 | 
			
		||||
        self.just_years = menu.get_option_by_name('justyears').get_value()
 | 
			
		||||
@@ -160,7 +163,8 @@ class RelGraphReport(Report):
 | 
			
		||||
            self.add_child_links_to_families()
 | 
			
		||||
 | 
			
		||||
    def add_child_links_to_families(self):
 | 
			
		||||
        "returns string of GraphViz edges linking parents to families or children"
 | 
			
		||||
        "returns string of GraphViz edges linking parents to families or \
 | 
			
		||||
         children"
 | 
			
		||||
        person_dict = {}
 | 
			
		||||
        # Hash people in a dictionary for faster inclusion checking
 | 
			
		||||
        for person_handle in self.person_handles:
 | 
			
		||||
@@ -259,7 +263,8 @@ class RelGraphReport(Report):
 | 
			
		||||
                        elif self.colorize == 'filled':
 | 
			
		||||
                            fill = self.colors['family']
 | 
			
		||||
                            style = "filled"
 | 
			
		||||
                        self.doc.add_node(fam_id,label,"ellipse",color,style,fill)
 | 
			
		||||
                        self.doc.add_node(fam_id, label, "ellipse",
 | 
			
		||||
                                          color, style, fill)
 | 
			
		||||
                    # Link this person to all his/her families.
 | 
			
		||||
                    self.doc.add_link( fam_id, p_id, "", 
 | 
			
		||||
                                      self.arrowheadstyle, self.arrowtailstyle )
 | 
			
		||||
@@ -308,16 +313,20 @@ class RelGraphReport(Report):
 | 
			
		||||
                    imagePath = ThumbNails.get_thumbnail_path(
 | 
			
		||||
                                    Utils.media_path_full(self.database, 
 | 
			
		||||
                                                          media.get_path()))
 | 
			
		||||
                    #test if thumbnail actually exists in thumbs (import of data means media files might not be present
 | 
			
		||||
                    # test if thumbnail actually exists in thumbs
 | 
			
		||||
                    # (import of data means media files might not be present
 | 
			
		||||
                    imagePath = Utils.find_file(imagePath)
 | 
			
		||||
 | 
			
		||||
        label = u""
 | 
			
		||||
        lineDelimiter = '\\n'
 | 
			
		||||
 | 
			
		||||
        # If we have an image, then start an HTML table; remember to close the table afterwards!
 | 
			
		||||
        # If we have an image, then start an HTML table; remember to close
 | 
			
		||||
        # the table afterwards!
 | 
			
		||||
        #
 | 
			
		||||
        # This isn't a free-form HTML format here...just a few keywords that happen to be
 | 
			
		||||
        # simillar to keywords commonly seen in HTML.  For additional information on what
 | 
			
		||||
        # This isn't a free-form HTML format here...just a few keywords that
 | 
			
		||||
        # happen to be
 | 
			
		||||
        # simillar to keywords commonly seen in HTML.  For additional
 | 
			
		||||
        # information on what
 | 
			
		||||
        # is allowed, see:
 | 
			
		||||
        #
 | 
			
		||||
        #       http://www.graphviz.org/info/shapes.html#html
 | 
			
		||||
@@ -358,29 +367,18 @@ class RelGraphReport(Report):
 | 
			
		||||
    
 | 
			
		||||
    def get_date_strings(self, person):
 | 
			
		||||
        "returns tuple of birth/christening and death/burying date strings"
 | 
			
		||||
        birth_ref = person.get_birth_ref()
 | 
			
		||||
        if birth_ref:
 | 
			
		||||
            birth_event = self.database.get_event_from_handle(birth_ref.ref)
 | 
			
		||||
        birth_event = ReportUtils.get_birth_or_fallback(self.database, person)
 | 
			
		||||
        if birth_event:
 | 
			
		||||
            birth = self.get_event_string(birth_event)
 | 
			
		||||
        else:
 | 
			
		||||
            birth = ''
 | 
			
		||||
        death_ref = person.get_death_ref()
 | 
			
		||||
        if death_ref:
 | 
			
		||||
            death_event = self.database.get_event_from_handle(death_ref.ref)
 | 
			
		||||
            birth = ""
 | 
			
		||||
 | 
			
		||||
        death_event = ReportUtils.get_death_or_fallback(self.database, person)
 | 
			
		||||
        if death_event:
 | 
			
		||||
            death = self.get_event_string(death_event)
 | 
			
		||||
        else:
 | 
			
		||||
            death = ''
 | 
			
		||||
        if birth and death:
 | 
			
		||||
            return (birth, death)
 | 
			
		||||
        # missing info, use (first) christening/burial instead
 | 
			
		||||
        for event_ref in person.get_primary_event_ref_list():
 | 
			
		||||
            event = self.database.get_event_from_handle(event_ref.ref)
 | 
			
		||||
            if event.type == gen.lib.EventType.CHRISTEN:
 | 
			
		||||
                if not birth:
 | 
			
		||||
                    birth = self.get_event_string(event)
 | 
			
		||||
            elif event.type ==  gen.lib.EventType.BURIAL:
 | 
			
		||||
                if not death:
 | 
			
		||||
                    death = self.get_event_string(event)
 | 
			
		||||
            death = ""
 | 
			
		||||
 | 
			
		||||
        return (birth, death)
 | 
			
		||||
 | 
			
		||||
    def get_event_string(self, event):
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user