def LoadPixmap(path, desktop=None, cached=None, width=0, height=0): if path[-4:] == ".png": # cache unless caller explicity requests to not cache ptr = loadPNG(path, 0, 0 if cached is False else 1) elif path[-4:] == ".jpg": # don't cache unless caller explicity requests caching ptr = loadJPG(path, 1 if cached is True else 0) elif path[-4:] == ".svg": from skin import parameters, getSkinFactor # imported here to avoid circular import autoscale = int(parameters.get( "AutoscaleSVG", -1)) # skin_default only == -1, disabled == 0 or enabled == 1 scale = height == 0 and (autoscale == -1 and "/skin_default/" in path or autoscale == 1) and getSkinFactor() or 0 ptr = loadSVG(path, 0 if cached is False else 1, width, height, scale) elif path[-1:] == ".": # caching mechanism isn't suitable for multi file images, so it's explicitly disabled alpha = loadPNG(path + "a.png", 0, 0) ptr = loadJPG(path + "rgb.jpg", alpha, 0) else: raise Exception( "Neither .png nor .jpg nor .svg, please fix file extension") if ptr and desktop: desktop.makeCompatiblePixmap(ptr) return ptr
def LoadPixmap(path, desktop=None, cached=None): if path[-4:] == ".png": # cache unless caller explicity requests to not cache ptr = loadPNG(path, 0, 0 if cached == False else 1) elif path[-4:] == ".jpg": # don't cache unless caller explicity requests caching ptr = loadJPG(path, 1 if cached == True else 0) elif path[-4:] == ".svg": ptr = loadSVG(path) elif path[-1:] == ".": # caching mechanism isn't suitable for multi file images, so it's explicitly disabled alpha = loadPNG(path + "a.png", 0, 0) ptr = loadJPG(path + "rgb.jpg", alpha, 0) else: raise Exception("neither .png nor .jpg/.svg, please fix file extension") if ptr and desktop: desktop.makeCompatiblePixmap(ptr) return ptr
def LoadPixmap(path, desktop=None, cached=None, width=0, height=0): if path[-4:] == ".png": # cache unless caller explicity requests to not cache ptr = loadPNG(path, 0, 0 if cached == False else 1) elif path[-4:] == ".jpg": # don't cache unless caller explicity requests caching ptr = loadJPG(path, 1 if cached == True else 0) elif path[-4:] == ".svg": scale = getDesktop(0).size().height() / 720.0 if height == 0 else 0 ptr = loadSVG(path, 0 if cached == False else 1, width, height, scale) elif path[-1:] == ".": # caching mechanism isn't suitable for multi file images, so it's explicitly disabled alpha = loadPNG(path + "a.png", 0, 0) ptr = loadJPG(path + "rgb.jpg", alpha, 0) else: raise Exception( _("Neither .png nor .jpg nor .svg, please fix file extension")) if ptr and desktop: desktop.makeCompatiblePixmap(ptr) return ptr