Start of editing of place objects

svn: r346
This commit is contained in:
Don Allingham 2001-08-18 19:52:02 +00:00
parent 27c3d421eb
commit 7c083dee98
7 changed files with 1608 additions and 17 deletions

439
gramps/src/EditPlace.py Normal file
View File

@ -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)

View File

@ -486,7 +486,7 @@ def exportData(database, filename, callback):
g.write(' description="' + url.get_description() + '"')
if place.getNote() != "":
writeNote(g,"note",place.getNote(),3)
dump_source_ref(g,event.getSourceRef(),index+1)
dump_source_ref(g,event.getSourceRef(),3)
g.write(" </placeobj>\n")
g.write(" </places>\n")

View File

@ -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"

327
gramps/src/earth.xpm Normal file
View File

@ -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+ ",
" "};

View File

@ -2955,9 +2955,9 @@
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>on_add_source_clicked</handler>
<object>source_list</object>
<last_modification_time>Tue, 29 May 2001 21:16:02 GMT</last_modification_time>
<handler>on_add_place_clicked</handler>
<object>place_list</object>
<last_modification_time>Sat, 18 Aug 2001 15:39:49 GMT</last_modification_time>
</signal>
<label>Add Place</label>
<relief>GTK_RELIEF_NORMAL</relief>
@ -2970,11 +2970,11 @@
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>on_edit_source_clicked</handler>
<object>source_list</object>
<last_modification_time>Tue, 29 May 2001 21:15:39 GMT</last_modification_time>
<handler>on_edit_place_clicked</handler>
<object>place_list</object>
<last_modification_time>Sat, 18 Aug 2001 15:39:59 GMT</last_modification_time>
</signal>
<label>Edit Edit</label>
<label>Edit Place</label>
<relief>GTK_RELIEF_NORMAL</relief>
</widget>
@ -2994,7 +2994,7 @@
<class>GtkLabel</class>
<child_name>Notebook:tab</child_name>
<name>label230</name>
<label>Places</label>
<label>label230</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>

View File

@ -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)
#-------------------------------------------------------------------------
#
#
@ -909,6 +973,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
})

747
gramps/src/places.glade Normal file
View File

@ -0,0 +1,747 @@
<?xml version="1.0"?>
<GTK-Interface>
<project>
<name>Gramps</name>
<program_name>gramps</program_name>
<directory></directory>
<source_directory>src</source_directory>
<pixmaps_directory></pixmaps_directory>
<language>C</language>
<gnome_support>True</gnome_support>
<gettext_support>True</gettext_support>
<output_translatable_strings>True</output_translatable_strings>
<translatable_strings_file>gramps.strings</translatable_strings_file>
</project>
<widget>
<class>GnomeDialog</class>
<name>placeEditor</name>
<title>Gramps - Place Editor</title>
<type>GTK_WINDOW_TOPLEVEL</type>
<position>GTK_WIN_POS_CENTER</position>
<modal>False</modal>
<allow_shrink>False</allow_shrink>
<allow_grow>False</allow_grow>
<auto_shrink>False</auto_shrink>
<auto_close>False</auto_close>
<hide_on_close>False</hide_on_close>
<widget>
<class>GtkVBox</class>
<child_name>GnomeDialog:vbox</child_name>
<name>dialog-vbox11</name>
<homogeneous>False</homogeneous>
<spacing>8</spacing>
<child>
<padding>4</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkHButtonBox</class>
<child_name>GnomeDialog:action_area</child_name>
<name>dialog-action_area11</name>
<layout_style>GTK_BUTTONBOX_END</layout_style>
<spacing>8</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>False</expand>
<fill>True</fill>
<pack>GTK_PACK_END</pack>
</child>
<widget>
<class>GtkButton</class>
<name>button88</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>on_apply_clicked</handler>
<object>placeEditor</object>
<last_modification_time>Sat, 18 Aug 2001 17:26:41 GMT</last_modification_time>
</signal>
<stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
</widget>
<widget>
<class>GtkButton</class>
<name>button90</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>destroy_passed_object</handler>
<object>placeEditor</object>
<last_modification_time>Thu, 18 Jan 2001 02:52:48 GMT</last_modification_time>
</signal>
<stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
</widget>
</widget>
<widget>
<class>GtkVBox</class>
<name>vbox26</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkLabel</class>
<name>placeEditorTitle</name>
<signal>
<name>clicked</name>
<handler>on_lupdatesource_clicked</handler>
<last_modification_time>Thu, 18 Jan 2001 02:53:40 GMT</last_modification_time>
</signal>
<label>Place Editor</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>5</ypad>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkHSeparator</class>
<name>hseparator12</name>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
</widget>
<widget>
<class>GtkNotebook</class>
<name>notebook2</name>
<width>450</width>
<height>350</height>
<can_focus>True</can_focus>
<signal>
<name>switch_page</name>
<handler>on_switch_page</handler>
<object>placeEditor</object>
<last_modification_time>Thu, 31 May 2001 15:04:55 GMT</last_modification_time>
</signal>
<show_tabs>True</show_tabs>
<show_border>True</show_border>
<tab_pos>GTK_POS_TOP</tab_pos>
<scrollable>False</scrollable>
<tab_hborder>2</tab_hborder>
<tab_vborder>2</tab_vborder>
<popup_enable>False</popup_enable>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkTable</class>
<name>table17</name>
<rows>8</rows>
<columns>3</columns>
<homogeneous>False</homogeneous>
<row_spacing>0</row_spacing>
<column_spacing>0</column_spacing>
<widget>
<class>GtkLabel</class>
<name>label165</name>
<label>Title</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>1</xalign>
<yalign>0.5</yalign>
<xpad>5</xpad>
<ypad>0</ypad>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>0</top_attach>
<bottom_attach>1</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label166</name>
<label>City</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>1</xalign>
<yalign>0.5</yalign>
<xpad>5</xpad>
<ypad>0</ypad>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label167</name>
<label>State</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>1</xalign>
<yalign>0.5</yalign>
<xpad>5</xpad>
<ypad>0</ypad>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>3</top_attach>
<bottom_attach>4</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label232</name>
<label>County</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>1</xalign>
<yalign>0.5</yalign>
<xpad>5</xpad>
<ypad>0</ypad>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>2</top_attach>
<bottom_attach>3</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label233</name>
<label>Country</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>1</xalign>
<yalign>0.5</yalign>
<xpad>5</xpad>
<ypad>0</ypad>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>4</top_attach>
<bottom_attach>5</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label234</name>
<label>Longitude</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>1</xalign>
<yalign>0.5</yalign>
<xpad>5</xpad>
<ypad>0</ypad>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>5</top_attach>
<bottom_attach>6</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label235</name>
<label>Latitude</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>1</xalign>
<yalign>0.5</yalign>
<xpad>5</xpad>
<ypad>0</ypad>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>6</top_attach>
<bottom_attach>7</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label236</name>
<label>Source</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>1</xalign>
<yalign>0.5</yalign>
<xpad>5</xpad>
<ypad>0</ypad>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>7</top_attach>
<bottom_attach>8</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkEntry</class>
<name>entry5</name>
<can_focus>True</can_focus>
<editable>False</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>7</top_attach>
<bottom_attach>8</bottom_attach>
<xpad>5</xpad>
<ypad>5</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkEntry</class>
<name>place_title</name>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
<child>
<left_attach>1</left_attach>
<right_attach>3</right_attach>
<top_attach>0</top_attach>
<bottom_attach>1</bottom_attach>
<xpad>5</xpad>
<ypad>5</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkEntry</class>
<name>city</name>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
<child>
<left_attach>1</left_attach>
<right_attach>3</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<xpad>5</xpad>
<ypad>5</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkEntry</class>
<name>county</name>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
<child>
<left_attach>1</left_attach>
<right_attach>3</right_attach>
<top_attach>2</top_attach>
<bottom_attach>3</bottom_attach>
<xpad>5</xpad>
<ypad>5</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkEntry</class>
<name>state</name>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
<child>
<left_attach>1</left_attach>
<right_attach>3</right_attach>
<top_attach>3</top_attach>
<bottom_attach>4</bottom_attach>
<xpad>5</xpad>
<ypad>5</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkEntry</class>
<name>country</name>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
<child>
<left_attach>1</left_attach>
<right_attach>3</right_attach>
<top_attach>4</top_attach>
<bottom_attach>5</bottom_attach>
<xpad>5</xpad>
<ypad>5</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkEntry</class>
<name>longitude</name>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
<child>
<left_attach>1</left_attach>
<right_attach>3</right_attach>
<top_attach>5</top_attach>
<bottom_attach>6</bottom_attach>
<xpad>5</xpad>
<ypad>5</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkEntry</class>
<name>latitude</name>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
<child>
<left_attach>1</left_attach>
<right_attach>3</right_attach>
<top_attach>6</top_attach>
<bottom_attach>7</bottom_attach>
<xpad>5</xpad>
<ypad>5</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkButton</class>
<name>button114</name>
<sensitive>False</sensitive>
<can_focus>True</can_focus>
<label>Select</label>
<relief>GTK_RELIEF_NORMAL</relief>
<child>
<left_attach>2</left_attach>
<right_attach>3</right_attach>
<top_attach>7</top_attach>
<bottom_attach>8</bottom_attach>
<xpad>5</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
</widget>
<widget>
<class>GtkLabel</class>
<child_name>Notebook:tab</child_name>
<name>label204</name>
<label>General</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
<widget>
<class>GtkScrolledWindow</class>
<name>scrolledwindow23</name>
<hscrollbar_policy>GTK_POLICY_NEVER</hscrollbar_policy>
<vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy>
<hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
<vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
<widget>
<class>GtkText</class>
<name>place_note</name>
<can_focus>True</can_focus>
<editable>True</editable>
<text></text>
</widget>
</widget>
<widget>
<class>GtkLabel</class>
<child_name>Notebook:tab</child_name>
<name>label205</name>
<label>Note</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
<widget>
<class>GtkScrolledWindow</class>
<name>scrolledwindow25</name>
<hscrollbar_policy>GTK_POLICY_NEVER</hscrollbar_policy>
<vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy>
<hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
<vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
<widget>
<class>GtkViewport</class>
<name>viewport1</name>
<shadow_type>GTK_SHADOW_IN</shadow_type>
<widget>
<class>GtkVBox</class>
<name>vbox34</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<widget>
<class>GnomeIconList</class>
<name>photolist</name>
<can_focus>True</can_focus>
<signal>
<name>select_icon</name>
<handler>on_photolist_select_icon</handler>
<object>sourceEditor</object>
<last_modification_time>Thu, 31 May 2001 14:39:53 GMT</last_modification_time>
</signal>
<signal>
<name>button_press_event</name>
<handler>on_photolist_button_press_event</handler>
<object>sourceEditor</object>
<last_modification_time>Thu, 31 May 2001 14:40:04 GMT</last_modification_time>
</signal>
<selection_mode>GTK_SELECTION_SINGLE</selection_mode>
<icon_width>100</icon_width>
<row_spacing>20</row_spacing>
<column_spacing>10</column_spacing>
<text_spacing>5</text_spacing>
<text_editable>False</text_editable>
<text_static>True</text_static>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
</widget>
<widget>
<class>GtkHButtonBox</class>
<name>hbuttonbox21</name>
<layout_style>GTK_BUTTONBOX_SPREAD</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>False</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkButton</class>
<name>add_photo</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>on_addphoto_clicked</handler>
<object>sourceEditor</object>
<last_modification_time>Thu, 31 May 2001 14:39:32 GMT</last_modification_time>
</signal>
<label>Add Image</label>
<relief>GTK_RELIEF_NORMAL</relief>
</widget>
<widget>
<class>GtkButton</class>
<name>delete_photo</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>on_deletephoto_clicked</handler>
<object>sourceEditor</object>
<last_modification_time>Thu, 31 May 2001 14:39:16 GMT</last_modification_time>
</signal>
<label>Delete Image</label>
<relief>GTK_RELIEF_NORMAL</relief>
</widget>
</widget>
</widget>
</widget>
</widget>
<widget>
<class>GtkLabel</class>
<child_name>Notebook:tab</child_name>
<name>label206</name>
<label>Gallery</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
</widget>
</widget>
</widget>
</widget>
</GTK-Interface>