* src/EditFamily.py: monitor for changed people and update if needed,
CellRendererCombo for child relations svn: r5791
This commit is contained in:
parent
8fbe67e6b0
commit
d3e381faca
@ -1,6 +1,7 @@
|
|||||||
2006-01-18 Don Allingham <don@gramps-project.org>
|
2006-01-18 Don Allingham <don@gramps-project.org>
|
||||||
* src/DisplayTabs.py: mediatab improvements
|
* src/DisplayTabs.py: mediatab improvements
|
||||||
* src/EditFamily.py: monitor for changed people and update if needed.
|
* src/EditFamily.py: monitor for changed people and update if needed,
|
||||||
|
CellRendererCombo for child relations
|
||||||
|
|
||||||
2006-01-18 Alex Roitman <shura@gramps-project.org>
|
2006-01-18 Alex Roitman <shura@gramps-project.org>
|
||||||
* src/GrampsDb/_GrampsBSDDB.py (load): Use BTREE for
|
* src/GrampsDb/_GrampsBSDDB.py (load): Use BTREE for
|
||||||
|
@ -95,7 +95,7 @@ class ButtonTab(GrampsTab):
|
|||||||
self.pack_start(vbox,False)
|
self.pack_start(vbox,False)
|
||||||
|
|
||||||
def double_click(self, obj, event):
|
def double_click(self, obj, event):
|
||||||
if event.type == gtk.gdk.BUTTON_PRESS and event.button == 1:
|
if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:
|
||||||
self.edit_button_clicked(obj)
|
self.edit_button_clicked(obj)
|
||||||
|
|
||||||
def add_button_clicked(self,obj):
|
def add_button_clicked(self,obj):
|
||||||
@ -341,16 +341,19 @@ class ChildModel(gtk.ListStore):
|
|||||||
|
|
||||||
_HANDLE_COL = -8
|
_HANDLE_COL = -8
|
||||||
|
|
||||||
def __init__(self, child_list,db):
|
def __init__(self, family,db):
|
||||||
gtk.ListStore.__init__(self,int,str,str,str,str,str,str,str,str,str,int,int)
|
self.family = family
|
||||||
|
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 child_list:
|
for child_handle in family.get_child_handle_list():
|
||||||
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(),
|
||||||
NameDisplay.displayer.display(child),
|
NameDisplay.displayer.display(child),
|
||||||
_GENDER[child.get_gender()],
|
_GENDER[child.get_gender()],
|
||||||
|
self.column_father_rel(child),
|
||||||
|
self.column_mother_rel(child),
|
||||||
self.column_birth_day(child),
|
self.column_birth_day(child),
|
||||||
self.column_death_day(child),
|
self.column_death_day(child),
|
||||||
self.column_birth_place(child),
|
self.column_birth_place(child),
|
||||||
@ -362,6 +365,28 @@ class ChildModel(gtk.ListStore):
|
|||||||
])
|
])
|
||||||
index += 1
|
index += 1
|
||||||
|
|
||||||
|
def display_rel(self,rtype):
|
||||||
|
if rtype[0] == RelLib.Family.CUSTOM:
|
||||||
|
return unicode(rtype[1])
|
||||||
|
else:
|
||||||
|
return Utils.child_relations[rtype[0]]
|
||||||
|
|
||||||
|
def column_father_rel(self,data):
|
||||||
|
chandle = data.handle
|
||||||
|
fhandle = self.family.handle
|
||||||
|
for (handle, mrel, frel) in data.get_parent_family_handle_list():
|
||||||
|
if handle == fhandle:
|
||||||
|
return self.display_rel(frel)
|
||||||
|
return ""
|
||||||
|
|
||||||
|
def column_mother_rel(self,data):
|
||||||
|
chandle = data.handle
|
||||||
|
fhandle = self.family.handle
|
||||||
|
for (handle, mrel, frel) in data.get_parent_family_handle_list():
|
||||||
|
if handle == fhandle:
|
||||||
|
return self.display_rel(mrel)
|
||||||
|
return ""
|
||||||
|
|
||||||
def column_birth_day(self,data):
|
def column_birth_day(self,data):
|
||||||
event_ref = data.get_birth_ref()
|
event_ref = data.get_birth_ref()
|
||||||
if event_ref and event_ref.ref:
|
if event_ref and event_ref.ref:
|
||||||
|
@ -90,13 +90,15 @@ class AttrEmbedList(EmbeddedList):
|
|||||||
|
|
||||||
class ChildEmbedList(EmbeddedList):
|
class ChildEmbedList(EmbeddedList):
|
||||||
|
|
||||||
_HANDLE_COL = 8
|
_HANDLE_COL = 10
|
||||||
|
|
||||||
column_names = [
|
column_names = [
|
||||||
(_('#'),0) ,
|
(_('#'),0) ,
|
||||||
(_('ID'),1) ,
|
(_('ID'),1) ,
|
||||||
(_('Name'),9),
|
(_('Name'),9),
|
||||||
(_('Gender'),3),
|
(_('Gender'),3),
|
||||||
|
(_('Paternal'),12),
|
||||||
|
(_('Maternal'),13),
|
||||||
(_('Birth Date'),10),
|
(_('Birth Date'),10),
|
||||||
(_('Death Date'),11),
|
(_('Death Date'),11),
|
||||||
(_('Birth Place'),6),
|
(_('Birth Place'),6),
|
||||||
@ -108,14 +110,51 @@ class ChildEmbedList(EmbeddedList):
|
|||||||
EmbeddedList.__init__(self, dbstate, uistate, track,
|
EmbeddedList.__init__(self, dbstate, uistate, track,
|
||||||
_('Children'), ChildModel)
|
_('Children'), ChildModel)
|
||||||
|
|
||||||
|
def build_columns(self):
|
||||||
|
for column in self.columns:
|
||||||
|
self.tree.remove_column(column)
|
||||||
|
self.columns = []
|
||||||
|
|
||||||
|
for pair in self.column_order():
|
||||||
|
if not pair[0]:
|
||||||
|
continue
|
||||||
|
name = self.column_names[pair[1]][0]
|
||||||
|
if pair[1] == 4 or pair[1] == 5:
|
||||||
|
model = gtk.ListStore(str,int)
|
||||||
|
for x in Utils.child_relations.keys():
|
||||||
|
model.append(row=[Utils.child_relations[x],x])
|
||||||
|
render = gtk.CellRendererCombo()
|
||||||
|
render.set_property('editable',True)
|
||||||
|
render.set_property('model',model)
|
||||||
|
render.set_property('text-column',0)
|
||||||
|
else:
|
||||||
|
render = gtk.CellRendererText()
|
||||||
|
|
||||||
|
column = gtk.TreeViewColumn(name, render, text=pair[1])
|
||||||
|
column = gtk.TreeViewColumn(name, render, text=pair[1])
|
||||||
|
column.set_resizable(True)
|
||||||
|
column.set_min_width(40)
|
||||||
|
column.set_sort_column_id(self.column_names[pair[1]][1])
|
||||||
|
self.columns.append(column)
|
||||||
|
self.tree.append_column(column)
|
||||||
|
|
||||||
def get_icon_name(self):
|
def get_icon_name(self):
|
||||||
return 'gramps-person'
|
return 'gramps-person'
|
||||||
|
|
||||||
|
def set_label(self):
|
||||||
|
if len(self.family.get_child_handle_list()):
|
||||||
|
self.tab_image.show()
|
||||||
|
self.label.set_text("<b>%s</b>" % self.tab_name)
|
||||||
|
self.label.set_use_markup(True)
|
||||||
|
else:
|
||||||
|
self.tab_image.hide()
|
||||||
|
self.label.set_text(self.tab_name)
|
||||||
|
|
||||||
def get_data(self):
|
def get_data(self):
|
||||||
return self.family.get_child_handle_list()
|
return self.family
|
||||||
|
|
||||||
def column_order(self):
|
def column_order(self):
|
||||||
return self.dbstate.db.get_child_column_order()
|
return [(1,0),(1,1),(1,2),(1,3),(1,4),(1,5),(1,6),(0,8),(0,9)]
|
||||||
|
|
||||||
def add_button_clicked(self,obj):
|
def add_button_clicked(self,obj):
|
||||||
print "Add Button Clicked"
|
print "Add Button Clicked"
|
||||||
|
Loading…
Reference in New Issue
Block a user