diff --git a/src/AddrEdit.py b/src/AddrEdit.py index 732cd7e43..5323524a2 100644 --- a/src/AddrEdit.py +++ b/src/AddrEdit.py @@ -168,17 +168,17 @@ class AddressEditor: 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.parent.winsmenu.append(self.parent_menu_item) + self.winsmenu = 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) + self.winsmenu.append(self.menu_item) def remove_itself_from_menu(self): del self.parent.child_windows[self.win_key] self.menu_item.destroy() - self.menu.destroy() + self.winsmenu.destroy() self.parent_menu_item.destroy() def present(self,obj): diff --git a/src/AttrEdit.py b/src/AttrEdit.py index 0935d7e57..861f0a7c9 100644 --- a/src/AttrEdit.py +++ b/src/AttrEdit.py @@ -171,17 +171,17 @@ class AttributeEditor: 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.parent.winsmenu.append(self.parent_menu_item) + self.winsmenu = 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) + self.winsmenu.append(self.menu_item) def remove_itself_from_menu(self): del self.parent.child_windows[self.win_key] self.menu_item.destroy() - self.menu.destroy() + self.winsmenu.destroy() self.parent_menu_item.destroy() def present(self,obj): diff --git a/src/ChooseParents.py b/src/ChooseParents.py index 32011306e..42aa37777 100644 --- a/src/ChooseParents.py +++ b/src/ChooseParents.py @@ -78,6 +78,7 @@ class ChooseParents: """ self.parent = parent self.db = db + self.child_windows = {} self.person = person self.family = family self.family_update = family_update @@ -102,9 +103,9 @@ class ChooseParents: self.glade = gtk.glade.XML(const.gladeFile,"familyDialog","gramps") self.top = self.glade.get_widget("familyDialog") - text = _("Choose the Parents of %s") % GrampsCfg.nameof(self.person) + self.title_text = _("Choose the Parents of %s") % GrampsCfg.nameof(self.person) Utils.set_titles(self.top,self.glade.get_widget('title'), - text,_('Choose Parents')) + self.title_text,_('Choose Parents')) self.mother_rel = self.glade.get_widget("mrel") self.father_rel = self.glade.get_widget("frel") @@ -149,14 +150,52 @@ class ChooseParents: "on_prel_changed" : self.parent_relation_changed, "on_showallf_toggled" : self.showallf_toggled, "on_showallm_toggled" : self.showallm_toggled, - "destroy_passed_object" : Utils.destroy_passed_object, + "destroy_passed_object" : self.close, "on_help_familyDialog_clicked" : self.on_help_clicked, + "on_familyDialog_delete_event" : self.on_delete_event, }) + self.add_itself_to_menu() + self.top.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.top.destroy() + + def close_child_windows(self): + for child_window in self.child_windows.values(): + child_window.close(None) + self.child_windows = {} + + def add_itself_to_menu(self): + self.parent.child_windows[self] = self + self.win_menu_item = gtk.MenuItem(self.title_text) + self.win_menu_item.set_submenu(gtk.Menu()) + self.win_menu_item.show() + self.parent.winsmenu.append(self.win_menu_item) + self.winsmenu = self.win_menu_item.get_submenu() + self.menu_item = gtk.MenuItem(_('Choose Parents')) + self.menu_item.connect("activate",self.present) + self.menu_item.show() + self.winsmenu.append(self.menu_item) + + def remove_itself_from_menu(self): + del self.parent.child_windows[self] + self.menu_item.destroy() + self.winsmenu.destroy() + self.win_menu_item.destroy() + + def present(self,obj): + self.top.present() + def on_help_clicked(self,obj): """Display the relevant portion of GRAMPS manual""" gnome.help_display('gramps-manual','gramps-edit-quick') - self.val = self.top.run() def redrawf(self): """Redraws the potential father list""" @@ -460,11 +499,11 @@ class ChooseParents: else: self.family = None - Utils.destroy_passed_object(obj) if self.family: self.family.set_relationship(self.type) self.change_family_type(self.family,mother_rel,father_rel) self.family_update(None) + self.close(obj) def add_new_parent(self,epo): """Adds a new person to either the father list or the mother list, @@ -502,7 +541,7 @@ class ChooseParents: try: import EditPerson - EditPerson.EditPerson(self.parent, person,self.db,self.add_new_parent) + EditPerson.EditPerson(self, person,self.db,self.add_new_parent) except: import DisplayTrace DisplayTrace.DisplayTrace() diff --git a/src/EditPerson.py b/src/EditPerson.py index eb4575517..ed194f320 100644 --- a/src/EditPerson.py +++ b/src/EditPerson.py @@ -81,8 +81,8 @@ class EditPerson: self.person = person 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) + if self.parent.child_windows.has_key(self.original_id): + self.parent.child_windows[self.original_id].present(None) return self.db = db self.callback = callback @@ -423,7 +423,7 @@ class EditPerson: self.window.destroy() def add_itself_to_winsmenu(self): - self.parent.wins_dict[self.original_id] = self + self.parent.child_windows[self.original_id] = self win_menu_label = GrampsCfg.nameof(self.person) if not win_menu_label.strip(): win_menu_label = _("New Person") @@ -431,16 +431,16 @@ class EditPerson: 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.winsmenu = 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.menu.append(self.menu_item) + self.winsmenu.append(self.menu_item) def remove_itself_from_winsmenu(self): - del self.parent.wins_dict[self.original_id] + del self.parent.child_windows[self.original_id] self.menu_item.destroy() - self.menu.destroy() + self.winsmenu.destroy() self.win_menu_item.destroy() def present(self,obj): @@ -1475,7 +1475,7 @@ class EditPerson: if self.orig_birth == None: self.db.add_event(self.birth) - self.person.set_birth_id(self.birth_id) + self.person.set_birth_id(self.birth.get_id()) elif not self.orig_birth.are_equal(self.birth): self.db.commit_event(self.birth) diff --git a/src/EditSource.py b/src/EditSource.py index 4444f60a2..a52c963df 100644 --- a/src/EditSource.py +++ b/src/EditSource.py @@ -164,17 +164,17 @@ class EditSource: 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.parent.winsmenu.append(self.parent_menu_item) + self.winsmenu = self.parent_menu_item.get_submenu() self.menu_item = gtk.MenuItem(_('Source Editor')) self.menu_item.connect("activate",self.present) self.menu_item.show() - self.menu.append(self.menu_item) + self.winsmenu.append(self.menu_item) def remove_itself_from_menu(self): del self.parent.child_windows[self.win_key] self.menu_item.destroy() - self.menu.destroy() + self.winsmenu.destroy() self.parent_menu_item.destroy() def present(self,obj): diff --git a/src/EventEdit.py b/src/EventEdit.py index e2173adb7..8ccecddfc 100644 --- a/src/EventEdit.py +++ b/src/EventEdit.py @@ -238,17 +238,17 @@ class EventEditor: 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.parent.winsmenu.append(self.parent_menu_item) + self.winsmenu = self.parent_menu_item.get_submenu() self.menu_item = gtk.MenuItem(_('Event Editor')) self.menu_item.connect("activate",self.present) self.menu_item.show() - self.menu.append(self.menu_item) + self.winsmenu.append(self.menu_item) def remove_itself_from_menu(self): del self.parent.child_windows[self.win_key] self.menu_item.destroy() - self.menu.destroy() + self.winsmenu.destroy() self.parent_menu_item.destroy() def present(self,obj): diff --git a/src/ImageSelect.py b/src/ImageSelect.py index 339d311fb..2829dc79b 100644 --- a/src/ImageSelect.py +++ b/src/ImageSelect.py @@ -772,17 +772,17 @@ class LocalMediaProperties: self.parent_menu_item = gtk.MenuItem(label) self.parent_menu_item.set_submenu(gtk.Menu()) self.parent_menu_item.show() - self.parent.parent.menu.append(self.parent_menu_item) - self.menu = self.parent_menu_item.get_submenu() + self.parent.parent.winsmenu.append(self.parent_menu_item) + self.winsmenu = self.parent_menu_item.get_submenu() self.menu_item = gtk.MenuItem(_('Reference Editor')) self.menu_item.connect("activate",self.present) self.menu_item.show() - self.menu.append(self.menu_item) + self.winsmenu.append(self.menu_item) def remove_itself_from_menu(self): del self.parent.parent.child_windows[self.win_key] self.menu_item.destroy() - self.menu.destroy() + self.winsmenu.destroy() self.parent_menu_item.destroy() def present(self,obj): diff --git a/src/Marriage.py b/src/Marriage.py index a8d19746f..dc103da6c 100644 --- a/src/Marriage.py +++ b/src/Marriage.py @@ -73,8 +73,8 @@ class Marriage: """Initializes the Marriage class, and displays the window""" self.family = family self.parent = parent - if self.parent.wins_dict.has_key(family.get_id()): - self.parent.wins_dict[family.get_id()].present(None) + if self.parent.child_windows.has_key(family.get_id()): + self.parent.child_windows[family.get_id()].present(None) return self.child_windows = {} self.db = db @@ -271,7 +271,7 @@ class Marriage: self.window.destroy() def add_itself_to_winsmenu(self): - self.parent.wins_dict[self.family.get_id()] = self + self.parent.child_windows[self.family.get_id()] = self win_menu_label = self.title if not win_menu_label.strip(): win_menu_label = _("New Relationship") @@ -279,16 +279,16 @@ class Marriage: 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.winsmenu = self.win_menu_item.get_submenu() self.menu_item = gtk.MenuItem(_('Marriage/Relationship Editor')) self.menu_item.connect("activate",self.present) self.menu_item.show() - self.menu.append(self.menu_item) + self.winsmenu.append(self.menu_item) def remove_itself_from_winsmenu(self): - del self.parent.wins_dict[self.family.get_id()] + del self.parent.child_windows[self.family.get_id()] self.menu_item.destroy() - self.menu.destroy() + self.winsmenu.destroy() self.win_menu_item.destroy() def present(self,obj): diff --git a/src/NameEdit.py b/src/NameEdit.py index e9fa31c6d..99f51b380 100644 --- a/src/NameEdit.py +++ b/src/NameEdit.py @@ -162,17 +162,17 @@ class NameEditor: 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.parent.winsmenu.append(self.parent_menu_item) + self.winsmenu = self.parent_menu_item.get_submenu() self.menu_item = gtk.MenuItem(_('Name Editor')) self.menu_item.connect("activate",self.present) self.menu_item.show() - self.menu.append(self.menu_item) + self.winsmenu.append(self.menu_item) def remove_itself_from_menu(self): del self.parent.child_windows[self.win_key] self.menu_item.destroy() - self.menu.destroy() + self.winsmenu.destroy() self.parent_menu_item.destroy() def present(self,obj): diff --git a/src/NoteEdit.py b/src/NoteEdit.py index e74101fa1..63bd1deb8 100644 --- a/src/NoteEdit.py +++ b/src/NoteEdit.py @@ -107,7 +107,7 @@ class NoteEditor: self.parent_menu_item = gtk.MenuItem(_('Note')) self.parent_menu_item.connect("activate",self.present) self.parent_menu_item.show() - self.parent.menu.append(self.parent_menu_item) + self.parent.winsmenu.append(self.parent_menu_item) def remove_itself_from_menu(self): del self.parent.child_windows[self.win_key] diff --git a/src/Sources.py b/src/Sources.py index 63dbf736a..95989a1b3 100644 --- a/src/Sources.py +++ b/src/Sources.py @@ -129,17 +129,17 @@ class SourceSelector: 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.parent.winsmenu.append(self.parent_menu_item) + self.winsmenu = self.parent_menu_item.get_submenu() self.menu_item = gtk.MenuItem(_('Reference Selector')) self.menu_item.connect("activate",self.present) self.menu_item.show() - self.menu.append(self.menu_item) + self.winsmenu.append(self.menu_item) def remove_itself_from_menu(self): del self.parent.child_windows[self.win_key] self.menu_item.destroy() - self.menu.destroy() + self.winsmenu.destroy() self.parent_menu_item.destroy() def present(self,obj): @@ -371,17 +371,17 @@ class SourceEditor: self.parent_menu_item = gtk.MenuItem(label) self.parent_menu_item.set_submenu(gtk.Menu()) self.parent_menu_item.show() - self.win_parent.menu.append(self.parent_menu_item) - self.menu = self.parent_menu_item.get_submenu() + self.win_parent.winsmenu.append(self.parent_menu_item) + self.winsmenu = self.parent_menu_item.get_submenu() self.menu_item = gtk.MenuItem(_('Source Information')) self.menu_item.connect("activate",self.present) self.menu_item.show() - self.menu.append(self.menu_item) + self.winsmenu.append(self.menu_item) def remove_itself_from_menu(self): del self.win_parent.child_windows[self.win_key] self.menu_item.destroy() - self.menu.destroy() + self.winsmenu.destroy() self.parent_menu_item.destroy() def present(self,obj): diff --git a/src/UrlEdit.py b/src/UrlEdit.py index 2eac05b79..6122a29f6 100644 --- a/src/UrlEdit.py +++ b/src/UrlEdit.py @@ -102,7 +102,7 @@ class UrlEditor: self.parent_menu_item = gtk.MenuItem(label) self.parent_menu_item.connect("activate",self.present) self.parent_menu_item.show() - self.parent.menu.append(self.parent_menu_item) + self.parent.winsmenu.append(self.parent_menu_item) def remove_itself_from_menu(self): self.parent.child_windows[self.win_key] diff --git a/src/Witness.py b/src/Witness.py index adc2449a4..f9ab525af 100644 --- a/src/Witness.py +++ b/src/Witness.py @@ -178,7 +178,7 @@ class WitnessEditor: self.parent_menu_item = gtk.MenuItem(_('Witness Editor')) self.parent_menu_item.connect("activate",self.present) self.parent_menu_item.show() - self.parent.parent.menu.append(self.parent_menu_item) + self.parent.parent.winsmenu.append(self.parent_menu_item) def remove_itself_from_menu(self): self.parent.parent.child_windows[self.win_key] diff --git a/src/gramps.glade b/src/gramps.glade index 52e31c37a..64df27bad 100644 --- a/src/gramps.glade +++ b/src/gramps.glade @@ -4008,6 +4008,7 @@ False gramps.png False + diff --git a/src/gramps_main.py b/src/gramps_main.py index 47ccbd487..a70b30aad 100755 --- a/src/gramps_main.py +++ b/src/gramps_main.py @@ -267,7 +267,7 @@ class Gramps: self.wins = self.gtop.get_widget("windows1") self.wins.set_submenu(gtk.Menu()) self.winsmenu = self.wins.get_submenu() - self.wins_dict = {} + self.child_windows = {} self.gtop.signal_autoconnect({ "on_back_clicked" : self.back_clicked,