Remember image location

svn: r1103
This commit is contained in:
Don Allingham 2002-08-01 04:16:55 +00:00
parent ababb5fcaa
commit 06482ff46d
2 changed files with 26 additions and 10 deletions

View File

@ -65,6 +65,8 @@ _ = gettext
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class ImageSelect: class ImageSelect:
last_path = ""
def __init__(self, path, db, parent): def __init__(self, path, db, parent):
"""Creates an edit window. Associates a person with the window.""" """Creates an edit window. Associates a person with the window."""
self.path = path; self.path = path;
@ -102,6 +104,8 @@ class ImageSelect:
"destroy_passed_object" : Utils.destroy_passed_object "destroy_passed_object" : Utils.destroy_passed_object
}) })
if ImageSelect.last_path != "":
self.glade.get_widget("photosel").set_default_path(ImageSelect.last_path)
window.editable_enters(self.description) window.editable_enters(self.description)
window.show() window.show()
@ -128,6 +132,8 @@ class ImageSelect:
def on_savephoto_clicked(self, obj): def on_savephoto_clicked(self, obj):
"""Save the photo in the dataobj object. (Required function)""" """Save the photo in the dataobj object. (Required function)"""
filename = self.glade.get_widget("photosel").get_full_path(0) filename = self.glade.get_widget("photosel").get_full_path(0)
ImageSelect.last_path = os.path.dirname(filename)
description = self.description.get_text() description = self.description.get_text()
if os.path.exists(filename) == 0: if os.path.exists(filename) == 0:

View File

@ -27,7 +27,6 @@ Handles the place view for GRAMPS.
# GTK modules # GTK modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import GTK
import GDK import GDK
import gnome.ui import gnome.ui
@ -110,7 +109,7 @@ class PlaceView:
self.place_list.select_row(current_row,0) self.place_list.select_row(current_row,0)
self.place_list.moveto(current_row) self.place_list.moveto(current_row)
id = self.place_list.get_row_data(current_row) id = self.place_list.get_row_data(current_row)
self.active = self.db.getPlaceMap()[id] self.active = self.db.getPlace(id)
else: else:
self.active = None self.active = None
@ -119,7 +118,7 @@ class PlaceView:
def select_row(self,obj,row,b,c): def select_row(self,obj,row,b,c):
if row == obj.selection[0]: if row == obj.selection[0]:
id = self.place_list.get_row_data(row) id = self.place_list.get_row_data(row)
self.active = self.db.getPlaceMap()[id] self.active = self.db.getPlace(id)
def merge(self): def merge(self):
if len(self.place_list.selection) != 2: if len(self.place_list.selection) != 2:
@ -129,8 +128,8 @@ class PlaceView:
import MergeData import MergeData
p1 = self.place_list.get_row_data(self.place_list.selection[0]) p1 = self.place_list.get_row_data(self.place_list.selection[0])
p2 = self.place_list.get_row_data(self.place_list.selection[1]) p2 = self.place_list.get_row_data(self.place_list.selection[1])
p1 = self.db.getPlaceMap()[p1] p1 = self.db.getPlace(p1)
p2 = self.db.getPlaceMap()[p2] p2 = self.db.getPlace(p2)
MergeData.MergePlaces(self.db,p1,p2,self.load_places) MergeData.MergePlaces(self.db,p1,p2,self.load_places)
def on_button_press_event(self,obj,event): def on_button_press_event(self,obj,event):
@ -183,14 +182,25 @@ class PlaceView:
index = obj.selection[0] index = obj.selection[0]
used = 0 used = 0
place = self.db.getPlaceMap()[obj.get_row_data(index)] place = self.db.getPlace(obj.get_row_data(index))
for key in self.db.getPersonKeys(): for key in self.db.getPersonKeys():
p = self.db.getPersonMap()[key] p = self.db.getPerson[key]
for event in [p.getBirth(), p.getDeath()] + p.getEventList(): event_list = [p.getBirth(), p.getDeath()] + p.getEventList()
if p.getLdsBaptism():
event_list.append(p.getLdsBaptism())
if p.getLdsEndowment():
event_list.append(p.getLdsEndowment())
if p.getLdsSeal():
event_list.append(p.getLdsSeal())
for event in event_list:
if event.getPlace() == place: if event.getPlace() == place:
used = 1 used = 1
for f in self.db.getFamilyMap().values(): for f in self.db.getFamilyMap().values():
for event in f.getEventList(): event_list = f.getEventList()
if f.getLdsSeal():
event_list.append(f.getLdsSeal())
for event in event_list:
if event.getPlace() == place: if event.getPlace() == place:
used = 1 used = 1
@ -212,7 +222,7 @@ class PlaceView:
gnome.ui.GnomeErrorDialog(msg) gnome.ui.GnomeErrorDialog(msg)
else: else:
for p in obj.selection: for p in obj.selection:
place = self.db.getPlaceMap()[obj.get_row_data(p)] place = self.db.getPlace(obj.get_row_data(p))
EditPlace.EditPlace(place,self.db, EditPlace.EditPlace(place,self.db,
self.update_display_after_edit) self.update_display_after_edit)