* 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
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2000 Donald N. Allingham
|
||||
# Copyright (C) 2000-2003 Donald N. Allingham
|
||||
#
|
||||
# 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
|
||||
@@ -40,9 +40,10 @@ from gettext import gettext as _
|
||||
#-------------------------------------------------------------------------
|
||||
class NoteEditor:
|
||||
"""Displays a simple text editor that allows a person to edit a note"""
|
||||
def __init__(self,data):
|
||||
def __init__(self,data,parent_window=None):
|
||||
|
||||
self.data = data
|
||||
self.parent_window = parent_window
|
||||
self.draw()
|
||||
|
||||
def draw(self):
|
||||
@@ -75,13 +76,10 @@ class NoteEditor:
|
||||
self.top.add_button(gtk.STOCK_OK,0)
|
||||
self.top.show_all()
|
||||
|
||||
if self.parent_window:
|
||||
self.top.set_transient_for(self.parent_window)
|
||||
if self.top.run() == 0:
|
||||
self.on_save_note_clicked()
|
||||
else:
|
||||
self.cancel()
|
||||
|
||||
def cancel(self):
|
||||
"""Closes the window without saving the note"""
|
||||
self.top.destroy()
|
||||
|
||||
def on_save_note_clicked(self):
|
||||
@@ -92,5 +90,3 @@ class NoteEditor:
|
||||
if text != self.data.getNote():
|
||||
self.data.setNote(text)
|
||||
Utils.modified()
|
||||
self.top.destroy()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user