2002-10-20 19:55:16 +05:30
|
|
|
#
|
|
|
|
# Gramps - a GTK+/GNOME based genealogy program
|
|
|
|
#
|
2003-09-14 02:12:57 +05:30
|
|
|
# Copyright (C) 2000-2003 Donald N. Allingham
|
2002-10-20 19:55:16 +05:30
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
#
|
|
|
|
|
2003-11-13 00:15:07 +05:30
|
|
|
# $Id$
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
from string import strip
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# GTK/Gnome modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
import gtk
|
|
|
|
import gtk.glade
|
2003-11-18 09:56:06 +05:30
|
|
|
import gnome
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# gramps modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
import Sources
|
2003-02-24 10:21:57 +05:30
|
|
|
import Witness
|
2002-10-20 19:55:16 +05:30
|
|
|
import const
|
|
|
|
import Utils
|
|
|
|
import GrampsCfg
|
|
|
|
import AutoComp
|
2003-01-02 10:01:52 +05:30
|
|
|
import Calendar
|
2003-01-10 10:51:32 +05:30
|
|
|
import RelLib
|
|
|
|
import Date
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
from DateEdit import DateEdit
|
2003-08-17 07:44:33 +05:30
|
|
|
from gettext import gettext as _
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-05-22 09:07:33 +05:30
|
|
|
from QuestionDialog import WarningDialog
|
2002-10-20 19:55:16 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# EventEditor class
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
class EventEditor:
|
|
|
|
|
2003-05-14 02:20:58 +05:30
|
|
|
def __init__(self,parent,name,list,trans,event,def_placename,read_only,cb,
|
|
|
|
def_event=None):
|
2002-10-20 19:55:16 +05:30
|
|
|
self.parent = parent
|
2003-11-13 00:15:07 +05:30
|
|
|
self.db = self.parent.db
|
2002-10-20 19:55:16 +05:30
|
|
|
self.event = event
|
|
|
|
self.trans = trans
|
|
|
|
self.callback = cb
|
|
|
|
self.plist = []
|
|
|
|
self.pmap = {}
|
2003-11-27 23:31:20 +05:30
|
|
|
self.elist = list
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
for key in self.parent.db.get_place_id_keys():
|
|
|
|
p = self.parent.db.get_place_display(key)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.pmap[p[0]] = key
|
|
|
|
|
|
|
|
if event:
|
2004-02-14 11:10:30 +05:30
|
|
|
self.srcreflist = self.event.get_source_references()
|
2003-02-24 10:21:57 +05:30
|
|
|
self.witnesslist = self.event.get_witness_list()
|
|
|
|
if not self.witnesslist:
|
|
|
|
self.witnesslist = []
|
2004-02-14 11:10:30 +05:30
|
|
|
self.date = Date.Date(self.event.get_date_object())
|
|
|
|
transname = const.display_event(event.get_name())
|
2003-11-30 11:17:59 +05:30
|
|
|
# add the name to the list if it is not already there. This tends to occur
|
|
|
|
# in translated languages with the 'Death' event, which is a partial match
|
|
|
|
# to other events
|
|
|
|
if not transname in list:
|
|
|
|
list.append(transname)
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
|
|
|
self.srcreflist = []
|
2003-02-24 10:21:57 +05:30
|
|
|
self.witnesslist = []
|
2003-01-10 10:51:32 +05:30
|
|
|
self.date = Date.Date(None)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-08-17 07:44:33 +05:30
|
|
|
self.top = gtk.glade.XML(const.dialogFile, "event_edit","gramps")
|
2003-03-05 11:31:31 +05:30
|
|
|
|
2003-03-06 11:42:51 +05:30
|
|
|
self.window = self.top.get_widget("event_edit")
|
2003-03-05 11:31:31 +05:30
|
|
|
title_label = self.top.get_widget('title')
|
2003-03-06 11:42:51 +05:30
|
|
|
|
2003-06-03 08:24:56 +05:30
|
|
|
if name == ", ":
|
|
|
|
etitle = _('Event Editor')
|
|
|
|
else:
|
|
|
|
etitle = _('Event Editor for %s') % name
|
|
|
|
|
|
|
|
Utils.set_titles(self.window,title_label, etitle,
|
2003-03-06 11:42:51 +05:30
|
|
|
_('Event Editor'))
|
2003-03-05 11:31:31 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
self.name_field = self.top.get_widget("eventName")
|
|
|
|
self.place_field = self.top.get_widget("eventPlace")
|
|
|
|
self.cause_field = self.top.get_widget("eventCause")
|
|
|
|
self.slist = self.top.get_widget("slist")
|
2003-02-24 10:21:57 +05:30
|
|
|
self.wlist = self.top.get_widget("wlist")
|
2002-10-20 19:55:16 +05:30
|
|
|
self.place_combo = self.top.get_widget("eventPlace_combo")
|
|
|
|
self.date_field = self.top.get_widget("eventDate")
|
|
|
|
self.cause_field = self.top.get_widget("eventCause")
|
|
|
|
self.descr_field = self.top.get_widget("event_description")
|
|
|
|
self.note_field = self.top.get_widget("eventNote")
|
|
|
|
self.event_menu = self.top.get_widget("personalEvents")
|
|
|
|
self.priv = self.top.get_widget("priv")
|
|
|
|
self.calendar = self.top.get_widget("calendar")
|
2003-11-13 00:15:07 +05:30
|
|
|
self.sources_label = self.top.get_widget("sourcesEvent")
|
|
|
|
self.notes_label = self.top.get_widget("notesEvent")
|
2003-12-16 01:30:47 +05:30
|
|
|
self.flowed = self.top.get_widget("eventflowed")
|
|
|
|
self.preform = self.top.get_widget("eventpreform")
|
2003-11-13 00:15:07 +05:30
|
|
|
self.witnesses_label = self.top.get_widget("witnessesEvent")
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
if GrampsCfg.calendar:
|
|
|
|
self.calendar.show()
|
|
|
|
else:
|
|
|
|
self.calendar.hide()
|
|
|
|
|
|
|
|
if read_only:
|
|
|
|
self.event_menu.set_sensitive(0)
|
|
|
|
self.date_field.grab_focus()
|
|
|
|
|
2003-11-13 00:15:07 +05:30
|
|
|
self.sourcetab = Sources.SourceTab(self.srcreflist,self,
|
2003-09-14 02:12:57 +05:30
|
|
|
self.top,self.window,self.slist,
|
2002-10-20 19:55:16 +05:30
|
|
|
self.top.get_widget('add_src'),
|
2003-03-03 10:02:53 +05:30
|
|
|
self.top.get_widget('edit_src'),
|
2002-10-20 19:55:16 +05:30
|
|
|
self.top.get_widget('del_src'))
|
|
|
|
|
2003-11-13 00:15:07 +05:30
|
|
|
self.witnesstab = Witness.WitnessTab(self.witnesslist,self,
|
* src/SourceView.py (button_press,on_add_clicked,on_delete_clicked,
on_edit_clicked): Pass parent window to the child dialog.
* src/Sources.py (add_src_clicked): Likewise.
* src/EditSource.py (__init__): Add optional parent_window argument.
Make dialog modal and transient for its parent.
* src/gramps.glade (sourceEditor dialog): Delete unneeded handlers
for buttons.
* src/QuestionDialog.py (SaveDialog,QuestionDialog,OptionDialog,
ErrorDialog,WarningDialog,MissingMediaDialog): Set transient status
if parent is given.
* src/EventEdit.py (__init__): Make dialog modal and transient for
its parent.
* src/Witness.py: Make WittnessEditor dialog modal and transient for
its parent. Call SelectPerson with itself as a parent.
* src/SelectPerson.py (__init__): Make dialog transient for its parent.
* src/imagesel.glade: Define proper responses and delete unneeded handlers
for buttons. Make gtkFileEntry modal.
* src/dialog.glade (all dialogs): Define proper responses for buttons.
* src/EditPerson.py (on_add_aka_clicked, on_aka_update_clicked):
Call NameEdit with itself as a parent; (on_add_attr_clicked,
on_update_attr_clicked): Call AttributeEditor with itself as a parent;
(on_add_addr_clicked,on_update_addr_clicked): Call AddressEditor with
itself as a parent; (on_add_url_clicked,on_update_url_clicked): Call
UrlEditor with itself as a parent; (on_name_note_clicked,
on_ldsbap_note_clicked,on_ldsendow_note_clicked,
on_ldsseal_note_clicked): Call NoteEditor with itself as a parent.
* src/NameEdit.py (__init__): Make dialog modal and transient for
its parent.
* src/AttrEdit.py (__init__): Likewise.
* src/AddrEdit.py (__init__): Likewise.
* src/UrlEdit.py (__init__): Likewise.
* src/NoteEdit.py (__init__): Likewise.
svn: r2131
2003-09-15 09:41:30 +05:30
|
|
|
self.top,self.window,self.wlist,
|
2003-02-24 10:21:57 +05:30
|
|
|
self.top.get_widget('add_witness'),
|
2003-03-03 10:02:53 +05:30
|
|
|
self.top.get_widget('edit_witness'),
|
2003-02-24 10:21:57 +05:30
|
|
|
self.top.get_widget('del_witness'))
|
|
|
|
|
2003-01-06 10:44:49 +05:30
|
|
|
AutoComp.AutoCombo(self.event_menu,list)
|
2002-10-20 19:55:16 +05:30
|
|
|
AutoComp.AutoEntry(self.place_field,self.pmap.keys())
|
|
|
|
|
|
|
|
if event != None:
|
2003-11-29 09:22:53 +05:30
|
|
|
self.name_field.set_text(transname)
|
2002-10-20 19:55:16 +05:30
|
|
|
if (def_placename):
|
|
|
|
self.place_field.set_text(def_placename)
|
|
|
|
else:
|
2004-02-14 11:10:30 +05:30
|
|
|
self.place_field.set_text(event.get_place_name())
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
self.date_field.set_text(self.date.get_date())
|
|
|
|
self.cause_field.set_text(event.get_cause())
|
|
|
|
self.descr_field.set_text(event.get_description())
|
|
|
|
self.priv.set_active(event.get_privacy())
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
self.note_field.get_buffer().set_text(event.get_note())
|
|
|
|
if event.get_note():
|
|
|
|
self.note_field.get_buffer().set_text(event.get_note())
|
2003-12-16 01:30:47 +05:30
|
|
|
Utils.bold_label(self.notes_label)
|
2004-02-14 11:10:30 +05:30
|
|
|
if event.get_note_format() == 1:
|
2003-12-16 01:30:47 +05:30
|
|
|
self.preform.set_active(1)
|
|
|
|
else:
|
|
|
|
self.flowed.set_active(1)
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2003-05-14 02:20:58 +05:30
|
|
|
if def_event:
|
|
|
|
self.name_field.set_text(def_event)
|
|
|
|
if def_placename:
|
2002-10-20 19:55:16 +05:30
|
|
|
self.place_field.set_text(def_placename)
|
|
|
|
self.date_check = DateEdit(self.date_field,self.top.get_widget("date_stat"))
|
|
|
|
|
|
|
|
self.top.signal_autoconnect({
|
|
|
|
"on_add_src_clicked" : self.add_source,
|
|
|
|
"on_del_src_clicked" : self.del_source,
|
2003-11-13 00:15:07 +05:30
|
|
|
"on_switch_page" : self.on_switch_page,
|
2003-11-18 09:56:06 +05:30
|
|
|
"on_help_event_clicked" : self.on_help_clicked
|
2002-10-20 19:55:16 +05:30
|
|
|
})
|
|
|
|
|
|
|
|
menu = gtk.Menu()
|
2003-01-02 10:01:52 +05:30
|
|
|
index = 0
|
|
|
|
for cobj in Calendar.calendar_names():
|
|
|
|
item = gtk.MenuItem(cobj.TNAME)
|
|
|
|
item.set_data("d",cobj)
|
2002-10-20 19:55:16 +05:30
|
|
|
item.connect("activate",self.on_menu_changed)
|
|
|
|
item.show()
|
|
|
|
menu.append(item)
|
2003-01-02 10:01:52 +05:30
|
|
|
if self.date.get_calendar().NAME == cobj.NAME:
|
|
|
|
menu.set_active(index)
|
|
|
|
self.date_check.set_calendar(cobj())
|
|
|
|
index = index + 1
|
2002-10-20 19:55:16 +05:30
|
|
|
self.calendar.set_menu(menu)
|
|
|
|
|
* src/SourceView.py (button_press,on_add_clicked,on_delete_clicked,
on_edit_clicked): Pass parent window to the child dialog.
* src/Sources.py (add_src_clicked): Likewise.
* src/EditSource.py (__init__): Add optional parent_window argument.
Make dialog modal and transient for its parent.
* src/gramps.glade (sourceEditor dialog): Delete unneeded handlers
for buttons.
* src/QuestionDialog.py (SaveDialog,QuestionDialog,OptionDialog,
ErrorDialog,WarningDialog,MissingMediaDialog): Set transient status
if parent is given.
* src/EventEdit.py (__init__): Make dialog modal and transient for
its parent.
* src/Witness.py: Make WittnessEditor dialog modal and transient for
its parent. Call SelectPerson with itself as a parent.
* src/SelectPerson.py (__init__): Make dialog transient for its parent.
* src/imagesel.glade: Define proper responses and delete unneeded handlers
for buttons. Make gtkFileEntry modal.
* src/dialog.glade (all dialogs): Define proper responses for buttons.
* src/EditPerson.py (on_add_aka_clicked, on_aka_update_clicked):
Call NameEdit with itself as a parent; (on_add_attr_clicked,
on_update_attr_clicked): Call AttributeEditor with itself as a parent;
(on_add_addr_clicked,on_update_addr_clicked): Call AddressEditor with
itself as a parent; (on_add_url_clicked,on_update_url_clicked): Call
UrlEditor with itself as a parent; (on_name_note_clicked,
on_ldsbap_note_clicked,on_ldsendow_note_clicked,
on_ldsseal_note_clicked): Call NoteEditor with itself as a parent.
* src/NameEdit.py (__init__): Make dialog modal and transient for
its parent.
* src/AttrEdit.py (__init__): Likewise.
* src/AddrEdit.py (__init__): Likewise.
* src/UrlEdit.py (__init__): Likewise.
* src/NoteEdit.py (__init__): Likewise.
svn: r2131
2003-09-15 09:41:30 +05:30
|
|
|
self.window.set_transient_for(self.parent.window)
|
2003-11-18 09:56:06 +05:30
|
|
|
self.val = self.window.run()
|
|
|
|
if self.val == gtk.RESPONSE_OK:
|
* src/SourceView.py (button_press,on_add_clicked,on_delete_clicked,
on_edit_clicked): Pass parent window to the child dialog.
* src/Sources.py (add_src_clicked): Likewise.
* src/EditSource.py (__init__): Add optional parent_window argument.
Make dialog modal and transient for its parent.
* src/gramps.glade (sourceEditor dialog): Delete unneeded handlers
for buttons.
* src/QuestionDialog.py (SaveDialog,QuestionDialog,OptionDialog,
ErrorDialog,WarningDialog,MissingMediaDialog): Set transient status
if parent is given.
* src/EventEdit.py (__init__): Make dialog modal and transient for
its parent.
* src/Witness.py: Make WittnessEditor dialog modal and transient for
its parent. Call SelectPerson with itself as a parent.
* src/SelectPerson.py (__init__): Make dialog transient for its parent.
* src/imagesel.glade: Define proper responses and delete unneeded handlers
for buttons. Make gtkFileEntry modal.
* src/dialog.glade (all dialogs): Define proper responses for buttons.
* src/EditPerson.py (on_add_aka_clicked, on_aka_update_clicked):
Call NameEdit with itself as a parent; (on_add_attr_clicked,
on_update_attr_clicked): Call AttributeEditor with itself as a parent;
(on_add_addr_clicked,on_update_addr_clicked): Call AddressEditor with
itself as a parent; (on_add_url_clicked,on_update_url_clicked): Call
UrlEditor with itself as a parent; (on_name_note_clicked,
on_ldsbap_note_clicked,on_ldsendow_note_clicked,
on_ldsseal_note_clicked): Call NoteEditor with itself as a parent.
* src/NameEdit.py (__init__): Make dialog modal and transient for
its parent.
* src/AttrEdit.py (__init__): Likewise.
* src/AddrEdit.py (__init__): Likewise.
* src/UrlEdit.py (__init__): Likewise.
* src/NoteEdit.py (__init__): Likewise.
svn: r2131
2003-09-15 09:41:30 +05:30
|
|
|
self.on_event_edit_ok_clicked()
|
|
|
|
self.window.destroy()
|
|
|
|
|
2003-11-18 09:56:06 +05:30
|
|
|
def on_help_clicked(self,obj):
|
|
|
|
"""Display the relevant portion of GRAMPS manual"""
|
2003-12-02 09:57:23 +05:30
|
|
|
gnome.help_display('gramps-manual','gramps-edit-complete')
|
2003-11-18 09:56:06 +05:30
|
|
|
self.val = self.window.run()
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
def add_source(self,obj):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def del_source(self,obj):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def on_menu_changed(self,obj):
|
2003-01-02 10:01:52 +05:30
|
|
|
cobj = obj.get_data("d")
|
2003-12-17 10:53:16 +05:30
|
|
|
self.date.set(unicode(self.date_field.get_text()))
|
2003-01-02 10:01:52 +05:30
|
|
|
self.date.set_calendar(cobj)
|
2004-02-14 11:10:30 +05:30
|
|
|
self.date_field.set_text(self.date.get_date())
|
2003-01-02 10:01:52 +05:30
|
|
|
self.date_check.set_calendar(cobj())
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def get_place(self,field,makenew=0):
|
2003-12-17 21:36:36 +05:30
|
|
|
text = strip(unicode(field.get_text()))
|
2002-12-30 06:12:47 +05:30
|
|
|
if text:
|
2002-10-20 19:55:16 +05:30
|
|
|
if self.pmap.has_key(text):
|
2004-02-14 11:10:30 +05:30
|
|
|
return self.parent.db.get_place_id_map()[self.pmap[text]]
|
2002-10-20 19:55:16 +05:30
|
|
|
elif makenew:
|
2003-01-10 10:51:32 +05:30
|
|
|
place = RelLib.Place()
|
2002-10-20 19:55:16 +05:30
|
|
|
place.set_title(text)
|
2004-02-14 11:10:30 +05:30
|
|
|
self.parent.db.add_place(place)
|
|
|
|
self.pmap[text] = place.get_id()
|
2002-10-20 19:55:16 +05:30
|
|
|
self.plist.append(place)
|
|
|
|
Utils.modified()
|
|
|
|
return place
|
|
|
|
else:
|
|
|
|
return None
|
|
|
|
else:
|
|
|
|
return None
|
|
|
|
|
* src/SourceView.py (button_press,on_add_clicked,on_delete_clicked,
on_edit_clicked): Pass parent window to the child dialog.
* src/Sources.py (add_src_clicked): Likewise.
* src/EditSource.py (__init__): Add optional parent_window argument.
Make dialog modal and transient for its parent.
* src/gramps.glade (sourceEditor dialog): Delete unneeded handlers
for buttons.
* src/QuestionDialog.py (SaveDialog,QuestionDialog,OptionDialog,
ErrorDialog,WarningDialog,MissingMediaDialog): Set transient status
if parent is given.
* src/EventEdit.py (__init__): Make dialog modal and transient for
its parent.
* src/Witness.py: Make WittnessEditor dialog modal and transient for
its parent. Call SelectPerson with itself as a parent.
* src/SelectPerson.py (__init__): Make dialog transient for its parent.
* src/imagesel.glade: Define proper responses and delete unneeded handlers
for buttons. Make gtkFileEntry modal.
* src/dialog.glade (all dialogs): Define proper responses for buttons.
* src/EditPerson.py (on_add_aka_clicked, on_aka_update_clicked):
Call NameEdit with itself as a parent; (on_add_attr_clicked,
on_update_attr_clicked): Call AttributeEditor with itself as a parent;
(on_add_addr_clicked,on_update_addr_clicked): Call AddressEditor with
itself as a parent; (on_add_url_clicked,on_update_url_clicked): Call
UrlEditor with itself as a parent; (on_name_note_clicked,
on_ldsbap_note_clicked,on_ldsendow_note_clicked,
on_ldsseal_note_clicked): Call NoteEditor with itself as a parent.
* src/NameEdit.py (__init__): Make dialog modal and transient for
its parent.
* src/AttrEdit.py (__init__): Likewise.
* src/AddrEdit.py (__init__): Likewise.
* src/UrlEdit.py (__init__): Likewise.
* src/NoteEdit.py (__init__): Likewise.
svn: r2131
2003-09-15 09:41:30 +05:30
|
|
|
def on_event_edit_ok_clicked(self):
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-12-17 10:53:16 +05:30
|
|
|
ename = unicode(self.name_field.get_text())
|
|
|
|
self.date.set(unicode(self.date_field.get_text()))
|
|
|
|
ecause = unicode(self.cause_field.get_text())
|
2002-10-20 19:55:16 +05:30
|
|
|
eplace_obj = self.get_place(self.place_field,1)
|
|
|
|
buf = self.note_field.get_buffer()
|
|
|
|
|
2003-12-17 21:36:36 +05:30
|
|
|
enote = unicode(buf.get_text(buf.get_start_iter(),buf.get_end_iter(),gtk.FALSE))
|
2003-12-16 01:30:47 +05:30
|
|
|
eformat = self.preform.get_active()
|
2003-12-17 10:53:16 +05:30
|
|
|
edesc = unicode(self.descr_field.get_text())
|
2002-10-20 19:55:16 +05:30
|
|
|
epriv = self.priv.get_active()
|
|
|
|
|
2003-11-27 23:31:20 +05:30
|
|
|
if not ename in self.elist:
|
|
|
|
WarningDialog(_('New event type created'),
|
|
|
|
_('The "%s" event type has been added to this database.\n'
|
|
|
|
'It will now appear in the event menus for this database') % ename)
|
|
|
|
self.elist.append(ename)
|
|
|
|
self.elist.sort()
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
if self.event == None:
|
2003-01-10 10:51:32 +05:30
|
|
|
self.event = RelLib.Event()
|
2004-02-14 11:10:30 +05:30
|
|
|
self.event.set_source_reference_list(self.srcreflist)
|
2003-02-24 10:21:57 +05:30
|
|
|
self.event.set_witness_list(self.witnesslist)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.parent.elist.append(self.event)
|
|
|
|
|
2003-12-16 01:30:47 +05:30
|
|
|
self.update_event(ename,self.date,eplace_obj,edesc,enote,eformat,epriv,ecause)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.parent.redraw_event_list()
|
2003-06-11 08:24:57 +05:30
|
|
|
self.callback(self.event)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-12-16 01:30:47 +05:30
|
|
|
def update_event(self,name,date,place,desc,note,format,priv,cause):
|
2004-02-14 11:10:30 +05:30
|
|
|
if self.event.get_place_id() != place:
|
|
|
|
self.event.set_place_id(place)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.parent.lists_changed = 1
|
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
if self.event.get_name() != self.trans(name):
|
|
|
|
self.event.set_name(self.trans(name))
|
2002-10-20 19:55:16 +05:30
|
|
|
self.parent.lists_changed = 1
|
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
if self.event.get_description() != desc:
|
|
|
|
self.event.set_description(desc)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.parent.lists_changed = 1
|
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
if self.event.get_note() != note:
|
|
|
|
self.event.set_note(note)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.parent.lists_changed = 1
|
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
if self.event.get_note_format() != format:
|
|
|
|
self.event.set_note_format(format)
|
2003-12-16 01:30:47 +05:30
|
|
|
self.parent.lists_changed = 1
|
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
dobj = self.event.get_date_object()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
self.event.set_source_reference_list(self.srcreflist)
|
2003-02-24 10:21:57 +05:30
|
|
|
self.event.set_witness_list(self.witnesslist)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-01-10 10:51:32 +05:30
|
|
|
if Date.compare_dates(dobj,date) != 0:
|
2004-02-14 11:10:30 +05:30
|
|
|
self.event.set_date_object(date)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.parent.lists_changed = 1
|
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
if self.event.get_cause() != cause:
|
|
|
|
self.event.set_cause(cause)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.parent.lists_changed = 1
|
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
if self.event.get_privacy() != priv:
|
|
|
|
self.event.set_privacy(priv)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.parent.lists_changed = 1
|
2003-11-13 00:15:07 +05:30
|
|
|
|
|
|
|
def on_switch_page(self,obj,a,page):
|
|
|
|
buf = self.note_field.get_buffer()
|
2003-12-17 21:36:36 +05:30
|
|
|
text = unicode(buf.get_text(buf.get_start_iter(),buf.get_end_iter(),gtk.FALSE))
|
2003-11-13 00:15:07 +05:30
|
|
|
if text:
|
|
|
|
Utils.bold_label(self.notes_label)
|
|
|
|
else:
|
|
|
|
Utils.unbold_label(self.notes_label)
|