Fixed for place merging, make local copy of image
svn: r511
This commit is contained in:
parent
b40034531d
commit
3c10bc0a95
@ -95,6 +95,8 @@ class AddMediaObject:
|
||||
if external.get_active() == 0:
|
||||
path = self.db.getSavePath()
|
||||
name = RelImage.import_media_object(filename,path,mobj.getId())
|
||||
else:
|
||||
name = filename
|
||||
mobj.setPath(name)
|
||||
|
||||
utils.modified()
|
||||
|
@ -511,14 +511,14 @@ class LocalMediaProperties:
|
||||
|
||||
class GlobalMediaProperties:
|
||||
|
||||
def __init__(self,db,object):
|
||||
def __init__(self,db,object,update):
|
||||
self.object = object
|
||||
self.alist = self.object.getAttributeList()[:]
|
||||
self.lists_changed = 0
|
||||
self.db = db
|
||||
self.update = update
|
||||
|
||||
path = self.db.getSavePath()
|
||||
fname = self.object.getPath()
|
||||
self.path = self.db.getSavePath()
|
||||
self.change_dialog = libglade.GladeXML(const.imageselFile,"change_global")
|
||||
window = self.change_dialog.get_widget("change_global")
|
||||
descr_window = self.change_dialog.get_widget("description")
|
||||
@ -530,28 +530,46 @@ class GlobalMediaProperties:
|
||||
|
||||
descr_window.set_text(self.object.getDescription())
|
||||
mtype = self.object.getMimeType()
|
||||
pixmap.load_file(utils.thumb_path(path,self.object))
|
||||
pixmap.load_file(utils.thumb_path(self.path,self.object))
|
||||
|
||||
self.change_dialog.get_widget("gid").set_text(self.object.getId())
|
||||
self.makelocal = self.change_dialog.get_widget("makelocal")
|
||||
|
||||
if self.object.getLocal():
|
||||
self.change_dialog.get_widget("path").set_text("<local>")
|
||||
else:
|
||||
self.change_dialog.get_widget("path").set_text(fname)
|
||||
self.update_info()
|
||||
|
||||
self.change_dialog.get_widget("type").set_text(utils.get_mime_description(mtype))
|
||||
self.change_dialog.get_widget("notes").insert_defaults(object.getNote())
|
||||
self.change_dialog.signal_autoconnect({
|
||||
"on_cancel_clicked" : utils.destroy_passed_object,
|
||||
"on_ok_clicked" : self.on_ok_clicked,
|
||||
"on_apply_clicked" : self.on_apply_clicked,
|
||||
"on_attr_list_select_row" : self.on_attr_list_select_row,
|
||||
"on_add_attr_clicked": self.on_add_attr_clicked,
|
||||
"on_cancel_clicked" : utils.destroy_passed_object,
|
||||
"on_ok_clicked" : self.on_ok_clicked,
|
||||
"on_apply_clicked" : self.on_apply_clicked,
|
||||
"on_attr_list_select_row": self.on_attr_list_select_row,
|
||||
"on_add_attr_clicked" : self.on_add_attr_clicked,
|
||||
"on_notebook_switch_page": self.on_notebook_switch_page,
|
||||
"on_make_local_clicked" : self.on_make_local_clicked,
|
||||
"on_delete_attr_clicked" : self.on_delete_attr_clicked,
|
||||
"on_update_attr_clicked" : self.on_update_attr_clicked,
|
||||
})
|
||||
self.redraw_attr_list()
|
||||
|
||||
def update_info(self):
|
||||
fname = self.object.getPath()
|
||||
if self.object.getLocal():
|
||||
self.change_dialog.get_widget("path").set_text("<local>")
|
||||
self.makelocal.set_sensitive(0)
|
||||
else:
|
||||
self.change_dialog.get_widget("path").set_text(fname)
|
||||
self.makelocal.set_sensitive(1)
|
||||
|
||||
def on_make_local_clicked(self, obj):
|
||||
name = RelImage.import_media_object(self.object.getPath(),
|
||||
self.path,
|
||||
self.object.getId())
|
||||
self.object.setPath(name)
|
||||
self.object.setLocal(1)
|
||||
self.update_info()
|
||||
self.update()
|
||||
|
||||
def redraw_attr_list(self):
|
||||
utils.redraw_list(self.alist,self.attr_list,disp_attr)
|
||||
|
||||
|
@ -807,7 +807,9 @@ class MergePlaces:
|
||||
self.top.show()
|
||||
|
||||
def on_merge_places_clicked(self,obj):
|
||||
if self.glade.get_widget("title2").get_active():
|
||||
t2active = self.glade.get_widget("title2").get_active()
|
||||
|
||||
if t2active:
|
||||
self.p1.set_title(self.p2.get_title())
|
||||
elif self.glade.get_widget("title3").get_active():
|
||||
self.p1.set_title(self.t3.get_text())
|
||||
@ -827,9 +829,20 @@ class MergePlaces:
|
||||
self.p1.setNote(note)
|
||||
elif self.p1.getNote() != note:
|
||||
self.p1.setNote("%s\n\n%s" % (self.p1.getNote(),note))
|
||||
for l in [self.p2.get_main_location()] + self.p2.get_alternate_locations():
|
||||
if not l.is_empty():
|
||||
self.p1.add_alternate_locations(l)
|
||||
|
||||
if t2active:
|
||||
list = [self.p1.get_main_location()] + self.p1.get_alternate_locations()
|
||||
self.p1.set_main_location(self.p2.get_main_location())
|
||||
for l in list:
|
||||
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:
|
||||
if not l.is_empty():
|
||||
self.p1.add_alternate_locations(l)
|
||||
|
||||
|
||||
for p in self.db.getPersonMap().values():
|
||||
for event in [p.getBirth(), p.getDeath()] + p.getEventList():
|
||||
if event.getPlace() == self.p2:
|
||||
|
@ -2129,7 +2129,7 @@ def on_edit_media_clicked(obj):
|
||||
if len(media_list.selection) <= 0:
|
||||
return
|
||||
object = media_list.get_row_data(media_list.selection[0])
|
||||
ImageSelect.GlobalMediaProperties(database,object)
|
||||
ImageSelect.GlobalMediaProperties(database,object,load_media)
|
||||
|
||||
def on_delete_media_clicked(obj):
|
||||
if len(media_list.selection) <= 0:
|
||||
|
@ -1676,7 +1676,7 @@
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<expand>False</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
@ -1736,7 +1736,7 @@
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<padding>5</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
@ -1760,7 +1760,7 @@
|
||||
|
||||
<widget>
|
||||
<class>GtkButton</class>
|
||||
<name>button92</name>
|
||||
<name>makelocal</name>
|
||||
<can_focus>True</can_focus>
|
||||
<signal>
|
||||
<name>clicked</name>
|
||||
|
Loading…
Reference in New Issue
Block a user