Skip to content

Commit 943ed6e

Browse files
add boiler plate arrows code (need to finish)
1 parent c59f4ff commit 943ed6e

8 files changed

+35
-13
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ __pycache__/
1010
.Python
1111
build/
1212
develop-eggs/
13-
dist/
13+
# dist/ # Releases live here, let's keep them
1414
downloads/
1515
eggs/
1616
.eggs/
41.8 KB
Binary file not shown.

dist/schemascii-0.1.1.tar.gz

52.3 KB
Binary file not shown.

release.py

100644100755
Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#! /usr/bin/env python3
12
import argparse
23
import os
34
import re
@@ -7,7 +8,7 @@
78
def cmd(sh_line):
89
print(sh_line)
910
if code := os.system(sh_line):
10-
print("***Exit", code, file=sys.stderr)
11+
print("***Error", code, file=sys.stderr)
1112
sys.exit(code)
1213

1314

@@ -37,15 +38,19 @@ def writefile(file, text):
3738

3839
cmd("python3 -m build --sdist")
3940
cmd("python3 -m build --wheel")
41+
4042
cmd("schemascii test_data/test_charge_pump.txt --out test_data/test_charge_pump.txt.svg --padding 30")
43+
44+
print("for some reason convert isn't working with the css, so aborting the auto-rendering")
45+
sys.exit(0)
46+
4147
cmd("convert test_data/test_charge_pump.txt.svg test_data/test_charge_pump.png")
4248

4349
svg_content = readfile("test_data/test_charge_pump.txt.svg")
4450
css_content = readfile("schemascii_example.css")
45-
writefile("test_data/test_charge_pump.txt.svg",
51+
writefile("test_data/test_charge_pump_css.txt.svg",
4652
svg_content.replace("</svg>", f'<style>{css_content}</style></svg>'))
47-
cmd("convert test_data/test_charge_pump.txt.svg test_data/test_charge_pump_css.png")
48-
writefile("test_data/test_charge_pump.txt.svg", svg_content)
53+
cmd("convert test_data/test_charge_pump_css.txt.svg test_data/test_charge_pump_css.png")
4954

5055
# cmd("git add -A")
5156
# cmd("git commit -m 'blah'")

schemascii/components_render.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,6 @@ def sort_terminals(
8383
return sort_terminals
8484

8585

86-
@component("R", "RV", "VR")
87-
@n_terminal(2)
88-
@no_ambiguous
8986
def resistor(
9087
box: Cbox,
9188
terminals: list[Terminal],
@@ -111,9 +108,10 @@ def resistor(
111108
text_pt, **options))
112109

113110

114-
@component("C", "CV", "VC")
115-
@polarized
116-
@no_ambiguous
111+
# Register it
112+
component("R", "RV", "VR")(n_terminal(2)(no_ambiguous(resistor)))
113+
114+
117115
def capacitor(
118116
box: Cbox,
119117
terminals: list[Terminal],
@@ -137,6 +135,9 @@ def capacitor(
137135
box, bom_data, terminals, (("F", True), ("V", False)),
138136
text_pt, **options))
139137

138+
# Register it
139+
component("C", "CV", "VC")(n_terminal(2)(no_ambiguous(capacitor)))
140+
140141

141142
@component("B", "BT", "BAT")
142143
@polarized

schemascii/utils.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,22 @@ def make_variable(
240240
], center, theta), **options)
241241

242242

243+
# def arrows(
244+
# center: complex,
245+
# theta: float,
246+
# out: bool,
247+
# **options):
248+
# """Draw arrows towards or away from the component
249+
# (i.e.light-emitting or light-dependent)."""
250+
# theta = theta % pi
251+
# if out:
252+
# return bunch_o_lines(deep_transform([
253+
# (-.5-.6j, .5-1.2j),
254+
# (.375-1.2j, .5-1.2j),
255+
# (.5-1.)
256+
# ], center, theta), **options)
257+
258+
243259
def sort_counterclockwise(terminals: list[Terminal]) -> list[Terminal]:
244260
"Sort the terminals in counterclockwise order."
245261
partitioned = {

schemascii_example.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,6 @@ svg.schemascii .component tspan:is(.cmp-value, .part-num) {
5555
fill: black;
5656
}
5757
svg.schemascii :is(.wire, .component):hover {
58-
--sch-color: green;
58+
--sch-color: lime;
5959
}
6060
}

test_data/test_charge_pump.txt.svg

Lines changed: 1 addition & 1 deletion
Loading

0 commit comments

Comments
 (0)