* src/DisplayTabs.py: add SourceRefModel

* src/EditFamily.py: fix variable names


svn: r5849
This commit is contained in:
Don Allingham 2006-01-28 20:38:03 +00:00
parent 754a0400f0
commit 1cd6feda90
3 changed files with 39 additions and 12 deletions

View File

@ -1,4 +1,6 @@
2006-01-28 Don Allingham <don@gramps-project.org> 2006-01-28 Don Allingham <don@gramps-project.org>
* src/DisplayTabs.py: add SourceRefModel
* src/EditFamily.py: fix variable names
* src/GrampsDb/_GrampsBSDDB.py: qualify strxfrm * src/GrampsDb/_GrampsBSDDB.py: qualify strxfrm
2006-01-27 Alex Roitman <shura@gramps-project.org> 2006-01-27 Alex Roitman <shura@gramps-project.org>

View File

@ -239,7 +239,6 @@ class ButtonTab(GrampsTab):
""" """
print "Uncaught Edit clicked" print "Uncaught Edit clicked"
class EmbeddedList(ButtonTab): class EmbeddedList(ButtonTab):
""" """
This class provides the base class for all the list tabs. It This class provides the base class for all the list tabs. It
@ -444,7 +443,6 @@ class EventEmbedList(EmbeddedList):
if ref: if ref:
print ref print ref
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# SourceBackRefList # SourceBackRefList
@ -512,7 +510,6 @@ class SourceBackRefList(EmbeddedList):
if ref: if ref:
print ref print ref
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# DataEmbedList # DataEmbedList
@ -570,7 +567,7 @@ class NoteTab(GrampsTab):
how the label should be displayed. how the label should be displayed.
""" """
buf = self.text.get_buffer() 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): def build_interface(self):
self.text = gtk.TextView() self.text = gtk.TextView()
@ -671,6 +668,8 @@ class SourceEmbedList(EmbeddedList):
_column_names = [ _column_names = [
(_('ID'),0), (_('ID'),0),
(_('Title'),1), (_('Title'),1),
(_('Author'),2),
(_('Page'),3),
] ]
def __init__(self,dbstate,uistate,track,obj): def __init__(self,dbstate,uistate,track,obj):
@ -711,12 +710,13 @@ class ChildModel(gtk.ListStore):
_HANDLE_COL = -8 _HANDLE_COL = -8
def __init__(self, family,db): def __init__(self, family, db):
self.family = family 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 self.db = db
index = 1 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) child = db.get_person_from_handle(child_handle)
self.append(row=[index, self.append(row=[index,
child.get_gramps_id(), child.get_gramps_id(),
@ -735,6 +735,9 @@ class ChildModel(gtk.ListStore):
]) ])
index += 1 index += 1
def get_data(self):
return self.family.get_child_handle_list()
def display_rel(self,rtype): def display_rel(self,rtype):
if type(rtype) == tuple: if type(rtype) == tuple:
rel = rtype[0] 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): class SourceBackRefModel(gtk.ListStore):

View File

@ -73,7 +73,7 @@ class AttrEmbedList(EmbeddedList):
_HANDLE_COL = -1 _HANDLE_COL = -1
column_names = [ _column_names = [
(_('Type'),0), (_('Type'),0),
(_('Value'),1), (_('Value'),1),
] ]
@ -93,7 +93,7 @@ class ChildEmbedList(EmbeddedList):
_HANDLE_COL = 10 _HANDLE_COL = 10
column_names = [ _column_names = [
(_('#'),0) , (_('#'),0) ,
(_('ID'),1) , (_('ID'),1) ,
(_('Name'),9), (_('Name'),9),
@ -119,7 +119,7 @@ class ChildEmbedList(EmbeddedList):
for pair in self.column_order(): for pair in self.column_order():
if not pair[0]: if not pair[0]:
continue continue
name = self.column_names[pair[1]][0] name = self._column_names[pair[1]][0]
if pair[1] == 4 or pair[1] == 5: if pair[1] == 4 or pair[1] == 5:
render = TypeCellRenderer(Utils.child_relations) render = TypeCellRenderer(Utils.child_relations)
column = gtk.TreeViewColumn(name, render, text=pair[1]) column = gtk.TreeViewColumn(name, render, text=pair[1])
@ -129,7 +129,7 @@ class ChildEmbedList(EmbeddedList):
column.set_resizable(True) column.set_resizable(True)
column.set_min_width(40) 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.columns.append(column)
self.tree.append_column(column) self.tree.append_column(column)
@ -145,6 +145,9 @@ class ChildEmbedList(EmbeddedList):
self.tab_image.hide() self.tab_image.hide()
self.label.set_text(self.tab_name) self.label.set_text(self.tab_name)
def is_empty(self):
return len(self.family.get_child_handle_list()) == 0
def get_data(self): def get_data(self):
return self.family return self.family