diff options
| author | su_v <suv-sf@users.sourceforge.net> | 2012-09-23 17:24:25 +0000 |
|---|---|---|
| committer | ~suv <suv-sf@users.sourceforge.net> | 2012-09-23 17:24:25 +0000 |
| commit | ac16411f213f98407fc42c1d04eb4ae6c187e4a6 (patch) | |
| tree | b8fd94caee6b202043810a7366ab3f032882a48f /share/extensions | |
| parent | add newly linked-in m4 files to .bzrignore (diff) | |
| parent | Fix for 170395 : Add Trace Bitmap to context menu of images : Focus fix (diff) | |
| download | inkscape-ac16411f213f98407fc42c1d04eb4ae6c187e4a6.tar.gz inkscape-ac16411f213f98407fc42c1d04eb4ae6c187e4a6.zip | |
merge from trunk (r11698)
(bzr r11668.1.10)
Diffstat (limited to 'share/extensions')
| -rw-r--r-- | share/extensions/Makefile.am | 2 | ||||
| -rw-r--r-- | share/extensions/inkscape_follow_link.inx | 13 | ||||
| -rw-r--r-- | share/extensions/inkscape_follow_link.py | 35 |
3 files changed, 50 insertions, 0 deletions
diff --git a/share/extensions/Makefile.am b/share/extensions/Makefile.am index 9fdfea24f..bb767d253 100644 --- a/share/extensions/Makefile.am +++ b/share/extensions/Makefile.am @@ -79,6 +79,7 @@ extensions = \ ink2canvas.py \ inkex.py \ Inkscape.pm \ + inkscape_follow_link.py \ inkwebeffect.py \ interp.py \ interp_att_g.py \ @@ -264,6 +265,7 @@ modules = \ handles.inx \ hpgl_output.inx \ ink2canvas.inx \ + inkscape_follow_link.inx \ inkscape_help_askaquestion.inx \ inkscape_help_commandline.inx \ inkscape_help_faq.inx\ diff --git a/share/extensions/inkscape_follow_link.inx b/share/extensions/inkscape_follow_link.inx new file mode 100644 index 000000000..d2ee0a8a1 --- /dev/null +++ b/share/extensions/inkscape_follow_link.inx @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> + <_name>Follow Link</_name> + <id>org.inkscape.followlink</id> + <dependency type="executable" location="extensions">inkscape_follow_link.py</dependency> + <effect needs-live-preview="false"> + <object-type>all</object-type> + <effects-menu hidden="true" /> + </effect> + <script> + <command reldir="extensions" interpreter="python">inkscape_follow_link.py</command> + </script> +</inkscape-extension> diff --git a/share/extensions/inkscape_follow_link.py b/share/extensions/inkscape_follow_link.py new file mode 100644 index 000000000..bf19cb84f --- /dev/null +++ b/share/extensions/inkscape_follow_link.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python + +import threading +import webbrowser + +import inkex + +class VisitWebSiteWithoutLockingInkscape(threading.Thread): + def __init__(self, url): + threading.Thread.__init__ (self) + self.url = url + + def run(self): + webbrowser.open(self.url) + +class FollowLink(inkex.Effect): + def __init__(self): + inkex.Effect.__init__(self) + + def effect(self): + if (self.options.ids): + for id, node in self.selected.iteritems(): + if node.tag == inkex.addNS('a','svg'): + self.url = node.get(inkex.addNS('href','xlink')) + vwswli = VisitWebSiteWithoutLockingInkscape(self.url) + vwswli.start() + #inkex.errormsg("Link: %s" % self.url) + break + + +if __name__ == '__main__': + e = FollowLink() + e.affect(output=False) + +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 fileencoding=utf-8 textwidth=99 |
