Fix bug #4687: session log gramplet - overzealous l10n of signal names breaks clickable link handlers
* No longer translate "link_type" passed to GuiGramplet.link, this is an internal constant name never exposed to the user. * Add a warning to GuiGramplet.on_button_press, in case an unknown link type is encountered during the event processing * Applied changes to my patch as suggested during the CR by dsblank svn: r16714
This commit is contained in:
		@@ -676,6 +676,8 @@ class GuiGramplet(object):
 | 
				
			|||||||
                                                     'attribute_match', 
 | 
					                                                     'attribute_match', 
 | 
				
			||||||
                                                     handle)
 | 
					                                                     handle)
 | 
				
			||||||
                    return True
 | 
					                    return True
 | 
				
			||||||
 | 
					                else: # overzealous l10n while setting the link?
 | 
				
			||||||
 | 
					                    warn( "Unknown link type " + link_type, RuntimeWarning, 2)
 | 
				
			||||||
        return False # did not handle event
 | 
					        return False # did not handle event
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class GridGramplet(GuiGramplet):
 | 
					class GridGramplet(GuiGramplet):
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -42,32 +42,34 @@ class LogGramplet(Gramplet):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    def db_changed(self):
 | 
					    def db_changed(self):
 | 
				
			||||||
        self.append_text(_("Opened data base -----------\n"))
 | 
					        self.append_text(_("Opened data base -----------\n"))
 | 
				
			||||||
 | 
					        # List of translated strings used here (translated in self.log ).
 | 
				
			||||||
 | 
					        _('Added'), _('Deleted'), _('Edited') # Dead code for l10n
 | 
				
			||||||
        self.dbstate.db.connect('person-add', 
 | 
					        self.dbstate.db.connect('person-add', 
 | 
				
			||||||
                                lambda handles: self.log(_('Person'), _('Added'), handles))
 | 
					                                lambda handles: self.log('Person', 'Added', handles))
 | 
				
			||||||
        self.dbstate.db.connect('person-delete', 
 | 
					        self.dbstate.db.connect('person-delete', 
 | 
				
			||||||
                                lambda handles: self.log(_('Person'), _('Deleted'), handles))
 | 
					                                lambda handles: self.log('Person', 'Deleted', handles))
 | 
				
			||||||
        self.dbstate.db.connect('person-update', 
 | 
					        self.dbstate.db.connect('person-update', 
 | 
				
			||||||
                                lambda handles: self.log(_('Person'), _('Edited'), handles))
 | 
					                                lambda handles: self.log('Person', 'Edited', handles))
 | 
				
			||||||
        self.dbstate.db.connect('family-add', 
 | 
					        self.dbstate.db.connect('family-add', 
 | 
				
			||||||
                                lambda handles: self.log(_('Family'), _('Added'), handles))
 | 
					                                lambda handles: self.log('Family', 'Added', handles))
 | 
				
			||||||
        self.dbstate.db.connect('family-delete', 
 | 
					        self.dbstate.db.connect('family-delete', 
 | 
				
			||||||
                                lambda handles: self.log(_('Family'), _('Deleted'), handles))
 | 
					                                lambda handles: self.log('Family', 'Deleted', handles))
 | 
				
			||||||
        self.dbstate.db.connect('family-update', 
 | 
					        self.dbstate.db.connect('family-update', 
 | 
				
			||||||
                                lambda handles: self.log(_('Family'), _('Added'), handles))
 | 
					                                lambda handles: self.log('Family', 'Edited', handles))
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    def active_changed(self, handle):
 | 
					    def active_changed(self, handle):
 | 
				
			||||||
        self.log(_('Person'), _('Selected'), [handle])
 | 
					        self.log('Person', 'Selected', [handle])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def log(self, ltype, action, handles):
 | 
					    def log(self, ltype, action, handles):
 | 
				
			||||||
        for handle in set(handles):
 | 
					        for handle in set(handles):
 | 
				
			||||||
            if self.last_log == (ltype, action, handle):
 | 
					            if self.last_log == (ltype, action, handle):
 | 
				
			||||||
                continue
 | 
					                continue
 | 
				
			||||||
            self.last_log = (ltype, action, handle)
 | 
					            self.last_log = (ltype, action, handle)
 | 
				
			||||||
            self.append_text("%s: " % action)
 | 
					            self.append_text("%s: " % _(action))
 | 
				
			||||||
            if ltype == _("Person"):
 | 
					            if ltype == 'Person':
 | 
				
			||||||
                person = self.dbstate.db.get_person_from_handle(handle)
 | 
					                person = self.dbstate.db.get_person_from_handle(handle)
 | 
				
			||||||
                name = name_displayer.display(person)
 | 
					                name = name_displayer.display(person)
 | 
				
			||||||
            elif ltype == _("Family"):
 | 
					            elif ltype == 'Family':
 | 
				
			||||||
                family = self.dbstate.db.get_family_from_handle(handle)
 | 
					                family = self.dbstate.db.get_family_from_handle(handle)
 | 
				
			||||||
                father_name = _("unknown")
 | 
					                father_name = _("unknown")
 | 
				
			||||||
                mother_name = _("unknown")
 | 
					                mother_name = _("unknown")
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user