Display primary source on event list window

svn: r1030
This commit is contained in:
Don Allingham 2002-06-16 04:10:37 +00:00
parent 342a0a74cf
commit df578b01d3
6 changed files with 121 additions and 104 deletions

View File

@ -2306,58 +2306,6 @@
</child> </child>
</widget> </widget>
<widget>
<class>GtkLabel</class>
<name>label164</name>
<label>Details</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>1</xalign>
<yalign>0.5</yalign>
<xpad>5</xpad>
<ypad>3</ypad>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>4</top_attach>
<bottom_attach>5</bottom_attach>
<xpad>0</xpad>
<ypad>0</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>event_details</name>
<label></label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<left_attach>2</left_attach>
<right_attach>3</right_attach>
<top_attach>4</top_attach>
<bottom_attach>5</bottom_attach>
<xpad>3</xpad>
<ypad>3</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget> <widget>
<class>GtkLabel</class> <class>GtkLabel</class>
<name>label232</name> <name>label232</name>
@ -2436,32 +2384,6 @@
</child> </child>
</widget> </widget>
<widget>
<class>GtkLabel</class>
<name>label235</name>
<label>:</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>3</ypad>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>4</top_attach>
<bottom_attach>5</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget> <widget>
<class>GtkLabel</class> <class>GtkLabel</class>
<name>label241</name> <name>label241</name>
@ -2539,6 +2461,84 @@
<yfill>False</yfill> <yfill>False</yfill>
</child> </child>
</widget> </widget>
<widget>
<class>GtkLabel</class>
<name>label273</name>
<label>:</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>3</ypad>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>4</top_attach>
<bottom_attach>5</bottom_attach>
<xpad>0</xpad>
<ypad>0</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>label274</name>
<label>Primary Source</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>1</xalign>
<yalign>0.5</yalign>
<xpad>5</xpad>
<ypad>3</ypad>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>4</top_attach>
<bottom_attach>5</bottom_attach>
<xpad>0</xpad>
<ypad>0</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>event_srcinfo</name>
<label></label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<left_attach>2</left_attach>
<right_attach>3</right_attach>
<top_attach>4</top_attach>
<bottom_attach>5</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
</widget> </widget>
</widget> </widget>

View File

@ -173,7 +173,7 @@ class EditPerson:
self.event_cause_field = self.get_widget("eventCause") self.event_cause_field = self.get_widget("eventCause")
self.event_date_field = self.get_widget("eventDate") self.event_date_field = self.get_widget("eventDate")
self.event_descr_field = self.get_widget("eventDescription") self.event_descr_field = self.get_widget("eventDescription")
self.event_details_field = self.get_widget("event_details") self.event_src_field = self.get_widget("event_srcinfo")
self.attr_details_field = self.get_widget("attr_details") self.attr_details_field = self.get_widget("attr_details")
self.name_details_field = self.get_widget("name_details") self.name_details_field = self.get_widget("name_details")
self.addr_details_field = self.get_widget("addr_details") self.addr_details_field = self.get_widget("addr_details")
@ -225,16 +225,16 @@ class EditPerson:
self.name_source = self.get_widget("name_source") self.name_source = self.get_widget("name_source")
self.gid = self.get_widget("gid") self.gid = self.get_widget("gid")
self.death = Event(person.getDeath())
self.birth = Event(person.getBirth())
self.pname = Name(person.getPrimaryName())
self.elist = person.getEventList()[:] self.elist = person.getEventList()[:]
self.nlist = person.getAlternateNames()[:] self.nlist = person.getAlternateNames()[:]
self.alist = person.getAttributeList()[:] self.alist = person.getAttributeList()[:]
self.ulist = person.getUrlList()[:] self.ulist = person.getUrlList()[:]
self.plist = person.getAddressList()[:] self.plist = person.getAddressList()[:]
self.death = Event(person.getDeath())
self.birth = Event(person.getBirth())
self.pname = Name(person.getPrimaryName())
# Typing CR selects OK button # Typing CR selects OK button
self.window.editable_enters(self.notes_field); self.window.editable_enters(self.notes_field);
self.window.editable_enters(self.given); self.window.editable_enters(self.given);
@ -614,16 +614,14 @@ class EditPerson:
# Update birth with new values, make sure death values don't change # Update birth with new values, make sure death values don't change
if self.update_birth: if self.update_birth:
self.update_birth = 0 self.update_birth = 0
self.bdate.set_text(self.birth.getDate()) self.update_birth_info()
self.bplace.set_text(self.birth.getPlaceName())
self.dplace.set_text(prev_dtext) self.dplace.set_text(prev_dtext)
self.bdate_check = DateEdit(self.bdate,self.get_widget("birth_stat")) self.bdate_check = DateEdit(self.bdate,self.get_widget("birth_stat"))
# Update death with new values, make sure birth values don't change # Update death with new values, make sure birth values don't change
if self.update_death: if self.update_death:
self.update_death = 0 self.update_death = 0
self.ddate.set_text(self.death.getDate()) self.update_death_info()
self.dplace.set_text(self.death.getPlaceName())
self.bplace.set_text(prev_btext) self.bplace.set_text(prev_btext)
self.ddate_check = DateEdit(self.ddate,self.get_widget("death_stat")) self.ddate_check = DateEdit(self.ddate,self.get_widget("death_stat"))
@ -906,7 +904,6 @@ class EditPerson:
ord.getStatus() != self.seal_stat or \ ord.getStatus() != self.seal_stat or \
ord.getFamily() != self.ldsfam: ord.getFamily() != self.ldsfam:
return 1 return 1
return 0 return 0
def on_event_delete_clicked(self,obj): def on_event_delete_clicked(self,obj):
@ -979,7 +976,14 @@ class EditPerson:
self.event_name_field.set_label(const.display_pevent(event.getName())) self.event_name_field.set_label(const.display_pevent(event.getName()))
self.event_cause_field.set_text(event.getCause()) self.event_cause_field.set_text(event.getCause())
self.event_descr_field.set_text(event.getDescription()) self.event_descr_field.set_text(event.getDescription())
self.event_details_field.set_text(Utils.get_detail_text(event)) if len(event.getSourceRefList()) > 0:
psrc = event.getSourceRefList()[0]
n = _("%(source_title)s; Confidence - %(confidence)s") % {
'source_title' : psrc.getBase().getTitle(),
'confidence' : const.confidence[psrc.getConfidence()]}
self.event_src_field.set_text(n)
else:
self.event_src_field.set_text('')
def on_event_unselect_row(self,obj,a,b,c): def on_event_unselect_row(self,obj,a,b,c):
enable = len(obj.selection) > 0 enable = len(obj.selection) > 0
@ -1389,9 +1393,21 @@ class EditPerson:
else: else:
self.load_photo(None) self.load_photo(None)
def update_birth_info(self):
self.bdate.set_text(self.birth.getDate())
self.bplace.set_text(self.birth.getPlaceName())
def update_death_info(self):
self.ddate.set_text(self.death.getDate())
self.dplace.set_text(self.death.getPlaceName())
def on_switch_page(self,obj,a,page): def on_switch_page(self,obj,a,page):
if page == 0: if page == 0:
self.load_person_image() self.load_person_image()
self.update_death_info()
self.update_birth_info()
elif page == 2:
self.redraw_event_list()
elif page == 6 and self.not_loaded: elif page == 6 and self.not_loaded:
self.not_loaded = 0 self.not_loaded = 0
self.gallery.load_images() self.gallery.load_images()

View File

@ -209,6 +209,8 @@ class EventEditor:
dobj = self.event.getDateObj() dobj = self.event.getDateObj()
self.event.setSourceRefList(self.srcreflist)
if compare_dates(dobj,date) != 0: if compare_dates(dobj,date) != 0:
self.event.setDateObj(date) self.event.setDateObj(date)
self.parent.lists_changed = 1 self.parent.lists_changed = 1

View File

@ -1327,6 +1327,16 @@ class Event(DataObj):
self.name = "" self.name = ""
self.cause = "" self.cause = ""
def is_empty(self):
date = self.getDateObj()
place = self.getPlace()
description = self.getDescription()
if (not name or name == "Birth" or name == "Death") and \
date.isEmpty() and not place and not description:
return 1
else:
return 0
def set(self,name,date,place,description): def set(self,name,date,place,description):
"""sets the name, date, place, and description of an Event instance""" """sets the name, date, place, and description of an Event instance"""
self.name = name self.name = name

View File

@ -31,19 +31,17 @@ import libglade
# gramps modules # gramps modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import const import const
import Utils import Utils
from RelLib import * from RelLib import *
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# constants # SourceSelector
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class SourceSelector: class SourceSelector:
def __init__(self,srclist,parent,update=None): def __init__(self,srclist,parent,update=None):
self.db = parent.db self.db = parent.db
self.parent = parent self.parent = parent
@ -149,7 +147,6 @@ class SourceEditor:
return self.showSource.get_widget(name) return self.showSource.get_widget(name)
def draw(self): def draw(self):
if self.source_ref: if self.source_ref:
self.get_widget("spage").set_text(self.source_ref.getPage()) self.get_widget("spage").set_text(self.source_ref.getPage())
date = self.source_ref.getDate() date = self.source_ref.getDate()

View File

@ -355,22 +355,14 @@ class XmlWriter:
self.dump_my_event(event.getName(),event,index) self.dump_my_event(event.getName(),event,index)
def dump_my_event(self,name,event,index=1): def dump_my_event(self,name,event,index=1):
if not event: if not event or event.is_empty():
return
date = event.getDateObj()
place = event.getPlace()
description = event.getDescription()
cause = event.getCause()
if (not name or name == "Birth" or name == "Death") and \
date.isEmpty() and not place and not description:
return return
sp = " " * index sp = " " * index
self.g.write('%s<event type="%s"%s>\n' % (sp,self.fix(name),conf_priv(event))) self.g.write('%s<event type="%s"%s>\n' % (sp,self.fix(name),conf_priv(event)))
self.write_date(event.getDateObj(),index+1) self.write_date(event.getDateObj(),index+1)
self.write_ref("place",place,index+1) self.write_ref("place",place,index+1)
self.write_line("cause",cause,index+1) self.write_line("cause",event.getCause(),index+1)
self.write_line("description",description,index+1) self.write_line("description",description,index+1)
if event.getNote(): if event.getNote():
self.write_note("note",event.getNote(),index+1) self.write_note("note",event.getNote(),index+1)