Skip to content

Commit cca8e9d

Browse files
committed
update for GEPS045
merge some fixes from master
1 parent 13e61f5 commit cca8e9d

File tree

5 files changed

+236
-99
lines changed

5 files changed

+236
-99
lines changed

lxml/etreeGramplet.py

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363

6464

6565

66-
NAMESPACE = '{http://gramps-project.org/xml/1.7.1/}'
66+
NAMESPACE = '{http://gramps-project.org/xml/1.8.0/}'
6767

6868
#-------------------------------------------------------------------------
6969
#
@@ -309,21 +309,22 @@ def ParseXML(self, tree, filename):
309309
print('people', self.dbstate.db.get_number_of_people())
310310
print('families', self.dbstate.db.get_number_of_families())
311311
print('sources', self.dbstate.db.get_number_of_sources())
312-
print('citations', self.dbstate.db.get_number_of_citations())
312+
if self.dbstate.db.db_is_open:
313+
print('citations', self.dbstate.db.get_number_of_citations())
313314
print('places', self.dbstate.db.get_number_of_places())
314315
print('objects', self.dbstate.db.get_number_of_media())
315316
print('repositories', self.dbstate.db.get_number_of_repositories())
316317
print('notes', self.dbstate.db.get_number_of_notes())
317318

318-
print('emap', self.dbstate.db.emap_index)
319-
print('pmap', self.dbstate.db.pmap_index)
320-
print('fmap', self.dbstate.db.fmap_index)
321-
print('smap', self.dbstate.db.smap_index)
322-
print('cmap', self.dbstate.db.cmap_index)
323-
print('lmap', self.dbstate.db.lmap_index)
324-
print('omap', self.dbstate.db.omap_index)
325-
print('rmap', self.dbstate.db.rmap_index)
326-
print('nmap', self.dbstate.db.nmap_index)
319+
#print('emap', self.dbstate.db.emap_index)
320+
#print('pmap', self.dbstate.db.pmap_index)
321+
#print('fmap', self.dbstate.db.fmap_index)
322+
#print('smap', self.dbstate.db.smap_index)
323+
#print('cmap', self.dbstate.db.cmap_index)
324+
#print('lmap', self.dbstate.db.lmap_index)
325+
#print('omap', self.dbstate.db.omap_index)
326+
#print('rmap', self.dbstate.db.rmap_index)
327+
#print('nmap', self.dbstate.db.nmap_index)
327328

328329
#print(self.dbstate.db.surname_list)
329330

@@ -475,10 +476,17 @@ def counters(self, time, entries, tags, events, people, families, sources, citat
475476
tag = _('Number of tags : \n\t\t\t%s\n' % len(tags))
476477

477478
event = _('Number of events : \n\t\t\t%s\t|\t(%s)*\n') % (len(events), self.dbstate.db.get_number_of_events())
478-
person = _('Number of persons : \n\t\t\t%s\t|\t(%s)* and (%s)* surnames\n') % (len(people), self.dbstate.db.get_number_of_people(), len(self.dbstate.db.surname_list))
479+
#DummyDB
480+
if self.dbstate.db.db_is_open:
481+
person = _('Number of persons : \n\t\t\t%s\t|\t(%s) and (%s)* surnames\n') % (len(people), self.dbstate.db.get_number_of_people(), len(self.dbstate.db.surname_list))
482+
else:
483+
person = _('Number of persons : \n\t\t\t%s\t|\t(%s)*\n') % (len(people), self.dbstate.db.get_number_of_people())
479484
family = _('Number of families : \n\t\t\t%s\t|\t(%s)*\n') % (len(families), self.dbstate.db.get_number_of_families())
480485
source = _('Number of sources : \n\t\t\t%s\t|\t(%s)*\n') % (len(sources), self.dbstate.db.get_number_of_sources())
481-
citation = _('Number of citations : \n\t\t\t%s\t|\t(%s)*\n') % (len(citations), self.dbstate.db.get_number_of_citations())
486+
if self.dbstate.db.db_is_open:
487+
citation = _('Number of citations : \n\t\t\t%s\t|\t(%s)*\n') % (len(citations), self.dbstate.db.get_number_of_citations())
488+
else:
489+
citation = ''
482490
place = _('Number of places : \n\t\t\t%s\t|\t(%s)*\n') % (len(places), self.dbstate.db.get_number_of_places())
483491
media = _('Number of media objects : \n\t\t\t%s\t|\t(%s)*\n') % (len(objects), self.dbstate.db.get_number_of_media())
484492
repository = _('Number of repositories : \n\t\t\t%s\t|\t(%s)*\n') % (len(repositories), self.dbstate.db.get_number_of_repositories())
@@ -489,10 +497,14 @@ def counters(self, time, entries, tags, events, people, families, sources, citat
489497

490498
other = _('\nXML: Number of additional records and relations: \t%s\n') % others
491499

492-
nb = _('* loaded Family Tree base:\n "%s"\n' % self.dbstate.db.path)
500+
#DummyDB
501+
if self.dbstate.db.db_is_open:
502+
nb = _('* loaded Family Tree base:\n "%s"\n' % self.dbstate.db.path)
503+
else:
504+
nb = ''
493505

494-
preview = time + total + tag + event + person + family + source + citation + \
495-
place + media + repository + note + nb + other
506+
preview = time + total + tag + event + person + family + source + citation\
507+
+ place + media + repository + note + nb + other
496508

497509
self.text.set_text(preview)
498510

lxml/grampsxml.dtd

Lines changed: 59 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22

3-
<!--
3+
<!--
44
# Gramps - a GTK+/GNOME based genealogy program
55
#
66
# Copyright (C) 2001 Graham J. Williams
@@ -21,19 +21,18 @@
2121
# along with this program; if not, write to the Free Software
2222
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
2323
24-
# $Id$
2524
-->
2625

2726
<!--
28-
This is the Document Type Definition file for v1.7.1
27+
This is the Document Type Definition file for v1.8.0
2928
of the GRAMPS XML genealogy data format.
3029
Please use the following formal public identifier to identify it:
3130
32-
"-//GRAMPS//DTD GRAMPS XML V1.7.1//EN"
31+
"-//GRAMPS//DTD GRAMPS XML V1.8.0//EN"
3332
3433
For example:
35-
<!DOCTYPE database PUBLIC "-//GRAMPS//DTD GRAMPS XML V1.7.1//EN"
36-
"http://gramps-project.org/xml/1.7.1/grampsxml.dtd"
34+
<!DOCTYPE database PUBLIC "-//GRAMPS//DTD GRAMPS XML V1.8.0//EN"
35+
"http://gramps-project.org/xml/1.8.0/grampsxml.dtd"
3736
[...]>
3837
-->
3938

@@ -59,10 +58,10 @@ DATABASE
5958
tags
6059
-->
6160

62-
<!ELEMENT database (header, name-formats?, tags?, events?, people?, families?,
63-
citations?, sources?, places?, objects?, repositories?,
64-
notes?, bookmarks?, namemaps?)>
65-
<!ATTLIST database xmlns CDATA #FIXED "http://gramps-project.org/xml/1.7.1/">
61+
<!ELEMENT database (header, name-formats?, place-types?, tags?, events?,
62+
people?, families?, citations?, sources?, places?,
63+
objects?, repositories?, notes?, bookmarks?, namemaps?)>
64+
<!ATTLIST database xmlns CDATA #FIXED "http://gramps-project.org/xml/1.8.0/">
6665

6766

6867
<!-- ************************************************************
@@ -100,7 +99,7 @@ PEOPLE
10099
-->
101100

102101
<!ELEMENT people (person)*>
103-
<!ATTLIST people
102+
<!ATTLIST people
104103
default CDATA #IMPLIED
105104
home IDREF #IMPLIED
106105
>
@@ -123,7 +122,7 @@ GENDER has values of M, F, or U.
123122
<!ELEMENT name (first?, call?, surname*, suffix?, title?, nick?, familynick?, group?,
124123
(daterange|datespan|dateval|datestr)?, noteref*, citationref*)>
125124
<!-- (Unknown|Also Know As|Birth Name|Married Name|Other Name) -->
126-
<!ATTLIST name
125+
<!ATTLIST name
127126
alt (0|1) #IMPLIED
128127
type CDATA #IMPLIED
129128
priv (0|1) #IMPLIED
@@ -156,15 +155,15 @@ Pseudonym|Patrilineal|Matrilineal|Occupation|Location) -->
156155
<!ATTLIST parentin hlink IDREF #REQUIRED>
157156

158157
<!ELEMENT personref (citationref*, noteref*)>
159-
<!ATTLIST personref
158+
<!ATTLIST personref
160159
hlink IDREF #REQUIRED
161160
priv (0|1) #IMPLIED
162161
rel CDATA #REQUIRED
163162
>
164163

165-
<!ELEMENT address ((daterange|datespan|dateval|datestr)?, street?,
166-
locality?, city?, county?, state?, country?, postal?,
167-
phone?, noteref*,citationref*)>
164+
<!ELEMENT address ((daterange|datespan|dateval|datestr)?, street?,
165+
locality?, city?, county?, state?, country?, postal?,
166+
phone?, noteref*,citationref*)>
168167
<!ATTLIST address priv (0|1) #IMPLIED>
169168

170169
<!ELEMENT street (#PCDATA)>
@@ -221,7 +220,7 @@ EVENT
221220
<!ELEMENT event (type?, (daterange|datespan|dateval|datestr)?, place?, cause?,
222221
description?, attribute*, noteref*, citationref*, objref*,
223222
tagref*)>
224-
<!ATTLIST event
223+
<!ATTLIST event
225224
id CDATA #IMPLIED
226225
handle ID #REQUIRED
227226
priv (0|1) #IMPLIED
@@ -252,25 +251,36 @@ PLACES
252251

253252
<!ELEMENT places (placeobj)*>
254253

255-
<!ELEMENT placeobj (ptitle?, pname+, code?, coord?, placeref*, location*,
256-
objref*, url*, noteref*, citationref*, tagref*)>
254+
<!ELEMENT placeobj (ptitle?, pname+, ptype+, coord?, placeref*, location*,
255+
objref*, url*, noteref*, citationref*, tagref*,
256+
attribute*, eventref*)>
257257
<!ATTLIST placeobj
258258
id CDATA #IMPLIED
259259
handle ID #REQUIRED
260260
priv (0|1) #IMPLIED
261261
change CDATA #REQUIRED
262-
type CDATA #REQUIRED
263262
>
264263

265-
<!ELEMENT pname (daterange|datespan|dateval|datestr)?>
266-
264+
<!ELEMENT pname ((daterange|datespan|dateval|datestr)?, citationref*,
265+
pabbr*)>
267266
<!ATTLIST pname
268267
lang CDATA #IMPLIED
269268
value CDATA #REQUIRED
270269
>
271270

272271
<!ELEMENT ptitle (#PCDATA)>
273-
<!ELEMENT code (#PCDATA)>
272+
273+
<!ELEMENT placeref ((daterange|datespan|dateval|datestr)?, citationref*)>
274+
<!ATTLIST placeref
275+
type CDATA #IMPLIED
276+
hlink IDREF #REQUIRED
277+
>
278+
279+
<!ELEMENT ptype ((daterange|datespan|dateval|datestr)?, citationref*)>
280+
<!ATTLIST ptype
281+
value CDATA #REQUIRED
282+
number CDATA #IMPLIED
283+
>
274284

275285
<!ELEMENT coord EMPTY>
276286
<!ATTLIST coord
@@ -290,6 +300,12 @@ PLACES
290300
postal CDATA #IMPLIED
291301
phone CDATA #IMPLIED
292302
>
303+
<!ELEMENT pabbr EMPTY>
304+
<!ATTLIST pabbr
305+
type CDATA #IMPLIED
306+
value CDATA #REQUIRED
307+
>
308+
293309

294310
<!-- ************************************************************
295311
OBJECTS
@@ -320,7 +336,7 @@ REPOSITORIES
320336

321337
<!ELEMENT repositories (repository)*>
322338

323-
<!ELEMENT repository (rname, type, address*, url*, noteref*, tagref*)>
339+
<!ELEMENT repository (rname?, type, address*, url*, noteref*, tagref*)>
324340
<!ATTLIST repository
325341
id CDATA #IMPLIED
326342
handle ID #REQUIRED
@@ -397,7 +413,7 @@ BOOKMARKS
397413

398414
<!ELEMENT bookmarks (bookmark)*>
399415
<!ELEMENT bookmark EMPTY>
400-
<!ATTLIST bookmark
416+
<!ATTLIST bookmark
401417
target (person|family|event|source|citation|place|media|repository|
402418
note) #REQUIRED
403419
hlink IDREF #REQUIRED
@@ -408,7 +424,7 @@ NAME MAPS
408424
-->
409425
<!ELEMENT namemaps (map)*>
410426
<!ELEMENT map EMPTY>
411-
<!ATTLIST map
427+
<!ATTLIST map
412428
type CDATA #REQUIRED
413429
key CDATA #REQUIRED
414430
value CDATA #REQUIRED
@@ -427,6 +443,18 @@ NAME FORMATS
427443
active (0|1) #IMPLIED
428444
>
429445

446+
<!-- ************************************************************
447+
PLACE TYPES
448+
-->
449+
450+
<!ELEMENT place-types (place-type)*>
451+
<!ELEMENT place-type (pgroup*)>
452+
<!ATTLIST place-type
453+
number CDATA #IMPLIED
454+
name CDATA #REQUIRED
455+
>
456+
<!ELEMENT pgroup (#PCDATA)>
457+
430458
<!-- ************************************************************
431459
SHARED ELEMENTS
432460
-->
@@ -437,7 +465,7 @@ SHARED ELEMENTS
437465
quality (estimated|calculated) #IMPLIED
438466
cformat CDATA #IMPLIED
439467
dualdated (0|1) #IMPLIED
440-
newyear CDATA #IMPLIED
468+
newyear CDATA #IMPLIED
441469
>
442470

443471
<!ELEMENT datespan EMPTY>
@@ -447,7 +475,7 @@ SHARED ELEMENTS
447475
quality (estimated|calculated) #IMPLIED
448476
cformat CDATA #IMPLIED
449477
dualdated (0|1) #IMPLIED
450-
newyear CDATA #IMPLIED
478+
newyear CDATA #IMPLIED
451479
>
452480

453481
<!ELEMENT dateval EMPTY>
@@ -457,7 +485,7 @@ SHARED ELEMENTS
457485
quality (estimated|calculated) #IMPLIED
458486
cformat CDATA #IMPLIED
459487
dualdated (0|1) #IMPLIED
460-
newyear CDATA #IMPLIED
488+
newyear CDATA #IMPLIED
461489
>
462490

463491
<!ELEMENT datestr EMPTY>
@@ -530,16 +558,11 @@ SHARED ELEMENTS
530558
>
531559

532560
<!ELEMENT objref (region?, attribute*, citationref*, noteref*)>
533-
<!ATTLIST objref
561+
<!ATTLIST objref
534562
hlink IDREF #REQUIRED
535563
priv (0|1) #IMPLIED
536564
>
537565

538-
<!ELEMENT placeref ((daterange|datespan|dateval|datestr)?)>
539-
<!ATTLIST placeref
540-
hlink IDREF #REQUIRED
541-
>
542-
543566
<!ELEMENT region EMPTY>
544567
<!ATTLIST region
545568
corner1_x CDATA #REQUIRED
@@ -573,4 +596,4 @@ SHARED ELEMENTS
573596
<!ELEMENT sealed_to EMPTY>
574597
<!ATTLIST sealed_to
575598
hlink IDREF #REQUIRED
576-
>
599+
>

0 commit comments

Comments
 (0)