From: amphi Date: Tue, 9 Jan 2007 04:28:28 +0000 (+0000) Subject: added a "selected only" checkbox for fixing some obscure usability issue X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=7635f139f805c57c99a6e35330312d5c7d093924;p=inkscape.git added a "selected only" checkbox for fixing some obscure usability issue --- diff --git a/share/extensions/embedimage.inx b/share/extensions/embedimage.inx index eebd404a3..fd0c2e3b3 100644 --- a/share/extensions/embedimage.inx +++ b/share/extensions/embedimage.inx @@ -3,6 +3,7 @@ org.ekips.filter.embedimage embedimage.py inkex.py + false all diff --git a/share/extensions/embedimage.py b/share/extensions/embedimage.py index c7b00514b..964d1a5ec 100644 --- a/share/extensions/embedimage.py +++ b/share/extensions/embedimage.py @@ -22,16 +22,21 @@ import inkex, os, base64 class MyEffect(inkex.Effect): def __init__(self): inkex.Effect.__init__(self) + self.OptionParser.add_option("-s", "--selectedonly", + action="store", type="inkbool", + dest="selectedonly", default=False, + help="embed only selected images") def effect(self): ctx = inkex.xml.xpath.Context.Context(self.document,processorNss=inkex.NSS) - - # if there is a selection only embed selected images - # otherwise embed all images - if (self.options.ids): - for id, node in self.selected.iteritems(): - if node.tagName == 'image': - self.embedImage(node) + + # if slectedonly is enabled and there is a selection only embed selected + # images. otherwise embed all images + if (self.options.selectedonly): + if (self.options.ids): + for id, node in self.selected.iteritems(): + if node.tagName == 'image': + self.embedImage(node) else: path = '//image' for node in inkex.xml.xpath.Evaluate(path,self.document, context=ctx):