MCPcopy
hub / github.com/yaqwsx/KiKit / runBoardExample

Function runBoardExample

kikit/doc.py:81–124  ·  view source on GitHub ↗

Run kikit CLI command with args - omitting the output file name. Prints a markdown with the command and includes a generated board image. Generating images runs in parallel, so do not forget to invoke runBoardExampleJoin() at the end of your script.

(name, args)

Source from the content-addressed store, hash-verified

79runExampleThreads = []
80
81def runBoardExample(name, args):
82 """
83 Run kikit CLI command with args - omitting the output file name. Prints a
84 markdown with the command and includes a generated board image.
85
86 Generating images runs in parallel, so do not forget to invoke
87 runBoardExampleJoin() at the end of your script.
88 """
89 realArgs = ["python3", "-m", "kikit.ui"] + list(chain(*args))
90
91 # We print first, so in a case of failure we have the command in a nice
92 # copy-paste-ready form
93 args[0] = ["kikit"] + args[0]
94 args[-1] = args[-1] + ["panel.kicad_pcb"]
95
96 print('!!! example "Panelization command"\n')
97
98 print(' === "Linux/macOS"')
99 print(" ```")
100 for i, c in enumerate(args):
101 if i == 0:
102 print(" ", end="")
103 else:
104 print(" ", end="")
105 end = "\n" if i + 1 == len(args) else " \\\n"
106 print(" ".join(quotePosix(c)), end=end)
107 print(" ```")
108 print("")
109 print(' === "Windows"')
110 print(" ```")
111 for i, c in enumerate(args):
112 if i == 0:
113 print(" ", end="")
114 else:
115 print(" ", end="")
116 end = "\n" if i + 1 == len(args) else " ^\n"
117 print(" ".join(quoteWindows(c)), end=end)
118 print(" ```\n")
119 print(" ![{0}](../resources/{0}.png)".format(name))
120
121 t = threading.Thread(target=lambda: panelizeAndDraw(name, realArgs))
122 t.start()
123 global runExampleThreads
124 runExampleThreads.append(t)
125
126def runScriptingExample(name, args):
127 """

Callers 2

exampleDoc.pyFile · 0.90

Calls 5

quotePosixFunction · 0.85
quoteWindowsFunction · 0.85
panelizeAndDrawFunction · 0.85
startMethod · 0.80
formatMethod · 0.45

Tested by

no test coverage detected