Skip to content

Commit

Permalink
#1908 cache the images so we don't hit the disk again and again for t…
Browse files Browse the repository at this point in the history
…he same file path

git-svn-id: https://xpra.org/svn/Xpra/trunk@20057 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Aug 6, 2018
1 parent 10a24ea commit f5b2b1c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/xpra/platform/win32/win32_NotifyIcon.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ def __init__(self, app_id=0, title="", move_callbacks=None, click_callback=None,
self.exit_callback = exit_callback
self.command_callback = command_callback
self.reset_function = None
self.image_cache = {}

def __repr__(self):
return "win32NotifyIcon(%#x)" % self.app_id
Expand Down Expand Up @@ -338,6 +339,13 @@ def set_icon_from_data(self, pixels, has_alpha, w, h, rowstride, options={}):
def LoadImage(self, iconPathName):
if not iconPathName:
return None
image = self.image_cache.get(iconPathName)
if not image:
image = self.doLoadImage(iconPathName)
self.image_cache[iconPathName] = image
return image

def doLoadImage(self, iconPathName):
mingw_prefix = os.environ.get("MINGW_PREFIX")
if mingw_prefix and iconPathName.find(mingw_prefix)>=0:
#python can deal with mixed win32 and unix paths,
Expand Down

0 comments on commit f5b2b1c

Please sign in to comment.