Fixed the column rename feature of the internal BoM
This commit is contained in:
parent
b2189991fc
commit
d66410636e
|
|
@ -209,6 +209,8 @@ class BoMOptions(BaseOptions):
|
||||||
# Lower case available columns
|
# Lower case available columns
|
||||||
valid_columns = self._get_columns()
|
valid_columns = self._get_columns()
|
||||||
valid_columns_l = {c.lower(): c for c in valid_columns}
|
valid_columns_l = {c.lower(): c for c in valid_columns}
|
||||||
|
# Special row number column
|
||||||
|
valid_columns_l['component'] = 'Component'
|
||||||
logger.debug("Valid columns: "+str(valid_columns))
|
logger.debug("Valid columns: "+str(valid_columns))
|
||||||
# Create the different lists
|
# Create the different lists
|
||||||
columns = []
|
columns = []
|
||||||
|
|
@ -222,7 +224,7 @@ class BoMOptions(BaseOptions):
|
||||||
new_col = col.field
|
new_col = col.field
|
||||||
# A column rename
|
# A column rename
|
||||||
if col.name:
|
if col.name:
|
||||||
self.column_rename[col.field] = col.name
|
self.column_rename[col.field.lower()] = col.name
|
||||||
# Attach other columns
|
# Attach other columns
|
||||||
if col.join:
|
if col.join:
|
||||||
self.join.append([col.field]+col.join)
|
self.join.append([col.field]+col.join)
|
||||||
|
|
@ -231,6 +233,8 @@ class BoMOptions(BaseOptions):
|
||||||
raise KiPlotConfigurationError('Invalid column name `{}`'.format(new_col))
|
raise KiPlotConfigurationError('Invalid column name `{}`'.format(new_col))
|
||||||
columns.append(new_col)
|
columns.append(new_col)
|
||||||
columns_l[new_col.lower()] = new_col
|
columns_l[new_col.lower()] = new_col
|
||||||
|
# TODO less magic, more explicit
|
||||||
|
del columns_l['component']
|
||||||
# Create a list of the columns we don't want
|
# Create a list of the columns we don't want
|
||||||
self.ignore = [c for c in valid_columns_l.keys() if c not in columns_l]
|
self.ignore = [c for c in valid_columns_l.keys() if c not in columns_l]
|
||||||
# And this is the ordered list with the case style defined by the user
|
# And this is the ordered list with the case style defined by the user
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue