Commits

Elson Wei committed cca8750

overlay: add load_icon() to load icon and return the icon handle

Comments (0)

Files changed (1)

TortoiseHgOverlayServer.py

 
 logger = Logger()
 
-def SetIcon(hwnd, name, add=False):
-    # Try and find a custom icon
-    if '--noicon' in sys.argv:
-        return
-    print "SetIcon(%s)" % name
+def load_icon(name):
     from tortoisehg.util.paths import get_tortoise_icon
     iconPathName = get_tortoise_icon(name)
     if iconPathName and os.path.isfile(iconPathName):
     else:
         print "Can't find a Python icon file - using default"
         hicon = LoadIcon(0, win32con.IDI_APPLICATION)
+    return hicon
+
+def SetIcon(hwnd, name, add=False):
+    # Try and find a custom icon
+    if '--noicon' in sys.argv:
+        return
+    print "SetIcon(%s)" % name
+
+    hicon = load_icon(name)
 
     flags = NIF_ICON | NIF_MESSAGE | NIF_TIP
     nid = (hwnd, 0, flags, win32con.WM_USER+20, hicon, APP_TITLE)