From 5afa55c0ad742984cb91c1d29af0d863fce39d41 Mon Sep 17 00:00:00 2001 From: Roland Lutz Date: Wed, 13 Jul 2016 14:34:40 +0200 Subject: [PATCH] python: Add flag for loading pixmaps referenced in symbols --- src/python/geda/clib.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/python/geda/clib.py b/src/python/geda/clib.py index d464dbea1..548d0c4d6 100644 --- a/src/python/geda/clib.py +++ b/src/python/geda/clib.py @@ -86,6 +86,13 @@ _search_cache = {} _symbol_cache = {} +## Whether to load pixmaps referenced by symbols. +# +# This should be set before reading any symbols. Otherwise, cached +# symbols loaded with the wrong \a load_pixmaps flag may be returned. + +load_pixmaps = False + ## Source object representing a directory of symbol files. # @@ -139,7 +146,7 @@ class DirectorySource: break if path is not None: - return xorn.geda.read.read(path) + return xorn.geda.read.read(path, load_pixmaps = load_pixmaps) raise ValueError, 'symbol "%s" not found in library' % symbol @@ -195,7 +202,8 @@ class CommandSource: def get(self, symbol): return _run_source_command( shlex.split(self.get_cmd) + [symbol], - lambda f: xorn.geda.read.read_file(f, '')) + lambda f: xorn.geda.read.read_file( + f, '', load_pixmaps = load_pixmaps)) ## Execute a library command. -- 2.11.4.GIT