Revert "try to make icon-render-script more robust regarding the output destination"
This reverts commit bd538edfe9.
Conflicts:
admin/render-icon.py
This commit is contained in:
parent
081b630a9c
commit
d9b747a544
1 changed files with 12 additions and 19 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
#
|
|
||||||
# render-icons.py - Icon rendering utility script
|
# render-icons.py - Icon rendering utility script
|
||||||
#
|
#
|
||||||
# Copyright (C) Lumiera.org
|
# Copyright (C) Lumiera.org
|
||||||
|
|
@ -20,10 +20,9 @@
|
||||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import os
|
|
||||||
import os.path as Path
|
|
||||||
import getopt
|
import getopt
|
||||||
from xml.dom import minidom
|
from xml.dom import minidom
|
||||||
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
#svgDir = "svg"
|
#svgDir = "svg"
|
||||||
|
|
@ -33,20 +32,14 @@ rsvgPath = "./rsvg-convert"
|
||||||
artworkLayerPrefix = "artwork:"
|
artworkLayerPrefix = "artwork:"
|
||||||
|
|
||||||
def createDirectory( name ):
|
def createDirectory( name ):
|
||||||
if Path.isfile(name):
|
if os.path.exists(name) == False:
|
||||||
print "WARNING: moving %s to %s.bak because it's in the way." % (name,name)
|
|
||||||
bak_name = name + ".bak"
|
|
||||||
if Path.isfile(bak_name):
|
|
||||||
os.remove(bak_name)
|
|
||||||
os.rename(name,bak_name)
|
|
||||||
if not Path.isdir(name):
|
|
||||||
os.mkdir(name)
|
os.mkdir(name)
|
||||||
|
|
||||||
def copyMergeDirectory( src, dst ):
|
def copyMergeDirectory( src, dst ):
|
||||||
listing = os.listdir(src)
|
listing = os.listdir(src)
|
||||||
for file_name in listing:
|
for file_name in listing:
|
||||||
src_file_path = Path.join(src, file_name)
|
src_file_path = os.path.join(src, file_name)
|
||||||
dst_file_path = Path.join(dst, file_name)
|
dst_file_path = os.path.join(dst, file_name)
|
||||||
shutil.copyfile(src_file_path, dst_file_path)
|
shutil.copyfile(src_file_path, dst_file_path)
|
||||||
|
|
||||||
def getDocumentSize( svg_element ):
|
def getDocumentSize( svg_element ):
|
||||||
|
|
@ -165,19 +158,19 @@ def main(argv):
|
||||||
print "Missing arguments in_path and out_dir."
|
print "Missing arguments in_path and out_dir."
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if Path.isfile(out_dir):
|
if os.path.isfile(out_dir):
|
||||||
print "Unable to use '%s' as output directory, because it\'s a file." % out_dir
|
print "Unable to use '%s' as output directory, because it\'s a file." % out_dir
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
if not Path.isdir(out_dir):
|
if not os.path.isdir(out_dir):
|
||||||
print "Output directory '%s' not found." % out_dir
|
print "Output directory '%s' not found." % out_dir
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# Create the icons folders
|
# Create the icons folders
|
||||||
createDirectory(Path.join(out_dir, "48x48"))
|
createDirectory(os.path.join(out_dir, "48x48"))
|
||||||
createDirectory(Path.join(out_dir, "32x32"))
|
createDirectory(os.path.join(out_dir, "32x32"))
|
||||||
createDirectory(Path.join(out_dir, "24x24"))
|
createDirectory(os.path.join(out_dir, "24x24"))
|
||||||
createDirectory(Path.join(out_dir, "22x22"))
|
createDirectory(os.path.join(out_dir, "22x22"))
|
||||||
createDirectory(Path.join(out_dir, "16x16"))
|
createDirectory(os.path.join(out_dir, "16x16"))
|
||||||
|
|
||||||
renderSvgIcon(in_path, out_dir)
|
renderSvgIcon(in_path, out_dir)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue