* src/GrampsBSDDB.py: increase cachesize
* src/ReadGedcom.py: increment source count * src/gedcomimport.glade: increment source count * src/DateDisplay.py: handle BC * src/DateParser.py: handle BC * src/GrampsInMemDB.py: handle missing handles in find functions * src/ReadGedcom.py: handle BC * src/WriteGedcom.py: handle BC * src/ReadXML.py: handle BC svn: r3634
This commit is contained in:
parent
573df793ed
commit
9ae62cfe7d
@ -1,3 +1,14 @@
|
||||
2004-10-15 Don Allingham <dallingham@users.sourceforge.net>
|
||||
* src/GrampsBSDDB.py: increase cachesize
|
||||
* src/ReadGedcom.py: increment source count
|
||||
* src/gedcomimport.glade: increment source count
|
||||
* src/DateDisplay.py: handle BC
|
||||
* src/DateParser.py: handle BC
|
||||
* src/GrampsInMemDB.py: handle missing handles in find functions
|
||||
* src/ReadGedcom.py: handle BC
|
||||
* src/WriteGedcom.py: handle BC
|
||||
* src/ReadXML.py: handle BC
|
||||
|
||||
2004-10-13 Don Allingham <dallingham@users.sourceforge.net>
|
||||
* src/docgen/OpenOfficeDoc.py: incorporated Julio Sanchez's
|
||||
language patch
|
||||
|
@ -495,6 +495,12 @@
|
||||
2 DATE 10 JUL 1996
|
||||
2 PLAC Community Presbyterian Church, Danville, CA
|
||||
1 FAMC @F01@
|
||||
0 @I43@ INDI
|
||||
1 NAME Really Old /Guy/
|
||||
1 SEX M
|
||||
1 BIRT
|
||||
2 DATE 26 JUN 34 B.C.
|
||||
2 PLAC Hayward, Alameda Co., CA
|
||||
0 @F01@ FAM
|
||||
1 HUSB @I01@
|
||||
1 WIFE @I40@
|
||||
|
@ -194,10 +194,15 @@ class DateDisplay:
|
||||
return "%s%s%s%s" % (qual_str,self._mod_str[mod],text,self.calendar[cal])
|
||||
|
||||
def _slash_year(self,val,slash):
|
||||
bc = ""
|
||||
if val < 0:
|
||||
val = - val
|
||||
bc = " B.C.E"
|
||||
|
||||
if slash:
|
||||
return "%d/%d" % (val,(val%10)+1)
|
||||
return "%d/%d%s" % (val,(val%10)+1,bc)
|
||||
else:
|
||||
return str(val)
|
||||
return "%d%s" % (val,bc)
|
||||
|
||||
def _display_gregorian(self,date_val):
|
||||
year = self._slash_year(date_val[2],date_val[3])
|
||||
|
@ -158,6 +158,7 @@ class DateParser:
|
||||
"Bahman" : 11, "Esfand" : 12,
|
||||
}
|
||||
|
||||
bce = ["BC", "B\.C", "B\.C\.", "BCE", "B\.C\.E", "B\.C\.E"]
|
||||
|
||||
calendar_to_int = {
|
||||
'gregorian' : Date.CAL_GREGORIAN,
|
||||
@ -186,7 +187,9 @@ class DateParser:
|
||||
|
||||
_rfc_mon_str = '(' + '|'.join(_rfc_mons_to_int.keys()) + ')'
|
||||
_rfc_day_str = '(' + '|'.join(_rfc_days) + ')'
|
||||
|
||||
|
||||
_bce_str = '(' + '|'.join(bce) + ')'
|
||||
|
||||
_qual_str = '(' + '|'.join(
|
||||
[ key.replace('.','\.') for key in quality_to_int.keys() ]
|
||||
) + ')'
|
||||
@ -199,6 +202,8 @@ class DateParser:
|
||||
_pmon_str = '(' + '|'.join(persian_to_int.keys()) + ')'
|
||||
_cal_str = '(' + '|'.join(calendar_to_int.keys()) + ')'
|
||||
_imon_str = '(' + '|'.join(islamic_to_int.keys()) + ')'
|
||||
|
||||
_bce_re = re.compile("(.+)\s+%s" % _bce_str)
|
||||
|
||||
_cal = re.compile("(.+)\s\(%s\)" % _cal_str,
|
||||
re.IGNORECASE)
|
||||
@ -428,12 +433,21 @@ class DateParser:
|
||||
(d0,m,y,s,d1,m,y,s))
|
||||
return
|
||||
|
||||
match = self._bce_re.match(text)
|
||||
bc = False
|
||||
if match:
|
||||
text = match.groups()[0]
|
||||
bc = True
|
||||
|
||||
match = self._modifier.match(text)
|
||||
if match:
|
||||
grps = match.groups()
|
||||
start = self._parse_subdate(grps[1])
|
||||
mod = self.modifier_to_int.get(grps[0].lower(),Date.MOD_NONE)
|
||||
date.set(qual,mod,cal,start)
|
||||
if bc:
|
||||
date.set(qual,mod,cal,self.invert_year(start))
|
||||
else:
|
||||
date.set(qual,mod,cal,start)
|
||||
return
|
||||
|
||||
subdate = self._parse_subdate(text)
|
||||
@ -456,9 +470,15 @@ class DateParser:
|
||||
cal = Date.CAL_PERSIAN
|
||||
else:
|
||||
cal = Date.CAL_HEBREW
|
||||
|
||||
date.set(qual,Date.MOD_NONE,cal,subdate)
|
||||
|
||||
if bc:
|
||||
date.set(qual,Date.MOD_NONE,cal,self.invert_year(subdate))
|
||||
else:
|
||||
date.set(qual,Date.MOD_NONE,cal,subdate)
|
||||
|
||||
def invert_year(self,subdate):
|
||||
return (subdate[0],subdate[1],-subdate[2],subdate[3])
|
||||
|
||||
def parse(self,text):
|
||||
"""
|
||||
Parses the text, returning a Date object.
|
||||
|
@ -58,20 +58,20 @@ class GrampsBSDDB(GrampsDbBase):
|
||||
self.close()
|
||||
|
||||
self.env = db.DBEnv()
|
||||
self.env.set_cachesize(0,4*1024*1024) # 2MB
|
||||
self.env.set_cachesize(0,0x2000000) # 2MB
|
||||
flags = db.DB_CREATE|db.DB_INIT_MPOOL|db.DB_PRIVATE
|
||||
|
||||
self.undolog = "%s.log" % name
|
||||
self.env.open(os.path.dirname(name), flags)
|
||||
|
||||
name = os.path.basename(name)
|
||||
self.person_map = dbshelve.open(name, dbname="person", dbenv=self.env)
|
||||
self.family_map = dbshelve.open(name, dbname="family", dbenv=self.env)
|
||||
self.place_map = dbshelve.open(name, dbname="places", dbenv=self.env)
|
||||
self.source_map = dbshelve.open(name, dbname="sources",dbenv=self.env)
|
||||
self.media_map = dbshelve.open(name, dbname="media", dbenv=self.env)
|
||||
self.event_map = dbshelve.open(name, dbname="events", dbenv=self.env)
|
||||
self.metadata = dbshelve.open(name, dbname="meta", dbenv=self.env)
|
||||
self.person_map = dbshelve.open(name, dbname="person", dbenv=self.env)
|
||||
|
||||
self.surnames = db.DB(self.env)
|
||||
self.surnames.set_flags(db.DB_DUP)
|
||||
|
@ -148,16 +148,28 @@ class GrampsInMemDB(GrampsDbBase):
|
||||
|
||||
def get_family_from_gramps_id(self,val):
|
||||
handle = self.fid_trans.get(str(val))
|
||||
return self.family_map[handle]
|
||||
if handle:
|
||||
return self.family_map[handle]
|
||||
else:
|
||||
return None
|
||||
|
||||
def get_place_from_gramps_id(self,val):
|
||||
handle = self.pid_trans.get(str(val))
|
||||
return self.place_map[handle]
|
||||
if handle:
|
||||
return self.place_map[handle]
|
||||
else:
|
||||
return None
|
||||
|
||||
def get_source_from_gramps_id(self,val):
|
||||
handle = self.sid_trans.get(str(val))
|
||||
return self.source_map[handle]
|
||||
if handle:
|
||||
return self.source_map[handle]
|
||||
else:
|
||||
return None
|
||||
|
||||
def get_object_from_gramps_id(self,val):
|
||||
handle = self.oid_trans.get(str(val))
|
||||
return self.media_map[handle]
|
||||
if handle:
|
||||
return self.media_map[handle]
|
||||
else:
|
||||
return None
|
||||
|
@ -124,7 +124,7 @@ spanRegexp = re.compile(r"\s*FROM\s+@#D([^@]+)@\s*(.*)\s+TO\s+@#D([^@]+)@\s*(.*)
|
||||
def importData(database, filename, cb=None, use_trans=True):
|
||||
|
||||
global callback
|
||||
|
||||
|
||||
f = open(filename,"r")
|
||||
|
||||
ansel = False
|
||||
@ -285,6 +285,7 @@ class GedcomParser:
|
||||
self.version_obj = window.get_widget("version")
|
||||
self.families_obj = window.get_widget("families")
|
||||
self.people_obj = window.get_widget("people")
|
||||
self.source_obj = window.get_widget("sources")
|
||||
self.errors_obj = window.get_widget("errors")
|
||||
self.close_done = window.get_widget('close_done')
|
||||
self.error_text_obj = window.get_widget("error_text")
|
||||
@ -434,6 +435,7 @@ class GedcomParser:
|
||||
self.index = 0
|
||||
self.fam_count = 0
|
||||
self.indi_count = 0
|
||||
self.source_count = 0
|
||||
try:
|
||||
self.parse_header()
|
||||
self.parse_submitter()
|
||||
@ -575,6 +577,8 @@ class GedcomParser:
|
||||
elif matches[1] in ["SUBM","SUBN","OBJE","_EVENT_DEFN"]:
|
||||
self.ignore_sub_junk(1)
|
||||
elif matches[2] == "SOUR":
|
||||
if self.source_count % UPDATE == 0 and self.window:
|
||||
self.update(self.source_obj,str(self.source_count))
|
||||
self.parse_source(matches[1],1)
|
||||
elif matches[2][0:4] == "NOTE":
|
||||
if self.nmap.has_key(matches[1]):
|
||||
@ -1811,7 +1815,8 @@ class GedcomParser:
|
||||
dateobj.set_calendar(Date.CAL_HEBREW)
|
||||
return dateobj
|
||||
else:
|
||||
return self.dp.parse(text)
|
||||
dval = self.dp.parse(text)
|
||||
return dval
|
||||
except IOError:
|
||||
return self.dp.set_text(text)
|
||||
|
||||
|
@ -776,7 +776,7 @@ class GrampsParser:
|
||||
self.family.set_gramps_id(handle)
|
||||
except KeyError:
|
||||
self.family = self.find_family_by_gramps_id(handle)
|
||||
|
||||
|
||||
if attrs.has_key("type"):
|
||||
self.family.set_relationship(_FAMILY_TRANS.get(attrs["type"],
|
||||
const.FAMILY_UNKNOWN))
|
||||
@ -1017,10 +1017,15 @@ class GrampsParser:
|
||||
else:
|
||||
dv = self.event.get_date_object()
|
||||
|
||||
start = attrs['val'].split('-')
|
||||
bc = 1
|
||||
val = attrs['val']
|
||||
if val[0] == '-':
|
||||
bc = -1
|
||||
val = val[1:]
|
||||
start = val.split('-')
|
||||
|
||||
try:
|
||||
y = int(start[0])
|
||||
y = int(start[0])*bc
|
||||
except:
|
||||
y = 0
|
||||
|
||||
|
@ -221,30 +221,36 @@ def make_date(subdate,calendar,mode):
|
||||
(day,mon,year,sl) = subdate
|
||||
|
||||
(mmap,prefix) = _calmap.get(calendar,(_month,""))
|
||||
|
||||
if year < 0:
|
||||
year = -year
|
||||
bc = " B.C."
|
||||
else:
|
||||
bc = ""
|
||||
|
||||
if day == 0:
|
||||
try:
|
||||
if mon == 0:
|
||||
retval = '%d' % year
|
||||
retval = '%d%s' % (year,bc)
|
||||
elif year == 0:
|
||||
retval = '(%s)' % mmap[mon]
|
||||
else:
|
||||
retval = "%s %d" % (mmap[mon],year)
|
||||
retval = "%s %d%s" % (mmap[mon],year,bc)
|
||||
except IndexError:
|
||||
print "Month index error - %d" % mon
|
||||
retval = '%d' % year
|
||||
retval = '%d%s' % (year,bc)
|
||||
elif mon == 0:
|
||||
retval = '%d' % year
|
||||
retval = '%d%s' % (year,bc)
|
||||
else:
|
||||
try:
|
||||
month = mmap[mon]
|
||||
if year == 0:
|
||||
retval = "(%d %s)" % (day,month)
|
||||
else:
|
||||
retval = "%d %s %d" % (day,month,year)
|
||||
retval = "%d %s %d%s" % (day,month,year,bc)
|
||||
except IndexError:
|
||||
print "Month index error - %d" % mon
|
||||
retval = str(year)
|
||||
retval = "%d%s" % (year,bc)
|
||||
|
||||
if prefix:
|
||||
retval = "%s %s" % (prefix, retval)
|
||||
|
@ -50,7 +50,7 @@
|
||||
<widget class="GtkTable" id="table1">
|
||||
<property name="border_width">12</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="n_rows">10</property>
|
||||
<property name="n_rows">11</property>
|
||||
<property name="n_columns">5</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="row_spacing">6</property>
|
||||
@ -161,7 +161,7 @@
|
||||
<property name="max_length">0</property>
|
||||
<property name="text" translatable="yes"></property>
|
||||
<property name="has_frame">True</property>
|
||||
<property name="invisible_char" translatable="yes">*</property>
|
||||
<property name="invisible_char">*</property>
|
||||
<property name="activates_default">False</property>
|
||||
</widget>
|
||||
<packing>
|
||||
@ -204,8 +204,8 @@
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">5</property>
|
||||
<property name="top_attach">6</property>
|
||||
<property name="bottom_attach">7</property>
|
||||
<property name="top_attach">7</property>
|
||||
<property name="bottom_attach">8</property>
|
||||
<property name="x_options">fill</property>
|
||||
</packing>
|
||||
</child>
|
||||
@ -227,8 +227,8 @@
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">5</property>
|
||||
<property name="top_attach">5</property>
|
||||
<property name="bottom_attach">6</property>
|
||||
<property name="top_attach">6</property>
|
||||
<property name="bottom_attach">7</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
@ -251,8 +251,8 @@
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">5</property>
|
||||
<property name="top_attach">8</property>
|
||||
<property name="bottom_attach">9</property>
|
||||
<property name="top_attach">9</property>
|
||||
<property name="bottom_attach">10</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
@ -290,8 +290,8 @@
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">5</property>
|
||||
<property name="top_attach">9</property>
|
||||
<property name="bottom_attach">10</property>
|
||||
<property name="top_attach">10</property>
|
||||
<property name="bottom_attach">11</property>
|
||||
<property name="x_options">fill</property>
|
||||
</packing>
|
||||
</child>
|
||||
@ -305,7 +305,7 @@
|
||||
<property name="max_length">0</property>
|
||||
<property name="text" translatable="yes"></property>
|
||||
<property name="has_frame">True</property>
|
||||
<property name="invisible_char" translatable="yes">*</property>
|
||||
<property name="invisible_char">*</property>
|
||||
<property name="activates_default">False</property>
|
||||
</widget>
|
||||
<packing>
|
||||
@ -350,7 +350,7 @@
|
||||
<property name="max_length">10</property>
|
||||
<property name="text" translatable="yes"></property>
|
||||
<property name="has_frame">True</property>
|
||||
<property name="invisible_char" translatable="yes">*</property>
|
||||
<property name="invisible_char">*</property>
|
||||
<property name="activates_default">False</property>
|
||||
</widget>
|
||||
<packing>
|
||||
@ -371,7 +371,7 @@
|
||||
<property name="max_length">0</property>
|
||||
<property name="text" translatable="yes"></property>
|
||||
<property name="has_frame">True</property>
|
||||
<property name="invisible_char" translatable="yes">*</property>
|
||||
<property name="invisible_char">*</property>
|
||||
<property name="activates_default">False</property>
|
||||
</widget>
|
||||
<packing>
|
||||
@ -392,7 +392,7 @@
|
||||
<property name="max_length">10</property>
|
||||
<property name="text" translatable="yes"></property>
|
||||
<property name="has_frame">True</property>
|
||||
<property name="invisible_char" translatable="yes">*</property>
|
||||
<property name="invisible_char">*</property>
|
||||
<property name="activates_default">False</property>
|
||||
</widget>
|
||||
<packing>
|
||||
@ -437,7 +437,7 @@
|
||||
<property name="max_length">0</property>
|
||||
<property name="text" translatable="yes"></property>
|
||||
<property name="has_frame">True</property>
|
||||
<property name="invisible_char" translatable="yes">*</property>
|
||||
<property name="invisible_char">*</property>
|
||||
<property name="activates_default">False</property>
|
||||
</widget>
|
||||
<packing>
|
||||
@ -472,6 +472,51 @@
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label20">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Sources:</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkEntry" id="sources">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="editable">False</property>
|
||||
<property name="visibility">True</property>
|
||||
<property name="max_length">0</property>
|
||||
<property name="text" translatable="yes"></property>
|
||||
<property name="has_frame">True</property>
|
||||
<property name="invisible_char">*</property>
|
||||
<property name="activates_default">False</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="right_attach">3</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
|
Loading…
Reference in New Issue
Block a user