2863: Wrong row when dropping on embedded list
This patch makes sure open of old database shows correct columns, and adds ... if several main participants svn: r13085
This commit is contained in:
		@@ -69,10 +69,10 @@ class EventView(PageView.ListView):
 | 
			
		||||
        _('Description'),
 | 
			
		||||
        _('ID'),
 | 
			
		||||
        _('Type'),
 | 
			
		||||
        _('First Main Participant'),
 | 
			
		||||
        _('Date'),
 | 
			
		||||
        _('Place'),
 | 
			
		||||
        _('Last Changed'),
 | 
			
		||||
        _('Main Participants'),
 | 
			
		||||
        ]
 | 
			
		||||
    
 | 
			
		||||
    ADD_MSG     = _("Add a new event")
 | 
			
		||||
 
 | 
			
		||||
@@ -76,10 +76,10 @@ class EventModel(FlatBaseModel):
 | 
			
		||||
            self.column_description,
 | 
			
		||||
            self.column_id,
 | 
			
		||||
            self.column_type,
 | 
			
		||||
            self.column_participant,
 | 
			
		||||
            self.column_date,
 | 
			
		||||
            self.column_place,
 | 
			
		||||
            self.column_change,
 | 
			
		||||
            self.column_participant,
 | 
			
		||||
            self.column_handle,
 | 
			
		||||
            self.column_tooltip,
 | 
			
		||||
            ]
 | 
			
		||||
@@ -87,10 +87,10 @@ class EventModel(FlatBaseModel):
 | 
			
		||||
            self.column_description,
 | 
			
		||||
            self.column_id,
 | 
			
		||||
            self.column_type,
 | 
			
		||||
            self.column_participant,
 | 
			
		||||
            self.sort_date,
 | 
			
		||||
            self.column_place,
 | 
			
		||||
            self.sort_change,
 | 
			
		||||
            self.column_participant,
 | 
			
		||||
            self.column_handle,
 | 
			
		||||
            self.column_tooltip,
 | 
			
		||||
            ]
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										32
									
								
								src/Utils.py
									
									
									
									
									
								
							
							
						
						
									
										32
									
								
								src/Utils.py
									
									
									
									
									
								
							@@ -1012,33 +1012,45 @@ def get_participant_from_event(db, event_handle):
 | 
			
		||||
    """
 | 
			
		||||
    Obtain the first primary or family participant to an event we find in the 
 | 
			
		||||
    database. Note that an event can have more than one primary or 
 | 
			
		||||
    family participant, only one is returned. 
 | 
			
		||||
    family participant, only one is returned, adding ellipses if there are
 | 
			
		||||
    more. 
 | 
			
		||||
    """
 | 
			
		||||
    participant = ""
 | 
			
		||||
    ellipses = False
 | 
			
		||||
    result_list = [i for i in db.find_backlink_handles(event_handle, 
 | 
			
		||||
                             include_classes=['Person', 'Family'])]
 | 
			
		||||
    people = [x[1] for x in result_list if x[0] == 'Person']
 | 
			
		||||
    families =  [x[1] for x in result_list if x[0] == 'Family']
 | 
			
		||||
    #obtain handles without duplicates
 | 
			
		||||
    people = set([x[1] for x in result_list if x[0] == 'Person'])
 | 
			
		||||
    families = set([x[1] for x in result_list if x[0] == 'Family'])
 | 
			
		||||
    for personhandle in people: 
 | 
			
		||||
        person = db.get_person_from_handle(personhandle)
 | 
			
		||||
        for event_ref in person.get_event_ref_list():
 | 
			
		||||
            if event_handle == event_ref.ref and \
 | 
			
		||||
                    event_ref.get_role() == gen.lib.EventRoleType.PRIMARY:
 | 
			
		||||
                participant =  name_displayer.display(person)
 | 
			
		||||
                if participant:
 | 
			
		||||
                    ellipses = True
 | 
			
		||||
                else:
 | 
			
		||||
                    participant =  name_displayer.display(person)
 | 
			
		||||
                break
 | 
			
		||||
        if participant:
 | 
			
		||||
        if ellipses:
 | 
			
		||||
            break
 | 
			
		||||
    if participant:
 | 
			
		||||
        return participant
 | 
			
		||||
    if ellipses:
 | 
			
		||||
        return _('%s, ...') % participant
 | 
			
		||||
    
 | 
			
		||||
    for familyhandle in families:
 | 
			
		||||
        family = db.get_family_from_handle(familyhandle)
 | 
			
		||||
        for event_ref in family.get_event_ref_list():
 | 
			
		||||
            if event_handle == event_ref.ref and \
 | 
			
		||||
                    event_ref.get_role() == gen.lib.EventRoleType.FAMILY:
 | 
			
		||||
                participant = family_name(family, db)
 | 
			
		||||
                if participant:
 | 
			
		||||
                    ellipses = True
 | 
			
		||||
                else:
 | 
			
		||||
                    participant = family_name(family, db)
 | 
			
		||||
                break
 | 
			
		||||
        if participant:
 | 
			
		||||
        if ellipses:
 | 
			
		||||
            break
 | 
			
		||||
    
 | 
			
		||||
    return participant
 | 
			
		||||
    if ellipses:
 | 
			
		||||
        return _('%s, ...') % participant
 | 
			
		||||
    else:
 | 
			
		||||
        return participant
 | 
			
		||||
 
 | 
			
		||||
@@ -2473,8 +2473,8 @@ class GrampsDbBase(Callback):
 | 
			
		||||
        metadata.
 | 
			
		||||
        """
 | 
			
		||||
        default = [(1, 0, 200), (1, 1, 75), (1, 2, 100), 
 | 
			
		||||
                   (0, 3, 0), (1, 4, 150),
 | 
			
		||||
                   (1, 5, 200), (0, 6, 100)]
 | 
			
		||||
                   (0, 6, 230), (1, 3, 150),
 | 
			
		||||
                   (1, 4, 200), (0, 5, 100)]
 | 
			
		||||
        return self.__get_columns(EVENT_COL_KEY, default)
 | 
			
		||||
 | 
			
		||||
    def get_repository_column_order(self):
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user