* src/gramps.glade:

svn: r4756
This commit is contained in:
Don Allingham 2005-06-02 04:44:51 +00:00
parent a624fc2fde
commit ea089b6b25
7 changed files with 47 additions and 54 deletions

View File

@ -4,6 +4,7 @@
* src/ListModel.py: Start event_ref integration * src/ListModel.py: Start event_ref integration
* src/PersonModel.py: Start event_ref integration * src/PersonModel.py: Start event_ref integration
* src/ListBox.py: Start event_ref integration * src/ListBox.py: Start event_ref integration
* src/gramps.glade:
2005-06-01 Alex Roitman <shura@gramps-project.org> 2005-06-01 Alex Roitman <shura@gramps-project.org>
* src/AutoComp.py (StandardCustomSelector): Provide an option to * src/AutoComp.py (StandardCustomSelector): Provide an option to

View File

@ -26,10 +26,9 @@
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import gtk import gtk
import gobject
def fill_combo(combo,data_list): def fill_combo(combo,data_list):
store = gtk.ListStore(gobject.TYPE_STRING) store = gtk.ListStore(str)
for data in data_list: for data in data_list:
store.append(row=[data]) store.append(row=[data])
@ -43,7 +42,7 @@ def fill_combo(combo,data_list):
combo.child.set_completion(completion) combo.child.set_completion(completion)
def fill_entry(entry,data_list): def fill_entry(entry,data_list):
store = gtk.ListStore(gobject.TYPE_STRING) store = gtk.ListStore(str)
for data in data_list: for data in data_list:
store.append(row=[data]) store.append(row=[data])
@ -121,7 +120,7 @@ class StandardCustomSelector:
self.active_index = 0 self.active_index = 0
# make model # make model
self.store = gtk.ListStore(gobject.TYPE_INT,gobject.TYPE_STRING) self.store = gtk.ListStore(int,str)
# fill it up using mapping # fill it up using mapping
self.fill() self.fill()

View File

@ -853,9 +853,7 @@ class EditPerson:
self.person.set_birth_ref(None) self.person.set_birth_ref(None)
self.person.set_death_ref(None) self.person.set_death_ref(None)
eref_list = self.event_box.data[:] eref_list = self.event_box.data[:]
print eref_list
for (event_ref,event) in eref_list: for (event_ref,event) in eref_list:
print event.handle
if event.get_type()[0] == RelLib.Event.BIRTH: if event.get_type()[0] == RelLib.Event.BIRTH:
self.person.set_birth_ref(event_ref) self.person.set_birth_ref(event_ref)
self.event_box.data.remove(event_ref) self.event_box.data.remove(event_ref)

View File

@ -82,25 +82,12 @@ class EventEditor:
self.dp = DateHandler.parser self.dp = DateHandler.parser
self.dd = DateHandler.displayer self.dd = DateHandler.displayer
# values = {}
# for v in elist:
# values[v] = 1
# for vv in self.db.get_person_event_type_list():
# v = _(vv)
# values[v] = 1
#
# self.elist = values.keys()
# self.elist.sort()
for key in self.parent.db.get_place_handles(): for key in self.parent.db.get_place_handles():
title = self.parent.db.get_place_from_handle(key).get_title() title = self.parent.db.get_place_from_handle(key).get_title()
self.pmap[title] = key self.pmap[title] = key
if event: if event:
self.srcreflist = self.event.get_source_references() self.srcreflist = self.event.get_source_references()
self.witnesslist = self.event.get_witness_list()
if not self.witnesslist:
self.witnesslist = []
self.date = Date.Date(self.event.get_date_object()) self.date = Date.Date(self.event.get_date_object())
# add the name to the list if it is not already there. This # add the name to the list if it is not already there. This
# tends to occur in translated languages with the 'Death' # tends to occur in translated languages with the 'Death'
@ -109,7 +96,6 @@ class EventEditor:
# elist.append(transname) # elist.append(transname)
else: else:
self.srcreflist = [] self.srcreflist = []
self.witnesslist = []
self.date = Date.Date(None) self.date = Date.Date(None)
self.top = gtk.glade.XML(const.dialogFile, "event_edit","gramps") self.top = gtk.glade.XML(const.dialogFile, "event_edit","gramps")
@ -174,19 +160,24 @@ class EventEditor:
del_witness = self.top.get_widget('del_witness') del_witness = self.top.get_widget('del_witness')
del_witness.set_sensitive(not noedit) del_witness.set_sensitive(not noedit)
self.witnesstab = Witness.WitnessTab( # self.witnesstab = Witness.WitnessTab(
self.witnesslist, self, self.top, self.window, self.wlist, # self.witnesslist, self, self.top, self.window, self.wlist,
add_witness, edit_witness, del_witness) # add_witness, edit_witness, del_witness)
#AutoComp.fill_combo(self.event_menu,self.elist) #AutoComp.fill_combo(self.event_menu,self.elist)
if event:
defval = event.get_type()[0]
else:
defval = None
self.eventmapper = AutoComp.StandardCustomSelector( self.eventmapper = AutoComp.StandardCustomSelector(
Utils.personal_events, self.event_menu, RelLib.Event.CUSTOM) Utils.personal_events, self.event_menu, RelLib.Event.CUSTOM, defval)
AutoComp.fill_entry(self.place_field,self.pmap.keys()) AutoComp.fill_entry(self.place_field,self.pmap.keys())
if event != None: if event != None:
self.event_menu.child.set_text(transname) # self.event_menu.child.set_text(transname)
if (def_placename): if def_placename:
self.place_field.set_text(def_placename) self.place_field.set_text(def_placename)
else: else:
place_handle = event.get_place_handle() place_handle = event.get_place_handle()
@ -275,7 +266,11 @@ class EventEditor:
if not self.event: if not self.event:
label = _("New Event") label = _("New Event")
else: else:
label = self.event.get_name() (val,strval) = self.event.get_type()
if val == RelLib.Event.CUSTOM:
label = strval
else:
label = Utils.personal_events[val]
if not label.strip(): if not label.strip():
label = _("New Event") label = _("New Event")
label = "%s: %s" % (_('Event'),label) label = "%s: %s" % (_('Event'),label)
@ -347,7 +342,6 @@ class EventEditor:
self.event = RelLib.Event() self.event = RelLib.Event()
self.event.set_handle(Utils.create_id()) self.event.set_handle(Utils.create_id())
self.event.set_source_reference_list(self.srcreflist) self.event.set_source_reference_list(self.srcreflist)
#self.event.set_witness_list(self.witnesslist)
self.event.set_type(event_data) self.event.set_type(event_data)
just_added = True just_added = True
@ -359,8 +353,6 @@ class EventEditor:
self.callback(self.event) self.callback(self.event)
def update_event(self,the_type,date,place,desc,note,format,priv,cause): def update_event(self,the_type,date,place,desc,note,format,priv,cause):
print self.event
if place: if place:
if self.event.get_place_handle() != place.get_handle(): if self.event.get_place_handle() != place.get_handle():
self.event.set_place_handle(place.get_handle()) self.event.set_place_handle(place.get_handle())
@ -389,7 +381,6 @@ class EventEditor:
dobj = self.event.get_date_object() dobj = self.event.get_date_object()
self.event.set_source_reference_list(self.srcreflist) self.event.set_source_reference_list(self.srcreflist)
#self.event.set_witness_list(self.witnesslist)
if not dobj.is_equal(date): if not dobj.is_equal(date):
self.event.set_date_object(date) self.event.set_date_object(date)

View File

@ -82,8 +82,6 @@ class ListBox:
return list(self.change_list) return list(self.change_list)
def add_object(self,item): def add_object(self,item):
import traceback
traceback.print_stack()
self.data.append(item) self.data.append(item)
self.change_list.add(item) self.change_list.add(item)
@ -253,7 +251,6 @@ class EventListBox(ReorderListBox):
if death_ref: if death_ref:
self.data.append((death_ref, self.data.append((death_ref,
parent.db.get_event_from_handle(death_ref.ref))) parent.db.get_event_from_handle(death_ref.ref)))
self
for event_ref in person.get_event_ref_list(): for event_ref in person.get_event_ref_list():
self.data.append((event_ref, self.data.append((event_ref,
parent.db.get_event_from_handle(event_ref.ref))) parent.db.get_event_from_handle(event_ref.ref)))
@ -303,11 +300,10 @@ class EventListBox(ReorderListBox):
event = self.list_model.get_object(node) event = self.list_model.get_object(node)
EventEdit.EventEditor( EventEdit.EventEditor(
self.parent, self.name, Utils.personal_events, self.parent, self.name, Utils.personal_events,
event, None, False, event[1], None, False,
self.edit_callback, noedit=self.db.readonly) self.edit_callback, noedit=self.db.readonly)
def display_data(self,event_tuple): def display_data(self,event_tuple):
print event_tuple
(event_ref, event) = event_tuple (event_ref, event) = event_tuple
pid = event.get_place_handle() pid = event.get_place_handle()
if pid: if pid:
@ -338,11 +334,16 @@ class EventListBox(ReorderListBox):
def edit_callback(self,data): def edit_callback(self,data):
self.changed = True self.changed = True
ref = RelLib.EventRef() changed = False
ref.ref = data for val in self.data:
new_data = (ref,data) if data.handle == val[1].handle:
self.change_list.add(new_data) self.change_list.add(val)
if new_data not in self.data: changed = True
if not changed:
ref = RelLib.EventRef()
ref.ref = data.handle
new_data = (ref,data)
self.change_list.add(new_data)
self.data.append(new_data) self.data.append(new_data)
self.redraw() self.redraw()
try: try:

View File

@ -42,7 +42,7 @@ class ListModel:
self.mylist = [] self.mylist = []
self.data_index = 0 self.data_index = 0
for l in dlist: for l in dlist:
if l[2] == TOGGLE: if l[3] == TOGGLE:
self.mylist.append(TYPE_BOOLEAN) self.mylist.append(TYPE_BOOLEAN)
else: else:
self.mylist.append(TYPE_STRING) self.mylist.append(TYPE_STRING)

View File

@ -302,10 +302,9 @@ class PeopleModel(gtk.GenericTreeModel):
return cgi.escape(birth.get_date()) return cgi.escape(birth.get_date())
for event_ref in data[_EVENT_COL]: for event_ref in data[_EVENT_COL]:
print event_ref, event_ref.ref
event = self.db.get_event_from_handle(event_ref.ref) event = self.db.get_event_from_handle(event_ref.ref)
print "Event",event etype = event.get_type()[0]
if (event.get_type() in [RelLib.Event.BAPTISM, RelLib.Event.CHRISTEN] if (etype in [Event.BAPTISM, Event.CHRISTEN]
and event.get_date() != ""): and event.get_date() != ""):
return "<i>" + cgi.escape(event.get_date()) + "</i>" return "<i>" + cgi.escape(event.get_date()) + "</i>"
@ -317,9 +316,11 @@ class PeopleModel(gtk.GenericTreeModel):
if death.get_date() and death.get_date() != "": if death.get_date() and death.get_date() != "":
return cgi.escape(death.get_date()) return cgi.escape(death.get_date())
for event_handle in data[_EVENT_COL].ref: for event_ref in data[_EVENT_COL]:
event = self.db.get_event_from_handle(event_handle) event = self.db.get_event_from_handle(event_ref.ref)
if event.name in ["Burial", "Cremation"] and event.get_date() != "": etype = event.get_type()[0]
if (etype in [Event.BURIAL, Event.CREMATION]
and event.get_date() != ""):
return "<i>" + cgi.escape(event.get_date()) + "</i>" return "<i>" + cgi.escape(event.get_date()) + "</i>"
return u"" return u""
@ -340,9 +341,10 @@ class PeopleModel(gtk.GenericTreeModel):
if place_title != "": if place_title != "":
return cgi.escape(place_title) return cgi.escape(place_title)
for event_handle in data[_EVENT_COL].ref: for event_ref in data[_EVENT_COL]:
event = self.db.get_event_from_handle(event_handle) etype = event.get_type()[0]
if event.name in ["Baptism", "Christening"]: if etype in [Event.BAPTISM, Event.CHRISTEN]:
event = self.db.get_event_from_handle(event_ref.ref)
place_handle = event.get_place_handle() place_handle = event.get_place_handle()
if place_handle: if place_handle:
place_title = self.db.get_place_from_handle(place_handle).get_title() place_title = self.db.get_place_from_handle(place_handle).get_title()
@ -361,9 +363,10 @@ class PeopleModel(gtk.GenericTreeModel):
if place_title != "": if place_title != "":
return cgi.escape(place_title) return cgi.escape(place_title)
for event_handle in data[_EVENT_COL].ref: for event_ref in data[_EVENT_COL]:
event = self.db.get_event_from_handle(event_handle) etype = event.get_type()[0]
if event.name in ["Burial", "Cremation"]: if etype in [Event.BURIAL, Event.CREMATION]:
event = self.db.get_event_from_handle(event_ref.ref)
place_handle = event.get_place_handle() place_handle = event.get_place_handle()
if place_handle: if place_handle:
place_title = self.db.get_place_from_handle(place_handle).get_title() place_title = self.db.get_place_from_handle(place_handle).get_title()