* src/EditPlace.py: Pass window to LocEdit.py. Correct apply callback.

* src/LocEdit.py (__init__): Make dialog modal and transient
for its parent; (on_help_clicked): Add function.
* src/dialog.glade: Correct response IDs.
* src/places.glade: Correct response IDs.


svn: r2457
This commit is contained in:
Alex Roitman 2003-12-07 04:54:40 +00:00
parent c10818fcd6
commit 3e4dfe4353
5 changed files with 30 additions and 16 deletions

View File

@ -11,6 +11,11 @@
* FAQ, doc/gramps-manual/C/faq.xml: Add two questions. * FAQ, doc/gramps-manual/C/faq.xml: Add two questions.
* src/plugins/WriteFtree.py (on_help_clicked): Add function. * src/plugins/WriteFtree.py (on_help_clicked): Add function.
* doc/gramps.1: Update. * doc/gramps.1: Update.
* src/EditPlace.py: Pass window to LocEdit.py. Correct apply callback.
* src/LocEdit.py (__init__): Make dialog modal and transient
for its parent; (on_help_clicked): Add function.
* src/dialog.glade: Correct response IDs.
* src/places.glade: Correct response IDs.
2003-12-05 Alex Roitman <shura@alex.neuro.umn.edu> 2003-12-05 Alex Roitman <shura@alex.neuro.umn.edu>
* src/po/ru.po: Update Russian translation for 0.98. * src/po/ru.po: Update Russian translation for 0.98.

View File

@ -271,7 +271,7 @@ class EditPlace:
setf(text) setf(text)
Utils.modified() Utils.modified()
def on_place_apply_clicked(self,obj): def on_place_apply_clicked(self):
note = self.note_buffer.get_text(self.note_buffer.get_start_iter(), note = self.note_buffer.get_text(self.note_buffer.get_start_iter(),
self.note_buffer.get_end_iter(),gtk.FALSE) self.note_buffer.get_end_iter(),gtk.FALSE)
@ -298,7 +298,6 @@ class EditPlace:
self.update_lists() self.update_lists()
self.close(None)
if self.callback: if self.callback:
self.callback(self.place) self.callback(self.place)
@ -335,7 +334,7 @@ class EditPlace:
if iter: if iter:
row = store.get_path(iter) row = store.get_path(iter)
loc = self.llist[row[0]] loc = self.llist[row[0]]
LocEdit.LocationEditor(self,loc) LocEdit.LocationEditor(self,loc,self.top)
def on_delete_url_clicked(self,obj): def on_delete_url_clicked(self,obj):
if Utils.delete_selected(obj,self.ulist): if Utils.delete_selected(obj,self.ulist):
@ -360,7 +359,7 @@ class EditPlace:
def on_add_loc_clicked(self,obj): def on_add_loc_clicked(self,obj):
import LocEdit import LocEdit
LocEdit.LocationEditor(self,None) LocEdit.LocationEditor(self,None,self.top)
def on_web_list_select_row(self,obj): def on_web_list_select_row(self,obj):
store,iter = obj.get_selected() store,iter = obj.get_selected()

View File

@ -1,7 +1,7 @@
# #
# Gramps - a GTK+/GNOME based genealogy program # 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 # 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 # it under the terms of the GNU General Public License as published by
@ -18,6 +18,8 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# #
# $Id$
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# GTK/Gnome modules # GTK/Gnome modules
@ -25,6 +27,7 @@
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import gtk import gtk
import gtk.glade import gtk.glade
import gnome
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -44,7 +47,7 @@ from gettext import gettext as _
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class LocationEditor: class LocationEditor:
def __init__(self,parent,location): def __init__(self,parent,location,parent_window=None):
self.parent = parent self.parent = parent
self.location = location self.location = location
self.top = gtk.glade.XML(const.dialogFile, "loc_edit","gramps") self.top = gtk.glade.XML(const.dialogFile, "loc_edit","gramps")
@ -67,11 +70,22 @@ class LocationEditor:
self.window.set_data("o",self) self.window.set_data("o",self)
self.top.signal_autoconnect({ self.top.signal_autoconnect({
"destroy_passed_object" : Utils.destroy_passed_object, "on_help_loc_clicked" : self.on_help_clicked,
"on_loc_edit_ok_clicked" : self.on_location_edit_ok_clicked })
})
def on_location_edit_ok_clicked(self,obj): if parent_window:
self.window.set_transient_for(parent_window)
self.val = self.window.run()
if self.val == gtk.RESPONSE_OK:
self.on_location_edit_ok_clicked()
self.window.destroy()
def on_help_clicked(self,obj):
"""Display the relevant portion of GRAMPS manual"""
gnome.help_display('gramps-manual','gramps-edit-complete')
self.val = self.window.run()
def on_location_edit_ok_clicked(self):
self.location = self.location self.location = self.location
city = self.city.get_text() city = self.city.get_text()
@ -87,7 +101,6 @@ class LocationEditor:
self.update_location(city,parish,county,state,country) self.update_location(city,parish,county,state,country)
self.parent.redraw_location_list() self.parent.redraw_location_list()
Utils.destroy_passed_object(obj)
def update_location(self,city,parish,county,state,country): def update_location(self,city,parish,county,state,country):
if self.location.get_city() != city: if self.location.get_city() != city:
@ -109,4 +122,3 @@ class LocationEditor:
if self.location.get_country() != country: if self.location.get_country() != country:
self.location.set_country(country) self.location.set_country(country)
self.parent.lists_changed = 1 self.parent.lists_changed = 1

View File

@ -1447,7 +1447,6 @@
<property name="use_stock">True</property> <property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property> <property name="relief">GTK_RELIEF_NORMAL</property>
<property name="response_id">-6</property> <property name="response_id">-6</property>
<signal name="clicked" handler="destroy_passed_object" object="loc_edit"/>
</widget> </widget>
</child> </child>
@ -1461,7 +1460,6 @@
<property name="use_stock">True</property> <property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property> <property name="relief">GTK_RELIEF_NORMAL</property>
<property name="response_id">-5</property> <property name="response_id">-5</property>
<signal name="clicked" handler="on_loc_edit_ok_clicked" object="loc_edit"/>
</widget> </widget>
</child> </child>

View File

@ -37,7 +37,7 @@
<property name="label">gtk-cancel</property> <property name="label">gtk-cancel</property>
<property name="use_stock">True</property> <property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property> <property name="relief">GTK_RELIEF_NORMAL</property>
<property name="response_id">0</property> <property name="response_id">-6</property>
<signal name="clicked" handler="destroy_passed_object" object="placeEditor"/> <signal name="clicked" handler="destroy_passed_object" object="placeEditor"/>
</widget> </widget>
</child> </child>
@ -51,7 +51,7 @@
<property name="label">gtk-ok</property> <property name="label">gtk-ok</property>
<property name="use_stock">True</property> <property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property> <property name="relief">GTK_RELIEF_NORMAL</property>
<property name="response_id">0</property> <property name="response_id">-5</property>
<signal name="clicked" handler="on_apply_clicked" object="placeEditor"/> <signal name="clicked" handler="on_apply_clicked" object="placeEditor"/>
</widget> </widget>
</child> </child>