4 ## This file is part of the sigrok-meter project.
6 ## Copyright (C) 2015 Jens Steinhauser <jens.steinhauser@gmail.com>
8 ## This program is free software; you can redistribute it and/or modify
9 ## it under the terms of the GNU General Public License as published by
10 ## the Free Software Foundation; either version 2 of the License, or
11 ## (at your option) any later version.
13 ## This program is distributed in the hope that it will be useful,
14 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ## GNU General Public License for more details.
18 ## You should have received a copy of the GNU General Public License
19 ## along with this program; if not, write to the Free Software
20 ## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 # This scripts copies the icons that sigrok-meter uses from the icon pack,
24 # and outputs the matching entries for a Qt resource file.
29 ICONDIR = '../adwaita-icon-theme-3.18.0/Adwaita'
30 OUTDIR = 'icons/adwaita-icon-theme-3.18.0'
34 for root, dirs, files in os.walk(ICONDIR):
36 result.append(os.path.join(root[len(ICONDIR)+1:], iconname))
39 def copy(alias, iconname):
40 for fn in sorted(find(iconname)):
41 inputfile = os.path.join(ICONDIR, fn)
42 outputfile = os.path.join(OUTDIR, fn)
43 outputpath = os.path.dirname(outputfile)
44 size = fn.split(os.sep)[0]
46 if not os.path.exists(outputpath):
47 os.makedirs(outputpath)
49 shutil.copy(inputfile, outputpath)
51 template = '<file alias="{}-{}.png">{}</file>'
52 print(template.format(alias, size, outputfile))
54 copy('about', 'help-about.png')
55 copy('add', 'list-add.png')
56 copy('exit', 'application-exit.png')
57 copy('graph', 'utilities-system-monitor.png')
58 copy('log', 'accessories-text-editor.png')
59 copy('preferences', 'preferences-system.png')
60 copy('start', 'media-playback-start.png')
61 copy('stop', 'media-playback-stop.png')