Skip to content

Instantly share code, notes, and snippets.

@hualet
Created February 27, 2017 02:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hualet/2302d9ef6617c6c5835f4f1ad3d805f7 to your computer and use it in GitHub Desktop.
Save hualet/2302d9ef6617c6c5835f4f1ad3d805f7 to your computer and use it in GitHub Desktop.
Check whether icons of the apps in Deepin Appstore are included in deepin-icon-theme
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2014 Deepin Technology Co., Ltd.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
import os
import urllib2
import json
import sys
from PyQt5.QtGui import QGuiApplication, QIcon
def check_all_icons():
result = {}
try:
metadata = urllib2.urlopen("http://api.lastore.deepin.org/metadata")
metadata_obj = json.loads(metadata.read())
for package in metadata_obj["data"]:
package_id = package.get("id", "")
app_name = package.get("name", "")
find_result = find_icon_for(package_id)
if find_result:
print("found icon for app %s" % app_name)
else:
print("no icon found for app %s" % app_name)
except Exception, e:
print e
return result
def find_icon_for(package):
return QIcon.hasThemeIcon(package)
if __name__ == "__main__":
QIcon.setThemeName("deepin")
app = QGuiApplication(sys.argv)
check_all_icons()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment