|
65 | 65 | except ImportError: |
66 | 66 | __version__ = "unknown" |
67 | 67 |
|
| 68 | +# Constants for pin default settings |
| 69 | +DEFAULT_SIDE = "left" # Default pin side for unspecified pins |
| 70 | +DEFAULT_STYLE = "line" # Default pin style for unspecified pins |
| 71 | +DEFAULT_TYPE = "passive" # Default pin type for unspecified pins |
| 72 | + |
68 | 73 | # Constants for layout calculations |
69 | 74 | FONT_SIZE = 1.27 # Default font size for pin names and numbers |
70 | 75 | GRID_SPACING = 1.27 # Grid spacing for aligning pins and symbols |
|
83 | 88 | TB_SEPARATION = ( |
84 | 89 | 2 * GRID_SPACING |
85 | 90 | ) # Minimum separation between opposing pin names on top and bottom sides |
| 91 | +DEFAULT_PUSH = 0.5 # Default push value for pin alignment (centered) |
86 | 92 |
|
87 | 93 | # Enable/disable debugging diagnostics |
88 | 94 | debug = False |
@@ -798,11 +804,11 @@ def rows_to_symbol( |
798 | 804 | symbol_rows, |
799 | 805 | sort_by="row", |
800 | 806 | reverse=False, |
801 | | - default_side="left", |
802 | | - default_type="passive", |
803 | | - default_style="line", |
| 807 | + default_side=DEFAULT_SIDE, |
| 808 | + default_type=DEFAULT_TYPE, |
| 809 | + default_style=DEFAULT_STYLE, |
804 | 810 | alt_pin_delim=None, |
805 | | - push=0.5, |
| 811 | + push=DEFAULT_PUSH, |
806 | 812 | bundle=False, |
807 | 813 | scrunch=False, |
808 | 814 | ccw=False, |
@@ -1282,14 +1288,14 @@ def rows_to_symbol_lib( |
1282 | 1288 | rows, |
1283 | 1289 | sort_by="row", |
1284 | 1290 | reverse=False, |
1285 | | - default_side="left", |
1286 | | - default_type="passive", |
1287 | | - default_style="line", |
| 1291 | + default_side=DEFAULT_SIDE, |
| 1292 | + default_type=DEFAULT_TYPE, |
| 1293 | + default_style=DEFAULT_STYLE, |
1288 | 1294 | alt_pin_delim=None, |
1289 | 1295 | bundle=False, |
1290 | 1296 | scrunch=False, |
1291 | 1297 | ccw=False, |
1292 | | - push=0.5, |
| 1298 | + push=DEFAULT_PUSH, |
1293 | 1299 | ): |
1294 | 1300 | """ |
1295 | 1301 | Generate a complete KiCad symbol library from CSV or Excel data. |
@@ -1379,15 +1385,15 @@ def row_file_to_symbol_lib_file( |
1379 | 1385 | symbol_lib_file=None, |
1380 | 1386 | sort_by="row", |
1381 | 1387 | reverse=False, |
1382 | | - default_side="left", |
1383 | | - default_type="passive", |
1384 | | - default_style="line", |
| 1388 | + default_side=DEFAULT_SIDE, |
| 1389 | + default_type=DEFAULT_TYPE, |
| 1390 | + default_style=DEFAULT_STYLE, |
1385 | 1391 | alt_pin_delim=None, |
1386 | 1392 | overwrite=False, |
1387 | 1393 | bundle=False, |
1388 | 1394 | scrunch=False, |
1389 | 1395 | ccw=False, |
1390 | | - push=0.5, |
| 1396 | + push=DEFAULT_PUSH, |
1391 | 1397 | ): |
1392 | 1398 | """ |
1393 | 1399 | Convert a CSV or Excel file to a KiCad symbol library file. |
@@ -1644,12 +1650,12 @@ def kipart(): |
1644 | 1650 | ) |
1645 | 1651 | parser.add_argument( |
1646 | 1652 | "--type", |
1647 | | - default="passive", |
| 1653 | + default=DEFAULT_TYPE, |
1648 | 1654 | help="Default type for pins without a type specifier (e.g., input, output, bidirectional, passive)", |
1649 | 1655 | ) |
1650 | 1656 | parser.add_argument( |
1651 | 1657 | "--style", |
1652 | | - default="line", |
| 1658 | + default=DEFAULT_STYLE, |
1653 | 1659 | help="Default style for pins without a style specifier (e.g., line, inverted, clock)", |
1654 | 1660 | ) |
1655 | 1661 | parser.add_argument( |
|
0 commit comments