Jump to content


Loading plugin pixmaps from skin path first, then fallback to plugin path - What's the best way to do it?

  • Please log in to reply
No replies to this topic

#1 nautilus7

  • PLi® Contributor
  • 167 posts


Posted 11 November 2019 - 23:34

So, let's say a plugin needs to load some pixmaps for its skin. It can look up in the plugin director to load the pixmaps provided by the plugin, or look up in the skin directory to load the pixmaps provided by the skin.


This could be done like this:

# first check if current skin provides the icon
icon = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "icons/pluginName/icon.png"))

# fallback to icon supplied by the plugin
if icon is None:
     icon = LoadPixmap(resolveFilename(SCOPE_CURRENT_PLUGIN, "pluginName/icons/icon.png"))

The above work fine, but if the skin does not provides the icon, then we get an message in the debug log (icon not found)... Is there a way to do the same, but without getting the error message in the log?


In general, is there a more efficient or faster way to do it? 

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users