diff --git a/ChangeLog b/ChangeLog index dc1154bc8..be85b2b37 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,6 @@ 2006-01-28 Don Allingham + * src/DisplayTabs.py: add SourceRefModel + * src/EditFamily.py: fix variable names * src/GrampsDb/_GrampsBSDDB.py: qualify strxfrm 2006-01-27 Alex Roitman diff --git a/src/DisplayTabs.py b/src/DisplayTabs.py index 879832e38..5cd348a93 100644 --- a/src/DisplayTabs.py +++ b/src/DisplayTabs.py @@ -239,7 +239,6 @@ class ButtonTab(GrampsTab): """ print "Uncaught Edit clicked" - class EmbeddedList(ButtonTab): """ This class provides the base class for all the list tabs. It @@ -444,7 +443,6 @@ class EventEmbedList(EmbeddedList): if ref: print ref - #------------------------------------------------------------------------- # # SourceBackRefList @@ -512,7 +510,6 @@ class SourceBackRefList(EmbeddedList): if ref: print ref - #------------------------------------------------------------------------- # # DataEmbedList @@ -570,7 +567,7 @@ class NoteTab(GrampsTab): how the label should be displayed. """ buf = self.text.get_buffer() - return len(buf.get_text(buf.get_start_iter(),buf.get_end_iter()))>0 + return len(buf.get_text(buf.get_start_iter(),buf.get_end_iter())) == 0 def build_interface(self): self.text = gtk.TextView() @@ -671,6 +668,8 @@ class SourceEmbedList(EmbeddedList): _column_names = [ (_('ID'),0), (_('Title'),1), + (_('Author'),2), + (_('Page'),3), ] def __init__(self,dbstate,uistate,track,obj): @@ -711,12 +710,13 @@ class ChildModel(gtk.ListStore): _HANDLE_COL = -8 - def __init__(self, family,db): + def __init__(self, family, db): self.family = family - gtk.ListStore.__init__(self,int,str,str,str,str,str,str,str,str,str,str,str,int,int) + gtk.ListStore.__init__(self,int,str,str,str,str,str, + str,str,str,str,str,str,int,int) self.db = db index = 1 - for child_handle in family.get_child_handle_list(): + for child_handle in self.get_data(): child = db.get_person_from_handle(child_handle) self.append(row=[index, child.get_gramps_id(), @@ -735,6 +735,9 @@ class ChildModel(gtk.ListStore): ]) index += 1 + def get_data(self): + return self.family.get_child_handle_list() + def display_rel(self,rtype): if type(rtype) == tuple: rel = rtype[0] @@ -900,7 +903,26 @@ class DataModel(gtk.ListStore): #------------------------------------------------------------------------- # -# SourceRefModel +# DataModel +# +#------------------------------------------------------------------------- +class SourceRefModel(gtk.ListStore): + + def __init__(self,sref_list,db): + gtk.ListStore.__init__(self,str,str,str,str) + self.db = db + for sref in sref_list: + src = self.db.get_source_from_handle(sref.ref) + self.append(row=[ + sref.ref, + src.title, + src.author, + sref.page + ]) + +#------------------------------------------------------------------------- +# +# SourceBacRefModel # #------------------------------------------------------------------------- class SourceBackRefModel(gtk.ListStore): diff --git a/src/EditFamily.py b/src/EditFamily.py index 78933f372..741b7f8b6 100644 --- a/src/EditFamily.py +++ b/src/EditFamily.py @@ -73,7 +73,7 @@ class AttrEmbedList(EmbeddedList): _HANDLE_COL = -1 - column_names = [ + _column_names = [ (_('Type'),0), (_('Value'),1), ] @@ -93,7 +93,7 @@ class ChildEmbedList(EmbeddedList): _HANDLE_COL = 10 - column_names = [ + _column_names = [ (_('#'),0) , (_('ID'),1) , (_('Name'),9), @@ -119,7 +119,7 @@ class ChildEmbedList(EmbeddedList): for pair in self.column_order(): if not pair[0]: continue - name = self.column_names[pair[1]][0] + name = self._column_names[pair[1]][0] if pair[1] == 4 or pair[1] == 5: render = TypeCellRenderer(Utils.child_relations) column = gtk.TreeViewColumn(name, render, text=pair[1]) @@ -129,7 +129,7 @@ class ChildEmbedList(EmbeddedList): column.set_resizable(True) column.set_min_width(40) - column.set_sort_column_id(self.column_names[pair[1]][1]) + column.set_sort_column_id(self._column_names[pair[1]][1]) self.columns.append(column) self.tree.append_column(column) @@ -145,6 +145,9 @@ class ChildEmbedList(EmbeddedList): self.tab_image.hide() self.label.set_text(self.tab_name) + def is_empty(self): + return len(self.family.get_child_handle_list()) == 0 + def get_data(self): return self.family