Hold onto iconlists to keep from crashing while program is active

svn: r1224
This commit is contained in:
Don Allingham 2002-12-17 05:12:28 +00:00
parent 7fd574b4c0
commit 21b8a4f3db
3 changed files with 50 additions and 55 deletions

View File

@ -64,6 +64,9 @@ _IMAGEX = 140
_IMAGEY = 150 _IMAGEY = 150
_PAD = 5 _PAD = 5
_iconlist_refs = []
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# ImageSelect class # ImageSelect class
@ -217,6 +220,8 @@ class Gallery(ImageSelect):
icon_list.connect("drag_data_get", icon_list.connect("drag_data_get",
self.on_photolist_drag_data_get) self.on_photolist_drag_data_get)
_iconlist_refs.append(icon_list)
# Remember arguments # Remember arguments
self.path = path; self.path = path;
self.dataobj = dataobj; self.dataobj = dataobj;
@ -235,9 +240,13 @@ class Gallery(ImageSelect):
def close(self): def close(self):
self.iconlist.hide() self.iconlist.hide()
self.canvas_list = None for a in self.canvas_list:
a[0].destroy()
a[1].destroy()
a[2].destroy()
self.p_map = None self.p_map = None
# gc.collect() self.canvas_list = None
self.iconlist.destroy() self.iconlist.destroy()
def on_canvas1_event(self,obj,event): def on_canvas1_event(self,obj,event):

View File

@ -142,17 +142,12 @@ class PlaceView:
def button_press(self,obj,event): def button_press(self,obj,event):
if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1: if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:
store,iter = self.selection.get_selected() mlist = []
id = store.get_value(iter,1) self.selection.selected_foreach(self.blist,mlist)
if mlist:
place = self.db.getPlace(id) EditPlace.EditPlace(self,mlist[0],self.update_display)
EditPlace.EditPlace(self,place,self.update_display)
return 1 return 1
# def insert_place(self,place):
# self.place_list.append(place.getDisplayInfo())
# self.place_list.set_row_data(self.place_list.rows-1,place.getId())
def new_place_after_edit(self,place): def new_place_after_edit(self,place):
self.db.addPlace(place) self.db.addPlace(place)
self.update(0) self.update(0)
@ -165,57 +160,48 @@ class PlaceView:
def on_add_place_clicked(self,obj): def on_add_place_clicked(self,obj):
EditPlace.EditPlace(self,Place(),self.new_place_after_edit) EditPlace.EditPlace(self,Place(),self.new_place_after_edit)
# def moveto(self,row):
# self.place_list.unselect_all()
# self.place_list.select_row(row,0)
# self.place_list.moveto(row)
def on_delete_clicked(self,obj): def on_delete_clicked(self,obj):
store,iter = self.selection.get_selected() mlist = []
if not iter: self.selection.selected_foreach(self.blist,mlist)
return
id = store.get_value(iter,1) for place in mlist:
for key in self.db.getPersonKeys():
p = self.db.getPerson(key)
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:
used = 1
used = 0 for f in self.db.getFamilyMap().values():
place = self.db.getPlace(id) event_list = f.getEventList()
for key in self.db.getPersonKeys(): if f.getLdsSeal():
p = self.db.getPerson(key) event_list.append(f.getLdsSeal())
event_list = [p.getBirth(), p.getDeath()] + p.getEventList() for event in event_list:
if p.getLdsBaptism(): if event.getPlace() == place:
event_list.append(p.getLdsBaptism()) used = 1
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:
used = 1
for f in self.db.getFamilyMap().values(): if used == 1:
event_list = f.getEventList() ans = EditPlace.DeletePlaceQuery(place,self.db,self.update_display)
if f.getLdsSeal(): QuestionDialog(_('Delete Place'),
event_list.append(f.getLdsSeal()) _("%s is currently being used.\nDelete anyway?" % place.get_title()),
for event in event_list: ans.query_response)
if event.getPlace() == place: else:
used = 1 self.db.removePlace(place.getId())
self.update(0)
if used == 1: Utils.modified()
ans = EditPlace.DeletePlaceQuery(place,self.db,self.update_display)
QuestionDialog(_('Delete Place'),
_("This place is currently being used. Delete anyway?"),
ans.query_response)
else:
self.db.removePlace(place.getId())
self.update(0)
Utils.modified()
def on_edit_clicked(self,obj): def on_edit_clicked(self,obj):
"""Display the selected places in the EditPlace display""" """Display the selected places in the EditPlace display"""
list_store, iter = self.selection.get_selected() mlist = []
if iter: self.selection.selected_foreach(self.blist,mlist)
id = list_store.get_value(iter,1)
place = self.db.getPlace(id) for place in mlist:
EditPlace.EditPlace(self, place, self.update_display) EditPlace.EditPlace(self, place, self.update_display)
def blist(self,store,path,iter,list): def blist(self,store,path,iter,list):

Binary file not shown.