* src/DisplayTabs.py: mediatab improvements

* src/EditFamily.py: monitor for changed people and update if needed.


svn: r5787
This commit is contained in:
Don Allingham 2006-01-18 19:36:23 +00:00
parent ca3ec41ac7
commit f7f45779ee
3 changed files with 58 additions and 2 deletions

View File

@ -1,3 +1,7 @@
2006-01-18 Don Allingham <don@gramps-project.org>
* src/DisplayTabs.py: mediatab improvements
* src/EditFamily.py: monitor for changed people and update if needed.
2006-01-18 Alex Roitman <shura@gramps-project.org>
* src/GrampsDb/_GrampsBSDDB.py (load): Use BTREE for
reference_map; sort reference_map_referenced_map index.

View File

@ -282,6 +282,7 @@ class GalleryTab(ButtonTab):
self.iconlist.set_pixbuf_column(0)
self.iconlist.set_text_column(1)
self.iconlist.set_model(self.iconmodel)
self.iconlist.set_selection_mode(gtk.SELECTION_SINGLE)
scroll = gtk.ScrolledWindow()
scroll.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC)
@ -292,10 +293,12 @@ class GalleryTab(ButtonTab):
return self.media_list
def rebuild(self):
self.iconmodel= gtk.ListStore(gtk.gdk.Pixbuf,str)
for ref in self.media_list:
obj = self.dbstate.db.get_object_from_handle(ref.get_reference_handle())
pixbuf = self.get_image(obj)
self.iconmodel.append(row=[pixbuf,obj.get_description()])
self.iconlist.set_model(self.iconmodel)
self.set_label()
def get_image(self,obj):
@ -310,6 +313,25 @@ class GalleryTab(ButtonTab):
image = gtk.gdk.pixbuf_new_from_file(const.icon)
return image
def get_selected(self):
node = self.iconlist.get_selected_items()
if len(node) > 0:
return self.media_list[node[0][0]]
else:
return None
def add_button_clicked(self,obj):
print "Media Add clicked"
def del_button_clicked(self,obj):
ref = self.get_selected()
if ref:
self.media_list.remove(ref)
self.rebuild()
def edit_button_clicked(self,obj):
print "Media Edit clicked"
#-------------------------------------------------------------------------
#
# ChildModel

View File

@ -155,9 +155,31 @@ class EditFamily(DisplayState.ManagedWindow):
self.mname = None
self.fname = None
self.signal_keys = []
self.signal_keys.append(self.dbstate.db.connect('person-update',
self.check_for_change))
self.signal_keys.append(self.dbstate.db.connect('person-delete',
self.check_for_change))
self.signal_keys.append(self.dbstate.db.connect('person-rebuild',
self.reload_people))
self.show()
def check_for_change(self,handles):
for node in handles:
if node in self.phandles:
self.reload_people()
break;
def reload_people(self):
fhandle = self.family.get_father_handle()
self.update_father(fhandle)
mhandle = self.family.get_mother_handle()
self.update_mother(mhandle)
self.child_list.rebuild()
def build_menu_names(self,obj):
return ('Edit Family','Undefined Submenu')
@ -211,8 +233,14 @@ class EditFamily(DisplayState.ManagedWindow):
self.cancel.connect('clicked', self.close_window)
def load_data(self):
self.update_father(self.family.get_father_handle())
self.update_mother(self.family.get_mother_handle())
fhandle = self.family.get_father_handle()
self.update_father(fhandle)
mhandle = self.family.get_mother_handle()
self.update_mother(mhandle)
self.phandles = [mhandle, fhandle] + self.family.get_child_handle_list()
self.phandles = [handle for handle in self.phandles if handle]
self.mbutton.connect('clicked',self.mother_clicked)
self.fbutton.connect('clicked',self.father_clicked)
@ -327,4 +355,6 @@ class EditFamily(DisplayState.ManagedWindow):
death_obj.set_text(death)
def close_window(self,obj):
for key in self.signal_keys:
self.dbstate.db.disconnect(key)
self.close()