Skip to content

Commit 2321523

Browse files
committed
some exceptions for citations and surnames if db is not open
1 parent 1fcbac8 commit 2321523

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

lxml/etreeGramplet.py

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,8 @@ 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-
# TODO:bug?
313-
# 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())
314314
print('places', self.dbstate.db.get_number_of_places())
315315
print('objects', self.dbstate.db.get_number_of_media())
316316
print('repositories', self.dbstate.db.get_number_of_repositories())
@@ -477,26 +477,34 @@ def counters(self, time, entries, tags, events, people, families, sources, citat
477477

478478
event = _('Number of events : \n\t\t\t%s\t|\t(%s)*\n') % (len(events), self.dbstate.db.get_number_of_events())
479479
#DummyDB
480-
person = _('Number of persons : \n\t\t\t%s\t|\t(%s)*\n') % (len(people), self.dbstate.db.get_number_of_people())
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())
481484
family = _('Number of families : \n\t\t\t%s\t|\t(%s)*\n') % (len(families), self.dbstate.db.get_number_of_families())
482485
source = _('Number of sources : \n\t\t\t%s\t|\t(%s)*\n') % (len(sources), self.dbstate.db.get_number_of_sources())
483-
# TODO:bug?
484-
#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 = ''
485490
place = _('Number of places : \n\t\t\t%s\t|\t(%s)*\n') % (len(places), self.dbstate.db.get_number_of_places())
486491
media = _('Number of media objects : \n\t\t\t%s\t|\t(%s)*\n') % (len(objects), self.dbstate.db.get_number_of_media())
487492
repository = _('Number of repositories : \n\t\t\t%s\t|\t(%s)*\n') % (len(repositories), self.dbstate.db.get_number_of_repositories())
488493
note = _('Number of notes : \n\t\t\t%s\t|\t(%s)*\n') % (len(notes), self.dbstate.db.get_number_of_notes())
489494

490-
#others = len(entries) - (len(tags) + len(events) + len(people) + len(families) + len(sources) + \
491-
#len(citations) + len(places) + len(objects) + len(repositories) + len(notes))
495+
others = len(entries) - (len(tags) + len(events) + len(people) + len(families) + len(sources) + \
496+
len(citations) + len(places) + len(objects) + len(repositories) + len(notes))
492497

493-
#other = _('\nXML: Number of additional records and relations: \t%s\n') % others
498+
other = _('\nXML: Number of additional records and relations: \t%s\n') % others
494499

495500
#DummyDB
496-
#nb = _('* loaded Family Tree base:\n "%s"\n' % self.dbstate.db.path)
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 = ''
497505

498-
preview = time + total + tag + event + person + family + source + \
499-
place + media + repository + note #+ nb + other + citation
506+
preview = time + total + tag + event + person + family + source + citation\
507+
+ place + media + repository + note + nb + other
500508

501509
self.text.set_text(preview)
502510

0 commit comments

Comments
 (0)