View Single Post
Old 12-15-2010, 12:17 PM   #18
chaley
"chaley", not "charley"
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 5,648
Karma: 1137414
Join Date: Jan 2010
Location: France
Device: Many android devices
Quote:
Originally Posted by kiwidude View Post
Code:
                        actual_icon = None
                        try:
                            resource = self.load_resource(icon_name)
                            pixmap = QPixmap()
                            pixmap.loadFromData(resource)
                            actual_icon = QIcon(pixmap)
                        except ValueError:
                            actual_icon = QIcon(I(icon_name))
                        ac.setIcon(actual_icon)
Given the new list interface, the problem becomes much more tractable. You load the icons you need from the zip into the dict. Some might not be there. You then loop through the items you need using a simple if x in list: test. If they is in the dict, cool. If not, you use the file approach. That lets the customizers put their icons in the local resources/images directory (or a subdir if they want to). There is almost zero time penalty because the zip scan was done once and you would need to open the files anyway.
Quote:
And yeah as Chaley says if you have a lot of icons you are opening/closing the zip a lot of times.
Problem gone with list interface.
chaley is offline   Reply With Quote