* src/SelectChild.py: use PersonModel

* src/plugins/FilterEditor.py: use new SelectPerson


svn: r3052
This commit is contained in:
Don Allingham 2004-03-23 05:01:19 +00:00
parent b35dd5973b
commit bf92d284ab
17 changed files with 217 additions and 330 deletions

View File

@ -5,6 +5,8 @@
* src/PeopleModel.py: handle sorting of columns
* src/ChooseParents.py: handle sorting of columns
* src/SelectPerson.py: use PersonModel
* src/SelectChild.py: use PersonModel
* src/plugins/FilterEditor.py: use new SelectPerson
2004-03-22 Alex Roitman <shura@alex.neuro.umn.edu>
* src/docgen/LPRDoc.py: Fix colliding name.

View File

@ -181,12 +181,14 @@ class ChooseParents:
def add_columns(self,tree):
column = gtk.TreeViewColumn(_('Name'), self.renderer,text=0)
column.set_resizable(gtk.TRUE)
#column.set_clickable(gtk.TRUE)
column.set_clickable(gtk.TRUE)
column.set_sort_column_id(0)
column.set_min_width(225)
tree.append_column(column)
column = gtk.TreeViewColumn(_('ID'), self.renderer,text=1)
column.set_resizable(gtk.TRUE)
#column.set_clickable(gtk.TRUE)
column.set_clickable(gtk.TRUE)
column.set_sort_column_id(1)
column.set_min_width(75)
tree.append_column(column)
column = gtk.TreeViewColumn(_('Birth date'), self.renderer,text=3)
@ -291,7 +293,7 @@ class ChooseParents:
def redrawf(self):
"""Redraws the potential father list"""
self.father_model = PeopleModel.PeopleModel(self.db, self.father_filter)
self.father_model = gtk.TreeModelSort(PeopleModel.PeopleModel(self.db, self.father_filter))
self.father_list.set_model(self.father_model)
if self.type == "Partners":
self.flabel.set_label("<b>%s</b>" % _("Par_ent"))
@ -300,7 +302,7 @@ class ChooseParents:
def redrawm(self):
"""Redraws the potential mother list"""
self.mother_model = PeopleModel.PeopleModel(self.db, self.mother_filter)
self.mother_model = gtk.TreeModelSort(PeopleModel.PeopleModel(self.db, self.mother_filter))
self.mother_list.set_model(self.mother_model)
if self.type == "Partners":
self.mlabel.set_label("<b>%s</b>" % _("Pa_rent"))

View File

@ -62,8 +62,8 @@ class BaseModel(gtk.GenericTreeModel):
def on_row_deleted(self,obj,path):
self.rebuild_data()
def find_path(self,iter):
return self.iter2path.get(iter)
# def find_path(self,iter):
# return self.iter2path.get(iter)
def on_get_flags(self):
'''returns the GtkTreeModelFlags for this particular type of model'''

View File

@ -718,7 +718,7 @@ class FamilyView:
child = self.parent.db.get_person(id)
self.family.remove_child_id(child.get_id())
child.remove_parent_family_id(self.family)
child.remove_parent_family_id(self.family.get_id())
if len(self.family.get_child_id_list()) == 0:
if self.family.get_father_id() == None:

View File

@ -200,7 +200,7 @@ class GrampsParser:
if self.tempDefault != None:
id = self.tempDefault
if self.db.has_person_id(id) and self.db.get_default_person() == None:
self.db.set_default_person(id)
self.db.set_default_person_id(id)
for key in self.func_map.keys():
del self.func_map[key]
@ -550,8 +550,8 @@ class GrampsParser:
if attrs.has_key("cformat"):
d.set_calendar(Calendar.find_calendar(attrs['calendar']))
d.get_start_date().setIsoDate(attrs['start'])
d.get_stop_date().setIsoDate(attrs['stop'])
d.get_start_date().set_iso_date(attrs['start'])
d.get_stop_date().set_iso_date(attrs['stop'])
d.range = 1
def start_dateval(self,attrs):
@ -570,12 +570,12 @@ class GrampsParser:
if attrs.has_key("cformat"):
d.set_calendar(Calendar.find_calendar(attrs['cformat']))
d.get_start_date().setIsoDate(attrs['val'])
d.get_start_date().set_iso_date(attrs['val'])
if attrs.has_key("type"):
d.get_start_date().setMode(attrs['type'])
d.get_start_date().set_mode(attrs['type'])
else:
d.get_start_date().setMode(None)
d.get_start_date().set_mode(None)
def start_datestr(self,attrs):
if self.source_ref:

View File

@ -85,7 +85,7 @@ class MediaView:
self.preview = glade.get_widget("preview")
self.renderer = gtk.CellRendererText()
self.model = DisplayModels.MediaModel(self.db)
self.model = gtk.TreeModelSort(DisplayModels.MediaModel(self.db))
self.selection = self.list.get_selection()
self.list.set_model(self.model)
@ -125,9 +125,9 @@ class MediaView:
column = gtk.TreeViewColumn(_('Title'), self.renderer,text=0)
column.set_resizable(gtk.TRUE)
#column.set_clickable(gtk.TRUE)
column.set_clickable(gtk.TRUE)
column.set_min_width(225)
#column.set_sort_column_id(0)
column.set_sort_column_id(0)
self.list.append_column(column)
self.columns = [column]
@ -140,7 +140,7 @@ class MediaView:
column.set_resizable(gtk.TRUE)
column.set_clickable(gtk.TRUE)
column.set_min_width(75)
column.set_sort_column_id(0)
column.set_sort_column_id(index)
self.columns.append(column)
self.list.append_column(column)
index += 1
@ -160,13 +160,9 @@ class MediaView:
def build_tree(self):
self.list.set_model(None)
self.model = DisplayModels.MediaModel(self.parent.db)
self.model = gtk.TreeModelSort(DisplayModels.MediaModel(self.parent.db))
self.list.set_model(self.model)
self.selection = self.list.get_selection()
#self.selection.connect('changed',self.row_changed)
#self.list.connect('row_activated', self.alpha_event)
#self.model.connect('button-press-event',self.on_plist_button_press)
def on_select_row(self,obj):
fexists = 1

View File

@ -24,6 +24,9 @@ import gtk.glade
import gnome
import gnome.ui
COLUMN_NAME = 0
COLUMN_NAME_SORT = 7
from RelLib import *
class PeopleModel(gtk.GenericTreeModel):
@ -47,6 +50,7 @@ class PeopleModel(gtk.GenericTreeModel):
self.column_birth_place,
self.column_death_day,
self.column_death_place,
self.sort_name,
]
def rebuild_data(self):
@ -68,23 +72,30 @@ class PeopleModel(gtk.GenericTreeModel):
surname = unicode(person.get_primary_name().get_surname())
if self.sname_sub.has_key(surname):
val = len(self.sname_sub[surname])
self.sname_sub[surname].append(person_id)
else:
self.sname_sub[surname] = [person_id]
val = 0
tpl = (surname,val)
self.iter2path[person_id] = tpl
self.path2iter[tpl] = person_id
val = 0
sval = 0
name_list = self.db.get_surnames()
for name in name_list:
if self.sname_sub.has_key(name):
self.top_iter2path[unicode(name)] = (val,)
self.top_path2iter[val] = unicode(name)
val += 1
self.top_iter2path[name] = (sval,)
self.top_path2iter[sval] = name
val = 0
entries = self.sname_sub[name]
entries.sort(self.byname)
for person_id in entries:
tpl = (name,val)
self.iter2path[person_id] = tpl
self.path2iter[tpl] = person_id
val += 1
sval += 1
def byname(self,f,s):
n1 = self.db.person_map.get(str(f))[2].get_sort_name()
n2 = self.db.person_map.get(str(s))[2].get_sort_name()
return cmp(n1,n2)
def on_row_inserted(self,obj,path,iter):
self.rebuild_data()
@ -92,29 +103,16 @@ class PeopleModel(gtk.GenericTreeModel):
def on_row_deleted(self,obj,path):
self.rebuild_data()
def find_path(self,iter):
if self.top_iter2path.has_key(iter):
return self.top_iter2path[iter]
else:
path = self.iter2path.get(iter)
if path:
return (self.top_iter2path[path[0]][0],path[1]);
else:
return None
def on_get_flags(self):
'''returns the GtkTreeModelFlags for this particular type of model'''
#print "on_get_flags"
return 1
def on_get_n_columns(self):
#print "on_get_columns"
return 5
return 8
def on_get_path(self, node):
'''returns the tree path (a tuple of indices at the various
levels) for a particular node.'''
#print "on_get_path"
if self.top_iter2path.has_key(node):
return self.top_iter2path[node]
else:
@ -125,7 +123,6 @@ class PeopleModel(gtk.GenericTreeModel):
return gobject.TYPE_STRING
def on_get_iter(self, path):
#print "on_get_iter"
try:
if len(path)==1:
return self.top_path2iter[path[0]]
@ -136,10 +133,11 @@ class PeopleModel(gtk.GenericTreeModel):
return None
def on_get_value(self,iter,col):
#print "on_get_value", iter, col
if self.top_iter2path.has_key(iter):
if col == 0:
return iter
elif col == COLUMN_NAME_SORT:
return iter.upper()
else:
return u''
else:
@ -147,7 +145,6 @@ class PeopleModel(gtk.GenericTreeModel):
def on_iter_next(self, node):
'''returns the next node at this level of the tree'''
#print "on_iter_next"
if self.top_iter2path.has_key(node):
path = self.top_iter2path[node]
return self.top_path2iter.get(path[0]+1)
@ -157,14 +154,12 @@ class PeopleModel(gtk.GenericTreeModel):
def on_iter_children(self,node):
"""Return the first child of the node"""
#print "on_iter_children"
if node == None:
return self.top_path2iter[0]
return self.path2iter.get((node,0))
def on_iter_has_child(self, node):
'''returns true if this node has children'''
#print "on_iter_has_child"
if node == None:
return len(top_iter2path) > 0
if self.sname_sub.has_key(node) and len(self.sname_sub[node]) > 0:
@ -172,7 +167,6 @@ class PeopleModel(gtk.GenericTreeModel):
return 0
def on_iter_n_children(self,node):
#print "on_iter_n_children",node
if node == None:
return len(self.top_iter2path)
if self.top_iter2path.has_key(node):
@ -180,7 +174,6 @@ class PeopleModel(gtk.GenericTreeModel):
return 0
def on_iter_nth_child(self,node,n):
#print "on_iter_nth_child"
path = self.top_iter2path.get(node)
if path:
return self.path2iter.get((node,n))
@ -189,17 +182,19 @@ class PeopleModel(gtk.GenericTreeModel):
def on_iter_parent(self, node):
'''returns the parent of this node'''
#print "on_iter_parent"
path = self.iter2path.get(node)
if path:
return path[0]
return None
def sort_name(self,data):
return data[2].get_sort_name()
def column_name(self,data):
return unicode(data[2].get_name())
return data[2].get_name()
def column_id(self,data):
return unicode(data[0])
return data[0]
def column_gender(self,data):
return _GENDER[data[1]]

View File

@ -86,7 +86,7 @@ class PeopleView:
column.set_resizable(gtk.TRUE)
column.set_clickable(gtk.TRUE)
column.set_min_width(225)
column.set_sort_column_id(0)
column.set_sort_column_id(PeopleModel.COLUMN_NAME_SORT)
self.person_tree.append_column(column)
self.columns = [column]
@ -99,7 +99,7 @@ class PeopleView:
column.set_resizable(gtk.TRUE)
#column.set_clickable(gtk.TRUE)
column.set_min_width(60)
column.set_sort_column_id(0)
column.set_sort_column_id(index)
self.columns.append(column)
self.person_tree.append_column(column)
index += 1
@ -108,10 +108,10 @@ class PeopleView:
self.person_tree.set_model(None)
self.person_model = PeopleModel.PeopleModel(self.parent.db)
#self.sort_model = gtk.TreeModelSort(self.person_model)
#self.person_tree.set_model(self.sort_model)
self.sort_model = gtk.TreeModelSort(self.person_model)
self.person_tree.set_model(self.sort_model)
self.person_tree.set_model(self.person_model)
#self.person_tree.set_model(self.person_model)
self.person_selection = self.person_tree.get_selection()
self.person_selection.connect('changed',self.row_changed)
@ -119,7 +119,8 @@ class PeopleView:
self.person_tree.connect('button-press-event',self.on_plist_button_press)
def blist(self,store,path,iter,id_list):
id_list.append(self.person_model.get_value(iter,1))
#id_list.append(self.person_model.get_value(iter,1))
id_list.append(self.sort_model.get_value(iter,1))
def get_selected_objects(self):
mlist = []
@ -151,7 +152,7 @@ class PeopleView:
"""Remove the selected person from the list. A person object is expected,
not an ID"""
if old_id == None or person.get_id() == old_id:
path = self.person_model.find_path(person.get_id())
path = self.person_model.on_get_path(person.get_id())
self.person_model.row_deleted(path)
else:
self.person_model.rebuild_data()
@ -194,8 +195,8 @@ class PeopleView:
return
p = self.parent.active_person
id = p.get_id()
path = self.person_model.find_path(id)
top_path = self.person_model.find_path(p.get_primary_name().get_surname())
path = self.person_model.on_get_path(id)
top_path = self.person_model.on_get_path(p.get_primary_name().get_surname())
self.person_tree.expand_row(top_path,0)
self.person_selection.select_path(path)
self.person_tree.scroll_to_cell(path,None,1,0.5,0)

View File

@ -77,7 +77,7 @@ class PlaceView:
self.active = None
self.model = DisplayModels.PlaceModel(self.db)
self.model = gtk.TreeModelSort(DisplayModels.PlaceModel(self.db))
self.list.set_model(self.model)
self.selection = self.list.get_selection()
self.selection.set_mode(gtk.SELECTION_MULTIPLE)
@ -94,9 +94,9 @@ class PlaceView:
column = gtk.TreeViewColumn(_('Place Name'), self.renderer,text=0)
column.set_resizable(gtk.TRUE)
#column.set_clickable(gtk.TRUE)
column.set_clickable(gtk.TRUE)
column.set_min_width(225)
#column.set_sort_column_id(0)
column.set_sort_column_id(0)
self.list.append_column(column)
self.columns = [column]
@ -109,7 +109,7 @@ class PlaceView:
column.set_resizable(gtk.TRUE)
column.set_clickable(gtk.TRUE)
column.set_min_width(75)
column.set_sort_column_id(0)
column.set_sort_column_id(index)
self.columns.append(column)
self.list.append_column(column)
index += 1
@ -123,14 +123,9 @@ class PlaceView:
def build_tree(self):
self.list.set_model(None)
self.model = DisplayModels.PlaceModel(self.parent.db)
self.model = gtk.TreeModelSort(DisplayModels.PlaceModel(self.parent.db))
self.list.set_model(self.model)
self.selection = self.list.get_selection()
#self.selection.connect('changed',self.row_changed)
#self.list.connect('row_activated', self.alpha_event)
#self.model.connect('button-press-event',self.on_plist_button_press)
def load_places(self,id=None):
"""Rebuilds the entire place view. This can be very time consuming

View File

@ -2567,15 +2567,20 @@ class GrampsDB:
self.metadata['default'] = str(person.get_id())
# if person:
# self.default.set_ancestor(1)
def set_default_person_id(self,id):
"""sets the default Person to the passed instance"""
assert(type(id) == types.StringType or type(id) == types.UnicodeType)
self.metadata['default'] = id
def get_default_person(self):
"""returns the default Person of the database"""
if self.metadata:
if self.metadata.has_key('default'):
person = Person()
data = self.person_map.get(self.metadata['default'])
person.unserialize(data)
return person
if self.metadata and self.metadata.has_key('default'):
person = Person()
id = self.metadata['default']
data = self.person_map.get(str(id))
person.unserialize(data)
return person
return None
def get_person(self,id):

View File

@ -44,7 +44,7 @@ import gnome
import RelLib
import const
import Utils
import ListModel
import PeopleModel
import GrampsCfg
from RelLib import Person
@ -62,6 +62,7 @@ class SelectChild:
self.family = family
self.redraw = redraw
self.add_person = add_person
self.renderer = gtk.CellRendererText()
self.xml = gtk.glade.XML(const.gladeFile,"select_child","gramps")
if person:
@ -119,14 +120,29 @@ class SelectChild:
self.frel.set_text(_("Birth"))
titles = [(_('Name'),3,150),(_('ID'),1,50), (_('Birth date'),4,100),
('',-1,0),('',-1,0)]
self.refmodel = ListModel.ListModel(self.add_child,titles)
self.refmodel = PeopleModel.PeopleModel(self.db)
self.add_child.set_model(self.refmodel)
self.redraw_child_list(2)
self.add_itself_to_menu()
self.add_columns(self.add_child)
self.top.show()
def add_columns(self,tree):
column = gtk.TreeViewColumn(_('Name'), self.renderer,text=0)
column.set_resizable(gtk.TRUE)
#column.set_clickable(gtk.TRUE)
column.set_min_width(225)
tree.append_column(column)
column = gtk.TreeViewColumn(_('ID'), self.renderer,text=1)
column.set_resizable(gtk.TRUE)
#column.set_clickable(gtk.TRUE)
column.set_min_width(75)
tree.append_column(column)
column = gtk.TreeViewColumn(_('Birth date'), self.renderer,text=3)
#column.set_resizable(gtk.TRUE)
column.set_clickable(gtk.TRUE)
tree.append_column(column)
def on_delete_event(self,obj,b):
self.remove_itself_from_menu()
@ -153,8 +169,8 @@ class SelectChild:
gnome.help_display('gramps-manual','gramps-edit-quick')
def redraw_child_list(self,filter):
self.refmodel.clear()
self.refmodel.new_model()
return
birth = self.db.find_event_from_id(self.person.get_birth_id())
death = self.db.find_event_from_id(self.person.get_death_id())
if birth:
@ -243,14 +259,22 @@ class SelectChild:
col = self.add_child.get_column(0)
self.add_child.scroll_to_cell(path,col,1,0.5,0.0)
def select_function(self,store,path,iter,id_list):
id_list.append(self.refmodel.get_value(iter,1))
def get_selected_ids(self):
mlist = []
self.add_child.get_selection().selected_foreach(self.select_function,mlist)
return mlist
def on_save_child_clicked(self,obj):
store,iter = self.refmodel.selection.get_selected()
if not iter:
idlist = self.get_selected_ids()
if not idlist or not idlist[0]:
return
id = self.refmodel.model.get_value(iter,1)
id = idlist[0]
select_child = self.db.get_person(id)
if self.family == None:
self.family = self.db.new_family()

View File

@ -42,7 +42,7 @@ import gtk.glade
import RelLib
import const
import Utils
import ListModel
import PeopleModel
#-------------------------------------------------------------------------
#
@ -53,6 +53,7 @@ class SelectPerson:
def __init__(self,db,title,flabel="",filter=None,parent_window=None):
self.renderer = gtk.CellRendererText()
self.db = db
self.filter = filter
gladefile = "%s/choose.glade" % const.rootDir
@ -60,9 +61,7 @@ class SelectPerson:
self.top = self.glade.get_widget('select')
title_label = self.glade.get_widget('title')
self.filter_select = self.glade.get_widget('filter')
self.female = self.glade.get_widget('female')
self.male = self.glade.get_widget('male')
self.unknown = self.glade.get_widget('unknown')
self.plist = self.glade.get_widget('plist')
self.notebook = self.glade.get_widget('notebook')
if filter:
self.use_filter = 1
@ -71,12 +70,7 @@ class SelectPerson:
Utils.set_titles(self.top,title_label,title)
titles = [(_('Name'),3,150),(_('ID'),1,50), (_('Birth date'),4,100),
('',0,0),('',0,0)]
self.fmodel = ListModel.ListModel(self.female,titles)
self.mmodel = ListModel.ListModel(self.male,titles)
self.umodel = ListModel.ListModel(self.unknown,titles)
self.model = PeopleModel.PeopleModel(self.db)
if filter:
self.filter_select.set_label(flabel)
@ -86,7 +80,9 @@ class SelectPerson:
else:
self.filter_select.hide()
self.add_columns(self.plist)
self.redraw()
self.plist.set_model(self.model)
self.top.show()
if parent_window:
@ -95,18 +91,29 @@ class SelectPerson:
def redraw_cb(self,obj):
self.use_filter = self.filter_select.get_active()
self.redraw()
def add_columns(self,tree):
column = gtk.TreeViewColumn(_('Name'), self.renderer,text=0)
column.set_resizable(gtk.TRUE)
column.set_clickable(gtk.TRUE)
column.set_sort_column_id(0)
column.set_min_width(225)
tree.append_column(column)
column = gtk.TreeViewColumn(_('ID'), self.renderer,text=1)
column.set_resizable(gtk.TRUE)
column.set_clickable(gtk.TRUE)
column.set_sort_column_id(1)
column.set_min_width(75)
tree.append_column(column)
column = gtk.TreeViewColumn(_('Birth date'), self.renderer,text=3)
#column.set_resizable(gtk.TRUE)
column.set_clickable(gtk.TRUE)
tree.append_column(column)
def redraw(self):
self.fmodel.clear()
self.fmodel.new_model()
self.mmodel.clear()
self.mmodel.new_model()
self.umodel.clear()
self.umodel.new_model()
return
for key in self.db.sort_person_keys():
person = self.db.get_person(key)
if self.use_filter and not self.filter(person):
@ -114,33 +121,28 @@ class SelectPerson:
data = self.db.get_person_display(key)
gender = person.get_gender()
if gender == RelLib.Person.male:
if gender == RelLib.Person.plist:
self.mmodel.add([data[0],data[1],data[3],data[5],data[6]],key)
elif gender == RelLib.Person.female:
elif gender == RelLib.Person.feplist:
self.fmodel.add([data[0],data[1],data[3],data[5],data[6]],key)
else:
self.umodel.add([data[0],data[1],data[3],data[5],data[6]],key)
self.fmodel.connect_model()
self.mmodel.connect_model()
self.umodel.connect_model()
def select_function(self,store,path,iter,id_list):
id_list.append(self.model.get_value(iter,1))
def get_selected_ids(self):
mlist = []
self.plist.get_selection().selected_foreach(self.select_function,mlist)
return mlist
def run(self):
val = self.top.run()
page = self.notebook.get_current_page()
if val == gtk.RESPONSE_OK:
if page == 0:
lmodel = self.fmodel
elif page == 1:
lmodel = self.mmodel
else:
lmodel = self.umodel
model,iter = lmodel.get_selected()
if iter:
id = lmodel.get_object(iter)
return_value = self.db.get_person(id)
idlist = self.get_selected_ids()
if idlist and idlist[0]:
return_value = self.db.get_person(idlist[0])
else:
return_value = None
self.top.destroy()

View File

@ -73,7 +73,7 @@ class SourceView:
self.renderer = gtk.CellRendererText()
self.model = DisplayModels.SourceModel(self.db)
self.model = gtk.TreeModelSort(DisplayModels.SourceModel(self.db))
self.list.set_model(self.model)
self.topWindow = self.glade.get_widget("gramps")
@ -92,9 +92,9 @@ class SourceView:
column = gtk.TreeViewColumn(_('Title'), self.renderer,text=0)
column.set_resizable(gtk.TRUE)
#column.set_clickable(gtk.TRUE)
column.set_clickable(gtk.TRUE)
column.set_min_width(225)
#column.set_sort_column_id(0)
column.set_sort_column_id(0)
self.list.append_column(column)
self.columns = [column]
@ -107,7 +107,7 @@ class SourceView:
column.set_resizable(gtk.TRUE)
column.set_clickable(gtk.TRUE)
column.set_min_width(75)
column.set_sort_column_id(0)
column.set_sort_column_id(index)
self.columns.append(column)
self.list.append_column(column)
index += 1
@ -125,21 +125,20 @@ class SourceView:
def build_tree(self):
self.list.set_model(None)
self.model = DisplayModels.SourceModel(self.parent.db)
self.model = gtk.TreeModelSort(DisplayModels.SourceModel(self.parent.db))
self.list.set_model(self.model)
self.selection = self.list.get_selection()
#self.selection.connect('changed',self.row_changed)
#self.list.connect('row_activated', self.alpha_event)
#self.model.connect('button-press-event',self.on_plist_button_press)
self.list.connect('button-press-event',self.button_press)
def button_press(self,obj,event):
if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:
store,iter = self.selection.get_selected()
id = store.get_value(iter,1)
source = self.db.get_source(id)
EditSource.EditSource(source,self.db,self.parent,self.topWindow,self.update_display)
EditSource.EditSource(source,self.db,self.parent,
self.topWindow,self.update_display)
return 1
elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
self.build_context_menu(event)
@ -179,7 +178,8 @@ class SourceView:
menu.popup(None,None,None,event.button,event.time)
def on_add_clicked(self,obj):
EditSource.EditSource(RelLib.Source(),self.db,self.parent,self.topWindow,self.new_after_edit)
EditSource.EditSource(RelLib.Source(),self.db,self.parent,
self.topWindow,self.new_after_edit)
def on_delete_clicked(self,obj):
@ -253,7 +253,8 @@ class SourceView:
if iter:
id = list_store.get_value(iter,1)
source = self.db.get_source(id)
EditSource.EditSource(source, self.db, self.parent, self.topWindow, self.update_display)
EditSource.EditSource(source, self.db, self.parent,
self.topWindow, self.update_display)
def new_after_edit(self,source):
self.db.add_source(source)

View File

@ -87,148 +87,23 @@
</child>
<child>
<widget class="GtkNotebook" id="notebook">
<widget class="GtkScrolledWindow" id="scrolledwindow33">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="show_tabs">True</property>
<property name="show_border">True</property>
<property name="tab_pos">GTK_POS_BOTTOM</property>
<property name="scrollable">False</property>
<property name="enable_popup">False</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow32">
<widget class="GtkTreeView" id="plist">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
<widget class="GtkTreeView" id="female">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="headers_visible">True</property>
<property name="rules_hint">True</property>
<property name="reorderable">False</property>
<property name="enable_search">True</property>
</widget>
</child>
<property name="headers_visible">True</property>
<property name="rules_hint">True</property>
<property name="reorderable">False</property>
<property name="enable_search">True</property>
</widget>
<packing>
<property name="tab_expand">False</property>
<property name="tab_fill">True</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label257">
<property name="visible">True</property>
<property name="label" translatable="yes">female</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="type">tab</property>
</packing>
</child>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow33">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
<widget class="GtkTreeView" id="male">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="headers_visible">True</property>
<property name="rules_hint">True</property>
<property name="reorderable">False</property>
<property name="enable_search">True</property>
</widget>
</child>
</widget>
<packing>
<property name="tab_expand">False</property>
<property name="tab_fill">True</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label258">
<property name="visible">True</property>
<property name="label" translatable="yes">male</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="type">tab</property>
</packing>
</child>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow34">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
<widget class="GtkTreeView" id="unknown">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="headers_visible">True</property>
<property name="rules_hint">False</property>
<property name="reorderable">False</property>
<property name="enable_search">True</property>
</widget>
</child>
</widget>
<packing>
<property name="tab_expand">False</property>
<property name="tab_fill">True</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label259">
<property name="visible">True</property>
<property name="label" translatable="yes">unknown</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="type">tab</property>
</packing>
</child>
</widget>
<packing>

View File

@ -51,7 +51,7 @@
<accelerator key="N" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image1800">
<widget class="GtkImage" id="image1865">
<property name="visible">True</property>
<property name="stock">gtk-new</property>
<property name="icon_size">1</property>
@ -73,7 +73,7 @@
<accelerator key="O" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image1801">
<widget class="GtkImage" id="image1866">
<property name="visible">True</property>
<property name="stock">gtk-open</property>
<property name="icon_size">1</property>
@ -107,7 +107,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image1802">
<widget class="GtkImage" id="image1867">
<property name="visible">True</property>
<property name="stock">gtk-convert</property>
<property name="icon_size">1</property>
@ -120,27 +120,6 @@
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="reload_plugins">
<property name="visible">True</property>
<property name="label" translatable="yes">Re_load plugins</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_reload_plugins_activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image1803">
<property name="visible">True</property>
<property name="stock">gtk-refresh</property>
<property name="icon_size">1</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="separator1">
<property name="visible">True</property>
@ -156,7 +135,7 @@
<accelerator key="Q" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image1804">
<widget class="GtkImage" id="image1868">
<property name="visible">True</property>
<property name="stock">gtk-quit</property>
<property name="icon_size">1</property>
@ -192,7 +171,7 @@
<accelerator key="Insert" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image1805">
<widget class="GtkImage" id="image1869">
<property name="visible">True</property>
<property name="stock">gtk-add</property>
<property name="icon_size">1</property>
@ -215,7 +194,7 @@
<accelerator key="Delete" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image1806">
<widget class="GtkImage" id="image1870">
<property name="visible">True</property>
<property name="stock">gtk-remove</property>
<property name="icon_size">1</property>
@ -253,7 +232,7 @@
<accelerator key="F" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image1807">
<widget class="GtkImage" id="image1871">
<property name="visible">True</property>
<property name="stock">gtk-find</property>
<property name="icon_size">1</property>
@ -275,7 +254,7 @@
<accelerator key="M" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image1808">
<widget class="GtkImage" id="image1872">
<property name="visible">True</property>
<property name="stock">gtk-convert</property>
<property name="icon_size">1</property>
@ -302,7 +281,7 @@
<signal name="activate" handler="on_preferences1_activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image1809">
<widget class="GtkImage" id="image1873">
<property name="visible">True</property>
<property name="stock">gtk-preferences</property>
<property name="icon_size">1</property>
@ -316,11 +295,23 @@
</child>
<child>
<widget class="GtkMenuItem" id="column_order">
<widget class="GtkImageMenuItem" id="column_order">
<property name="visible">True</property>
<property name="label" translatable="yes">_Column order</property>
<property name="label" translatable="yes">_Column Editor...</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_column_order_activate" last_modification_time="Wed, 10 Mar 2004 04:36:07 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1874">
<property name="visible">True</property>
<property name="stock">gtk-properties</property>
<property name="icon_size">1</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
</child>
@ -332,7 +323,7 @@
<signal name="activate" handler="on_default_person_activate" last_modification_time="Sat, 16 Aug 2003 01:58:26 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1810">
<widget class="GtkImage" id="image1875">
<property name="visible">True</property>
<property name="stock">gtk-home</property>
<property name="icon_size">1</property>
@ -418,7 +409,7 @@
<accelerator key="D" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image1811">
<widget class="GtkImage" id="image1876">
<property name="visible">True</property>
<property name="stock">gtk-index</property>
<property name="icon_size">1</property>
@ -440,7 +431,7 @@
<accelerator key="B" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image1812">
<widget class="GtkImage" id="image1877">
<property name="visible">True</property>
<property name="stock">gnome-stock-book-open</property>
<property name="icon_size">1</property>
@ -513,7 +504,7 @@
<accelerator key="F1" modifiers="0" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image1813">
<widget class="GtkImage" id="image1878">
<property name="visible">True</property>
<property name="stock">gtk-help</property>
<property name="icon_size">1</property>
@ -534,7 +525,7 @@
<signal name="activate" handler="on_faq_activate" last_modification_time="Wed, 26 Nov 2003 17:59:23 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1814">
<widget class="GtkImage" id="image1879">
<property name="visible">True</property>
<property name="stock">gnome-stock-book-open</property>
<property name="icon_size">1</property>
@ -561,7 +552,7 @@
<signal name="activate" handler="on_gramps_home_page_activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image1815">
<widget class="GtkImage" id="image1880">
<property name="visible">True</property>
<property name="stock">gtk-jump-to</property>
<property name="icon_size">1</property>
@ -582,7 +573,7 @@
<signal name="activate" handler="on_gramps_mailing_lists_activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image1816">
<widget class="GtkImage" id="image1881">
<property name="visible">True</property>
<property name="stock">gnome-stock-mail</property>
<property name="icon_size">1</property>
@ -636,7 +627,7 @@
<signal name="activate" handler="on_about_activate" last_modification_time="Tue, 01 Apr 2003 03:44:24 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1817">
<widget class="GtkImage" id="image1882">
<property name="visible">True</property>
<property name="stock">gnome-stock-about</property>
<property name="icon_size">1</property>
@ -4805,7 +4796,7 @@
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
<property name="default_width">500</property>
<property name="default_width">550</property>
<property name="default_height">400</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>

View File

@ -121,9 +121,6 @@ class Gramps:
"is rarely a wise idea, and can open up potential "
"security risks."))
# This will never contain data - It will be replaced by either
# a GrampsXML
self.history = []
self.mhistory = []
self.hindex = -1
@ -244,9 +241,12 @@ class Gramps:
self.change_active_person, self.load_person
)
self.place_view = PlaceView.PlaceView(self,self.db,self.gtop,self.update_display)
self.source_view = SourceView.SourceView(self,self.db,self.gtop,self.update_display)
self.media_view = MediaView.MediaView(self,self.db,self.gtop,self.update_display)
self.place_view = PlaceView.PlaceView(self,self.db,self.gtop,
self.update_display)
self.source_view = SourceView.SourceView(self,self.db,self.gtop,
self.update_display)
self.media_view = MediaView.MediaView(self,self.db,self.gtop,
self.update_display)
self.add_button = self.gtop.get_widget('addbtn')
self.add_item = self.gtop.get_widget('add_item')
@ -312,7 +312,6 @@ class Gramps:
"on_filter1_activate" : self.on_filter_activate,
"on_places_activate" : self.on_places_activate,
"on_preferences1_activate" : self.on_preferences_activate,
"on_reload_plugins_activate" : Plugins.reload_plugins,
"on_reports_clicked" : self.on_reports_clicked,
"on_revert_activate" : self.on_revert_activate,
"on_show_plugin_status" : self.on_show_plugin_status,
@ -919,7 +918,10 @@ class Gramps:
def full_update(self):
"""Brute force display update, updating all the pages"""
self.update_display(1)
self.place_view.change_db(self.db)
self.people_view.change_db(self.db)
self.source_view.change_db(self.db)
self.media_view.change_db(self.db)
self.toolbar.set_style(GrampsCfg.toolbar)
def update_display(self,changed):
@ -1300,7 +1302,6 @@ class Gramps:
self.people_view.remove_from_history(self.active_person)
self.db.remove_person_id(self.active_person.get_id())
self.people_view.remove_from_person_list(self.active_person)
#self.people_view.person_model.sort_column_changed()
if self.hindex >= 0:
self.active_person = self.db.get_person(self.history[self.hindex])
@ -1535,13 +1536,11 @@ class Gramps:
def update_after_edit(self,epo,change=1):
if epo:
if change:
print "change"
self.people_view.redisplay_person_list(epo.person)
else:
print "no change"
iter = self.people_view.person_model.get_iter((0,))
id = epo.person.get_id()
path = self.people_view.person_model.find_path(id)
path = self.people_view.person_model.on_get_path(id)
self.people_view.person_model.row_changed(path,iter)
self.update_display(0)

View File

@ -465,8 +465,7 @@ class FilterEditor:
t = MyFilters(self.filterdb.get_filters())
elif _name2list.has_key(v1):
data =_name2list[v1]
print data, data.get_values()
t = MySelect(data.get_values(),data)
t = MySelect(data)
elif v == _('Inclusive:'):
t = MyBoolean(_('Include original person'))
else: