From f5131a3b82d578485824effc7e01fc3762a369ae Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Mon, 23 May 2005 02:28:17 +0000 Subject: [PATCH] * src/ImageSelect.py (item_event): Do nothing if nothing is selected. * src/EditSource.py (button_press): Return if no data. * src/Sources.py (drag_data_get): Return if no data. * src/EditPerson.py (ev_drag_data_get,name_drag_data_get): Return if no data. * src/EditPlace.py (url_source_drag_data_get): Properly obtain data; return if no data. svn: r4655 --- gramps2/ChangeLog | 9 +++++++++ gramps2/src/EditPerson.py | 6 ++++-- gramps2/src/EditPlace.py | 11 +++++++---- gramps2/src/EditSource.py | 14 ++++++++------ gramps2/src/ImageSelect.py | 2 ++ gramps2/src/Sources.py | 2 ++ 6 files changed, 32 insertions(+), 12 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index f4d2299c2..3d9c9f463 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,12 @@ +2005-05-22 Alex Roitman + * src/ImageSelect.py (item_event): Do nothing if nothing is selected. + * src/EditSource.py (button_press): Return if no data. + * src/Sources.py (drag_data_get): Return if no data. + * src/EditPerson.py (ev_drag_data_get,name_drag_data_get): + Return if no data. + * src/EditPlace.py (url_source_drag_data_get): Properly obtain data; + return if no data. + 2005-05-22 Julio Sanchez * src/po/es.po: Updated translation for filters, tips still pending diff --git a/gramps2/src/EditPerson.py b/gramps2/src/EditPerson.py index e5a13fc02..c31a39a33 100644 --- a/gramps2/src/EditPerson.py +++ b/gramps2/src/EditPerson.py @@ -828,7 +828,8 @@ class EditPerson: def name_drag_data_get(self,widget, context, sel_data, info, time): name = self.ntree.get_selected_objects() - + if not name: + return bits_per = 8; # we're going to pass a string pickled = pickle.dumps(name[0]); data = str((DdTargets.NAME.drag_type,self.person.get_handle(),pickled)); @@ -900,7 +901,8 @@ class EditPerson: def ev_drag_data_get(self,widget, context, sel_data, info, time): ev = self.etree.get_selected_objects() - + if not ev: + return bits_per = 8; # we're going to pass a string pickled = pickle.dumps(ev[0]); data = str((DdTargets.EVENT.drag_type,self.person.get_handle(),pickled)); diff --git a/gramps2/src/EditPlace.py b/gramps2/src/EditPlace.py index d5f176cae..f41ba2dae 100644 --- a/gramps2/src/EditPlace.py +++ b/gramps2/src/EditPlace.py @@ -314,11 +314,14 @@ class EditPlace: self.redraw_url_list() def url_source_drag_data_get(self,widget, context, sel_data, info, time): - - ev = self.web_model.get_selected_objects()[0] + store,node = self.web_list.get_selection().get_selected() + if not node: + return + row = store.get_path(node) + url = self.ulist[row[0]] bits_per = 8; # we're going to pass a string - pickled = pickle.dumps(ev); - data = str(('url',self.place.get_handle(),pickled)); + pickled = pickle.dumps(url) + data = str(('url',self.place.get_handle(),pickled)) sel_data.set(sel_data.target, bits_per, data) def update_lists(self): diff --git a/gramps2/src/EditSource.py b/gramps2/src/EditSource.py index bd2bac0e9..99c3061d5 100644 --- a/gramps2/src/EditSource.py +++ b/gramps2/src/EditSource.py @@ -255,16 +255,18 @@ class EditSource: def button_press(self,obj): data = self.model.get_selected_objects() - (type,handle) = data[0] - if type == 0: + if not data: + return + (data_type,handle) = data[0] + if data_type == 0: import EditPerson person = self.db.get_person_from_handle(handle) EditPerson.EditPerson(self.parent,person,self.db) - elif type == 1: + elif data_type == 1: import Marriage family = self.db.get_family_from_handle(handle) Marriage.Marriage(self.parent,family,self.db) - elif type == 2: + elif data_type == 2: import EventEdit event = self.db.get_event_from_handle(handle) event_name = event.get_name() @@ -280,11 +282,11 @@ class EditSource: EventEdit.EventEditor( self,", ", const.personalEvents, const.personal_events, event, None, 1, None, None, self.db.readonly) - elif type == 3: + elif data_type == 3: import EditPlace place = self.db.get_place_from_handle(handle) EditPlace.EditPlace(self.parent,place) - elif type == 5: + elif data_type == 5: import ImageSelect media = self.db.get_object_from_handle(handle) ImageSelect.GlobalMediaProperties(self.db,media,self) diff --git a/gramps2/src/ImageSelect.py b/gramps2/src/ImageSelect.py index 7511e82e6..b93fdb72f 100644 --- a/gramps2/src/ImageSelect.py +++ b/gramps2/src/ImageSelect.py @@ -291,6 +291,8 @@ class Gallery(ImageSelect): self.drag_item = widget.get_item_at(self.remember_x, self.remember_y) icon_index = self.get_index(widget,event.x,event.y)-1 + if icon_index == -1: + return self.sel_obj = self.dataobj.get_media_list()[icon_index] if self.drag_item: widget.drag_begin([DdTargets.MEDIAOBJ.target()]+_drag_targets, diff --git a/gramps2/src/Sources.py b/gramps2/src/Sources.py index b9ffef88c..c596ab62c 100644 --- a/gramps2/src/Sources.py +++ b/gramps2/src/Sources.py @@ -286,6 +286,8 @@ class SourceTab: def drag_data_get(self,widget, context, sel_data, info, time): store,node = self.selection.get_selected() + if not node: + return ev = store.get_value(node,2) bits_per = 8; # we're going to pass a string