* src/srcsel.glade: Define proper responses for OK and Cancel buttons

in both SourceSelector and SourceEditor windows.
* src/Sources.py: Make both SourceSelector and SourceEditor modal and
transients for their parent window. Add SourceTab window argument to
SourceTab to pass to the SourceEditor.
* src/AddrEdit.py: Pass window widget to the SourceTab.
* src/AttrEdit.py: Likewise.
* src/EditPlace.py: Likewise.
* src/EventEdit.py: Likewise.
* src/NameEdit.py: Likewise.
* src/Marriage.py: Rename top_window to self.window.


svn: r2123
This commit is contained in:
Alex Roitman 2003-09-13 20:42:57 +00:00
parent 9c868b08b5
commit eaae22c536
9 changed files with 47 additions and 32 deletions

View File

@ -1,6 +1,17 @@
2003-09-13 Alex Roitman <shura@alex.neuro.umn.edu>
* src/plugins/AncestorChart.py (AncestorChart.__init__): Call calc()
after self.standalone is defined.
* src/srcsel.glade: Define proper responses for OK and Cancel buttons
in both SourceSelector and SourceEditor windows.
* src/Sources.py: Make both SourceSelector and SourceEditor modal and
transients for their parent window. Add SourceTab window argument to
SourceTab to pass to the SourceEditor.
* src/AddrEdit.py: Pass window widget to the SourceTab.
* src/AttrEdit.py: Likewise.
* src/EditPlace.py: Likewise.
* src/EventEdit.py: Likewise.
* src/NameEdit.py: Likewise.
* src/Marriage.py: Rename top_window to self.window.
2003-09-12 Don Allingham <dallingham@users.sourceforge.net>
* src/BaseDoc.py: add init function to BaseDoc to be called after

View File

@ -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
@ -100,7 +100,7 @@ class AddressEditor:
self.srcreflist = []
self.sourcetab = Sources.SourceTab(self.srcreflist,self.parent,
self.top, self.slist,
self.top, self.window, self.slist,
self.top.get_widget('add_src'),
self.top.get_widget('edit_src'),
self.top.get_widget('del_src'))

View File

@ -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
@ -84,7 +84,7 @@ class AttributeEditor:
self.srcreflist = []
self.sourcetab = Sources.SourceTab(self.srcreflist,self.parent,self.top,
self.slist,
self.window, self.slist,
self.top.get_widget('add_src'),
self.top.get_widget('edit_src'),
self.top.get_widget('del_src'))

View File

@ -157,7 +157,7 @@ class EditPlace:
})
self.sourcetab = Sources.SourceTab(self.srcreflist,self,
self.top_window,self.slist,
self.top_window,self.top,self.slist,
self.top_window.get_widget('add_src'),
self.top_window.get_widget('edit_src'),
self.top_window.get_widget('del_src'))

View File

@ -1,7 +1,7 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000, 2003 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
@ -115,7 +115,7 @@ class EventEditor:
self.date_field.grab_focus()
self.sourcetab = Sources.SourceTab(self.srcreflist,self.parent,
self.top,self.slist,
self.top,self.window,self.slist,
self.top.get_widget('add_src'),
self.top.get_widget('edit_src'),
self.top.get_widget('del_src'))

View File

@ -78,9 +78,9 @@ class Marriage:
self.pmap[p[0]] = key
self.top = gtk.glade.XML(const.marriageFile,"marriageEditor","gramps")
top_window = self.get_widget("marriageEditor")
self.window = self.get_widget("marriageEditor")
Utils.set_titles(top_window, self.top.get_widget('title'),
Utils.set_titles(self.window, self.top.get_widget('title'),
_('Marriage/Relationship Editor'))
self.icon_list = self.get_widget('iconlist')
@ -200,7 +200,7 @@ class Marriage:
self.redraw_event_list()
self.redraw_attr_list()
top_window.show()
self.window.show()
def ev_drag_begin(self, context, a):
return

View File

@ -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
@ -84,7 +84,7 @@ class NameEditor:
Utils.set_titles(self.window, alt_title, tmsg, _('Alternate Name Editor'))
self.sourcetab = Sources.SourceTab(self.srcreflist, self.parent,
self.top, self.slist,
self.top, self.window, self.slist,
self.top.get_widget('add_src'),
self.top.get_widget('edit_src'),
self.top.get_widget('del_src'))

View File

@ -53,17 +53,15 @@ class SourceSelector:
self.list.append(RelLib.SourceRef(s))
self.update=update
self.top = gtk.glade.XML(const.srcselFile,"sourcesel","gramps")
self.sourcesel = self.top.get_widget("sourcesel")
self.window = self.top.get_widget("sourcesel")
Utils.set_titles(self.sourcesel, self.top.get_widget('title'),
Utils.set_titles(self.window, self.top.get_widget('title'),
_('Source Reference Selection'))
self.top.signal_autoconnect({
"destroy_passed_object" : Utils.destroy_passed_object,
"on_add_src_clicked" : self.add_src_clicked,
"on_del_src_clicked" : self.del_src_clicked,
"on_edit_src_clicked" : self.edit_src_clicked,
"on_src_ok_clicked" : self.src_ok_clicked,
})
self.slist = self.top.get_widget("slist")
@ -90,7 +88,14 @@ class SourceSelector:
self.delete.set_sensitive(gtk.FALSE)
self.edit.set_sensitive(gtk.FALSE)
self.redraw()
self.sourcesel.show()
if self.parent:
self.window.set_transient_for(self.parent.window)
self.window.show()
val = self.window.run()
if val == gtk.RESPONSE_OK:
self.src_ok_clicked()
self.window.destroy()
def selection_changed(self,obj):
(store,iter) = self.selection.get_selected()
@ -108,13 +113,12 @@ class SourceSelector:
iter = self.model.append()
self.model.set(iter,0,base.getId(),1,base.getTitle())
def src_ok_clicked(self,obj):
def src_ok_clicked(self):
del self.orig[:]
for s in self.list:
self.orig.append(s)
if self.update:
self.update(self.orig)
Utils.destroy_passed_object(self.sourcesel)
def edit_src_clicked(self,obj):
store,iter = self.selection.get_selected()
@ -148,11 +152,12 @@ class SourceSelector:
#
#-------------------------------------------------------------------------
class SourceTab:
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()
self.model = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING)
@ -234,10 +239,8 @@ class SourceEditor:
_('Source Information'))
self.showSource.signal_autoconnect({
"on_sourceok_clicked" : self.on_sourceok_clicked,
"on_source_changed" : self.on_source_changed,
"on_add_src_clicked" : self.add_src_clicked,
"destroy_passed_object" : Utils.destroy_passed_object
})
self.source_field = self.get_widget("sourceList")
self.title_menu = self.get_widget("source_title")
@ -262,6 +265,12 @@ class SourceEditor:
self.draw(self.active_source)
self.set_button()
self.sourceDisplay.show()
if self.parent:
self.sourceDisplay.set_transient_for(self.parent.window)
val = self.sourceDisplay.run()
if val == gtk.RESPONSE_OK:
self.on_sourceok_clicked()
self.sourceDisplay.destroy()
def set_button(self):
if self.active_source:
@ -322,7 +331,7 @@ class SourceEditor:
else:
self.title_menu.set_sensitive(0)
def on_sourceok_clicked(self,obj):
def on_sourceok_clicked(self):
if self.active_source != self.source_ref.getBase():
self.source_ref.setBase(self.active_source)
@ -352,7 +361,6 @@ class SourceEditor:
self.update(self.parent,self.source_ref)
Utils.modified()
Utils.destroy_passed_object(obj)
def on_source_changed(self,obj):
sel = obj.list.get_selection()

View File

@ -35,8 +35,7 @@
<property name="label">gtk-cancel</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="response_id">0</property>
<signal name="clicked" handler="destroy_passed_object" object="sourceDisplay"/>
<property name="response_id">-6</property>
</widget>
</child>
@ -49,8 +48,7 @@
<property name="label">gtk-ok</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="response_id">0</property>
<signal name="clicked" handler="on_sourceok_clicked" object="sourceDisplay"/>
<property name="response_id">-5</property>
</widget>
</child>
</widget>
@ -744,8 +742,7 @@
<property name="label">gtk-cancel</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="response_id">0</property>
<signal name="clicked" handler="destroy_passed_object" object="sourcesel"/>
<property name="response_id">-6</property>
</widget>
</child>
@ -757,8 +754,7 @@
<property name="label">gtk-ok</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="response_id">0</property>
<signal name="clicked" handler="on_src_ok_clicked" object="slist"/>
<property name="response_id">-5</property>
</widget>
</child>
</widget>