More
svn: r2876
This commit is contained in:
parent
aa9090e2c5
commit
7cdcd1e6a5
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# Gramps - a GTK+/GNOME based genealogy program
|
# Gramps - a GTK+/GNOME based genealogy program
|
||||||
#
|
#
|
||||||
# Copyright (C) 2000-2003 Donald N. Allingham
|
# Copyright (C) 2000-2004 Donald N. Allingham
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@ -85,6 +85,7 @@ class AddressEditor:
|
|||||||
self.db = self.parent.db
|
self.db = self.parent.db
|
||||||
self.addr = addr
|
self.addr = addr
|
||||||
self.callback = callback
|
self.callback = callback
|
||||||
|
self.child_windows = []
|
||||||
name = parent.person.get_primary_name().get_name()
|
name = parent.person.get_primary_name().get_name()
|
||||||
if name == ", ":
|
if name == ", ":
|
||||||
text = _("Address Editor")
|
text = _("Address Editor")
|
||||||
@ -127,22 +128,57 @@ class AddressEditor:
|
|||||||
|
|
||||||
self.top.signal_autoconnect({
|
self.top.signal_autoconnect({
|
||||||
"on_switch_page" : self.on_switch_page,
|
"on_switch_page" : self.on_switch_page,
|
||||||
"on_help_addr_clicked" : self.on_help_clicked
|
"on_help_addr_clicked" : self.on_help_clicked,
|
||||||
|
"on_ok_addr_clicked" : self.ok_clicked,
|
||||||
|
"on_cancel_addr_clicked" : self.close,
|
||||||
|
"on_addr_edit_delete_event" : self.on_delete_event,
|
||||||
})
|
})
|
||||||
|
|
||||||
if parent_window:
|
if parent_window:
|
||||||
self.window.set_transient_for(parent_window)
|
self.window.set_transient_for(parent_window)
|
||||||
self.val = self.window.run()
|
self.parent.child_windows.append(self)
|
||||||
if self.val == gtk.RESPONSE_OK:
|
self.add_itself_to_menu()
|
||||||
self.ok_clicked()
|
self.window.show()
|
||||||
|
|
||||||
|
def on_delete_event(self,obj,b):
|
||||||
|
self.close_child_windows()
|
||||||
|
self.remove_itself_from_menu()
|
||||||
|
|
||||||
|
def close(self,obj):
|
||||||
|
self.close_child_windows()
|
||||||
|
self.remove_itself_from_menu()
|
||||||
self.window.destroy()
|
self.window.destroy()
|
||||||
|
|
||||||
|
def close_child_windows(self):
|
||||||
|
for child_window in self.child_windows:
|
||||||
|
child_window.close(None)
|
||||||
|
self.child_windows = []
|
||||||
|
|
||||||
|
def add_itself_to_menu(self):
|
||||||
|
label = _('Address')
|
||||||
|
self.parent_menu_item = gtk.MenuItem(label)
|
||||||
|
self.parent_menu_item.set_submenu(gtk.Menu())
|
||||||
|
self.parent_menu_item.show()
|
||||||
|
self.parent.menu.append(self.parent_menu_item)
|
||||||
|
self.menu = self.parent_menu_item.get_submenu()
|
||||||
|
self.menu_item = gtk.MenuItem(_('Address Editor'))
|
||||||
|
self.menu_item.connect("activate",self.present)
|
||||||
|
self.menu_item.show()
|
||||||
|
self.menu.append(self.menu_item)
|
||||||
|
|
||||||
|
def remove_itself_from_menu(self):
|
||||||
|
self.menu_item.destroy()
|
||||||
|
self.menu.destroy()
|
||||||
|
self.parent_menu_item.destroy()
|
||||||
|
|
||||||
|
def present(self,obj):
|
||||||
|
self.window.present()
|
||||||
|
|
||||||
def on_help_clicked(self,obj):
|
def on_help_clicked(self,obj):
|
||||||
"""Display the relevant portion of GRAMPS manual"""
|
"""Display the relevant portion of GRAMPS manual"""
|
||||||
gnome.help_display('gramps-manual','gramps-edit-complete')
|
gnome.help_display('gramps-manual','gramps-edit-complete')
|
||||||
self.val = self.window.run()
|
|
||||||
|
|
||||||
def ok_clicked(self):
|
def ok_clicked(self,obj):
|
||||||
"""
|
"""
|
||||||
Called when the OK button is pressed. Gets data from the
|
Called when the OK button is pressed. Gets data from the
|
||||||
form and updates the Address data structure.
|
form and updates the Address data structure.
|
||||||
@ -166,6 +202,7 @@ class AddressEditor:
|
|||||||
|
|
||||||
self.update(date,street,city,state,country,postal,phone,note,format,priv)
|
self.update(date,street,city,state,country,postal,phone,note,format,priv)
|
||||||
self.callback(self.addr)
|
self.callback(self.addr)
|
||||||
|
self.close(obj)
|
||||||
|
|
||||||
def check(self,get,set,data):
|
def check(self,get,set,data):
|
||||||
"""Compares a data item, updates if necessary, and sets the
|
"""Compares a data item, updates if necessary, and sets the
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# Gramps - a GTK+/GNOME based genealogy program
|
# Gramps - a GTK+/GNOME based genealogy program
|
||||||
#
|
#
|
||||||
# Copyright (C) 2000-2003 Donald N. Allingham
|
# Copyright (C) 2000-2004 Donald N. Allingham
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@ -21,8 +21,8 @@
|
|||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
"""
|
"""
|
||||||
The AttrEdit module provides the AddressEditor class. This provides a
|
The AttrEdit module provides the AttributeEditor class. This provides a
|
||||||
mechanism for the user to edit address information.
|
mechanism for the user to edit attribute information.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__author__ = "Donald N. Allingham"
|
__author__ = "Donald N. Allingham"
|
||||||
@ -85,6 +85,7 @@ class AttributeEditor:
|
|||||||
self.flowed = self.top.get_widget("attr_flowed")
|
self.flowed = self.top.get_widget("attr_flowed")
|
||||||
self.preform = self.top.get_widget("attr_preform")
|
self.preform = self.top.get_widget("attr_preform")
|
||||||
self.callback = callback
|
self.callback = callback
|
||||||
|
self.child_windows = []
|
||||||
self.alist = list
|
self.alist = list
|
||||||
|
|
||||||
self.window = self.top.get_widget("attr_edit")
|
self.window = self.top.get_widget("attr_edit")
|
||||||
@ -123,31 +124,64 @@ class AttributeEditor:
|
|||||||
self.flowed.set_active(1)
|
self.flowed.set_active(1)
|
||||||
|
|
||||||
self.top.signal_autoconnect({
|
self.top.signal_autoconnect({
|
||||||
"on_add_src_clicked" : self.add_source,
|
|
||||||
"on_del_src_clicked" : self.del_source,
|
|
||||||
"on_help_attr_clicked" : self.on_help_clicked,
|
"on_help_attr_clicked" : self.on_help_clicked,
|
||||||
|
"on_ok_attr_clicked" : self.on_ok_clicked,
|
||||||
|
"on_cancel_attr_clicked" : self.close,
|
||||||
|
"on_attr_edit_delete_event" : self.on_delete_event,
|
||||||
"on_switch_page" : self.on_switch_page
|
"on_switch_page" : self.on_switch_page
|
||||||
})
|
})
|
||||||
|
|
||||||
if parent_window:
|
if parent_window:
|
||||||
self.window.set_transient_for(parent_window)
|
self.window.set_transient_for(parent_window)
|
||||||
self.val = self.window.run()
|
self.parent.child_windows.append(self)
|
||||||
if self.val == gtk.RESPONSE_OK:
|
self.add_itself_to_menu()
|
||||||
self.on_ok_clicked()
|
self.window.show()
|
||||||
|
|
||||||
|
def on_delete_event(self,obj,b):
|
||||||
|
self.close_child_windows()
|
||||||
|
self.remove_itself_from_menu()
|
||||||
|
|
||||||
|
def close(self,obj):
|
||||||
|
self.close_child_windows()
|
||||||
|
self.remove_itself_from_menu()
|
||||||
self.window.destroy()
|
self.window.destroy()
|
||||||
|
|
||||||
|
def close_child_windows(self):
|
||||||
|
for child_window in self.child_windows:
|
||||||
|
child_window.close(None)
|
||||||
|
self.child_windows = []
|
||||||
|
|
||||||
|
def add_itself_to_menu(self):
|
||||||
|
if not self.attrib:
|
||||||
|
label = _("New Attribute")
|
||||||
|
else:
|
||||||
|
label = self.attrib.get_type()
|
||||||
|
if not label.strip():
|
||||||
|
label = _("New Attribute")
|
||||||
|
label = "%s: %s" % (_('Attribute'),label)
|
||||||
|
self.parent_menu_item = gtk.MenuItem(label)
|
||||||
|
self.parent_menu_item.set_submenu(gtk.Menu())
|
||||||
|
self.parent_menu_item.show()
|
||||||
|
self.parent.menu.append(self.parent_menu_item)
|
||||||
|
self.menu = self.parent_menu_item.get_submenu()
|
||||||
|
self.menu_item = gtk.MenuItem(_('Attribute Editor'))
|
||||||
|
self.menu_item.connect("activate",self.present)
|
||||||
|
self.menu_item.show()
|
||||||
|
self.menu.append(self.menu_item)
|
||||||
|
|
||||||
|
def remove_itself_from_menu(self):
|
||||||
|
self.menu_item.destroy()
|
||||||
|
self.menu.destroy()
|
||||||
|
self.parent_menu_item.destroy()
|
||||||
|
|
||||||
|
def present(self,obj):
|
||||||
|
self.window.present()
|
||||||
|
|
||||||
def on_help_clicked(self,obj):
|
def on_help_clicked(self,obj):
|
||||||
"""Display the relevant portion of GRAMPS manual"""
|
"""Display the relevant portion of GRAMPS manual"""
|
||||||
gnome.help_display('gramps-manual','gramps-edit-complete')
|
gnome.help_display('gramps-manual','gramps-edit-complete')
|
||||||
self.val = self.window.run()
|
|
||||||
|
|
||||||
def add_source(self,obj):
|
def on_ok_clicked(self,obj):
|
||||||
pass
|
|
||||||
|
|
||||||
def del_source(self,obj):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def on_ok_clicked(self):
|
|
||||||
"""
|
"""
|
||||||
Called when the OK button is pressed. Gets data from the
|
Called when the OK button is pressed. Gets data from the
|
||||||
form and updates the Attribute data structure.
|
form and updates the Attribute data structure.
|
||||||
@ -174,6 +208,7 @@ class AttributeEditor:
|
|||||||
self.attrib.set_source_reference_list(self.srcreflist)
|
self.attrib.set_source_reference_list(self.srcreflist)
|
||||||
self.update(type,value,note,format,priv)
|
self.update(type,value,note,format,priv)
|
||||||
self.callback(self.attrib)
|
self.callback(self.attrib)
|
||||||
|
self.close(obj)
|
||||||
|
|
||||||
def check(self,get,set,data):
|
def check(self,get,set,data):
|
||||||
"""Compares a data item, updates if necessary, and sets the
|
"""Compares a data item, updates if necessary, and sets the
|
||||||
|
@ -172,7 +172,6 @@ class NameEditor:
|
|||||||
def on_help_clicked(self,obj):
|
def on_help_clicked(self,obj):
|
||||||
"""Display the relevant portion of GRAMPS manual"""
|
"""Display the relevant portion of GRAMPS manual"""
|
||||||
gnome.help_display('gramps-manual','gramps-edit-complete')
|
gnome.help_display('gramps-manual','gramps-edit-complete')
|
||||||
#self.val = self.window.run()
|
|
||||||
|
|
||||||
def on_name_edit_ok_clicked(self,obj):
|
def on_name_edit_ok_clicked(self,obj):
|
||||||
first = unicode(self.given_field.get_text())
|
first = unicode(self.given_field.get_text())
|
||||||
|
Loading…
Reference in New Issue
Block a user