InteractiveHtmlBom 2.8.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. interactivehtmlbom-2.8.1/.github/workflows/release.yml +31 -0
  2. interactivehtmlbom-2.8.1/.gitignore +11 -0
  3. interactivehtmlbom-2.8.1/.jsbeautifyrc +27 -0
  4. interactivehtmlbom-2.8.1/DATAFORMAT.md +384 -0
  5. interactivehtmlbom-2.8.1/InteractiveHtmlBom/.gitattributes +1 -0
  6. interactivehtmlbom-2.8.1/InteractiveHtmlBom/Run.bat +73 -0
  7. interactivehtmlbom-2.8.1/InteractiveHtmlBom/__init__.py +58 -0
  8. interactivehtmlbom-2.8.1/InteractiveHtmlBom/core/__init__.py +0 -0
  9. interactivehtmlbom-2.8.1/InteractiveHtmlBom/core/config.py +483 -0
  10. interactivehtmlbom-2.8.1/InteractiveHtmlBom/core/fontparser.py +52 -0
  11. interactivehtmlbom-2.8.1/InteractiveHtmlBom/core/ibom.py +365 -0
  12. interactivehtmlbom-2.8.1/InteractiveHtmlBom/core/lzstring.py +304 -0
  13. interactivehtmlbom-2.8.1/InteractiveHtmlBom/core/newstroke_font.py +11361 -0
  14. interactivehtmlbom-2.8.1/InteractiveHtmlBom/core/units.py +192 -0
  15. interactivehtmlbom-2.8.1/InteractiveHtmlBom/dialog/__init__.py +1 -0
  16. interactivehtmlbom-2.8.1/InteractiveHtmlBom/dialog/bitmaps/btn-arrow-down.png +0 -0
  17. interactivehtmlbom-2.8.1/InteractiveHtmlBom/dialog/bitmaps/btn-arrow-up.png +0 -0
  18. interactivehtmlbom-2.8.1/InteractiveHtmlBom/dialog/bitmaps/btn-minus.png +0 -0
  19. interactivehtmlbom-2.8.1/InteractiveHtmlBom/dialog/bitmaps/btn-plus.png +0 -0
  20. interactivehtmlbom-2.8.1/InteractiveHtmlBom/dialog/bitmaps/btn-question.png +0 -0
  21. interactivehtmlbom-2.8.1/InteractiveHtmlBom/dialog/dialog_base.py +578 -0
  22. interactivehtmlbom-2.8.1/InteractiveHtmlBom/dialog/settings_dialog.py +406 -0
  23. interactivehtmlbom-2.8.1/InteractiveHtmlBom/dialog_test.py +17 -0
  24. interactivehtmlbom-2.8.1/InteractiveHtmlBom/ecad/__init__.py +41 -0
  25. interactivehtmlbom-2.8.1/InteractiveHtmlBom/ecad/common.py +251 -0
  26. interactivehtmlbom-2.8.1/InteractiveHtmlBom/ecad/easyeda.py +462 -0
  27. interactivehtmlbom-2.8.1/InteractiveHtmlBom/ecad/fusion_eagle.py +920 -0
  28. interactivehtmlbom-2.8.1/InteractiveHtmlBom/ecad/genericjson.py +167 -0
  29. interactivehtmlbom-2.8.1/InteractiveHtmlBom/ecad/kicad.py +843 -0
  30. interactivehtmlbom-2.8.1/InteractiveHtmlBom/ecad/kicad_extra/__init__.py +59 -0
  31. interactivehtmlbom-2.8.1/InteractiveHtmlBom/ecad/kicad_extra/netlistparser.py +59 -0
  32. interactivehtmlbom-2.8.1/InteractiveHtmlBom/ecad/kicad_extra/parser_base.py +26 -0
  33. interactivehtmlbom-2.8.1/InteractiveHtmlBom/ecad/kicad_extra/sexpressions.py +32 -0
  34. interactivehtmlbom-2.8.1/InteractiveHtmlBom/ecad/kicad_extra/xmlparser.py +42 -0
  35. interactivehtmlbom-2.8.1/InteractiveHtmlBom/ecad/schema/genericjsonpcbdata_v1.schema +638 -0
  36. interactivehtmlbom-2.8.1/InteractiveHtmlBom/ecad/svgpath.py +538 -0
  37. interactivehtmlbom-2.8.1/InteractiveHtmlBom/errors.py +16 -0
  38. interactivehtmlbom-2.8.1/InteractiveHtmlBom/generate_interactive_bom.py +84 -0
  39. interactivehtmlbom-2.8.1/InteractiveHtmlBom/i18n/language_en.bat +12 -0
  40. interactivehtmlbom-2.8.1/InteractiveHtmlBom/i18n/language_zh.bat +17 -0
  41. interactivehtmlbom-2.8.1/InteractiveHtmlBom/icon.png +0 -0
  42. interactivehtmlbom-2.8.1/InteractiveHtmlBom/version.py +29 -0
  43. interactivehtmlbom-2.8.1/InteractiveHtmlBom/web/ibom.css +887 -0
  44. interactivehtmlbom-2.8.1/InteractiveHtmlBom/web/ibom.html +337 -0
  45. interactivehtmlbom-2.8.1/InteractiveHtmlBom/web/ibom.js +1294 -0
  46. interactivehtmlbom-2.8.1/InteractiveHtmlBom/web/lz-string.js +10 -0
  47. interactivehtmlbom-2.8.1/InteractiveHtmlBom/web/pep.js +43 -0
  48. interactivehtmlbom-2.8.1/InteractiveHtmlBom/web/render.js +1075 -0
  49. interactivehtmlbom-2.8.1/InteractiveHtmlBom/web/split.js +6 -0
  50. interactivehtmlbom-2.8.1/InteractiveHtmlBom/web/table-util.js +371 -0
  51. interactivehtmlbom-2.8.1/InteractiveHtmlBom/web/util.js +638 -0
  52. interactivehtmlbom-2.8.1/LICENSE +21 -0
  53. interactivehtmlbom-2.8.1/PKG-INFO +67 -0
  54. interactivehtmlbom-2.8.1/README.md +45 -0
  55. interactivehtmlbom-2.8.1/__init__.py +1 -0
  56. interactivehtmlbom-2.8.1/icons/baseline-settings-20px.svg +4 -0
  57. interactivehtmlbom-2.8.1/icons/bom-grouped-32px.svg +7 -0
  58. interactivehtmlbom-2.8.1/icons/bom-left-right-32px.svg +12 -0
  59. interactivehtmlbom-2.8.1/icons/bom-netlist-32px.svg +8 -0
  60. interactivehtmlbom-2.8.1/icons/bom-only-32px.svg +7 -0
  61. interactivehtmlbom-2.8.1/icons/bom-top-bot-32px.svg +12 -0
  62. interactivehtmlbom-2.8.1/icons/bom-ungrouped-32px.svg +7 -0
  63. interactivehtmlbom-2.8.1/icons/btn-arrow-down.svg +70 -0
  64. interactivehtmlbom-2.8.1/icons/btn-arrow-up.svg +70 -0
  65. interactivehtmlbom-2.8.1/icons/btn-minus.svg +72 -0
  66. interactivehtmlbom-2.8.1/icons/btn-plus.svg +80 -0
  67. interactivehtmlbom-2.8.1/icons/btn-question.svg +87 -0
  68. interactivehtmlbom-2.8.1/icons/copy-48px.svg +1 -0
  69. interactivehtmlbom-2.8.1/icons/io-36px.svg +4 -0
  70. interactivehtmlbom-2.8.1/icons/plugin.svg +169 -0
  71. interactivehtmlbom-2.8.1/icons/plugin_icon_big.png +0 -0
  72. interactivehtmlbom-2.8.1/icons/stats-36px.svg +3 -0
  73. interactivehtmlbom-2.8.1/pyproject.toml +68 -0
  74. interactivehtmlbom-2.8.1/settings_dialog.fbp +3859 -0
@@ -0,0 +1,31 @@
1
+ name: Build and publish a release
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ push:
6
+ tags:
7
+ - v**
8
+
9
+ jobs:
10
+ pypi-deploy:
11
+ runs-on: ubuntu-latest
12
+
13
+ environment: release
14
+ permissions:
15
+ id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
16
+
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+ - name: Set up Python
20
+ uses: actions/setup-python@v4
21
+ with:
22
+ python-version: '3.11'
23
+ cache: 'pip'
24
+ - name: Install dependencies
25
+ run: |
26
+ python -m pip install --upgrade pip
27
+ pip install hatch
28
+ - name: Build package
29
+ run: hatch build
30
+ - name: Publish package distributions to PyPI
31
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,11 @@
1
+ *.pyc
2
+ .idea
3
+ .vscode
4
+ *.iml
5
+ *.bak
6
+ test
7
+ releases
8
+ demo
9
+ *config.ini
10
+ InteractiveHtmlBom/web/user*
11
+ dist/
@@ -0,0 +1,27 @@
1
+ {
2
+ "indent_size": 2,
3
+ "indent_char": " ",
4
+ "indent_with_tabs": false,
5
+ "editorconfig": false,
6
+ "eol": "\n",
7
+ "end_with_newline": true,
8
+ "indent_level": 0,
9
+ "preserve_newlines": true,
10
+ "max_preserve_newlines": 10,
11
+ "space_in_paren": false,
12
+ "space_in_empty_paren": false,
13
+ "jslint_happy": false,
14
+ "space_after_anon_function": false,
15
+ "space_after_named_function": false,
16
+ "brace_style": "collapse",
17
+ "unindent_chained_methods": false,
18
+ "break_chained_methods": false,
19
+ "keep_array_indentation": false,
20
+ "unescape_strings": false,
21
+ "wrap_line_length": 0,
22
+ "e4x": false,
23
+ "comma_first": false,
24
+ "operator_position": "before-newline",
25
+ "indent_empty_lines": false,
26
+ "templating": ["auto"]
27
+ }
@@ -0,0 +1,384 @@
1
+ # pcbdata struct
2
+
3
+ This document describes pcbdata json structure that plugin
4
+ extracts from PCB file and injects into generated bom page.
5
+
6
+ Notes on conventions:
7
+ * Coordinate system has origin in top left corner i.e. Y grows downwards
8
+ * All angles are in degrees measured clockwise from positive X axis vector
9
+ * Units are arbitrary but some browsers will not handle too large numbers
10
+ well so sticking to mm/mils is preferred.
11
+
12
+ ```js
13
+ pcbdata = {
14
+ // Describes bounding box of all edge cut drawings.
15
+ // Used for determining default zoom and pan values to fit
16
+ // whole board on canvas.
17
+ "edges_bbox": {
18
+ "minx": 1,
19
+ "miny": 2,
20
+ "maxx": 100,
21
+ "maxy": 200,
22
+ },
23
+ // Describes all edge cut drawings including ones in footprints.
24
+ // See drawing structure description below.
25
+ "edges": [drawing1, drawing2, ...],
26
+ "drawings": {
27
+ // Contains all drawings + reference + value texts on silkscreen
28
+ // layer grouped by front and back.
29
+ "silkscreen": {
30
+ "F": [drawing1, drawing2, ...],
31
+ "B": [drawing1, drawing2, ...],
32
+ },
33
+ // Same as above but for fabrication layer.
34
+ "fabrication": {
35
+ "F": [drawing1, drawing2, ...],
36
+ "B": [drawing1, drawing2, ...],
37
+ },
38
+ },
39
+ // Describes footprints.
40
+ // See footprint structure description below.
41
+ // index of entry corresponds to component's numeric ID
42
+ "footprints": [
43
+ footprint1,
44
+ footprint2,
45
+ ...
46
+ ],
47
+ // Optional track data. Vias are 0 length tracks.
48
+ "tracks": {
49
+ "F": [
50
+ {
51
+ // In case of line segment or via (via is 0 length segment)
52
+ "start": [x, y],
53
+ "end": [x, y],
54
+ // In case of arc
55
+ "center": [x, y],
56
+ "startangle":
57
+ "radius": radius,
58
+ "startangle": angle1,
59
+ "endangle": angle2,
60
+ // Common fields
61
+ "width": w,
62
+ // Optional net name
63
+ "net": netname,
64
+ // Optional drill diameter (un-tented vias only)
65
+ "drillsize": x
66
+ },
67
+ ...
68
+ ],
69
+ "B": [...]
70
+ },
71
+ // Optional zone data (should be present if tracks are present).
72
+ "zones": {
73
+ "F": [
74
+ {
75
+ // SVG path of the polygon given as 'd' attribute of svg spec.
76
+ // If "svgpath" is present "polygons" is ignored.
77
+ "svgpath": svgpath,
78
+ // optional fillrule flag, defaults to nonzero
79
+ "fillrule": "nonzero" | "evenodd",
80
+ "polygons": [
81
+ // Set of polylines same as in polygon drawing.
82
+ [[point1x, point1y], [point2x, point2y], ...],
83
+ ],
84
+ // Optional net name.
85
+ "net": netname,
86
+ },
87
+ ...
88
+ ],
89
+ "B": [...]
90
+ },
91
+ // Optional net name list.
92
+ "nets": [net1, net2, ...],
93
+ // PCB metadata from the title block.
94
+ "metadata": {
95
+ "title": "title",
96
+ "revision": "rev",
97
+ "company": "Horns and Hoofs",
98
+ "date": "2019-04-18",
99
+ },
100
+ // Contains full bom table as well as filtered by front/back.
101
+ // See bom row description below.
102
+ "bom": {
103
+ "both": [bomrow1, bomrow2, ...],
104
+ "F": [bomrow1, bomrow2, ...],
105
+ "B": [bomrow1, bomrow2, ...],
106
+ // numeric IDs of DNP components that are not in BOM
107
+ "skipped": [id1, id2, ...]
108
+ // Fields map is keyed on component ID with values being field data.
109
+ // It's order corresponds to order of fields data in config struct.
110
+ "fields" {
111
+ id1: [field1, field2, ...],
112
+ id2: [field1, field2, ...],
113
+ ...
114
+ }
115
+ },
116
+ // Contains parsed stroke data from newstroke font for
117
+ // characters used on the pcb.
118
+ "font_data": {
119
+ "a": {
120
+ "w": character_width,
121
+ // Contains array of polylines that form the character shape.
122
+ "l": [
123
+ [[point1x, point1y], [point2x, point2y],...],
124
+ ...
125
+ ]
126
+ },
127
+ "%": {
128
+ ...
129
+ },
130
+ ...
131
+ },
132
+ }
133
+ ```
134
+
135
+ # drawing struct
136
+
137
+ All drawings are either graphical items (arcs, lines, circles, curves)
138
+ or text.
139
+
140
+ Rendering method and properties are determined based on `type`
141
+ attribute.
142
+
143
+
144
+ ## graphical items
145
+
146
+ ### segment
147
+
148
+ ```js
149
+ {
150
+ "type": "segment",
151
+ "start": [x, y],
152
+ "end": [x, y],
153
+ "width": width,
154
+ }
155
+ ```
156
+
157
+ ### rect
158
+
159
+ ```js
160
+ {
161
+ "type": "rect",
162
+ "start": [x, y], // coordinates of opposing corners
163
+ "end": [x, y],
164
+ "width": width,
165
+ }
166
+ ```
167
+
168
+ ### circle
169
+
170
+ ```js
171
+ {
172
+ "type": "circle",
173
+ "start": [x, y],
174
+ "radius": radius,
175
+ // Optional boolean, defaults to 0
176
+ "filled": 0,
177
+ // Line width (only has effect for non-filled shapes)
178
+ "width": width,
179
+ }
180
+ ```
181
+
182
+ ### arc
183
+
184
+ ```js
185
+ {
186
+ "type": "arc",
187
+ "width": width,
188
+ // SVG path of the arc given as 'd' attribute of svg spec.
189
+ // If this parameter is specified everything below it is ignored.
190
+ "svgpath": svgpath,
191
+ "start": [x, y], // arc center
192
+ "radius": radius,
193
+ "startangle": angle1,
194
+ "endangle": angle2,
195
+ }
196
+ ```
197
+
198
+ ### curve
199
+
200
+ ```js
201
+ {
202
+ "type": "curve", // Bezier curve
203
+ "start": [x, y],
204
+ "end": [x, y],
205
+ "cpa": [x, y], // control point A
206
+ "cpb": [x, y], // control point B
207
+ "width": width,
208
+ }
209
+ ```
210
+
211
+ ### polygon
212
+
213
+ ```js
214
+ {
215
+ "type": "polygon",
216
+ // Optional, defaults to 1
217
+ "filled": 1,
218
+ // Line width (only has effect for non-filled shapes)
219
+ "width": width
220
+ // SVG path of the polygon given as 'd' attribute of svg spec.
221
+ // If this parameter is specified everything below it is ignored.
222
+ "svgpath": svgpath,
223
+ "pos": [x, y],
224
+ "angle": angle,
225
+ "polygons": [
226
+ // Polygons are described as set of outlines.
227
+ [
228
+ [point1x, point1y], [point2x, point2y], ...
229
+ ],
230
+ ...
231
+ ]
232
+ }
233
+ ```
234
+
235
+ ## text
236
+
237
+ ```js
238
+ {
239
+ "pos": [x, y],
240
+ "text": text,
241
+ // SVG path of the text given as 'd' attribute of svg spec.
242
+ // If this parameter is specified then height, width, angle,
243
+ // text attributes and justification is ignored. Rendering engine
244
+ // will not attempt to read character data from newstroke font and
245
+ // will draw the path as is. "thickness" will be used as stroke width.
246
+ "svgpath": svgpath,
247
+ // If polygons are specified then remaining attributes are ignored
248
+ "polygons": [
249
+ // Polygons are described as set of outlines.
250
+ [
251
+ [point1x, point1y], [point2x, point2y], ...
252
+ ],
253
+ ...
254
+ ],
255
+ "height": height,
256
+ "width": width,
257
+ // -1: justify left/top
258
+ // 0: justify center
259
+ // 1: justify right/bot
260
+ "justify": [horizontal, vertical],
261
+ "thickness": thickness,
262
+ "attr": [
263
+ // may include none, one or both
264
+ "italic", "mirrored"
265
+ ],
266
+ "angle": angle,
267
+ // Present only if text is reference designator
268
+ "ref": 1,
269
+ // Present only if text is component value
270
+ "val": 1,
271
+ }
272
+ ```
273
+
274
+ # footprint struct
275
+
276
+ Footprints are a collection of pads, drawings and some metadata.
277
+
278
+ ```js
279
+ {
280
+ "ref": reference,
281
+ "center": [x, y],
282
+ "bbox": {
283
+ // Position of the rotation center of the bounding box.
284
+ "pos": [x, y],
285
+ // Rotation angle in degrees.
286
+ "angle": angle,
287
+ // Left top corner position relative to center (after rotation)
288
+ "relpos": [x, y],
289
+ "size": [x, y],
290
+ },
291
+ "pads": [
292
+ {
293
+ "layers": [
294
+ // Contains one or both
295
+ "F", "B",
296
+ ],
297
+ "pos": [x, y],
298
+ "size": [x, y],
299
+ "angle": angle,
300
+ // Only present if pad is considered first pin.
301
+ // Pins are considered first if it's name is one of
302
+ // 1, A, A1, P1, PAD1
303
+ // OR footprint has no pads named as one of above and
304
+ // current pad's name is lexicographically smallest.
305
+ "pin1": 1,
306
+ // Shape is one of "rect", "oval", "circle", "roundrect", "chamfrect", custom".
307
+ "shape": shape,
308
+ // Only present if shape is "custom".
309
+ // SVG path of the polygon given as 'd' attribute of svg spec.
310
+ // If "svgpath" is present "polygons", "pos", "angle" are ignored.
311
+ "svgpath": svgpath,
312
+ "polygons": [
313
+ // Set of polylines same as in polygon drawing.
314
+ [[point1x, point1y], [point2x, point2y], ...],
315
+ ...
316
+ ],
317
+ // Only present if shape is "roundrect" or "chamfrect".
318
+ "radius": radius,
319
+ // Only present if shape is "chamfrect".
320
+ // chamfpos is a bitmask, left = 1, right = 2, bottom left = 4, bottom right = 8
321
+ "chamfpos": chamfpos,
322
+ "chamfratio": ratio,
323
+ // Pad type is "th" for standard and NPTH pads
324
+ // "smd" otherwise.
325
+ "type": type,
326
+ // Present only if type is "th".
327
+ // One of "circle", "oblong".
328
+ "drillshape": drillshape,
329
+ // Present only if type is "th". In case of circle shape x is diameter, y is ignored.
330
+ "drillsize": [x, y],
331
+ // Optional attribute.
332
+ "offset": [x, y],
333
+ // Optional net name
334
+ "net": netname,
335
+ },
336
+ ...
337
+ ],
338
+ "drawings": [
339
+ // Contains only copper F_Cu, B_Cu drawings of the footprint.
340
+ {
341
+ // One of "F", "B".
342
+ "layer": layer,
343
+ // See drawing struct description above.
344
+ "drawing": drawing,
345
+ },
346
+ ...
347
+ ],
348
+ // One of "F", "B".
349
+ "layer": layer,
350
+ }
351
+ ```
352
+
353
+ # bom row struct
354
+
355
+ Bom row is a list of reference sets
356
+
357
+ Reference set is array of tuples of (ref, id) where id is just
358
+ a unique numeric identifier for each footprint that helps avoid
359
+ collisions when references are duplicated.
360
+
361
+ ```js
362
+ [
363
+ [reference_name, footprint_id],
364
+ ...
365
+ ]
366
+ ```
367
+
368
+ # config struct
369
+
370
+ ```js
371
+ config = {
372
+ "dark_mode": bool,
373
+ "show_pads": bool,
374
+ "show_fabrication": bool,
375
+ "show_silkscreen": bool,
376
+ "highlight_pin1": "none" | "all" | "selected",
377
+ "redraw_on_drag": bool,
378
+ "board_rotation": int,
379
+ "checkboxes": "checkbox1,checkbox2,...",
380
+ "bom_view": "bom-only" | "left-right" | "top-bottom",
381
+ "layer_view": "F" | "FB" | "B",
382
+ "extra_fields": ["field1_name", "field2_name", ...],
383
+ }
384
+ ```
@@ -0,0 +1 @@
1
+ *.bat eol=crlf
@@ -0,0 +1,73 @@
1
+ @echo off
2
+ set pathofEDASourceFile=%1
3
+ set FilePath=%~dp0
4
+
5
+ ::delete --show-dialog after first start up and setting
6
+ set option=--show-dialog
7
+
8
+ ::detect current language of user.
9
+ reg query "HKCU\Control Panel\Desktop" /v PreferredUILanguages>nul 2>nul&&goto _dosearch1_||goto _dosearch2_
10
+
11
+ :_dosearch1_
12
+ FOR /F "tokens=3" %%a IN (
13
+ 'reg query "HKCU\Control Panel\Desktop" /v PreferredUILanguages ^| find "PreferredUILanguages"'
14
+ ) DO (
15
+ set language=%%a
16
+ )
17
+ set language=%language:~,2%
18
+ goto _setlanguage_
19
+
20
+ :_dosearch2_
21
+ FOR /F "tokens=3" %%a IN (
22
+ 'reg query "HKLM\SYSTEM\ControlSet001\Control\Nls\Language" /v InstallLanguage ^| find "InstallLanguage"'
23
+ ) DO (
24
+ set language=%%a
25
+ )
26
+ if %language%==0804 (
27
+ set language=zh
28
+ )
29
+ goto _setlanguage_
30
+
31
+ :_setlanguage_
32
+ if %language%==zh (
33
+ call %FilePath%\i18n\language_zh.bat
34
+ ) else (
35
+ call %FilePath%\i18n\language_en.bat
36
+ )
37
+
38
+ cls
39
+
40
+ echo -------------------------------------------------------------------------------------------------------------------
41
+ echo -------------------------------------------------------------------------------------------------------------------
42
+ echo.
43
+ echo %i18n_thx4using%
44
+ echo %i18n_gitAddr%
45
+ echo %i18n_batScar%
46
+ echo.
47
+ echo -------------------------------------------------------------------------------------------------------------------
48
+ echo -------------------------------------------------------------------------------------------------------------------
49
+
50
+ set pyFilePath=%FilePath%generate_interactive_bom.py
51
+
52
+ :_convert_
53
+ if not defined pathofEDASourceFile (
54
+ set /p pathofEDASourceFile=%i18n_draghere%
55
+ )
56
+ echo.
57
+ echo %i18n_converting%
58
+ echo.
59
+ python %pyFilePath% %pathofEDASourceFile% %option%
60
+ set pathofEDASourceFile=
61
+
62
+ echo -------------------------------------------------------------------------------------------------------------------
63
+ echo -------------------------------------------------------------------------------------------------------------------
64
+ echo.
65
+ echo %i18n_converted%
66
+ echo.
67
+ echo -------------------------------------------------------------------------------------------------------------------
68
+ echo -------------------------------------------------------------------------------------------------------------------
69
+
70
+
71
+ CHOICE /C YN /N /M "%i18n_again% [ Y/N ]"
72
+ if errorlevel 2 exit
73
+ if errorlevel 1 goto _convert_
@@ -0,0 +1,58 @@
1
+ import os
2
+ import sys
3
+ import threading
4
+ import time
5
+
6
+ import wx
7
+ import wx.aui
8
+
9
+
10
+ def check_for_bom_button():
11
+ # From Miles McCoo's blog
12
+ # https://kicad.mmccoo.com/2017/03/05/adding-your-own-command-buttons-to-the-pcbnew-gui/
13
+ def find_pcbnew_window():
14
+ windows = wx.GetTopLevelWindows()
15
+ pcbneww = [w for w in windows if "pcbnew" in w.GetTitle().lower()]
16
+ if len(pcbneww) != 1:
17
+ return None
18
+ return pcbneww[0]
19
+
20
+ def callback(_):
21
+ plugin.Run()
22
+
23
+ path = os.path.dirname(__file__)
24
+ while not wx.GetApp():
25
+ time.sleep(1)
26
+ bm = wx.Bitmap(path + '/icon.png', wx.BITMAP_TYPE_PNG)
27
+ button_wx_item_id = 0
28
+
29
+ from pcbnew import ID_H_TOOLBAR
30
+ while True:
31
+ time.sleep(1)
32
+ pcbnew_window = find_pcbnew_window()
33
+ if not pcbnew_window:
34
+ continue
35
+
36
+ top_tb = pcbnew_window.FindWindowById(ID_H_TOOLBAR)
37
+ if button_wx_item_id == 0 or not top_tb.FindTool(button_wx_item_id):
38
+ top_tb.AddSeparator()
39
+ button_wx_item_id = wx.NewId()
40
+ top_tb.AddTool(button_wx_item_id, "iBOM", bm,
41
+ "Generate interactive BOM", wx.ITEM_NORMAL)
42
+ top_tb.Bind(wx.EVT_TOOL, callback, id=button_wx_item_id)
43
+ top_tb.Realize()
44
+
45
+
46
+ if (not os.environ.get('INTERACTIVE_HTML_BOM_CLI_MODE', False) and
47
+ not os.path.basename(sys.argv[0]).startswith('generate_interactive_bom')):
48
+ from .ecad.kicad import InteractiveHtmlBomPlugin
49
+
50
+ plugin = InteractiveHtmlBomPlugin()
51
+ plugin.register()
52
+
53
+ # Add a button the hacky way if plugin button is not supported
54
+ # in pcbnew, unless this is linux.
55
+ if not plugin.pcbnew_icon_support and not sys.platform.startswith('linux'):
56
+ t = threading.Thread(target=check_for_bom_button)
57
+ t.daemon = True
58
+ t.start()