Updates
svn: r1023
This commit is contained in:
@@ -301,11 +301,14 @@ class AncestorChartDialog(DrawReportDialog):
|
||||
"""Create the object that will produce the Ancestor Chart.
|
||||
All user dialog has already been handled and the output file
|
||||
opened."""
|
||||
MyReport = AncestorChart(self.db, self.person, self.target_path,
|
||||
self.max_gen, self.doc, self.report_text)
|
||||
MyReport.write_report()
|
||||
|
||||
|
||||
try:
|
||||
MyReport = AncestorChart(self.db, self.person, self.target_path,
|
||||
self.max_gen, self.doc, self.report_text)
|
||||
MyReport.write_report()
|
||||
except:
|
||||
import DisplayTrace
|
||||
DisplayTrace.DisplayTrace()
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
@@ -35,16 +35,11 @@ import libglade
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
# AncestorReport
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class AncestorReport(Report):
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def __init__(self,database,person,output,max,doc,pgbrk):
|
||||
self.map = {}
|
||||
self.database = database
|
||||
@@ -58,11 +53,6 @@ class AncestorReport(Report):
|
||||
except IOError,msg:
|
||||
gnome.ui.GnomeErrorDialog(_("Could not open %s") % output + "\n" + msg)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def filter(self,person,index):
|
||||
if person == None or index >= (1 << 31):
|
||||
return
|
||||
@@ -73,11 +63,6 @@ class AncestorReport(Report):
|
||||
self.filter(family.getFather(),index*2)
|
||||
self.filter(family.getMother(),(index*2)+1)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def write_report(self):
|
||||
|
||||
self.filter(self.start,1)
|
||||
@@ -215,7 +200,6 @@ class AncestorReport(Report):
|
||||
self.doc.write_text(".")
|
||||
|
||||
self.doc.end_paragraph()
|
||||
|
||||
self.doc.close()
|
||||
|
||||
|
||||
@@ -250,11 +234,6 @@ class AncestorReportDialog(TextReportDialog):
|
||||
"""Where to save styles for this report."""
|
||||
return "ancestor_report.xml"
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Create output styles appropriate to this report.
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def make_default_style(self):
|
||||
"""Make the default output style for the Ahnentafel report."""
|
||||
font = FontStyle()
|
||||
@@ -277,18 +256,17 @@ class AncestorReportDialog(TextReportDialog):
|
||||
para.set(first_indent=-1.0,lmargin=1.0,pad=0.25)
|
||||
self.default_style.add_style("Entry",para)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Create the contents of the report.
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def make_report(self):
|
||||
"""Create the object that will produce the Ahnentafel Report.
|
||||
All user dialog has already been handled and the output file
|
||||
opened."""
|
||||
MyReport = AncestorReport(self.db, self.person, self.target_path,
|
||||
self.max_gen, self.doc, self.pg_brk)
|
||||
MyReport.write_report()
|
||||
try:
|
||||
MyReport = AncestorReport(self.db, self.person, self.target_path,
|
||||
self.max_gen, self.doc, self.pg_brk)
|
||||
MyReport.write_report()
|
||||
except:
|
||||
import DisplayTrace
|
||||
DisplayTrace.DisplayTrace()
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
@@ -37,7 +37,11 @@ _ = intl.gettext
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def runTool(database,person,callback):
|
||||
ChangeTypes(database,person)
|
||||
try:
|
||||
ChangeTypes(database,person)
|
||||
except:
|
||||
import DisplayTrace
|
||||
DisplayTrace.DisplayTrace()
|
||||
|
||||
class ChangeTypes:
|
||||
def __init__(self,db,person):
|
||||
|
||||
+10
-6
@@ -37,12 +37,16 @@ import libglade
|
||||
#-------------------------------------------------------------------------
|
||||
def runTool(database,active_person,callback):
|
||||
|
||||
checker = CheckIntegrity(database)
|
||||
checker.check_for_broken_family_links()
|
||||
checker.cleanup_missing_photos()
|
||||
checker.check_parent_relationships()
|
||||
checker.cleanup_empty_families(0)
|
||||
checker.report()
|
||||
try:
|
||||
checker = CheckIntegrity(database)
|
||||
checker.check_for_broken_family_links()
|
||||
checker.cleanup_missing_photos()
|
||||
checker.check_parent_relationships()
|
||||
checker.cleanup_empty_families(0)
|
||||
checker.report()
|
||||
except:
|
||||
import DisplayTrace
|
||||
DisplayTrace.DisplayTrace()
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
+41
-27
@@ -20,17 +20,32 @@
|
||||
|
||||
"Generate files/Descendant Report"
|
||||
|
||||
import GraphLayout
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# standard python modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
import string
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# GTK/GNOME modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
import libglade
|
||||
import gtk
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
import GraphLayout
|
||||
from FontScale import string_width
|
||||
from DrawDoc import *
|
||||
from Report import *
|
||||
from TextDoc import *
|
||||
|
||||
import libglade
|
||||
import gtk
|
||||
import string
|
||||
|
||||
import intl
|
||||
_ = intl.gettext
|
||||
|
||||
@@ -44,13 +59,13 @@ _sep = 0.5
|
||||
def pt2cm(pt):
|
||||
return (float(pt)/72.0)*2.54
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# DescendantReport
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class DescendantReport:
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def __init__(self,database,display,person,output,doc):
|
||||
self.doc = doc
|
||||
self.doc.creator(database.getResearcher().getName())
|
||||
@@ -98,7 +113,6 @@ class DescendantReport:
|
||||
|
||||
self.lines = max(self.lines,len(self.text[p]))
|
||||
|
||||
|
||||
def write_report(self):
|
||||
|
||||
self.calc()
|
||||
@@ -214,14 +228,10 @@ class DescendantReport:
|
||||
except:
|
||||
print "Document close failure"
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
# calc - calculate the maximum width that a box needs to be. From
|
||||
# that and the page dimensions, calculate the proper place to put
|
||||
# the elements on a page.
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def calc(self):
|
||||
"""calc - calculate the maximum width that a box needs to be. From
|
||||
that and the page dimensions, calculate the proper place to put
|
||||
the elements on a page."""
|
||||
self.height = self.lines*pt2cm(1.25*self.font.get_size())
|
||||
self.box_width = pt2cm(self.box_width+20)
|
||||
|
||||
@@ -238,11 +248,6 @@ class DescendantReport:
|
||||
g = GraphicsStyle()
|
||||
self.doc.add_draw_style("line",g)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def print_page(self, plist,elist,r,c):
|
||||
self.doc.start_page()
|
||||
|
||||
@@ -299,6 +304,11 @@ class DescendantReport:
|
||||
self.doc.end_page()
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# DescendantReportDialog
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class DescendantReportDialog(DrawReportDialog):
|
||||
def __init__(self,database,person):
|
||||
DrawReportDialog.__init__(self,database,person)
|
||||
@@ -337,10 +347,14 @@ class DescendantReportDialog(DrawReportDialog):
|
||||
"""Create the object that will produce the Descendant Graph.
|
||||
All user dialog has already been handled and the output file
|
||||
opened."""
|
||||
MyReport = DescendantReport(self.db,self.report_text,
|
||||
self.person, self.target_path, self.doc)
|
||||
MyReport.write_report()
|
||||
|
||||
try:
|
||||
MyReport = DescendantReport(self.db,self.report_text,
|
||||
self.person, self.target_path, self.doc)
|
||||
MyReport.write_report()
|
||||
except:
|
||||
import DisplayTrace
|
||||
DisplayTrace.DisplayTrace()
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
|
||||
@@ -20,14 +20,30 @@
|
||||
|
||||
"Analysis and Exploration/Interactive descendant browser"
|
||||
|
||||
from RelLib import *
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# standard python modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
import os
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from RelLib import *
|
||||
import Utils
|
||||
import intl
|
||||
import GrampsCfg
|
||||
|
||||
_ = intl.gettext
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# GTK/GNOME modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
import GDK
|
||||
import gtk
|
||||
import libglade
|
||||
@@ -38,7 +54,11 @@ import libglade
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def runTool(database,person,callback):
|
||||
DesBrowse(database,person,callback)
|
||||
try:
|
||||
DesBrowse(database,person,callback)
|
||||
except:
|
||||
import DisplayTrace
|
||||
DisplayTrace.DisplayTrace()
|
||||
|
||||
class DesBrowse:
|
||||
def __init__(self,database,person,callback):
|
||||
|
||||
@@ -20,30 +20,40 @@
|
||||
|
||||
"Generate files/Descendant Report"
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# standard python modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
import os
|
||||
import sort
|
||||
import string
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from Report import *
|
||||
import intl
|
||||
|
||||
_ = intl.gettext
|
||||
|
||||
from Report import *
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# GTK/GNOME modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
import gtk
|
||||
import libglade
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
# DescendantReport
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class DescendantReport:
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def __init__(self,db,person,name,max,doc):
|
||||
self.creator = db.getResearcher().getName()
|
||||
self.name = name
|
||||
@@ -51,27 +61,12 @@ class DescendantReport:
|
||||
self.max_generations = max
|
||||
self.doc = doc
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def setup(self):
|
||||
self.doc.open(self.name)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def end(self):
|
||||
self.doc.close()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def dump_dates(self, person):
|
||||
birth = person.getBirth().getDateObj().get_start_date()
|
||||
death = person.getDeath().getDateObj().get_start_date()
|
||||
@@ -85,11 +80,6 @@ class DescendantReport:
|
||||
self.doc.write_text('d. ' + str(death.getYear()))
|
||||
self.doc.write_text(')')
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def report(self):
|
||||
self.doc.start_paragraph("Title")
|
||||
name = self.person.getPrimaryName().getRegularName()
|
||||
@@ -98,11 +88,6 @@ class DescendantReport:
|
||||
self.doc.end_paragraph()
|
||||
self.dump(0,self.person)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def dump(self,level,person):
|
||||
|
||||
if level != 0:
|
||||
@@ -155,11 +140,6 @@ class DescendantReportDialog(TextReportDialog):
|
||||
"""Where to save styles for this report."""
|
||||
return "descend_report.xml"
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Create output styles appropriate to this report.
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def make_default_style(self):
|
||||
"""Make the default output style for the Descendant Report."""
|
||||
f = FontStyle()
|
||||
@@ -178,20 +158,19 @@ class DescendantReportDialog(TextReportDialog):
|
||||
p.set_left_margin(max(10.0,float(i-1)))
|
||||
self.default_style.add_style("Level%d" % i,p)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Create the contents of the report.
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def make_report(self):
|
||||
"""Create the object that will produce the Descendant Report.
|
||||
All user dialog has already been handled and the output file
|
||||
opened."""
|
||||
MyReport = DescendantReport(self.db, self.person, self.target_path,
|
||||
self.max_gen, self.doc)
|
||||
MyReport.setup()
|
||||
MyReport.report()
|
||||
MyReport.end()
|
||||
try:
|
||||
MyReport = DescendantReport(self.db, self.person, self.target_path,
|
||||
self.max_gen, self.doc)
|
||||
MyReport.setup()
|
||||
MyReport.report()
|
||||
MyReport.end()
|
||||
except:
|
||||
import DisplayTrace
|
||||
DisplayTrace.DisplayTrace()
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
@@ -27,9 +27,6 @@ _ = intl.gettext
|
||||
|
||||
from Report import *
|
||||
|
||||
import gtk
|
||||
import libglade
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
@@ -365,9 +362,9 @@ class FamilyGroupDialog(TextReportDialog):
|
||||
will return a placebo label and disable the OK button."""
|
||||
mapping = {}
|
||||
family_list = self.person.getFamilyList()
|
||||
if not family_list:
|
||||
mapping[_("No known marriages")] = None
|
||||
self.topDialog.get_widget("OK").set_sensitive(0)
|
||||
# if not family_list:
|
||||
# mapping[_("No known marriages")] = None
|
||||
# self.topDialog.get_widget("OK").set_sensitive(0)
|
||||
for family in family_list:
|
||||
if self.person == family.getFather():
|
||||
spouse = family.getMother()
|
||||
|
||||
@@ -501,7 +501,11 @@ def get_name_obj(person):
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def runTool(database,active_person,callback):
|
||||
Merge(database,callback)
|
||||
try:
|
||||
Merge(database,callback)
|
||||
except:
|
||||
import DisplayTrace
|
||||
DisplayTrace.DisplayTrace()
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
@@ -43,7 +43,11 @@ _nick_re = re.compile(r"(.+)[(\"](.*)[)\"]")
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def runTool(database,active_person,callback):
|
||||
PatchNames(database,callback)
|
||||
try:
|
||||
PatchNames(database,callback)
|
||||
except:
|
||||
import DisplayTrace
|
||||
DisplayTrace.DisplayTrace()
|
||||
|
||||
class PatchNames:
|
||||
|
||||
|
||||
@@ -1705,7 +1705,11 @@ def on_ok_clicked(obj):
|
||||
if name == "":
|
||||
return
|
||||
Utils.destroy_passed_object(obj)
|
||||
importData(db,name)
|
||||
try:
|
||||
importData(db,name)
|
||||
except:
|
||||
import DisplayTrace
|
||||
DisplayTrace.DisplayTrace()
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
"Import from Gramps"
|
||||
|
||||
import libglade
|
||||
from ReadXML import *
|
||||
import Utils
|
||||
import intl
|
||||
@@ -69,7 +68,11 @@ class ReadNative:
|
||||
|
||||
name = "%s/%s" % (name,const.xmlFile)
|
||||
Utils.destroy_passed_object(self.top)
|
||||
importData(self.db,name,progress)
|
||||
try:
|
||||
importData(self.db,name,progress)
|
||||
except:
|
||||
import DisplayTrace
|
||||
DisplayTrace.DisplayTrace()
|
||||
self.callback(1)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
@@ -33,7 +33,11 @@ _findint = re.compile('^[^\d]*(\d+)[^\d]*')
|
||||
|
||||
def runTool(db,active_person,callback):
|
||||
"""Changed person, family, object, source, and place ids"""
|
||||
ReorderIds(db,callback)
|
||||
try:
|
||||
ReorderIds(db,callback)
|
||||
except:
|
||||
import DisplayTrace
|
||||
DisplayTrace.DisplayTrace()
|
||||
|
||||
class ReorderIds:
|
||||
|
||||
|
||||
+17
-3
@@ -20,15 +20,29 @@
|
||||
|
||||
"View/Summary of the database"
|
||||
|
||||
from RelLib import *
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# standard python modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
import os
|
||||
import posixpath
|
||||
import re
|
||||
import string
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from RelLib import *
|
||||
import Utils
|
||||
import intl
|
||||
_ = intl.gettext
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# GNOME/GTK modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from gtk import *
|
||||
from gnome.ui import *
|
||||
from libglade import *
|
||||
|
||||
+22
-8
@@ -20,19 +20,33 @@
|
||||
|
||||
"View/Verify"
|
||||
|
||||
from RelLib import *
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# standard python modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
import os
|
||||
import posixpath
|
||||
import re
|
||||
import sort
|
||||
import string
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# GNOME/GTK modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from gtk import *
|
||||
from gnome.ui import *
|
||||
from libglade import *
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from RelLib import *
|
||||
|
||||
import Utils
|
||||
import intl
|
||||
_ = intl.gettext
|
||||
|
||||
from gtk import *
|
||||
from gnome.ui import *
|
||||
from libglade import *
|
||||
|
||||
db = None
|
||||
glade_file = None
|
||||
|
||||
@@ -283,7 +283,11 @@ def ged_subdate(date):
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def writeData(database,person):
|
||||
GedcomWriter(database,person)
|
||||
try:
|
||||
GedcomWriter(database,person)
|
||||
except:
|
||||
import DisplayTrace
|
||||
DisplayTrace.DisplayTrace()
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
+107
-88
@@ -20,113 +20,132 @@
|
||||
|
||||
"Export to GRAMPS package"
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# standard python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import time
|
||||
import os
|
||||
from cStringIO import StringIO
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GNOME/GTK modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import libglade
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from RelLib import *
|
||||
|
||||
import WriteXML
|
||||
import time
|
||||
import os
|
||||
import TarFile
|
||||
import Utils
|
||||
import libglade
|
||||
|
||||
from cStringIO import StringIO
|
||||
import intl
|
||||
_ = intl.gettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# writeData
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def writeData(database,person):
|
||||
global db
|
||||
global topDialog
|
||||
global active_person
|
||||
try:
|
||||
PackageWriter(database)
|
||||
except:
|
||||
import DisplayTrace
|
||||
DisplayTrace.DisplayTrace()
|
||||
|
||||
db = database
|
||||
active_person = person
|
||||
|
||||
base = os.path.dirname(__file__)
|
||||
glade_file = base + os.sep + "pkgexport.glade"
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# PackageWriter
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class PackageWriter:
|
||||
|
||||
def __init__(self,database):
|
||||
self.db = database
|
||||
|
||||
dic = {
|
||||
"destroy_passed_object" : Utils.destroy_passed_object,
|
||||
"on_ok_clicked" : on_ok_clicked
|
||||
}
|
||||
base = os.path.dirname(__file__)
|
||||
glade_file = "%s/%s" % (base,"pkgexport.glade")
|
||||
|
||||
|
||||
dic = {
|
||||
"destroy_passed_object" : Utils.destroy_passed_object,
|
||||
"on_ok_clicked" : self.on_ok_clicked
|
||||
}
|
||||
|
||||
self.top = libglade.GladeXML(glade_file,"packageExport")
|
||||
self.top.signal_autoconnect(dic)
|
||||
self.top.get_widget("packageExport").show()
|
||||
|
||||
topDialog = libglade.GladeXML(glade_file,"packageExport")
|
||||
topDialog.signal_autoconnect(dic)
|
||||
def on_ok_clicked(self,obj):
|
||||
name = self.top.get_widget("filename").get_text()
|
||||
Utils.destroy_passed_object(obj)
|
||||
self.export(name)
|
||||
|
||||
topDialog.get_widget("packageExport").show()
|
||||
def export(self, filename):
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def on_ok_clicked(obj):
|
||||
global db
|
||||
global topDialog
|
||||
|
||||
name = topDialog.get_widget("filename").get_text()
|
||||
Utils.destroy_passed_object(obj)
|
||||
exportData(db,name)
|
||||
t = TarFile.TarFile(filename)
|
||||
g = StringIO()
|
||||
|
||||
gfile = WriteXML.XmlWriter(self.db,None,1)
|
||||
gfile.write_handle(g)
|
||||
mtime = time.time()
|
||||
t.add_file("data.gramps",mtime,g)
|
||||
g.close()
|
||||
|
||||
def callback(a):
|
||||
pass
|
||||
|
||||
def exportData(database, filename):
|
||||
|
||||
t = TarFile.TarFile(filename)
|
||||
g = StringIO()
|
||||
|
||||
gfile = WriteXML.XmlWriter(database,None,1)
|
||||
gfile.write_handle(g)
|
||||
mtime = time.time()
|
||||
t.add_file("data.gramps",mtime,g)
|
||||
g.close()
|
||||
|
||||
for f in database.getPersonMap().values():
|
||||
for p in f.getPhotoList():
|
||||
object = p.getReference()
|
||||
base = os.path.basename(object.getPath())
|
||||
try:
|
||||
g = open(object.getPath(),"rb")
|
||||
t.add_file(base,mtime,g)
|
||||
g.close()
|
||||
except:
|
||||
pass
|
||||
for f in database.getFamilyMap().values():
|
||||
for p in f.getPhotoList():
|
||||
object = p.getReference()
|
||||
base = os.path.basename(object.getPath())
|
||||
try:
|
||||
g = open(object.getPath(),"rb")
|
||||
t.add_file(base,mtime,g)
|
||||
g.close()
|
||||
except:
|
||||
pass
|
||||
for f in database.getSourceMap().values():
|
||||
for p in f.getPhotoList():
|
||||
object = p.getReference()
|
||||
base = os.path.basename(object.getPath())
|
||||
try:
|
||||
g = open(object.getPath(),"rb")
|
||||
t.add_file(base,mtime,g)
|
||||
g.close()
|
||||
except:
|
||||
pass
|
||||
for f in database.getPlaceMap().values():
|
||||
for p in f.getPhotoList():
|
||||
object = p.getReference()
|
||||
base = os.path.basename(object.getPath())
|
||||
try:
|
||||
g = open(object.getPath(),"rb")
|
||||
t.add_file(base,mtime,g)
|
||||
g.close()
|
||||
except:
|
||||
pass
|
||||
|
||||
t.close()
|
||||
for f in self.db.getPersonMap().values():
|
||||
for p in f.getPhotoList():
|
||||
object = p.getReference()
|
||||
base = os.path.basename(object.getPath())
|
||||
try:
|
||||
g = open(object.getPath(),"rb")
|
||||
t.add_file(base,mtime,g)
|
||||
g.close()
|
||||
except:
|
||||
pass
|
||||
for f in self.db.getFamilyMap().values():
|
||||
for p in f.getPhotoList():
|
||||
object = p.getReference()
|
||||
base = os.path.basename(object.getPath())
|
||||
try:
|
||||
g = open(object.getPath(),"rb")
|
||||
t.add_file(base,mtime,g)
|
||||
g.close()
|
||||
except:
|
||||
pass
|
||||
for f in self.db.getSourceMap().values():
|
||||
for p in f.getPhotoList():
|
||||
object = p.getReference()
|
||||
base = os.path.basename(object.getPath())
|
||||
try:
|
||||
g = open(object.getPath(),"rb")
|
||||
t.add_file(base,mtime,g)
|
||||
g.close()
|
||||
except:
|
||||
pass
|
||||
for f in self.db.getPlaceMap().values():
|
||||
for p in f.getPhotoList():
|
||||
object = p.getReference()
|
||||
base = os.path.basename(object.getPath())
|
||||
try:
|
||||
g = open(object.getPath(),"rb")
|
||||
t.add_file(base,mtime,g)
|
||||
g.close()
|
||||
except:
|
||||
pass
|
||||
t.close()
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
# Register the plugin
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from Plugins import register_export
|
||||
|
||||
+52
-42
@@ -31,49 +31,59 @@ from gnome.ui import *
|
||||
from libglade import *
|
||||
|
||||
def report(database,person):
|
||||
text = ""
|
||||
base = os.path.dirname(__file__)
|
||||
glade_file = base + os.sep + "summary.glade"
|
||||
topDialog = GladeXML(glade_file,"summary")
|
||||
topDialog.signal_autoconnect({
|
||||
"destroy_passed_object" : Utils.destroy_passed_object,
|
||||
})
|
||||
thisgen = []
|
||||
allgen = []
|
||||
thisgen.append(person)
|
||||
title = _("Number of ancestors of \"%s\" by generation") % person.getPrimaryName().getName()
|
||||
text = text + title + ':\n'
|
||||
thisgensize=1
|
||||
gen=1
|
||||
while thisgensize>0:
|
||||
thisgensize=0
|
||||
if len(thisgen) >0:
|
||||
thisgensize=len(thisgen)
|
||||
gen= gen-1
|
||||
if thisgensize == 1 :
|
||||
text = text + _("Generation %d has 1 individual.\n") % (gen)
|
||||
else:
|
||||
text = text + _("Generation %d has %d individuals.\n") % (gen, thisgensize)
|
||||
temp = thisgen
|
||||
thisgen = []
|
||||
for person in temp:
|
||||
family = person.getMainParents()
|
||||
if family != None:
|
||||
father = family.getFather()
|
||||
mother = family.getMother()
|
||||
if father != None:
|
||||
thisgen.append(father)
|
||||
if mother != None:
|
||||
thisgen.append(mother)
|
||||
allgen = allgen + thisgen
|
||||
|
||||
text = text + _("Total ancestors in generations %d to -1 is %d .\n") % (gen, len(allgen))
|
||||
try:
|
||||
CountAncestors(database,person)
|
||||
except:
|
||||
import DisplayTrace
|
||||
DisplayTrace.DisplayTrace()
|
||||
|
||||
top = topDialog.get_widget("summary")
|
||||
textwindow = topDialog.get_widget("textwindow")
|
||||
topDialog.get_widget("summaryTitle").set_text(title)
|
||||
textwindow.show_string(text)
|
||||
top.show()
|
||||
class CountAncestors:
|
||||
|
||||
def __init__(self,database,person):
|
||||
|
||||
text = ""
|
||||
base = os.path.dirname(__file__)
|
||||
glade_file = base + os.sep + "summary.glade"
|
||||
topDialog = GladeXML(glade_file,"summary")
|
||||
topDialog.signal_autoconnect({
|
||||
"destroy_passed_object" : Utils.destroy_passed_object,
|
||||
})
|
||||
thisgen = []
|
||||
allgen = []
|
||||
thisgen.append(person)
|
||||
title = _("Number of ancestors of \"%s\" by generation") % person.getPrimaryName().getName()
|
||||
text = text + title + ':\n'
|
||||
thisgensize=1
|
||||
gen=1
|
||||
while thisgensize>0:
|
||||
thisgensize=0
|
||||
if len(thisgen) >0:
|
||||
thisgensize=len(thisgen)
|
||||
gen= gen-1
|
||||
if thisgensize == 1 :
|
||||
text = text + _("Generation %d has 1 individual.\n") % (gen)
|
||||
else:
|
||||
text = text + _("Generation %d has %d individuals.\n") % (gen, thisgensize)
|
||||
temp = thisgen
|
||||
thisgen = []
|
||||
for person in temp:
|
||||
family = person.getMainParents()
|
||||
if family != None:
|
||||
father = family.getFather()
|
||||
mother = family.getMother()
|
||||
if father != None:
|
||||
thisgen.append(father)
|
||||
if mother != None:
|
||||
thisgen.append(mother)
|
||||
allgen = allgen + thisgen
|
||||
|
||||
text = text + _("Total ancestors in generations %d to -1 is %d .\n") % (gen, len(allgen))
|
||||
|
||||
top = topDialog.get_widget("summary")
|
||||
textwindow = topDialog.get_widget("textwindow")
|
||||
topDialog.get_widget("summaryTitle").set_text(title)
|
||||
textwindow.show_string(text)
|
||||
top.show()
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user