7 Module implementing a pixmap cache for icons. |
7 Module implementing a pixmap cache for icons. |
8 """ |
8 """ |
9 |
9 |
10 import os |
10 import os |
11 |
11 |
12 from PyQt4.QtGui import QPixmap, QIcon |
12 from PyQt4.QtGui import QPixmap, QIcon, QPainter |
13 |
13 |
14 class PixmapCache(object): |
14 class PixmapCache(object): |
15 """ |
15 """ |
16 Class implementing a pixmap cache for icons. |
16 Class implementing a pixmap cache for icons. |
17 """ |
17 """ |
73 @param key name of the wanted icon (string) |
73 @param key name of the wanted icon (string) |
74 @return the requested icon (QIcon) |
74 @return the requested icon (QIcon) |
75 """ |
75 """ |
76 return QIcon(cache.getPixmap(key)) |
76 return QIcon(cache.getPixmap(key)) |
77 |
77 |
|
78 def getSymlinkIcon(key, cache = pixCache): |
|
79 """ |
|
80 Module function to retrieve a symbolic link icon. |
|
81 |
|
82 @param key name of the wanted icon (string) |
|
83 @return the requested icon (QIcon) |
|
84 """ |
|
85 pix1 = QPixmap(cache.getPixmap(key)) |
|
86 pix2 = cache.getPixmap("symlink.png") |
|
87 painter = QPainter(pix1) |
|
88 painter.drawPixmap(0, 10, pix2) |
|
89 painter.end() |
|
90 return QIcon(pix1) |
|
91 |
78 def addSearchPath(path, cache = pixCache): |
92 def addSearchPath(path, cache = pixCache): |
79 """ |
93 """ |
80 Module function to add a path to the search path. |
94 Module function to add a path to the search path. |
81 |
95 |
82 @param path path to add (string) |
96 @param path path to add (string) |