Fixed flake8 style details

This commit is contained in:
SET 2020-08-11 12:46:36 -03:00
parent fe2f5d6c65
commit 6d09d662be
6 changed files with 34 additions and 29 deletions

View File

@ -28,15 +28,15 @@ except YAMLError as e:
sys.exit(1)
schema = Map({"kiplot":
Map({"version": Int()}),
Map({"version": Int()}), # noqa: E127
Optional("preflight"): Map({
Optional("run_drc"): Bool(),
Optional("run_drc"): Bool(), # noqa: E121
Optional("run_erc"): Bool(),
Optional("update_xml"): Bool(),
Optional("check_zone_fills"): Bool(),
Optional("ignore_unconnected"): Bool(),
}),
Optional("outputs"): Seq(Any())}) # noqa: E127
Optional("outputs"): Seq(Any())})
try:
parsed = load(s, schema, label=fname)

View File

@ -71,7 +71,7 @@ class ColumnList:
COL_VALUE_L: 1,
COL_PART_L: 1,
COL_PART_LIB_L: 1,
#COL_DESCRIPTION_L: 1,
# COL_DESCRIPTION_L: 1,
COL_DATASHEET_L: 1,
COL_SHEETPATH_L: 1,
COL_FP_L: 1,

View File

@ -181,6 +181,24 @@ def create_color_ref(workbook, col_colors, hl_empty, fmt_cols):
worksheet.set_column(0, 0, 50)
def adjust_widths(worksheet, column_widths, max_width):
for i, width in enumerate(column_widths):
if width > max_width:
width = max_width
worksheet.set_column(i, i, width)
def adjust_heights(worksheet, rows, max_width, head_size):
for rn, r in enumerate(rows):
max_h = 1
for c in r:
if len(c) > max_width:
h = len(wrap(c, max_width))
max_h = max(h, max_h)
if max_h > 1:
worksheet.set_row(head_size+rn, 15.0*max_h)
def write_xlsx(filename, groups, col_fields, head_names, cfg):
"""
Write BoM out to a XLSX file
@ -307,22 +325,9 @@ def write_xlsx(filename, groups, col_fields, head_names, cfg):
rc = add_info(worksheet, column_widths, rc, col1, fmt_info, "Number of PCBs:", cfg.number)
rc = add_info(worksheet, column_widths, rc, col1, fmt_info, "Total components:", cfg.n_build)
# Adjust the widths
for i in range(len(column_widths)):
width = column_widths[i]
if width > max_width:
width = max_width
worksheet.set_column(i, i, width)
# Adjust the heights
for rn, r in enumerate(rows):
max_h = 1
for c in r:
if len(c) > max_width:
h = len(wrap(c, max_width))
max_h = max(h, max_h)
if max_h > 1:
worksheet.set_row(head_size+rn, 15.0*max_h)
# Adjust cols and rows
adjust_widths(worksheet, column_widths, max_width)
adjust_heights(worksheet, rows, max_width, head_size)
worksheet.freeze_panes(head_size+1, 0)
worksheet.repeat_rows(head_size+1)

View File

@ -640,7 +640,7 @@ class SchematicComponent(object):
def __str__(self):
if self.name == self.value:
return '{} ({})'.format(self.ref, self.name, self.value)
return '{} ({})'.format(self.ref, self.name)
return '{} ({} {})'.format(self.ref, self.name, self.value)
@staticmethod

View File

@ -65,10 +65,10 @@ class AnyLayerOptions(BaseOptions):
layers = Layer.solve(layers)
# plot every layer in the output
for l in layers:
suffix = l.suffix
desc = l.description
id = l.id
for la in layers:
suffix = la.suffix
desc = la.description
id = la.id
# Set current layer
plot_ctrl.SetLayer(id)
# Skipping NPTH is controlled by whether or not this is
@ -77,7 +77,7 @@ class AnyLayerOptions(BaseOptions):
po.SetSkipPlotNPTH_Pads(is_cu)
# Plot single layer to file
logger.debug("Opening plot file for layer `{}` format `{}`".format(l, self._plot_format))
logger.debug("Opening plot file for layer `{}` format `{}`".format(la, self._plot_format))
if not plot_ctrl.OpenPlotfile(suffix, self._plot_format, desc):
# Shouldn't happen
raise PlotError("OpenPlotfile failed!") # pragma: no cover
@ -87,7 +87,7 @@ class AnyLayerOptions(BaseOptions):
filename = self.expand_filename(output_dir, self.output, suffix, os.path.splitext(k_filename)[1][1:])
else:
filename = k_filename
logger.debug("Plotting layer `{}` to `{}`".format(l, filename))
logger.debug("Plotting layer `{}` to `{}`".format(la, filename))
plot_ctrl.PlotLayer()
plot_ctrl.ClosePlot()
if self.output:

View File

@ -25,7 +25,7 @@ class PDF_Pcb_PrintOptions(BaseOptions):
check_script(CMD_PCBNEW_PRINT_LAYERS, URL_PCBNEW_PRINT_LAYERS, '1.4.1')
layers = Layer.solve(layers)
# Output file name
id = '+'.join([l.suffix for l in layers])
id = '+'.join([la.suffix for la in layers])
output = self.expand_filename(output_dir, self.output, id, 'pdf')
cmd = [CMD_PCBNEW_PRINT_LAYERS, 'export', '--output_name', output]
if BasePreFlight.get_option('check_zone_fills'):
@ -35,7 +35,7 @@ class PDF_Pcb_PrintOptions(BaseOptions):
cmd.insert(1, '-vv')
cmd.insert(1, '-r')
# Add the layers
cmd.extend([l.layer for l in layers])
cmd.extend([la.layer for la in layers])
# Execute it
logger.debug('Executing: '+str(cmd))
ret = call(cmd)