0003162: adding pic to media gallery in person editor fails

svn: r13008
This commit is contained in:
Raphael Ackermann 2009-08-14 16:10:24 +00:00
parent 03ea29e183
commit 691088d116
2 changed files with 13 additions and 13 deletions

View File

@ -131,14 +131,14 @@ class AddMediaObject(ManagedWindow.ManagedWindow):
def build_menu_names(self, obj):
"""
Build the menu name for the window manager
Build the menu name for the window manager.
"""
return(_('Select media object'), None)
def save(self, *obj):
"""
Callback function called with the save button is pressed.
The media object is updated, and callback called
Callback function called when the save button is pressed.
The media object is updated, and callback called.
"""
description = unicode(self.description.get_text())
@ -151,15 +151,15 @@ class AddMediaObject(ManagedWindow.ManagedWindow):
filename = Utils.get_unicode_path(self.file_text.get_filename())
full_file = filename
pname = unicode(Utils.media_path(self.dbase))
if self.relpath.get_active():
filename = Utils.relative_path(filename, pname)
pname = unicode(Utils.media_path(self.dbase))
if not os.path.exists(pname):
msgstr = _("Cannot import %s")
msgstr2 = _("The filename supplied could not be found.")
ErrorDialog(msgstr % filename, msgstr2)
msgstr2 = _("Directory specified in preferences: Base path for relative media paths: %s does not exist. Change preferences or do not use relative path when importing")
ErrorDialog(msgstr % filename, msgstr2 % pname)
return
filename = Utils.relative_path(filename, pname)
mtype = Mime.get_type(full_file)
description = description or os.path.basename(filename)
@ -179,7 +179,7 @@ class AddMediaObject(ManagedWindow.ManagedWindow):
def on_name_changed(self, *obj):
"""
Called anytime the filename text window changes. Checks to
see if the file exists. If it does, the imgae is loaded into
see if the file exists. If it does, the image is loaded into
the preview window.
"""
fname = self.file_text.get_filename()

View File

@ -60,14 +60,14 @@ def _is_good_command(cmd):
return True
def get_description(type):
"""Return the description of the specified mime type"""
"""Return the description of the specified mime type."""
try:
return mime_get_description(type)
except:
return _("unknown")
def get_type(file):
"""Return the mime type of the specified file"""
"""Return the mime type of the specified file."""
try:
return get_mime_type(file)
except: