示例#1
0
 def main(self):
     """Search the database for the last person records changed."""
     self.set_text(_("Processing...") + "\n")
     counter = 0
     yield True
     handles = sorted(self.dbstate.db.get_person_handles(), key=self._getTimestamp)
     yield True
     self.clear_text()
     for handle in reversed(handles[-10:]):
         person = self.dbstate.db.get_person_from_handle(handle)
         self.append_text(" %d. " % (counter + 1, ))
         self.link(person.get_primary_name().get_name(), 'Person', person.handle)
         change_date = Date()
         change_date.set_yr_mon_day(*time.localtime(person.change)[0:3])
         self.append_text(" (%s %s)" % (_('changed on'), gramps.gen.datehandler.displayer.display(change_date)))
         self.append_text("\n")
         if (counter % _YIELD_INTERVAL):
             yield True
         counter += 1
 def main(self):
     """Search the database for the last person records changed."""
     self.set_text(_("Processing...") + "\n")
     counter = 0
     yield True
     handles = sorted(self.dbstate.db.get_person_handles(), key=self._getTimestamp)
     yield True
     self.clear_text()
     for handle in reversed(handles[-10:]):
         person = self.dbstate.db.get_person_from_handle(handle)
         self.append_text(" %d. " % (counter + 1, ))
         self.link(person.get_primary_name().get_name(), 'Person', person.handle)
         change_date = Date()
         change_date.set_yr_mon_day(*time.localtime(person.change)[0:3])
         self.append_text(" (%s %s)" % (_('changed on'), gramps.gen.datehandler.displayer.display(change_date)))
         self.append_text("\n")
         if (counter % _YIELD_INTERVAL):
             yield True
         counter += 1
示例#3
0
    def __init__(self, database, options, user):
        """
        Initialize the report class.

        database        - the GRAMPS database instance
        options         - instance of the Options class for this report
        user            - a gramps.gen.user.User() instance

        """

        Report.__init__(self, database, options, user)

        menu = options.menu

        # BUG: somehow when calculating if we've reached the max
        # generations limit the report is stopping at one generation
        # before the max requested, so I'm bumping this up by one to
        # compensate until I find where the calculation is wrong.
        self.max_generations = menu.get_option_by_name('maxgen').get_value() + 1

        pid = menu.get_option_by_name('pid').get_value()
        self.center_person = database.get_person_from_gramps_id(pid)
        if (self.center_person == None) :
            raise ReportError(_("Person %s is not in the Database") % pid )

        self.show_parent_tags = menu.get_option_by_name('showcaptions').get_value()
        self.parent_tag_len = pt2cm(self.doc.string_width(self.get_font('PC-box'), _("Mother")))
        self.parent_tag_height = self.get_font_height('PC-box')

        name = name_displayer.display_formal(self.center_person)
        self.title = _("Pedigree Chart for %s") % name

        report_date = Date()
        report_date.set_yr_mon_day(*time.localtime()[0:3])
        # researcher = self.database.get_researcher()

#        self.footer = escape("%s: %s <%s>\n%s" % (_('Researcher'),
#                             researcher.get_name(),
#                             researcher.get_email(),
#                             gramps.gen.datehandler.displayer.display(report_date)))
        self.footer = gramps.gen.datehandler.displayer.display(report_date)

        self.map = {}
        self.page_number = PageCounter(1)
        self.page_link_counter = PageCounter(2)
        self.generation_index = 1

        page_width = self.doc.get_usable_width()
        page_height = self.doc.get_usable_height()

        self.columns = [_GUTTER_SIZE,
            page_width *  6 / 40,
            page_width * 12 / 40,
            page_width * 25 / 40,
            page_width * 32 / 40
            ]

        #print "[DEBUG] page_width = %s, columns = %s" % (page_width, self.columns)

        # The third column (index 2) has the smallest space available, so I
        # base the box sizes on it.
        #self.em_size = pt2cm(self.doc.string_width(self.get_font('PC-box'), 'm'))
        self.max_box_size = self.columns[3] - self.columns[2] - _GUTTER_SIZE
        #self.name_max_len = self.max_box_size / self.em_size

        #print "[DEBUG] columns", repr(self.columns)
        #print "[DEBUG] em size: %s, max_box_size: %s, max_name_len: %s" % (self.em_size, self.max_box_size, self.name_max_len)

        self.coordinates = { 1: (self.columns[0], page_height * 32 / 64),
                        # second generation
                        2: (self.columns[1], page_height * 16 / 64),
                        3: (self.columns[1], page_height * 48 / 64),
                        # third generation
                        4: (self.columns[2], page_height * 8 / 64),
                        5: (self.columns[2], page_height * 24 / 64),
                        6: (self.columns[2], page_height * 40 / 64),
                        7: (self.columns[2], page_height * 56 / 64),
                        # fourth generation
                        8: (self.columns[3], page_height * 4 / 64),    #  3/64
                        9: (self.columns[3], page_height * 13 / 64),   # 15/64
                        10: (self.columns[3], page_height * 20 / 64),  # 20/64
                        11: (self.columns[3], page_height * 28 / 64),  # 30
                        12: (self.columns[3], page_height * 36 / 64),  # 35
                        13: (self.columns[3], page_height * 45 / 64),  # 47
                        14: (self.columns[3], page_height * 52 / 64),  # 51
                        15: (self.columns[3], page_height * 60 / 64)   # 60
        }