Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.9, 1.9.1, and 1.9.2

qtlib: split code to search icon of geticon()

Preparation for extend geticon() to handle tortoisehg's common icons path.

Changeset 8b97b4597c61

Parent d8dcf12f72ae

by Yuya Nishihara

Changes to one file · Browse files at 8b97b4597c61 Showing diff from parent d8dcf12f72ae Diff from another changeset...

 
152
153
154
 
 
 
 
 
 
 
 
155
156
157
158
159
160
161
162
163
164
165
166
 
 
167
168
169
 
152
153
154
155
156
157
158
159
160
161
162
163
164
165
 
 
 
 
 
 
 
 
 
166
167
168
169
170
@@ -152,18 +152,19 @@
  Return a QIcon for the resource named 'name.(svg|png)' (the given   'name' parameter must *not* provide the extension).   """ + def findicon(name): + for ext in ('svg', 'png', 'ico'): + path = ':/icons/%s.%s' % (name, ext) + if QtCore.QFile.exists(path): + return QtGui.QIcon(path) + + return QtGui.QIcon(':/icons/fallback.svg') +   try:   return _iconcache[name]   except KeyError: - for ext in ('svg', 'png', 'ico'): - path = ':/icons/%s.%s' % (name, ext) - if QtCore.QFile.exists(path): - icon = QtGui.QIcon(path) - break - else: - icon = QtGui.QIcon(':/icons/fallback.svg') - _iconcache[name] = icon - return icon + _iconcache[name] = findicon(name) + return _iconcache[name]    _pixmapcache = {}