1
0
Fork 0
inkscape/share/extensions/inkscape_follow_link.py
Daniel Baumann 02d935e272
Adding upstream version 1.4.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-22 23:40:13 +02:00

33 lines
694 B
Python
Executable file

#!/usr/bin/env python3
# coding=utf-8
import threading
import webbrowser
import inkex
from inkex import Anchor
class ThreadWebsite(threading.Thread):
"""Visit the website without locking inkscape"""
def __init__(self, url):
threading.Thread.__init__(self)
self.url = url
def run(self):
webbrowser.open(self.url)
class FollowLink(inkex.EffectExtension):
"""Get the first selected item and follow it's href/url"""
def effect(self):
for node in self.svg.selection.filter(Anchor):
vwswli = ThreadWebsite(node.get("xlink:href"))
vwswli.start()
break
if __name__ == "__main__":
FollowLink().run()