* src/GrampsInMemDB.py: handle null handle
* src/GrampsXMLDB.py: disable undo during normal read of database * src/ReadGedcom.py: handle lines shorter than 50 lines, disable undo during normal reads of the database * src/ReadXML.py: disable undo during normal read of databas * src/RelLib.py: revert Name.__cmp__ to Name.is_equal * src/docgen/HTMLDoc.py: drop deprecated gnome.ui dialogs svn: r3617
This commit is contained in:
parent
695a98eff6
commit
72024c566d
@ -1,3 +1,12 @@
|
|||||||
|
2004-10-10 Don Allingham <dallingham@users.sourceforge.net>
|
||||||
|
* src/GrampsInMemDB.py: handle null handle
|
||||||
|
* src/GrampsXMLDB.py: disable undo during normal read of database
|
||||||
|
* src/ReadGedcom.py: handle lines shorter than 50 lines, disable undo during
|
||||||
|
normal reads of the database
|
||||||
|
* src/ReadXML.py: disable undo during normal read of databas
|
||||||
|
* src/RelLib.py: revert Name.__cmp__ to Name.is_equal
|
||||||
|
* src/docgen/HTMLDoc.py: drop deprecated gnome.ui dialogs
|
||||||
|
|
||||||
2004-10-10 Eero Tamminen <eerot@sf>
|
2004-10-10 Eero Tamminen <eerot@sf>
|
||||||
* TestPlan.txt: Add test for reports like in stable version
|
* TestPlan.txt: Add test for reports like in stable version
|
||||||
|
|
||||||
|
@ -41,14 +41,15 @@ class GrampsGEDDB(GrampsInMemDB):
|
|||||||
|
|
||||||
def load(self,name,callback):
|
def load(self,name,callback):
|
||||||
self.filename = name
|
self.filename = name
|
||||||
ReadGedcom.importData(self,name)
|
ReadGedcom.importData(self,name,use_trans=False)
|
||||||
|
|
||||||
self.bookmarks = self.metadata.get('bookmarks')
|
self.bookmarks = self.metadata.get('bookmarks')
|
||||||
if self.bookmarks == None:
|
if self.bookmarks == None:
|
||||||
self.bookmarks = []
|
self.bookmarks = []
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
writer = WriteGedcom.GedcomWriter(self,self.get_default_person())
|
if len(self.undodb) > 0:
|
||||||
writer.export_data(self.filename)
|
writer = WriteGedcom.GedcomWriter(self,self.get_default_person())
|
||||||
|
writer.export_data(self.filename)
|
||||||
|
|
||||||
|
@ -138,7 +138,10 @@ class GrampsInMemDB(GrampsDbBase):
|
|||||||
|
|
||||||
def get_person_from_gramps_id(self,val):
|
def get_person_from_gramps_id(self,val):
|
||||||
handle = self.id_trans.get(str(val))
|
handle = self.id_trans.get(str(val))
|
||||||
return self.person_map[handle]
|
if handle:
|
||||||
|
return self.person_map[handle]
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
def get_family_from_gramps_id(self,val):
|
def get_family_from_gramps_id(self,val):
|
||||||
handle = self.fid_trans.get(str(val))
|
handle = self.fid_trans.get(str(val))
|
||||||
|
@ -40,9 +40,10 @@ class GrampsXMLDB(GrampsInMemDB):
|
|||||||
GrampsInMemDB.__init__(self)
|
GrampsInMemDB.__init__(self)
|
||||||
|
|
||||||
def load(self,name,callback):
|
def load(self,name,callback):
|
||||||
|
self.filename = name
|
||||||
self.id_trans = {}
|
self.id_trans = {}
|
||||||
|
|
||||||
ReadXML.importData(self,name)
|
ReadXML.importData(self,name,use_trans=False)
|
||||||
|
|
||||||
self.bookmarks = self.metadata.get('bookmarks')
|
self.bookmarks = self.metadata.get('bookmarks')
|
||||||
if self.bookmarks == None:
|
if self.bookmarks == None:
|
||||||
@ -50,5 +51,6 @@ class GrampsXMLDB(GrampsInMemDB):
|
|||||||
return 1
|
return 1
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
WriteXML.quick_write(self,self.filename)
|
if len(self.undodb) > 0:
|
||||||
|
WriteXML.quick_write(self,self.filename)
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ spanRegexp = re.compile(r"\s*FROM\s+@#D([^@]+)@\s*(.*)\s+TO\s+@#D([^@]+)@\s*(.*)
|
|||||||
#
|
#
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
def importData(database, filename, cb=None):
|
def importData(database, filename, cb=None, use_trans=True):
|
||||||
|
|
||||||
global callback
|
global callback
|
||||||
|
|
||||||
@ -131,6 +131,8 @@ def importData(database, filename, cb=None):
|
|||||||
gramps = False
|
gramps = False
|
||||||
for index in range(0,50):
|
for index in range(0,50):
|
||||||
line = f.readline().split()
|
line = f.readline().split()
|
||||||
|
if len(line) == 0:
|
||||||
|
break
|
||||||
if line[1] == 'CHAR' and line[2] == "ANSEL":
|
if line[1] == 'CHAR' and line[2] == "ANSEL":
|
||||||
ansel = True
|
ansel = True
|
||||||
if line[1] == 'SOUR' and line[2] == "GRAMPS":
|
if line[1] == 'SOUR' and line[2] == "GRAMPS":
|
||||||
@ -148,10 +150,10 @@ def importData(database, filename, cb=None):
|
|||||||
dialog.destroy()
|
dialog.destroy()
|
||||||
else:
|
else:
|
||||||
codeset = None
|
codeset = None
|
||||||
import2(database, filename, cb, codeset)
|
import2(database, filename, cb, codeset, use_trans)
|
||||||
|
|
||||||
|
|
||||||
def import2(database, filename, cb, codeset):
|
def import2(database, filename, cb, codeset, use_trans):
|
||||||
# add some checking here
|
# add some checking here
|
||||||
|
|
||||||
glade_file = "%s/gedcomimport.glade" % os.path.dirname(__file__)
|
glade_file = "%s/gedcomimport.glade" % os.path.dirname(__file__)
|
||||||
@ -181,7 +183,7 @@ def import2(database, filename, cb, codeset):
|
|||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
close = g.parse_gedcom_file()
|
close = g.parse_gedcom_file(use_trans)
|
||||||
g.resolve_refns()
|
g.resolve_refns()
|
||||||
except IOError,msg:
|
except IOError,msg:
|
||||||
Utils.destroy_passed_object(statusWindow)
|
Utils.destroy_passed_object(statusWindow)
|
||||||
@ -422,9 +424,12 @@ class GedcomParser:
|
|||||||
def backup(self):
|
def backup(self):
|
||||||
self.backoff = 1
|
self.backoff = 1
|
||||||
|
|
||||||
def parse_gedcom_file(self):
|
def parse_gedcom_file(self,use_trans=True):
|
||||||
|
|
||||||
self.trans = self.db.transaction_begin()
|
if use_trans:
|
||||||
|
self.trans = self.db.transaction_begin()
|
||||||
|
else:
|
||||||
|
self.trans = None
|
||||||
t = time.time()
|
t = time.time()
|
||||||
self.index = 0
|
self.index = 0
|
||||||
self.fam_count = 0
|
self.fam_count = 0
|
||||||
@ -445,7 +450,8 @@ class GedcomParser:
|
|||||||
t = time.time() - t
|
t = time.time() - t
|
||||||
msg = _('Import Complete: %d seconds') % t
|
msg = _('Import Complete: %d seconds') % t
|
||||||
|
|
||||||
self.db.transaction_commit(self.trans,_("GEDCOM import"))
|
if use_trans:
|
||||||
|
self.db.transaction_commit(self.trans,_("GEDCOM import"))
|
||||||
|
|
||||||
if self.window:
|
if self.window:
|
||||||
self.infomsg("\n%s" % msg)
|
self.infomsg("\n%s" % msg)
|
||||||
|
@ -67,7 +67,7 @@ _FAMILY_TRANS = {
|
|||||||
# Must takes care of renaming media files according to their new IDs.
|
# Must takes care of renaming media files according to their new IDs.
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
def importData(database, filename, callback=None,cl=0):
|
def importData(database, filename, callback=None,cl=0,use_trans=True):
|
||||||
|
|
||||||
filename = os.path.normpath(filename)
|
filename = os.path.normpath(filename)
|
||||||
basefile = os.path.dirname(filename)
|
basefile = os.path.dirname(filename)
|
||||||
@ -112,7 +112,7 @@ def importData(database, filename, callback=None,cl=0):
|
|||||||
ErrorDialog(_("%s could not be opened") % filename)
|
ErrorDialog(_("%s could not be opened") % filename)
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
parser.parse(xml_file)
|
parser.parse(xml_file,use_trans)
|
||||||
except IOError,msg:
|
except IOError,msg:
|
||||||
if cl:
|
if cl:
|
||||||
print "Error reading %s" % filename
|
print "Error reading %s" % filename
|
||||||
@ -435,7 +435,7 @@ class GrampsParser:
|
|||||||
person = RelLib.Person()
|
person = RelLib.Person()
|
||||||
person.set_handle(intid)
|
person.set_handle(intid)
|
||||||
person.set_gramps_id(gramps_id)
|
person.set_gramps_id(gramps_id)
|
||||||
self.db.add_person(person,self.trans)
|
self.db.add_person(person,None)
|
||||||
self.gid2id[gramps_id] = intid
|
self.gid2id[gramps_id] = intid
|
||||||
return person
|
return person
|
||||||
|
|
||||||
@ -448,7 +448,7 @@ class GrampsParser:
|
|||||||
family = RelLib.Family()
|
family = RelLib.Family()
|
||||||
family.set_handle(intid)
|
family.set_handle(intid)
|
||||||
family.set_gramps_id(gramps_id)
|
family.set_gramps_id(gramps_id)
|
||||||
self.db.add_family(family,self.trans)
|
self.db.add_family(family,None)
|
||||||
self.gid2fid[gramps_id] = intid
|
self.gid2fid[gramps_id] = intid
|
||||||
return family
|
return family
|
||||||
|
|
||||||
@ -461,7 +461,7 @@ class GrampsParser:
|
|||||||
place = RelLib.Place()
|
place = RelLib.Place()
|
||||||
place.set_handle(intid)
|
place.set_handle(intid)
|
||||||
place.set_gramps_id(gramps_id)
|
place.set_gramps_id(gramps_id)
|
||||||
self.db.add_place(place,self.trans)
|
self.db.add_place(place,None)
|
||||||
self.gid2pid[gramps_id] = intid
|
self.gid2pid[gramps_id] = intid
|
||||||
return place
|
return place
|
||||||
|
|
||||||
@ -474,7 +474,7 @@ class GrampsParser:
|
|||||||
source = RelLib.Source()
|
source = RelLib.Source()
|
||||||
source.set_handle(intid)
|
source.set_handle(intid)
|
||||||
source.set_gramps_id(gramps_id)
|
source.set_gramps_id(gramps_id)
|
||||||
self.db.add_source(source,self.trans)
|
self.db.add_source(source,None)
|
||||||
self.gid2sid[gramps_id] = intid
|
self.gid2sid[gramps_id] = intid
|
||||||
return source
|
return source
|
||||||
|
|
||||||
@ -487,7 +487,7 @@ class GrampsParser:
|
|||||||
obj = RelLib.MediaObject()
|
obj = RelLib.MediaObject()
|
||||||
obj.set_handle(intid)
|
obj.set_handle(intid)
|
||||||
obj.set_gramps_id(gramps_id)
|
obj.set_gramps_id(gramps_id)
|
||||||
self.db.add_object(obj,self.trans)
|
self.db.add_object(obj,None)
|
||||||
self.gid2oid[gramps_id] = intid
|
self.gid2oid[gramps_id] = intid
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
@ -531,8 +531,11 @@ class GrampsParser:
|
|||||||
self.oidswap[handle] = handle
|
self.oidswap[handle] = handle
|
||||||
return self.oidswap[handle]
|
return self.oidswap[handle]
|
||||||
|
|
||||||
def parse(self,file):
|
def parse(self,file,use_trans=True):
|
||||||
self.trans = self.db.transaction_begin()
|
if use_trans:
|
||||||
|
self.trans = self.db.transaction_begin()
|
||||||
|
else:
|
||||||
|
self.trans = None
|
||||||
p = xml.parsers.expat.ParserCreate()
|
p = xml.parsers.expat.ParserCreate()
|
||||||
p.StartElementHandler = self.startElement
|
p.StartElementHandler = self.startElement
|
||||||
p.EndElementHandler = self.endElement
|
p.EndElementHandler = self.endElement
|
||||||
@ -554,7 +557,8 @@ class GrampsParser:
|
|||||||
del self.func_map
|
del self.func_map
|
||||||
del self.func_list
|
del self.func_list
|
||||||
del p
|
del p
|
||||||
self.db.transaction_commit(self.trans,_("GRAMPS XML import"))
|
if use_trans:
|
||||||
|
self.db.transaction_commit(self.trans,_("GRAMPS XML import"))
|
||||||
|
|
||||||
def start_lds_ord(self,attrs):
|
def start_lds_ord(self,attrs):
|
||||||
atype = attrs['type']
|
atype = attrs['type']
|
||||||
@ -702,17 +706,13 @@ class GrampsParser:
|
|||||||
self.db.bookmarks.append(person.get_handle())
|
self.db.bookmarks.append(person.get_handle())
|
||||||
|
|
||||||
def start_person(self,attrs):
|
def start_person(self,attrs):
|
||||||
if self.callback != None and self.count % self.increment == 0:
|
|
||||||
self.callback(float(self.count)/float(self.entries))
|
|
||||||
self.count = self.count + 1
|
|
||||||
|
|
||||||
new_id = self.map_gid(attrs['id'])
|
new_id = self.map_gid(attrs['id'])
|
||||||
try:
|
try:
|
||||||
self.person = self.db.find_person_from_handle(attrs['handle'],self.trans)
|
self.person = self.db.find_person_from_handle(attrs['handle'],self.trans)
|
||||||
self.person.set_gramps_id(new_id)
|
self.person.set_gramps_id(new_id)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
self.person = self.find_person_by_gramps_id(new_id)
|
self.person = self.find_person_by_gramps_id(new_id)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.person.set_complete_flag(int(attrs['complete']))
|
self.person.set_complete_flag(int(attrs['complete']))
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
@ -1958,38 +1958,38 @@ class Name(DataObj):
|
|||||||
else:
|
else:
|
||||||
return "%s %s, %s" % (first, self.surname.upper(), self.suffix)
|
return "%s %s, %s" % (first, self.surname.upper(), self.suffix)
|
||||||
|
|
||||||
def __cmp__(self,other):
|
def is_equal(self,other):
|
||||||
"""
|
"""
|
||||||
compares to names to see if they are equal, return 0 if they
|
compares to names to see if they are equal, return 0 if they
|
||||||
are not
|
are not
|
||||||
"""
|
"""
|
||||||
if self.first_name != other.first_name:
|
if self.first_name != other.first_name:
|
||||||
return 1
|
return False
|
||||||
if self.surname != other.surname:
|
if self.surname != other.surname:
|
||||||
return 1
|
return False
|
||||||
if self.patronymic != other.patronymic:
|
if self.patronymic != other.patronymic:
|
||||||
return 1
|
return False
|
||||||
if self.prefix != other.prefix:
|
if self.prefix != other.prefix:
|
||||||
return 1
|
return False
|
||||||
if self.suffix != other.suffix:
|
if self.suffix != other.suffix:
|
||||||
return 1
|
return False
|
||||||
if self.title != other.title:
|
if self.title != other.title:
|
||||||
return 1
|
return False
|
||||||
if self.type != other.type:
|
if self.type != other.type:
|
||||||
return 1
|
return False
|
||||||
if self.private != other.private:
|
if self.private != other.private:
|
||||||
return 1
|
return False
|
||||||
if self.get_note() != other.get_note():
|
if self.get_note() != other.get_note():
|
||||||
return 1
|
return False
|
||||||
if len(self.get_source_references()) != len(other.get_source_references()):
|
if len(self.get_source_references()) != len(other.get_source_references()):
|
||||||
return 1
|
return False
|
||||||
index = 0
|
index = 0
|
||||||
olist = other.get_source_references()
|
olist = other.get_source_references()
|
||||||
for a in self.get_source_references():
|
for a in self.get_source_references():
|
||||||
if not a.are_equal(olist[index]):
|
if not a.are_equal(olist[index]):
|
||||||
return True
|
return True
|
||||||
index += 1
|
index += 1
|
||||||
return 0
|
return True
|
||||||
|
|
||||||
class Url:
|
class Url:
|
||||||
"""Contains information related to internet Uniform Resource Locators,
|
"""Contains information related to internet Uniform Resource Locators,
|
||||||
|
@ -137,7 +137,6 @@ class XmlWriter:
|
|||||||
"""
|
"""
|
||||||
Write the database to the specified file.
|
Write the database to the specified file.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
base = os.path.dirname(filename)
|
base = os.path.dirname(filename)
|
||||||
if os.path.isdir(base):
|
if os.path.isdir(base):
|
||||||
if not os.access(base,os.W_OK) or not os.access(base,os.R_OK):
|
if not os.access(base,os.W_OK) or not os.access(base,os.R_OK):
|
||||||
|
@ -25,7 +25,6 @@ import string
|
|||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import gnome.ui
|
|
||||||
import Plugins
|
import Plugins
|
||||||
import ImgManip
|
import ImgManip
|
||||||
import TarFile
|
import TarFile
|
||||||
@ -157,7 +156,7 @@ class HtmlDoc(BaseDoc.BaseDoc):
|
|||||||
|
|
||||||
if top_add == 1:
|
if top_add == 1:
|
||||||
mymsg = _("The marker '<!-- START -->' was not in the template")
|
mymsg = _("The marker '<!-- START -->' was not in the template")
|
||||||
gnome.ui.GnomeErrorDialog(mymsg)
|
QuestionDialog.ErrorDialog(_("Template Error"),mymsg)
|
||||||
|
|
||||||
def load_html(self):
|
def load_html(self):
|
||||||
start = re.compile(r"<!--\s*START\s*-->")
|
start = re.compile(r"<!--\s*START\s*-->")
|
||||||
@ -182,7 +181,7 @@ class HtmlDoc(BaseDoc.BaseDoc):
|
|||||||
|
|
||||||
if top_add == 1:
|
if top_add == 1:
|
||||||
mymsg = _("The marker '<!-- START -->' was not in the template")
|
mymsg = _("The marker '<!-- START -->' was not in the template")
|
||||||
gnome.ui.GnomeErrorDialog(mymsg)
|
QuestionDilaog.ErrorDialog(_("Template Error"),mymsg)
|
||||||
|
|
||||||
def load_template(self):
|
def load_template(self):
|
||||||
if self.template:
|
if self.template:
|
||||||
|
@ -29,7 +29,6 @@
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
import os
|
import os
|
||||||
import cStringIO
|
import cStringIO
|
||||||
import shutil
|
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
@ -186,6 +185,8 @@ class CheckIntegrity:
|
|||||||
self.bad_photo.append(ObjectId)
|
self.bad_photo.append(ObjectId)
|
||||||
|
|
||||||
def fs_ok_clicked(obj):
|
def fs_ok_clicked(obj):
|
||||||
|
import shutil
|
||||||
|
|
||||||
name = fs_top.get_filename()
|
name = fs_top.get_filename()
|
||||||
if os.path.isfile(name):
|
if os.path.isfile(name):
|
||||||
shutil.copyfile(name,photo_name)
|
shutil.copyfile(name,photo_name)
|
||||||
|
@ -38,7 +38,6 @@ from cStringIO import StringIO
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
import gtk
|
import gtk
|
||||||
import gtk.glade
|
import gtk.glade
|
||||||
import gnome
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
Loading…
Reference in New Issue
Block a user