diff --git a/gramps2/src/EditPerson.py b/gramps2/src/EditPerson.py index 427749fd0..111873931 100644 --- a/gramps2/src/EditPerson.py +++ b/gramps2/src/EditPerson.py @@ -83,7 +83,7 @@ class EditPerson: self.parent = parent if self.parent.wins_dict.has_key(self.original_id): self.parent.wins_dict[self.original_id].present(None) - return + return self.db = db self.callback = callback self.child_windows = [] @@ -412,14 +412,15 @@ class EditPerson: self.window.show() def close_child_windows(self): - for child_window in self.child_windows: - child_window.close(None) + for child_window in self.child_windows: + child_window.close(None) + self.child_windows = [] def close(self,ok=0): - self.gallery.close(ok) - self.close_child_windows() - self.remove_itself_from_winsmenu() - self.window.destroy() + 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 @@ -427,11 +428,11 @@ class EditPerson: if not win_menu_label.strip(): win_menu_label = _("New Person") self.win_menu_item = gtk.MenuItem(win_menu_label) - self.win_menu_item.set_submenu(gtk.Menu()) + 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 = 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) @@ -439,8 +440,8 @@ class EditPerson: def remove_itself_from_winsmenu(self): del self.parent.wins_dict[self.original_id] self.menu_item.destroy() - self.menu.destroy() - self.win_menu_item.destroy() + self.menu.destroy() + self.win_menu_item.destroy() def present(self,obj): self.window.present() @@ -1749,7 +1750,7 @@ class EditPerson: child_date = sort.build_sort_date(bday) else: continue - if (prev_date <= child_date): # <= allows for twins + if (prev_date <= child_date): # <= allows for twins prev_date = child_date else: inorder = 0 diff --git a/gramps2/src/NameEdit.py b/gramps2/src/NameEdit.py index cee062c09..6f5eb0b59 100644 --- a/gramps2/src/NameEdit.py +++ b/gramps2/src/NameEdit.py @@ -116,56 +116,55 @@ class NameEditor: self.type_field.entry.set_text(_(name.get_type())) self.priv.set_active(name.get_privacy()) if name.get_note(): - self.note_buffer.set_text(name.get_note()) + self.note_buffer.set_text(name.get_note()) Utils.bold_label(self.notes_label) - if name.get_note_format() == 1: + if name.get_note_format() == 1: self.preform.set_active(1) - else: + else: self.flowed.set_active(1) if parent_window: self.window.set_transient_for(parent_window) self.parent.child_windows.append(self) - self.add_itself_to_menu() - self.window.show() + self.add_itself_to_menu() + self.window.show() def on_delete_event(self,obj,b): - self.close_child_windows() - self.parent.child_windows.remove(self) - self.remove_itself_from_menu() + self.close_child_windows() + self.remove_itself_from_menu() def close(self,obj): - self.close_child_windows() - self.parent.child_windows.remove(self) - self.remove_itself_from_menu() - Utils.destroy_passed_object(self.window) + self.close_child_windows() + self.remove_itself_from_menu() + self.window.destroy() def close_child_windows(self): - for child_window in self.child_windows: - child_window.close(None) + for child_window in self.child_windows: + child_window.close(None) + self.child_windows = [] def add_itself_to_menu(self): - if not self.name: - label = _("New Name") - else: - label = self.name.get_name() - if not label.strip(): - label = _("New Name") - label = "%s: %s" % (_('Alternate Name'),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(_('Name Editor')) + if not self.name: + label = _("New Name") + else: + label = self.name.get_name() + if not label.strip(): + label = _("New Name") + label = "%s: %s" % (_('Alternate Name'),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(_('Name 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() + self.menu.destroy() + self.parent_menu_item.destroy() def present(self,obj): self.window.present() @@ -202,7 +201,7 @@ class NameEditor: self.parent.lists_changed = 1 self.callback(self.name) - Utils.destroy_passed_object(obj) + self.close(obj) def update_name(self,first,last,suffix,title,type,note,format,priv): diff --git a/gramps2/src/Sources.py b/gramps2/src/Sources.py index 904264103..9518c5dd4 100644 --- a/gramps2/src/Sources.py +++ b/gramps2/src/Sources.py @@ -247,7 +247,7 @@ class SourceEditor: self.parent = parent self.update = update self.source_ref = srcref - self.child_windows = [] + self.child_windows = [] self.showSource = gtk.glade.XML(const.srcselFile, "sourceDisplay","gramps") self.sourceDisplay = self.get_widget("sourceDisplay") @@ -287,49 +287,49 @@ class SourceEditor: if self.parent: self.sourceDisplay.set_transient_for(self.parent.window) self.parent.parent.child_windows.append(self) - self.add_itself_to_menu() + self.add_itself_to_menu() self.sourceDisplay.show() def on_delete_event(self,obj,b): - self.close_child_windows() + self.close_child_windows() self.parent.parent.child_windows.remove(self) - self.remove_itself_from_menu() + self.remove_itself_from_menu() def close(self,obj): - self.close_child_windows() - self.parent.parent.child_windows.remove(self) - self.remove_itself_from_menu() - Utils.destroy_passed_object(self.sourceDisplay) + self.close_child_windows() + self.remove_itself_from_menu() + Utils.destroy_passed_object(self.sourceDisplay) def close_child_windows(self): - for child_window in self.child_windows: - child_window.close() + for child_window in self.child_windows: + child_window.close() + self.child_windows = [] def add_itself_to_menu(self): if self.active_source: label = self.active_source.get_title() else: label = _("New Source") - if not label.strip(): - label = _("New Source") - label = "%s: %s" % (_('Source Reference'),label) - 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.menu_item = gtk.MenuItem(_('Source Information')) + if not label.strip(): + label = _("New Source") + label = "%s: %s" % (_('Source Reference'),label) + 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.menu_item = gtk.MenuItem(_('Source Information')) 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() + self.menu.destroy() + self.parent_menu_item.destroy() def present(self,obj): - self.window.present() + self.sourceDisplay.present() def on_help_clicked(self,obj): """Display the relevant portion of GRAMPS manual""" @@ -424,7 +424,7 @@ class SourceEditor: self.update(self.parent,self.source_ref) Utils.modified() - self.close() + self.close() def on_source_changed(self,obj): sel = obj.list.get_selection()