예제 #1
0
파일: icons.py 프로젝트: koeart/blain
 def get_service_icon(self, id, name, url):
     icon, st = None, self.app.preferences.settings
     if not st.contains('icon/'+name):
         icon = get_favicon(url)
         if icon:
             icon = QIcon(QPixmap.fromImage(QImage.fromData(icon)))
             print name, "icon loaded?", not icon.isNull()
             if not icon.isNull():
                 st.setValue('icon/'+name, icon)
         else: print "error while loading", name, "icon"
     else:
         icon = st.value('icon/'+name, None)
         if icon: icon = QIcon(icon)
     if icon:
         self.app.preferences.ui.accountsTabWidget.setTabIcon(id, icon)
     return icon
예제 #2
0
파일: icons.py 프로젝트: dodo/blain
 def get_service_icon(self, name, url):
     key = "service/" + name
     if key in self.icons:
         return self.icons[key]
     icon, st = None, self.app.accounts.settings
     if not st.contains('icon/'+name):
         icon = get_favicon(url)
         if icon:
             icon = QIcon(QPixmap.fromImage(QImage.fromData(icon)))
             #print name, "icon loaded?", not icon.isNull()
             if not icon.isNull():
                 st.setValue('icon/'+name, icon)
         else: print "[ERROR] while loading", name, "icon"
     else:
         icon = st.value('icon/'+name, None)
         if icon: icon = QIcon(icon)
     if icon:
         self.icons[key] = icon
     return icon