summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbulia byak <buliabyak@gmail.com>2007-02-20 03:15:12 +0000
committerbuliabyak <buliabyak@users.sourceforge.net>2007-02-20 03:15:12 +0000
commit0792d55e2038a4cfa33d6350811eddeee960a2be (patch)
treeae2cccc921ad30b26b6aaa17ecfbe0dcaf5f2520
parentCleaned up DOS line ends that had snuck in. (diff)
downloadinkscape-0792d55e2038a4cfa33d6350811eddeee960a2be.tar.gz
inkscape-0792d55e2038a4cfa33d6350811eddeee960a2be.zip
fix the order of searching for linked image file to match that of inkscape itself: first href, only if it fails absref
(bzr r2400)
-rw-r--r--share/extensions/embedimage.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/share/extensions/embedimage.py b/share/extensions/embedimage.py
index 81380c165..5277f0fa4 100644
--- a/share/extensions/embedimage.py
+++ b/share/extensions/embedimage.py
@@ -51,21 +51,22 @@ class MyEffect(inkex.Effect):
path=''
#path selection strategy:
- # 1. absref
- # 2. href if absolute
- # 3. sodipodi:docbase + href
- # 4. realpath-ified href
- if (absref != None):
- path=absref.value
- elif (href != None):
+ # 1. href if absolute
+ # 2. sodipodi:docbase + href
+ # 3. realpath-ified href
+ # 4. absref, only if the above does not point to a file
+ if (href != None):
if (os.path.isabs(href.value)):
path=os.path.realpath(href.value)
elif (docbase != None):
path=os.path.join(docbase.value,href.value)
else:
path=os.path.realpath(href.value)
- else:
- inkex.debug('No xlink:href or sodipodi:absref attributes found! Unable to embed image.')
+ if (not os.path.isfile(path)):
+ if (absref != None):
+ path=absref.value
+ if (not os.path.isfile(path)):
+ inkex.debug('No xlink:href or sodipodi:absref attributes found, or they do not point to an existing file! Unable to embed image.')
if (os.path.isfile(path)):
file = open(path,"rb").read()