Update
svn: r2871
This commit is contained in:
parent
83130e1889
commit
ea5a7b5cbb
@ -5,6 +5,7 @@
|
||||
* src/gramps.glade: Add Windows menu.
|
||||
* src/gramps_main.py: Get Windows menu and its submenu.
|
||||
Pass Gramps class to the children -- first-class object editors.
|
||||
* src/dialog.glade: Add handler.
|
||||
|
||||
2004-02-16 Alex Roitman <shura@alex.neuro.umn.edu>
|
||||
* src/Relationship.py: Factor out relationship distance computation.
|
||||
|
@ -82,6 +82,7 @@ class EditPerson:
|
||||
self.original_id = person.get_id()
|
||||
self.parent = parent
|
||||
if self.parent.wins_dict.has_key(self.original_id):
|
||||
self.parent.wins_dict[self.original_id].present(None)
|
||||
return
|
||||
self.db = db
|
||||
self.callback = callback
|
||||
@ -410,19 +411,36 @@ class EditPerson:
|
||||
self.add_itself_to_winsmenu()
|
||||
self.window.show()
|
||||
|
||||
def close_child_windows(self):
|
||||
for child_window in self.child_windows:
|
||||
child_window.close(None)
|
||||
|
||||
def close(self,ok=0):
|
||||
self.gallery.close(ok)
|
||||
self.close_child_windows()
|
||||
self.remove_itself_from_winsmenu()
|
||||
self.window.destroy()
|
||||
|
||||
def add_itself_to_winsmenu(self):
|
||||
self.parent.wins_dict[self.original_id] = self.window
|
||||
label = GrampsCfg.nameof(self.person)
|
||||
if not label.strip():
|
||||
label = _("NewPerson %(gramps_id)s") % { 'gramps_id' : self.original_id }
|
||||
self.menu_item = gtk.MenuItem(label)
|
||||
self.parent.wins_dict[self.original_id] = self
|
||||
win_menu_label = GrampsCfg.nameof(self.person)
|
||||
if not win_menu_label.strip():
|
||||
win_menu_label = _("NewPerson")
|
||||
self.win_menu_item = gtk.MenuItem(win_menu_label)
|
||||
self.win_menu_item.set_submenu(gtk.Menu())
|
||||
self.win_menu_item.show()
|
||||
self.parent.winsmenu.append(self.win_menu_item)
|
||||
self.menu = self.win_menu_item.get_submenu()
|
||||
self.menu_item = gtk.MenuItem(_('Edit Person'))
|
||||
self.menu_item.connect("activate",self.present)
|
||||
self.menu_item.show()
|
||||
self.parent.winsmenu.append(self.menu_item)
|
||||
self.menu.append(self.menu_item)
|
||||
|
||||
def remove_itself_from_winsmenu(self):
|
||||
self.parent.wins_dict.pop(self.original_id,None)
|
||||
self.menu_item.destroy()
|
||||
self.menu.destroy()
|
||||
self.win_menu_item.destroy()
|
||||
|
||||
def present(self,obj):
|
||||
self.window.present()
|
||||
@ -995,9 +1013,7 @@ class EditPerson:
|
||||
self.cancel_callback,
|
||||
self.save)
|
||||
else:
|
||||
self.gallery.close(0)
|
||||
self.remove_itself_from_winsmenu()
|
||||
self.window.destroy()
|
||||
self.close(0)
|
||||
|
||||
def save(self):
|
||||
self.on_apply_person_clicked(None)
|
||||
@ -1014,16 +1030,12 @@ class EditPerson:
|
||||
self.save)
|
||||
return 1
|
||||
else:
|
||||
self.gallery.close(0)
|
||||
self.remove_itself_from_winsmenu()
|
||||
self.window.destroy()
|
||||
self.close(0)
|
||||
return 0
|
||||
|
||||
def cancel_callback(self):
|
||||
"""If the user answered yes to abandoning changes, close the window"""
|
||||
self.gallery.close(0)
|
||||
self.remove_itself_from_winsmenu()
|
||||
self.window.destroy()
|
||||
self.close(0)
|
||||
|
||||
def did_data_change(self):
|
||||
"""Check to see if any of the data has changed from the
|
||||
@ -1582,9 +1594,7 @@ class EditPerson:
|
||||
if self.callback:
|
||||
self.callback(self)
|
||||
|
||||
self.gallery.close(1)
|
||||
self.remove_itself_from_winsmenu()
|
||||
self.window.destroy()
|
||||
self.close(1)
|
||||
|
||||
def get_place(self,field,makenew=0):
|
||||
text = unicode(string.strip(field.get_text()))
|
||||
|
@ -53,6 +53,7 @@ class NameEditor:
|
||||
self.db = self.parent.db
|
||||
self.name = name
|
||||
self.callback = callback
|
||||
self.child_windows = []
|
||||
self.top = gtk.glade.XML(const.dialogFile, "name_edit","gramps")
|
||||
self.window = self.top.get_widget("name_edit")
|
||||
self.given_field = self.top.get_widget("alt_given")
|
||||
@ -102,7 +103,8 @@ class NameEditor:
|
||||
self.top.signal_autoconnect({
|
||||
"on_help_name_clicked" : self.on_help_clicked,
|
||||
"on_name_edit_ok_clicked" : self.on_name_edit_ok_clicked,
|
||||
"destroy_passed_object" : Utils.destroy_passed_object,
|
||||
"on_name_edit_cancel_clicked" : self.close,
|
||||
"on_name_edit_delete_event" : self.on_delete_event,
|
||||
"on_switch_page" : self.on_switch_page
|
||||
})
|
||||
|
||||
@ -123,11 +125,34 @@ class NameEditor:
|
||||
|
||||
if parent_window:
|
||||
self.window.set_transient_for(parent_window)
|
||||
#self.val = self.window.run()
|
||||
self.parent.child_windows.append(self)
|
||||
self.add_itself_to_menu()
|
||||
self.window.show()
|
||||
#if self.val == gtk.RESPONSE_OK:
|
||||
# self.on_name_edit_ok_clicked()
|
||||
#self.window.destroy()
|
||||
|
||||
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()
|
||||
Utils.destroy_passed_object(self.window)
|
||||
|
||||
def close_child_windows(self):
|
||||
for child_window in self.child_windows:
|
||||
child_window.close()
|
||||
|
||||
def add_itself_to_menu(self):
|
||||
self.menu_item = gtk.MenuItem(_('Name Editor'))
|
||||
self.menu_item.connect("activate",self.present)
|
||||
self.menu_item.show()
|
||||
self.parent.menu.append(self.menu_item)
|
||||
|
||||
def remove_itself_from_menu(self):
|
||||
self.menu_item.destroy()
|
||||
|
||||
def present(self,obj):
|
||||
self.window.present()
|
||||
|
||||
def on_help_clicked(self,obj):
|
||||
"""Display the relevant portion of GRAMPS manual"""
|
||||
|
@ -3241,6 +3241,7 @@
|
||||
<property name="destroy_with_parent">False</property>
|
||||
<property name="icon">gramps.png</property>
|
||||
<property name="has_separator">True</property>
|
||||
<signal name="delete_event" handler="on_name_edit_delete_event" last_modification_time="Thu, 19 Feb 2004 18:07:08 GMT"/>
|
||||
|
||||
<child internal-child="vbox">
|
||||
<widget class="GtkVBox" id="vbox32">
|
||||
@ -3263,7 +3264,7 @@
|
||||
<property name="use_stock">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="response_id">-6</property>
|
||||
<signal name="clicked" handler="destroy_passed_object" object="name_edit"/>
|
||||
<signal name="clicked" handler="on_name_edit_cancel_clicked" last_modification_time="Thu, 19 Feb 2004 18:07:59 GMT"/>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user