Initial support for place objects
svn: r337
This commit is contained in:
parent
87d8138aa8
commit
f769231805
@ -126,6 +126,8 @@ class EditPerson:
|
||||
self.title = self.get_widget("title")
|
||||
self.bdate = self.get_widget("birthDate")
|
||||
self.bplace = self.get_widget("birthPlace")
|
||||
self.bpcombo = self.get_widget("bp_combo")
|
||||
self.dpcombo = self.get_widget("dp_combo")
|
||||
self.ddate = self.get_widget("deathDate")
|
||||
self.dplace = self.get_widget("deathPlace")
|
||||
self.is_male = self.get_widget("genderMale")
|
||||
@ -198,8 +200,9 @@ class EditPerson:
|
||||
self.attr_list.set_column_visibility(2,Config.show_detail)
|
||||
self.address_list.set_column_visibility(2,Config.show_detail)
|
||||
if len(const.places) > 0:
|
||||
self.get_widget("dp_combo").set_popdown_strings(const.places)
|
||||
self.get_widget("bp_combo").set_popdown_strings(const.places)
|
||||
plist = self.db.getPlaceMap().values()
|
||||
attach_places(plist,self.dpcombo,self.death.getPlace())
|
||||
attach_places(plist,self.bpcombo,self.birth.getPlace())
|
||||
|
||||
if Config.display_attr:
|
||||
self.get_widget("user_label").set_text(Config.attr_name)
|
||||
@ -229,9 +232,18 @@ class EditPerson:
|
||||
self.nick.set_text(person.getNickName())
|
||||
self.title.set_text(self.pname.getTitle())
|
||||
self.bdate.set_text(self.birth.getDate())
|
||||
self.bplace.set_text(self.birth.getPlace())
|
||||
p = self.birth.getPlace()
|
||||
if p:
|
||||
self.bplace.set_text(p.get_title())
|
||||
else:
|
||||
self.bplace.set_text("")
|
||||
self.ddate.set_text(self.death.getDate())
|
||||
self.dplace.set_text(self.death.getPlace())
|
||||
|
||||
p = self.death.getPlace()
|
||||
if p:
|
||||
self.dplace.set_text(p.get_title())
|
||||
else:
|
||||
self.dplace.set_text("")
|
||||
|
||||
# load photos into the photo window
|
||||
photo_list = person.getPhotoList()
|
||||
@ -398,8 +410,12 @@ class EditPerson:
|
||||
self.event_index = 0
|
||||
for event in self.elist:
|
||||
attr = get_detail_flags(event)
|
||||
if event.getPlace():
|
||||
p = event.getPlace().get_title()
|
||||
else:
|
||||
p = ""
|
||||
self.event_list.append([const.display_pevent(event.getName()),\
|
||||
event.getQuoteDate(), event.getPlace(),attr])
|
||||
event.getQuoteDate(),p,attr])
|
||||
self.event_list.set_row_data(self.event_index,event)
|
||||
self.event_index = self.event_index + 1
|
||||
|
||||
@ -518,7 +534,7 @@ def did_data_change(obj):
|
||||
nick = epo.nick.get_text()
|
||||
title = epo.title.get_text()
|
||||
bdate = epo.bdate.get_text()
|
||||
bplace = epo.bplace.get_text()
|
||||
bplace = string.strip(epo.bplace.get_text())
|
||||
ddate = epo.ddate.get_text()
|
||||
dplace = epo.dplace.get_text()
|
||||
gender = epo.is_male.get_active()
|
||||
@ -539,12 +555,21 @@ def did_data_change(obj):
|
||||
changed = 1
|
||||
|
||||
epo.birth.setDate(bdate)
|
||||
epo.birth.setPlace(bplace)
|
||||
|
||||
bplace_obj = get_place_from_list(epo.bpcombo)
|
||||
if bplace_obj == None and bplace != "":
|
||||
changed = 1
|
||||
epo.birth.setPlace(bplace_obj)
|
||||
|
||||
if not epo.birth.are_equal(epo.person.getBirth()):
|
||||
changed = 1
|
||||
|
||||
epo.death.setDate(ddate)
|
||||
epo.death.setPlace(dplace)
|
||||
dplace_obj = get_place_from_list(epo.dpcombo)
|
||||
if dplace_obj == None and dplace != "":
|
||||
changed = 1
|
||||
epo.death.setPlace(dplace_obj)
|
||||
|
||||
if not epo.death.are_equal(epo.person.getDeath()):
|
||||
changed = 1
|
||||
|
||||
@ -902,7 +927,10 @@ def on_event_select_row(obj,row,b,c):
|
||||
|
||||
epo = obj.get_data(EDITPERSON)
|
||||
epo.event_date_field.set_text(": %s" % event.getDate())
|
||||
epo.event_place_field.set_text(": %s" % event.getPlace())
|
||||
if event.getPlace():
|
||||
epo.event_place_field.set_text(": %s" % event.getPlace().get_title())
|
||||
else:
|
||||
epo.event_place_field.set_text(":")
|
||||
epo.event_name_field.set_label(const.display_pevent(event.getName()))
|
||||
epo.event_descr_field.set_text(": %s" % event.getDescription())
|
||||
epo.event_details_field.set_text(": %s" % get_detail_text(event))
|
||||
@ -975,6 +1003,7 @@ def on_primary_photo_clicked(obj):
|
||||
#-------------------------------------------------------------------------
|
||||
def update_event(event,name,date,place,desc,note,priv,conf):
|
||||
changed = 0
|
||||
|
||||
if event.getPlace() != place:
|
||||
event.setPlace(place)
|
||||
changed = 1
|
||||
@ -1244,24 +1273,31 @@ def save_person(obj):
|
||||
person.setNickName(nick)
|
||||
utils.modified()
|
||||
|
||||
bplace = epo.bplace.get_text()
|
||||
dplace = epo.dplace.get_text()
|
||||
bplace = string.strip(epo.bplace.get_text())
|
||||
dplace = string.strip(epo.dplace.get_text())
|
||||
|
||||
epo.birth.setDate(epo.bdate.get_text())
|
||||
epo.birth.setPlace(bplace)
|
||||
|
||||
p1 = get_place_from_list(epo.bpcombo)
|
||||
if p1 == None and bplace != "":
|
||||
p1 = Place()
|
||||
p1.set_title(bplace)
|
||||
epo.db.addPlace(p1)
|
||||
epo.birth.setPlace(p1)
|
||||
if not person.getBirth().are_equal(epo.birth):
|
||||
person.setBirth(epo.birth)
|
||||
|
||||
epo.death.setDate(epo.ddate.get_text())
|
||||
epo.death.setPlace(dplace)
|
||||
|
||||
p2 = get_place_from_list(epo.dpcombo)
|
||||
if p2 == None and dplace != "":
|
||||
p2 = Place()
|
||||
p2.set_title(dplace)
|
||||
epo.db.addPlace(p2)
|
||||
epo.death.setPlace(p2)
|
||||
if not person.getDeath().are_equal(epo.death):
|
||||
person.setDeath(epo.death)
|
||||
|
||||
for place in [ dplace, bplace ]:
|
||||
if place not in const.places:
|
||||
const.places.append(place)
|
||||
const.places.sort()
|
||||
|
||||
gender = epo.is_male.get_active()
|
||||
error = 0
|
||||
if gender and person.getGender() == Person.female:
|
||||
@ -1631,6 +1667,7 @@ class EventEditor:
|
||||
self.window = self.top.get_widget("event_edit")
|
||||
self.name_field = self.top.get_widget("eventName")
|
||||
self.place_field = self.top.get_widget("eventPlace")
|
||||
self.place_combo = self.top.get_widget("eventPlace_combo")
|
||||
self.date_field = self.top.get_widget("eventDate")
|
||||
self.descr_field = self.top.get_widget("eventDescription")
|
||||
self.note_field = self.top.get_widget("eventNote")
|
||||
@ -1655,9 +1692,16 @@ class EventEditor:
|
||||
|
||||
self.conf_menu.set_menu(myMenu)
|
||||
|
||||
values = self.parent.db.getPlaceMap().values()
|
||||
if event != None:
|
||||
self.name_field.set_text(event.getName())
|
||||
self.place_field.set_text(event.getPlace())
|
||||
|
||||
attach_places(values,self.place_combo,event.getPlace())
|
||||
if event.getPlace():
|
||||
self.place_field.set_text(event.getPlace().get_title())
|
||||
else:
|
||||
self.place_field.set_text('')
|
||||
|
||||
self.date_field.set_text(event.getDate())
|
||||
self.descr_field.set_text(event.getDescription())
|
||||
self.conf_menu.set_history(event.getConfidence())
|
||||
@ -1674,6 +1718,7 @@ class EventEditor:
|
||||
self.note_field.insert_defaults(event.getNote())
|
||||
self.note_field.set_word_wrap(1)
|
||||
else:
|
||||
attach_places(values,self.place_combo,None)
|
||||
self.conf_menu.set_history(2)
|
||||
|
||||
self.window.set_data("o",self)
|
||||
@ -1703,7 +1748,8 @@ def on_event_edit_ok_clicked(obj):
|
||||
|
||||
ename = ee.name_field.get_text()
|
||||
edate = ee.date_field.get_text()
|
||||
eplace = ee.place_field.get_text()
|
||||
eplace = string.strip(ee.place_field.get_text())
|
||||
eplace_obj = get_place_from_list(ee.place_combo)
|
||||
enote = ee.note_field.get_chars(0,-1)
|
||||
edesc = ee.descr_field.get_text()
|
||||
epriv = ee.priv.get_active()
|
||||
@ -1712,8 +1758,13 @@ def on_event_edit_ok_clicked(obj):
|
||||
if event == None:
|
||||
event = Event()
|
||||
ee.parent.elist.append(event)
|
||||
|
||||
if eplace_obj == None and eplace != "":
|
||||
eplace_obj = Place()
|
||||
eplace_obj.set_title(eplace)
|
||||
ee.parent.db.addPlace(eplace_obj)
|
||||
|
||||
if update_event(event,ename,edate,eplace,edesc,enote,epriv,econf):
|
||||
if update_event(event,ename,edate,eplace_obj,edesc,enote,epriv,econf):
|
||||
ee.parent.events_changed = 1
|
||||
|
||||
if not event.getSourceRef().are_equal(ee.srcref):
|
||||
@ -2141,3 +2192,49 @@ def get_detail_text(obj):
|
||||
details = "%s, %s" % (details,_("Private"))
|
||||
return details
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def attach_places(values,combo,place):
|
||||
l = GtkLabel("")
|
||||
l.show()
|
||||
l.set_alignment(0,0.5)
|
||||
c = GtkListItem()
|
||||
c.add(l)
|
||||
c.set_data("s",None)
|
||||
c.show()
|
||||
sel_child = c
|
||||
list = [c]
|
||||
mymap = {}
|
||||
for src in values:
|
||||
l = GtkLabel("%s [%s]" % (src.get_title(),src.getId()))
|
||||
l.show()
|
||||
l.set_alignment(0,0.5)
|
||||
c = GtkListItem()
|
||||
c.add(l)
|
||||
c.set_data("s",src)
|
||||
c.show()
|
||||
list.append(c)
|
||||
if src == place:
|
||||
sel_child = c
|
||||
mymap[src] = c
|
||||
|
||||
combo.list.append_items(list)
|
||||
combo.list.select_child(sel_child)
|
||||
|
||||
for v in mymap.keys():
|
||||
combo.set_item_string(mymap[v],v.get_title())
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def get_place_from_list(obj):
|
||||
select = obj.list.get_selection()
|
||||
if len(select) == 0:
|
||||
return None
|
||||
else:
|
||||
return select[0].get_data("s")
|
||||
|
@ -92,6 +92,8 @@ class GrampsParser(handler.ContentHandler):
|
||||
self.source = None
|
||||
self.source_ref = None
|
||||
self.attribute = None
|
||||
self.placeobj = None
|
||||
self.place_map = {}
|
||||
|
||||
self.resname = ""
|
||||
self.resaddr = ""
|
||||
@ -142,6 +144,57 @@ class GrampsParser(handler.ContentHandler):
|
||||
person = self.db.personMap[id]
|
||||
self.db.setDefaultPerson(person)
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#---------------------------------------------------------------------
|
||||
def start_place(self,attrs):
|
||||
if attrs.has_key('ref'):
|
||||
self.placeobj = self.db.findPlaceNoMap(u2l(attrs['ref']))
|
||||
else:
|
||||
self.placeobj = None
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#---------------------------------------------------------------------
|
||||
def start_placeobj(self,attrs):
|
||||
self.placeobj = self.db.findPlaceNoMap(u2l(attrs['id']))
|
||||
self.placeobj.set_title(u2l(attrs['title']))
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#---------------------------------------------------------------------
|
||||
def start_location(self,attrs):
|
||||
loc = Location()
|
||||
if attrs.has_key('city'):
|
||||
loc.set_city(attrs['city'])
|
||||
if attrs.has_key('state'):
|
||||
loc.set_state(attrs['state'])
|
||||
if attrs.has_key('county'):
|
||||
loc.set_state(attrs['county'])
|
||||
if attrs.has_key('country'):
|
||||
loc.set_state(attrs['country'])
|
||||
if attrs.has_key('type'):
|
||||
self.placeobj.add_alternate_locations(loc)
|
||||
else:
|
||||
self.placeobj.set_main_location(loc)
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#---------------------------------------------------------------------
|
||||
def start_coord(tag,attrs):
|
||||
if attrs.has_key('lat'):
|
||||
self.placeobj.set_latitude(attrs['lat'])
|
||||
if attrs.has_key('long'):
|
||||
self.placeobj.set_longitude(attrs['long'])
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
@ -262,7 +315,10 @@ class GrampsParser(handler.ContentHandler):
|
||||
url.set_description(desc)
|
||||
if attrs.has_key("priv"):
|
||||
url.setPrivacy(string.atoi(attrs['priv']))
|
||||
self.person.addUrl(url)
|
||||
if self.person:
|
||||
self.person.addUrl(url)
|
||||
elif self.placeobj:
|
||||
self.placeobj.addUrl(url)
|
||||
except KeyError:
|
||||
return
|
||||
|
||||
@ -352,6 +408,8 @@ class GrampsParser(handler.ContentHandler):
|
||||
self.event.setSourceRef(self.source_ref)
|
||||
elif self.attribute:
|
||||
self.attribute.setSourceRef(self.source_ref)
|
||||
elif self.placeobj:
|
||||
self.placeobj.setSourceRef(self.source_ref)
|
||||
else:
|
||||
print "Sorry, I'm lost"
|
||||
|
||||
@ -385,8 +443,10 @@ class GrampsParser(handler.ContentHandler):
|
||||
self.family.addPhoto(photo)
|
||||
elif self.source:
|
||||
self.source.addPhoto(photo)
|
||||
else:
|
||||
elif self.person:
|
||||
self.person.addPhoto(photo)
|
||||
elif self.placeobj:
|
||||
self.placeobj.addPhoto(photo)
|
||||
else:
|
||||
photo.addProperty(key,attrs[key])
|
||||
|
||||
@ -441,6 +501,14 @@ class GrampsParser(handler.ContentHandler):
|
||||
def stop_address(self,tag):
|
||||
self.address = None
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#---------------------------------------------------------------------
|
||||
def stop_places(self,tag):
|
||||
self.placeobj = None
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
@ -474,7 +542,15 @@ class GrampsParser(handler.ContentHandler):
|
||||
#
|
||||
#---------------------------------------------------------------------
|
||||
def stop_place(self,tag):
|
||||
self.event.place = u2l(tag)
|
||||
if self.placeobj == None:
|
||||
if self.place_map.has_key(tag):
|
||||
self.placeobj = self.place_map[tag]
|
||||
else:
|
||||
self.placeobj = Place()
|
||||
self.placeobj.set_title(tag)
|
||||
self.db.addPlace(self.placeobj)
|
||||
self.place_map[tag] = self.placeobj
|
||||
self.event.place = self.placeobj
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
#
|
||||
@ -706,6 +782,8 @@ class GrampsParser(handler.ContentHandler):
|
||||
self.person.setNote(note)
|
||||
elif self.family:
|
||||
self.family.setNote(note)
|
||||
elif self.placeobj:
|
||||
self.placeobj.setNote(note)
|
||||
self.note_list = []
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
@ -837,7 +915,11 @@ class GrampsParser(handler.ContentHandler):
|
||||
"people" : (start_people, stop_people),
|
||||
"person" : (start_person, None),
|
||||
"img" : (start_photo, None),
|
||||
"place" : (None, stop_place),
|
||||
"place" : (start_place, stop_place),
|
||||
"places" : (None, stop_places),
|
||||
"placeobj" : (start_placeobj,None),
|
||||
"location" : (start_location,None),
|
||||
"coord" : (start_coord,None),
|
||||
"pos" : (start_pos, None),
|
||||
"postal" : (None, stop_postal),
|
||||
"researcher" : (None, stop_research),
|
||||
@ -1003,6 +1085,8 @@ class GrampsImportParser(GrampsParser):
|
||||
self.event.setSourceRef(self.source_ref)
|
||||
elif self.attribute:
|
||||
self.attribute.setSourceRef(self.source_ref)
|
||||
elif self.placeobj:
|
||||
self.placeobj.setSourceRef(self.source_ref)
|
||||
else:
|
||||
print "Sorry, I'm lost"
|
||||
|
||||
|
@ -198,7 +198,8 @@ class Marriage:
|
||||
if not event:
|
||||
return
|
||||
detail = get_detail_flags(event)
|
||||
self.event_list.append([text,event.getQuoteDate(),event.getPlace(),detail])
|
||||
self.event_list.append([text,event.getQuoteDate(),
|
||||
event.getPlace().get_title(),detail])
|
||||
self.event_list.set_row_data(self.lines,event)
|
||||
self.lines = self.lines + 1
|
||||
|
||||
@ -435,7 +436,7 @@ def on_select_row(obj,row,b,c):
|
||||
event = obj.get_row_data(row)
|
||||
|
||||
family_obj.date_field.set_text(event.getDate())
|
||||
family_obj.place_field.set_text(event.getPlace())
|
||||
family_obj.place_field.set_text(event.getPlace().get_title())
|
||||
family_obj.name_field.set_label(const.display_fevent(event.getName()))
|
||||
family_obj.event_details.set_text(get_detail_text(event))
|
||||
family_obj.descr_field.set_text(event.getDescription())
|
||||
@ -767,6 +768,7 @@ class EventEditor:
|
||||
self.window = self.top.get_widget("event_edit")
|
||||
self.name_field = self.top.get_widget("eventName")
|
||||
self.place_field = self.top.get_widget("eventPlace")
|
||||
self.place_combo = self.top.get_widget("eventPlace_combo")
|
||||
self.date_field = self.top.get_widget("eventDate")
|
||||
self.descr_field = self.top.get_widget("eventDescription")
|
||||
self.note_field = self.top.get_widget("eventNote")
|
||||
@ -799,9 +801,16 @@ class EventEditor:
|
||||
|
||||
self.conf_menu.set_menu(myMenu)
|
||||
|
||||
values = self.parent.db.getPlaceMap().values()
|
||||
if event != None:
|
||||
self.name_field.set_text(event.getName())
|
||||
self.place_field.set_text(event.getPlace())
|
||||
|
||||
attach_places(values,self.place_combo,event.getPlace())
|
||||
if event.getPlace():
|
||||
self.place_field.set_text(event.getPlace().get_title())
|
||||
else:
|
||||
self.place_field.set_text('')
|
||||
|
||||
self.date_field.set_text(event.getDate())
|
||||
self.descr_field.set_text(event.getDescription())
|
||||
self.conf_menu.set_history(event.getConfidence())
|
||||
@ -818,6 +827,7 @@ class EventEditor:
|
||||
self.note_field.insert_defaults(event.getNote())
|
||||
self.note_field.set_word_wrap(1)
|
||||
else:
|
||||
attach_places(values,self.place_combo,None)
|
||||
self.conf_menu.set_history(2)
|
||||
|
||||
self.window.set_data("o",self)
|
||||
@ -847,7 +857,8 @@ def on_event_edit_ok_clicked(obj):
|
||||
|
||||
ename = ee.name_field.get_text()
|
||||
edate = ee.date_field.get_text()
|
||||
eplace = ee.place_field.get_text()
|
||||
eplace = string.strip(ee.place_field.get_text())
|
||||
eplace_obj = get_place_from_list(ee.place_combo)
|
||||
enote = ee.note_field.get_chars(0,-1)
|
||||
edesc = ee.descr_field.get_text()
|
||||
epriv = ee.priv.get_active()
|
||||
@ -857,7 +868,12 @@ def on_event_edit_ok_clicked(obj):
|
||||
event = Event()
|
||||
ee.parent.elist.append(event)
|
||||
|
||||
if update_event(event,ename,edate,eplace,edesc,enote,epriv,econf):
|
||||
if eplace_obj == None and eplace != "":
|
||||
eplace_obj = Place()
|
||||
eplace_obj.set_title(eplace)
|
||||
ee.parent.db.addPlace(eplace_obj)
|
||||
|
||||
if update_event(event,ename,edate,eplace_obj,edesc,enote,epriv,econf):
|
||||
ee.parent.events_changed = 1
|
||||
|
||||
if not source_refs_equal(event.getSourceRef(),ee.srcref):
|
||||
@ -1038,3 +1054,50 @@ def source_refs_equal(one,two):
|
||||
if one.text != two.text:
|
||||
return 0
|
||||
return 1
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def attach_places(values,combo,place):
|
||||
l = GtkLabel("")
|
||||
l.show()
|
||||
l.set_alignment(0,0.5)
|
||||
c = GtkListItem()
|
||||
c.add(l)
|
||||
c.set_data("s",None)
|
||||
c.show()
|
||||
sel_child = c
|
||||
list = [c]
|
||||
mymap = {}
|
||||
for src in values:
|
||||
l = GtkLabel("%s [%s]" % (src.get_title(),src.getId()))
|
||||
l.show()
|
||||
l.set_alignment(0,0.5)
|
||||
c = GtkListItem()
|
||||
c.add(l)
|
||||
c.set_data("s",src)
|
||||
c.show()
|
||||
list.append(c)
|
||||
if src == place:
|
||||
sel_child = c
|
||||
mymap[src] = c
|
||||
|
||||
combo.list.append_items(list)
|
||||
combo.list.select_child(sel_child)
|
||||
|
||||
for v in mymap.keys():
|
||||
combo.set_item_string(mymap[v],v.get_title())
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def get_place_from_list(obj):
|
||||
select = obj.list.get_selection()
|
||||
if len(select) == 0:
|
||||
return None
|
||||
else:
|
||||
return select[0].get_data("s")
|
||||
|
246
src/RelLib.py
246
src/RelLib.py
@ -21,6 +21,162 @@
|
||||
from Date import *
|
||||
from Researcher import *
|
||||
|
||||
class Place:
|
||||
def __init__(self,source=None):
|
||||
if source:
|
||||
self.long = source.log
|
||||
self.lat = source.lat
|
||||
self.title = source.title
|
||||
self.main_loc = Location(source.main_loc)
|
||||
self.alt_loc = []
|
||||
if source.source_ref:
|
||||
self.source_ref = SourceRef(source.source_ref)
|
||||
else:
|
||||
self.source_ref = None
|
||||
if source.note:
|
||||
self.note = Note(source.note.get())
|
||||
else:
|
||||
self.note = None
|
||||
for loc in source.alt_loc:
|
||||
self.alt_loc = Location(loc)
|
||||
self.id = source.id
|
||||
self.urls = []
|
||||
for u in source.urls:
|
||||
self.urls.append(Url(u))
|
||||
self.photoList = []
|
||||
for photo in source.photoList:
|
||||
self.photoList.append(Photo(photo))
|
||||
else:
|
||||
self.source_ref = None
|
||||
self.long = ""
|
||||
self.lat = ""
|
||||
self.title = ""
|
||||
self.note = None
|
||||
self.main_loc = Location()
|
||||
self.alt_loc = []
|
||||
self.id = ""
|
||||
self.urls = []
|
||||
self.photoList = []
|
||||
|
||||
def getUrlList(self):
|
||||
return self.urls
|
||||
|
||||
def setUrlList(self,list):
|
||||
self.urls = list
|
||||
|
||||
def addUrl(self,url):
|
||||
self.urls.append(url)
|
||||
|
||||
def setSourceRef(self,id) :
|
||||
self.source_ref = id
|
||||
|
||||
def getSourceRef(self) :
|
||||
if not self.source_ref:
|
||||
self.source_ref = SourceRef()
|
||||
return self.source_ref
|
||||
|
||||
def setId(self,id):
|
||||
self.id = id
|
||||
|
||||
def getId(self):
|
||||
return self.id
|
||||
|
||||
def set_title(self,name):
|
||||
self.title = name
|
||||
|
||||
def get_title(self):
|
||||
return self.title
|
||||
|
||||
def set_longitude(self,long):
|
||||
self.long = long
|
||||
|
||||
def get_longitude(self):
|
||||
return self.long
|
||||
|
||||
def set_latitude(self,long):
|
||||
self.lat = long
|
||||
|
||||
def get_latitude(self):
|
||||
return self.lat
|
||||
|
||||
def get_main_location(self):
|
||||
return self.main_loc
|
||||
|
||||
def set_main_location(self,loc):
|
||||
self.main_loc = loc
|
||||
|
||||
def get_alternate_locations(self):
|
||||
return self.alt_loc
|
||||
|
||||
def add_alternate_locations(self,loc):
|
||||
if loc not in self.alt_loc:
|
||||
self.alt_loc.append(loc)
|
||||
|
||||
def setNote(self,text):
|
||||
if self.note == None:
|
||||
self.note = Note()
|
||||
self.note.set(text)
|
||||
|
||||
def getNote(self):
|
||||
if self.note == None:
|
||||
return ""
|
||||
else:
|
||||
return self.note.get()
|
||||
|
||||
def setNoteObj(self,obj):
|
||||
self.note = obj
|
||||
|
||||
def getNoteObj(self):
|
||||
return self.note
|
||||
|
||||
def addPhoto(self,photo):
|
||||
self.photoList.append(photo)
|
||||
|
||||
def getPhotoList(self):
|
||||
return self.photoList
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Location
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class Location:
|
||||
def __init__(self,source=None):
|
||||
if source:
|
||||
self.city = source.city
|
||||
self.county = source.county
|
||||
self.state = source.state
|
||||
self.country = source.country
|
||||
else:
|
||||
self.city = ""
|
||||
self.county = ""
|
||||
self.state = ""
|
||||
self.country = ""
|
||||
|
||||
def set_city(self,data):
|
||||
self.city = data
|
||||
|
||||
def get_city(self):
|
||||
return self.city
|
||||
|
||||
def set_county(self,data):
|
||||
self.county = data
|
||||
|
||||
def get_county(self):
|
||||
return self.county
|
||||
|
||||
def set_state(self,data):
|
||||
self.state = data
|
||||
|
||||
def get_state(self):
|
||||
return self.state
|
||||
|
||||
def set_country(self,data):
|
||||
self.country = data
|
||||
|
||||
def get_country(self):
|
||||
return self.country
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Note class.
|
||||
@ -42,11 +198,22 @@ class Note:
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class Photo:
|
||||
def __init__(self):
|
||||
self.path = ""
|
||||
self.desc = ""
|
||||
self.private = 0
|
||||
self.proplist = None
|
||||
def __init__(self,source=None):
|
||||
if source:
|
||||
self.path = source.path
|
||||
self.desc = source.desc
|
||||
self.private = source.private
|
||||
if self.proplist != None:
|
||||
self.proplist = {}
|
||||
for p in source.proplist.keys():
|
||||
self.proplist[k] = source.proplist[k]
|
||||
else:
|
||||
self.proplist = None
|
||||
else:
|
||||
self.path = ""
|
||||
self.desc = ""
|
||||
self.private = 0
|
||||
self.proplist = None
|
||||
|
||||
def setPath(self,path):
|
||||
self.path = path
|
||||
@ -659,7 +826,7 @@ class Event:
|
||||
self.confidence = source.confidence
|
||||
self.private = source.private
|
||||
else:
|
||||
self.place = ""
|
||||
self.place = None
|
||||
self.date = Date()
|
||||
self.description = ""
|
||||
self.name = ""
|
||||
@ -1025,13 +1192,16 @@ class RelDataBase:
|
||||
self.personMap = {}
|
||||
self.familyMap = {}
|
||||
self.sourceMap = {}
|
||||
self.placeMap = {}
|
||||
self.smapIndex = 0
|
||||
self.pmapIndex = 0
|
||||
self.fmapIndex = 0
|
||||
self.lmapIndex = 0
|
||||
self.default = None
|
||||
self.owner = Researcher()
|
||||
self.bookmarks = []
|
||||
self.path = ""
|
||||
self.place2title = {}
|
||||
|
||||
def getBookmarks(self):
|
||||
return self.bookmarks
|
||||
@ -1062,6 +1232,19 @@ class RelDataBase:
|
||||
def setPersonMap(self,map):
|
||||
self.personMap = map
|
||||
|
||||
def getPlaceFromTitle(self,title):
|
||||
for val in self.placeMap.keys():
|
||||
p = self.placeMap[val]
|
||||
if title == p.title:
|
||||
return p
|
||||
return None
|
||||
|
||||
def getPlaceMap(self):
|
||||
return self.placeMap
|
||||
|
||||
def setPlaceMap(self,map):
|
||||
self.placeMap = map
|
||||
|
||||
def getFamilyMap(self):
|
||||
return self.familyMap
|
||||
|
||||
@ -1116,14 +1299,10 @@ class RelDataBase:
|
||||
return map.keys()
|
||||
|
||||
def getPlaces(self):
|
||||
map = {}
|
||||
for family in self.familyMap.values():
|
||||
for attr in family.getEventList():
|
||||
map[attr.getPlace()] = 1
|
||||
for person in self.personMap.values():
|
||||
for attr in person.getEventList():
|
||||
map[attr.getPlace()] = 1
|
||||
return map.keys()
|
||||
map = []
|
||||
for place in self.placeMap.values():
|
||||
map.append(place.get_title())
|
||||
return map[:]
|
||||
|
||||
def getFamilyRelationTypes(self):
|
||||
map = {}
|
||||
@ -1165,6 +1344,9 @@ class RelDataBase:
|
||||
def getNextSourceId(self):
|
||||
return self.smapIndex
|
||||
|
||||
def getNextPlaceId(self):
|
||||
return self.lmapIndex
|
||||
|
||||
def addSource(self,source):
|
||||
index = "S%d" % self.smapIndex
|
||||
while self.sourceMap.has_key(index):
|
||||
@ -1175,6 +1357,16 @@ class RelDataBase:
|
||||
self.smapIndex = self.smapIndex + 1
|
||||
return index
|
||||
|
||||
def addPlace(self,place):
|
||||
index = "P%d" % self.lmapIndex
|
||||
while self.placeMap.has_key(index):
|
||||
self.lmapIndex = self.lmapIndex + 1
|
||||
index = "P%d" % self.lmapIndex
|
||||
place.setId(index)
|
||||
self.placeMap[index] = place
|
||||
self.lmapIndex = self.lmapIndex + 1
|
||||
return index
|
||||
|
||||
def findSource(self,idVal,map):
|
||||
idVal = str(idVal)
|
||||
if map.has_key(idVal):
|
||||
@ -1184,6 +1376,15 @@ class RelDataBase:
|
||||
map[idVal] = self.addSource(source)
|
||||
return source
|
||||
|
||||
def findPlace(self,idVal,map):
|
||||
idVal = str(idVal)
|
||||
if map.has_key(idVal):
|
||||
place = self.placeMap[map[idVal]]
|
||||
else:
|
||||
palce = Place()
|
||||
map[idVal] = self.addPlace(place)
|
||||
return place
|
||||
|
||||
def addSourceNoMap(self,source,index):
|
||||
index = str(index)
|
||||
source.setId(index)
|
||||
@ -1191,6 +1392,13 @@ class RelDataBase:
|
||||
self.smapIndex = self.smapIndex + 1
|
||||
return index
|
||||
|
||||
def addPlaceNoMap(self,place,index):
|
||||
index = str(index)
|
||||
place.setId(index)
|
||||
self.placeMap[index] = place
|
||||
self.lmapIndex = self.lmapIndex + 1
|
||||
return index
|
||||
|
||||
def findSourceNoMap(self,idVal):
|
||||
val = str(idVal)
|
||||
if self.sourceMap.has_key(val):
|
||||
@ -1200,6 +1408,15 @@ class RelDataBase:
|
||||
self.addSourceNoMap(source,val)
|
||||
return source
|
||||
|
||||
def findPlaceNoMap(self,idVal):
|
||||
val = str(idVal)
|
||||
if self.placeMap.has_key(val):
|
||||
place = self.placeMap[val]
|
||||
else:
|
||||
place = Place()
|
||||
self.addPlaceNoMap(place,val)
|
||||
return place
|
||||
|
||||
def newFamily(self):
|
||||
index = "F%d" % self.fmapIndex
|
||||
while self.familyMap.has_key(index):
|
||||
@ -1241,3 +1458,4 @@ class RelDataBase:
|
||||
del self.familyMap[family.getId()]
|
||||
|
||||
|
||||
|
||||
|
@ -67,15 +67,21 @@ class SourceEditor:
|
||||
self.showSource = libglade.GladeXML(const.gladeFile, "sourceDisplay")
|
||||
self.showSource.signal_autoconnect({
|
||||
"on_sourceok_clicked" : on_sourceok_clicked,
|
||||
"on_source_changed": on_source_changed,
|
||||
"destroy_passed_object" : utils.destroy_passed_object
|
||||
})
|
||||
self.sourceDisplay = self.get_widget("sourceDisplay")
|
||||
self.source_field = self.get_widget("sourceList")
|
||||
self.title_menu = self.get_widget("source_title")
|
||||
self.title_menu.set_data("o",self)
|
||||
|
||||
self.author_field = self.get_widget("sauthor")
|
||||
self.pub_field = self.get_widget("spubinfo")
|
||||
|
||||
self.active_source = None
|
||||
if self.source_ref:
|
||||
self.active_source = self.source_ref.getBase()
|
||||
else:
|
||||
self.active_source = None
|
||||
self.draw()
|
||||
self.sourceDisplay.set_data(SOURCEDISP,self)
|
||||
self.sourceDisplay.show()
|
||||
@ -88,42 +94,13 @@ class SourceEditor:
|
||||
def get_widget(self,name):
|
||||
return self.showSource.get_widget(name)
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
#
|
||||
# draw
|
||||
#
|
||||
#---------------------------------------------------------------------
|
||||
def draw(self):
|
||||
|
||||
typeMenu = GtkMenu()
|
||||
menuitem = GtkMenuItem('None')
|
||||
menuitem.set_data("s",None)
|
||||
menuitem.set_data("o",self)
|
||||
menuitem.connect("activate",on_source_changed)
|
||||
menuitem.show()
|
||||
typeMenu.append(menuitem)
|
||||
index = 1
|
||||
active = 0
|
||||
save = 0
|
||||
if self.source_ref:
|
||||
self.base = self.source_ref.getBase()
|
||||
else:
|
||||
self.base = None
|
||||
|
||||
for src in self.db.getSourceMap().values():
|
||||
if src == self.base:
|
||||
active = 1
|
||||
save = index
|
||||
menuitem = GtkMenuItem(src.getTitle())
|
||||
menuitem.set_data("s",src)
|
||||
menuitem.set_data("o",self)
|
||||
menuitem.connect("activate",on_source_changed)
|
||||
menuitem.show()
|
||||
typeMenu.append(menuitem)
|
||||
index = index + 1
|
||||
typeMenu.set_active(save)
|
||||
self.title_menu.set_menu(typeMenu)
|
||||
|
||||
self.get_widget("spage").set_sensitive(active)
|
||||
self.get_widget("sdate").set_sensitive(active)
|
||||
self.get_widget("stext").set_sensitive(active)
|
||||
self.get_widget("scomment").set_sensitive(active)
|
||||
|
||||
if self.source_ref:
|
||||
self.get_widget("spage").set_text(self.source_ref.getPage())
|
||||
date = self.source_ref.getDate()
|
||||
@ -149,6 +126,50 @@ class SourceEditor:
|
||||
self.author_field.set_text("")
|
||||
self.pub_field.set_text("")
|
||||
|
||||
if self.active_source:
|
||||
active = 1
|
||||
else:
|
||||
active = 0
|
||||
|
||||
values = self.db.getSourceMap().values()
|
||||
values.sort(by_title)
|
||||
l = GtkLabel("-- No Source --")
|
||||
l.show()
|
||||
l.set_alignment(0,0.5)
|
||||
c = GtkListItem()
|
||||
c.add(l)
|
||||
c.set_data("s",None)
|
||||
c.show()
|
||||
sel_child = c
|
||||
list = [c]
|
||||
|
||||
for src in values:
|
||||
l = GtkLabel("%s [%s]" % (src.getTitle(),src.getId()))
|
||||
l.show()
|
||||
l.set_alignment(0,0.5)
|
||||
c = GtkListItem()
|
||||
c.add(l)
|
||||
c.set_data("s",src)
|
||||
c.show()
|
||||
list.append(c)
|
||||
if src == self.active_source:
|
||||
sel_child = c
|
||||
|
||||
self.title_menu.list.append_items(list)
|
||||
self.title_menu.list.select_child(sel_child)
|
||||
self.get_widget("spage").set_sensitive(active)
|
||||
self.get_widget("sdate").set_sensitive(active)
|
||||
self.get_widget("stext").set_sensitive(active)
|
||||
self.get_widget("scomment").set_sensitive(active)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def by_title(a,b):
|
||||
return cmp(a.getTitle(),b.getTitle())
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
@ -158,9 +179,10 @@ def on_sourceok_clicked(obj):
|
||||
|
||||
src_edit = obj.get_data(SOURCEDISP)
|
||||
|
||||
|
||||
if src_edit.active_source != src_edit.source_ref.getBase():
|
||||
src_edit.source_ref.setBase(src_edit.active_source)
|
||||
|
||||
|
||||
page = src_edit.get_widget("spage").get_text()
|
||||
date = src_edit.get_widget("sdate").get_text()
|
||||
text = src_edit.get_widget("stext").get_chars(0,-1)
|
||||
@ -189,7 +211,7 @@ def on_sourceok_clicked(obj):
|
||||
def on_source_changed(obj):
|
||||
|
||||
src_entry = obj.get_data("o")
|
||||
src_entry.active_source = obj.get_data("s")
|
||||
src_entry.active_source = obj.list.get_selection()[0].get_data("s")
|
||||
|
||||
if src_entry.active_source == None:
|
||||
active = 0
|
||||
|
@ -114,7 +114,7 @@ def dump_my_event(g,name,event,index=1):
|
||||
sp = " " * index
|
||||
g.write('%s<event type="%s"%s>\n' % (sp,fix(name),conf_priv(event)))
|
||||
write_line(g,"date",date,index+1)
|
||||
write_line(g,"place",place,index+1)
|
||||
write_ref(g,"place",place,index+1)
|
||||
write_line(g,"description",description,index+1)
|
||||
if event.getNote() != "":
|
||||
writeNote(g,"note",event.getNote(),index+1)
|
||||
@ -230,7 +230,8 @@ def exportData(database, filename, callback):
|
||||
familyList = database.getFamilyMap().values()
|
||||
familyList.sort(sortById)
|
||||
sourceList = database.getSourceMap().values()
|
||||
sourceList.sort(sortById)
|
||||
placeList = database.getPlaceMap().values()
|
||||
placeList.sort(sortById)
|
||||
|
||||
total = len(personList) + len(familyList)
|
||||
|
||||
@ -438,6 +439,57 @@ def exportData(database, filename, callback):
|
||||
g.write(" </source>\n")
|
||||
g.write(" </sources>\n")
|
||||
|
||||
if len(placeList) > 0:
|
||||
g.write(" <places>\n")
|
||||
for place in placeList:
|
||||
g.write(' <placeobj id="%s" title="%s">\n' % \
|
||||
(place.getId(),place.get_title()))
|
||||
if place.get_longitude() != "" or place.get_latitude() != "":
|
||||
g.write(' <coord long="%s" lat=%s"/>\n' % \
|
||||
(place.get_longitude(),place.get_latitude()))
|
||||
loc = place.get_main_location()
|
||||
city = loc.get_city()
|
||||
state = loc.get_state()
|
||||
country = loc.get_country()
|
||||
county = loc.get_county()
|
||||
if city or state or country or county:
|
||||
g.write(' <location city="%s" ' % city)
|
||||
g.write('county="%s" state="%s" ' % (county,state))
|
||||
g.write('country="%s"/>\n' % country)
|
||||
for loc in place.get_alternate_locations():
|
||||
city = loc.get_city()
|
||||
state = loc.get_state()
|
||||
country = loc.get_country()
|
||||
county = loc.get_county()
|
||||
if city or state or country or county:
|
||||
g.write(' <location type="alternate"')
|
||||
g.write('city="%s" county="%s" state="%s" country="%s"/>\n' \
|
||||
% (city,county,state,country))
|
||||
for photo in place.getPhotoList():
|
||||
path = photo.getPath()
|
||||
l = len(fileroot)
|
||||
if len(path) >= l:
|
||||
if fileroot == path[0:l]:
|
||||
path = path[l+1:]
|
||||
g.write(" <img src=\"" + fix(path) + "\"")
|
||||
g.write(" descrip=\"" + fix(photo.getDescription()) + "\"")
|
||||
proplist = photo.getPropertyList()
|
||||
if proplist:
|
||||
for key in proplist.keys():
|
||||
g.write(' %s="%s"' % (key,proplist[key]))
|
||||
g.write("/>\n")
|
||||
if len(place.getUrlList()) > 0:
|
||||
for url in place.getUrlList():
|
||||
g.write(' <url priv="%d" href="%s"' % \
|
||||
(url.getPrivacy(),url.get_path()))
|
||||
if url.get_description() != "":
|
||||
g.write(' description="' + url.get_description() + '"')
|
||||
if place.getNote() != "":
|
||||
writeNote(g,"note",place.getNote(),3)
|
||||
dump_source_ref(g,event.getSourceRef(),index+1)
|
||||
g.write(" </placeobj>\n")
|
||||
g.write(" </places>\n")
|
||||
|
||||
if len(database.getBookmarks()) > 0:
|
||||
g.write(" <bookmarks>\n")
|
||||
for person in database.getBookmarks():
|
||||
|
219
src/gramps.glade
219
src/gramps.glade
@ -224,6 +224,18 @@
|
||||
<label>_Sources</label>
|
||||
<right_justify>False</right_justify>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkMenuItem</class>
|
||||
<name>places1</name>
|
||||
<signal>
|
||||
<name>activate</name>
|
||||
<handler>on_places_activate</handler>
|
||||
<last_modification_time>Tue, 14 Aug 2001 13:39:34 GMT</last_modification_time>
|
||||
</signal>
|
||||
<label>_Places</label>
|
||||
<right_justify>False</right_justify>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
@ -495,7 +507,10 @@
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>Placeholder</class>
|
||||
<class>GtkButton</class>
|
||||
<child_name>Toolbar:button</child_name>
|
||||
<name>button111</name>
|
||||
<label>Places</label>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
@ -2792,6 +2807,143 @@
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkVBox</class>
|
||||
<name>vbox38</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
|
||||
<widget>
|
||||
<class>GtkScrolledWindow</class>
|
||||
<name>scrolledwindow26</name>
|
||||
<hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy>
|
||||
<vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy>
|
||||
<hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
|
||||
<vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkCList</class>
|
||||
<name>place_list</name>
|
||||
<can_focus>True</can_focus>
|
||||
<signal>
|
||||
<name>select_row</name>
|
||||
<handler>on_source_list_select_row</handler>
|
||||
<last_modification_time>Tue, 29 May 2001 21:23:02 GMT</last_modification_time>
|
||||
</signal>
|
||||
<signal>
|
||||
<name>button_press_event</name>
|
||||
<handler>on_source_list_button_press_event</handler>
|
||||
<last_modification_time>Thu, 31 May 2001 17:22:45 GMT</last_modification_time>
|
||||
</signal>
|
||||
<columns>2</columns>
|
||||
<column_widths>427,80</column_widths>
|
||||
<selection_mode>GTK_SELECTION_SINGLE</selection_mode>
|
||||
<show_titles>True</show_titles>
|
||||
<shadow_type>GTK_SHADOW_IN</shadow_type>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<child_name>CList:title</child_name>
|
||||
<name>label232</name>
|
||||
<label>Place Name</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0.5</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<child_name>CList:title</child_name>
|
||||
<name>label233</name>
|
||||
<label>Country</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0.5</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkHButtonBox</class>
|
||||
<name>hbuttonbox24</name>
|
||||
<layout_style>GTK_BUTTONBOX_SPREAD</layout_style>
|
||||
<spacing>30</spacing>
|
||||
<child_min_width>85</child_min_width>
|
||||
<child_min_height>27</child_min_height>
|
||||
<child_ipad_x>7</child_ipad_x>
|
||||
<child_ipad_y>0</child_ipad_y>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkButton</class>
|
||||
<name>button112</name>
|
||||
<can_default>True</can_default>
|
||||
<can_focus>True</can_focus>
|
||||
<signal>
|
||||
<name>clicked</name>
|
||||
<handler>on_add_source_clicked</handler>
|
||||
<object>source_list</object>
|
||||
<last_modification_time>Tue, 29 May 2001 21:16:02 GMT</last_modification_time>
|
||||
</signal>
|
||||
<label>Add Place</label>
|
||||
<relief>GTK_RELIEF_NORMAL</relief>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkButton</class>
|
||||
<name>button113</name>
|
||||
<can_default>True</can_default>
|
||||
<can_focus>True</can_focus>
|
||||
<signal>
|
||||
<name>clicked</name>
|
||||
<handler>on_edit_source_clicked</handler>
|
||||
<object>source_list</object>
|
||||
<last_modification_time>Tue, 29 May 2001 21:15:39 GMT</last_modification_time>
|
||||
</signal>
|
||||
<label>Edit Edit</label>
|
||||
<relief>GTK_RELIEF_NORMAL</relief>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkButton</class>
|
||||
<name>button114</name>
|
||||
<sensitive>False</sensitive>
|
||||
<can_default>True</can_default>
|
||||
<can_focus>True</can_focus>
|
||||
<label>Delete Place</label>
|
||||
<relief>GTK_RELIEF_NORMAL</relief>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<child_name>Notebook:tab</child_name>
|
||||
<name>label230</name>
|
||||
<label>label230</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0.5</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
@ -4807,29 +4959,6 @@ Unknown
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkOptionMenu</class>
|
||||
<name>source_title</name>
|
||||
<can_focus>True</can_focus>
|
||||
<items>
|
||||
</items>
|
||||
<initial_choice>0</initial_choice>
|
||||
<child>
|
||||
<left_attach>1</left_attach>
|
||||
<right_attach>2</right_attach>
|
||||
<top_attach>0</top_attach>
|
||||
<bottom_attach>1</bottom_attach>
|
||||
<xpad>5</xpad>
|
||||
<ypad>5</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>sauthor</name>
|
||||
@ -4881,6 +5010,48 @@ Unknown
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkCombo</class>
|
||||
<name>source_title</name>
|
||||
<value_in_list>True</value_in_list>
|
||||
<ok_if_empty>False</ok_if_empty>
|
||||
<case_sensitive>False</case_sensitive>
|
||||
<use_arrows>True</use_arrows>
|
||||
<use_arrows_always>False</use_arrows_always>
|
||||
<items></items>
|
||||
<child>
|
||||
<left_attach>1</left_attach>
|
||||
<right_attach>2</right_attach>
|
||||
<top_attach>0</top_attach>
|
||||
<bottom_attach>1</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>True</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkEntry</class>
|
||||
<child_name>GtkCombo:entry</child_name>
|
||||
<name>combo-entry1</name>
|
||||
<can_focus>True</can_focus>
|
||||
<signal>
|
||||
<name>changed</name>
|
||||
<handler>on_source_changed</handler>
|
||||
<object>source_title</object>
|
||||
<last_modification_time>Thu, 16 Aug 2001 19:46:31 GMT</last_modification_time>
|
||||
</signal>
|
||||
<editable>False</editable>
|
||||
<text_visible>True</text_visible>
|
||||
<text_max_length>0</text_max_length>
|
||||
<text></text>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
|
@ -519,7 +519,7 @@
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<child_name>CList:title</child_name>
|
||||
<name>event_details</name>
|
||||
<name>event_details_header</name>
|
||||
<label>Details</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
|
15
src/sort.py
15
src/sort.py
@ -137,13 +137,18 @@ def by_last_name(first, second) :
|
||||
name1 = first.getPrimaryName()
|
||||
name2 = second.getPrimaryName()
|
||||
|
||||
if name1.getSurname() == name2.getSurname() :
|
||||
if name1.getFirstName() == name2.getFirstName() :
|
||||
return cmp(name1.getSuffix(), name2.getSuffix())
|
||||
fsn = string.upper(name1.getSurname())
|
||||
ssn = string.upper(name1.getSurname())
|
||||
|
||||
if first == second :
|
||||
ffn = string.upper(name1.getFirstName())
|
||||
sfn = string.upper(name2.getFirstName())
|
||||
if ffn == sfn :
|
||||
return cmp(string.upper(name1.getSuffix()), string.upper(name2.getSuffix()))
|
||||
else :
|
||||
return cmp(name1.getFirstName(), name2.getFirstName())
|
||||
return cmp(ffn, sfn)
|
||||
else :
|
||||
return cmp(name1.getSurname(), name2.getSurname())
|
||||
return cmp(fsn, ssn)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
Loading…
x
Reference in New Issue
Block a user