From 7c083dee983ae9e94918ae55f9308ad10100a3be Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Sat, 18 Aug 2001 19:52:02 +0000 Subject: [PATCH] Start of editing of place objects svn: r346 --- gramps/src/EditPlace.py | 439 ++++++++++++++++++++++ gramps/src/WriteXML.py | 18 +- gramps/src/const.py | 1 + gramps/src/earth.xpm | 327 +++++++++++++++++ gramps/src/gramps.glade | 16 +- gramps/src/gramps_main.py | 77 ++++ gramps/src/places.glade | 747 ++++++++++++++++++++++++++++++++++++++ 7 files changed, 1608 insertions(+), 17 deletions(-) create mode 100644 gramps/src/EditPlace.py create mode 100644 gramps/src/earth.xpm create mode 100644 gramps/src/places.glade diff --git a/gramps/src/EditPlace.py b/gramps/src/EditPlace.py new file mode 100644 index 000000000..ea1b551d4 --- /dev/null +++ b/gramps/src/EditPlace.py @@ -0,0 +1,439 @@ +#! /usr/bin/python -O +# +# Gramps - a GTK+/GNOME based genealogy program +# +# Copyright (C) 2000 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 +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +#------------------------------------------------------------------------- +# +# Standard python modules +# +#------------------------------------------------------------------------- +import os +import string + +#------------------------------------------------------------------------- +# +# GTK/Gnome modules +# +#------------------------------------------------------------------------- +from gtk import * +from gnome.ui import * +import gnome.mime + +import libglade + +#------------------------------------------------------------------------- +# +# gramps modules +# +#------------------------------------------------------------------------- +import intl +import const +import utils +from RelLib import * +import RelImage + +_ = intl.gettext + +#------------------------------------------------------------------------- +# +# Constants +# +#------------------------------------------------------------------------- +INDEX = "i" +PLACE = "p" + +class EditPlace: + + def __init__(self,place,db,func): + self.place = place + self.db = db + self.callback = func + self.path = db.getSavePath() + self.not_loaded = 1 + + self.selectedIcon = -1 + self.currentImages = [] + self.top_window = libglade.GladeXML(const.placesFile,"placeEditor") + self.title = self.top_window.get_widget("place_title") + self.city = self.top_window.get_widget("city") + self.county = self.top_window.get_widget("county") + self.state = self.top_window.get_widget("state") + self.country = self.top_window.get_widget("country") + self.longitude = self.top_window.get_widget("longitude") + self.latitude = self.top_window.get_widget("latitude") + self.note = self.top_window.get_widget("place_note") + + self.title.set_text(place.get_title()) + mloc = place.get_main_location() + self.city.set_text(mloc.get_city()) + self.county.set_text(mloc.get_county()) + self.state.set_text(mloc.get_state()) + self.country.set_text(mloc.get_country()) + self.longitude.set_text(place.get_longitude()) + self.latitude.set_text(place.get_latitude()) + + self.note.set_point(0) + self.note.insert_defaults(place.getNote()) + self.note.set_word_wrap(1) + + self.photo_list = self.top_window.get_widget("photolist") + + self.top_window.signal_autoconnect({ + "destroy_passed_object" : utils.destroy_passed_object, + "on_photolist_select_icon" : on_photo_select_icon, + "on_photolist_button_press_event" : on_photolist_button_press_event, + "on_switch_page" : on_switch_page, + "on_addphoto_clicked" : on_add_photo_clicked, + "on_deletephoto_clicked" : on_delete_photo_clicked, + "on_apply_clicked" : on_place_apply_clicked + }) + + self.top = self.top_window.get_widget("placeEditor") + self.top.set_data(PLACE,self) + + if self.place.getId() == "": + self.top_window.get_widget("add_photo").set_sensitive(0) + self.top_window.get_widget("delete_photo").set_sensitive(0) + + #------------------------------------------------------------------------- + # + # add_thumbnail - Scale the image and add it to the IconList. + # + #------------------------------------------------------------------------- + def add_thumbnail(self,photo): + src = photo.getPath() + thumb = self.db.getSavePath() + os.sep + ".thumb" + os.sep + \ + os.path.basename(src) + + RelImage.check_thumb(src,thumb,const.thumbScale) + + self.photo_list.append(thumb,photo.getDescription()) + + #------------------------------------------------------------------------- + # + # load_images - clears the currentImages list to free up any cached + # Imlibs. Then add each photo in the place's list of photos to the + # photolist window. + # + #------------------------------------------------------------------------- + def load_images(self): + if len(self.place.getPhotoList()) == 0: + return + self.photo_list.freeze() + self.photo_list.clear() + for photo in self.place.getPhotoList(): + self.add_thumbnail(photo) + self.photo_list.thaw() + +#----------------------------------------------------------------------------- +# +# +# +#----------------------------------------------------------------------------- +def on_place_apply_clicked(obj): + + edit = obj.get_data(PLACE) + title = edit.title.get_text() + city = edit.city.get_text() + county = edit.county.get_text() + state = edit.state.get_text() + country = edit.country.get_text() + longitude = edit.longitude.get_text() + latitude = edit.latitude.get_text() + note = edit.note.get_chars(0,-1) + + mloc = edit.place.get_main_location() + if city != mloc.get_city(): + mloc.set_city(city) + utils.modified() + + if state != mloc.get_state(): + mloc.set_state(state) + utils.modified() + + if county != mloc.get_county(): + mloc.set_county(county) + utils.modified() + + if country != mloc.get_country(): + mloc.set_country(country) + utils.modified() + + if title != edit.place.get_title(): + edit.place.set_title(title) + utils.modified() + + if longitude != edit.place.get_longitude(): + edit.place.set_longitude(longitude) + utils.modified() + + if latitude != edit.place.get_latitude(): + edit.place.set_latitude(latitude) + utils.modified() + + if note != edit.place.getNote(): + edit.place.setNote(note) + utils.modified() + + utils.destroy_passed_object(edit.top) + edit.callback(edit.place) + +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def on_switch_page(obj,a,page): + src = obj.get_data(PLACE) + if page == 2 and src.not_loaded: + src.not_loaded = 0 + src.load_images() + +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def on_photo_select_icon(obj,iconNumber,event): + obj.get_data(PLACE).selectedIcon = iconNumber + +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def on_delete_photo_clicked(obj): + edit_place_obj = obj.get_data(PLACE) + icon = edit_place_obj.selectedIcon + + if icon == -1: + return + + photolist = edit_place_obj.place.getPhotoList() + edit_place_obj.photo_list.remove(icon) + del photolist[edit_place_obj.selectedIcon] + +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def on_add_photo_clicked(obj): + + edit_place = obj.get_data(PLACE) + + image_select = libglade.GladeXML(const.imageselFile,"imageSelect") + + edit_place.isel = image_select + + image_select.signal_autoconnect({ + "on_savephoto_clicked" : on_savephoto_clicked, + "on_name_changed" : on_name_changed, + "destroy_passed_object" : utils.destroy_passed_object + }) + + edit_place.fname = image_select.get_widget("fname") + edit_place.add_image = image_select.get_widget("image") + edit_place.external = image_select.get_widget("private") + image_select.get_widget("imageSelect").set_data(PLACE,edit_place) + image_select.get_widget("imageSelect").show() + +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def on_savephoto_clicked(obj): + edit_place_obj = obj.get_data(PLACE) + image_select = edit_place_obj.isel + + filename = image_select.get_widget("photosel").get_full_path(0) + description = image_select.get_widget("photoDescription").get_text() + + if os.path.exists(filename) == 0: + return + + prefix = "s%s" % edit_place_obj.place.getId() + if edit_place_obj.external.get_active() == 1: + if os.path.isfile(filename): + name = filename + else: + return + else: + name = RelImage.import_photo(filename,edit_place_obj.path,prefix) + if name == None: + return + + photo = Photo() + photo.setPath(name) + photo.setDescription(description) + + edit_place_obj.place.addPhoto(photo) + edit_place_obj.add_thumbnail(photo) + + utils.modified() + utils.destroy_passed_object(obj) + +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def on_photolist_button_press_event(obj,event): + + myobj = obj.get_data(PLACE) + icon = myobj.selectedIcon + if icon == -1: + return + + if event.button == 3: + photo = myobj.place.getPhotoList()[icon] + menu = GtkMenu() + item = GtkTearoffMenuItem() + item.show() + view = GtkMenuItem(_("View Image")) + view.set_data("m",myobj) + view.connect("activate",on_view_photo) + view.show() + edit = GtkMenuItem(_("Edit Image")) + edit.set_data("m",myobj) + edit.connect("activate",on_edit_photo) + edit.show() + change = GtkMenuItem(_("Edit Description")) + change.set_data("m",myobj) + change.connect("activate",on_change_description) + change.show() + menu.append(item) + menu.append(view) + menu.append(edit) + menu.append(change) + if photo.getPrivate() == 0: + private = GtkMenuItem(_("Convert to private copy")) + private.set_data("m",myobj) + private.connect("activate",on_convert_to_private) + private.show() + menu.append(private) + menu.popup(None,None,None,0,0) + +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def on_convert_to_private(obj): + edit_place_obj = obj.get_data("m") + photo = edit_place_obj.place.getPhotoList()[edit_place_obj.selectedIcon] + + prefix = "i%s" % edit_place_obj.place.getId() + name = RelImage.import_photo(photo.getPath(),edit_place_obj.path,prefix) + + photo.setPath(name) + photo.setPrivate(1) + +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def on_view_photo(obj): + myobj = obj.get_data("m") + photo = myobj.place.getPhotoList()[myobj.selectedIcon] + type = gnome.mime.type(photo.getPath()) + + prog = string.split(gnome.mime.get_value(type,'view')) + args = [] + for val in prog: + if val == "%f": + args.append(photo.getPath()) + else: + args.append(val) + + if os.fork() == 0: + os.execvp(args[0],args) + +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def on_edit_photo(obj): + myobj = obj.get_data("m") + photo = myobj.place.getPhotoList()[myobj.selectedIcon] + if os.fork() == 0: + os.execvp(const.editor,[const.editor, photo.getPath()]) + +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def on_change_description(obj): + myobj = obj.get_data("m") + photo = myobj.place.getPhotoList()[myobj.selectedIcon] + window = libglade.GladeXML(const.imageselFile,"dialog1") + + text = window.get_widget("text") + text.set_text(photo.getDescription()) + + image2 = RelImage.scale_image(photo.getPath(),200.0) + window.get_widget("photo").load_imlib(image2) + window.get_widget("dialog1").set_data("p",photo) + window.get_widget("dialog1").set_data("t",text) + window.get_widget("dialog1").set_data("m",obj.get_data("m")) + window.signal_autoconnect({ + "on_cancel_clicked" : utils.destroy_passed_object, + "on_ok_clicked" : on_ok_clicked, + "on_apply_clicked" : on_apply_clicked + }) + +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def on_ok_clicked(obj): + on_apply_clicked(obj) + utils.destroy_passed_object(obj) + +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def on_apply_clicked(obj): + photo = obj.get_data("p") + text = obj.get_data("t").get_text() + if text != photo.getDescription(): + photo.setDescription(text) + edit_window = obj.get_data("m") + edit_window.load_images() + utils.modified() + +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def on_name_changed(obj): + edit_person = obj.get_data(PLACE) + file = edit_person.fname.get_text() + if os.path.isfile(file): + image = RelImage.scale_image(file,const.thumbScale) + edit_person.add_image.load_imlib(image) diff --git a/gramps/src/WriteXML.py b/gramps/src/WriteXML.py index a0e233746..8d46894c1 100644 --- a/gramps/src/WriteXML.py +++ b/gramps/src/WriteXML.py @@ -478,15 +478,15 @@ def exportData(database, filename, callback): for key in proplist.keys(): g.write(' %s="%s"' % (key,proplist[key])) g.write("/>\n") - if len(place.getUrlList()) > 0: - for url in place.getUrlList(): - g.write(' 0: + for url in place.getUrlList(): + g.write(' \n") g.write(" \n") diff --git a/gramps/src/const.py b/gramps/src/const.py index 34da5ac0f..9348871cd 100644 --- a/gramps/src/const.py +++ b/gramps/src/const.py @@ -55,6 +55,7 @@ else: logo = rootDir + os.sep + "gramps.xpm" gladeFile = rootDir + os.sep + "gramps.glade" +placesFile = rootDir + os.sep + "places.glade" imageselFile = rootDir + os.sep + "imagesel.glade" marriageFile = rootDir + os.sep + "marriage.glade" editPersonFile = rootDir + os.sep + "EditPerson.glade" diff --git a/gramps/src/earth.xpm b/gramps/src/earth.xpm new file mode 100644 index 000000000..fc9866838 --- /dev/null +++ b/gramps/src/earth.xpm @@ -0,0 +1,327 @@ +/* XPM */ +static char * earth_xpm[] = { +"21 21 303 2", +" c None", +". c #000000", +"+ c #10212D", +"@ c #201765", +"# c #281C81", +"$ c #3D85A0", +"% c #37D36B", +"& c #23286C", +"* c #365C9B", +"= c #150649", +"- c #083E00", +"; c #12770E", +"> c #289A46", +", c #42B4A1", +"' c #34BB6A", +") c #3B6AA2", +"! c #2EFA3A", +"~ c #34E458", +"{ c #526EF9", +"] c #2FFF39", +"^ c #5369FF", +"/ c #23F414", +"( c #179811", +"_ c #198115", +": c #28FF1F", +"< c #28FF25", +"[ c #28FF23", +"} c #26E819", +"| c #2F7A55", +"1 c #26EC17", +"2 c #1E7D27", +"3 c #1A0849", +"4 c #20A803", +"5 c #30E749", +"6 c #2DFB34", +"7 c #27F817", +"8 c #20D217", +"9 c #072603", +"0 c #147F12", +"a c #2AFF22", +"b c #26FF1E", +"c c #63DC40", +"d c #26FF17", +"e c #1F1A40", +"f c #584DFF", +"g c #3B8C90", +"h c #2F2081", +"i c #5853FF", +"j c #2E9760", +"k c #414ECB", +"l c #5061F9", +"m c #203739", +"n c #39B77C", +"o c #22D018", +"p c #062005", +"q c #09150C", +"r c #22DC1C", +"s c #30FF25", +"t c #2CFF21", +"u c #3CFA31", +"v c #3C9D98", +"w c #20175F", +"x c #585AFF", +"y c #4A48EB", +"z c #242466", +"A c #37D46E", +"B c #30DF2B", +"C c #2DE42D", +"D c #4F5FFD", +"E c #4656DD", +"F c #1B5237", +"G c #29FF1A", +"H c #09410F", +"I c #137C11", +"J c #29FF1C", +"K c #3E7729", +"L c #348220", +"M c #1E963A", +"N c #183832", +"O c #2C2680", +"P c #2E2D86", +"Q c #271C74", +"R c #0F7300", +"S c #25FF1A", +"T c #47F11D", +"U c #40F71A", +"V c #3BFD15", +"W c #43FD14", +"X c #2AF733", +"Y c #32E84E", +"Z c #33B06B", +"` c #187F15", +" . c #3DA198", +".. c #1B0650", +"+. c #4542DC", +"@. c #4454DC", +"#. c #1B2C41", +"$. c #3E3FC0", +"%. c #4142CB", +"&. c #3D51B6", +"*. c #1FE80C", +"=. c #78D64E", +"-. c #24FF1E", +";. c #26FF20", +">. c #31FA21", +",. c #33F91F", +"'. c #31F32F", +"). c #3CA796", +"!. c #4852E1", +"~. c #0A0011", +"{. c #140C31", +"]. c #4D8DD9", +"^. c #26F91D", +"/. c #1F0C5C", +"(. c #5751FF", +"_. c #5854FF", +":. c #1E1854", +"<. c #4F53FB", +"[. c #5458FF", +"}. c #4944E7", +"|. c #164D2A", +"1. c #2AFF2C", +"2. c #24FF13", +"3. c #27FF1A", +"4. c #27FF1E", +"5. c #25FF1E", +"6. c #6CD546", +"7. c #23FF0D", +"8. c #3CC583", +"9. c #322E9A", +"0. c #140E2E", +"a. c #5A55FF", +"b. c #4880CD", +"c. c #32916F", +"d. c #3EB095", +"e. c #3FB495", +"f. c #20115D", +"g. c #4F4EFC", +"h. c #5558FF", +"i. c #494BE5", +"j. c #281D77", +"k. c #4E7CE4", +"l. c #4982D3", +"m. c #2C5A52", +"n. c #33F427", +"o. c #31E42A", +"p. c #23FF12", +"q. c #5168F7", +"r. c #312D97", +"s. c #090407", +"t. c #1D1950", +"u. c #1B1149", +"v. c #21A40D", +"w. c #26FF16", +"x. c #25FF17", +"y. c #159607", +"z. c #0E410C", +"A. c #1B0F4D", +"B. c #17123D", +"C. c #0B0612", +"D. c #1C174C", +"E. c #1C154F", +"F. c #150119", +"G. c #34E559", +"H. c #24FF18", +"I. c #73D849", +"J. c #2A8C43", +"K. c #201159", +"L. c #110B2C", +"M. c #14112E", +"N. c #5B5FFF", +"O. c #5561FF", +"P. c #25FF10", +"Q. c #48F121", +"R. c #52F121", +"S. c #2AFF2B", +"T. c #4A8FCD", +"U. c #4C4CEE", +"V. c #272670", +"W. c #585DFF", +"X. c #595EFF", +"Y. c #190948", +"Z. c #4B82DB", +"`. c #25FF18", +" + c #1FDF15", +".+ c #3446A0", +"++ c #43B7A5", +"@+ c #33309C", +"#+ c #13102C", +"$+ c #4D50F0", +"%+ c #5450FF", +"&+ c #215728", +"*+ c #43C54E", +"=+ c #25FF1D", +"-+ c #29FF25", +";+ c #4792C4", +">+ c #4B4BED", +",+ c #27266F", +"'+ c #595DFF", +")+ c #1F0E50", +"!+ c #30F724", +"~+ c #27D11E", +"{+ c #239B16", +"]+ c #4F77EC", +"^+ c #2B267F", +"/+ c #100E26", +"(+ c #201D5A", +"_+ c #0A0019", +":+ c #24C731", +"<+ c #6CDB43", +"[+ c #296E2E", +"}+ c #291D67", +"|+ c #0C0A1A", +"1+ c #201F5B", +"2+ c #201F5D", +"3+ c #12001B", +"4+ c #27FF15", +"5+ c #34F525", +"6+ c #1E5E11", +"7+ c #0C3700", +"8+ c #1C2549", +"9+ c #030000", +"0+ c #242367", +"a+ c #4F53F9", +"b+ c #312D94", +"c+ c #3937B6", +"d+ c #2EFF15", +"e+ c #2CF837", +"f+ c #4344C9", +"g+ c #5252FF", +"h+ c #4347D3", +"i+ c #242264", +"j+ c #5256FF", +"k+ c #484CE3", +"l+ c #2D2269", +"m+ c #30F248", +"n+ c #4794C2", +"o+ c #180C40", +"p+ c #5453FF", +"q+ c #3D3DBB", +"r+ c #4648D9", +"s+ c #484BE3", +"t+ c #281B7C", +"u+ c #38CE74", +"v+ c #459AB8", +"w+ c #16093F", +"x+ c #575BFF", +"y+ c #494CE3", +"z+ c #252369", +"A+ c #333499", +"B+ c #3B37B6", +"C+ c #5855FF", +"D+ c #3933B0", +"E+ c #3735A7", +"F+ c #5A5FFF", +"G+ c #120F28", +"H+ c #18163F", +"I+ c #4C50F2", +"J+ c #170E3A", +"K+ c #3E7AA8", +"L+ c #40AA9B", +"M+ c #140E34", +"N+ c #494DE8", +"O+ c #3E40BE", +"P+ c #201E57", +"Q+ c #4A4EEA", +"R+ c #2B2B80", +"S+ c #323295", +"T+ c #494DE6", +"U+ c #1A1947", +"V+ c #4649D9", +"W+ c #30308F", +"X+ c #040000", +"Y+ c #221E5F", +"Z+ c #130923", +"`+ c #3C8F94", +" @ c #1F235C", +".@ c #100E36", +"+@ c #1E1D65", +"@@ c #0B0824", +"#@ c #252472", +"$@ c #0D091B", +"%@ c #1F1C53", +"&@ c #1D1B50", +"*@ c #070204", +"=@ c #1A1844", +"-@ c #0A030F", +";@ c #3838BA", +">@ c #887DA9", +",@ c #3C3B9B", +"'@ c #ADADDF", +")@ c #8887D5", +"!@ c #5C61FF", +"~@ c #2B2965", +"{@ c #5357FF", +"]@ c #100E23", +"^@ c #020000", +"/@ c #2E2727", +"(@ c #7E7879", +"_@ c #797573", +":@ c #767373", +"<@ c #7C7875", +"[@ c #5C5957", +" . . . . ", +" + @ # $ % & * = - ", +" ; > , ' ) ! ~ { ] ^ / ( ", +" _ : < [ } | 1 2 3 4 5 6 7 8 9 ", +" 0 a b c d e f g h i j k l m n o p ", +" q r s t u v w x y z A B C D E F G H ", +" I J K L M N O P Q R S T U V W X Y Z . ", +" ` ...+.@.#.$.%.&.*.=.-.;.>.,.'.).!.~. ", +"{.].^./.(._.:.<.[.}.|.1.2.3.4.5.6.7.8.9. ", +"0.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.: p.q.r. ", +"s.t.u.v.w.x.y.z.A.B.C.D.E.F.G.H.I.J.K.L. ", +"M.N.O.P.4.Q.R.S.T.U.V.W.X.Y.Z.`. +.+++@+ ", +"#+$+%+&+*+=+=+-+;+>+,+W.'+)+J !+~+{+]+^+ ", +" /+(+_+:+<+`.[+}+D.|+1+2+3+4+5+6+7+8+9+ ", +" 0+a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p+q+ ", +" r+s+t+u+v+w+x+y+z+W.A+B+C+D+E+F+G+ ", +" H+I+J+K+L+M+N+O+P+Q+R+S+T+U+V+W+ ", +" X+Y+Z+`+ @.@+@@@#@$@R+%@&@*@ ", +" =@-@;@>@,@'@)@!@~@{@]@#+ ", +" ^@/@(@_@:@<@[@9+ ", +" "}; diff --git a/gramps/src/gramps.glade b/gramps/src/gramps.glade index 10202954d..598056d2c 100644 --- a/gramps/src/gramps.glade +++ b/gramps/src/gramps.glade @@ -2955,9 +2955,9 @@ True clicked - on_add_source_clicked - source_list - Tue, 29 May 2001 21:16:02 GMT + on_add_place_clicked + place_list + Sat, 18 Aug 2001 15:39:49 GMT GTK_RELIEF_NORMAL @@ -2970,11 +2970,11 @@ True clicked - on_edit_source_clicked - source_list - Tue, 29 May 2001 21:15:39 GMT + on_edit_place_clicked + place_list + Sat, 18 Aug 2001 15:39:59 GMT - + GTK_RELIEF_NORMAL @@ -2994,7 +2994,7 @@ GtkLabel Notebook:tab label230 - + GTK_JUSTIFY_CENTER False 0.5 diff --git a/gramps/src/gramps_main.py b/gramps/src/gramps_main.py index 3e0080cc6..f97d54f36 100755 --- a/gramps/src/gramps_main.py +++ b/gramps/src/gramps_main.py @@ -63,6 +63,7 @@ import ListColors import Config import EditSource import EditPerson +import EditPlace import Marriage #------------------------------------------------------------------------- @@ -751,6 +752,7 @@ def new_database_response(val): person_list.clear() load_family() load_sources() + load_places() #------------------------------------------------------------------------- # @@ -788,6 +790,7 @@ def full_update(): apply_filter() load_family() load_sources() + load_places() load_tree() #------------------------------------------------------------------------- @@ -855,6 +858,20 @@ def on_source_list_button_press_event(obj,event): source = obj.get_row_data(index) EditSource.EditSource(source,database,update_source_after_edit) +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def on_place_list_button_press_event(obj,event): + if event.button == 1 and event.type == GDK._2BUTTON_PRESS: + index = obj.get_data("i") + if index == -1: + return + + place = obj.get_row_data(index) + EditPlace.EditPlace(place,database,update_place_after_edit) + #------------------------------------------------------------------------- # # @@ -863,6 +880,14 @@ def on_source_list_button_press_event(obj,event): def on_source_list_select_row(obj,a,b,c): obj.set_data("i",a) +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def on_place_list_select_row(obj,a,b,c): + obj.set_data("i",a) + #------------------------------------------------------------------------- # # @@ -871,6 +896,14 @@ def on_source_list_select_row(obj,a,b,c): def on_add_source_clicked(obj): EditSource.EditSource(Source(),database,new_source_after_edit) +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def on_add_place_clicked(obj): + EditPlace.EditPlace(Place(),database,new_place_after_edit) + #------------------------------------------------------------------------- # # @@ -879,6 +912,14 @@ def on_add_source_clicked(obj): def on_delete_source_clicked(obj): pass +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def on_delete_place_clicked(obj): + pass + #------------------------------------------------------------------------- # # @@ -892,6 +933,20 @@ def on_edit_source_clicked(obj): source = obj.get_row_data(index) EditSource.EditSource(source,database,update_source_after_edit) + +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +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) + #------------------------------------------------------------------------- # # @@ -901,6 +956,15 @@ def new_source_after_edit(source): database.addSource(source) update_display(0) +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def new_place_after_edit(place): + database.addPlace(place) + update_display(0) + #------------------------------------------------------------------------- # # @@ -908,6 +972,14 @@ def new_source_after_edit(source): #------------------------------------------------------------------------- def update_source_after_edit(source): update_display(0) + +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def update_place_after_edit(source): + update_display(0) #------------------------------------------------------------------------- # @@ -2786,10 +2858,15 @@ def main(arg): "on_edit_mother_clicked" : on_edit_mother_clicked, "on_exit_activate" : on_exit_activate, "on_add_source_clicked" : on_add_source_clicked, + "on_add_place_clicked" : on_add_place_clicked, "on_source_list_button_press_event" : on_source_list_button_press_event, "on_source_list_select_row": on_source_list_select_row, + "on_place_list_button_press_event" : on_place_list_button_press_event, + "on_place_list_select_row": on_place_list_select_row, "on_delete_source_clicked" : on_delete_source_clicked, +# "on_delete_place_clicked" : on_delete_place_clicked, "on_edit_source_clicked" : on_edit_source_clicked, + "on_edit_place_clicked" : on_edit_place_clicked, "delete_event" : delete_event, "on_open_activate" : on_open_activate }) diff --git a/gramps/src/places.glade b/gramps/src/places.glade new file mode 100644 index 000000000..4c62e8d87 --- /dev/null +++ b/gramps/src/places.glade @@ -0,0 +1,747 @@ + + + + + Gramps + gramps + + src + + C + True + True + True + gramps.strings + + + + GnomeDialog + placeEditor + Gramps - Place Editor + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_CENTER + False + False + False + False + False + False + + + GtkVBox + GnomeDialog:vbox + dialog-vbox11 + False + 8 + + 4 + True + True + + + + GtkHButtonBox + GnomeDialog:action_area + dialog-action_area11 + GTK_BUTTONBOX_END + 8 + 85 + 27 + 7 + 0 + + 0 + False + True + GTK_PACK_END + + + + GtkButton + button88 + True + True + + clicked + on_apply_clicked + placeEditor + Sat, 18 Aug 2001 17:26:41 GMT + + GNOME_STOCK_BUTTON_OK + + + + GtkButton + button90 + True + True + + clicked + destroy_passed_object + placeEditor + Thu, 18 Jan 2001 02:52:48 GMT + + GNOME_STOCK_BUTTON_CANCEL + + + + + GtkVBox + vbox26 + False + 0 + + 0 + True + True + + + + GtkLabel + placeEditorTitle + + clicked + on_lupdatesource_clicked + Thu, 18 Jan 2001 02:53:40 GMT + + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 5 + + 0 + False + False + + + + + GtkHSeparator + hseparator12 + + 0 + True + True + + + + + GtkNotebook + notebook2 + 450 + 350 + True + + switch_page + on_switch_page + placeEditor + Thu, 31 May 2001 15:04:55 GMT + + True + True + GTK_POS_TOP + False + 2 + 2 + False + + 0 + True + True + + + + GtkTable + table17 + 8 + 3 + False + 0 + 0 + + + GtkLabel + label165 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 5 + 0 + + 0 + 1 + 0 + 1 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + label166 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 5 + 0 + + 0 + 1 + 1 + 2 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + label167 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 5 + 0 + + 0 + 1 + 3 + 4 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + label232 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 5 + 0 + + 0 + 1 + 2 + 3 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + label233 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 5 + 0 + + 0 + 1 + 4 + 5 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + label234 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 5 + 0 + + 0 + 1 + 5 + 6 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + label235 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 5 + 0 + + 0 + 1 + 6 + 7 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + label236 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 5 + 0 + + 0 + 1 + 7 + 8 + 0 + 0 + False + False + False + False + True + False + + + + + GtkEntry + entry5 + True + False + True + 0 + + + 1 + 2 + 7 + 8 + 5 + 5 + True + False + False + False + True + False + + + + + GtkEntry + place_title + True + True + True + 0 + + + 1 + 3 + 0 + 1 + 5 + 5 + True + False + False + False + True + False + + + + + GtkEntry + city + True + True + True + 0 + + + 1 + 3 + 1 + 2 + 5 + 5 + True + False + False + False + True + False + + + + + GtkEntry + county + True + True + True + 0 + + + 1 + 3 + 2 + 3 + 5 + 5 + True + False + False + False + True + False + + + + + GtkEntry + state + True + True + True + 0 + + + 1 + 3 + 3 + 4 + 5 + 5 + True + False + False + False + True + False + + + + + GtkEntry + country + True + True + True + 0 + + + 1 + 3 + 4 + 5 + 5 + 5 + True + False + False + False + True + False + + + + + GtkEntry + longitude + True + True + True + 0 + + + 1 + 3 + 5 + 6 + 5 + 5 + True + False + False + False + True + False + + + + + GtkEntry + latitude + True + True + True + 0 + + + 1 + 3 + 6 + 7 + 5 + 5 + True + False + False + False + True + False + + + + + GtkButton + button114 + False + True + + GTK_RELIEF_NORMAL + + 2 + 3 + 7 + 8 + 5 + 0 + False + False + False + False + True + False + + + + + + GtkLabel + Notebook:tab + label204 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + + + GtkScrolledWindow + scrolledwindow23 + GTK_POLICY_NEVER + GTK_POLICY_AUTOMATIC + GTK_UPDATE_CONTINUOUS + GTK_UPDATE_CONTINUOUS + + + GtkText + place_note + True + True + + + + + + GtkLabel + Notebook:tab + label205 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + + + GtkScrolledWindow + scrolledwindow25 + GTK_POLICY_NEVER + GTK_POLICY_AUTOMATIC + GTK_UPDATE_CONTINUOUS + GTK_UPDATE_CONTINUOUS + + + GtkViewport + viewport1 + GTK_SHADOW_IN + + + GtkVBox + vbox34 + False + 0 + + + GnomeIconList + photolist + True + + select_icon + on_photolist_select_icon + sourceEditor + Thu, 31 May 2001 14:39:53 GMT + + + button_press_event + on_photolist_button_press_event + sourceEditor + Thu, 31 May 2001 14:40:04 GMT + + GTK_SELECTION_SINGLE + 100 + 20 + 10 + 5 + False + True + + 0 + True + True + + + + + GtkHButtonBox + hbuttonbox21 + GTK_BUTTONBOX_SPREAD + 30 + 85 + 27 + 7 + 0 + + 0 + False + True + + + + GtkButton + add_photo + True + True + + clicked + on_addphoto_clicked + sourceEditor + Thu, 31 May 2001 14:39:32 GMT + + + GTK_RELIEF_NORMAL + + + + GtkButton + delete_photo + True + True + + clicked + on_deletephoto_clicked + sourceEditor + Thu, 31 May 2001 14:39:16 GMT + + + GTK_RELIEF_NORMAL + + + + + + + + GtkLabel + Notebook:tab + label206 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + + + + + +