From fed08bea4da177d8c7302f43e5d47d3ce22b9d23 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Tue, 21 Aug 2001 15:40:37 +0000 Subject: [PATCH] Places now have source support, and the ability to delete places svn: r354 --- gramps/configure | 4 + gramps/configure.in | 1 + gramps/src/EditPlace.py | 25 +++++- gramps/src/gramps.glade | 168 +++++++++++++++++++++++++++++++++++++- gramps/src/gramps_main.py | 104 ++++++++++++++++++++--- gramps/src/places.glade | 9 +- 6 files changed, 293 insertions(+), 18 deletions(-) diff --git a/gramps/configure b/gramps/configure index 8a005a61d..4cf043bd6 100755 --- a/gramps/configure +++ b/gramps/configure @@ -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 <> $CONFIG_STATUS <<\EOF diff --git a/gramps/configure.in b/gramps/configure.in index 8543a363c..1dbb9824c 100644 --- a/gramps/configure.in +++ b/gramps/configure.in @@ -138,6 +138,7 @@ AC_OUTPUT(Makefile \ src/plugins/Makefile\ src/filters/Makefile\ src/data/Makefile\ + doc/gramps-manual/C/Makefile\ gramps.sh) diff --git a/gramps/src/EditPlace.py b/gramps/src/EditPlace.py index a2dc707c7..4cf4f2b9f 100644 --- a/gramps/src/EditPlace.py +++ b/gramps/src/EditPlace.py @@ -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,7 +85,8 @@ 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") self.loc_county = self.top_window.get_widget("loc_county") @@ -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 diff --git a/gramps/src/gramps.glade b/gramps/src/gramps.glade index f84be671a..0e8aa7d8c 100644 --- a/gramps/src/gramps.glade +++ b/gramps/src/gramps.glade @@ -2981,9 +2981,14 @@ GtkButton button114 - False True True + + clicked + on_delete_place_clicked + place_list + Tue, 21 Aug 2001 14:48:57 GMT + GTK_RELIEF_NORMAL @@ -5805,4 +5810,165 @@ Unknown + + GtkDialog + place_query + Gramps - Delete a currently used Place + GTK_WINDOW_DIALOG + GTK_WIN_POS_CENTER + True + True + True + False + + + GtkVBox + Dialog:vbox + dialog-vbox13 + False + 0 + + + GtkHBox + Dialog:action_area + dialog-action_area13 + 10 + True + 5 + + 0 + False + True + GTK_PACK_END + + + + GtkHButtonBox + hbuttonbox25 + GTK_BUTTONBOX_END + 30 + 85 + 27 + 7 + 0 + + 0 + True + True + + + + GtkButton + force_delete + True + True + + clicked + on_force_delete_clicked + place_query + Tue, 21 Aug 2001 15:30:46 GMT + + GNOME_STOCK_BUTTON_YES + GTK_RELIEF_NORMAL + + + + GtkButton + button116 + True + True + + clicked + destroy_passed_object + place_query + Tue, 21 Aug 2001 15:33:25 GMT + + GNOME_STOCK_BUTTON_NO + GTK_RELIEF_NORMAL + + + + + + GtkVBox + vbox39 + False + 0 + + 0 + True + True + + + + GtkLabel + label234 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 10 + + 0 + False + False + + + + + GtkHSeparator + hseparator20 + + 0 + False + True + + + + + GtkScrolledWindow + scrolledwindow27 + 450 + 250 + GTK_POLICY_NEVER + GTK_POLICY_ALWAYS + GTK_UPDATE_CONTINUOUS + GTK_UPDATE_CONTINUOUS + + 0 + True + True + + + + GtkText + text + True + False + + + + + + GtkLabel + label233 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 10 + + 0 + False + False + + + + + + diff --git a/gramps/src/gramps_main.py b/gramps/src/gramps_main.py index fdedaad3a..0d53c4a99 100755 --- a/gramps/src/gramps_main.py +++ b/gramps/src/gramps_main.py @@ -914,8 +914,87 @@ 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,12 +1002,9 @@ def on_delete_place_clicked(obj): #------------------------------------------------------------------------- def on_edit_source_clicked(obj): index = obj.get_data("i") - if index == -1: - return - - source = obj.get_row_data(index) - EditSource.EditSource(source,database,update_source_after_edit) - + if index != -1: + source = obj.get_row_data(index) + EditSource.EditSource(source,database,update_source_after_edit) #------------------------------------------------------------------------- # @@ -937,11 +1013,9 @@ def on_edit_source_clicked(obj): #------------------------------------------------------------------------- def on_edit_place_clicked(obj): index = obj.get_data("i") - if index == -1: - return - - place = obj.get_row_data(index) - EditPlace.EditPlace(place,database,update_place_after_edit) + 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 diff --git a/gramps/src/places.glade b/gramps/src/places.glade index 0996ba305..a1352fcf8 100644 --- a/gramps/src/places.glade +++ b/gramps/src/places.glade @@ -380,7 +380,7 @@ GtkEntry - entry6 + source_field True False True @@ -573,8 +573,13 @@ GtkButton button119 - False True + + clicked + on_source_clicked + placeEditor + Tue, 21 Aug 2001 14:02:25 GMT + GTK_RELIEF_NORMAL