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, see <http://www.gnu.org/licenses/>.
22 # This scripts copies the icons that sigrok-meter uses from the icon pack,
23 # and outputs the matching entries for a Qt resource file.
28 ICONDIR
= '../adwaita-icon-theme-3.18.0/Adwaita'
29 OUTDIR
= 'icons/adwaita-icon-theme-3.18.0'
33 for root
, dirs
, files
in os
.walk(ICONDIR
):
35 result
.append(os
.path
.join(root
[len(ICONDIR
)+1:], iconname
))
38 def copy(alias
, iconname
):
39 for fn
in sorted(find(iconname
)):
40 inputfile
= os
.path
.join(ICONDIR
, fn
)
41 outputfile
= os
.path
.join(OUTDIR
, fn
)
42 outputpath
= os
.path
.dirname(outputfile
)
43 size
= fn
.split(os
.sep
)[0]
45 if not os
.path
.exists(outputpath
):
46 os
.makedirs(outputpath
)
48 shutil
.copy(inputfile
, outputpath
)
50 template
= '<file alias="{}-{}.png">{}</file>'
51 print(template
.format(alias
, size
, outputfile
))
53 copy('about', 'help-about.png')
54 copy('add', 'list-add.png')
55 copy('exit', 'application-exit.png')
56 copy('graph', 'utilities-system-monitor.png')
57 copy('log', 'accessories-text-editor.png')
58 copy('preferences', 'preferences-system.png')
59 copy('start', 'media-playback-start.png')
60 copy('stop', 'media-playback-stop.png')