From e2e2070bafe85d5f4d965a2096a8eb957a3d39b2 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Fri, 3 May 2002 04:21:23 +0000 Subject: [PATCH] *** empty log message *** svn: r955 --- gramps/src/Date.py | 20 ++++++++++++++------ gramps/src/gramps.glade | 1 + gramps/src/plugins/AncestorReport.py | 4 ++-- gramps/src/plugins/DescendReport.py | 12 ++++++------ gramps/src/plugins/DetAncestralReport.py | 1 + gramps/src/plugins/ReadGedcom.py | 18 ++++++++++-------- 6 files changed, 34 insertions(+), 22 deletions(-) diff --git a/gramps/src/Date.py b/gramps/src/Date.py index 175fd5446..05f6f565c 100644 --- a/gramps/src/Date.py +++ b/gramps/src/Date.py @@ -741,19 +741,27 @@ class SingleDate: _format13] def display_calendar(self,month_map): + d = '' if self.year==UNDEF: if self.month == UNDEF: - return "" + d = "" elif self.day == UNDEF: - return month_map[self.month] + d = month_map[self.month] else: - return "%02d %s" % (self.day,month_map[self.month]) + d = "%02d %s" % (self.day,month_map[self.month]) elif self.month == UNDEF: - return str(self.year) + d = str(self.year) elif self.day == UNDEF: - return "%s %d" % (month_map[self.month],self.year) + d = "%s %d" % (month_map[self.month],self.year) else: - return "%02d %s %d" % (self.day,month_map[self.month],self.year) + d = "%02d %s %d" % (self.day,month_map[self.month],self.year) + if self.mode == SingleDate.about: + d = _("about") + ' ' + d + elif self.mode == SingleDate.before: + d = _("before") + ' ' + d + elif self.mode == SingleDate.after: + d = _("after") + ' ' + d + return d def getDate(self): if self.calendar == GREGORIAN: diff --git a/gramps/src/gramps.glade b/gramps/src/gramps.glade index d4b975ac9..ce218a497 100644 --- a/gramps/src/gramps.glade +++ b/gramps/src/gramps.glade @@ -912,6 +912,7 @@ GtkCList person_list + 750 350 True diff --git a/gramps/src/plugins/AncestorReport.py b/gramps/src/plugins/AncestorReport.py index 84f04695e..e0cb7d124 100644 --- a/gramps/src/plugins/AncestorReport.py +++ b/gramps/src/plugins/AncestorReport.py @@ -64,7 +64,7 @@ class AncestorReport(Report): # #-------------------------------------------------------------------- def filter(self,person,index): - if person == None or index >= 2**self.max_generations: + if person == None or index >= (1 << 31): return self.map[index] = person @@ -93,7 +93,7 @@ class AncestorReport(Report): generation = 0 for key in keys : - if generation == 0 or key >= 2**generation: + if generation == 0 or key >= ( 1 << 31): if self.pgbrk and generation > 0: self.doc.page_break() self.doc.start_paragraph("Generation") diff --git a/gramps/src/plugins/DescendReport.py b/gramps/src/plugins/DescendReport.py index 22bf44633..188788d6f 100644 --- a/gramps/src/plugins/DescendReport.py +++ b/gramps/src/plugins/DescendReport.py @@ -106,13 +106,13 @@ class DescendantReport: def dump(self,level,person): if level != 0: - self.doc.start_paragraph("Level" + str(level)) - self.doc.write_text(str(level) + '. ') + self.doc.start_paragraph("Level%d" % level) + self.doc.write_text("%d." % level) self.doc.write_text(person.getPrimaryName().getRegularName()) self.dump_dates(person) self.doc.end_paragraph() - if (level >= self.max_generations): + if level >= self.max_generations: return childlist = [] @@ -172,11 +172,11 @@ class DescendantReportDialog(TextReportDialog): self.default_style.add_style("Title",p) f = FontStyle() - for i in range(1,10): + for i in range(1,32): p = ParagraphStyle() p.set_font(f) - p.set_left_margin(float(i-1)) - self.default_style.add_style("Level" + str(i),p) + p.set_left_margin(max(10.0,float(i-1))) + self.default_style.add_style("Level%d" % i,p) #------------------------------------------------------------------------ # diff --git a/gramps/src/plugins/DetAncestralReport.py b/gramps/src/plugins/DetAncestralReport.py index 7a5f8f31c..7a8fd95d0 100644 --- a/gramps/src/plugins/DetAncestralReport.py +++ b/gramps/src/plugins/DetAncestralReport.py @@ -304,6 +304,7 @@ class DetAncestorReport(Report): if len(famList) > 0: for fam in famList: #print "Marriage:fam", fam.__dict__ + spouse = '' if person.getGender() == RelLib.Person.male: if fam.getMother() != None: spouse= fam.getMother().getPrimaryName().getRegularName() diff --git a/gramps/src/plugins/ReadGedcom.py b/gramps/src/plugins/ReadGedcom.py index 56c3d625e..699732887 100644 --- a/gramps/src/plugins/ReadGedcom.py +++ b/gramps/src/plugins/ReadGedcom.py @@ -97,7 +97,7 @@ lineRE = re.compile(r"\s*(\d+)\s+(\S+)\s*(.*)$") headRE = re.compile(r"\s*(\d+)\s+HEAD") nameRegexp= re.compile(r"/?([^/]*)(/([^/]*)(/([^/]*))?)?") snameRegexp= re.compile(r"/([^/]*)/") -calRegexp = re.compile(r"\s*@#D([^@]+)@\s*(.*)$") +calRegexp = re.compile(r"\s*(ABT|BEF|AFT)?\s*@#D([^@]+)@\s*(.*)$") fromtoRegexp = re.compile(r"\s*FROM\s+@#D([^@]+)@\s*(.*)\s+TO\s+@#D([^@]+)@\s*(.*)$") #------------------------------------------------------------------------- @@ -131,11 +131,13 @@ def importData(database, filename): gnome.ui.GnomeErrorDialog(_("%s could not be opened\n") % filename) return - g.parse_gedcom_file() + close = g.parse_gedcom_file() g.resolve_refns() statusTop.get_widget("close").set_sensitive(1) - + if close: + statusWindow.destroy() + Utils.modified() if callback: callback(1) @@ -313,8 +315,7 @@ class GedcomParser: self.break_note_links() t = time.time() - t self.error_text_obj.insert_defaults(_('Import Complete: %d seconds') % t) - if self.close_done.get_active(): - self.window.destroy() + return self.close_done.get_active() def break_note_links(self): for o in self.share_note: @@ -609,7 +610,7 @@ class GedcomParser: name = Name() m = snameRegexp.match(matches[2]) if m: - n = m.groups() + n = m.groups()[0] names = ('','',n,'','') else: try: @@ -1418,7 +1419,6 @@ class GedcomParser: """Parses the person's name information""" while 1: matches = self.get_next() - if int(matches[0]) < level: self.backup() return @@ -1690,7 +1690,7 @@ class GedcomParser: match = calRegexp.match(text) if match: - (cal,data) = match.groups() + (abt,cal,data) = match.groups() if cal == "FRENCH R": dateobj.set_calendar(Date.FRENCH) elif cal == "JULIAN": @@ -1698,6 +1698,8 @@ class GedcomParser: elif cal == "HEBREW": dateobj.set_calendar(Date.HEBREW) dateobj.set(data) + if abt: + dateobj.get_start_date().setMode(abt) else: dateobj.set(text)