Display primary source on event list window
svn: r1030
This commit is contained in:
		| @@ -2306,58 +2306,6 @@ | ||||
| 		  </child> | ||||
| 		</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> | ||||
| 		  <class>GtkLabel</class> | ||||
| 		  <name>label232</name> | ||||
| @@ -2436,32 +2384,6 @@ | ||||
| 		  </child> | ||||
| 		</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> | ||||
| 		  <class>GtkLabel</class> | ||||
| 		  <name>label241</name> | ||||
| @@ -2539,6 +2461,84 @@ | ||||
| 		    <yfill>False</yfill> | ||||
| 		  </child> | ||||
| 		</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> | ||||
|  | ||||
|   | ||||
| @@ -173,7 +173,7 @@ class EditPerson: | ||||
|         self.event_cause_field = self.get_widget("eventCause") | ||||
|         self.event_date_field  = self.get_widget("eventDate") | ||||
|         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.name_details_field = self.get_widget("name_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.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.nlist = person.getAlternateNames()[:] | ||||
|         self.alist = person.getAttributeList()[:] | ||||
|         self.ulist = person.getUrlList()[:] | ||||
|         self.plist = person.getAddressList()[:] | ||||
|  | ||||
|         self.death = Event(person.getDeath()) | ||||
|         self.birth = Event(person.getBirth()) | ||||
|         self.pname = Name(person.getPrimaryName()) | ||||
|  | ||||
|         # Typing CR selects OK button | ||||
|         self.window.editable_enters(self.notes_field); | ||||
|         self.window.editable_enters(self.given); | ||||
| @@ -614,16 +614,14 @@ class EditPerson: | ||||
|         # Update birth with new values, make sure death values don't change | ||||
|         if self.update_birth: | ||||
|             self.update_birth = 0 | ||||
|             self.bdate.set_text(self.birth.getDate()) | ||||
|             self.bplace.set_text(self.birth.getPlaceName()) | ||||
|             self.update_birth_info() | ||||
|             self.dplace.set_text(prev_dtext) | ||||
|         self.bdate_check = DateEdit(self.bdate,self.get_widget("birth_stat")) | ||||
|  | ||||
|         # Update death with new values, make sure birth values don't change | ||||
|         if self.update_death: | ||||
|             self.update_death = 0 | ||||
|             self.ddate.set_text(self.death.getDate()) | ||||
|             self.dplace.set_text(self.death.getPlaceName()) | ||||
|             self.update_death_info() | ||||
|             self.bplace.set_text(prev_btext) | ||||
|         self.ddate_check = DateEdit(self.ddate,self.get_widget("death_stat")) | ||||
|  | ||||
| @@ -906,7 +904,6 @@ class EditPerson: | ||||
|                ord.getStatus() != self.seal_stat or \ | ||||
|                ord.getFamily() != self.ldsfam: | ||||
|                 return 1 | ||||
|  | ||||
|         return 0 | ||||
|  | ||||
|     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_cause_field.set_text(event.getCause()) | ||||
|         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): | ||||
|         enable = len(obj.selection) > 0 | ||||
| @@ -1388,10 +1392,22 @@ class EditPerson: | ||||
|                     self.load_photo(None) | ||||
|         else: | ||||
|             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): | ||||
|         if page == 0: | ||||
|             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: | ||||
|             self.not_loaded = 0 | ||||
|             self.gallery.load_images() | ||||
|   | ||||
| @@ -209,6 +209,8 @@ class EventEditor: | ||||
|  | ||||
|         dobj = self.event.getDateObj() | ||||
|  | ||||
|         self.event.setSourceRefList(self.srcreflist) | ||||
|          | ||||
|         if compare_dates(dobj,date) != 0: | ||||
|             self.event.setDateObj(date) | ||||
|             self.parent.lists_changed = 1 | ||||
|   | ||||
| @@ -1327,6 +1327,16 @@ class Event(DataObj): | ||||
|             self.name = "" | ||||
|             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): | ||||
|         """sets the name, date, place, and description of an Event instance""" | ||||
|         self.name = name | ||||
|   | ||||
| @@ -31,19 +31,17 @@ import libglade | ||||
| # gramps modules | ||||
| # | ||||
| #------------------------------------------------------------------------- | ||||
|  | ||||
| import const | ||||
| import Utils | ||||
| from RelLib import * | ||||
|  | ||||
| #------------------------------------------------------------------------- | ||||
| # | ||||
| # constants | ||||
| # SourceSelector | ||||
| # | ||||
| #------------------------------------------------------------------------- | ||||
|  | ||||
| class SourceSelector: | ||||
|  | ||||
|     def __init__(self,srclist,parent,update=None): | ||||
|         self.db = parent.db | ||||
|         self.parent = parent | ||||
| @@ -149,7 +147,6 @@ class SourceEditor: | ||||
|         return self.showSource.get_widget(name) | ||||
|  | ||||
|     def draw(self): | ||||
|  | ||||
|         if self.source_ref: | ||||
|             self.get_widget("spage").set_text(self.source_ref.getPage()) | ||||
|             date = self.source_ref.getDate() | ||||
|   | ||||
| @@ -355,22 +355,14 @@ class XmlWriter: | ||||
|             self.dump_my_event(event.getName(),event,index) | ||||
|  | ||||
|     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 | ||||
|          | ||||
|  | ||||
|         sp = "  " * index | ||||
|         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_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) | ||||
|         if event.getNote(): | ||||
|             self.write_note("note",event.getNote(),index+1) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user