2003-06-27 Tim Waugh <twaugh@redhat.com>

* src/plugins/Ancestors.py: Include source reference notes.  Made
        source citation optional.  Adjusted styles.


svn: r1794
This commit is contained in:
Tim Waugh 2003-06-27 11:18:58 +00:00
parent 40349700c1
commit dac160cf68
2 changed files with 43 additions and 9 deletions

View File

@ -1,3 +1,7 @@
2003-06-27 Tim Waugh <twaugh@redhat.com>
* src/plugins/Ancestors.py: Include source reference notes. Made
source citation optional. Adjusted styles.
2003-06-26 Don Allingham <dallingham@users.sourceforge.net> 2003-06-26 Don Allingham <dallingham@users.sourceforge.net>
* src/plugins/IndivComplete.py: make compatible with BookReport * src/plugins/IndivComplete.py: make compatible with BookReport
* src/plugins/IndivSummary.py: changed style names to use colon qualifiers * src/plugins/IndivSummary.py: changed style names to use colon qualifiers

View File

@ -21,6 +21,8 @@
# $Id$ # $Id$
import gtk
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
# gramps modules # gramps modules
@ -40,14 +42,16 @@ from intl import gettext as _
#------------------------------------------------------------------------ #------------------------------------------------------------------------
class AncestorsReport (Report.Report): class AncestorsReport (Report.Report):
def __init__(self,database,person,max,pgbrk,doc,output,newpage=0): def __init__(self,database,person,max,pgbrk,cite,doc,output,newpage=0):
self.map = {} self.map = {}
self.database = database self.database = database
self.start = person self.start = person
self.max_generations = max self.max_generations = max
self.pgbrk = pgbrk self.pgbrk = pgbrk
self.opt_cite = cite
self.doc = doc self.doc = doc
self.sources = [] self.sources = []
self.sourcerefs = []
table = TextDoc.TableStyle () table = TextDoc.TableStyle ()
table.set_column_widths ([15, 85]) table.set_column_widths ([15, 85])
@ -87,9 +91,11 @@ class AncestorsReport (Report.Report):
doc.add_cell_style ("NoPhoto", cell) doc.add_cell_style ("NoPhoto", cell)
cell = TextDoc.TableCellStyle () cell = TextDoc.TableCellStyle ()
cell.set_padding (0.1)
doc.add_cell_style ("Photo", cell) doc.add_cell_style ("Photo", cell)
cell = TextDoc.TableCellStyle () cell = TextDoc.TableCellStyle ()
cell.set_padding (0.1)
doc.add_cell_style ("Entry", cell) doc.add_cell_style ("Entry", cell)
if output: if output:
@ -286,6 +292,7 @@ class AncestorsReport (Report.Report):
if len (photos) == 0: if len (photos) == 0:
ret.append ((self.doc.start_cell, ["NoPhoto"])) ret.append ((self.doc.start_cell, ["NoPhoto"]))
ret.append ((self.doc.write_text, ["(no photo)"]))
ret.append ((self.doc.end_cell, [])) ret.append ((self.doc.end_cell, []))
else: else:
ret.append ((self.doc.start_cell, ["Photo"])) ret.append ((self.doc.start_cell, ["Photo"]))
@ -443,14 +450,25 @@ class AncestorsReport (Report.Report):
def cite_sources (self, sourcereflist): def cite_sources (self, sourcereflist):
citation = "" citation = ""
for ref in sourcereflist: if self.opt_cite:
source = ref.getBase () for ref in sourcereflist:
if source in self.sources: if ref in self.sourcerefs:
citation += "[%d]" % (self.sources.index (source) + 1) continue
continue
self.sources.append (source) self.sourcerefs.append (ref)
citation += "[%d]" % len (self.sources) source = ref.getBase ()
if source in self.sources:
ind = self.sources.index (source) + 1
else:
self.sources.append (source)
ind = len (self.sources)
citation += "[%d" % ind
comments = ref.getComments ()
if comments and comments.find ('\n') == -1:
citation += " - %s" % comments.rstrip ('.')
citation += "]"
return citation return citation
@ -672,13 +690,25 @@ class AncestorReportDialog(Report.TextReportDialog):
def make_default_style(self): def make_default_style(self):
_make_default_style(self) _make_default_style(self)
def add_user_options (self):
self.cb_cite = gtk.CheckButton (_("Cite sources"))
self.cb_cite.set_active (gtk.TRUE)
self.add_option ('', self.cb_cite)
def parse_report_options_frame (self):
# Call base class
Report.ReportDialog.parse_report_options_frame (self)
self.opt_cite = self.cb_cite.get_active ()
def make_report(self): def make_report(self):
"""Create the object that will produce the Ancestors Report. """Create the object that will produce the Ancestors Report.
All user dialog has already been handled and the output file All user dialog has already been handled and the output file
opened.""" opened."""
try: try:
MyReport = AncestorsReport(self.db, self.person, MyReport = AncestorsReport(self.db, self.person,
self.max_gen, self.pg_brk, self.doc, self.target_path) self.max_gen, self.pg_brk,
self.opt_cite, self.doc,
self.target_path)
MyReport.write_report() MyReport.write_report()
except Errors.ReportError, msg: except Errors.ReportError, msg:
(m1,m2) = msg.messages() (m1,m2) = msg.messages()