[3D models] Various small details about missing models
- Fail to expand a VAR is reported once. Not for every model.
- Warnings no longer printed if the model is missing but we can
download it. It confuses people when the problem is solved.
- When we fail to expand a VAR and the result is "${VAR}..."
we tried to make it an absolute path creating a path that was
confusing. Now we keep the original name.
This commit is contained in:
parent
99bfaec4dc
commit
2f37a5c6b4
|
|
@ -52,6 +52,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
components that doesn't specify a library. (See #242)
|
||||
- Problems when setting a text variable to an empty string. (#268)
|
||||
- QR lib update: Problems when moving the footprint to the bottom. (#271)
|
||||
- Misleading messages for missing 3D models that starts with ${VAR} when VAR
|
||||
isn't defined. The old code tried to make it an absolute path.
|
||||
|
||||
### Changed
|
||||
- The order in which main sections are parsed is now fixed.
|
||||
|
|
@ -61,6 +63,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- Continue downloading if an SSL certificate error found (#239)
|
||||
- PCB_Print: PNGs no longer has transparent background. This is because now we
|
||||
use a PDF as intermediate step.
|
||||
- Fails to expand KiCad vars are reported once (not every time)
|
||||
- No more warnings about missing 3D models when we can download them
|
||||
|
||||
|
||||
## [1.2.0] - 2022-06-15
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ else: # pragma: no cover (Py2)
|
|||
logger = log.get_logger()
|
||||
SYM_LIB_TABLE = 'sym-lib-table'
|
||||
KICAD_COMMON = 'kicad_common'
|
||||
reported = set()
|
||||
|
||||
|
||||
class KiConfError(Exception):
|
||||
|
|
@ -68,7 +69,9 @@ def expand_env(val, env, extra_env, used_extra=None):
|
|||
val = val.replace('${'+var+'}', extra_env[var])
|
||||
used_extra[0] = True
|
||||
else:
|
||||
logger.error('Unable to expand `{}` in `{}`'.format(var, val))
|
||||
if var not in reported:
|
||||
logger.error('Unable to expand `{}` in `{}`'.format(var, val))
|
||||
reported.add(var)
|
||||
return val
|
||||
|
||||
|
||||
|
|
@ -530,4 +533,6 @@ class KiConf(object):
|
|||
used_extra = [False]
|
||||
if not name:
|
||||
return name
|
||||
return os.path.abspath(expand_env(un_quote(name), KiConf.kicad_env, GS.load_pro_variables(), used_extra))
|
||||
expanded = expand_env(un_quote(name), KiConf.kicad_env, GS.load_pro_variables(), used_extra)
|
||||
# Don't try to get the absolute path for something that starts with a variable that we couldn't expand
|
||||
return expanded if expanded.startswith('${') else os.path.abspath(expanded)
|
||||
|
|
|
|||
|
|
@ -127,8 +127,6 @@ class Base3DOptions(VariantOptions):
|
|||
logger.debug("- Expanded {} -> {}".format(m3d.m_Filename, full_name))
|
||||
if not os.path.isfile(full_name):
|
||||
# Missing 3D model
|
||||
if full_name not in downloaded:
|
||||
logger.warning(W_MISS3D+'Missing 3D model for {}: `{}`'.format(ref, full_name))
|
||||
if self.download and (m3d.m_Filename.startswith('${KISYS3DMOD}/') or
|
||||
m3d.m_Filename.startswith('${KICAD6_3DMODEL_DIR}/')):
|
||||
# This is a model from KiCad, try to download it
|
||||
|
|
@ -153,6 +151,8 @@ class Base3DOptions(VariantOptions):
|
|||
if replace:
|
||||
m3d.m_Filename = replace
|
||||
models_replaced = True
|
||||
if full_name not in downloaded:
|
||||
logger.warning(W_MISS3D+'Missing 3D model for {}: `{}`'.format(ref, full_name))
|
||||
else: # File was found
|
||||
if used_extra[0]:
|
||||
# The file is there, but we got it expanding a user defined text
|
||||
|
|
|
|||
Loading…
Reference in New Issue