* src/plugins/RelCalc.py: use empty string instead of None
* src/EditPerson.py: pychecker fixes * src/EditPlace.py: pychecker fixes * src/EditSource.py: pychecker fixes * src/GenericFilter.py: pychecker fixes * src/GrampsCfg.py: pychecker fixes * src/ImageSelect.py: pychecker fixes * src/ListModel.py: pychecker fixes * src/MediaView.py; pychecker fixes * src/MergeData.py: pychecker fixes * src/PedView.py: pychecker fixes * src/PeopleView.py: pychecker fixes * src/PlaceView.py: pychecker fixes * src/Plugins.py: pychecker fixes * src/RelImage.py: pychecker fixes * src/Relationship.py: pychecker fixes svn: r3450
This commit is contained in:
parent
7a22617b52
commit
f741527b55
18
ChangeLog
18
ChangeLog
@ -1,3 +1,21 @@
|
||||
2004-08-20 Don Allingham <dallingham@users.sourceforge.net>
|
||||
* src/plugins/RelCalc.py: use empty string instead of None
|
||||
* src/EditPerson.py: pychecker fixes
|
||||
* src/EditPlace.py: pychecker fixes
|
||||
* src/EditSource.py: pychecker fixes
|
||||
* src/GenericFilter.py: pychecker fixes
|
||||
* src/GrampsCfg.py: pychecker fixes
|
||||
* src/ImageSelect.py: pychecker fixes
|
||||
* src/ListModel.py: pychecker fixes
|
||||
* src/MediaView.py; pychecker fixes
|
||||
* src/MergeData.py: pychecker fixes
|
||||
* src/PedView.py: pychecker fixes
|
||||
* src/PeopleView.py: pychecker fixes
|
||||
* src/PlaceView.py: pychecker fixes
|
||||
* src/Plugins.py: pychecker fixes
|
||||
* src/RelImage.py: pychecker fixes
|
||||
* src/Relationship.py: pychecker fixes
|
||||
|
||||
2004-08-20 Tim Waugh <twaugh@redhat.com>
|
||||
* src/plugins/RelCalc.py (__init__): Handle unknown birth dates.
|
||||
* src/Calendar.py (calendar_names): Fixed typo.
|
||||
|
@ -1719,9 +1719,9 @@ class EditPerson:
|
||||
elif page == 9 and self.lds_not_loaded:
|
||||
self.lds_not_loaded = 0
|
||||
self.draw_lds()
|
||||
buffer = self.notes_buffer
|
||||
text = unicode(buffer.get_text(buffer.get_start_iter(),
|
||||
buffer.get_end_iter(),gtk.FALSE))
|
||||
note_buf = self.notes_buffer
|
||||
text = unicode(note_buf.get_text(note_buf.get_start_iter(),
|
||||
note_buf.get_end_iter(),gtk.FALSE))
|
||||
if text:
|
||||
Utils.bold_label(self.notes_label)
|
||||
else:
|
||||
|
@ -393,9 +393,9 @@ class EditPlace:
|
||||
|
||||
def on_update_url_clicked(self,obj):
|
||||
import UrlEdit
|
||||
store,iter = self.web_list.get_selection().get_selected()
|
||||
if iter:
|
||||
row = store.get_path(iter)
|
||||
store,node = self.web_list.get_selection().get_selected()
|
||||
if node:
|
||||
row = store.get_path(node)
|
||||
url = self.ulist[row[0]]
|
||||
if url:
|
||||
name = _("Internet Address Editor for %s") % self.place.get_title()
|
||||
@ -406,9 +406,9 @@ class EditPlace:
|
||||
def on_update_loc_clicked(self,obj):
|
||||
import LocEdit
|
||||
|
||||
store,iter = self.loc_sel.get_selected()
|
||||
if iter:
|
||||
row = store.get_path(iter)
|
||||
store,node = self.loc_sel.get_selected()
|
||||
if node:
|
||||
row = store.get_path(node)
|
||||
loc = self.llist[row[0]]
|
||||
LocEdit.LocationEditor(self,loc,self.top)
|
||||
|
||||
@ -438,13 +438,13 @@ class EditPlace:
|
||||
LocEdit.LocationEditor(self,None,self.top)
|
||||
|
||||
def on_web_list_select_row(self,obj):
|
||||
store,iter = obj.get_selected()
|
||||
if not iter:
|
||||
store,node = obj.get_selected()
|
||||
if not node:
|
||||
self.web_url.set_text("")
|
||||
self.web_go.set_sensitive(0)
|
||||
self.web_description.set_text("")
|
||||
else:
|
||||
row = store.get_path(iter)
|
||||
row = store.get_path(node)
|
||||
url = self.ulist[row[0]]
|
||||
path = url.get_path()
|
||||
self.web_url.set_text(path)
|
||||
@ -452,8 +452,8 @@ class EditPlace:
|
||||
self.web_description.set_text(url.get_description())
|
||||
|
||||
def on_loc_list_select_row(self,obj):
|
||||
store,iter = self.loc_sel.get_selected()
|
||||
if not iter:
|
||||
store,node = self.loc_sel.get_selected()
|
||||
if not node:
|
||||
self.loc_city.set_text('')
|
||||
self.loc_county.set_text('')
|
||||
self.loc_state.set_text('')
|
||||
@ -462,7 +462,7 @@ class EditPlace:
|
||||
self.loc_parish.set_text('')
|
||||
self.loc_country.set_text('')
|
||||
else:
|
||||
row = store.get_path(iter)
|
||||
row = store.get_path(node)
|
||||
loc = self.llist[row[0]]
|
||||
|
||||
self.loc_city.set_text(loc.get_city())
|
||||
|
@ -218,9 +218,9 @@ class EditSource:
|
||||
if sref.get_base_handle() == self.source.get_handle():
|
||||
p_addr_list.append((name,v.get_street()))
|
||||
for object_handle in self.db.get_media_object_handles():
|
||||
object = self.db.get_object_from_handle(object_handle)
|
||||
name = object.get_description()
|
||||
for sref in object.get_source_references():
|
||||
obj = self.db.get_object_from_handle(object_handle)
|
||||
name = obj.get_description()
|
||||
for sref in obj.get_source_references():
|
||||
if sref.get_base_handle() == self.source.get_handle():
|
||||
m_list.append(name)
|
||||
for family_handle in self.db.get_family_handles():
|
||||
@ -356,16 +356,16 @@ class DelSrcQuery:
|
||||
self.db = db
|
||||
self.update = update
|
||||
|
||||
def delete_source(self,object):
|
||||
def delete_source(self,obj):
|
||||
m = 0
|
||||
l = []
|
||||
for sref in object.get_source_references():
|
||||
for sref in obj.get_source_references():
|
||||
if sref.get_base_handle() != self.source.get_handle():
|
||||
l.append(sref)
|
||||
else:
|
||||
m = 1
|
||||
if m:
|
||||
object.set_source_reference_list(l)
|
||||
obj.set_source_reference_list(l)
|
||||
return m
|
||||
|
||||
def query_response(self):
|
||||
|
@ -392,9 +392,9 @@ class IsDescendantOfFilterMatch(IsDescendantOf):
|
||||
|
||||
if not self.init:
|
||||
self.init = 1
|
||||
filter = MatchesFilter(self.list)
|
||||
filt = MatchesFilter(self.list)
|
||||
for person_handle in db.get_person_handles(sort_handles=False):
|
||||
if filter.apply (db, person_handle):
|
||||
if filt.apply (db, person_handle):
|
||||
self.init_list (person_handle, first)
|
||||
return self.map.has_key(p_id)
|
||||
|
||||
@ -523,9 +523,9 @@ class IsChildOfFilterMatch(Rule):
|
||||
|
||||
if not self.init:
|
||||
self.init = 1
|
||||
filter = MatchesFilter(self.list)
|
||||
filt = MatchesFilter(self.list)
|
||||
for person_handle in db.get_person_handles(sort_handles=False):
|
||||
if filter.apply (db, person_handle):
|
||||
if filt.apply (db, person_handle):
|
||||
self.init_list (person_handle)
|
||||
return self.map.has_key(p_id)
|
||||
|
||||
@ -681,9 +681,9 @@ class IsAncestorOfFilterMatch(IsAncestorOf):
|
||||
|
||||
if not self.init:
|
||||
self.init = 1
|
||||
filter = MatchesFilter(self.list[0])
|
||||
filt = MatchesFilter(self.list[0])
|
||||
for person_handle in db.get_person_handles(sort_handles=False):
|
||||
if filter.apply (db, person_handle):
|
||||
if filt.apply (db, person_handle):
|
||||
self.init_ancestor_list (person_handle,first)
|
||||
return self.map.has_key(p_id)
|
||||
|
||||
@ -826,9 +826,9 @@ class IsParentOfFilterMatch(Rule):
|
||||
|
||||
if not self.init:
|
||||
self.init = 1
|
||||
filter = MatchesFilter(self.list)
|
||||
filt = MatchesFilter(self.list)
|
||||
for person_handle in db.get_person_handles(sort_handles=False):
|
||||
if filter.apply (db, person_handle):
|
||||
if filt.apply (db, person_handle):
|
||||
self.init_list (person_handle)
|
||||
return self.map.has_key(p_id)
|
||||
|
||||
@ -910,11 +910,11 @@ class HasCommonAncestorWithFilterMatch(HasCommonAncestorWith):
|
||||
HasCommonAncestorWith.__init__(self,list)
|
||||
|
||||
def init_ancestor_cache(self,db):
|
||||
filter = MatchesFilter(self.list)
|
||||
filt = MatchesFilter(self.list)
|
||||
def init(self,pid): self.ancestor_cache[pid] = 1
|
||||
for p_id in db.get_person_handles(sort_handles=False):
|
||||
if (not self.ancestor_cache.has_key (p_id)
|
||||
and filter.apply (db, p_id)):
|
||||
and filt.apply (db, p_id)):
|
||||
for_each_ancestor([p_id],init,self)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -1327,12 +1327,12 @@ class MatchesFilter(Rule):
|
||||
return 'Matches the filter named'
|
||||
|
||||
def apply(self,db,p_id):
|
||||
for filter in SystemFilters.get_filters():
|
||||
if filter.get_name() == self.list[0]:
|
||||
return filter.check(p_id)
|
||||
for filter in CustomFilters.get_filters():
|
||||
if filter.get_name() == self.list[0]:
|
||||
return filter.check(db,p_id)
|
||||
for filt in SystemFilters.get_filters():
|
||||
if filt.get_name() == self.list[0]:
|
||||
return filt.check(p_id)
|
||||
for filt in CustomFilters.get_filters():
|
||||
if filt.get_name() == self.list[0]:
|
||||
return filt.check(db,p_id)
|
||||
return 0
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -1356,7 +1356,7 @@ class IsSpouseOfFilterMatch(Rule):
|
||||
return _('Family filters')
|
||||
|
||||
def apply(self,db,p_id):
|
||||
filter = MatchesFilter (self.list)
|
||||
filt = MatchesFilter (self.list)
|
||||
p = db.get_person_from_handle(p_id)
|
||||
for family_handle in p.get_family_handle_list ():
|
||||
family = db.get_family_from_handle(family_handle)
|
||||
@ -1365,7 +1365,7 @@ class IsSpouseOfFilterMatch(Rule):
|
||||
continue
|
||||
if spouse_id == p_id:
|
||||
continue
|
||||
if filter.apply (db, spouse_id):
|
||||
if filt.apply (db, spouse_id):
|
||||
return 1
|
||||
return 0
|
||||
|
||||
@ -1553,8 +1553,8 @@ class GenericFilterList:
|
||||
def get_filters(self):
|
||||
return self.filter_list
|
||||
|
||||
def add(self,filter):
|
||||
self.filter_list.append(filter)
|
||||
def add(self,filt):
|
||||
self.filter_list.append(filt)
|
||||
|
||||
def load(self):
|
||||
try:
|
||||
@ -1704,30 +1704,30 @@ def build_filter_menu(local_filters = [], default=""):
|
||||
|
||||
active = 0
|
||||
cnt = 0
|
||||
for filter in local_filters:
|
||||
menuitem = gtk.MenuItem(filter.get_name())
|
||||
for filt in local_filters:
|
||||
menuitem = gtk.MenuItem(filt.get_name())
|
||||
menuitem.show()
|
||||
menu.append(menuitem)
|
||||
menuitem.set_data("filter", filter)
|
||||
if default != "" and default == filter.get_name():
|
||||
menuitem.set_data("filter", filt)
|
||||
if default != "" and default == filt.get_name():
|
||||
active = cnt
|
||||
cnt += 1
|
||||
|
||||
for filter in SystemFilters.get_filters():
|
||||
menuitem = gtk.MenuItem(_(filter.get_name()))
|
||||
for filt in SystemFilters.get_filters():
|
||||
menuitem = gtk.MenuItem(_(filt.get_name()))
|
||||
menuitem.show()
|
||||
menu.append(menuitem)
|
||||
menuitem.set_data("filter", filter)
|
||||
if default != "" and default == filter.get_name():
|
||||
menuitem.set_data("filter", filt)
|
||||
if default != "" and default == filt.get_name():
|
||||
active = cnt
|
||||
cnt += 1
|
||||
|
||||
for filter in CustomFilters.get_filters():
|
||||
menuitem = gtk.MenuItem(_(filter.get_name()))
|
||||
for filt in CustomFilters.get_filters():
|
||||
menuitem = gtk.MenuItem(_(filt.get_name()))
|
||||
menuitem.show()
|
||||
menu.append(menuitem)
|
||||
menuitem.set_data("filter", filter)
|
||||
if default != "" and default == filter.get_name():
|
||||
menuitem.set_data("filter", filt)
|
||||
if default != "" and default == filt.get_name():
|
||||
active = cnt
|
||||
cnt += 1
|
||||
|
||||
|
@ -693,11 +693,11 @@ class GrampsPreferences:
|
||||
def build_tree(self):
|
||||
prev = None
|
||||
ilist = []
|
||||
for (name,list) in panellist:
|
||||
for (name,lst) in panellist:
|
||||
node = self.store.insert_after(None, prev)
|
||||
self.store.set(node,0,name)
|
||||
next = None
|
||||
for (subname,tab) in list:
|
||||
for (subname,tab) in lst:
|
||||
next = self.store.insert_after(node,next)
|
||||
ilist.append((next,tab))
|
||||
self.store.set(next,0,subname)
|
||||
@ -971,10 +971,10 @@ class GrampsPreferences:
|
||||
col = col + 1
|
||||
|
||||
def select(self,obj):
|
||||
store,iter = self.selection.get_selected()
|
||||
if iter:
|
||||
path = store.get_path(iter)
|
||||
if iter and self.imap.has_key(path):
|
||||
store,node = self.selection.get_selected()
|
||||
if node:
|
||||
path = store.get_path(node)
|
||||
if node and self.imap.has_key(path):
|
||||
self.panel.set_current_page(self.imap[path])
|
||||
|
||||
def on_propertybox_help(self,obj):
|
||||
|
@ -143,12 +143,12 @@ class ImageSelect:
|
||||
self.temp_name = root
|
||||
|
||||
if os.path.isfile(filename):
|
||||
type = GrampsMime.get_type(filename)
|
||||
if type[0:5] == "image":
|
||||
mtype = GrampsMime.get_type(filename)
|
||||
if mtype[0:5] == "image":
|
||||
image = RelImage.scale_image(filename,const.thumbScale)
|
||||
self.image.set_from_pixbuf(image)
|
||||
else:
|
||||
i = gtk.gdk.pixbuf_new_from_file(Utils.find_icon(type))
|
||||
i = gtk.gdk.pixbuf_new_from_file(Utils.find_icon(mtype))
|
||||
self.image.set_from_pixbuf(i)
|
||||
|
||||
def on_savephoto_clicked(self):
|
||||
@ -184,12 +184,12 @@ class ImageSelect:
|
||||
self.dataobj.add_media_reference(oref)
|
||||
self.add_thumbnail(oref)
|
||||
else:
|
||||
type = GrampsMime.get_type(filename)
|
||||
mtype = GrampsMime.get_type(filename)
|
||||
mobj = RelLib.MediaObject()
|
||||
if description == "":
|
||||
description = os.path.basename(filename)
|
||||
mobj.set_description(description)
|
||||
mobj.set_mime_type(type)
|
||||
mobj.set_mime_type(mtype)
|
||||
self.savephoto(mobj)
|
||||
mobj.set_path(filename)
|
||||
self.db.commit_media_object(mobj,trans)
|
||||
@ -268,9 +268,8 @@ class Gallery(ImageSelect):
|
||||
|
||||
def on_drag_begin(self,obj,context):
|
||||
if const.dnd_images:
|
||||
id = self.sel_obj.get_reference_handle()
|
||||
obj = self.db.get_object_from_handle(id)
|
||||
mtype = obj.get_mime_type()
|
||||
handle = self.sel_obj.get_reference_handle()
|
||||
obj = self.db.get_object_from_handle(handle)
|
||||
name = Utils.thumb_path(self.db.get_save_path(),obj)
|
||||
pix = gtk.gdk.pixbuf_new_from_file(name)
|
||||
context.set_icon_pixbuf(pix,0,0)
|
||||
@ -363,7 +362,7 @@ class Gallery(ImageSelect):
|
||||
def add_thumbnail(self, photo):
|
||||
"""Scale the image and add it to the IconList."""
|
||||
oid = photo.get_reference_handle()
|
||||
object = self.db.get_object_from_handle(oid)
|
||||
obj = self.db.get_object_from_handle(oid)
|
||||
if self.canvas_list.has_key(oid):
|
||||
(grp,item,text,x,y) = self.canvas_list[oid]
|
||||
if x != self.cx or y != self.cy:
|
||||
@ -371,9 +370,9 @@ class Gallery(ImageSelect):
|
||||
else:
|
||||
import gobject
|
||||
|
||||
name = Utils.thumb_path(self.db.get_save_path(),object)
|
||||
name = Utils.thumb_path(self.db.get_save_path(),obj)
|
||||
|
||||
description = object.get_description()
|
||||
description = obj.get_description()
|
||||
if len(description) > 20:
|
||||
description = "%s..." % description[0:20]
|
||||
|
||||
@ -461,9 +460,9 @@ class Gallery(ImageSelect):
|
||||
if data and data.format == 8:
|
||||
icon_index = self.get_index(w,x,y)
|
||||
d = string.strip(string.replace(data.data,'\0',' '))
|
||||
protocol,site,file, j,k,l = urlparse.urlparse(d)
|
||||
protocol,site,mfile,j,k,l = urlparse.urlparse(d)
|
||||
if protocol == "file":
|
||||
name = file
|
||||
name = mfile
|
||||
mime = GrampsMime.get_type(name)
|
||||
photo = RelLib.MediaObject()
|
||||
photo.set_path(name)
|
||||
@ -498,8 +497,8 @@ class Gallery(ImageSelect):
|
||||
oref.set_reference_handle(photo.get_handle())
|
||||
self.dataobj.add_media_reference(oref)
|
||||
try:
|
||||
id = photo.get_handle()
|
||||
name = RelImage.import_media_object(tfile,self.path,id)
|
||||
handle = photo.get_handle()
|
||||
name = RelImage.import_media_object(tfile,self.path,handle)
|
||||
photo.set_path(name)
|
||||
except:
|
||||
photo.set_path(tfile)
|
||||
@ -542,8 +541,8 @@ class Gallery(ImageSelect):
|
||||
def on_photolist_drag_data_get(self,w, context, selection_data, info, time):
|
||||
if info == 1:
|
||||
return
|
||||
id = self.p_map[self.drag_item]
|
||||
selection_data.set(selection_data.target, 8, id[4])
|
||||
data = self.p_map[self.drag_item]
|
||||
selection_data.set(selection_data.target, 8, data[4])
|
||||
self.drag_item = None
|
||||
|
||||
def on_add_media_clicked(self, obj):
|
||||
@ -556,11 +555,11 @@ class Gallery(ImageSelect):
|
||||
Create a dialog to find out which object they want."""
|
||||
|
||||
s_o = SelectObject.SelectObject(self.db,_("Select an Object"))
|
||||
object = s_o.run()
|
||||
if not object:
|
||||
obj = s_o.run()
|
||||
if not obj:
|
||||
return
|
||||
oref = RelLib.MediaRef()
|
||||
oref.set_reference_handle(object.get_handle())
|
||||
oref.set_reference_handle(obj.get_handle())
|
||||
self.dataobj.add_media_reference(oref)
|
||||
self.add_thumbnail(oref)
|
||||
|
||||
@ -598,8 +597,8 @@ class Gallery(ImageSelect):
|
||||
|
||||
menu = gtk.Menu()
|
||||
menu.set_title(_("Media Object"))
|
||||
object = self.db.get_object_from_handle(photo.get_reference_handle())
|
||||
mtype = object.get_mime_type()
|
||||
obj = self.db.get_object_from_handle(photo.get_reference_handle())
|
||||
mtype = obj.get_mime_type()
|
||||
progname = GrampsMime.get_application(mtype)
|
||||
|
||||
if progname and len(progname) > 1:
|
||||
@ -628,10 +627,10 @@ class Gallery(ImageSelect):
|
||||
"""Copy this picture into gramps private database instead of
|
||||
leaving it as an external data object."""
|
||||
photo = obj.get_data('o')
|
||||
object = self.db.get_object_from_handle(photo.get_reference_handle())
|
||||
name = RelImage.import_media_object(object.get_path(),self.path,
|
||||
object.get_handle())
|
||||
object.set_path(name)
|
||||
obj = self.db.get_object_from_handle(photo.get_reference_handle())
|
||||
name = RelImage.import_media_object(obj.get_path(),self.path,
|
||||
obj.get_handle())
|
||||
obj.set_path(name)
|
||||
|
||||
def popup_change_description(self, obj):
|
||||
"""Bring up a window allowing the user to edit the description
|
||||
@ -659,11 +658,11 @@ class LocalMediaProperties:
|
||||
self.child_windows = {}
|
||||
self.photo = photo
|
||||
self.db = parent.db
|
||||
self.object = self.db.get_object_from_handle(photo.get_reference_handle())
|
||||
self.obj = self.db.get_object_from_handle(photo.get_reference_handle())
|
||||
self.alist = photo.get_attribute_list()[:]
|
||||
self.lists_changed = 0
|
||||
|
||||
fname = self.object.get_path()
|
||||
fname = self.obj.get_path()
|
||||
self.change_dialog = gtk.glade.XML(const.imageselFile,"change_description","gramps")
|
||||
|
||||
title = _('Media Reference Editor')
|
||||
@ -691,7 +690,7 @@ class LocalMediaProperties:
|
||||
|
||||
self.slist = self.change_dialog.get_widget("src_list")
|
||||
self.sources_label = self.change_dialog.get_widget("source_label")
|
||||
if self.object:
|
||||
if self.obj:
|
||||
self.srcreflist = [RelLib.SourceRef(ref) for ref in self.photo.get_source_references()]
|
||||
else:
|
||||
self.srcreflist = []
|
||||
@ -703,16 +702,16 @@ class LocalMediaProperties:
|
||||
self.change_dialog.get_widget('edit_src'),
|
||||
self.change_dialog.get_widget('del_src'))
|
||||
|
||||
descr_window.set_text(self.object.get_description())
|
||||
mtype = self.object.get_mime_type()
|
||||
descr_window.set_text(self.obj.get_description())
|
||||
mtype = self.obj.get_mime_type()
|
||||
|
||||
thumb = Utils.thumb_path(path,self.object)
|
||||
thumb = Utils.thumb_path(path,self.obj)
|
||||
if os.path.isfile(thumb):
|
||||
self.pix = gtk.gdk.pixbuf_new_from_file(thumb)
|
||||
self.pixmap.set_from_pixbuf(self.pix)
|
||||
|
||||
self.change_dialog.get_widget("private").set_active(photo.get_privacy())
|
||||
self.change_dialog.get_widget("gid").set_text(self.object.get_handle())
|
||||
self.change_dialog.get_widget("gid").set_text(self.obj.get_handle())
|
||||
|
||||
self.change_dialog.get_widget("path").set_text(fname)
|
||||
|
||||
@ -784,8 +783,8 @@ class LocalMediaProperties:
|
||||
self.amap = {}
|
||||
for attr in self.alist:
|
||||
d = [attr.get_type(),attr.get_value()]
|
||||
iter = self.atree.add(d,attr)
|
||||
self.amap[str(attr)] = iter
|
||||
node = self.atree.add(d,attr)
|
||||
self.amap[str(attr)] = node
|
||||
if self.alist:
|
||||
Utils.bold_label(self.attr_label)
|
||||
else:
|
||||
@ -820,7 +819,7 @@ class LocalMediaProperties:
|
||||
self.parent.parent.lists_changed = 1
|
||||
|
||||
trans = self.db.transaction_begin()
|
||||
self.db.commit_media_object(self.object,trans)
|
||||
self.db.commit_media_object(self.obj,trans)
|
||||
self.db.transaction_commit(trans,_("Edit Media Object"))
|
||||
|
||||
def on_help_clicked(self, obj):
|
||||
@ -832,9 +831,9 @@ class LocalMediaProperties:
|
||||
self.close(obj)
|
||||
|
||||
def on_attr_list_select_row(self,obj):
|
||||
store,iter = self.atree.get_selected()
|
||||
if iter:
|
||||
attr = self.atree.get_object(iter)
|
||||
store,node = self.atree.get_selected()
|
||||
if node:
|
||||
attr = self.atree.get_object(node)
|
||||
|
||||
self.attr_type.set_label(attr.get_type())
|
||||
self.attr_value.set_text(attr.get_value())
|
||||
@ -849,9 +848,9 @@ class LocalMediaProperties:
|
||||
def on_update_attr_clicked(self,obj):
|
||||
import AttrEdit
|
||||
|
||||
store,iter = self.atree.get_selected()
|
||||
if iter:
|
||||
attr = self.atree.get_object(iter)
|
||||
store,node = self.atree.get_selected()
|
||||
if node:
|
||||
attr = self.atree.get_object(node)
|
||||
AttrEdit.AttributeEditor(self,attr,"Media Object",
|
||||
Plugins.get_image_attributes(),
|
||||
self.attr_callback)
|
||||
@ -874,19 +873,19 @@ class LocalMediaProperties:
|
||||
#-------------------------------------------------------------------------
|
||||
class GlobalMediaProperties:
|
||||
|
||||
def __init__(self,db,object,update,parent,parent_window=None):
|
||||
def __init__(self,db,obj,update,parent,parent_window=None):
|
||||
self.parent = parent
|
||||
if object:
|
||||
if self.parent.parent.child_windows.has_key(object.get_handle()):
|
||||
self.parent.parent.child_windows[object.get_handle()].present(None)
|
||||
if obj:
|
||||
if self.parent.parent.child_windows.has_key(obj.get_handle()):
|
||||
self.parent.parent.child_windows[obj.get_handle()].present(None)
|
||||
return
|
||||
else:
|
||||
self.win_key = object.get_handle()
|
||||
self.win_key = obj.get_handle()
|
||||
else:
|
||||
self.win_key = self
|
||||
self.child_windows = {}
|
||||
self.object = object
|
||||
self.alist = self.object.get_attribute_list()[:]
|
||||
self.obj = obj
|
||||
self.alist = self.obj.get_attribute_list()[:]
|
||||
self.lists_changed = 0
|
||||
self.db = db
|
||||
self.update = update
|
||||
@ -924,8 +923,8 @@ class GlobalMediaProperties:
|
||||
|
||||
self.slist = self.change_dialog.get_widget("src_list")
|
||||
self.sources_label = self.change_dialog.get_widget("sourcesGlobal")
|
||||
if self.object:
|
||||
self.srcreflist = [RelLib.SourceRef(ref) for ref in self.object.get_source_references()]
|
||||
if self.obj:
|
||||
self.srcreflist = [RelLib.SourceRef(ref) for ref in self.obj.get_source_references()]
|
||||
else:
|
||||
self.srcreflist = []
|
||||
|
||||
@ -936,21 +935,21 @@ class GlobalMediaProperties:
|
||||
self.change_dialog.get_widget('gl_edit_src'),
|
||||
self.change_dialog.get_widget('gl_del_src'))
|
||||
|
||||
self.descr_window.set_text(self.object.get_description())
|
||||
mtype = self.object.get_mime_type()
|
||||
pb = gtk.gdk.pixbuf_new_from_file(Utils.thumb_path(self.path,self.object))
|
||||
self.descr_window.set_text(self.obj.get_description())
|
||||
mtype = self.obj.get_mime_type()
|
||||
pb = gtk.gdk.pixbuf_new_from_file(Utils.thumb_path(self.path,self.obj))
|
||||
self.pixmap.set_from_pixbuf(pb)
|
||||
|
||||
self.change_dialog.get_widget("gid").set_text(self.object.get_handle())
|
||||
self.change_dialog.get_widget("gid").set_text(self.obj.get_handle())
|
||||
self.makelocal = self.change_dialog.get_widget("makelocal")
|
||||
|
||||
self.update_info()
|
||||
|
||||
self.change_dialog.get_widget("type").set_text(Utils.get_mime_description(mtype))
|
||||
if self.object.get_note():
|
||||
self.notes.get_buffer().set_text(self.object.get_note())
|
||||
if self.obj.get_note():
|
||||
self.notes.get_buffer().set_text(self.obj.get_note())
|
||||
Utils.bold_label(self.notes_label)
|
||||
if self.object.get_note_format() == 1:
|
||||
if self.obj.get_note_format() == 1:
|
||||
self.preform.set_active(1)
|
||||
else:
|
||||
self.flowed.set_active(1)
|
||||
@ -1013,21 +1012,21 @@ class GlobalMediaProperties:
|
||||
self.window.present()
|
||||
|
||||
def on_up_clicked(self,obj):
|
||||
store,iter = self.atree.get_selected()
|
||||
if iter:
|
||||
row = self.atree.get_row(iter)
|
||||
store,node = self.atree.get_selected()
|
||||
if node:
|
||||
row = self.atree.get_row(node)
|
||||
if row != 0:
|
||||
self.atree.select_row(row-1)
|
||||
|
||||
def on_down_clicked(self,obj):
|
||||
model,iter = self.atree.get_selected()
|
||||
if not iter:
|
||||
model,node = self.atree.get_selected()
|
||||
if not node:
|
||||
return
|
||||
row = self.atree.get_row(iter)
|
||||
row = self.atree.get_row(node)
|
||||
self.atree.select_row(row+1)
|
||||
|
||||
def update_info(self):
|
||||
fname = self.object.get_path()
|
||||
fname = self.obj.get_path()
|
||||
self.change_dialog.get_widget("path").set_text(fname)
|
||||
|
||||
def redraw_attr_list(self):
|
||||
@ -1035,16 +1034,16 @@ class GlobalMediaProperties:
|
||||
self.amap = {}
|
||||
for attr in self.alist:
|
||||
d = [attr.get_type(),attr.get_value()]
|
||||
iter = self.atree.add(d,attr)
|
||||
self.amap[str(attr)] = iter
|
||||
node = self.atree.add(d,attr)
|
||||
self.amap[str(attr)] = node
|
||||
if self.alist:
|
||||
Utils.bold_label(self.attr_label)
|
||||
else:
|
||||
Utils.unbold_label(self.attr_label)
|
||||
|
||||
def button_press(self,obj):
|
||||
store,iter = self.refmodel.selection.get_selected()
|
||||
if not iter:
|
||||
store,node = self.refmodel.selection.get_selected()
|
||||
if not node:
|
||||
return
|
||||
|
||||
def display_refs(self):
|
||||
@ -1059,25 +1058,25 @@ class GlobalMediaProperties:
|
||||
for key in self.db.get_person_handles(sort_handles=False):
|
||||
p = self.db.get_person_from_handle(key)
|
||||
for o in p.get_media_list():
|
||||
if o.get_reference_handle() == self.object.get_handle():
|
||||
if o.get_reference_handle() == self.obj.get_handle():
|
||||
self.refmodel.add([_("Person"),p.get_handle(),GrampsCfg.get_nameof()(p)])
|
||||
any = 1
|
||||
for key in self.db.get_family_handles():
|
||||
p = self.db.get_family_from_handle(key)
|
||||
for o in p.get_media_list():
|
||||
if o.get_reference_handle() == self.object.get_handle():
|
||||
if o.get_reference_handle() == self.obj.get_handle():
|
||||
self.refmodel.add([_("Family"),p.get_handle(),Utils.family_name(p,self.db)])
|
||||
any = 1
|
||||
for key in self.db.get_source_handles():
|
||||
p = self.db.get_source_from_handle(key)
|
||||
for o in p.get_media_list():
|
||||
if o.get_reference_handle() == self.object.get_handle():
|
||||
if o.get_reference_handle() == self.obj.get_handle():
|
||||
self.refmodel.add([_("Source"),p.get_handle(),p.get_title()])
|
||||
any = 1
|
||||
for key in self.db.get_place_handles():
|
||||
p = self.db.get_place_from_handle(key)
|
||||
for o in p.get_media_list():
|
||||
if o.get_reference_handle() == self.object.get_handle():
|
||||
if o.get_reference_handle() == self.obj.get_handle():
|
||||
self.refmodel.add([_("Place"),p.get_handle(),p.get_title()])
|
||||
any = 1
|
||||
if any:
|
||||
@ -1099,20 +1098,20 @@ class GlobalMediaProperties:
|
||||
t = self.notes.get_buffer()
|
||||
text = unicode(t.get_text(t.get_start_iter(),t.get_end_iter(),gtk.FALSE))
|
||||
desc = unicode(self.descr_window.get_text())
|
||||
note = self.object.get_note()
|
||||
note = self.obj.get_note()
|
||||
format = self.preform.get_active()
|
||||
if text != note or desc != self.object.get_description():
|
||||
self.object.set_note(text)
|
||||
self.object.set_description(desc)
|
||||
if format != self.object.get_note_format():
|
||||
self.object.set_note_format(format)
|
||||
if text != note or desc != self.obj.get_description():
|
||||
self.obj.set_note(text)
|
||||
self.obj.set_description(desc)
|
||||
if format != self.obj.get_note_format():
|
||||
self.obj.set_note_format(format)
|
||||
if self.lists_changed:
|
||||
self.object.set_attribute_list(self.alist)
|
||||
self.object.set_source_reference_list(self.srcreflist)
|
||||
self.obj.set_attribute_list(self.alist)
|
||||
self.obj.set_source_reference_list(self.srcreflist)
|
||||
if self.update != None:
|
||||
self.update()
|
||||
trans = self.db.transaction_begin()
|
||||
self.db.commit_media_object(self.object,trans)
|
||||
self.db.commit_media_object(self.obj,trans)
|
||||
self.db.transaction_commit(trans,_("Edit Media Object"))
|
||||
|
||||
def on_help_clicked(self, obj):
|
||||
@ -1124,9 +1123,9 @@ class GlobalMediaProperties:
|
||||
self.close(obj)
|
||||
|
||||
def on_attr_list_select_row(self,obj):
|
||||
store,iter = self.atree.get_selected()
|
||||
if iter:
|
||||
attr = self.atree.get_object(iter)
|
||||
store,node = self.atree.get_selected()
|
||||
if node:
|
||||
attr = self.atree.get_object(node)
|
||||
|
||||
self.attr_type.set_label(attr.get_type())
|
||||
self.attr_value.set_text(attr.get_value())
|
||||
@ -1141,9 +1140,9 @@ class GlobalMediaProperties:
|
||||
def on_update_attr_clicked(self,obj):
|
||||
import AttrEdit
|
||||
|
||||
store,iter = self.atree.get_selected()
|
||||
if iter:
|
||||
attr = self.atree.get_object(iter)
|
||||
store,node = self.atree.get_selected()
|
||||
if node:
|
||||
attr = self.atree.get_object(node)
|
||||
AttrEdit.AttributeEditor(self,attr,"Media Object",
|
||||
Plugins.get_image_attributes(),
|
||||
self.attr_callback)
|
||||
|
104
src/ListModel.py
104
src/ListModel.py
@ -128,9 +128,9 @@ class ListModel:
|
||||
return path[0][0]-1
|
||||
|
||||
def get_selected_row(self):
|
||||
store, iter = self.selection.get_selected()
|
||||
if iter:
|
||||
rows = store.get_path(iter)
|
||||
store, node = self.selection.get_selected()
|
||||
if node:
|
||||
rows = store.get_path(node)
|
||||
return rows[0]
|
||||
else:
|
||||
return -1
|
||||
@ -139,9 +139,9 @@ class ListModel:
|
||||
if self.count == 0:
|
||||
return []
|
||||
elif self.mode == gtk.SELECTION_SINGLE:
|
||||
store,iter = self.selection.get_selected()
|
||||
if iter:
|
||||
return [self.model.get_value(iter,self.data_index)]
|
||||
store,node = self.selection.get_selected()
|
||||
if node:
|
||||
return [self.model.get_value(node,self.data_index)]
|
||||
else:
|
||||
return []
|
||||
else:
|
||||
@ -151,98 +151,98 @@ class ListModel:
|
||||
|
||||
def get_icon(self):
|
||||
if self.mode == gtk.SELECTION_SINGLE:
|
||||
store,iter = self.selection.get_selected()
|
||||
path = self.model.get_path(iter)
|
||||
store,node = self.selection.get_selected()
|
||||
path = self.model.get_path(node)
|
||||
else:
|
||||
mlist = []
|
||||
self.selection.selected_foreach(self.blist,mlist)
|
||||
path = self.model.get_path(mlist[0])
|
||||
return self.tree.create_row_drag_icon(path)
|
||||
|
||||
def blist(self,store,path,iter,list):
|
||||
list.append(self.model.get_value(iter,self.data_index))
|
||||
def blist(self,store,path,node,list):
|
||||
list.append(self.model.get_value(node,self.data_index))
|
||||
|
||||
def clear(self):
|
||||
self.count = 0
|
||||
self.model.clear()
|
||||
|
||||
def remove(self,iter):
|
||||
self.model.remove(iter)
|
||||
def remove(self,node):
|
||||
self.model.remove(node)
|
||||
self.count = self.count - 1
|
||||
|
||||
def get_row(self,iter):
|
||||
row = self.model.get_path(iter)
|
||||
def get_row(self,node):
|
||||
row = self.model.get_path(node)
|
||||
return row[0]
|
||||
|
||||
def select_row(self,row):
|
||||
self.selection.select_path((row))
|
||||
|
||||
def select_iter(self,iter):
|
||||
self.selection.select_iter(iter)
|
||||
def select_iter(self,node):
|
||||
self.selection.select_iter(node)
|
||||
|
||||
def get_object(self,iter):
|
||||
return self.model.get_value(iter,self.data_index)
|
||||
def get_object(self,node):
|
||||
return self.model.get_value(node,self.data_index)
|
||||
|
||||
def insert(self,position,data,info=None,select=0):
|
||||
self.count = self.count + 1
|
||||
iter = self.model.insert(position)
|
||||
node = self.model.insert(position)
|
||||
col = 0
|
||||
for object in data:
|
||||
self.model.set_value(iter,col,object)
|
||||
for obj in data:
|
||||
self.model.set_value(node,col,obj)
|
||||
col = col + 1
|
||||
self.model.set_value(iter,col,info)
|
||||
self.model.set_value(node,col,info)
|
||||
if info:
|
||||
self.idmap[str(info)] = iter
|
||||
self.idmap[str(info)] = node
|
||||
if select:
|
||||
self.selection.select_iter(iter)
|
||||
return iter
|
||||
self.selection.select_iter(node)
|
||||
return node
|
||||
|
||||
def get_data(self,iter,cols):
|
||||
return [ self.model.get_value(iter,c) for c in cols ]
|
||||
def get_data(self,node,cols):
|
||||
return [ self.model.get_value(node,c) for c in cols ]
|
||||
|
||||
def add(self,data,info=None,select=0):
|
||||
self.count = self.count + 1
|
||||
iter = self.model.append()
|
||||
node = self.model.append()
|
||||
col = 0
|
||||
for object in data:
|
||||
self.model.set_value(iter,col,object)
|
||||
for obj in data:
|
||||
self.model.set_value(node,col,obj)
|
||||
col = col + 1
|
||||
self.model.set_value(iter,col,info)
|
||||
self.model.set_value(node,col,info)
|
||||
if info:
|
||||
self.idmap[str(info)] = iter
|
||||
self.idmap[str(info)] = node
|
||||
if select:
|
||||
self.sel_iter = iter
|
||||
self.sel_iter = node
|
||||
self.selection.select_iter(self.sel_iter)
|
||||
return iter
|
||||
return node
|
||||
|
||||
def set(self,iter,data,info=None,select=0):
|
||||
def set(self,node,data,info=None,select=0):
|
||||
col = 0
|
||||
for object in data:
|
||||
self.model.set_value(iter,col,object)
|
||||
for obj in data:
|
||||
self.model.set_value(node,col,obj)
|
||||
col = col + 1
|
||||
self.model.set_value(iter,col,info)
|
||||
self.model.set_value(node,col,info)
|
||||
if info:
|
||||
self.idmap[str(info)] = iter
|
||||
self.idmap[str(info)] = node
|
||||
if select:
|
||||
self.sel_iter = iter
|
||||
return iter
|
||||
self.sel_iter = node
|
||||
return node
|
||||
|
||||
def add_and_select(self,data,info=None):
|
||||
self.count = self.count + 1
|
||||
iter = self.model.append()
|
||||
node = self.model.append()
|
||||
col = 0
|
||||
for object in data:
|
||||
self.model.set_value(iter,col,object)
|
||||
for obj in data:
|
||||
self.model.set_value(node,col,obj)
|
||||
col = col + 1
|
||||
if info:
|
||||
self.idmap[str(info)] = iter
|
||||
self.model.set_value(iter,col,info)
|
||||
self.selection.select_iter(iter)
|
||||
self.idmap[str(info)] = node
|
||||
self.model.set_value(node,col,info)
|
||||
self.selection.select_iter(node)
|
||||
|
||||
def center_selected(self):
|
||||
model,iter = self.selection.get_selected()
|
||||
if iter:
|
||||
path = model.get_path(iter)
|
||||
model,node = self.selection.get_selected()
|
||||
if node:
|
||||
path = model.get_path(node)
|
||||
self.tree.scroll_to_cell(path,None,gtk.TRUE,0.5,0.5)
|
||||
|
||||
def button_press(self,obj,event):
|
||||
@ -253,8 +253,8 @@ class ListModel:
|
||||
|
||||
def find(self,info):
|
||||
if info in self.idmap.keys():
|
||||
iter = self.idmap[str(info)]
|
||||
self.selection.select_iter(iter)
|
||||
node = self.idmap[str(info)]
|
||||
self.selection.select_iter(node)
|
||||
|
||||
def cleanup(self):
|
||||
pass
|
||||
|
@ -33,7 +33,6 @@ import os
|
||||
# GTK/Gnome modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import gobject
|
||||
import gtk
|
||||
import gtk.gdk
|
||||
|
||||
@ -48,7 +47,6 @@ import GrampsCfg
|
||||
import const
|
||||
import ImageSelect
|
||||
import RelImage
|
||||
import ColumnOrder
|
||||
import DisplayModels
|
||||
import GrampsMime
|
||||
|
||||
@ -160,22 +158,22 @@ class MediaView:
|
||||
def on_select_row(self,obj):
|
||||
fexists = 1
|
||||
|
||||
store,iter = self.selection.get_selected()
|
||||
if not iter:
|
||||
store,node = self.selection.get_selected()
|
||||
if not node:
|
||||
return
|
||||
|
||||
id = store.get_value(iter,1)
|
||||
handle = store.get_value(node,1)
|
||||
|
||||
mobj = self.db.get_object_from_handle(id)
|
||||
type = mobj.get_mime_type()
|
||||
type_name = Utils.get_mime_description(type)
|
||||
mobj = self.db.get_object_from_handle(handle)
|
||||
mtype = mobj.get_mime_type()
|
||||
type_name = Utils.get_mime_description(mtype)
|
||||
path = mobj.get_path()
|
||||
thumb_path = Utils.thumb_path(self.db.get_save_path(),mobj)
|
||||
pexists = os.path.exists(path)
|
||||
if pexists and os.path.exists(thumb_path):
|
||||
self.preview.set_from_pixbuf(gtk.gdk.pixbuf_new_from_file(thumb_path))
|
||||
else:
|
||||
icon_image = gtk.gdk.pixbuf_new_from_file(Utils.find_icon(type))
|
||||
icon_image = gtk.gdk.pixbuf_new_from_file(Utils.find_icon(mtype))
|
||||
self.preview.set_from_pixbuf(icon_image)
|
||||
if not pexists:
|
||||
fexists = 0
|
||||
@ -211,12 +209,12 @@ class MediaView:
|
||||
menu = gtk.Menu()
|
||||
menu.set_title(_("Media Object"))
|
||||
|
||||
store,iter = self.selection.get_selected()
|
||||
if iter:
|
||||
id = store.get_value(iter,1)
|
||||
object = self.db.get_object_from_handle(id)
|
||||
self.obj = object
|
||||
mime_type = object.get_mime_type()
|
||||
store,node = self.selection.get_selected()
|
||||
if node:
|
||||
handle = store.get_value(node,1)
|
||||
obj = self.db.get_object_from_handle(handle)
|
||||
self.obj = obj
|
||||
mime_type = obj.get_mime_type()
|
||||
|
||||
Utils.add_menuitem(menu,_("View in the default viewer"),None,
|
||||
self.popup_view_photo)
|
||||
@ -255,8 +253,8 @@ class MediaView:
|
||||
|
||||
def popup_convert_to_private(self, obj):
|
||||
path = self.db.get_save_path()
|
||||
id = self.obj.get_handle()
|
||||
name = RelImage.import_media_object(self.obj.get_path(),path,id)
|
||||
handle = self.obj.get_handle()
|
||||
name = RelImage.import_media_object(self.obj.get_path(),path,handle)
|
||||
if name:
|
||||
self.obj.set_path(name)
|
||||
self.load_media()
|
||||
@ -277,20 +275,20 @@ class MediaView:
|
||||
def on_edit_clicked(self,obj):
|
||||
"""Edit the properties of an existing media object in the media list"""
|
||||
|
||||
list_store, iter = self.selection.get_selected()
|
||||
if iter:
|
||||
id = list_store.get_value(iter,1)
|
||||
object = self.db.get_object_from_handle(id)
|
||||
ImageSelect.GlobalMediaProperties(self.db,object,self.load_media,
|
||||
list_store, node = self.selection.get_selected()
|
||||
if node:
|
||||
handle = list_store.get_value(node,1)
|
||||
obj = self.db.get_object_from_handle(handle)
|
||||
ImageSelect.GlobalMediaProperties(self.db,obj,self.load_media,
|
||||
self,self.topWindow)
|
||||
|
||||
def on_delete_clicked(self,obj):
|
||||
store,iter = self.selection.get_selected()
|
||||
if not iter:
|
||||
store,node = self.selection.get_selected()
|
||||
if not node:
|
||||
return
|
||||
|
||||
id = store.get_value(iter,1)
|
||||
mobj = self.db.get_object_from_handle(id)
|
||||
handle = store.get_value(node,1)
|
||||
mobj = self.db.get_object_from_handle(handle)
|
||||
if self.is_object_used(mobj):
|
||||
ans = ImageSelect.DeleteMediaQuery(mobj,self.db,self.build_tree)
|
||||
QuestionDialog(_('Delete Media Object?'),
|
||||
@ -330,13 +328,12 @@ class MediaView:
|
||||
return 0
|
||||
|
||||
def on_drag_begin(self,obj,context):
|
||||
store,iter = self.selection.get_selected()
|
||||
if not iter:
|
||||
store,node = self.selection.get_selected()
|
||||
if not node:
|
||||
return
|
||||
if (const.dnd_images):
|
||||
object = self.db.get_object_from_handle(store.get_value(iter,1))
|
||||
mtype = object.get_mime_type()
|
||||
name = Utils.thumb_path(self.db.get_save_path(),object)
|
||||
obj = self.db.get_object_from_handle(store.get_value(node,1))
|
||||
name = Utils.thumb_path(self.db.get_save_path(),obj)
|
||||
pix = gtk.gdk.pixbuf_new_from_file(name)
|
||||
context.set_icon_pixbuf(pix,0,0)
|
||||
|
||||
@ -344,20 +341,19 @@ class MediaView:
|
||||
if info == 1:
|
||||
return
|
||||
|
||||
store,iter = self.selection.get_selected()
|
||||
if not iter:
|
||||
store,node = self.selection.get_selected()
|
||||
if not node:
|
||||
return
|
||||
id = store.get_value(iter,1)
|
||||
selection_data.set(selection_data.target, 8, id)
|
||||
handle = store.get_value(node,1)
|
||||
selection_data.set(selection_data.target, 8, handle)
|
||||
|
||||
def on_drag_data_received(self,w, context, x, y, data, info, time):
|
||||
print "on_drag_data_received"
|
||||
import urlparse
|
||||
if data and data.format == 8:
|
||||
d = string.strip(string.replace(data.data,'\0',' '))
|
||||
protocol,site,file, j,k,l = urlparse.urlparse(d)
|
||||
protocol,site,name, j,k,l = urlparse.urlparse(d)
|
||||
if protocol == "file":
|
||||
name = file
|
||||
mime = GrampsMime.get_type(name)
|
||||
photo = RelLib.MediaObject()
|
||||
photo.set_path(name)
|
||||
@ -398,9 +394,9 @@ class MediaView:
|
||||
oref = RelLib.MediaRef()
|
||||
oref.set_reference_handle(photo.get_handle())
|
||||
try:
|
||||
id = photo.get_handle()
|
||||
handle = photo.get_handle()
|
||||
path = self.db.get_save_path()
|
||||
name = RelImage.import_media_object(tfile,path,id)
|
||||
name = RelImage.import_media_object(tfile,path,handle)
|
||||
if name:
|
||||
photo.set_path(name)
|
||||
except:
|
||||
|
@ -231,9 +231,9 @@ class MergePeople:
|
||||
one.add_source_reference(xsrc)
|
||||
|
||||
def on_merge_clicked(self,obj):
|
||||
list = self.p1.get_alternate_names()[:]
|
||||
lst = self.p1.get_alternate_names()[:]
|
||||
for xdata in self.p2.get_alternate_names():
|
||||
for data in list:
|
||||
for data in lst:
|
||||
if data.are_equal(xdata):
|
||||
self.copy_note(xdata,data)
|
||||
self.copy_sources(xdata,data)
|
||||
@ -241,9 +241,9 @@ class MergePeople:
|
||||
else:
|
||||
self.p1.add_alternate_name(xdata)
|
||||
|
||||
list = self.p1.get_attribute_list()[:]
|
||||
lst = self.p1.get_attribute_list()[:]
|
||||
for xdata in self.p2.get_attribute_list():
|
||||
for data in list:
|
||||
for data in lst:
|
||||
if data.get_type() == xdata.get_type() and \
|
||||
data.getValue() == xdata.get_value():
|
||||
self.copy_note(xdata,data)
|
||||
@ -252,9 +252,9 @@ class MergePeople:
|
||||
else:
|
||||
self.p1.add_attribute(xdata)
|
||||
|
||||
list = self.p1.get_event_list()[:]
|
||||
lst = self.p1.get_event_list()[:]
|
||||
for xdata in self.p2.get_event_list():
|
||||
for data in list:
|
||||
for data in lst:
|
||||
if data.are_equal(xdata):
|
||||
self.copy_note(xdata,data)
|
||||
self.copy_sources(xdata,data)
|
||||
@ -262,9 +262,9 @@ class MergePeople:
|
||||
else:
|
||||
self.p1.add_event(xdata)
|
||||
|
||||
list = self.p1.get_url_list()[:]
|
||||
lst = self.p1.get_url_list()[:]
|
||||
for xdata in self.p2.get_url_list():
|
||||
for data in list:
|
||||
for data in lst:
|
||||
if data.are_equal(xdata):
|
||||
break
|
||||
else:
|
||||
@ -785,14 +785,14 @@ def is_initial(name):
|
||||
#
|
||||
#
|
||||
#---------------------------------------------------------------------
|
||||
def ancestors_of(p1,list):
|
||||
def ancestors_of(p1,lst):
|
||||
if p1 == None:
|
||||
return
|
||||
list.append(p1)
|
||||
lst.append(p1)
|
||||
f1 = p1.get_main_parents_family_handle()
|
||||
if f1 != None:
|
||||
ancestors_of(f1.get_father_handle(),list)
|
||||
ancestors_of(f1.get_mother_handle(),list)
|
||||
ancestors_of(f1.get_father_handle(),lst)
|
||||
ancestors_of(f1.get_mother_handle(),lst)
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
#
|
||||
@ -875,14 +875,14 @@ class MergePlaces:
|
||||
self.p1.set_note("%s\n\n%s" % (self.p1.get_note(),note))
|
||||
|
||||
if t2active:
|
||||
list = [self.p1.get_main_location()] + self.p1.get_alternate_locations()
|
||||
lst = [self.p1.get_main_location()] + self.p1.get_alternate_locations()
|
||||
self.p1.set_main_location(self.p2.get_main_location())
|
||||
for l in list:
|
||||
for l in lst:
|
||||
if not l.is_empty():
|
||||
self.p1.add_alternate_locations(l)
|
||||
else:
|
||||
list = [self.p2.get_main_location()] + self.p2.get_alternate_locations()
|
||||
for l in list:
|
||||
lst = [self.p2.get_main_location()] + self.p2.get_alternate_locations()
|
||||
for l in lst:
|
||||
if not l.is_empty():
|
||||
self.p1.add_alternate_locations(l)
|
||||
|
||||
|
@ -209,15 +209,15 @@ class PedigreeView:
|
||||
style = self.canvas.get_style()
|
||||
font = gtk.gdk.font_from_description(style.font_desc)
|
||||
|
||||
list = [None]*31
|
||||
self.find_tree(self.active_person,0,1,list)
|
||||
lst = [None]*31
|
||||
self.find_tree(self.active_person,0,1,lst)
|
||||
|
||||
# determine the largest string width and height for calcuation
|
||||
# of box sizes.
|
||||
|
||||
a = pango.Layout(self.canvas.get_pango_context())
|
||||
|
||||
for t in list:
|
||||
for t in lst:
|
||||
if t:
|
||||
birth_handle = t[0].get_birth_handle()
|
||||
death_handle = t[0].get_death_handle()
|
||||
@ -281,12 +281,12 @@ class PedigreeView:
|
||||
self.canvas_items.append(arrow)
|
||||
break
|
||||
|
||||
if list[1]:
|
||||
p = list[1]
|
||||
if lst[1]:
|
||||
p = lst[1]
|
||||
self.add_parent_button(p[0],x2-_PAD,ypts[1],h)
|
||||
|
||||
if list[2]:
|
||||
p = list[2]
|
||||
if lst[2]:
|
||||
p = lst[2]
|
||||
self.add_parent_button(p[0],x2-_PAD,ypts[2],h)
|
||||
|
||||
gen_no = 1
|
||||
@ -306,19 +306,19 @@ class PedigreeView:
|
||||
gen_no = gen_no + 1
|
||||
|
||||
for i in range(gen):
|
||||
if list[i]:
|
||||
if lst[i]:
|
||||
if i < int(gen/2.0):
|
||||
findex = (2*i)+1
|
||||
mindex = findex+1
|
||||
if list[findex]:
|
||||
p = list[findex]
|
||||
if lst[findex]:
|
||||
p = lst[findex]
|
||||
self.draw_canvas_line(xpts[i], ypts[i], xpts[findex],
|
||||
ypts[findex], h, w, p[0], style, p[1])
|
||||
if list[mindex]:
|
||||
p = list[mindex]
|
||||
if lst[mindex]:
|
||||
p = lst[mindex]
|
||||
self.draw_canvas_line(xpts[i],ypts[i], xpts[mindex],
|
||||
ypts[mindex], h, w, p[0], style, p[1])
|
||||
p = list[i]
|
||||
p = lst[i]
|
||||
box = DispBox(self.root,style,xpts[i],ypts[i],w,h,p[0],self.parent.db,
|
||||
self.change_active_person,
|
||||
self.load_person, self.build_full_nav_menu)
|
||||
@ -479,7 +479,7 @@ class PedigreeView:
|
||||
obj.set(fill_color_gdk=style.fg[gtk.STATE_NORMAL], width_pixels=2)
|
||||
self.update()
|
||||
|
||||
def find_tree(self,person,index,depth,list,val=0):
|
||||
def find_tree(self,person,index,depth,lst,val=0):
|
||||
"""Recursively build a list of ancestors"""
|
||||
|
||||
if depth > 5 or person == None:
|
||||
@ -491,16 +491,16 @@ class PedigreeView:
|
||||
frel = (f != "Birth")
|
||||
|
||||
family = self.parent.db.get_family_from_handle(family_handle)
|
||||
list[index] = (person,val)
|
||||
lst[index] = (person,val)
|
||||
if family != None:
|
||||
father_handle = family.get_father_handle()
|
||||
if father_handle != None:
|
||||
father = self.parent.db.get_person_from_handle(father_handle)
|
||||
self.find_tree(father,(2*index)+1,depth+1,list,frel)
|
||||
self.find_tree(father,(2*index)+1,depth+1,lst,frel)
|
||||
mother_handle = family.get_mother_handle()
|
||||
if mother_handle != None:
|
||||
mother = self.parent.db.get_person_from_handle(mother_handle)
|
||||
self.find_tree(mother,(2*index)+2,depth+1,list,mrel)
|
||||
self.find_tree(mother,(2*index)+2,depth+1,lst,mrel)
|
||||
|
||||
def on_canvas1_event(self,obj,event):
|
||||
"""Handle resize events over the canvas, redrawing if the size changes"""
|
||||
@ -518,6 +518,7 @@ class PedigreeView:
|
||||
if event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
|
||||
self.build_nav_menu(event)
|
||||
return gtk.TRUE
|
||||
return gtk.FALSE
|
||||
|
||||
def add_nav_portion_to_menu(self,menu):
|
||||
"""
|
||||
@ -738,7 +739,7 @@ def get_distance(db,orig_person,other_person):
|
||||
r = Relationship.RelationshipCalculator(db)
|
||||
r.apply_filter(orig_person,0,firstList,firstMap)
|
||||
r.apply_filter(other_person,0,secondList,secondMap)
|
||||
except RuntimeError,msg:
|
||||
except RuntimeError:
|
||||
return None
|
||||
|
||||
for person_handle in firstList:
|
||||
|
@ -181,7 +181,6 @@ class PeopleView:
|
||||
self.goto_active_person()
|
||||
|
||||
def add_to_person_list(self,person,change=0):
|
||||
path = self.person_model.add_person(person)
|
||||
self.apply_filter_clicked()
|
||||
|
||||
def goto_active_person(self,first=0):
|
||||
|
@ -237,8 +237,8 @@ class PlaceView:
|
||||
EditPlace.EditPlace(self.parent, place, self.update_display)
|
||||
|
||||
def blist(self,store,path,iter,list):
|
||||
id = self.parent.db.get_place_from_handle(store.get_value(iter,_HANDLE_COL))
|
||||
list.append(id)
|
||||
handle = self.parent.db.get_place_from_handle(store.get_value(iter,_HANDLE_COL))
|
||||
list.append(handle)
|
||||
|
||||
def merge(self):
|
||||
mlist = []
|
||||
|
@ -215,10 +215,10 @@ class PluginDialog:
|
||||
"""Updates the informational display on the right hand side of
|
||||
the dialog box with the description of the selected report"""
|
||||
|
||||
store,iter = self.selection.get_selected()
|
||||
if iter:
|
||||
path = store.get_path(iter)
|
||||
if not iter or not self.imap.has_key(path):
|
||||
store,node = self.selection.get_selected()
|
||||
if node:
|
||||
path = store.get_path(node)
|
||||
if not node or not self.imap.has_key(path):
|
||||
self.statbox.hide()
|
||||
return
|
||||
self.statbox.show()
|
||||
@ -344,14 +344,14 @@ class PluginStatus:
|
||||
info.write(_("The following modules could not be loaded:"))
|
||||
info.write("\n\n")
|
||||
|
||||
for (file,msg) in _expect:
|
||||
info.write("%s: %s\n\n" % (file,msg))
|
||||
for (filename,msg) in _expect:
|
||||
info.write("%s: %s\n\n" % (filename,msg))
|
||||
|
||||
for (file,msgs) in _failmsg:
|
||||
for (filename,msgs) in _failmsg:
|
||||
error = str(msgs[0])
|
||||
if error[0:11] == "exceptions.":
|
||||
error = error[11:]
|
||||
info.write("%s: %s\n" % (file,error) )
|
||||
info.write("%s: %s\n" % (filename,error) )
|
||||
traceback.print_exception(msgs[0],msgs[1],msgs[2],None,info)
|
||||
info.write('\n')
|
||||
info.seek(0)
|
||||
@ -394,20 +394,20 @@ def load_plugins(direct):
|
||||
# add it to the _success list. If it fails, add it to the _failure
|
||||
# list
|
||||
|
||||
for file in os.listdir(direct):
|
||||
name = os.path.split(file)
|
||||
for filename in os.listdir(direct):
|
||||
name = os.path.split(filename)
|
||||
match = pymod.match(name[1])
|
||||
if not match:
|
||||
continue
|
||||
_attempt.append(file)
|
||||
_attempt.append(filename)
|
||||
plugin = match.groups()[0]
|
||||
try:
|
||||
a = __import__(plugin)
|
||||
_success.append(a)
|
||||
except Errors.PluginError, msg:
|
||||
_expect.append((file,str(msg)))
|
||||
_expect.append((filename,str(msg)))
|
||||
except:
|
||||
_failmsg.append((file,sys.exc_info()))
|
||||
_failmsg.append((filename,sys.exc_info()))
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -438,22 +438,22 @@ def reload_plugins(obj):
|
||||
_failmsg.append((plugin,sys.exc_info()))
|
||||
|
||||
# attempt to load any new files found
|
||||
for dir in _loaddir:
|
||||
for file in os.listdir(dir):
|
||||
name = os.path.split(file)
|
||||
for directory in _loaddir:
|
||||
for filename in os.listdir(directory):
|
||||
name = os.path.split(filename)
|
||||
match = pymod.match(name[1])
|
||||
if not match:
|
||||
continue
|
||||
if file in _attempt:
|
||||
if filename in _attempt:
|
||||
return
|
||||
_attempt.append(file)
|
||||
_attempt.append(filename)
|
||||
plugin = match.groups()[0]
|
||||
try:
|
||||
a = __import__(plugin)
|
||||
if a not in _success:
|
||||
_success.append(a)
|
||||
except:
|
||||
_failmsg.append((file,sys.exc_info()))
|
||||
_failmsg.append((filename,sys.exc_info()))
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -600,14 +600,14 @@ def build_menu(top_menu,list,callback):
|
||||
report_menu = gtk.Menu()
|
||||
report_menu.show()
|
||||
|
||||
hash = {}
|
||||
hash_data = {}
|
||||
for report in list:
|
||||
if hash.has_key(report[1]):
|
||||
hash[report[1]].append((report[2],report[0]))
|
||||
if hash_data.has_key(report[1]):
|
||||
hash_data[report[1]].append((report[2],report[0]))
|
||||
else:
|
||||
hash[report[1]] = [(report[2],report[0])]
|
||||
hash_data[report[1]] = [(report[2],report[0])]
|
||||
|
||||
catlist = hash.keys()
|
||||
catlist = hash_data.keys()
|
||||
catlist.sort()
|
||||
for key in catlist:
|
||||
entry = gtk.MenuItem(key)
|
||||
@ -616,9 +616,9 @@ def build_menu(top_menu,list,callback):
|
||||
submenu = gtk.Menu()
|
||||
submenu.show()
|
||||
entry.set_submenu(submenu)
|
||||
list = hash[key]
|
||||
list.sort()
|
||||
for name in list:
|
||||
lst = hash_data[key]
|
||||
lst.sort()
|
||||
for name in lst:
|
||||
subentry = gtk.MenuItem("%s..." % name[0])
|
||||
subentry.show()
|
||||
subentry.connect("activate",callback,name[1])
|
||||
|
@ -61,8 +61,8 @@ def import_media_object(filename,path,base):
|
||||
|
||||
ext = os.path.splitext(filename)[1]
|
||||
|
||||
type = GrampsMime.get_type(filename)
|
||||
if type[0:5] == "image":
|
||||
mtype = GrampsMime.get_type(filename)
|
||||
if mtype[0:5] == "image":
|
||||
name = "%s/%s%s" % (os.path.dirname(path),base,ext)
|
||||
thumb = "%s/.thumb" % (os.path.dirname(path))
|
||||
|
||||
@ -137,26 +137,26 @@ def scale_image(path,size):
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def mk_thumb(source,dest,size):
|
||||
dir = os.path.dirname(dest)
|
||||
directory = os.path.dirname(dest)
|
||||
|
||||
source = os.path.normpath(source)
|
||||
dest = os.path.normpath(dest)
|
||||
|
||||
try:
|
||||
if not os.path.exists(dir):
|
||||
os.mkdir(dir)
|
||||
if not os.path.exists(directory):
|
||||
os.mkdir(directory)
|
||||
except IOError,msg:
|
||||
ErrorDialog(_("Could not create %s") % dir, str(msg))
|
||||
ErrorDialog(_("Could not create %s") % directory, str(msg))
|
||||
return
|
||||
except:
|
||||
ErrorDialog(_("Could not create %s") % dir)
|
||||
ErrorDialog(_("Could not create %s") % directory)
|
||||
return
|
||||
|
||||
if os.path.exists(dest):
|
||||
try:
|
||||
os.remove(dest)
|
||||
except IOError,msg:
|
||||
errmsg = _("Could not replace %s") % dir
|
||||
errmsg = _("Could not replace %s") % directory
|
||||
ErrorDialog(errmsg,msg)
|
||||
return
|
||||
|
||||
|
@ -273,7 +273,7 @@ class RelationshipCalculator:
|
||||
try:
|
||||
self.apply_filter(orig_person,0,firstList,firstMap)
|
||||
self.apply_filter(other_person,0,secondList,secondMap)
|
||||
except RuntimeError,msg:
|
||||
except RuntimeError:
|
||||
return (firstRel,secondRel,_("Relationship loop detected"))
|
||||
|
||||
for person_handle in firstList:
|
||||
|
@ -99,7 +99,7 @@ class RelCalc:
|
||||
continue
|
||||
val = self.db.get_person_from_handle(key).get_display_info()
|
||||
event = self.db.find_event_from_handle(val[3])
|
||||
event_date = None
|
||||
event_date = ""
|
||||
if event:
|
||||
event_date = event.get_date ()
|
||||
self.clist.add([val[0],val[1],event_date,val[5],val[6]],p.get_handle())
|
||||
|
Loading…
Reference in New Issue
Block a user