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 a08425ebc8
commit 6c1cceed82
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)
used = 0 for place in mlist:
place = self.db.getPlace(id) for key in self.db.getPersonKeys():
for key in self.db.getPersonKeys(): p = self.db.getPerson(key)
p = self.db.getPerson(key) event_list = [p.getBirth(), p.getDeath()] + p.getEventList()
event_list = [p.getBirth(), p.getDeath()] + p.getEventList() if p.getLdsBaptism():
if p.getLdsBaptism(): event_list.append(p.getLdsBaptism())
event_list.append(p.getLdsBaptism()) if p.getLdsEndowment():
if p.getLdsEndowment(): event_list.append(p.getLdsEndowment())
event_list.append(p.getLdsEndowment()) if p.getLdsSeal():
if p.getLdsSeal(): event_list.append(p.getLdsSeal())
event_list.append(p.getLdsSeal()) for event in event_list:
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():
event_list = f.getEventList() event_list = f.getEventList()
if f.getLdsSeal(): if f.getLdsSeal():
event_list.append(f.getLdsSeal()) event_list.append(f.getLdsSeal())
for event in event_list: for event in event_list:
if event.getPlace() == place: if event.getPlace() == place:
used = 1 used = 1
if used == 1: if used == 1:
ans = EditPlace.DeletePlaceQuery(place,self.db,self.update_display) ans = EditPlace.DeletePlaceQuery(place,self.db,self.update_display)
QuestionDialog(_('Delete Place'), QuestionDialog(_('Delete Place'),
_("This place is currently being used. Delete anyway?"), _("%s is currently being used.\nDelete anyway?" % place.get_title()),
ans.query_response) ans.query_response)
else: else:
self.db.removePlace(place.getId()) self.db.removePlace(place.getId())
self.update(0) self.update(0)
Utils.modified() 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.