223
224
If outImage is specified, sys.exit will be called after the image is saved4
227
for sizefolder in ("scalable", "64x64", "48x48", "32x32", "24x24", "22x22", "16x16", "12x12","8x8"):
228
if themePath is None: break
229
for folder in ("places", "filesystems"):
230
for icon in ("folder.svg", "folder.png"):
231
if os.path.exists(os.path.join(themePath, sizefolder, folder, icon)):
232
pb = gtk.gdk.pixbuf_new_from_file_at_size(os.path.join(themePath, sizefolder, folder, icon), 100, 100)
236
pb.save(outImage, "png")
240
icontheme = gtk.icon_theme_get_default()
241
icc = icontheme.load_icon(gtk.STOCK_MISSING_IMAGE, gtk.ICON_SIZE_BUTTON, 0)
227
# This code was ported from GNOME Control Center version 2.32.1,
228
# released under the GPLv2, from theme-thumbnail.c
229
# Modifications were made.
231
with _ThemeNameCollisionResolver(themePath, "icon") as theme:
233
icon_theme = gtk.IconTheme()
234
icon_theme.set_custom_theme(theme.theme_name)
237
example_icon_name = icon_theme.get_example_icon_name()
238
if example_icon_name is not None:
239
icon_names.append(example_icon_name)
240
icon_names.extend(["x-directory-normal", "gnome-fs-directory", "folder"])
242
folder_icon_info = icon_theme.choose_icon(icon_names, ICON_THUMBNAIL_SIZE, gtk.ICON_LOOKUP_FORCE_SIZE)
245
if folder_icon_info is not None:
246
folder_icon = folder_icon_info.load_icon()
248
if folder_icon is None:
250
folder_icon = dummy.render_icon(gtk.STOCK_MISSING_IMAGE, gtk.ICON_SIZE_DIALOG)
253
folder_icon.save(outImage, outImage.split(".")[-1].lower())
245
icc.save(outImage, "png")
246
print >> sys.stderr, "missing"
252
257
def skin_generate(outImage, gtkPath=None, iconPath=None, metacityPath=None, font=None):
253
258
# This code was ported from GNOME Control Center version 2.32.1,