From 3acb4765f5f80f0354213c1e23b9a2565bcdb58c Mon Sep 17 00:00:00 2001 From: Treeki Date: Tue, 22 Nov 2011 22:25:00 +0100 Subject: icons! --- src/main.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/main.py') diff --git a/src/main.py b/src/main.py index 1d53521..1ef7039 100644 --- a/src/main.py +++ b/src/main.py @@ -18,4 +18,20 @@ class KP: KP.mainWindow.show() KP.app.exec_() + + + @classmethod + def icon(cls, name): + try: + cache = cls.iconCache + except AttributeError: + cache = {} + cls.iconCache = cache + + try: + return cache[name] + except KeyError: + icon = QtGui.QIcon('Resources/%s.png' % name) + cache[name] = icon + return icon -- cgit v1.2.3