From 509800a47096e3ed2546b9a6328e49d0ea946713 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Wed, 11 Dec 2002 05:18:47 +0000 Subject: [PATCH] Improved reporting for traceback dialog, attempts to determine the distribution svn: r1220 --- gramps2/example/gramps/data.gramps | Bin 3801 -> 3770 bytes gramps2/src/AddMedia.py | 9 +++---- gramps2/src/DisplayTrace.py | 37 ++++++++++++++++++++++++----- gramps2/src/ImageSelect.py | 27 ++++++++++----------- gramps2/src/ListModel.py | 5 ++-- gramps2/src/MediaView.py | 28 ++++++++++++---------- gramps2/src/RelLib.py | 6 +++++ gramps2/src/gramps_main.py | 10 ++++---- gramps2/src/imagesel.glade | 2 ++ 9 files changed, 80 insertions(+), 44 deletions(-) diff --git a/gramps2/example/gramps/data.gramps b/gramps2/example/gramps/data.gramps index 7283cfcf7cfcb1305184a4ad52dab4c9e2834e8d..10666b1b7ede4c94287662e894183a9ee58be042 100644 GIT binary patch delta 3695 zcmV-#4v_KL9l9L{ABzYG<-+oj2RlO@Yj4{)@_T;;&mRtVKx~V8SQ0MHUg9QAvrQAk zySFF~hXZ5Lv06zqC^@PB{R%0`meWvXWX6ZZ7F$^)XNEJwd6AKaIe)s=Jx<;sbUddd zqFg+}k1405ppk$<-}ij<;e3p2%d&eLeAXZwSp5a3qaIpNwn(6(3(qr>#z{gL_zAWwG#Q|4 z5@%>q3}i>y(C9dgi+|P0WWnR?VHVRQlAYwsMyI@hd7gZsPv|S--({EbRTB_fW(8lJ z{60A?VN|~xT^0;RB`4T+Tu=6?UNpPRSw>GB$LV{X*AIQ$E<4KCjeayGadL9c?sLI{ zf95QuPrxNQ$Y>!)lpRVg4!7BOJlx3gxD*PC=!`6r;(hOvHyg@3l+w`};MMC7RPEC`36pr*3t1;*g`>9yZl=@af`1fX;J0W2Ysce-czrTqv*HP~ z8J%YjaYltcHJdeXoJY&)&nRHJoMaCafyLy7n6e*&`zY8#JO?ck*IwQaoYEE+Kf}?S z)!AS&IEVkV=F0BBt@(b_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)N;?h8@afz}~|L4_vtc?V5B6?Dpf>h?Z@ukW_I)vo9elWtt$gn$JymC z*?~zT8#UCW0hUD)y%lSfAOZBZFKlo9L}NBMLgUl5ytaurYa(|n z%jgk0V?3L)Bwc?SK+(`zH~h>Z%9o2H5LuG4WsW|JZ=_A0XhbtbW4!6Qyybp>g#IA; zoYAtgU;d?N=B}Gn-%vY3zlz&VG0F0RL>i2PHHAyEdLleJLZ=ByX+(D56s{YNS(+}h zxLCu9 z9)$WxxfCw^T?+a})o!C=A35uP)=|7sl=8m6mZWh*Lt0_**Y$n_xsWa$bQ+@l>B|@@ zzPLI03WDxfPJj{1Sh`DM4~$ncWIWJiY`Ym4n2fj$EpCi#kwujMv4DmEJ|R1kvKwMS+dK* z*}=An)3$JSv%^zPgtsWIYyG^<_;|Rn)x!Ow)1tQ9rrO!xze&A$Q{P&ErDOf`K->{Li-y%P%$&Ut$X!a6$`Fe}?q@coB zi!aC6mW5xW>(z9tVQ~?{%Vjl%nH0j(5eYqS_B*4 s>S*@zc-WY6$M=kV7ZbalfA#NY&hzoGQSo@V`KLDi2P5f<;J0G{09>a(6#xJL diff --git a/gramps2/src/AddMedia.py b/gramps2/src/AddMedia.py index dd5a9c2e3..d5d7006fe 100644 --- a/gramps2/src/AddMedia.py +++ b/gramps2/src/AddMedia.py @@ -88,7 +88,6 @@ class AddMediaObject: "destroy_passed_object" : Utils.destroy_passed_object }) - self.window.editable_enters(self.description) self.window.show() def on_savephoto_clicked(self,obj): @@ -143,8 +142,10 @@ class AddMediaObject: if os.path.isfile(filename): type = Utils.get_mime_type(filename) - if type[0:5] == 'image': + + if type[0:5] == "image": image = RelImage.scale_image(filename,const.thumbScale) - self.image.load_imlib(image) + self.image.set_from_pixbuf(image) else: - self.image.load_file(Utils.find_icon(type)) + i = gtk.gdk.pixbuf_new_from_file(Utils.find_icon(type)) + self.image.set_from_pixbuf(i) diff --git a/gramps2/src/DisplayTrace.py b/gramps2/src/DisplayTrace.py index b9dd97e4d..3ae5de156 100644 --- a/gramps2/src/DisplayTrace.py +++ b/gramps2/src/DisplayTrace.py @@ -26,12 +26,14 @@ import cStringIO import traceback import sys +import os #------------------------------------------------------------------------- # # GTK/GNOME modules # #------------------------------------------------------------------------- +import gtk import gtk.glade #------------------------------------------------------------------------- @@ -42,6 +44,14 @@ import gtk.glade import const from intl import gettext as _ +_release_files = [ + "/etc/redhat-release", + "/etc/mandrake-release", + "/etc/debian-release", + "/etc/SuSE-release", + "/etc/gentoo-release", + ] + #------------------------------------------------------------------------- # # DisplayTrace @@ -51,13 +61,28 @@ class DisplayTrace: def __init__(self): data = sys.exc_info() + ver = sys.version_info + msg = cStringIO.StringIO() - msg.write(_('GRAMPS %s has encountered an internal error.\n' - 'Please copy the message below and post a bug report ' - 'at http://sourceforge.net/projects/gramps or send an ' - 'email message to gramps-users@lists.sourceforge.net\n\n') - % const.version) - + msg.write(_('GRAMPS has encountered an internal error.\n' + 'Please copy the message below and post a bug report\n' + 'at http://sourceforge.net/projects/gramps or send an\n' + 'email message to gramps-bugs@lists.sourceforge.net\n\n')) + + msg.write("GRAMPS : %s\n" % const.version) + msg.write("Python : %s.%s.%s %s\n" % (ver[0],ver[1],ver[2],ver[3])) + msg.write("GTK : %s.%s.%s\n" % gtk.gtk_version) + for n in _release_files: + if os.path.isfile(n): + try: + f = open(n) + text = f.readline() + msg.write("OS : %s\n" % text) + f.close() + break + except: + pass + traceback.print_exception(data[0],data[1],data[2],None,msg) self.glade = gtk.glade.XML(const.pluginsFile,"plugstat") diff --git a/gramps2/src/ImageSelect.py b/gramps2/src/ImageSelect.py index 722d0a510..b8e7d346e 100644 --- a/gramps2/src/ImageSelect.py +++ b/gramps2/src/ImageSelect.py @@ -234,14 +234,11 @@ class Gallery(ImageSelect): self.photo = None def close(self): - pass -# self.iconlist.hide() -# print self.canvas_list -# print self.p_map -# self.canvas_list = None -# self.p_map = None + self.iconlist.hide() + self.canvas_list = None + self.p_map = None # gc.collect() -# self.iconlist.destroy() + self.iconlist.destroy() def on_canvas1_event(self,obj,event): """Handle resize events over the canvas, redrawing if the size changes""" @@ -267,11 +264,11 @@ class Gallery(ImageSelect): item = widget.get_item_at(event.x,event.y) if item: - (i,t,b,self.photo) = self.p_map[item] + (i,t,b,self.photo,oid) = self.p_map[item] t.set(fill_color_gdk=style.fg[gtk.STATE_SELECTED]) b.set(fill_color_gdk=style.bg[gtk.STATE_SELECTED]) if self.sel: - (i,t,b,photo) = self.p_map[self.sel] + (i,t,b,photo,oid) = self.p_map[self.sel] t.set(fill_color_gdk=style.fg[gtk.STATE_NORMAL]) b.set(fill_color_gdk=style.bg[gtk.STATE_NORMAL]) @@ -285,7 +282,7 @@ class Gallery(ImageSelect): elif event.button == 3: item = widget.get_item_at(event.x,event.y) if item: - (i,t,b,self.photo) = self.p_map[item] + (i,t,b,self.photo,oid) = self.p_map[item] self.show_popup(self.photo) return gtk.TRUE elif event.type == gtk.gdk.BUTTON_RELEASE: @@ -293,7 +290,7 @@ class Gallery(ImageSelect): elif event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1: item = widget.get_item_at(event.x,event.y) if item: - (i,t,b,self.photo) = self.p_map[item] + (i,t,b,self.photo,oid) = self.p_map[item] LocalMediaProperties(self.photo,self.path,self) return gtk.TRUE elif event.type == gtk.gdk.MOTION_NOTIFY: @@ -365,7 +362,7 @@ class Gallery(ImageSelect): self.cx = _PAD self.cy = self.cy + _PAD + _IMAGEY else: - self.cx = _PAD + self.cx + _IMAGEX + self.cx = self.cx + _PAD + _IMAGEX def load_images(self): """clears the currentImages list to free up any cached @@ -502,7 +499,7 @@ class Gallery(ImageSelect): thumbnails, and remove it from the dataobj photo list.""" if self.sel: - (i,t,b,photo) = self.p_map[self.sel] + (i,t,b,photo,oid) = self.p_map[self.sel] val = self.canvas_list[photo.getReference().getId()] val[0].hide() val[1].hide() @@ -591,7 +588,7 @@ class LocalMediaProperties: self.attr_details = self.change_dialog.get_widget("attr_details") self.attr_list = self.change_dialog.get_widget("attr_list") - titles = [(_('Attribute'),-1,150),(_('Value'),-1,100)] + titles = [(_('Attribute'),0,150),(_('Value'),0,100)] self.atree = ListModel.ListModel(self.attr_list,titles, self.on_attr_list_select_row, @@ -723,7 +720,7 @@ class GlobalMediaProperties: self.attr_list = self.change_dialog.get_widget("attr_list") - titles = [(_('Attribute'),-1,150),(_('Value'),-1,100)] + titles = [(_('Attribute'),0,150),(_('Value'),1,100)] self.atree = ListModel.ListModel(self.attr_list,titles, self.on_attr_list_select_row, diff --git a/gramps2/src/ListModel.py b/gramps2/src/ListModel.py index 95947fa2e..41c008ab4 100644 --- a/gramps2/src/ListModel.py +++ b/gramps2/src/ListModel.py @@ -54,8 +54,9 @@ class ListModel: self.cids.append(name[1]) if name[1] != -1: self.tree.append_column(column) - - self.model.set_sort_column_id(self.cids[0],gtk.SORT_ASCENDING) + + if self.cids[0] > 0: + self.model.set_sort_column_id(self.cids[0],gtk.SORT_ASCENDING) self.connect_model() if select_func: diff --git a/gramps2/src/MediaView.py b/gramps2/src/MediaView.py index ff7296a17..901518792 100644 --- a/gramps2/src/MediaView.py +++ b/gramps2/src/MediaView.py @@ -233,24 +233,27 @@ class MediaView: # self.list.moveto(0) # self.list.thaw() - def create_add_dialog(self,obj): + def on_add_clicked(self,obj): """Add a new media object to the media list""" import AddMedia AddMedia.AddMediaObject(self.db,self.load_media) - def on_edit_media_clicked(self,obj): + def on_edit_clicked(self,obj): """Edit the properties of an existing media object in the media list""" - if len(self.list.selection) <= 0: - return - object = self.list.get_row_data(self.list.selection[0]) - ImageSelect.GlobalMediaProperties(self.db,object,self.load_media) + + list_store, iter = self.selection.get_selected() + if iter: + id = list_store.get_value(iter,1) + object = self.db.getObject(id) + ImageSelect.GlobalMediaProperties(self.db,object,self.load_media) def on_delete_clicked(self,obj): - if len(self.list.selection) <= 0: + store,iter = self.selection.get_selected() + if not iter: return - else: - index = self.list.selection[0] - mobj = self.list.get_row_data(index) + + id = store.get_value(iter,1) + mobj = self.db.getObject(id) if self.is_object_used(mobj): ans = ImageSelect.DeleteMediaQuery(mobj,self.db,self.update) QuestionDialog(_('Delete Object'), @@ -258,12 +261,11 @@ class MediaView: "Delete anyway?"), ans.query_response) else: - map = self.db.getObjectMap() - del map[mobj.getId()] + self.db.removeObject(mobj.getId()) Utils.modified() self.update(0) - def is_media_object_used(self,mobj): + def is_object_used(self,mobj): for p in self.db.getFamilyMap().values(): for o in p.getPhotoList(): if o.getReference() == mobj: diff --git a/gramps2/src/RelLib.py b/gramps2/src/RelLib.py index cb4485712..47b58eaf5 100644 --- a/gramps2/src/RelLib.py +++ b/gramps2/src/RelLib.py @@ -2252,6 +2252,9 @@ class GrampsDB(Persistent): self.omapIndex = self.omapIndex + 1 return index + def getObject(self,id): + return self.objectMap[id] + def findObject(self,idVal,map): """finds an Object in the database using the idVal and map variables to translate between the external ID and gramps' @@ -2303,6 +2306,9 @@ class GrampsDB(Persistent): self.placeTable[index] = place.getDisplayInfo() return index + def removeObject(self,id): + del self.placeMap[id] + def removePlace(self,id): del self.placeMap[id] del self.placeTable[id] diff --git a/gramps2/src/gramps_main.py b/gramps2/src/gramps_main.py index 188cca6e0..00d6d5d56 100755 --- a/gramps2/src/gramps_main.py +++ b/gramps2/src/gramps_main.py @@ -311,9 +311,6 @@ class Gramps: "on_edit_active_person" : self.load_active_person, "on_edit_selected_people" : self.load_selected_people, "on_edit_bookmarks_activate" : self.on_edit_bookmarks_activate, - "on_edit_media_clicked" : self.media_view.on_edit_media_clicked, - "on_edit_place_clicked" : self.place_view.on_edit_clicked, - "on_edit_source_clicked" : self.source_view.on_edit_clicked, "on_exit_activate" : self.on_exit_activate, "on_family1_activate" : self.on_family1_activate, "on_find_activate" : self.on_find_activate, @@ -326,7 +323,6 @@ class Gramps: "on_pedigree1_activate" : self.on_pedigree1_activate, "on_person_list1_activate" : self.on_person_list1_activate, "on_main_key_release_event" : self.on_main_key_release_event, - "on_add_media_clicked" : self.media_view.create_add_dialog, "on_media_activate" : self.on_media_activate, "on_media_list_select_row" : self.media_view.on_select_row, "on_media_list_drag_data_get" : self.media_view.on_drag_data_get, @@ -371,6 +367,8 @@ class Gramps: self.source_view.on_edit_clicked(obj) elif cpage == 4: self.place_view.on_edit_clicked(obj) + elif cpage == 5: + self.media_view.on_edit_clicked(obj) def add_button_clicked(self,obj): cpage = self.notebook.get_current_page() @@ -380,6 +378,8 @@ class Gramps: self.source_view.on_add_clicked(obj) elif cpage == 4: self.place_view.on_add_place_clicked(obj) + elif cpage == 5: + self.media_view.on_add_clicked(obj) def remove_button_clicked(self,obj): cpage = self.notebook.get_current_page() @@ -389,6 +389,8 @@ class Gramps: self.source_view.on_delete_clicked(obj) elif cpage == 4: self.place_view.on_delete_clicked(obj) + elif cpage == 5: + self.media_view.on_delete_clicked(obj) def enable_buttons(self,val): self.addbtn.set_sensitive(val) diff --git a/gramps2/src/imagesel.glade b/gramps2/src/imagesel.glade index d1ebd761b..30019b6ac 100644 --- a/gramps2/src/imagesel.glade +++ b/gramps2/src/imagesel.glade @@ -135,6 +135,8 @@ + 100 + 100 True 0.5 0.5