* src/DbPrompter.py: Try to give a more intelligent error message on an

exception thrown in DbPrompter - don't give a traceback.
* src/MediaView.py: clear out details and image if unselected


svn: r5938
This commit is contained in:
Don Allingham 2006-02-14 19:27:03 +00:00
parent c1b12a893f
commit 810a80da51
3 changed files with 55 additions and 46 deletions

View File

@ -1,3 +1,8 @@
2006-02-14 Don Allingham <don@gramps-project.org>
* src/DbPrompter.py: Try to give a more intelligent error message on an
exception thrown in DbPrompter - don't give a traceback.
* src/MediaView.py: clear out details and image if unselected
2006-02-14 Alex Roitman <shura@gramps-project.org>
* src/ReportUtils.py (buried_str): Change the logic to be the same
as in born_str: first test for modified date, then full date, then

View File

@ -138,29 +138,28 @@ class DbPrompter:
top.show()
response = top.run()
top.hide()
if response == gtk.RESPONSE_OK:
if recent.get_active():
try:
try:
if response == gtk.RESPONSE_OK:
if recent.get_active():
(filename,filetype) = self.recent_files[filelist.get_active()]
if open_native(self.parent,filename,filetype):
break
except RuntimeError,msg:
QuestionDialog.ErrorDialog(
_("Could not open file: %s") % self.recent_file,
str(msg))
continue
elif new.get_active():
prompter = NewNativeDbPrompter(self.parent,
self.parent_window)
else:
prompter = ExistingDbPrompter(self.parent,
continue
elif new.get_active():
prompter = NewNativeDbPrompter(self.parent,
self.parent_window)
else:
prompter = ExistingDbPrompter(self.parent,
self.parent_window)
if prompter.chooser():
if prompter.chooser():
break
elif response == gtk.RESPONSE_CANCEL:
break
elif response == gtk.RESPONSE_CANCEL:
break
elif response == gtk.RESPONSE_HELP:
GrampsDisplay.help('choose-db-start')
elif response == gtk.RESPONSE_HELP:
GrampsDisplay.help('choose-db-start')
except:
import sys
QuestionDialog.ErrorDialog(_("Could not open file"),str(sys.exc_info()[1]))
top.destroy()
if response == gtk.RESPONSE_CANCEL:

View File

@ -227,36 +227,41 @@ class MediaView:
store,node = self.selection.get_selected()
if not node:
return
handle = store.get_value(node,_HANDLE_COL)
mobj = self.db.get_object_from_handle(handle)
mtype = mobj.get_mime_type()
path = mobj.get_path()
if mtype:
type_name = Utils.get_mime_description(mtype)
image = ImgManip.get_thumbnail_image(path,mtype)
else:
image = Utils.find_mime_type_pixbuf('text/plain')
type_name = _('Note')
self.preview.set_from_pixbuf(image)
del image
gc.collect()
self.mid.set_text(mobj.get_gramps_id())
if type_name:
self.mtype.set_text(type_name)
else:
self.mtype.set_text(_('unknown'))
self.mdesc.set_text(mobj.get_description())
if type_name == _('Note'):
self.preview.set_from_pixbuf(None)
self.mid.set_text('')
self.mdesc.set_text('')
self.mpath.set_text('')
elif len(path) == 0 or fexists == 0:
self.mpath.set_text(_("The file no longer exists"))
self.mdetails.set_text('')
self.mtype.set_text('')
else:
self.mpath.set_text(path)
self.mdetails.set_text(Utils.get_detail_text(mobj,0))
handle = store.get_value(node,_HANDLE_COL)
mobj = self.db.get_object_from_handle(handle)
mtype = mobj.get_mime_type()
path = mobj.get_path()
if mtype:
type_name = Utils.get_mime_description(mtype)
image = ImgManip.get_thumbnail_image(path,mtype)
else:
image = Utils.find_mime_type_pixbuf('text/plain')
type_name = _('Note')
self.preview.set_from_pixbuf(image)
del image
gc.collect()
self.mid.set_text(mobj.get_gramps_id())
if type_name:
self.mtype.set_text(type_name)
else:
self.mtype.set_text(_('unknown'))
self.mdesc.set_text(mobj.get_description())
if type_name == _('Note'):
self.mpath.set_text('')
elif len(path) == 0 or fexists == 0:
self.mpath.set_text(_("The file no longer exists"))
else:
self.mpath.set_text(path)
self.mdetails.set_text(Utils.get_detail_text(mobj,0))
def on_button_press_event(self,obj,event):
if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1: