* src/plugins/ReadGedcom.py: handle sources attached to a person (not

to an event), handle the PAF/FTW _MARNM extension.

* src/plugins/WriteGedcom.py: Allow for multi-line PAGE information for
as source.
* src/gramps.glade: parent relationship editor has an indicator to
mark the parents as the preferred parents for reporting and display
* src/ChooseParents.py: parent relationship editor has an indicator to
mark the parents as the preferred parents for reporting and display


svn: r1905
This commit is contained in:
Don Allingham 2003-07-21 00:09:12 +00:00
parent bd96aef984
commit ad76d91807
6 changed files with 159 additions and 43 deletions

View File

@ -515,6 +515,18 @@ class ModifyParents:
else:
self.mother_rel.set_sensitive(0)
self.pref = self.glade.get_widget('preferred')
if len(self.person.getParentList()) > 1:
self.glade.get_widget('pref_label').show()
self.pref.show()
if family == self.person.getParentList()[0]:
self.pref.set_active(1)
else:
self.pref.set_active(0)
self.top.show()
def quit(self,obj):
self.top.destroy()
@ -525,11 +537,29 @@ class ModifyParents:
"""
mother_rel = const.childRelations[self.mother_rel.get_text()]
father_rel = const.childRelations[self.father_rel.get_text()]
mod = 0
Utils.destroy_passed_object(self.top)
if mother_rel != self.orig_mrel or father_rel != self.orig_frel:
self.person.removeAltFamily(self.family)
self.person.addAltFamily(self.family,mother_rel,father_rel)
self.family_update(None)
mod = 1
Utils.modified()
if len(self.person.getParentList()):
make_pref = self.pref.get_active()
plist = self.person.getParentList()
if make_pref:
if self.family != plist[0]:
self.person.setMainParents(self.family)
Utils.modified()
mod = 1
else:
if self.family == plist[0]:
self.person.setMainParents(plist[0])
Utils.modified()
mod = 1
if mod:
self.family_update(None)

View File

@ -275,7 +275,8 @@ class SourceEditor:
def draw(self,sel = None):
self.title_menu.list.remove_items(self.list)
if self.source_ref:
self.get_widget("spage").set_text(self.source_ref.getPage())
spage = self.get_widget("spage")
spage.get_buffer().set_text(self.source_ref.getPage())
date = self.source_ref.getDate()
if date:
self.get_widget("sdate").set_text(date.getDate())
@ -324,7 +325,6 @@ class SourceEditor:
if self.active_source != self.source_ref.getBase():
self.source_ref.setBase(self.active_source)
page = self.get_widget("spage").get_text()
date = self.get_widget("sdate").get_text()
conf = self.get_widget("conf").get_menu().get_active().get_data('a')
@ -336,6 +336,10 @@ class SourceEditor:
text = buffer.get_text(buffer.get_start_iter(),
buffer.get_end_iter(),gtk.FALSE)
buffer = self.get_widget('spage').get_buffer()
page = buffer.get_text(buffer.get_start_iter(),
buffer.get_end_iter(),gtk.FALSE)
self.source_ref.setPage(page)
self.source_ref.getDate().set(date)
self.source_ref.setText(text)

View File

@ -1642,7 +1642,7 @@
<child>
<widget class="GtkTreeView" id="sp_parents">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Double-click to edit the selected parents</property>
<property name="tooltip" translatable="yes">Double-click to edit the relationship to the selected parents</property>
<property name="can_focus">True</property>
<property name="headers_visible">False</property>
<property name="rules_hint">True</property>
@ -1916,7 +1916,7 @@
<child>
<widget class="GtkTreeView" id="ap_parents">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Double-click to edit the selected parents</property>
<property name="tooltip" translatable="yes">Double-click to edit the relationship to the selected parents</property>
<property name="can_focus">True</property>
<property name="headers_visible">False</property>
<property name="rules_hint">True</property>
@ -5676,7 +5676,6 @@
</widget>
<widget class="GtkDialog" id="modparents">
<property name="visible">True</property>
<property name="title" translatable="yes"></property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
@ -5770,7 +5769,7 @@
<widget class="GtkTable" id="table41">
<property name="border_width">12</property>
<property name="visible">True</property>
<property name="n_rows">7</property>
<property name="n_rows">9</property>
<property name="n_columns">3</property>
<property name="homogeneous">False</property>
<property name="row_spacing">6</property>
@ -6361,6 +6360,50 @@
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="pref_label">
<property name="label" translatable="yes">&lt;b&gt;Preference&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</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">0</property>
<property name="right_attach">3</property>
<property name="top_attach">7</property>
<property name="bottom_attach">8</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="preferred">
<property name="tooltip" translatable="yes">Indicates that the parents should be used as the preferred parents for reporting and display purposes</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Use as preferred parents</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
<property name="top_attach">8</property>
<property name="bottom_attach">9</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>

View File

@ -361,12 +361,14 @@ class GedcomParser:
return self.groups
def barf(self,level):
import traceback
msg = _("Warning: line %d was not understood, so it was ignored.") % self.index
self.errmsg(msg)
msg = "\n\t%s\n" % self.text
self.errmsg(msg)
self.error_count = self.error_count + 1
# self.errmsg(string.join(traceback.format_stack()))
self.ignore_sub_junk(level)
def warn(self,msg):
@ -504,7 +506,7 @@ class GedcomParser:
self.db.buildPersonDisplay(self.person.getId())
elif matches[2] in ["SUBM","SUBN","REPO"]:
self.ignore_sub_junk(1)
elif matches[1] in ["SUBM","SUBN","OBJE"]:
elif matches[1] in ["SUBM","SUBN","OBJE","_EVENT_DEFN"]:
self.ignore_sub_junk(1)
elif matches[2] == "SOUR":
self.parse_source(matches[1],1)
@ -661,7 +663,7 @@ class GedcomParser:
self.family.addEvent(event)
self.parse_family_event(event,2)
def parse_note(self,matches,obj,level,old_note):
def parse_note_base(self,matches,obj,level,old_note,task):
note = old_note
if matches[2] and matches[2][0] == "@":
if self.nmap.has_key(matches[2]):
@ -677,10 +679,15 @@ class GedcomParser:
note = "%s\n%s%s" % (old_note,matches[2],self.parse_continue_data(level))
else:
note = matches[2] + self.parse_continue_data(level)
obj.setNote(note)
task(note)
self.ignore_sub_junk(level+1)
return note
def parse_note(self,matches,obj,level,old_note):
self.parse_note_base(matches,obj,level,old_note,obj.setNote)
def parse_comment(self,matches,obj,level,old_note):
self.parse_note_base(matches,obj,level,old_note,obj.setComments)
def parse_individual(self):
name_cnt = 0
@ -888,6 +895,9 @@ class GedcomParser:
return (string.capitalize(type),note)
elif matches[1] == "PEDI":
type = matches[2]
elif matches[1] == "SOUR":
source_ref = self.handle_source(matches,level)
self.person.getPrimaryName().addSourceRef(source_ref)
elif matches[1] == "_PRIMARY":
type = matches[1]
elif matches[1] == "NOTE":
@ -1033,7 +1043,7 @@ class GedcomParser:
elif matches[1] == "ADDR":
address.setStreet(matches[2] + self.parse_continue_data(level+1))
self.parse_address(address,level+1)
elif matches[1] in ["AGE","AGNC","CAUS","STAT","TEMP","OBJE","TYPE"]:
elif matches[1] in ["AGE","AGNC","CAUS","STAT","TEMP","OBJE","TYPE","_DATE2"]:
self.ignore_sub_junk(level+1)
elif matches[1] == "SOUR":
source_ref = RelLib.SourceRef()
@ -1140,7 +1150,7 @@ class GedcomParser:
elif matches[1] == "DATE":
event.setDateObj(self.extract_date(matches[2]))
elif matches[1] == "SOUR":
event.addSourceRef(self.handle_source(matches,level))
event.addSourceRef(self.handle_source(matches,level+1))
elif matches[1] == "PLAC":
val = matches[2]
n = string.strip(event.getName())
@ -1175,7 +1185,7 @@ class GedcomParser:
event.setDescription("%s%s" % (d, matches[2]))
elif matches[1] == "CONT":
event.setDescription("%s\n%s" % (event.getDescription(),matches[2]))
elif matches[1] in ["RELI", "TIME","ADDR","AGE","AGNC","STAT","TEMP","OBJE"]:
elif matches[1] in ["RELI", "TIME","ADDR","AGE","AGNC","STAT","TEMP","OBJE","_DATE2"]:
self.ignore_sub_junk(level+1)
else:
self.barf(level+1)
@ -1324,7 +1334,7 @@ class GedcomParser:
elif matches[1] in ["TIME","AGE","AGNC","ADDR","STAT","TEMP","HUSB","WIFE","OBJE","_CHUR"]:
self.ignore_sub_junk(level+1)
elif matches[1] == "SOUR":
event.addSourceRef(self.handle_source(matches,level))
event.addSourceRef(self.handle_source(matches,level+1))
elif matches[1] == "PLAC":
val = matches[2]
if self.placemap.has_key(val):
@ -1372,7 +1382,7 @@ class GedcomParser:
else:
source.setConfidence(val)
elif matches[1] == "NOTE":
self.ignore_sub_junk(level+1)
note = self.parse_comment(matches,source,level+1,note)
else:
self.barf(level+1)
@ -1382,13 +1392,11 @@ class GedcomParser:
note = ""
while 1:
matches = self.get_next()
if int(matches[0]) < level:
self.backup()
return (date,note)
elif matches[1] == "DATE":
date = matches[2]
elif matches[1] == "TEXT":
note = matches[2] + self.parse_continue_data(level+1)
else:
@ -1425,6 +1433,8 @@ class GedcomParser:
elif matches[1] == "SURN":
name.setSurname(matches[2])
self.db.addSurname(matches[2])
elif matches[1] == "_MARNM":
self.parse_marnm(self.person,matches[2].strip())
elif matches[1] == "TITL":
name.setSuffix(matches[2])
elif matches[1] == "NSFX":
@ -1453,6 +1463,20 @@ class GedcomParser:
else:
self.barf(level+1)
def parse_marnm(self,person,text):
data = text.split()
if len(data) == 1:
name = RelLib.Name(person.getPrimaryName())
name.setSurname(data[0])
name.setType('Married Name')
person.addAlternateName(name)
elif len(data) > 1:
name = RelLib.Name()
name.setSurname(data[-1])
name.setFirstName(string.join(data[0:-1],' '))
name.setType('Married Name')
person.addAlternateName(name)
def parse_header_head(self):
"""validiates that this is a valid GEDCOM file"""
line = string.replace(self.f.readline(),'\r','')
@ -1481,6 +1505,7 @@ class GedcomParser:
self.update(self.created_obj,matches[2])
elif matches[1] == "VERS" and self.window:
self.update(self.version_obj,matches[2])
pass
elif matches[1] in ["CORP","DATA","SUBM","SUBN","COPR","FILE","LANG"]:
self.ignore_sub_junk(2)
elif matches[1] == "DEST":
@ -1691,7 +1716,7 @@ class GedcomParser:
self.ignore_sub_junk(2)
else:
source_ref.setBase(self.db.findSource(matches[2],self.smap))
self.parse_source_reference(source_ref,level+1)
self.parse_source_reference(source_ref,level)
return source_ref
def resolve_refns(self):

View File

@ -1081,7 +1081,7 @@ class GedcomWriter:
self.writeln("%d SOUR @%s@" %
(level,self.sid(ref.getBase().getId())))
if ref.getPage() != "":
self.writeln("%d PAGE %s" % (level+1,ref.getPage()))
self.write_long_text("PAGE",level+1,self.cnvtxt(ref.getPage()))
ref_text = ref.getText()
if ref_text != "" or not ref.getDate().isEmpty():

View File

@ -2,6 +2,7 @@
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<glade-interface>
<requires lib="gnome"/>
<widget class="GtkDialog" id="sourceDisplay">
<property name="visible">True</property>
@ -146,9 +147,6 @@
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">spage</property>
<accessibility>
<atkrelation target="spage" type="label-for"/>
</accessibility>
</widget>
<packing>
<property name="left_attach">1</property>
@ -464,27 +462,6 @@
</packing>
</child>
<child>
<widget class="GtkEntry" id="spage">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</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" translatable="yes">*</property>
<property name="activates_default">False</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">4</property>
<property name="top_attach">7</property>
<property name="bottom_attach">8</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="sdate">
<property name="visible">True</property>
@ -673,6 +650,43 @@
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow31">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
<widget class="GtkTextView" id="spage">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="justification">GTK_JUSTIFY_LEFT</property>
<property name="wrap_mode">GTK_WRAP_NONE</property>
<property name="cursor_visible">True</property>
<property name="pixels_above_lines">0</property>
<property name="pixels_below_lines">0</property>
<property name="pixels_inside_wrap">0</property>
<property name="left_margin">0</property>
<property name="right_margin">0</property>
<property name="indent">0</property>
<property name="text" translatable="yes"></property>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">4</property>
<property name="top_attach">7</property>
<property name="bottom_attach">8</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>