* src/RelLib.py (Transaction.__len__): Redefine length.

* src/ChooseParents.py, src/EditPerson.py, src/EditSource.py,
src/EventEdit.py, src/FamilyView.py, src/gramps_main.py,
src/ImageSelect.py, src/Marriage.py, src/MediaView.py,
src/PedView.py, src/PeopleModel.py, src/PlaceView.py,
src/SelectChild.py, src/SelectObject.py, src/Sources.py,
src/SourceView.py, src/Utils.py, src/Witness.py,
src/WriteXML.py: Switch from find_* to try_to_find_* methods.


svn: r3193
This commit is contained in:
Alex Roitman
2004-05-26 03:26:18 +00:00
parent 6523c4ff2b
commit 7cc5d39fc9
20 changed files with 130 additions and 119 deletions

View File

@ -169,7 +169,7 @@ class ImageSelect:
trans = self.db.start_transactions()
for o_id in self.db.get_object_keys():
o = self.db.find_object_from_id(o_id,trans)
o = self.db.try_to_find_object_from_id(o_id,trans)
if o.get_path() == filename:
already_imported = o
break
@ -276,7 +276,7 @@ class Gallery(ImageSelect):
def on_drag_begin(self,obj,context):
if const.dnd_images:
id = self.sel_obj.get_reference_id()
obj = self.db.find_object_from_id(id,None)
obj = self.db.try_to_find_object_from_id(id,None)
mtype = obj.get_mime_type()
name = Utils.thumb_path(self.db.get_save_path(),obj)
pix = gtk.gdk.pixbuf_new_from_file(name)
@ -370,7 +370,7 @@ class Gallery(ImageSelect):
def add_thumbnail(self, photo):
"""Scale the image and add it to the IconList."""
oid = photo.get_reference_id()
object = self.db.find_object_from_id(oid,None)
object = self.db.try_to_find_object_from_id(oid,None)
if self.canvas_list.has_key(oid):
(grp,item,text,x,y) = self.canvas_list[oid]
if x != self.cx or y != self.cy:
@ -603,7 +603,7 @@ class Gallery(ImageSelect):
menu = gtk.Menu()
menu.set_title(_("Media Object"))
object = self.db.find_object_from_id(photo.get_reference_id(),None)
object = self.db.try_to_find_object_from_id(photo.get_reference_id(),None)
mtype = object.get_mime_type()
progname = GrampsMime.get_application(mtype)
@ -620,21 +620,21 @@ class Gallery(ImageSelect):
def popup_view_photo(self, obj):
"""Open this picture in a picture viewer"""
photo = obj.get_data('o')
Utils.view_photo(self.db.find_object_from_id(photo.get_reference_id(),
Utils.view_photo(self.db.try_to_find_object_from_id(photo.get_reference_id(),
None))
def popup_edit_photo(self, obj):
"""Open this picture in a picture editor"""
photo = obj.get_data('o')
if os.fork() == 0:
obj = self.db.find_object_from_id(photo.get_reference_id(),None)
obj = self.db.try_to_find_object_from_id(photo.get_reference_id(),None)
os.execvp(const.editor,[const.editor, obj.get_path()])
def popup_convert_to_private(self, obj):
"""Copy this picture into gramps private database instead of
leaving it as an external data object."""
photo = obj.get_data('o')
object = self.db.find_object_from_id(photo.get_reference_id(),None)
object = self.db.try_to_find_object_from_id(photo.get_reference_id(),None)
name = RelImage.import_media_object(object.get_path(),self.path,
object.get_id())
object.set_path(name)
@ -665,7 +665,7 @@ class LocalMediaProperties:
self.child_windows = {}
self.photo = photo
self.db = parent.db
self.object = self.db.find_object_from_id(photo.get_reference_id(),
self.object = self.db.try_to_find_object_from_id(photo.get_reference_id(),
None)
self.alist = photo.get_attribute_list()[:]
self.lists_changed = 0
@ -1119,7 +1119,7 @@ class DeleteMediaQuery:
self.db.commit_family(p,trans)
for key in self.db.get_source_keys():
sid = self.db.find_source_from_id(key,trans)
sid = self.db.try_to_find_source_from_id(key,trans)
nl = []
change = 0
for photo in p.get_media_list():
@ -1132,7 +1132,7 @@ class DeleteMediaQuery:
self.db.commit_source(p,trans)
for key in self.db.get_place_id_keys():
p = self.db.find_place_from_id(key)
p = self.db.try_to_find_place_from_id(key)
nl = []
change = 0
for photo in p.get_media_list():