Places now have source support, and the ability to delete places

svn: r354
This commit is contained in:
Don Allingham 2001-08-21 15:40:37 +00:00
parent e482e4c9e5
commit fed08bea4d
6 changed files with 293 additions and 18 deletions

4
gramps/configure vendored
View File

@ -1192,6 +1192,8 @@ trap 'rm -fr `echo "Makefile \
src/plugins/Makefile\
src/filters/Makefile\
src/data/Makefile\
doc/gramps-manual/C/Makefile\
omf-install/Makefile\
gramps.sh" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
EOF
cat >> $CONFIG_STATUS <<EOF
@ -1281,6 +1283,8 @@ CONFIG_FILES=\${CONFIG_FILES-"Makefile \
src/plugins/Makefile\
src/filters/Makefile\
src/data/Makefile\
doc/gramps-manual/C/Makefile\
omf-install/Makefile\
gramps.sh"}
EOF
cat >> $CONFIG_STATUS <<\EOF

View File

@ -138,6 +138,7 @@ AC_OUTPUT(Makefile \
src/plugins/Makefile\
src/filters/Makefile\
src/data/Makefile\
doc/gramps-manual/C/Makefile\
gramps.sh)

View File

@ -48,6 +48,7 @@ import const
import utils
from RelLib import *
import RelImage
import Sources
_ = intl.gettext
@ -67,6 +68,7 @@ class EditPlace:
self.callback = func
self.path = db.getSavePath()
self.not_loaded = 1
self.sref = SourceRef(place.getSourceRef())
self.selectedIcon = -1
self.currentImages = []
@ -83,6 +85,7 @@ class EditPlace:
self.web_list = self.top_window.get_widget("web_list")
self.web_url = self.top_window.get_widget("url_addr")
self.web_description = self.top_window.get_widget("url_des")
self.source_field = self.top_window.get_widget("source_field")
self.loc_list = self.top_window.get_widget("loc_list")
self.loc_city = self.top_window.get_widget("loc_city")
@ -103,6 +106,10 @@ class EditPlace:
self.country.set_text(mloc.get_country())
self.longitude.set_text(place.get_longitude())
self.latitude.set_text(place.get_latitude())
if self.sref.getBase():
self.source_field.set_text(self.sref.getBase().getTitle())
else:
self.source_field.set_text("")
self.note.set_point(0)
self.note.insert_defaults(place.getNote())
@ -112,6 +119,7 @@ class EditPlace:
self.top_window.signal_autoconnect({
"destroy_passed_object" : utils.destroy_passed_object,
"on_source_clicked" : on_source_clicked,
"on_photolist_select_icon" : on_photo_select_icon,
"on_photolist_button_press_event" : on_photolist_button_press_event,
"on_switch_page" : on_switch_page,
@ -158,7 +166,7 @@ class EditPlace:
#
#-------------------------------------------------------------------------
def update_locations(self):
self.place.set_alternate_locations(self.ulist)
self.place.set_alternate_locations(self.llist)
#---------------------------------------------------------------------
#
@ -267,6 +275,10 @@ def on_place_apply_clicked(obj):
mloc.set_city(city)
utils.modified()
if not edit.place.getSourceRef().are_equal(edit.sref):
edit.place.setSourceRef(edit.sref)
utils.modified()
if state != mloc.get_state():
mloc.set_state(state)
utils.modified()
@ -629,6 +641,15 @@ def on_add_loc_clicked(obj):
epo = obj.get_data(PLACE)
LocationEditor(obj.get_data(PLACE),None)
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def on_source_clicked(obj):
epo = obj.get_data(PLACE)
Sources.SourceEditor(epo.sref,epo.db,epo.source_field)
#-------------------------------------------------------------------------
#
# UrlEditor class

View File

@ -2981,9 +2981,14 @@
<widget>
<class>GtkButton</class>
<name>button114</name>
<sensitive>False</sensitive>
<can_default>True</can_default>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>on_delete_place_clicked</handler>
<object>place_list</object>
<last_modification_time>Tue, 21 Aug 2001 14:48:57 GMT</last_modification_time>
</signal>
<label>Delete Place</label>
<relief>GTK_RELIEF_NORMAL</relief>
</widget>
@ -5805,4 +5810,165 @@ Unknown
</widget>
</widget>
<widget>
<class>GtkDialog</class>
<name>place_query</name>
<title>Gramps - Delete a currently used Place</title>
<type>GTK_WINDOW_DIALOG</type>
<position>GTK_WIN_POS_CENTER</position>
<modal>True</modal>
<allow_shrink>True</allow_shrink>
<allow_grow>True</allow_grow>
<auto_shrink>False</auto_shrink>
<widget>
<class>GtkVBox</class>
<child_name>Dialog:vbox</child_name>
<name>dialog-vbox13</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<widget>
<class>GtkHBox</class>
<child_name>Dialog:action_area</child_name>
<name>dialog-action_area13</name>
<border_width>10</border_width>
<homogeneous>True</homogeneous>
<spacing>5</spacing>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>True</fill>
<pack>GTK_PACK_END</pack>
</child>
<widget>
<class>GtkHButtonBox</class>
<name>hbuttonbox25</name>
<layout_style>GTK_BUTTONBOX_END</layout_style>
<spacing>30</spacing>
<child_min_width>85</child_min_width>
<child_min_height>27</child_min_height>
<child_ipad_x>7</child_ipad_x>
<child_ipad_y>0</child_ipad_y>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkButton</class>
<name>force_delete</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>on_force_delete_clicked</handler>
<object>place_query</object>
<last_modification_time>Tue, 21 Aug 2001 15:30:46 GMT</last_modification_time>
</signal>
<stock_button>GNOME_STOCK_BUTTON_YES</stock_button>
<relief>GTK_RELIEF_NORMAL</relief>
</widget>
<widget>
<class>GtkButton</class>
<name>button116</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>destroy_passed_object</handler>
<object>place_query</object>
<last_modification_time>Tue, 21 Aug 2001 15:33:25 GMT</last_modification_time>
</signal>
<stock_button>GNOME_STOCK_BUTTON_NO</stock_button>
<relief>GTK_RELIEF_NORMAL</relief>
</widget>
</widget>
</widget>
<widget>
<class>GtkVBox</class>
<name>vbox39</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkLabel</class>
<name>label234</name>
<label>Warning: This place is currently in use!</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>10</ypad>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkHSeparator</class>
<name>hseparator20</name>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>True</fill>
</child>
</widget>
<widget>
<class>GtkScrolledWindow</class>
<name>scrolledwindow27</name>
<width>450</width>
<height>250</height>
<hscrollbar_policy>GTK_POLICY_NEVER</hscrollbar_policy>
<vscrollbar_policy>GTK_POLICY_ALWAYS</vscrollbar_policy>
<hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
<vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkText</class>
<name>text</name>
<can_focus>True</can_focus>
<editable>False</editable>
<text></text>
</widget>
</widget>
<widget>
<class>GtkLabel</class>
<name>label233</name>
<label>Do you wish to delete this place?</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>10</ypad>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
</widget>
</widget>
</widget>
</GTK-Interface>

View File

@ -914,7 +914,86 @@ def on_delete_source_clicked(obj):
#
#-------------------------------------------------------------------------
def on_delete_place_clicked(obj):
pass
global pevent
global fevent
index = obj.get_data("i")
if index == -1:
return
pevent = []
fevent = []
place = obj.get_row_data(index)
for p in database.getPersonMap().values():
for event in [p.getBirth(), p.getDeath()] + p.getEventList():
if event.getPlace() == place:
pevent.append(p,event)
for f in database.getFamilyMap().values():
for event in f.getEventList():
if event.getPlace() == place:
fevent.append(f,event)
if len(pevent) > 0 or len(fevent) > 0:
msg = []
ptop = libglade.GladeXML(const.gladeFile,"place_query")
ptop.signal_autoconnect({
'on_force_delete_clicked': on_force_delete_clicked,
'destroy_passed_object' : utils.destroy_passed_object})
fd = ptop.get_widget("place_query")
fd.set_data("p",pevent)
fd.set_data("f",fevent)
fd.set_data("place",place)
textbox = ptop.get_widget("text")
textbox.set_point(0)
textbox.set_word_wrap(1)
if len(pevent) > 0:
textbox.insert_defaults(_("People") + "\n")
textbox.insert_defaults("_________________________\n\n")
t = _("%s [%s]: event %s\n")
for e in pevent:
msg = t % (Config.nameof(e[0]),e[0].getId(),e[1].getName())
textbox.insert_defaults(msg)
if len(fevent) > 0:
textbox.insert_defaults("\n%s\n" % _("Families"))
textbox.insert_defaults("_________________________\n\n")
t = _("%s [%s]: event %s\n")
for e in fevent:
father = e[0].getFather()
mother = e[0].getMother()
if father and mother:
fname = "%s and %s" % (Config.nameof(father),Config.nameof(mother))
elif father:
fname = "%s" % Config.nameof(father)
else:
fname = "%s" % Config.nameof(mother)
msg = t % (fname,e[0].getId(),e[1].getName())
textbox.insert_defaults(msg)
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def on_force_delete_clicked(obj):
place = obj.get_data('place')
plist = obj.get_data('p')
flist = obj.get_data('f')
for event in plist + flist:
event[1].setPlace(None)
map = database.getPlaceMap()
del map[place.getId()]
utils.modified()
utils.destroy_passed_object(obj)
update_display(0)
#-------------------------------------------------------------------------
#
@ -923,13 +1002,10 @@ def on_delete_place_clicked(obj):
#-------------------------------------------------------------------------
def on_edit_source_clicked(obj):
index = obj.get_data("i")
if index == -1:
return
if index != -1:
source = obj.get_row_data(index)
EditSource.EditSource(source,database,update_source_after_edit)
#-------------------------------------------------------------------------
#
#
@ -937,9 +1013,7 @@ def on_edit_source_clicked(obj):
#-------------------------------------------------------------------------
def on_edit_place_clicked(obj):
index = obj.get_data("i")
if index == -1:
return
if index != -1:
place = obj.get_row_data(index)
EditPlace.EditPlace(place,database,update_place_after_edit)
@ -1782,7 +1856,9 @@ def load_places():
current_row = -1
index = 0
for src in database.getPlaceMap().values():
places = database.getPlaceMap().values()
for src in places:
title = src.get_title()
id = src.getId()
mloc = src.get_main_location()
@ -1794,6 +1870,8 @@ def load_places():
place_list.set_row_data(index,src)
index = index + 1
place_list.sort()
if index > 0:
if current_row == -1:
current_row = 0

View File

@ -380,7 +380,7 @@
<widget>
<class>GtkEntry</class>
<name>entry6</name>
<name>source_field</name>
<can_focus>True</can_focus>
<editable>False</editable>
<text_visible>True</text_visible>
@ -573,8 +573,13 @@
<widget>
<class>GtkButton</class>
<name>button119</name>
<sensitive>False</sensitive>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>on_source_clicked</handler>
<object>placeEditor</object>
<last_modification_time>Tue, 21 Aug 2001 14:02:25 GMT</last_modification_time>
</signal>
<label>Select</label>
<relief>GTK_RELIEF_NORMAL</relief>
<child>