diff --git a/ChangeLog b/ChangeLog index 23ac3e3bb..5f9b5c825 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2006-01-18 Don Allingham + * src/DisplayTabs.py: mediatab improvements + * src/EditFamily.py: monitor for changed people and update if needed. + 2006-01-18 Alex Roitman * src/GrampsDb/_GrampsBSDDB.py (load): Use BTREE for reference_map; sort reference_map_referenced_map index. diff --git a/src/DisplayTabs.py b/src/DisplayTabs.py index a171fbe63..f99d922c3 100644 --- a/src/DisplayTabs.py +++ b/src/DisplayTabs.py @@ -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 diff --git a/src/EditFamily.py b/src/EditFamily.py index 077f6a311..465932e6c 100644 --- a/src/EditFamily.py +++ b/src/EditFamily.py @@ -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()