2003-03-08 05:49:32 +05:30
|
|
|
#
|
|
|
|
# Gramps - a GTK+/GNOME based genealogy program
|
|
|
|
#
|
2005-03-29 21:35:50 +05:30
|
|
|
# Copyright (C) 2003-2005 Donald N. Allingham
|
2003-03-08 05:49:32 +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$
|
|
|
|
|
2005-03-29 21:35:50 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Python modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
from gettext import gettext as _
|
|
|
|
|
2003-03-08 05:49:32 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# GTK/Gnome modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
import gtk
|
|
|
|
import gtk.glade
|
2004-02-21 12:10:44 +05:30
|
|
|
import gnome
|
2003-03-08 05:49:32 +05:30
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# gramps modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
import const
|
|
|
|
import Utils
|
|
|
|
import RelLib
|
|
|
|
import ListModel
|
2005-01-01 09:57:15 +05:30
|
|
|
import NameDisplay
|
2003-03-08 05:49:32 +05:30
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# WitnessTab
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
class WitnessTab:
|
* 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 __init__(self,srclist,parent,top,window,clist,add_btn,edit_btn,del_btn):
|
2003-03-08 05:49:32 +05:30
|
|
|
self.db = parent.db
|
|
|
|
self.parent = parent
|
|
|
|
self.list = srclist
|
|
|
|
self.top = top
|
* 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 = window
|
2003-03-08 05:49:32 +05:30
|
|
|
self.slist = clist
|
|
|
|
self.selection = clist.get_selection()
|
2005-05-03 09:36:03 +05:30
|
|
|
titles = [
|
|
|
|
(_('Witness'), 0, 300, ListModel.TEXT, None, None),
|
|
|
|
(_('ID'), 1, 100, ListModel.TEXT, None, None)
|
|
|
|
]
|
|
|
|
|
|
|
|
self.model = ListModel.ListModel(
|
|
|
|
clist,titles,event_func=self.edit_clicked);
|
2003-03-08 05:49:32 +05:30
|
|
|
|
|
|
|
add_btn.connect('clicked', self.add_clicked)
|
|
|
|
edit_btn.connect('clicked', self.edit_clicked)
|
|
|
|
del_btn.connect('clicked', self.del_clicked)
|
|
|
|
|
|
|
|
self.redraw()
|
|
|
|
|
|
|
|
def redraw(self):
|
|
|
|
self.model.clear()
|
|
|
|
for s in self.list:
|
|
|
|
if s.get_type() == RelLib.Event.ID:
|
2004-09-01 10:27:44 +05:30
|
|
|
handle = s.get_value()
|
|
|
|
if self.db.has_person_handle(handle):
|
|
|
|
person = self.db.get_person_from_handle(handle)
|
2005-01-01 09:57:15 +05:30
|
|
|
n = NameDisplay.displayer.sorted(person)
|
2004-09-01 10:27:44 +05:30
|
|
|
the_id = person.get_gramps_id()
|
2003-03-08 05:49:32 +05:30
|
|
|
else:
|
|
|
|
n = _('Unknown')
|
2004-09-01 10:27:44 +05:30
|
|
|
the_id = ''
|
|
|
|
self.model.add([n,the_id],s)
|
2003-03-08 05:49:32 +05:30
|
|
|
else:
|
|
|
|
self.model.add([s.get_value(),''],s)
|
2003-11-13 00:15:07 +05:30
|
|
|
if self.list:
|
|
|
|
Utils.bold_label(self.parent.witnesses_label)
|
|
|
|
else:
|
|
|
|
Utils.unbold_label(self.parent.witnesses_label)
|
2003-03-08 05:49:32 +05:30
|
|
|
|
|
|
|
def update_clist(self):
|
|
|
|
self.redraw()
|
|
|
|
self.parent.lists_changed = 1
|
|
|
|
|
|
|
|
def edit_clicked(self,obj):
|
2004-10-06 09:12:54 +05:30
|
|
|
store,node = self.selection.get_selected()
|
|
|
|
if node:
|
2003-03-08 05:49:32 +05:30
|
|
|
objs = self.model.get_selected_objects()
|
|
|
|
src = objs[0]
|
2004-02-21 12:10:44 +05:30
|
|
|
WitnessEditor(src,self.db,self,self.update_clist,self.window)
|
2003-03-08 05:49:32 +05:30
|
|
|
|
|
|
|
def add_clicked(self,obj):
|
2004-02-21 12:10:44 +05:30
|
|
|
WitnessEditor(None,self.db,self,self.update_clist,self.window)
|
2003-03-08 05:49:32 +05:30
|
|
|
|
|
|
|
def add_ref(self,inst,ref):
|
|
|
|
self.parent.lists_changed = 1
|
|
|
|
inst.list.append(ref)
|
|
|
|
inst.redraw()
|
|
|
|
|
|
|
|
def del_clicked(self,obj):
|
2004-10-06 09:12:54 +05:30
|
|
|
(store,node) = self.selection.get_selected()
|
|
|
|
if node:
|
|
|
|
path = store.get_path(node)
|
2003-03-08 05:49:32 +05:30
|
|
|
del self.list[path[0]]
|
|
|
|
self.redraw()
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# WitnessEditor
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
class WitnessEditor:
|
|
|
|
|
2004-02-21 12:10:44 +05:30
|
|
|
def __init__(self,ref,database,parent,update=None,parent_window=None):
|
2003-03-08 05:49:32 +05:30
|
|
|
|
|
|
|
self.db = database
|
|
|
|
self.parent = parent
|
* src/AddrEdit.py, src/AttrEdit.py, src/EditPerson.py,
src/EditSource.py, src/EventEdit.py, src/ImageSelect.py,
src/Marriage.py, src/NameEdit.py, src/NoteEdit.py,
src/Sources.py, src/UrlEdit.py, src/Witness.py:
Register windows opened for existing objects. Prevent editing
same object twice.
svn: r2905
2004-02-24 11:07:06 +05:30
|
|
|
if ref:
|
|
|
|
if self.parent.parent.child_windows.has_key(ref):
|
|
|
|
self.parent.parent.child_windows[ref].present(None)
|
|
|
|
return
|
|
|
|
else:
|
|
|
|
self.win_key = ref
|
|
|
|
else:
|
|
|
|
self.win_key = self
|
2003-03-08 05:49:32 +05:30
|
|
|
self.update = update
|
|
|
|
self.ref = ref
|
2003-08-17 07:44:33 +05:30
|
|
|
self.show_witness = gtk.glade.XML(const.dialogFile, "witness_edit","gramps")
|
2003-03-08 05:49:32 +05:30
|
|
|
self.show_witness.signal_autoconnect({
|
|
|
|
"on_toggled" : self.on_toggled,
|
2004-02-21 12:10:44 +05:30
|
|
|
"on_witness_edit_delete_event" : self.on_delete_event,
|
|
|
|
"on_cancel_witness_clicked" : self.close,
|
|
|
|
"on_help_witness_clicked" : self.on_help_clicked,
|
|
|
|
"on_ok_witness_clicked" : self.ok_clicked,
|
2003-03-08 05:49:32 +05:30
|
|
|
})
|
2003-03-20 05:39:22 +05:30
|
|
|
|
* 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 = self.show_witness.get_widget('witness_edit')
|
2003-03-08 05:49:32 +05:30
|
|
|
self.name = self.show_witness.get_widget("name")
|
2004-11-28 01:18:25 +05:30
|
|
|
self.private = self.show_witness.get_widget("priv")
|
2003-07-03 10:25:16 +05:30
|
|
|
self.select = self.show_witness.get_widget("select")
|
|
|
|
self.select.connect('clicked',self.choose)
|
2003-03-08 05:49:32 +05:30
|
|
|
self.ok = self.show_witness.get_widget("ok")
|
|
|
|
self.in_db = self.show_witness.get_widget("in_db")
|
|
|
|
self.comment = self.show_witness.get_widget("comment")
|
2003-03-20 05:39:22 +05:30
|
|
|
|
2003-03-08 05:49:32 +05:30
|
|
|
if self.ref:
|
2003-03-20 05:39:22 +05:30
|
|
|
if self.ref.get_type():
|
2003-07-03 10:25:16 +05:30
|
|
|
self.idval = self.ref.get_value()
|
2005-03-29 21:35:50 +05:30
|
|
|
if self.db.has_person_handle(self.idval):
|
|
|
|
person = self.db.get_person_from_handle(self.idval)
|
|
|
|
self.name.set_text(person.get_primary_name().get_regular_name())
|
|
|
|
self.in_db.set_active(1)
|
|
|
|
else:
|
|
|
|
self.name.set_text(_("Unknown"))
|
|
|
|
self.in_db.set_active(0)
|
2003-03-20 05:39:22 +05:30
|
|
|
else:
|
|
|
|
self.name.set_text(self.ref.get_value())
|
|
|
|
self.in_db.set_active(0)
|
2003-03-08 05:49:32 +05:30
|
|
|
self.comment.get_buffer().set_text(self.ref.get_comment())
|
2004-11-28 01:18:25 +05:30
|
|
|
self.private.set_active(self.ref.get_privacy())
|
2003-03-08 05:49:32 +05:30
|
|
|
|
2003-03-20 05:39:22 +05:30
|
|
|
self.on_toggled(None)
|
2003-03-08 05:49:32 +05:30
|
|
|
Utils.set_titles(self.show_witness.get_widget('witness_edit'),
|
|
|
|
self.show_witness.get_widget('title'),
|
|
|
|
_('Witness Editor'))
|
|
|
|
|
* 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
|
|
|
if parent_window:
|
|
|
|
self.window.set_transient_for(parent_window)
|
2004-02-21 12:10:44 +05:30
|
|
|
self.add_itself_to_menu()
|
|
|
|
self.window.show()
|
|
|
|
|
|
|
|
def on_delete_event(self,obj,b):
|
|
|
|
self.remove_itself_from_menu()
|
|
|
|
|
|
|
|
def close(self,obj):
|
|
|
|
self.remove_itself_from_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.destroy()
|
|
|
|
|
2004-02-21 12:10:44 +05:30
|
|
|
def add_itself_to_menu(self):
|
* src/AddrEdit.py, src/AttrEdit.py, src/EditPerson.py,
src/EditSource.py, src/EventEdit.py, src/ImageSelect.py,
src/Marriage.py, src/NameEdit.py, src/NoteEdit.py,
src/Sources.py, src/UrlEdit.py, src/Witness.py:
Register windows opened for existing objects. Prevent editing
same object twice.
svn: r2905
2004-02-24 11:07:06 +05:30
|
|
|
self.parent.parent.child_windows[self.win_key] = self
|
2004-02-21 12:10:44 +05:30
|
|
|
self.parent_menu_item = gtk.MenuItem(_('Witness Editor'))
|
|
|
|
self.parent_menu_item.connect("activate",self.present)
|
|
|
|
self.parent_menu_item.show()
|
2004-02-25 08:50:53 +05:30
|
|
|
self.parent.parent.winsmenu.append(self.parent_menu_item)
|
2004-02-21 12:10:44 +05:30
|
|
|
|
|
|
|
def remove_itself_from_menu(self):
|
2004-09-01 10:27:44 +05:30
|
|
|
del self.parent.parent.child_windows[self.win_key]
|
2004-02-21 12:10:44 +05:30
|
|
|
self.parent_menu_item.destroy()
|
|
|
|
|
|
|
|
def present(self,obj):
|
|
|
|
self.window.present()
|
|
|
|
|
|
|
|
def on_help_clicked(self,obj):
|
|
|
|
"""Display the relevant portion of GRAMPS manual"""
|
2005-05-11 19:34:47 +05:30
|
|
|
gnome.help_display('gramps-manual','adv-wit')
|
2004-02-21 12:10:44 +05:30
|
|
|
|
2003-07-03 10:25:16 +05:30
|
|
|
def choose(self,obj):
|
|
|
|
import SelectPerson
|
2004-02-01 06:04:36 +05:30
|
|
|
sel_person = SelectPerson.SelectPerson(self.db,_('Select Person'),parent_window=self.window)
|
2003-07-03 10:25:16 +05:30
|
|
|
new_person = sel_person.run()
|
|
|
|
if new_person:
|
|
|
|
self.new_person = new_person
|
2004-07-28 07:59:07 +05:30
|
|
|
self.idval = new_person.get_handle()
|
2004-02-14 11:10:30 +05:30
|
|
|
new_name = new_person.get_primary_name().get_regular_name()
|
2004-09-01 09:17:10 +05:30
|
|
|
if new_name:
|
|
|
|
self.name.set_text(new_name)
|
2003-03-08 05:49:32 +05:30
|
|
|
|
|
|
|
def on_toggled(self,obj):
|
|
|
|
if self.in_db.get_active():
|
|
|
|
self.name.set_editable(0)
|
2003-03-20 05:39:22 +05:30
|
|
|
self.name.set_sensitive(0)
|
2003-07-03 10:25:16 +05:30
|
|
|
self.select.set_sensitive(1)
|
2003-03-08 05:49:32 +05:30
|
|
|
else:
|
|
|
|
self.name.set_editable(1)
|
2003-03-20 05:39:22 +05:30
|
|
|
self.name.set_sensitive(1)
|
2003-07-03 10:25:16 +05:30
|
|
|
self.select.set_sensitive(0)
|
2003-03-08 05:49:32 +05:30
|
|
|
|
2004-02-21 12:10:44 +05:30
|
|
|
def ok_clicked(self,obj):
|
2003-03-08 05:49:32 +05:30
|
|
|
if not self.ref:
|
|
|
|
if self.in_db.get_active():
|
|
|
|
self.ref = RelLib.Witness(RelLib.Event.ID)
|
|
|
|
else:
|
|
|
|
self.ref = RelLib.Witness(RelLib.Event.NAME)
|
|
|
|
self.parent.list.append(self.ref)
|
|
|
|
|
|
|
|
if self.in_db.get_active():
|
2004-09-01 10:27:44 +05:30
|
|
|
try:
|
|
|
|
self.ref.set_value(self.idval)
|
|
|
|
self.ref.set_type(RelLib.Event.ID)
|
|
|
|
except AttributeError:
|
|
|
|
import QuestionDialog
|
|
|
|
QuestionDialog.ErrorDialog(
|
|
|
|
_("Witness selection error"),
|
|
|
|
_("Since you have indicated that the person is "
|
|
|
|
"in the database, you need to actually select "
|
|
|
|
"the person by pressing the Select button.\n\n"
|
|
|
|
"Please try again. The witness has not been changed."),
|
|
|
|
self.window)
|
2003-03-08 05:49:32 +05:30
|
|
|
else:
|
2003-12-17 10:53:16 +05:30
|
|
|
self.ref.set_value(unicode(self.name.get_text()))
|
2004-02-21 12:10:44 +05:30
|
|
|
self.ref.set_type(RelLib.Event.NAME)
|
2003-03-08 05:49:32 +05:30
|
|
|
|
|
|
|
c = self.comment.get_buffer()
|
2005-02-24 05:55:34 +05:30
|
|
|
self.ref.set_comment(unicode(c.get_text(c.get_start_iter(),c.get_end_iter(),False)))
|
2004-11-28 01:18:25 +05:30
|
|
|
self.ref.set_privacy(self.private.get_active())
|
|
|
|
|
2003-03-08 05:49:32 +05:30
|
|
|
if self.update:
|
|
|
|
self.update()
|
2004-02-21 12:10:44 +05:30
|
|
|
self.close(obj)
|