Code

render_alphabetsoup now can be used as a module and is a more testable code
authoraurium <aurium@users.sourceforge.net>
Tue, 14 Apr 2009 22:36:11 +0000 (22:36 +0000)
committeraurium <aurium@users.sourceforge.net>
Tue, 14 Apr 2009 22:36:11 +0000 (22:36 +0000)
share/extensions/render_alphabetsoup.py

index f741eaa578ee236ac54e2e257b82d79b5cce19f5..6bc38459b70863d1c65270dde23f97827f1bd255 100644 (file)
@@ -39,7 +39,11 @@ font  = render_alphabetsoup_config.font
 
 # Loads a super-path from a given SVG file
 def loadPath( svgPath ):
-       extensionDir = os.path.normpath(os.path.join(os.getcwd(),os.path.dirname(sys.argv[0])))
+       extensionDir = os.path.normpath(
+                           os.path.join( os.getcwd(), os.path.dirname(__file__) )
+                         )
+       # __file__ is better then sys.argv[0] because this file may be a module
+       # for another one.
        tree = inkex.etree.parse( extensionDir + "/" + svgPath )
        root = tree.getroot()
        pathElement = root.find('{http://www.w3.org/2000/svg}path')