omnipython-apps 0.1.4.dev8__py3-none-any.whl
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.
- apps/__init__.py +5 -0
- apps/about/__init__.py +257 -0
- apps/about/app.json +1 -0
- apps/about/credits.py +12 -0
- apps/about/facts.py +398 -0
- apps/about/fonts/OFL.txt +93 -0
- apps/about/fonts/latin1_14.bin +0 -0
- apps/about/fonts/latin1_16.bin +0 -0
- apps/about/fonts/latin1_24.bin +0 -0
- apps/about/fonts/latin1_32.bin +0 -0
- apps/about/fonts/latin1_40.bin +0 -0
- apps/backline/__init__.py +58 -0
- apps/backline/app.json +1 -0
- apps/backline/app.py +475 -0
- apps/backline/art.py +717 -0
- apps/backline/ask.py +781 -0
- apps/backline/box.py +502 -0
- apps/backline/cast.py +137 -0
- apps/backline/desk/__init__.py +329 -0
- apps/backline/desk/editor.py +331 -0
- apps/backline/desk/grid.py +154 -0
- apps/backline/desk/look.py +169 -0
- apps/backline/desk/pedals.py +102 -0
- apps/backline/desk/perform.py +157 -0
- apps/backline/desk/prompt.py +210 -0
- apps/backline/desk/strip.py +159 -0
- apps/backline/desk_main.py +226 -0
- apps/backline/engine.py +622 -0
- apps/backline/floor.py +509 -0
- apps/backline/footswitch.py +119 -0
- apps/backline/glyphs.py +82 -0
- apps/backline/kits.py +428 -0
- apps/backline/midipedal.py +362 -0
- apps/backline/page_data.py +413 -0
- apps/backline/parts.py +145 -0
- apps/backline/pedal.py +107 -0
- apps/backline/remote.py +134 -0
- apps/backline/songs/ballad_68.json +1 -0
- apps/backline/songs/bossa.json +1 -0
- apps/backline/songs/country_train.json +1 -0
- apps/backline/songs/funk.json +1 -0
- apps/backline/songs/metal.json +1 -0
- apps/backline/songs/pop.json +1 -0
- apps/backline/songs/rock.json +1 -0
- apps/backline/songs/shuffle.json +1 -0
- apps/battery/__init__.py +101 -0
- apps/battery/app.json +1 -0
- apps/bit_world/act_deck.py +683 -0
- apps/bit_world/act_game.py +762 -0
- apps/bit_world/act_pet.py +1032 -0
- apps/bit_world/app.json +1 -0
- apps/bit_world/bit_output.py +45 -0
- apps/bit_world/bit_palette.py +503 -0
- apps/bit_world/bit_sound.py +431 -0
- apps/bit_world/bit_sprites.py +632 -0
- apps/bit_world/bit_world.py +534 -0
- apps/btreceiver/__init__.py +690 -0
- apps/btreceiver/app.json +1 -0
- apps/btreceiver/chime.py +155 -0
- apps/btreceiver/demo.py +529 -0
- apps/btreceiver/screen.py +633 -0
- apps/camera/__init__.py +316 -0
- apps/camera/app.json +1 -0
- apps/card/__init__.py +113 -0
- apps/card/app.json +1 -0
- apps/cast/__init__.py +631 -0
- apps/cast/app.json +1 -0
- apps/cast/receivers.py +193 -0
- apps/chess/__init__.py +18 -0
- apps/chess/app.json +1 -0
- apps/chess/app.py +922 -0
- apps/chess/art.py +323 -0
- apps/chess/ble.py +411 -0
- apps/chess/engine.py +925 -0
- apps/chess/game.py +327 -0
- apps/chess/net.py +261 -0
- apps/clock/__init__.py +38 -0
- apps/clock/app.json +1 -0
- apps/detect/__init__.py +214 -0
- apps/detect/app.json +1 -0
- apps/fmsynth/__init__.py +41 -0
- apps/fmsynth/algorithms.py +61 -0
- apps/fmsynth/app.json +1 -0
- apps/fmsynth/app.py +355 -0
- apps/fmsynth/editor.py +206 -0
- apps/fmsynth/engine.py +257 -0
- apps/fmsynth/meters.py +262 -0
- apps/fmsynth/midi.py +375 -0
- apps/fmsynth/panel_view.py +1071 -0
- apps/fmsynth/patches/fmsynth-01.syx +0 -0
- apps/fmsynth/settings.py +138 -0
- apps/fmsynth/voice.py +398 -0
- apps/gamepad/__init__.py +685 -0
- apps/gamepad/app.json +1 -0
- apps/gamepad/pad.py +94 -0
- apps/gamepad/watch.py +352 -0
- apps/hidden/__init__.py +72 -0
- apps/hidden/app.json +1 -0
- apps/home/__init__.py +483 -0
- apps/home/app.json +1 -0
- apps/home/main.py +36 -0
- apps/homeassistant/__init__.py +213 -0
- apps/homeassistant/api.py +104 -0
- apps/homeassistant/app.json +1 -0
- apps/huey/__init__.py +287 -0
- apps/huey/acting.py +184 -0
- apps/huey/actor.py +194 -0
- apps/huey/app.json +1 -0
- apps/huey/client.py +125 -0
- apps/huey/servers.py +121 -0
- apps/huey/settings.example.json +8 -0
- apps/huey/settings.py +97 -0
- apps/huey/turn.py +504 -0
- apps/huey/voice.py +217 -0
- apps/info/__init__.py +810 -0
- apps/info/app.json +1 -0
- apps/lora/__init__.py +62 -0
- apps/lora/app.json +1 -0
- apps/manifest.py +71 -0
- apps/medialink_baby_monitor/__init__.py +222 -0
- apps/medialink_baby_monitor/app.json +1 -0
- apps/medialink_doorbell/__init__.py +251 -0
- apps/medialink_doorbell/app.json +1 -0
- apps/medialink_hands_free/__init__.py +217 -0
- apps/medialink_hands_free/app.json +1 -0
- apps/medialink_surveillance_camera/__init__.py +258 -0
- apps/medialink_surveillance_camera/app.json +1 -0
- apps/medialink_video_doorbell/__init__.py +289 -0
- apps/medialink_video_doorbell/app.json +1 -0
- apps/medialink_videophone/__init__.py +273 -0
- apps/medialink_videophone/app.json +1 -0
- apps/medialink_walkie_talkie/__init__.py +228 -0
- apps/medialink_walkie_talkie/app.json +1 -0
- apps/midicontroller/__init__.py +774 -0
- apps/midicontroller/app.json +1 -0
- apps/midicontroller/links.py +421 -0
- apps/midicontroller/surface.py +343 -0
- apps/midiengine/__init__.py +977 -0
- apps/midiengine/app.json +1 -0
- apps/midiengine/banks.py +85 -0
- apps/midiengine/midiin.py +165 -0
- apps/midiengine/player.py +392 -0
- apps/midiengine/umidiparser.py +1413 -0
- apps/mp3/__init__.py +240 -0
- apps/mp3/app.json +1 -0
- apps/perch/__init__.py +119 -0
- apps/perch/app.json +1 -0
- apps/perch/huey.py +481 -0
- apps/perch/huey_props.py +386 -0
- apps/perch/huey_shift.py +42 -0
- apps/perch/huey_views.py +296 -0
- apps/perch/scene_bench.py +680 -0
- apps/perch/scene_coast.py +479 -0
- apps/perch/scene_desk.py +492 -0
- apps/perch/stage.py +1274 -0
- apps/perch/vec.py +366 -0
- apps/repl/__init__.py +325 -0
- apps/repl/app.json +1 -0
- apps/roku/__init__.py +156 -0
- apps/roku/app.json +1 -0
- apps/rokucam/__init__.py +362 -0
- apps/rokucam/app.json +1 -0
- apps/security/__init__.py +261 -0
- apps/security/app.json +1 -0
- apps/settings/__init__.py +221 -0
- apps/settings/app.json +1 -0
- apps/shell/__init__.py +33 -0
- apps/shell/app.json +1 -0
- apps/spotify/__init__.py +669 -0
- apps/spotify/app.json +1 -0
- apps/spotify/screen.py +82 -0
- apps/steps/__init__.py +58 -0
- apps/steps/app.json +1 -0
- apps/stompbox/__init__.py +31 -0
- apps/stompbox/app.json +1 -0
- apps/stompbox/app.py +668 -0
- apps/stompbox/boards.json +20 -0
- apps/stompbox/effects.py +241 -0
- apps/stompbox/engine.py +340 -0
- apps/stompbox/footswitch.py +331 -0
- apps/stompbox/inputs.py +449 -0
- apps/stompbox/meter.py +72 -0
- apps/stompbox/outputs.py +135 -0
- apps/stompbox/pedals.txt +45 -0
- apps/stompbox/presets.py +106 -0
- apps/stompbox/styles.py +135 -0
- apps/stompbox/ui.py +817 -0
- apps/stompbox/wavfile.py +73 -0
- apps/synthstation/__init__.py +20 -0
- apps/synthstation/app.json +1 -0
- apps/synthstation/audio.py +397 -0
- apps/synthstation/catalog.py +50 -0
- apps/synthstation/meters.py +136 -0
- apps/synthstation/midi.py +380 -0
- apps/synthstation/pads.py +177 -0
- apps/synthstation/parts.py +128 -0
- apps/synthstation/station.py +1069 -0
- apps/system/__init__.py +11 -0
- apps/system/app.json +1 -0
- apps/touchcal/__init__.py +324 -0
- apps/touchcal/app.json +1 -0
- apps/touchcal/fit.py +262 -0
- apps/wake/__init__.py +268 -0
- apps/wake/app.json +1 -0
- apps/wake/feed.py +155 -0
- apps/watch/__init__.py +355 -0
- apps/watch/app.json +1 -0
- apps/watch/faces.py +35 -0
- apps/watch/wheel.py +157 -0
- apps/weather/__init__.py +278 -0
- apps/weather/app.json +1 -0
- apps/weather/icons.py +172 -0
- apps/weather/sizing.py +71 -0
- apps/weather/zippad.py +172 -0
- omnipython_apps-0.1.4.dev8.dist-info/METADATA +33 -0
- omnipython_apps-0.1.4.dev8.dist-info/RECORD +218 -0
- omnipython_apps-0.1.4.dev8.dist-info/WHEEL +5 -0
- omnipython_apps-0.1.4.dev8.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,680 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2026 Brad Barnett
|
|
2
|
+
#
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
"""The workbench: a board in a vise under the lamp, and someone working on it.
|
|
5
|
+
|
|
6
|
+
`draw` adds the whole scene to a `vec.Doc`, 800 units wide and 480 tall.
|
|
7
|
+
The chameleon solders from the bar of a helping-hands stand, looks out at you
|
|
8
|
+
from the top of the board, or hangs from the wire rack. Every view is of that
|
|
9
|
+
one drawing, from the whole bench down to the board's parts.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
import math
|
|
13
|
+
|
|
14
|
+
from . import huey_props
|
|
15
|
+
from . import huey_shift # noqa: F401 (its colour schemes)
|
|
16
|
+
from . import huey_views
|
|
17
|
+
from . import huey
|
|
18
|
+
from .vec import at, circle, ellipse, group, limb, line, path, pts, rect, smooth
|
|
19
|
+
|
|
20
|
+
WALL = 0x17364A
|
|
21
|
+
PEG = 0xD6AD78
|
|
22
|
+
PEG_SHADE = 0xC39A66
|
|
23
|
+
PEG_HOLE = 0x9C7446
|
|
24
|
+
FRAME = 0x7A4E2B
|
|
25
|
+
WOOD = 0xB5733F
|
|
26
|
+
WOOD_LIGHT = 0xCF8E55
|
|
27
|
+
WOOD_DARK = 0x935A2E
|
|
28
|
+
MAT = 0x1F7D62
|
|
29
|
+
MAT_LIT = 0x2B9978
|
|
30
|
+
MAT_LINE = 0x58BC9A
|
|
31
|
+
MAT_EDGE = 0x155A47
|
|
32
|
+
PCB = 0x0B2A4A
|
|
33
|
+
PCB_EDGE = 0x1A4A7A
|
|
34
|
+
TRACE = 0x1F568C
|
|
35
|
+
GOLD = 0xE8B84A
|
|
36
|
+
GOLD_DARK = 0xB58A2C
|
|
37
|
+
LIME = 0xC4DC4C
|
|
38
|
+
STEEL = 0xC6D0D9
|
|
39
|
+
STEEL_LIGHT = 0xEEF3F7
|
|
40
|
+
STEEL_DARK = 0x8492A0
|
|
41
|
+
IRON = 0x39424D
|
|
42
|
+
IRON_LIGHT = 0x56626F
|
|
43
|
+
BLACK = 0x1B2028
|
|
44
|
+
MUSTARD = 0xF2B632
|
|
45
|
+
MUSTARD_DARK = 0xC98D1B
|
|
46
|
+
LIGHT = 0xFFE9A8
|
|
47
|
+
CREAM = 0xFFF6E0
|
|
48
|
+
RED = 0xE2483A
|
|
49
|
+
TEAL = 0x2BA6B8
|
|
50
|
+
ORANGE = 0xF29A2E
|
|
51
|
+
SHADOW = 0x000000
|
|
52
|
+
|
|
53
|
+
# The board's top-left corner; it is 204 wide and 130 tall.
|
|
54
|
+
BOARD_X, BOARD_Y = 453, 262
|
|
55
|
+
# The helping-hands bar the chameleon stands on: where his perch is, and its size.
|
|
56
|
+
HUEY_X, HUEY_Y, HUEY_SCALE = 322, 404, 0.6
|
|
57
|
+
# The wire rack on the pegboard that he hangs from: the rod's left end and top.
|
|
58
|
+
RACK_X, RACK_Y = 210, 188
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def _dots(x0, y, x1, pitch, size, color):
|
|
62
|
+
# a row of round dots: a line dashed into points with round caps
|
|
63
|
+
return path("M%s %sL%s %s" % (x0, y, x1, y), None, color, size, extra='stroke-dasharray="0.01 %s"' % pitch)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
# --- the wall ----------------------------------------------------------------
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def _pegboard():
|
|
70
|
+
out = [rect(0, 0, 800, 480, WALL), rect(22, 14, 756, 312, FRAME, r=7), rect(31, 23, 738, 303, PEG)]
|
|
71
|
+
out.append(rect(31, 23, 738, 7, PEG_SHADE))
|
|
72
|
+
y = 46
|
|
73
|
+
while y < 318:
|
|
74
|
+
out.append(_dots(48, y, 760, 22, 5.5, PEG_HOLE))
|
|
75
|
+
y += 22
|
|
76
|
+
return b"".join(out)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def _cabinet(x, y):
|
|
80
|
+
# a parts cabinet: four by three clear drawers, each with something in it
|
|
81
|
+
out = [rect(x - 7, y - 3, 190, 124, SHADOW, r=5, opacity=0.14)]
|
|
82
|
+
out.append(rect(x, y, 180, 112, 0x35505F, r=5))
|
|
83
|
+
out.append(rect(x, y, 180, 5, 0x47677A, r=2))
|
|
84
|
+
fills = (RED, MUSTARD, LIME, TEAL, ORANGE, 0xB98AD9, STEEL, GOLD, TEAL, LIME, RED, MUSTARD)
|
|
85
|
+
for row in range(3):
|
|
86
|
+
for col in range(4):
|
|
87
|
+
dx, dy = x + 7 + col * 42, y + 10 + row * 33
|
|
88
|
+
out.append(rect(dx, dy, 40, 29, 0x233845, r=3))
|
|
89
|
+
out.append(rect(dx + 2, dy + 2, 36, 25, 0x9CC6D4, r=2))
|
|
90
|
+
out.append(rect(dx + 4, dy + 15, 32, 10, fills[row * 4 + col], r=2))
|
|
91
|
+
out.append(rect(dx + 2, dy + 2, 36, 5, 0xC9E6EF, r=2))
|
|
92
|
+
out.append(rect(dx + 13, dy + 9, 14, 4, 0x35505F, r=2))
|
|
93
|
+
# the shelf it stands on
|
|
94
|
+
out.append(rect(x - 16, y + 112, 212, 9, WOOD_DARK, r=2))
|
|
95
|
+
out.append(rect(x - 16, y + 112, 212, 3, WOOD_LIGHT, r=1))
|
|
96
|
+
out.append(rect(x - 16, y + 119, 212, 2.5, FRAME, r=1))
|
|
97
|
+
return b"".join(out)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def _succulent(x, y):
|
|
101
|
+
out = []
|
|
102
|
+
for dx, tip, color in ((-15, -22, 0x3F8F5F), (15, -24, 0x3F8F5F), (-8, -32, 0x58AD72), (9, -33, 0x58AD72), (0, -38, 0x7CC98D)):
|
|
103
|
+
out.append(limb(x + dx * 0.3, y - 6, x + dx, y + tip, 0.12 if dx < 0 else -0.12, 13, 3, color))
|
|
104
|
+
out.append(path(pts(((x - 15, y - 8), (x + 15, y - 8), (x + 11, y + 12), (x - 11, y + 12)), True), 0xC96A45))
|
|
105
|
+
out.append(rect(x - 17, y - 11, 34, 6, 0xDE8159, r=2))
|
|
106
|
+
return b"".join(out)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def _screwdrivers(x, y):
|
|
110
|
+
# three screwdrivers standing in a rail
|
|
111
|
+
out = [rect(x - 6, y + 5, 98, 4, SHADOW, r=2, opacity=0.16)]
|
|
112
|
+
for i, color in enumerate((ORANGE, TEAL, 0x8E6BBF)):
|
|
113
|
+
cx = x + 14 + i * 30
|
|
114
|
+
out.append(rect(cx - 1.8, y, 3.6, 58, STEEL_DARK))
|
|
115
|
+
out.append(rect(cx - 1.8, y, 1.4, 58, STEEL_LIGHT))
|
|
116
|
+
out.append(path(pts(((cx - 3, y + 56), (cx + 3, y + 56), (cx + 1.6, y + 64), (cx - 1.6, y + 64)), True), STEEL_DARK))
|
|
117
|
+
out.append(rect(cx - 8, y - 44, 16, 42, color, r=6))
|
|
118
|
+
out.append(rect(cx + 2, y - 40, 3.5, 30, 0xFFFFFF, r=1.7, opacity=0.35))
|
|
119
|
+
out.append(rect(cx - 8, y - 12, 16, 6, BLACK, opacity=0.35))
|
|
120
|
+
out.append(rect(x - 4, y - 4, 96, 10, IRON, r=3))
|
|
121
|
+
out.append(rect(x - 4, y - 4, 96, 3, IRON_LIGHT, r=1.5))
|
|
122
|
+
return b"".join(out)
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
def _pliers(x, y):
|
|
126
|
+
# hung on a hook by the pivot, jaws up
|
|
127
|
+
out = [limb(x - 10, y + 16, x - 27, y + 86, -0.10, 12, 10, SHADOW, opacity=0.13)]
|
|
128
|
+
out.append(path(pts(((x - 8, y + 4), (x - 5, y - 40), (x - 0.8, y - 44), (x - 0.8, y + 4)), True), STEEL))
|
|
129
|
+
out.append(path(pts(((x + 8, y + 4), (x + 5, y - 40), (x + 0.8, y - 44), (x + 0.8, y + 4)), True), STEEL_DARK))
|
|
130
|
+
out.append(limb(x - 4, y + 8, x - 20, y + 80, -0.10, 12, 10, RED))
|
|
131
|
+
out.append(limb(x + 4, y + 8, x + 20, y + 80, 0.10, 12, 10, 0xB93A2E))
|
|
132
|
+
out.append(limb(x - 6, y + 26, x - 18, y + 70, -0.08, 3, 3, 0xFF8C7A))
|
|
133
|
+
out.append(circle(x, y + 6, 8, STEEL_DARK))
|
|
134
|
+
out.append(circle(x, y + 6, 3.2, STEEL_LIGHT))
|
|
135
|
+
return b"".join(out)
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
def _spool(x, y, loose=True):
|
|
139
|
+
# a reel of solder on a peg, a loose end hanging
|
|
140
|
+
out = [circle(x - 5, y + 5, 27, SHADOW, opacity=0.13)]
|
|
141
|
+
if loose:
|
|
142
|
+
out.append(path("M%s %sC%s %s %s %s %s %sS%s %s %s %s" % (x + 21, y + 6, x + 30, y + 30, x + 12, y + 44, x + 22, y + 60, x + 34, y + 70, x + 26, y + 78), None, STEEL, 2.2))
|
|
143
|
+
out.append(circle(x, y, 27, 0x2F6FA8))
|
|
144
|
+
out.append(circle(x, y, 27, None, 0x245A8B, 3))
|
|
145
|
+
out.append(circle(x, y, 20, STEEL))
|
|
146
|
+
for r in (17, 14, 11):
|
|
147
|
+
out.append(circle(x, y, r, None, STEEL_DARK, 1))
|
|
148
|
+
out.append(circle(x, y, 8, 0x2F6FA8))
|
|
149
|
+
out.append(circle(x, y, 3.5, BLACK))
|
|
150
|
+
out.append(path("M%s %sA22 22 0 0 1 %s %s" % (x + 4, y - 23.5, x + 21, y - 9), None, 0x7FB4E0, 2.5))
|
|
151
|
+
return b"".join(out)
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
def _tape(x, y):
|
|
155
|
+
out = [circle(x - 4, y + 5, 21, SHADOW, opacity=0.13)]
|
|
156
|
+
out.append(circle(x, y, 16, None, 0xD98E2B, 10))
|
|
157
|
+
out.append(circle(x, y, 20.5, None, 0xB87118, 1.2))
|
|
158
|
+
out.append(path("M%s %sA16 16 0 0 1 %s %s" % (x + 2, y - 16, x + 15, y - 5), None, 0xF4B55A, 3))
|
|
159
|
+
out.append(circle(x, y - 13, 2.6, IRON))
|
|
160
|
+
return b"".join(out)
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
def _postcard(x, y, rot):
|
|
164
|
+
# a postcard of the shore, pinned up
|
|
165
|
+
out = [rect(-3, 4, 84, 58, SHADOW, opacity=0.14), rect(0, 0, 84, 58, CREAM)]
|
|
166
|
+
out.append(rect(5, 5, 74, 48, 0xFFC98A))
|
|
167
|
+
out.append(rect(5, 5, 74, 12, 0xF79F79))
|
|
168
|
+
out.append(circle(54, 30, 9, 0xFFF1B8))
|
|
169
|
+
out.append(rect(5, 30, 74, 13, 0x2A93A8))
|
|
170
|
+
out.append(rect(5, 30, 74, 3, 0x7FD0D6))
|
|
171
|
+
out.append(path("M5 53L5 44Q30 36 79 43L79 53Z", 0xF3D9A8))
|
|
172
|
+
out.append(path(pts(((18, 30), (20, 16), (22, 30)), True), CREAM))
|
|
173
|
+
out.append(rect(19, 20, 2, 3, RED))
|
|
174
|
+
out.append(circle(42, 3, 3.2, RED))
|
|
175
|
+
out.append(circle(41, 2, 1.1, 0xFF9A8C))
|
|
176
|
+
return at(x, y, b"".join(out), rot=rot)
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
def _sticky(x, y, rot):
|
|
180
|
+
out = [rect(-2, 3, 46, 44, SHADOW, opacity=0.14), rect(0, 0, 46, 44, 0xFFE26A)]
|
|
181
|
+
out.append(path("M46 44L34 44L46 32Z", 0xE8C440))
|
|
182
|
+
for i, w in enumerate((30, 34, 22)):
|
|
183
|
+
out.append(line(7, 12 + i * 9, 7 + w, 12 + i * 9, 0x8A7420, 1.6))
|
|
184
|
+
out.append(rect(14, -4, 18, 9, 0xBFE0EA, opacity=0.8))
|
|
185
|
+
return at(x, y, b"".join(out), rot=rot)
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
def _mug(x, y):
|
|
189
|
+
# a mug of pens at the back of the bench
|
|
190
|
+
out = [ellipse(x - 8, y + 1, 30, 6, SHADOW, opacity=0.2)]
|
|
191
|
+
out.append(limb(x - 9, y - 30, x - 16, y - 74, 0, 5, 5, 0x2F6FA8))
|
|
192
|
+
out.append(limb(x - 16, y - 74, x - 17, y - 80, 0, 5, 2, BLACK))
|
|
193
|
+
out.append(limb(x + 2, y - 30, x + 4, y - 82, 0, 5, 5, MUSTARD))
|
|
194
|
+
out.append(path(pts(((x + 1.5, y - 82), (x + 6.5, y - 82), (x + 4, y - 90)), True), 0xF3D9A8))
|
|
195
|
+
out.append(limb(x + 10, y - 30, x + 22, y - 68, 0, 4, 4, RED))
|
|
196
|
+
out.append(path("M%s %sA11 12 0 0 1 %s %s" % (x + 19, y - 34, x + 19, y - 10), None, 0xE8DCC0, 5.5))
|
|
197
|
+
out.append(rect(x - 20, y - 44, 40, 44, CREAM, r=5))
|
|
198
|
+
out.append(rect(x - 20, y - 44, 9, 44, 0xE8DCC0, r=4))
|
|
199
|
+
out.append(rect(x - 20, y - 26, 40, 8, LIME))
|
|
200
|
+
out.append(rect(x - 20, y - 26, 9, 8, 0xA8C038))
|
|
201
|
+
out.append(ellipse(x, y - 44, 20, 4.5, 0x4A3A30))
|
|
202
|
+
return b"".join(out)
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
# --- the bench ---------------------------------------------------------------
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
def _bench():
|
|
209
|
+
out = [rect(0, 322, 800, 158, WOOD), rect(0, 322, 800, 5, WOOD_LIGHT), rect(0, 327, 800, 2, WOOD_DARK, opacity=0.5)]
|
|
210
|
+
for x, y, length in ((14, 342, 70), (700, 338, 84), (748, 352, 40), (6, 372, 38), (10, 420, 30), (764, 470, 30), (2, 462, 44)):
|
|
211
|
+
out.append(line(x, y, x + length, y, WOOD_DARK, 1.6, opacity=0.6))
|
|
212
|
+
return b"".join(out)
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
_MAT = ((118, 350), (736, 350), (792, 478), (56, 478))
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
def _mat_pt(u, v):
|
|
219
|
+
(ax, ay), (bx, by), (cx, cy), (dx, dy) = _MAT
|
|
220
|
+
left = ax + (dx - ax) * v
|
|
221
|
+
right = bx + (cx - bx) * v
|
|
222
|
+
return left + (right - left) * u, ay + (dy - ay) * v
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
def _mat():
|
|
226
|
+
out = [path(pts(((112, 355), (742, 355), (800, 480), (46, 480)), True), SHADOW, opacity=0.18)]
|
|
227
|
+
out.append(path(pts(_MAT, True), MAT_EDGE, MAT_EDGE, 6))
|
|
228
|
+
out.append(path(pts([_mat_pt(u, v) for u, v in ((0.012, 0.03), (0.988, 0.03), (0.992, 1), (0.008, 1))], True), MAT))
|
|
229
|
+
# where the lamp lands
|
|
230
|
+
out.append(ellipse(566, 428, 196, 46, MAT_LIT))
|
|
231
|
+
for i in range(1, 16):
|
|
232
|
+
x0, y0 = _mat_pt(i / 16, 0.03)
|
|
233
|
+
x1, y1 = _mat_pt(i / 16, 1)
|
|
234
|
+
out.append(line(x0, y0, x1, y1, MAT_LINE, 1.1 if i % 4 else 1.8, opacity=0.55))
|
|
235
|
+
for v in (0.16, 0.33, 0.53, 0.76):
|
|
236
|
+
x0, y0 = _mat_pt(0.012, v)
|
|
237
|
+
x1, y1 = _mat_pt(0.988, v)
|
|
238
|
+
out.append(line(x0, y0, x1, y1, MAT_LINE, 1.1, opacity=0.55))
|
|
239
|
+
return b"".join(out)
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
def _lamp_arm():
|
|
243
|
+
out = [rect(736, 310, 34, 16, IRON, r=3), rect(736, 310, 34, 4, IRON_LIGHT, r=2)]
|
|
244
|
+
out.append(limb(752, 312, 782, 176, 0, 9, 9, MUSTARD_DARK))
|
|
245
|
+
out.append(limb(782, 176, 704, 86, 0, 9, 9, MUSTARD))
|
|
246
|
+
out.append(circle(782, 176, 9, IRON))
|
|
247
|
+
out.append(circle(782, 176, 3.5, IRON_LIGHT))
|
|
248
|
+
return b"".join(out)
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
_LAMP_TURN = 120.5
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
def _lamp_light():
|
|
255
|
+
# the cone from the shade to the mat, drawn flat and faint
|
|
256
|
+
return path(pts(((644.5, 111.5), (703, 146), (756, 428), (372, 428)), True), LIGHT, opacity=0.13)
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
def _lamp_head():
|
|
260
|
+
out = [path("M-4 -15L52 -36L52 36L-4 15Z", MUSTARD)]
|
|
261
|
+
out.append(path("M-4 -15L52 -36L52 -22L-4 -7Z", 0xFFD05E))
|
|
262
|
+
out.append(path("M-4 15L52 36L52 22L-4 8Z", MUSTARD_DARK))
|
|
263
|
+
out.append(circle(-4, 0, 15, MUSTARD))
|
|
264
|
+
out.append(path("M-4 -15A15 15 0 0 0 -17 -7L-4 -7Z", 0xFFD05E))
|
|
265
|
+
out.append(ellipse(52, 0, 7, 36, 0xFFF7D6))
|
|
266
|
+
out.append(ellipse(52, 0, 3.5, 22, 0xFFFFFF))
|
|
267
|
+
out.append(circle(-4, 0, 6, IRON))
|
|
268
|
+
out.append(circle(-4, 0, 2.4, IRON_LIGHT))
|
|
269
|
+
return at(704, 86, b"".join(out), rot=_LAMP_TURN)
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
# --- the board ---------------------------------------------------------------
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
def _header(x, y, pins):
|
|
276
|
+
out = [rect(x, y, pins * 9.6 + 3, 13, BLACK, r=2), rect(x, y, pins * 9.6 + 3, 3, 0x343C48, r=1.5)]
|
|
277
|
+
for i in range(pins):
|
|
278
|
+
px = x + 3.8 + i * 9.6
|
|
279
|
+
out.append(rect(px, y + 4, 5, 5, GOLD_DARK))
|
|
280
|
+
out.append(rect(px + 1, y + 4, 4, 4, GOLD))
|
|
281
|
+
out.append(rect(px + 2.6, y + 4.6, 1.8, 1.8, 0xFFE9A0))
|
|
282
|
+
return b"".join(out)
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
def _passive(x, y, body, upright=False):
|
|
286
|
+
if upright:
|
|
287
|
+
return rect(x, y, 4, 8, STEEL) + rect(x, y + 2, 4, 4, body)
|
|
288
|
+
return rect(x, y, 8, 4, STEEL) + rect(x + 2, y, 4, 4, body)
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
def _trace(points):
|
|
292
|
+
return path(pts(points), None, TRACE, 1.5)
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
def _board(doc):
|
|
296
|
+
# drawn with its top-left corner at the origin
|
|
297
|
+
out = [rect(0, 0, 204, 130, PCB_EDGE, r=8), rect(1.5, 1.5, 201, 127, PCB, r=7)]
|
|
298
|
+
for x, y in ((10, 10), (194, 10), (10, 120), (194, 120)):
|
|
299
|
+
out.append(circle(x, y, 5.5, GOLD_DARK))
|
|
300
|
+
out.append(circle(x, y, 4.6, GOLD))
|
|
301
|
+
out.append(circle(x, y, 2.6, 0x06182C))
|
|
302
|
+
# copper, under everything else
|
|
303
|
+
for points in (
|
|
304
|
+
((100, 44), (100, 34), (92, 26), (92, 18)),
|
|
305
|
+
((108, 44), (108, 30), (102, 24), (102, 18)),
|
|
306
|
+
((116, 44), (116, 32), (121, 27), (121, 18)),
|
|
307
|
+
((124, 44), (124, 36), (140, 24), (140, 18)),
|
|
308
|
+
((100, 78), (100, 90), (92, 98), (92, 112)),
|
|
309
|
+
((108, 78), (108, 96), (111, 99), (111, 112)),
|
|
310
|
+
((116, 78), (116, 92), (130, 104), (130, 112)),
|
|
311
|
+
((124, 78), (124, 86), (146, 106), (150, 112)),
|
|
312
|
+
((96, 52), (84, 52), (78, 46)),
|
|
313
|
+
((96, 60), (82, 60)),
|
|
314
|
+
((96, 68), (86, 68), (80, 74)),
|
|
315
|
+
((130, 52), (140, 52), (144, 46)),
|
|
316
|
+
((130, 62), (186, 62)),
|
|
317
|
+
((130, 70), (144, 70), (150, 76), (186, 76)),
|
|
318
|
+
((56, 104), (56, 112)),
|
|
319
|
+
((78, 104), (72, 108), (72, 112)),
|
|
320
|
+
((34, 104), (34, 108), (44, 112)),
|
|
321
|
+
((160, 50), (160, 18)),
|
|
322
|
+
((150, 98), (160, 106), (160, 112)),
|
|
323
|
+
((172, 98), (169, 106), (169, 112)),
|
|
324
|
+
):
|
|
325
|
+
out.append(_trace(points))
|
|
326
|
+
for x, y in ((82, 60), (144, 46), (78, 46), (80, 74)):
|
|
327
|
+
out.append(circle(x, y, 2.2, GOLD))
|
|
328
|
+
out.append(circle(x, y, 0.9, 0x06182C))
|
|
329
|
+
out.append(_header(24, 5, 16))
|
|
330
|
+
out.append(_header(24, 112, 16))
|
|
331
|
+
# silk: a tick beside every fourth pin, and a mark at pin 1
|
|
332
|
+
for i in range(0, 16, 4):
|
|
333
|
+
out.append(line(30.3 + i * 9.6, 21, 30.3 + i * 9.6, 24, LIME, 1.2))
|
|
334
|
+
out.append(line(30.3 + i * 9.6, 106, 30.3 + i * 9.6, 109, LIME, 1.2))
|
|
335
|
+
out.append(path("M19 6L19 16L13 11Z", LIME))
|
|
336
|
+
|
|
337
|
+
# the radio module: its own small board, an antenna, a shield can
|
|
338
|
+
out.append(rect(12, 26, 64, 56, 0x162231, r=2))
|
|
339
|
+
out.append(path("M16 78L16 31L21 31L21 74L26 74L26 31L31 31L31 78", None, GOLD, 2.2, extra='stroke-linecap="butt" stroke-linejoin="miter"'))
|
|
340
|
+
out.append(rect(36, 30, 37, 48, STEEL_DARK, r=3))
|
|
341
|
+
out.append(rect(36, 30, 36, 47, STEEL, r=3))
|
|
342
|
+
out.append(path("M54 30L66 30L48 77L39 77Q36 77 36 74L36 70Z", STEEL_LIGHT, opacity=0.75))
|
|
343
|
+
out.append(rect(42, 60, 11, 11, None, r=1.5, stroke=STEEL_DARK, width=1))
|
|
344
|
+
out.append(path("M44 68L47.5 62L51 68Z", STEEL_DARK))
|
|
345
|
+
for i in range(6):
|
|
346
|
+
out.append(rect(40 + i * 5.6, 79.5, 3, 3.5, GOLD))
|
|
347
|
+
|
|
348
|
+
# the processor
|
|
349
|
+
for i in range(7):
|
|
350
|
+
out.append(rect(98.5 + i * 4.3, 41, 2.4, 40, STEEL))
|
|
351
|
+
out.append(rect(93, 46.5 + i * 4.3, 40, 2.4, STEEL))
|
|
352
|
+
out.append(rect(96, 44, 34, 34, 0x10151C, r=2))
|
|
353
|
+
out.append(rect(96, 44, 34, 34, None, r=2, stroke=0x39424D, width=1))
|
|
354
|
+
out.append(circle(101, 49, 1.6, 0x56626F))
|
|
355
|
+
out.append(rect(106, 57, 14, 2, 0x56626F))
|
|
356
|
+
out.append(rect(106, 62, 18, 2, 0x56626F))
|
|
357
|
+
out.append(rect(106, 67, 9, 2, 0x56626F))
|
|
358
|
+
|
|
359
|
+
# crystal, regulator, passives
|
|
360
|
+
out.append(rect(137, 32, 20, 9, STEEL_DARK, r=4.5))
|
|
361
|
+
out.append(rect(137, 32, 20, 8, STEEL, r=4))
|
|
362
|
+
out.append(rect(141, 34, 9, 1.6, STEEL_LIGHT, r=0.8))
|
|
363
|
+
out.append(rect(141, 49, 4, 14, STEEL))
|
|
364
|
+
out.append(rect(151, 49, 4, 14, STEEL))
|
|
365
|
+
out.append(rect(138, 52, 20, 8, 0x10151C, r=1))
|
|
366
|
+
out.append(_passive(82, 30, 0xC9A26B))
|
|
367
|
+
out.append(_passive(82, 37, 0x10151C))
|
|
368
|
+
out.append(_passive(164, 30, 0xC9A26B))
|
|
369
|
+
out.append(_passive(86, 84, 0x10151C, True))
|
|
370
|
+
out.append(_passive(132, 84, 0xC9A26B, True))
|
|
371
|
+
out.append(_passive(166, 50, 0x10151C, True))
|
|
372
|
+
|
|
373
|
+
# two buttons
|
|
374
|
+
for bx in (143, 165):
|
|
375
|
+
out.append(rect(bx, 86, 15, 15, STEEL_DARK, r=2))
|
|
376
|
+
out.append(rect(bx, 86, 15, 14, STEEL, r=2))
|
|
377
|
+
out.append(circle(bx + 7.5, 93, 4.6, BLACK))
|
|
378
|
+
out.append(circle(bx + 6.6, 92, 1.6, 0x56626F))
|
|
379
|
+
|
|
380
|
+
# the USB socket, overhanging the edge
|
|
381
|
+
out.append(rect(183, 52, 27, 34, STEEL_DARK, r=4))
|
|
382
|
+
out.append(rect(183, 52, 27, 32, STEEL, r=4))
|
|
383
|
+
out.append(rect(185, 54, 20, 4, STEEL_LIGHT, r=2))
|
|
384
|
+
out.append(rect(204, 59, 4, 19, 0x39424D, r=2))
|
|
385
|
+
|
|
386
|
+
# the row of lights: an empty footprint, one lit, one for power
|
|
387
|
+
out.append(rect(22, 88, 68, 19, None, r=3, stroke=LIME, width=1.1))
|
|
388
|
+
out.append(rect(26.5, 94, 5, 7, GOLD))
|
|
389
|
+
out.append(rect(36.5, 94, 5, 7, GOLD))
|
|
390
|
+
glow = doc.radial([(0, 0xE9FF8A, 0.85), (0.45, LIME, 0.4), (1, LIME, 0)])
|
|
391
|
+
out.append(circle(56, 97.5, 17, glow))
|
|
392
|
+
out.append(rect(49, 94, 14, 7, STEEL))
|
|
393
|
+
out.append(rect(51.5, 94, 9, 7, 0xF4FFC2))
|
|
394
|
+
out.append(rect(53, 95.5, 6, 2, 0xFFFFFF))
|
|
395
|
+
out.append(rect(71, 94, 14, 7, STEEL))
|
|
396
|
+
out.append(rect(73.5, 94, 9, 7, 0xB93A2E))
|
|
397
|
+
out.append(rect(75, 95.5, 4, 1.6, 0xFF8C7A))
|
|
398
|
+
# the maker's mark in silk: a faceted square
|
|
399
|
+
out.append(path("M112 90L120 94L120 102L112 106L104 102L104 94Z", None, LIME, 1.1))
|
|
400
|
+
out.append(path("M104 94L112 98L120 94M112 98L112 106", None, LIME, 1.1))
|
|
401
|
+
return b"".join(out)
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
def _holder():
|
|
405
|
+
# a board vise: a heavy foot, a post, a bar and two jaws
|
|
406
|
+
out = [ellipse(545, 432, 76, 13, SHADOW, opacity=0.2)]
|
|
407
|
+
out.append(ellipse(555, 428, 62, 12, IRON))
|
|
408
|
+
out.append(ellipse(555, 424, 62, 11, IRON_LIGHT))
|
|
409
|
+
out.append(ellipse(560, 423, 44, 6, 0x6B7885))
|
|
410
|
+
out.append(rect(549, 402, 12, 22, IRON))
|
|
411
|
+
out.append(rect(557, 402, 4, 22, IRON_LIGHT))
|
|
412
|
+
out.append(rect(436, 396, 240, 9, IRON, r=4.5))
|
|
413
|
+
out.append(rect(440, 396, 232, 3, IRON_LIGHT, r=1.5))
|
|
414
|
+
for x in (440, 658):
|
|
415
|
+
out.append(rect(x, 296, 14, 106, IRON, r=3))
|
|
416
|
+
out.append(rect(x + 9, 298, 3.5, 100, IRON_LIGHT, r=1.7))
|
|
417
|
+
out.append(circle(684, 400.5, 9, MUSTARD_DARK))
|
|
418
|
+
out.append(circle(685, 399.5, 7, MUSTARD))
|
|
419
|
+
return b"".join(out)
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
def _cable():
|
|
423
|
+
# from the USB socket off to the right, behind the meter
|
|
424
|
+
d = "M664 331C700 331 706 372 742 372S792 352 806 362"
|
|
425
|
+
return path(d, None, 0x10151C, 6.5) + path(d, None, 0x39424D, 2, opacity=0.9) + rect(660, 321, 18, 20, BLACK, r=3) + rect(660, 321, 18, 5, 0x343C48, r=2)
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
# --- things on the mat -------------------------------------------------------
|
|
429
|
+
|
|
430
|
+
_SEGS = {
|
|
431
|
+
"0": "abcdef",
|
|
432
|
+
"1": "bc",
|
|
433
|
+
"2": "abdeg",
|
|
434
|
+
"3": "abcdg",
|
|
435
|
+
"4": "bcfg",
|
|
436
|
+
"5": "acdfg",
|
|
437
|
+
"6": "acdefg",
|
|
438
|
+
"7": "abc",
|
|
439
|
+
"8": "abcdefg",
|
|
440
|
+
"9": "abcdfg",
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+
def _digit(x, y, w, h, char, color):
|
|
445
|
+
# one seven-segment digit, each lit segment a bar
|
|
446
|
+
t = w * 0.2
|
|
447
|
+
half = h / 2
|
|
448
|
+
bars = {
|
|
449
|
+
"a": (x + t, y, w - 2 * t, t),
|
|
450
|
+
"g": (x + t, y + half - t / 2, w - 2 * t, t),
|
|
451
|
+
"d": (x + t, y + h - t, w - 2 * t, t),
|
|
452
|
+
"f": (x, y + t * 0.6, t, half - t),
|
|
453
|
+
"b": (x + w - t, y + t * 0.6, t, half - t),
|
|
454
|
+
"e": (x, y + half + t * 0.4, t, half - t),
|
|
455
|
+
"c": (x + w - t, y + half + t * 0.4, t, half - t),
|
|
456
|
+
}
|
|
457
|
+
return b"".join(rect(*(bars[s] + (color,))) for s in _SEGS[char])
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
def _meter(x, y):
|
|
461
|
+
# a multimeter standing on its foot, reading the board's 3.30 volts
|
|
462
|
+
out = [path(pts(((-52, 60), (-16, 66), (34, 66), (-40, 44)), True), SHADOW, opacity=0.2)]
|
|
463
|
+
out.append(rect(-41, -66, 82, 132, MUSTARD_DARK, r=12))
|
|
464
|
+
out.append(rect(-41, -66, 80, 130, MUSTARD, r=12))
|
|
465
|
+
out.append(rect(-33, -58, 66, 114, 0x2A313B, r=7))
|
|
466
|
+
out.append(rect(-27, -52, 54, 30, 0x8FA583, r=3))
|
|
467
|
+
out.append(rect(-26, -51, 52, 28, 0xC6D6AE, r=3))
|
|
468
|
+
ink = 0x26301F
|
|
469
|
+
out.append(_digit(-19, -46, 10, 18, "3", ink))
|
|
470
|
+
out.append(rect(-6.2, -30.5, 2.6, 2.6, ink))
|
|
471
|
+
out.append(_digit(-1, -46, 10, 18, "3", ink))
|
|
472
|
+
out.append(_digit(12, -46, 10, 18, "0", ink))
|
|
473
|
+
# the dial
|
|
474
|
+
out.append(circle(0, 8, 22, 0x1B2028))
|
|
475
|
+
for i in range(10):
|
|
476
|
+
a = math.radians(i * 36 + 18)
|
|
477
|
+
out.append(line(math.cos(a) * 24.5, 8 + math.sin(a) * 24.5, math.cos(a) * 27.5, 8 + math.sin(a) * 27.5, STEEL_DARK, 1.4))
|
|
478
|
+
out.append(circle(0, 8, 16, 0x3B4552))
|
|
479
|
+
out.append(group(rect(-4, -16, 8, 32, MUSTARD, r=4) + rect(-1.2, -14, 2.4, 9, 0x2A313B, r=1), "translate(0 8) rotate(-54)"))
|
|
480
|
+
# the jacks
|
|
481
|
+
for jx, color in ((-20, RED), (0, BLACK), (20, BLACK)):
|
|
482
|
+
out.append(circle(jx, 43, 6.5, 0x10151C))
|
|
483
|
+
out.append(circle(jx, 43, 4.2, color))
|
|
484
|
+
out.append(circle(jx, 43, 1.8, 0x10151C))
|
|
485
|
+
out.append(rect(31, -52, 3.5, 100, 0xFFD05E, r=1.7))
|
|
486
|
+
return at(x, y, b"".join(out))
|
|
487
|
+
|
|
488
|
+
|
|
489
|
+
def _leads():
|
|
490
|
+
# the meter's two probes, lying on the mat
|
|
491
|
+
out = []
|
|
492
|
+
for d, color, tip in (
|
|
493
|
+
("M682 449C676 474 640 476 606 468", RED, (606, 468, 566, 460)),
|
|
494
|
+
("M702 449C700 484 640 492 596 480", 0x10151C, (596, 480, 556, 474)),
|
|
495
|
+
):
|
|
496
|
+
out.append(path(d, None, color, 3.2))
|
|
497
|
+
x0, y0, x1, y1 = tip
|
|
498
|
+
out.append(limb(x0, y0, x1, y1, 0, 8, 5, color))
|
|
499
|
+
out.append(limb(x1, y1, x1 - 20, y1 - 4, 0, 2, 1, STEEL))
|
|
500
|
+
return b"".join(out)
|
|
501
|
+
|
|
502
|
+
|
|
503
|
+
def _iron(x, y, home=True):
|
|
504
|
+
# a soldering iron in its stand, a wisp of smoke rising; the stand alone
|
|
505
|
+
# when the iron is out
|
|
506
|
+
out = [ellipse(x - 6, y + 6, 66, 10, SHADOW, opacity=0.2)]
|
|
507
|
+
if home:
|
|
508
|
+
out.append(path("M%s %sC%s %s %s %s %s %sS%s %s %s %s" % (x - 30, y - 78, x - 70, y - 60, x - 96, y - 20, x - 78, y + 4, x - 84, y + 30, x - 110, y + 30), None, 0x10151C, 4))
|
|
509
|
+
out.append(rect(x - 50, y - 8, 104, 15, IRON, r=5))
|
|
510
|
+
out.append(rect(x - 50, y - 8, 104, 4, IRON_LIGHT, r=2))
|
|
511
|
+
out.append(rect(x - 42, y - 15, 30, 9, 0xE8C440, r=3))
|
|
512
|
+
out.append(rect(x - 42, y - 15, 30, 3, 0xFFE26A, r=1.5))
|
|
513
|
+
# the iron, pointing down into the spring
|
|
514
|
+
turn = "translate(%s %s) rotate(-42)" % (x + 26, y - 14)
|
|
515
|
+
iron = rect(-3, -44, 6, 46, STEEL_DARK) + rect(0, -44, 3, 46, STEEL)
|
|
516
|
+
iron += rect(-6, -52, 12, 10, STEEL_DARK, r=2)
|
|
517
|
+
iron += rect(-9, -112, 18, 62, 0x2F6FA8, r=8) + rect(1, -106, 5, 50, 0x5B9BD5, r=2.5)
|
|
518
|
+
iron += rect(-9, -74, 18, 22, BLACK, r=3) + rect(-9, -68, 18, 2, 0x343C48) + rect(-9, -62, 18, 2, 0x343C48)
|
|
519
|
+
if home:
|
|
520
|
+
out.append(group(iron, turn))
|
|
521
|
+
spring = b""
|
|
522
|
+
for i in range(6):
|
|
523
|
+
spring += ellipse(0, -6 - i * 6.2, 9.5 - i * 0.5, 4, None, STEEL_LIGHT if i % 2 else STEEL, 2.4)
|
|
524
|
+
out.append(group(spring, turn))
|
|
525
|
+
out.append(limb(x + 26, y - 6, x + 26, y - 14, 0, 6, 6, IRON))
|
|
526
|
+
if not home:
|
|
527
|
+
return b"".join(out)
|
|
528
|
+
for points, width, opacity in (
|
|
529
|
+
(((x + 30, y - 22), (x + 40, y - 50), (x + 26, y - 78), (x + 40, y - 108), (x + 30, y - 136)), 3.2, 0.34),
|
|
530
|
+
(((x + 34, y - 26), (x + 50, y - 62), (x + 42, y - 92), (x + 54, y - 118)), 2.2, 0.22),
|
|
531
|
+
):
|
|
532
|
+
out.append(path(smooth(points), None, 0xFFFFFF, width, opacity=opacity))
|
|
533
|
+
return b"".join(out)
|
|
534
|
+
|
|
535
|
+
|
|
536
|
+
def _breadboard():
|
|
537
|
+
# a small breadboard lying on the mat, with three wires up to the board
|
|
538
|
+
out = [path(pts(((404, 452), (532, 452), (540, 480), (396, 480)), True), SHADOW, opacity=0.2)]
|
|
539
|
+
out.append(path(pts(((408, 446), (536, 446), (544, 476), (400, 476)), True), 0xD9D2C2))
|
|
540
|
+
out.append(path(pts(((408, 446), (536, 446), (543, 472), (401, 472)), True), 0xF6F1E6))
|
|
541
|
+
out.append(line(409, 450, 535, 450, RED, 1.1))
|
|
542
|
+
out.append(line(403, 469, 541, 469, 0x2F6FA8, 1.1))
|
|
543
|
+
for y, inset in ((454.5, 5), (459, 4), (464, 3)):
|
|
544
|
+
out.append(_dots(408 + 6 - inset, y, 538 + inset - 6, 7.2, 2.4, 0x8E8676))
|
|
545
|
+
return b"".join(out)
|
|
546
|
+
|
|
547
|
+
|
|
548
|
+
def _wires():
|
|
549
|
+
out = []
|
|
550
|
+
for x0, x1, color, dark in ((470, BOARD_X + 54.5, MUSTARD, MUSTARD_DARK), (496, BOARD_X + 93, TEAL, 0x1B7F8E), (520, BOARD_X + 131.4, 0xF6F1E6, 0xBDB6A6)):
|
|
551
|
+
d = "M%s 458C%s 418 %s 430 %s %s" % (x0, x0 - 6, x1 + 12, x1, BOARD_Y + 121)
|
|
552
|
+
out.append(path(d, None, dark, 4.2))
|
|
553
|
+
out.append(path(d, None, color, 2.6))
|
|
554
|
+
out.append(rect(x1 - 4.6, BOARD_Y + 114, 9.2, 15, 0x2A313B, r=1.5))
|
|
555
|
+
out.append(rect(x1 - 4.6, BOARD_Y + 114, 3, 15, 0x475260, r=1.5))
|
|
556
|
+
out.append(rect(x0 - 2.5, 455, 5, 6, BLACK, r=1))
|
|
557
|
+
return b"".join(out)
|
|
558
|
+
|
|
559
|
+
|
|
560
|
+
def _parts():
|
|
561
|
+
# loose parts on the mat: two resistors, a capacitor, a red light
|
|
562
|
+
out = []
|
|
563
|
+
for x, y, rot, bands in ((180, 468, -14, (0xB93A2E, 0x6B3B1D, MUSTARD)), (232, 474, 8, (0x2F6FA8, BLACK, RED))):
|
|
564
|
+
body = line(-17, 0, 17, 0, STEEL, 1.6) + rect(-9, -4, 18, 8, 0xE7C99A, r=4)
|
|
565
|
+
for i, color in enumerate(bands):
|
|
566
|
+
body += rect(-6 + i * 4.5, -4, 2.4, 8, color)
|
|
567
|
+
out.append(at(x, y, body, rot=rot))
|
|
568
|
+
out.append(ellipse(346, 471, 9, 3, SHADOW, opacity=0.2))
|
|
569
|
+
out.append(rect(338, 452, 13, 18, 0x2A4A8C, r=2) + rect(338, 452, 4, 18, STEEL, r=1) + ellipse(344.5, 452, 6.5, 2, 0x5B7FC9))
|
|
570
|
+
out.append(line(371, 466, 366, 476, STEEL, 1.4) + line(376, 466, 379, 477, STEEL, 1.4))
|
|
571
|
+
out.append(path("M366 467L366 458A7.5 7.5 0 0 1 381 458L381 467Z", RED) + rect(364, 465, 19, 3.5, 0xB93A2E, r=1.5))
|
|
572
|
+
out.append(path("M369 458A4.5 4.5 0 0 1 373.5 453.5", None, 0xFF9A8C, 1.8))
|
|
573
|
+
return b"".join(out)
|
|
574
|
+
|
|
575
|
+
|
|
576
|
+
def _hands(x, y):
|
|
577
|
+
# a helping-hands stand: a heavy foot, a post, and a bar with its top at
|
|
578
|
+
# y, a lens on an arm at one end
|
|
579
|
+
out = [ellipse(x - 54, 444, 74, 11, SHADOW, opacity=0.2)]
|
|
580
|
+
out.append(ellipse(x - 44, 440, 56, 12, IRON))
|
|
581
|
+
out.append(ellipse(x - 44, 436, 56, 11, IRON_LIGHT))
|
|
582
|
+
out.append(ellipse(x - 40, 435, 38, 6, 0x6B7885))
|
|
583
|
+
out.append(rect(x - 49, y + 6, 10, 30, STEEL_DARK))
|
|
584
|
+
out.append(rect(x - 43, y + 6, 4, 30, STEEL))
|
|
585
|
+
# the lens on its arm, at the far end
|
|
586
|
+
out.append(limb(x - 166, y + 4, x - 190, y - 42, -0.12, 5, 5, STEEL_DARK))
|
|
587
|
+
out.append(circle(x - 198, y - 70, 27, 0xBFE9FF, opacity=0.28))
|
|
588
|
+
out.append(circle(x - 198, y - 70, 27, None, MUSTARD_DARK, 7))
|
|
589
|
+
out.append(circle(x - 198, y - 70, 28.5, None, MUSTARD, 3.5))
|
|
590
|
+
out.append(path("M%s %sA18 18 0 0 1 %s %s" % (x - 215, y - 75, x - 203, y - 88), None, 0xFFFFFF, 3.5, opacity=0.85))
|
|
591
|
+
out.append(circle(x - 190, y - 42, 5, IRON))
|
|
592
|
+
# the bar
|
|
593
|
+
out.append(rect(x - 168, y, 256, 8, STEEL_DARK, r=4))
|
|
594
|
+
out.append(rect(x - 166, y, 252, 3.2, STEEL_LIGHT, r=1.6))
|
|
595
|
+
out.append(circle(x - 166, y + 4, 7, IRON) + circle(x - 167, y + 3, 2.6, IRON_LIGHT))
|
|
596
|
+
out.append(rect(x + 80, y - 2, 14, 12, BLACK, r=3) + rect(x + 80, y - 2, 14, 3, 0x343C48, r=1.5))
|
|
597
|
+
out.append(rect(x - 54, y - 3, 20, 14, IRON, r=3) + rect(x - 54, y - 3, 20, 4, IRON_LIGHT, r=2))
|
|
598
|
+
out.append(circle(x - 44, y + 4, 3.4, MUSTARD))
|
|
599
|
+
return b"".join(out)
|
|
600
|
+
|
|
601
|
+
|
|
602
|
+
def _rack(x0, y):
|
|
603
|
+
# a rod on two pegboard hooks, reels of hook-up wire on it
|
|
604
|
+
out = [rect(x0 - 2, y + 6, 226, 6, SHADOW, r=3, opacity=0.14)]
|
|
605
|
+
for x in (x0 + 12, x0 + 214):
|
|
606
|
+
out.append(path("M%s %sL%s %sQ%s %s %s %s" % (x, y - 14, x, y + 6, x, y + 12, x + 7, y + 11), None, STEEL_DARK, 3.4))
|
|
607
|
+
out.append(circle(x, y - 14, 3, IRON))
|
|
608
|
+
reels = b""
|
|
609
|
+
for dx, color, dark, drop in ((40, RED, 0xB93A2E, 30), (68, MUSTARD, MUSTARD_DARK, 18), (198, TEAL, 0x1B7F8E, 26)):
|
|
610
|
+
x = x0 + dx
|
|
611
|
+
reels += path("M%s %sq-5 %s 2 %s" % (x + 7, y + 16, drop * 0.5, drop), None, color, 2.2)
|
|
612
|
+
reels += rect(x - 12, y - 14, 24, 35, 0x2A313B, r=3)
|
|
613
|
+
reels += rect(x - 8, y - 12, 16, 31, color)
|
|
614
|
+
reels += rect(x - 8, y - 12, 5, 31, dark)
|
|
615
|
+
for i in range(1, 6):
|
|
616
|
+
reels += line(x - 8, y - 12 + i * 5.2, x + 8, y - 12 + i * 5.2, dark, 0.9)
|
|
617
|
+
reels += rect(x - 12, y - 14, 3.5, 35, 0x475260, r=1.5)
|
|
618
|
+
out.append(rect(x0, y, 226, 7, 0xB98452, r=3.5))
|
|
619
|
+
out.append(rect(x0 + 2, y, 222, 2.6, 0xDDAE7A, r=1.3))
|
|
620
|
+
out.append(reels)
|
|
621
|
+
return b"".join(out)
|
|
622
|
+
|
|
623
|
+
|
|
624
|
+
def _chameleon(doc, pose, look, look_far, mood, blink, colors):
|
|
625
|
+
# the chameleon, staged for one of his three places on the bench
|
|
626
|
+
if pose == "front":
|
|
627
|
+
# on the top edge of the board, facing out, one hand up
|
|
628
|
+
body = huey_views.front(doc, look=look or (0.0, 0.2), look_other=look_far, blink=blink, mood=mood or "calm", colors=colors or "brand", hand=1, perch=None)
|
|
629
|
+
return at(BOARD_X + 96, BOARD_Y + 1, body, scale=0.44)
|
|
630
|
+
if pose == "hang":
|
|
631
|
+
# head down from the wire rack, by his tail and hind feet
|
|
632
|
+
body = huey.draw_hang(doc, look=look or (0.5, 0.6), look_far=look_far, mood=mood or "happy", colors=colors or "copper", perch=None)
|
|
633
|
+
return at(RACK_X + 108, RACK_Y, body, scale=0.4)
|
|
634
|
+
# on the bar of the helping hands, iron in hand, its tip on the joint
|
|
635
|
+
body = huey_props.hold(
|
|
636
|
+
doc,
|
|
637
|
+
"iron",
|
|
638
|
+
lean=80,
|
|
639
|
+
look=look or (0.9, 0.55),
|
|
640
|
+
look_far=look_far or (0.75, 0.35),
|
|
641
|
+
blink=blink,
|
|
642
|
+
mood=mood or "calm",
|
|
643
|
+
colors=colors or "board",
|
|
644
|
+
perch=None,
|
|
645
|
+
nod=6,
|
|
646
|
+
)
|
|
647
|
+
out = ellipse(HUEY_X - 16, 446, 104, 9, SHADOW, opacity=0.16)
|
|
648
|
+
glow = doc.radial([(0, 0xFFF3B0, 0.9), (0.5, 0xFFB26B, 0.45), (1, 0xFFB26B, 0)])
|
|
649
|
+
return out + at(HUEY_X, HUEY_Y, body, scale=HUEY_SCALE) + circle(BOARD_X + 34, BOARD_Y + 97.5, 7, glow)
|
|
650
|
+
|
|
651
|
+
|
|
652
|
+
def draw(doc, who="chameleon", pose="solder", look=None, look_far=None, mood=None, blink=0, colors=None):
|
|
653
|
+
"""Add the workbench to *doc*, back to front.
|
|
654
|
+
|
|
655
|
+
Args:
|
|
656
|
+
doc: The `vec.Doc` to draw into.
|
|
657
|
+
who (str): "chameleon", or "stage" for the bench without him.
|
|
658
|
+
pose (str): What the chameleon is doing: "solder", standing on the
|
|
659
|
+
helping hands with the iron on the board; "front", on top of the
|
|
660
|
+
board, facing you; or "hang", head down from the wire rack.
|
|
661
|
+
look: Where the eyes point, or None for the pose's own.
|
|
662
|
+
look_far: Where the chameleon's other eye points, or None.
|
|
663
|
+
mood (str): The mood, as the mascot takes it, or None for the pose's own.
|
|
664
|
+
blink (float): 0 with the eyes open, 1 closed.
|
|
665
|
+
colors (str): The chameleon's scheme, from `huey.COLORS`,
|
|
666
|
+
or None for the one that suits where he is: "board" over the mat,
|
|
667
|
+
"brand" on the board, "copper" against the pegboard.
|
|
668
|
+
"""
|
|
669
|
+
doc.add(_pegboard(), _cabinet(58, 48), _succulent(206, 37), _screwdrivers(268, 102), _pliers(398, 78))
|
|
670
|
+
doc.add(_spool(470, 76, False), _tape(540, 72), _sticky(604, 44, 5))
|
|
671
|
+
doc.add(_postcard(74, 186, -4), _rack(RACK_X, RACK_Y))
|
|
672
|
+
doc.add(_bench(), _mug(60, 344), _mat(), _lamp_arm(), _lamp_light())
|
|
673
|
+
doc.add(_cable(), _holder(), at(BOARD_X, BOARD_Y, _board(doc)))
|
|
674
|
+
doc.add(_meter(712, 392), _leads(), _iron(112, 452, pose != "solder"), _breadboard(), _wires())
|
|
675
|
+
doc.add(_hands(HUEY_X, HUEY_Y), _parts())
|
|
676
|
+
if who == "chameleon":
|
|
677
|
+
doc.add(_chameleon(doc, pose, look, look_far, mood, blink, colors))
|
|
678
|
+
else:
|
|
679
|
+
doc.add(ellipse(HUEY_X - 16, 446, 104, 9, SHADOW, opacity=0.16))
|
|
680
|
+
doc.add(_lamp_head())
|