From fc28b6a2574ae28c7d32fb7a44c07102367fc687 Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Tue, 15 Mar 2022 17:47:33 -0300 Subject: [PATCH] Fixed: expanded text variables earlier for date - Avoids reformatting problems - Also done for title, because we keep a copy of the original Related to #161 --- kibot/gs.py | 4 ++-- kibot/kicad/v6_sch.py | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/kibot/gs.py b/kibot/gs.py index 11407d59..d36ddfa8 100644 --- a/kibot/gs.py +++ b/kibot/gs.py @@ -164,8 +164,8 @@ class GS(object): if GS.sch_title is not None: return assert GS.sch is not None - GS.sch_title = GS.expand_text_variables(GS.sch.title) - GS.sch_date = GS.expand_text_variables(GS.sch.date) + GS.sch_title = GS.sch.title + GS.sch_date = GS.sch.date GS.sch_rev = GS.expand_text_variables(GS.sch.revision) GS.sch_comp = GS.expand_text_variables(GS.sch.company) GS.sch_com = [GS.expand_text_variables(x) for x in GS.sch.comment] diff --git a/kibot/kicad/v6_sch.py b/kibot/kicad/v6_sch.py index 56fce3ba..82d72e77 100644 --- a/kibot/kicad/v6_sch.py +++ b/kibot/kicad/v6_sch.py @@ -1524,9 +1524,11 @@ class SchematicV6(Schematic): raise SchError('Wrong title block entry ({})'.format(item)) i_type = item[0].value() if i_type == 'title': - self.title_ori = self.title = _check_str(item, 1, i_type) + self.title_ori = _check_str(item, 1, i_type) + self.title = GS.expand_text_variables(self.title_ori) elif i_type == 'date': - self.date_ori = self.date = _check_str(item, 1, i_type) + self.date_ori = _check_str(item, 1, i_type) + self.date = GS.expand_text_variables(self.date_ori) elif i_type == 'rev': self.revision = _check_str(item, 1, i_type) elif i_type == 'company': @@ -1540,8 +1542,8 @@ class SchematicV6(Schematic): else: raise SchError('Unsupported entry in title block ({})'.format(item)) self._fill_missing_title_block() - logger.debug("SCH title: `{}`".format(self.title)) - logger.debug("SCH date: `{}`".format(self.date)) + logger.debug("SCH title: `{}`".format(self.title_ori)) + logger.debug("SCH date: `{}`".format(self.date_ori)) logger.debug("SCH revision: `{}`".format(self.revision)) logger.debug("SCH company: `{}`".format(self.company))