Skip to content
Snippets Groups Projects
Commit c700ba39 authored by Benjamin Jakimow's avatar Benjamin Jakimow
Browse files

svn2png used overwrite keyword when running with inkscape

parent 5b43eaa0
No related branches found
No related tags found
No related merge requests found
...@@ -209,12 +209,16 @@ def svg2png(pathDir, overwrite=False, mode='INKSCAPE'): ...@@ -209,12 +209,16 @@ def svg2png(pathDir, overwrite=False, mode='INKSCAPE'):
del painter, frame, img, page del painter, frame, img, page
s ="" s =""
elif mode == 'INKSCAPE': elif mode == 'INKSCAPE':
dirInkscape = r'C:\Program Files\Inkscape' if not os.path.exists(pathPng) or overwrite:
assert os.path.isdir(dirInkscape) if sys.platform == 'darwin':
cmd = [jp(dirInkscape,'inkscape')] cmd = ['inkscape']
cmd.append('--file={}'.format(pathSvg)) else:
cmd.append('--export-png={}'.format(pathPng)) dirInkscape = r'C:\Program Files\Inkscape'
subprocess.call(cmd) assert os.path.isdir(dirInkscape)
cmd = [jp(dirInkscape,'inkscape')]
cmd.append('--file={}'.format(pathSvg))
cmd.append('--export-png={}'.format(pathPng))
subprocess.call(cmd)
s = "" s = ""
...@@ -281,7 +285,7 @@ def png2qrc(icondir, pathQrc, pngprefix='timeseriesviewer/png'): ...@@ -281,7 +285,7 @@ def png2qrc(icondir, pathQrc, pngprefix='timeseriesviewer/png'):
if __name__ == '__main__': if __name__ == '__main__':
icondir = jp(DIR_UI, *['icons']) icondir = jp(DIR_UI, *['icons'])
pathQrc = jp(DIR_UI,'resources.qrc') pathQrc = jp(DIR_UI,'resources.qrc')
if True: if False:
from qgis import * from qgis import *
from qgis.core import * from qgis.core import *
from qgis.gui import * from qgis.gui import *
...@@ -316,10 +320,10 @@ if __name__ == '__main__': ...@@ -316,10 +320,10 @@ if __name__ == '__main__':
if True: if True:
#convert SVG to PNG and link them into the resource file #convert SVG to PNG and link them into the resource file
#svg2png(icondir, overwrite=True) svg2png(icondir, overwrite=False)
#add png icons to qrc file #add png icons to qrc file
png2qrc(icondir, pathQrc) #png2qrc(icondir, pathQrc)
if True: if True:
make(DIR_UI) make(DIR_UI)
print('Done') print('Done')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment