0003162: adding pic to media gallery in person editor fails
svn: r13008
This commit is contained in:
parent
03ea29e183
commit
691088d116
@ -131,14 +131,14 @@ class AddMediaObject(ManagedWindow.ManagedWindow):
|
|||||||
|
|
||||||
def build_menu_names(self, obj):
|
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)
|
return(_('Select media object'), None)
|
||||||
|
|
||||||
def save(self, *obj):
|
def save(self, *obj):
|
||||||
"""
|
"""
|
||||||
Callback function called with the save button is pressed.
|
Callback function called when the save button is pressed.
|
||||||
The media object is updated, and callback called
|
The media object is updated, and callback called.
|
||||||
"""
|
"""
|
||||||
description = unicode(self.description.get_text())
|
description = unicode(self.description.get_text())
|
||||||
|
|
||||||
@ -151,15 +151,15 @@ class AddMediaObject(ManagedWindow.ManagedWindow):
|
|||||||
filename = Utils.get_unicode_path(self.file_text.get_filename())
|
filename = Utils.get_unicode_path(self.file_text.get_filename())
|
||||||
full_file = filename
|
full_file = filename
|
||||||
|
|
||||||
pname = unicode(Utils.media_path(self.dbase))
|
|
||||||
if self.relpath.get_active():
|
if self.relpath.get_active():
|
||||||
filename = Utils.relative_path(filename, pname)
|
pname = unicode(Utils.media_path(self.dbase))
|
||||||
|
|
||||||
if not os.path.exists(pname):
|
if not os.path.exists(pname):
|
||||||
msgstr = _("Cannot import %s")
|
msgstr = _("Cannot import %s")
|
||||||
msgstr2 = _("The filename supplied could not be found.")
|
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)
|
ErrorDialog(msgstr % filename, msgstr2 % pname)
|
||||||
return
|
return
|
||||||
|
filename = Utils.relative_path(filename, pname)
|
||||||
|
|
||||||
|
|
||||||
mtype = Mime.get_type(full_file)
|
mtype = Mime.get_type(full_file)
|
||||||
description = description or os.path.basename(filename)
|
description = description or os.path.basename(filename)
|
||||||
@ -179,7 +179,7 @@ class AddMediaObject(ManagedWindow.ManagedWindow):
|
|||||||
def on_name_changed(self, *obj):
|
def on_name_changed(self, *obj):
|
||||||
"""
|
"""
|
||||||
Called anytime the filename text window changes. Checks to
|
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.
|
the preview window.
|
||||||
"""
|
"""
|
||||||
fname = self.file_text.get_filename()
|
fname = self.file_text.get_filename()
|
||||||
|
@ -60,14 +60,14 @@ def _is_good_command(cmd):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def get_description(type):
|
def get_description(type):
|
||||||
"""Return the description of the specified mime type"""
|
"""Return the description of the specified mime type."""
|
||||||
try:
|
try:
|
||||||
return mime_get_description(type)
|
return mime_get_description(type)
|
||||||
except:
|
except:
|
||||||
return _("unknown")
|
return _("unknown")
|
||||||
|
|
||||||
def get_type(file):
|
def get_type(file):
|
||||||
"""Return the mime type of the specified file"""
|
"""Return the mime type of the specified file."""
|
||||||
try:
|
try:
|
||||||
return get_mime_type(file)
|
return get_mime_type(file)
|
||||||
except:
|
except:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user