* src/Utils.py (get_media_referents): Add function;
Add generic data recovery message. * src/gramps_main.py (delete_person_clicked): Use generic data recovery message. * src/SourceView.py (on_delete_clicked): Use generic data recovery message. * src/EditSource.py (display_references): Change list headings. * src/MediaView.py (on_delete_clicked): Use new mediaref detector; Use generic data recovery message; (delete_objectmis-object_used): Remove functions. * src/ImageSelect.py (GlobalMediaProperties.display_ref): Use new sourceref detection; (DeleteMediaQuery__init__): Accept object handle and lists; (DeleteMediaQuery.query_response): Use new mediaref removal. svn: r4161
This commit is contained in:
49
src/Utils.py
49
src/Utils.py
@ -69,6 +69,9 @@ def history_broken():
|
||||
global _history_brokenFlag
|
||||
_history_brokenFlag = 1
|
||||
|
||||
data_recover_msg = _('The data can only be recovered by Undo operation '
|
||||
'or by quitting with abandoning changes.')
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# force_unicode
|
||||
@ -540,6 +543,52 @@ def get_source_referents(source_handle,db):
|
||||
return (person_list,family_list,event_list,
|
||||
place_list,source_list,media_list)
|
||||
|
||||
def get_media_referents(media_handle,db):
|
||||
"""
|
||||
Find objects that refer the media object.
|
||||
|
||||
This function finds all primary objects that refer
|
||||
to a given media handle in a given database.
|
||||
"""
|
||||
|
||||
# Persons
|
||||
person_list = [ handle \
|
||||
for handle in db.get_person_handles(sort_handles=False) \
|
||||
if media_handle in \
|
||||
[photo.get_reference_handle() for photo \
|
||||
in db.get_person_from_handle(handle).get_media_list()]
|
||||
]
|
||||
|
||||
# Families
|
||||
family_list = [ handle for handle in db.get_family_handles() \
|
||||
if media_handle in \
|
||||
[photo.get_reference_handle() for photo \
|
||||
in db.get_family_from_handle(handle).get_media_list()]
|
||||
]
|
||||
|
||||
# Events
|
||||
event_list = [ handle for handle in db.get_event_handles() \
|
||||
if media_handle in \
|
||||
[photo.get_reference_handle() for photo \
|
||||
in db.get_event_from_handle(handle).get_media_list()]
|
||||
]
|
||||
|
||||
# Places
|
||||
place_list = [ handle for handle in db.get_place_handles() \
|
||||
if media_handle in \
|
||||
[photo.get_reference_handle() for photo \
|
||||
in db.get_place_from_handle(handle).get_media_list()]
|
||||
]
|
||||
|
||||
# Sources
|
||||
source_list = [ handle for handle in db.get_source_handles() \
|
||||
if media_handle in \
|
||||
[photo.get_reference_handle() for photo \
|
||||
in db.get_source_from_handle(handle).get_media_list()]
|
||||
]
|
||||
|
||||
return (person_list,family_list,event_list,place_list,source_list)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
|
Reference in New Issue
Block a user