diff options
| author | Nicolas Dufour <nicoduf@yahoo.fr> | 2010-04-15 19:56:04 +0000 |
|---|---|---|
| committer | JazzyNico <nicoduf@yahoo.fr> | 2010-04-15 19:56:04 +0000 |
| commit | e28c1beffbc01f79a15c5ecce34296e49865d115 (patch) | |
| tree | a0c0ac2ad3880cd1ffb83f95b358ae519764f01f | |
| parent | filterUnits and primitiveUnits are now actually read/set, percentages for pri... (diff) | |
| download | inkscape-e28c1beffbc01f79a15c5ecce34296e49865d115.tar.gz inkscape-e28c1beffbc01f79a15c5ecce34296e49865d115.zip | |
Extensions. Extract Image fix for uppercase image type, and default path set to the user's home directory.
Fixed bugs:
- https://launchpad.net/bugs/554734
(bzr r9336)
| -rw-r--r-- | share/extensions/extractimage.inx | 5 | ||||
| -rw-r--r-- | share/extensions/extractimage.py | 10 |
2 files changed, 11 insertions, 4 deletions
diff --git a/share/extensions/extractimage.inx b/share/extensions/extractimage.inx index 364898c51..984dc9aef 100644 --- a/share/extensions/extractimage.inx +++ b/share/extensions/extractimage.inx @@ -4,8 +4,9 @@ <id>org.ekips.filter.extractimage</id> <dependency type="executable" location="extensions">extractimage.py</dependency> <dependency type="executable" location="extensions">inkex.py</dependency> - <param name="filepath" type="string" _gui-text="Path to save image">none</param> - <_param name="desc" type="description">Note: The file extension is appended automatically.</_param> + <param name="filepath" type="string" _gui-text="Path to save image:">none</param> + <_param name="desc" type="description" xml:space="preserve">* Don't type the file extension, it is appended automatically. +* A relative path (or a filename without path) is relative to the user's home directory.</_param> <effect needs-live-preview="false"> <object-type>all</object-type> <effects-menu> diff --git a/share/extensions/extractimage.py b/share/extensions/extractimage.py index 8b47de958..4093b94a7 100644 --- a/share/extensions/extractimage.py +++ b/share/extensions/extractimage.py @@ -54,10 +54,16 @@ class MyEffect(inkex.Effect): semicolon = xlink.find(';') if semicolon>0: for sub in mimesubext.keys(): - if sub in xlink[5:semicolon]: + if sub in xlink[5:semicolon].lower(): fileext=mimesubext[sub] path=path+fileext; - break + if (not os.path.isabs(path)): + if os.name == 'nt': + path = os.path.join(os.environ['USERPROFILE'],path) + else: + path = os.path.join(os.path.expanduser("~"),path) + inkex.errormsg(_('Image extracted to: %s') % path) + break #save data = base64.decodestring(xlink[comma:]) open(path,'wb').write(data) |
