diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 004a55cc7..a988dc0d3 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,37 @@ +2003-09-14 Alex Roitman + * 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. + 2003-09-14 Don Allingham * src/plugins/TimeLine.py: call doc.init routine to build header * src/FontScale.py: try to handle non-ASCII characters diff --git a/gramps2/src/AddrEdit.py b/gramps2/src/AddrEdit.py index ddb3cce36..0756cda00 100644 --- a/gramps2/src/AddrEdit.py +++ b/gramps2/src/AddrEdit.py @@ -52,7 +52,7 @@ class AddressEditor: """ Displays a dialog that allows the user to edit an address. """ - def __init__(self,parent,addr,callback): + def __init__(self,parent,addr,callback,parent_window=None): """ Displays the dialog box. @@ -108,12 +108,14 @@ class AddressEditor: date_stat = self.top.get_widget("date_stat") self.date_check = DateEdit(self.addr_start,date_stat) - self.top.signal_autoconnect({ - "destroy_passed_object" : Utils.destroy_passed_object, - "on_addr_edit_ok_clicked" : self.ok_clicked, - }) + if parent_window: + self.window.set_transient_for(parent_window) + val = self.window.run() + if val == gtk.RESPONSE_OK: + self.on_name_edit_ok_clicked() + self.window.destroy() - def ok_clicked(self,obj): + def ok_clicked(self): """ Called when the OK button is pressed. Gets data from the form and updates the Address data structure. @@ -135,7 +137,6 @@ class AddressEditor: self.update(date,street,city,state,country,postal,note,priv) self.callback(self.addr) - Utils.destroy_passed_object(obj) def check(self,get,set,data): """Compares a data item, updates if necessary, and sets the diff --git a/gramps2/src/AttrEdit.py b/gramps2/src/AttrEdit.py index 9be39099e..89fecabd5 100644 --- a/gramps2/src/AttrEdit.py +++ b/gramps2/src/AttrEdit.py @@ -54,7 +54,7 @@ class AttributeEditor: """ Displays a dialog that allows the user to edit an attribute. """ - def __init__(self,parent,attrib,title,list,callback): + def __init__(self,parent,attrib,title,list,callback,parent_window=None): """ Displays the dialog box. @@ -106,19 +106,24 @@ class AttributeEditor: self.note_field.get_buffer().set_text(attrib.getNote()) self.top.signal_autoconnect({ - "destroy_passed_object" : Utils.destroy_passed_object, - "on_attr_edit_ok_clicked" : self.on_ok_clicked, "on_add_src_clicked" : self.add_source, "on_del_src_clicked" : self.del_source, }) + if parent_window: + self.window.set_transient_for(parent_window) + val = self.window.run() + if val == gtk.RESPONSE_OK: + self.on_ok_clicked() + self.window.destroy() + def add_source(self,obj): pass def del_source(self,obj): pass - def on_ok_clicked(self,obj): + def on_ok_clicked(self): """ Called when the OK button is pressed. Gets data from the form and updates the Attribute data structure. @@ -137,7 +142,6 @@ class AttributeEditor: self.attrib.setSourceRefList(self.srcreflist) self.update(type,value,note,priv) self.callback(self.attrib) - Utils.destroy_passed_object(obj) def check(self,get,set,data): """Compares a data item, updates if necessary, and sets the diff --git a/gramps2/src/EditPerson.py b/gramps2/src/EditPerson.py index 24906ad41..2a963fa04 100644 --- a/gramps2/src/EditPerson.py +++ b/gramps2/src/EditPerson.py @@ -96,8 +96,11 @@ class EditPerson: self.load_obj = None self.top = gtk.glade.XML(const.editPersonFile, "editPerson","gramps") + self.window = self.get_widget("editPerson") + self.window.set_title("%s - GRAMPS" % _('Edit Person')) + self.icon_list = self.top.get_widget("iconlist") - self.gallery = ImageSelect.Gallery(person, self.path, self.icon_list,self.db,self) + self.gallery = ImageSelect.Gallery(person, self.path, self.icon_list,self.db,self,self.window) self.name_delete_btn = self.top.get_widget('aka_delete') self.name_edit_btn = self.top.get_widget('aka_edit') @@ -110,9 +113,6 @@ class EditPerson: self.addr_delete_btn = self.top.get_widget('addr_delete_btn') self.addr_edit_btn = self.top.get_widget('addr_edit_btn') - self.window = self.get_widget("editPerson") - self.window.set_title("%s - GRAMPS" % _('Edit Person')) - self.notes_field = self.get_widget("personNotes") self.event_name_field = self.get_widget("eventName") self.event_place_field = self.get_widget("eventPlace") @@ -759,25 +759,25 @@ class EditPerson: def on_add_addr_clicked(self,obj): """Invokes the address editor to add a new address""" import AddrEdit - AddrEdit.AddressEditor(self,None,self.addr_edit_callback) + AddrEdit.AddressEditor(self,None,self.addr_edit_callback,self.window) def on_add_aka_clicked(self,obj): """Invokes the name editor to add a new name""" import NameEdit - NameEdit.NameEditor(self,None,self.name_edit_callback) + NameEdit.NameEditor(self,None,self.name_edit_callback,self.window) def on_add_url_clicked(self,obj): """Invokes the url editor to add a new name""" import UrlEdit pname = self.person.getPrimaryName().getName() - UrlEdit.UrlEditor(self,pname,None,self.url_edit_callback) + UrlEdit.UrlEditor(self,pname,None,self.url_edit_callback,self.window) def on_add_attr_clicked(self,obj): """Brings up the AttributeEditor for a new attribute""" import AttrEdit pname = self.person.getPrimaryName().getName() AttrEdit.AttributeEditor(self,None,pname,const.personalAttributes, - self.attr_edit_callback) + self.attr_edit_callback,self.window) def on_up_clicked(self,obj): sel = obj.get_selection() @@ -1059,13 +1059,14 @@ class EditPerson: attr = self.atree.get_object(iter) pname = self.person.getPrimaryName().getName() AttrEdit.AttributeEditor(self,attr,pname,const.personalAttributes, - self.attr_edit_callback) + self.attr_edit_callback,self.window) def on_update_addr_clicked(self,obj): import AddrEdit store,iter = self.ptree.get_selected() if iter: - AddrEdit.AddressEditor(self,self.ptree.get_object(iter),self.addr_edit_callback) + AddrEdit.AddressEditor(self,self.ptree.get_object(iter), + self.addr_edit_callback,self.window) def on_update_url_clicked(self,obj): import UrlEdit @@ -1073,7 +1074,7 @@ class EditPerson: if iter: pname = self.person.getPrimaryName().getName() url = self.wtree.get_object(iter) - UrlEdit.UrlEditor(self,pname,url,self.url_edit_callback) + UrlEdit.UrlEditor(self,pname,url,self.url_edit_callback,self.window) def on_event_update_clicked(self,obj): import EventEdit @@ -1236,7 +1237,7 @@ class EditPerson: import NameEdit store,iter = self.ntree.get_selected() if iter: - NameEdit.NameEditor(self,self.ntree.get_object(iter),self.name_edit_callback) + NameEdit.NameEditor(self,self.ntree.get_object(iter),self.name_edit_callback,self.window) def load_photo(self,photo): """loads, scales, and displays the person's main photo""" @@ -1474,7 +1475,7 @@ class EditPerson: def on_name_note_clicked(self,obj): import NoteEdit - NoteEdit.NoteEditor(self.pname) + NoteEdit.NoteEditor(self.pname,self.window) def on_ldsbap_source_clicked(self,obj): import Sources @@ -1486,7 +1487,7 @@ class EditPerson: def on_ldsbap_note_clicked(self,obj): import NoteEdit - NoteEdit.NoteEditor(self.lds_baptism) + NoteEdit.NoteEditor(self.lds_baptism,self.window) def on_ldsendow_source_clicked(self,obj): import Sources @@ -1498,7 +1499,7 @@ class EditPerson: def on_ldsendow_note_clicked(self,obj): import NoteEdit - NoteEdit.NoteEditor(self.lds_endowment) + NoteEdit.NoteEditor(self.lds_endowment,self.window) def on_ldsseal_source_clicked(self,obj): import Sources @@ -1510,7 +1511,7 @@ class EditPerson: def on_ldsseal_note_clicked(self,obj): import NoteEdit - NoteEdit.NoteEditor(self.lds_sealing) + NoteEdit.NoteEditor(self.lds_sealing,self.window) def load_person_image(self): photo_list = self.person.getPhotoList() diff --git a/gramps2/src/EditSource.py b/gramps2/src/EditSource.py index 6d47ea364..0e68ab660 100644 --- a/gramps2/src/EditSource.py +++ b/gramps2/src/EditSource.py @@ -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 @@ -46,7 +46,7 @@ from gettext import gettext as _ class EditSource: - def __init__(self,source,db,func=None): + def __init__(self,source,db,parent_window=None,func=None): self.source = source self.db = db self.callback = func @@ -61,7 +61,7 @@ class EditSource: _('Source Editor')) plwidget = self.top_window.get_widget("iconlist") - self.gallery = ImageSelect.Gallery(source, self.path, plwidget, db, self) + self.gallery = ImageSelect.Gallery(source, self.path, plwidget, db, self, self.top) self.author = self.top_window.get_widget("author") self.pubinfo = self.top_window.get_widget("pubinfo") self.note = self.top_window.get_widget("source_note") @@ -77,19 +77,25 @@ class EditSource: self.notes_buffer.set_text(source.getNote()) self.top_window.signal_autoconnect({ - "destroy_passed_object" : self.close, "on_switch_page" : self.on_switch_page, "on_addphoto_clicked" : self.gallery.on_add_photo_clicked, "on_deletephoto_clicked" : self.gallery.on_delete_photo_clicked, "on_edit_properties_clicked": self.gallery.popup_change_description, - "on_sourceapply_clicked" : self.on_source_apply_clicked }) - if self.source.getId() == "": self.top_window.get_widget("edit_photo").set_sensitive(0) self.top_window.get_widget("delete_photo").set_sensitive(0) + if parent_window: + self.top.set_transient_for(parent_window) + + self.top.show() + val = self.top.run() + if val == gtk.RESPONSE_OK: + self.on_source_apply_clicked() + self.top.destroy() + def close(self,obj): self.gallery.close() self.top.destroy() @@ -184,7 +190,7 @@ class EditSource: for p in p_list: self.model.add([_("Places"),p,'']) - def on_source_apply_clicked(self,obj): + def on_source_apply_clicked(self): title = self.title.get_text() author = self.author.get_text() @@ -271,6 +277,3 @@ class DelSrcQuery: self.delete_source(self.db.getPlace(key)) self.update(0) - - - diff --git a/gramps2/src/EventEdit.py b/gramps2/src/EventEdit.py index 59a94aa4d..f24a6d195 100644 --- a/gramps2/src/EventEdit.py +++ b/gramps2/src/EventEdit.py @@ -121,7 +121,7 @@ class EventEditor: self.top.get_widget('del_src')) self.witnesstab = Witness.WitnessTab(self.witnesslist,self.parent, - self.top,self.wlist, + self.top,self.window,self.wlist, self.top.get_widget('add_witness'), self.top.get_widget('edit_witness'), self.top.get_widget('del_witness')) @@ -153,10 +153,8 @@ class EventEditor: # self.name_field.select_region(0, -1) self.top.signal_autoconnect({ - "destroy_passed_object" : Utils.destroy_passed_object, "on_add_src_clicked" : self.add_source, "on_del_src_clicked" : self.del_source, - "on_event_edit_ok_clicked" : self.on_event_edit_ok_clicked, }) menu = gtk.Menu() @@ -173,6 +171,12 @@ class EventEditor: index = index + 1 self.calendar.set_menu(menu) + self.window.set_transient_for(self.parent.window) + val = self.window.run() + if val == gtk.RESPONSE_OK: + self.on_event_edit_ok_clicked() + self.window.destroy() + def add_source(self,obj): pass @@ -204,7 +208,7 @@ class EventEditor: else: return None - def on_event_edit_ok_clicked(self,obj): + def on_event_edit_ok_clicked(self): ename = self.name_field.get_text() self.date.set(self.date_field.get_text()) diff --git a/gramps2/src/NameEdit.py b/gramps2/src/NameEdit.py index 83be7c05c..136528dca 100644 --- a/gramps2/src/NameEdit.py +++ b/gramps2/src/NameEdit.py @@ -45,7 +45,7 @@ from gettext import gettext as _ #------------------------------------------------------------------------- class NameEditor: - def __init__(self,parent,name,callback): + def __init__(self,parent,name,callback,parent_window=None): self.parent = parent self.name = name self.callback = callback @@ -100,12 +100,14 @@ class NameEditor: self.priv.set_active(name.getPrivacy()) self.note_buffer.set_text(name.getNote()) - self.top.signal_autoconnect({ - "destroy_passed_object" : Utils.destroy_passed_object, - "on_name_edit_ok_clicked" : self.on_name_edit_ok_clicked, - }) + if parent_window: + self.window.set_transient_for(parent_window) + val = self.window.run() + if val == gtk.RESPONSE_OK: + self.on_name_edit_ok_clicked() + self.window.destroy() - def on_name_edit_ok_clicked(self,obj): + def on_name_edit_ok_clicked(self): first = self.given_field.get_text() last = self.surname_field.get_text() title = self.title_field.get_text() @@ -131,7 +133,6 @@ class NameEditor: self.parent.lists_changed = 1 self.callback(self.name) - Utils.destroy_passed_object(obj) def update_name(self,first,last,suffix,title,type,note,priv): diff --git a/gramps2/src/NoteEdit.py b/gramps2/src/NoteEdit.py index 3785668df..c77c747e9 100644 --- a/gramps2/src/NoteEdit.py +++ b/gramps2/src/NoteEdit.py @@ -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() - diff --git a/gramps2/src/QuestionDialog.py b/gramps2/src/QuestionDialog.py index b2617a8af..8fac811b4 100644 --- a/gramps2/src/QuestionDialog.py +++ b/gramps2/src/QuestionDialog.py @@ -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 @@ -25,7 +25,7 @@ import const from gettext import gettext as _ class SaveDialog: - def __init__(self,msg1,msg2,task1,task2): + def __init__(self,msg1,msg2,task1,task2,parent=None): self.xml = gtk.glade.XML(const.errdialogsFile,"savedialog","gramps") self.top = self.xml.get_widget('savedialog') self.task1 = task1 @@ -40,6 +40,8 @@ class SaveDialog: label2.set_use_markup(gtk.TRUE) self.top.show() + if parent: + self.top.set_transient_for(parent) response = self.top.run() if response == gtk.RESPONSE_NO: self.task1() @@ -48,7 +50,7 @@ class SaveDialog: self.top.destroy() class QuestionDialog: - def __init__(self,msg1,msg2,label,task): + def __init__(self,msg1,msg2,label,task,parent=None): self.xml = gtk.glade.XML(const.errdialogsFile,"questiondialog","gramps") self.top = self.xml.get_widget('questiondialog') self.top.set_title('') @@ -64,13 +66,15 @@ class QuestionDialog: self.xml.get_widget('okbutton').set_label(label) self.top.show() + if parent: + self.top.set_transient_for(parent) response = self.top.run() if response == gtk.RESPONSE_ACCEPT: task() self.top.destroy() class OptionDialog: - def __init__(self,msg1,msg2,btnmsg1,task1,btnmsg2,task2): + def __init__(self,msg1,msg2,btnmsg1,task1,btnmsg2,task2,parent=None): self.xml = gtk.glade.XML(const.errdialogsFile,"optiondialog","gramps") self.top = self.xml.get_widget('optiondialog') self.top.set_title('') @@ -86,6 +90,8 @@ class OptionDialog: self.xml.get_widget('option1').set_label(btnmsg1) self.xml.get_widget('option2').set_label(btnmsg2) self.top.show() + if parent: + self.top.set_transient_for(parent) self.response = self.top.run() if self.response == gtk.RESPONSE_NO: if task1: @@ -99,7 +105,7 @@ class OptionDialog: return self.response class ErrorDialog: - def __init__(self,msg1,msg2=""): + def __init__(self,msg1,msg2="",parent=None): self.xml = gtk.glade.XML(const.errdialogsFile,"errdialog","gramps") self.top = self.xml.get_widget('errdialog') @@ -110,11 +116,13 @@ class ErrorDialog: label1.set_use_markup(gtk.TRUE) label2.set_text(str(msg2)) self.top.show() + if parent: + self.top.set_transient_for(parent) self.top.run() self.top.destroy() class WarningDialog: - def __init__(self,msg1,msg2=""): + def __init__(self,msg1,msg2="",parent=None): self.xml = gtk.glade.XML(const.errdialogsFile,"warndialog","gramps") self.top = self.xml.get_widget('warndialog') @@ -125,11 +133,13 @@ class WarningDialog: label1.set_use_markup(gtk.TRUE) label2.set_text(msg2) self.top.show() + if parent: + self.top.set_transient_for(parent) self.top.run() self.top.destroy() class OkDialog: - def __init__(self,msg1,msg2=""): + def __init__(self,msg1,msg2="",parent=None): self.xml = gtk.glade.XML(const.errdialogsFile,"okdialog","gramps") self.top = self.xml.get_widget('okdialog') @@ -140,11 +150,13 @@ class OkDialog: label1.set_use_markup(gtk.TRUE) label2.set_text(msg2) self.top.show() + if parent: + self.top.set_transient_for(parent) self.top.run() self.top.destroy() class MissingMediaDialog: - def __init__(self,msg1,msg2,task1,task2,task3): + def __init__(self,msg1,msg2,task1,task2,task3,parent=None): self.xml = gtk.glade.XML(const.errdialogsFile,"missmediadialog","gramps") self.top = self.xml.get_widget('missmediadialog') self.task1 = task1 @@ -160,6 +172,8 @@ class MissingMediaDialog: label2.set_use_markup(gtk.TRUE) self.top.show() + if parent: + self.top.set_transient_for(parent) response = self.top.run() if response == 1: self.task1() @@ -168,4 +182,3 @@ class MissingMediaDialog: elif response == 3: self.task3() self.top.destroy() - diff --git a/gramps2/src/SelectPerson.py b/gramps2/src/SelectPerson.py index 49fb0b200..7eab45204 100644 --- a/gramps2/src/SelectPerson.py +++ b/gramps2/src/SelectPerson.py @@ -53,7 +53,7 @@ from RelLib import Person #------------------------------------------------------------------------- class SelectPerson: - def __init__(self,db,title,flabel="",filter=None): + def __init__(self,db,title,flabel="",filter=None,parent_window=None): self.db = db self.filter = filter @@ -91,6 +91,9 @@ class SelectPerson: self.redraw() self.top.show() + if parent_window: + self.top.set_transient_for(parent_window) + def redraw_cb(self,obj): self.use_filter = self.filter_select.get_active() self.redraw() diff --git a/gramps2/src/SourceView.py b/gramps2/src/SourceView.py index d233cfcc8..bc711c5c4 100644 --- a/gramps2/src/SourceView.py +++ b/gramps2/src/SourceView.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2001 Donald N. Allingham +# Copyright (C) 2001-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 @@ -88,6 +88,7 @@ class SourceView: gobject.TYPE_STRING) self.list.set_model(self.model) self.list.get_column(0).clicked() + self.topWindow = self.glade.get_widget("gramps") def change_db(self,db): self.db = db @@ -117,12 +118,12 @@ class SourceView: store,iter = self.selection.get_selected() id = store.get_value(iter,1) source = self.db.getSource(id) - EditSource.EditSource(source,self.db,self.update_display) + EditSource.EditSource(source,self.db,self.topWindow,self.update_display) return 1 return 0 def on_add_clicked(self,obj): - EditSource.EditSource(RelLib.Source(),self.db,self.new_after_edit) + EditSource.EditSource(RelLib.Source(),self.db,self.topWindow,self.new_after_edit) def on_delete_clicked(self,obj): @@ -141,7 +142,7 @@ class SourceView: 'will remove it from the database and from all ' 'records that reference it.'), _('_Delete Source'), - ans.query_response) + ans.query_response,self.topWindow) else: self.db.removeSource(source.getId()) Utils.modified() @@ -191,7 +192,7 @@ class SourceView: if iter: id = list_store.get_value(iter,1) source = self.db.getSource(id) - EditSource.EditSource(source, self.db, self.update_display) + EditSource.EditSource(source, self.db, self.topWindow, self.update_display) def new_after_edit(self,source): self.db.addSource(source) diff --git a/gramps2/src/Sources.py b/gramps2/src/Sources.py index 7df64925a..df19c9c6a 100644 --- a/gramps2/src/Sources.py +++ b/gramps2/src/Sources.py @@ -380,7 +380,7 @@ class SourceEditor: def add_src_clicked(self,obj): import EditSource import RelLib - EditSource.EditSource(RelLib.Source(),self.db, self.update_display) + EditSource.EditSource(RelLib.Source(),self.db, self.sourceDisplay, self.update_display) def by_title(first,second): diff --git a/gramps2/src/UrlEdit.py b/gramps2/src/UrlEdit.py index a62f066ca..2da59a373 100644 --- a/gramps2/src/UrlEdit.py +++ b/gramps2/src/UrlEdit.py @@ -42,7 +42,7 @@ from gettext import gettext as _ #------------------------------------------------------------------------- class UrlEditor: - def __init__(self,parent,name,url,callback): + def __init__(self,parent,name,url,callback,parent_window=None): self.parent = parent self.url = url self.callback = callback @@ -66,12 +66,14 @@ class UrlEditor: self.addr.set_text(url.get_path()) self.priv.set_active(url.getPrivacy()) - self.top.signal_autoconnect({ - "destroy_passed_object" : Utils.destroy_passed_object, - "on_url_edit_ok_clicked" : self.on_url_edit_ok_clicked - }) + if parent_window: + self.window.set_transient_for(parent_window) + val = self.window.run() + if val == gtk.RESPONSE_OK: + self.on_url_edit_ok_clicked() + self.window.destroy() - def on_url_edit_ok_clicked(self,obj): + def on_url_edit_ok_clicked(self): des = self.des.get_text() addr = self.addr.get_text() priv = self.priv.get_active() @@ -82,7 +84,6 @@ class UrlEditor: self.update_url(des,addr,priv) self.callback(self.url) - Utils.destroy_passed_object(obj) def update_url(self,des,addr,priv): if self.url.get_path() != addr: diff --git a/gramps2/src/Witness.py b/gramps2/src/Witness.py index 79012480e..335c05621 100644 --- a/gramps2/src/Witness.py +++ b/gramps2/src/Witness.py @@ -44,11 +44,12 @@ from gettext import gettext as _ # #------------------------------------------------------------------------- class WitnessTab: - def __init__(self,srclist,parent,top,clist,add_btn,edit_btn,del_btn): + def __init__(self,srclist,parent,top,window,clist,add_btn,edit_btn,del_btn): self.db = parent.db self.parent = parent self.list = srclist self.top = top + self.window = window self.slist = clist self.selection = clist.get_selection() titles = [ (_('Witness'),0,300),(_('ID'),1,100)] @@ -85,7 +86,7 @@ class WitnessTab: WitnessEditor(src,self.db,self.update_clist,self) def add_clicked(self,obj): - WitnessEditor(None,self.db,self.update_clist,self) + WitnessEditor(None,self.db,self.update_clist,self,self.window) def add_ref(self,inst,ref): self.parent.lists_changed = 1 @@ -106,7 +107,7 @@ class WitnessTab: #------------------------------------------------------------------------- class WitnessEditor: - def __init__(self,ref,database,update=None,parent=None): + def __init__(self,ref,database,update=None,parent=None,parent_window=None): self.db = database self.parent = parent @@ -114,11 +115,10 @@ class WitnessEditor: self.ref = ref self.show_witness = gtk.glade.XML(const.dialogFile, "witness_edit","gramps") self.show_witness.signal_autoconnect({ - "ok_clicked" : self.ok_clicked, "on_toggled" : self.on_toggled, - "cancel_clicked" : self.cancel_clicked, }) + self.window = self.show_witness.get_widget('witness_edit') self.name = self.show_witness.get_widget("name") self.select = self.show_witness.get_widget("select") self.select.connect('clicked',self.choose) @@ -142,9 +142,16 @@ class WitnessEditor: self.show_witness.get_widget('title'), _('Witness Editor')) + if parent_window: + self.window.set_transient_for(parent_window) + val = self.window.run() + if val == gtk.RESPONSE_OK: + self.ok_clicked() + self.window.destroy() + def choose(self,obj): import SelectPerson - sel_person = SelectPerson.SelectPerson(self.db,'Select Person') + sel_person = SelectPerson.SelectPerson(self.db,'Select Person',parent_window=self.window) new_person = sel_person.run() if new_person: self.new_person = new_person @@ -153,7 +160,6 @@ class WitnessEditor: if new_name: self.name.set_text(new_name) - def on_toggled(self,obj): if self.in_db.get_active(): self.name.set_editable(0) @@ -164,10 +170,7 @@ class WitnessEditor: self.name.set_sensitive(1) self.select.set_sensitive(0) - def cancel_clicked(self,obj): - self.show_witness.get_widget('witness_edit').destroy() - - def ok_clicked(self,obj): + def ok_clicked(self): if not self.ref: if self.in_db.get_active(): self.ref = RelLib.Witness(RelLib.Event.ID) @@ -184,7 +187,3 @@ class WitnessEditor: self.ref.set_comment(c.get_text(c.get_start_iter(),c.get_end_iter(),gtk.FALSE)) if self.update: self.update() - self.cancel_clicked(obj) - - - diff --git a/gramps2/src/dialog.glade b/gramps2/src/dialog.glade index e6015d006..e19976f0f 100644 --- a/gramps2/src/dialog.glade +++ b/gramps2/src/dialog.glade @@ -915,7 +915,7 @@ gtk-cancel True GTK_RELIEF_NORMAL - 0 + -6 @@ -929,7 +929,7 @@ gtk-ok True GTK_RELIEF_NORMAL - 0 + -5 @@ -1421,7 +1421,7 @@ gtk-cancel True GTK_RELIEF_NORMAL - 0 + -6 @@ -1435,7 +1435,7 @@ gtk-ok True GTK_RELIEF_NORMAL - 0 + -5 @@ -1780,7 +1780,7 @@ gtk-cancel True GTK_RELIEF_NORMAL - 0 + -6 @@ -1795,7 +1795,7 @@ gtk-ok True GTK_RELIEF_NORMAL - 0 + -5 @@ -1896,6 +1896,7 @@ 0.5 0 0 + street @@ -2515,7 +2516,7 @@ gtk-cancel True GTK_RELIEF_NORMAL - 0 + -6 @@ -2530,7 +2531,7 @@ gtk-ok True GTK_RELIEF_NORMAL - 0 + -5 @@ -2762,7 +2763,7 @@ gtk-cancel True GTK_RELIEF_NORMAL - 0 + -6 @@ -2777,7 +2778,7 @@ gtk-ok True GTK_RELIEF_NORMAL - 0 + -5 diff --git a/gramps2/src/gramps.glade b/gramps2/src/gramps.glade index d306ba860..8af9a3dbd 100644 --- a/gramps2/src/gramps.glade +++ b/gramps2/src/gramps.glade @@ -5519,8 +5519,7 @@ gtk-cancel True GTK_RELIEF_NORMAL - 0 - + -6 @@ -5534,8 +5533,7 @@ gtk-ok True GTK_RELIEF_NORMAL - 0 - + -5 diff --git a/gramps2/src/imagesel.glade b/gramps2/src/imagesel.glade index 29a2ec566..21007e93c 100644 --- a/gramps2/src/imagesel.glade +++ b/gramps2/src/imagesel.glade @@ -36,7 +36,6 @@ True GTK_RELIEF_NORMAL -6 - @@ -50,7 +49,6 @@ True GTK_RELIEF_NORMAL -5 - @@ -286,7 +284,7 @@ 10 Select an image False - False + True