Improved reporting for traceback dialog, attempts to determine the distribution
svn: r1220
This commit is contained in:
parent
a1edffc260
commit
509800a470
Binary file not shown.
@ -88,7 +88,6 @@ class AddMediaObject:
|
|||||||
"destroy_passed_object" : Utils.destroy_passed_object
|
"destroy_passed_object" : Utils.destroy_passed_object
|
||||||
})
|
})
|
||||||
|
|
||||||
self.window.editable_enters(self.description)
|
|
||||||
self.window.show()
|
self.window.show()
|
||||||
|
|
||||||
def on_savephoto_clicked(self,obj):
|
def on_savephoto_clicked(self,obj):
|
||||||
@ -143,8 +142,10 @@ class AddMediaObject:
|
|||||||
|
|
||||||
if os.path.isfile(filename):
|
if os.path.isfile(filename):
|
||||||
type = Utils.get_mime_type(filename)
|
type = Utils.get_mime_type(filename)
|
||||||
if type[0:5] == 'image':
|
|
||||||
|
if type[0:5] == "image":
|
||||||
image = RelImage.scale_image(filename,const.thumbScale)
|
image = RelImage.scale_image(filename,const.thumbScale)
|
||||||
self.image.load_imlib(image)
|
self.image.set_from_pixbuf(image)
|
||||||
else:
|
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)
|
||||||
|
@ -26,12 +26,14 @@
|
|||||||
import cStringIO
|
import cStringIO
|
||||||
import traceback
|
import traceback
|
||||||
import sys
|
import sys
|
||||||
|
import os
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# GTK/GNOME modules
|
# GTK/GNOME modules
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
import gtk
|
||||||
import gtk.glade
|
import gtk.glade
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
@ -42,6 +44,14 @@ import gtk.glade
|
|||||||
import const
|
import const
|
||||||
from intl import gettext as _
|
from intl import gettext as _
|
||||||
|
|
||||||
|
_release_files = [
|
||||||
|
"/etc/redhat-release",
|
||||||
|
"/etc/mandrake-release",
|
||||||
|
"/etc/debian-release",
|
||||||
|
"/etc/SuSE-release",
|
||||||
|
"/etc/gentoo-release",
|
||||||
|
]
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# DisplayTrace
|
# DisplayTrace
|
||||||
@ -51,13 +61,28 @@ class DisplayTrace:
|
|||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
data = sys.exc_info()
|
data = sys.exc_info()
|
||||||
|
ver = sys.version_info
|
||||||
|
|
||||||
msg = cStringIO.StringIO()
|
msg = cStringIO.StringIO()
|
||||||
msg.write(_('GRAMPS %s has encountered an internal error.\n'
|
msg.write(_('GRAMPS has encountered an internal error.\n'
|
||||||
'Please copy the message below and post a bug report '
|
'Please copy the message below and post a bug report\n'
|
||||||
'at http://sourceforge.net/projects/gramps or send an '
|
'at http://sourceforge.net/projects/gramps or send an\n'
|
||||||
'email message to gramps-users@lists.sourceforge.net\n\n')
|
'email message to gramps-bugs@lists.sourceforge.net\n\n'))
|
||||||
% const.version)
|
|
||||||
|
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)
|
traceback.print_exception(data[0],data[1],data[2],None,msg)
|
||||||
|
|
||||||
self.glade = gtk.glade.XML(const.pluginsFile,"plugstat")
|
self.glade = gtk.glade.XML(const.pluginsFile,"plugstat")
|
||||||
|
@ -234,14 +234,11 @@ class Gallery(ImageSelect):
|
|||||||
self.photo = None
|
self.photo = None
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
pass
|
self.iconlist.hide()
|
||||||
# self.iconlist.hide()
|
self.canvas_list = None
|
||||||
# print self.canvas_list
|
self.p_map = None
|
||||||
# print self.p_map
|
|
||||||
# self.canvas_list = None
|
|
||||||
# self.p_map = None
|
|
||||||
# gc.collect()
|
# gc.collect()
|
||||||
# self.iconlist.destroy()
|
self.iconlist.destroy()
|
||||||
|
|
||||||
def on_canvas1_event(self,obj,event):
|
def on_canvas1_event(self,obj,event):
|
||||||
"""Handle resize events over the canvas, redrawing if the size changes"""
|
"""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)
|
item = widget.get_item_at(event.x,event.y)
|
||||||
if item:
|
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])
|
t.set(fill_color_gdk=style.fg[gtk.STATE_SELECTED])
|
||||||
b.set(fill_color_gdk=style.bg[gtk.STATE_SELECTED])
|
b.set(fill_color_gdk=style.bg[gtk.STATE_SELECTED])
|
||||||
if self.sel:
|
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])
|
t.set(fill_color_gdk=style.fg[gtk.STATE_NORMAL])
|
||||||
b.set(fill_color_gdk=style.bg[gtk.STATE_NORMAL])
|
b.set(fill_color_gdk=style.bg[gtk.STATE_NORMAL])
|
||||||
|
|
||||||
@ -285,7 +282,7 @@ class Gallery(ImageSelect):
|
|||||||
elif event.button == 3:
|
elif event.button == 3:
|
||||||
item = widget.get_item_at(event.x,event.y)
|
item = widget.get_item_at(event.x,event.y)
|
||||||
if item:
|
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)
|
self.show_popup(self.photo)
|
||||||
return gtk.TRUE
|
return gtk.TRUE
|
||||||
elif event.type == gtk.gdk.BUTTON_RELEASE:
|
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:
|
elif event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:
|
||||||
item = widget.get_item_at(event.x,event.y)
|
item = widget.get_item_at(event.x,event.y)
|
||||||
if item:
|
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)
|
LocalMediaProperties(self.photo,self.path,self)
|
||||||
return gtk.TRUE
|
return gtk.TRUE
|
||||||
elif event.type == gtk.gdk.MOTION_NOTIFY:
|
elif event.type == gtk.gdk.MOTION_NOTIFY:
|
||||||
@ -365,7 +362,7 @@ class Gallery(ImageSelect):
|
|||||||
self.cx = _PAD
|
self.cx = _PAD
|
||||||
self.cy = self.cy + _PAD + _IMAGEY
|
self.cy = self.cy + _PAD + _IMAGEY
|
||||||
else:
|
else:
|
||||||
self.cx = _PAD + self.cx + _IMAGEX
|
self.cx = self.cx + _PAD + _IMAGEX
|
||||||
|
|
||||||
def load_images(self):
|
def load_images(self):
|
||||||
"""clears the currentImages list to free up any cached
|
"""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."""
|
thumbnails, and remove it from the dataobj photo list."""
|
||||||
|
|
||||||
if self.sel:
|
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 = self.canvas_list[photo.getReference().getId()]
|
||||||
val[0].hide()
|
val[0].hide()
|
||||||
val[1].hide()
|
val[1].hide()
|
||||||
@ -591,7 +588,7 @@ class LocalMediaProperties:
|
|||||||
self.attr_details = self.change_dialog.get_widget("attr_details")
|
self.attr_details = self.change_dialog.get_widget("attr_details")
|
||||||
|
|
||||||
self.attr_list = self.change_dialog.get_widget("attr_list")
|
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.atree = ListModel.ListModel(self.attr_list,titles,
|
||||||
self.on_attr_list_select_row,
|
self.on_attr_list_select_row,
|
||||||
@ -723,7 +720,7 @@ class GlobalMediaProperties:
|
|||||||
|
|
||||||
self.attr_list = self.change_dialog.get_widget("attr_list")
|
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.atree = ListModel.ListModel(self.attr_list,titles,
|
||||||
self.on_attr_list_select_row,
|
self.on_attr_list_select_row,
|
||||||
|
@ -54,8 +54,9 @@ class ListModel:
|
|||||||
self.cids.append(name[1])
|
self.cids.append(name[1])
|
||||||
if name[1] != -1:
|
if name[1] != -1:
|
||||||
self.tree.append_column(column)
|
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()
|
self.connect_model()
|
||||||
|
|
||||||
if select_func:
|
if select_func:
|
||||||
|
@ -233,24 +233,27 @@ class MediaView:
|
|||||||
# self.list.moveto(0)
|
# self.list.moveto(0)
|
||||||
# self.list.thaw()
|
# self.list.thaw()
|
||||||
|
|
||||||
def create_add_dialog(self,obj):
|
def on_add_clicked(self,obj):
|
||||||
"""Add a new media object to the media list"""
|
"""Add a new media object to the media list"""
|
||||||
import AddMedia
|
import AddMedia
|
||||||
AddMedia.AddMediaObject(self.db,self.load_media)
|
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"""
|
"""Edit the properties of an existing media object in the media list"""
|
||||||
if len(self.list.selection) <= 0:
|
|
||||||
return
|
list_store, iter = self.selection.get_selected()
|
||||||
object = self.list.get_row_data(self.list.selection[0])
|
if iter:
|
||||||
ImageSelect.GlobalMediaProperties(self.db,object,self.load_media)
|
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):
|
def on_delete_clicked(self,obj):
|
||||||
if len(self.list.selection) <= 0:
|
store,iter = self.selection.get_selected()
|
||||||
|
if not iter:
|
||||||
return
|
return
|
||||||
else:
|
|
||||||
index = self.list.selection[0]
|
id = store.get_value(iter,1)
|
||||||
mobj = self.list.get_row_data(index)
|
mobj = self.db.getObject(id)
|
||||||
if self.is_object_used(mobj):
|
if self.is_object_used(mobj):
|
||||||
ans = ImageSelect.DeleteMediaQuery(mobj,self.db,self.update)
|
ans = ImageSelect.DeleteMediaQuery(mobj,self.db,self.update)
|
||||||
QuestionDialog(_('Delete Object'),
|
QuestionDialog(_('Delete Object'),
|
||||||
@ -258,12 +261,11 @@ class MediaView:
|
|||||||
"Delete anyway?"),
|
"Delete anyway?"),
|
||||||
ans.query_response)
|
ans.query_response)
|
||||||
else:
|
else:
|
||||||
map = self.db.getObjectMap()
|
self.db.removeObject(mobj.getId())
|
||||||
del map[mobj.getId()]
|
|
||||||
Utils.modified()
|
Utils.modified()
|
||||||
self.update(0)
|
self.update(0)
|
||||||
|
|
||||||
def is_media_object_used(self,mobj):
|
def is_object_used(self,mobj):
|
||||||
for p in self.db.getFamilyMap().values():
|
for p in self.db.getFamilyMap().values():
|
||||||
for o in p.getPhotoList():
|
for o in p.getPhotoList():
|
||||||
if o.getReference() == mobj:
|
if o.getReference() == mobj:
|
||||||
|
@ -2252,6 +2252,9 @@ class GrampsDB(Persistent):
|
|||||||
self.omapIndex = self.omapIndex + 1
|
self.omapIndex = self.omapIndex + 1
|
||||||
return index
|
return index
|
||||||
|
|
||||||
|
def getObject(self,id):
|
||||||
|
return self.objectMap[id]
|
||||||
|
|
||||||
def findObject(self,idVal,map):
|
def findObject(self,idVal,map):
|
||||||
"""finds an Object in the database using the idVal and map
|
"""finds an Object in the database using the idVal and map
|
||||||
variables to translate between the external ID and gramps'
|
variables to translate between the external ID and gramps'
|
||||||
@ -2303,6 +2306,9 @@ class GrampsDB(Persistent):
|
|||||||
self.placeTable[index] = place.getDisplayInfo()
|
self.placeTable[index] = place.getDisplayInfo()
|
||||||
return index
|
return index
|
||||||
|
|
||||||
|
def removeObject(self,id):
|
||||||
|
del self.placeMap[id]
|
||||||
|
|
||||||
def removePlace(self,id):
|
def removePlace(self,id):
|
||||||
del self.placeMap[id]
|
del self.placeMap[id]
|
||||||
del self.placeTable[id]
|
del self.placeTable[id]
|
||||||
|
@ -311,9 +311,6 @@ class Gramps:
|
|||||||
"on_edit_active_person" : self.load_active_person,
|
"on_edit_active_person" : self.load_active_person,
|
||||||
"on_edit_selected_people" : self.load_selected_people,
|
"on_edit_selected_people" : self.load_selected_people,
|
||||||
"on_edit_bookmarks_activate" : self.on_edit_bookmarks_activate,
|
"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_exit_activate" : self.on_exit_activate,
|
||||||
"on_family1_activate" : self.on_family1_activate,
|
"on_family1_activate" : self.on_family1_activate,
|
||||||
"on_find_activate" : self.on_find_activate,
|
"on_find_activate" : self.on_find_activate,
|
||||||
@ -326,7 +323,6 @@ class Gramps:
|
|||||||
"on_pedigree1_activate" : self.on_pedigree1_activate,
|
"on_pedigree1_activate" : self.on_pedigree1_activate,
|
||||||
"on_person_list1_activate" : self.on_person_list1_activate,
|
"on_person_list1_activate" : self.on_person_list1_activate,
|
||||||
"on_main_key_release_event" : self.on_main_key_release_event,
|
"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_activate" : self.on_media_activate,
|
||||||
"on_media_list_select_row" : self.media_view.on_select_row,
|
"on_media_list_select_row" : self.media_view.on_select_row,
|
||||||
"on_media_list_drag_data_get" : self.media_view.on_drag_data_get,
|
"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)
|
self.source_view.on_edit_clicked(obj)
|
||||||
elif cpage == 4:
|
elif cpage == 4:
|
||||||
self.place_view.on_edit_clicked(obj)
|
self.place_view.on_edit_clicked(obj)
|
||||||
|
elif cpage == 5:
|
||||||
|
self.media_view.on_edit_clicked(obj)
|
||||||
|
|
||||||
def add_button_clicked(self,obj):
|
def add_button_clicked(self,obj):
|
||||||
cpage = self.notebook.get_current_page()
|
cpage = self.notebook.get_current_page()
|
||||||
@ -380,6 +378,8 @@ class Gramps:
|
|||||||
self.source_view.on_add_clicked(obj)
|
self.source_view.on_add_clicked(obj)
|
||||||
elif cpage == 4:
|
elif cpage == 4:
|
||||||
self.place_view.on_add_place_clicked(obj)
|
self.place_view.on_add_place_clicked(obj)
|
||||||
|
elif cpage == 5:
|
||||||
|
self.media_view.on_add_clicked(obj)
|
||||||
|
|
||||||
def remove_button_clicked(self,obj):
|
def remove_button_clicked(self,obj):
|
||||||
cpage = self.notebook.get_current_page()
|
cpage = self.notebook.get_current_page()
|
||||||
@ -389,6 +389,8 @@ class Gramps:
|
|||||||
self.source_view.on_delete_clicked(obj)
|
self.source_view.on_delete_clicked(obj)
|
||||||
elif cpage == 4:
|
elif cpage == 4:
|
||||||
self.place_view.on_delete_clicked(obj)
|
self.place_view.on_delete_clicked(obj)
|
||||||
|
elif cpage == 5:
|
||||||
|
self.media_view.on_delete_clicked(obj)
|
||||||
|
|
||||||
def enable_buttons(self,val):
|
def enable_buttons(self,val):
|
||||||
self.addbtn.set_sensitive(val)
|
self.addbtn.set_sensitive(val)
|
||||||
|
@ -135,6 +135,8 @@
|
|||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkImage" id="image">
|
<widget class="GtkImage" id="image">
|
||||||
|
<property name="width_request">100</property>
|
||||||
|
<property name="height_request">100</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="xalign">0.5</property>
|
<property name="xalign">0.5</property>
|
||||||
<property name="yalign">0.5</property>
|
<property name="yalign">0.5</property>
|
||||||
|
Loading…
Reference in New Issue
Block a user