Sfoglia il codice sorgente

Address review feedback

Jeremy Stretch 8 ore fa
parent
commit
ef3e19804a
33 ha cambiato i file con 124 aggiunte e 171 eliminazioni
  1. 1 1
      docs/plugins/development/forms.md
  2. 0 0
      netbox/project-static/dist/netbox.css
  3. 2 2
      netbox/project-static/img/connectors/power-outlet/iec-60309-2p-e-4h.svg
  4. 2 2
      netbox/project-static/img/connectors/power-outlet/iec-60309-2p-e-6h.svg
  5. 2 2
      netbox/project-static/img/connectors/power-outlet/iec-60309-2p-e-9h.svg
  6. 2 2
      netbox/project-static/img/connectors/power-outlet/iec-60309-3p-e-4h.svg
  7. 2 2
      netbox/project-static/img/connectors/power-outlet/iec-60309-3p-e-6h.svg
  8. 2 2
      netbox/project-static/img/connectors/power-outlet/iec-60309-3p-e-9h.svg
  9. 2 2
      netbox/project-static/img/connectors/power-outlet/iec-60309-3p-n-e-4h.svg
  10. 2 2
      netbox/project-static/img/connectors/power-outlet/iec-60309-3p-n-e-6h.svg
  11. 2 2
      netbox/project-static/img/connectors/power-outlet/iec-60309-3p-n-e-9h.svg
  12. 2 2
      netbox/project-static/img/connectors/power-outlet/iec-60309-p-n-e-4h.svg
  13. 2 2
      netbox/project-static/img/connectors/power-outlet/iec-60309-p-n-e-6h.svg
  14. 2 2
      netbox/project-static/img/connectors/power-outlet/iec-60309-p-n-e-9h.svg
  15. 3 3
      netbox/project-static/img/connectors/power-port/iec-60309-2p-e-4h.svg
  16. 3 3
      netbox/project-static/img/connectors/power-port/iec-60309-2p-e-6h.svg
  17. 3 3
      netbox/project-static/img/connectors/power-port/iec-60309-2p-e-9h.svg
  18. 3 3
      netbox/project-static/img/connectors/power-port/iec-60309-3p-e-4h.svg
  19. 3 3
      netbox/project-static/img/connectors/power-port/iec-60309-3p-e-6h.svg
  20. 3 3
      netbox/project-static/img/connectors/power-port/iec-60309-3p-e-9h.svg
  21. 3 3
      netbox/project-static/img/connectors/power-port/iec-60309-3p-n-e-4h.svg
  22. 3 3
      netbox/project-static/img/connectors/power-port/iec-60309-3p-n-e-6h.svg
  23. 3 3
      netbox/project-static/img/connectors/power-port/iec-60309-3p-n-e-9h.svg
  24. 3 3
      netbox/project-static/img/connectors/power-port/iec-60309-p-n-e-4h.svg
  25. 3 3
      netbox/project-static/img/connectors/power-port/iec-60309-p-n-e-6h.svg
  26. 3 3
      netbox/project-static/img/connectors/power-port/iec-60309-p-n-e-9h.svg
  27. 1 1
      netbox/project-static/img/connectors/power-port/nema-5-20p.svg
  28. 1 1
      netbox/project-static/img/connectors/power-port/nema-6-20p.svg
  29. 0 4
      netbox/project-static/styles/custom/_misc.scss
  30. 8 17
      netbox/templates/dcim/inc/cable_termination.html
  31. 1 1
      netbox/templates/ui/attrs/choice.html
  32. 26 72
      netbox/utilities/tests/test_forms.py
  33. 26 14
      scripts/generate_connector_images.py

+ 1 - 1
docs/plugins/development/forms.md

@@ -218,7 +218,7 @@ These fields render a standard HTML `<select>` element (as opposed to the API-ba
 
 For choice set-backed fields, descriptions are defined per choice using a `Choice` object in the `ChoiceSet` and are rendered automatically. Pass `show_descriptions=False` to suppress them for a particular field.
 
-A `Choice` may also define an `image`: the path to a static file (such as a small line drawing) displayed beside the option's label.
+A `Choice` may also define an `image`: the path to a static file (such as a small line drawing) displayed beside the option's label. Images should be simple and render well at a small size and in both light and dark mode; SVG is preferred.
 
 ```python
 from utilities.choices import Choice, ChoiceSet

File diff suppressed because it is too large
+ 0 - 0
netbox/project-static/dist/netbox.css


+ 2 - 2
netbox/project-static/img/connectors/power-outlet/iec-60309-2p-e-4h.svg

@@ -1,4 +1,4 @@
 <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64">
-<g fill="none" stroke="#000" stroke-width="3" stroke-linejoin="round"><path d="M27.58 59.65A28 28 0 1 1 36.42 59.65A4.42 4.42 0 0 1 27.58 59.65Z"/></g>
-<g fill="#000"><circle cx="41.58" cy="37.53" r="5.06"/><circle cx="22.42" cy="37.53" r="3.79"/><circle cx="32" cy="20.94" r="3.79"/></g>
+<g fill="none" stroke="#000" stroke-width="3" stroke-linejoin="round"><path d="M27.87 55.9A26.11 26.11 0 1 1 36.13 55.9A4.13 4.13 0 0 1 27.87 55.9Z"/></g>
+<g fill="#000"><circle cx="40.93" cy="35.27" r="4.72"/><circle cx="23.07" cy="35.27" r="3.54"/><circle cx="32" cy="19.8" r="3.54"/></g>
 </svg>

+ 2 - 2
netbox/project-static/img/connectors/power-outlet/iec-60309-2p-e-6h.svg

@@ -1,4 +1,4 @@
 <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64">
-<g fill="none" stroke="#000" stroke-width="3" stroke-linejoin="round"><path d="M27.58 59.65A28 28 0 1 1 36.42 59.65A4.42 4.42 0 0 1 27.58 59.65Z"/></g>
-<g fill="#000"><circle cx="32" cy="43.06" r="5.06"/><circle cx="22.42" cy="26.47" r="3.79"/><circle cx="41.58" cy="26.47" r="3.79"/></g>
+<g fill="none" stroke="#000" stroke-width="3" stroke-linejoin="round"><path d="M27.87 55.9A26.11 26.11 0 1 1 36.13 55.9A4.13 4.13 0 0 1 27.87 55.9Z"/></g>
+<g fill="#000"><circle cx="32" cy="40.43" r="4.72"/><circle cx="23.07" cy="24.96" r="3.54"/><circle cx="40.93" cy="24.96" r="3.54"/></g>
 </svg>

+ 2 - 2
netbox/project-static/img/connectors/power-outlet/iec-60309-2p-e-9h.svg

@@ -1,4 +1,4 @@
 <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64">
-<g fill="none" stroke="#000" stroke-width="3" stroke-linejoin="round"><path d="M27.58 59.65A28 28 0 1 1 36.42 59.65A4.42 4.42 0 0 1 27.58 59.65Z"/></g>
-<g fill="#000"><circle cx="20.94" cy="32" r="5.06"/><circle cx="37.53" cy="22.42" r="3.79"/><circle cx="37.53" cy="41.58" r="3.79"/></g>
+<g fill="none" stroke="#000" stroke-width="3" stroke-linejoin="round"><path d="M27.87 55.9A26.11 26.11 0 1 1 36.13 55.9A4.13 4.13 0 0 1 27.87 55.9Z"/></g>
+<g fill="#000"><circle cx="21.68" cy="30.11" r="4.72"/><circle cx="37.16" cy="21.18" r="3.54"/><circle cx="37.16" cy="39.05" r="3.54"/></g>
 </svg>

+ 2 - 2
netbox/project-static/img/connectors/power-outlet/iec-60309-3p-e-4h.svg

@@ -1,4 +1,4 @@
 <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64">
-<g fill="none" stroke="#000" stroke-width="3" stroke-linejoin="round"><path d="M28.13 59.73A28 28 0 1 1 35.87 59.73A3.89 3.89 0 1 1 28.13 59.73Z"/></g>
-<g fill="#000"><circle cx="42.34" cy="37.97" r="4.44"/><circle cx="26.03" cy="42.34" r="3.33"/><circle cx="21.66" cy="26.03" r="3.33"/><circle cx="37.97" cy="21.66" r="3.33"/></g>
+<g fill="none" stroke="#000" stroke-width="3" stroke-linejoin="round"><path d="M28.39 56.02A26.13 26.13 0 1 1 35.61 56.02A3.63 3.63 0 1 1 28.39 56.02Z"/></g>
+<g fill="#000"><circle cx="41.65" cy="35.71" r="4.15"/><circle cx="26.43" cy="39.79" r="3.11"/><circle cx="22.35" cy="24.56" r="3.11"/><circle cx="37.57" cy="20.48" r="3.11"/></g>
 </svg>

+ 2 - 2
netbox/project-static/img/connectors/power-outlet/iec-60309-3p-e-6h.svg

@@ -1,4 +1,4 @@
 <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64">
-<g fill="none" stroke="#000" stroke-width="3" stroke-linejoin="round"><path d="M28.13 59.73A28 28 0 1 1 35.87 59.73A3.89 3.89 0 1 1 28.13 59.73Z"/></g>
-<g fill="#000"><circle cx="32" cy="43.94" r="4.44"/><circle cx="20.06" cy="32" r="3.33"/><circle cx="32" cy="20.06" r="3.33"/><circle cx="43.94" cy="32" r="3.33"/></g>
+<g fill="none" stroke="#000" stroke-width="3" stroke-linejoin="round"><path d="M28.39 56.02A26.13 26.13 0 1 1 35.61 56.02A3.63 3.63 0 1 1 28.39 56.02Z"/></g>
+<g fill="#000"><circle cx="32" cy="41.28" r="4.15"/><circle cx="20.85" cy="30.13" r="3.11"/><circle cx="32" cy="18.99" r="3.11"/><circle cx="43.15" cy="30.13" r="3.11"/></g>
 </svg>

+ 2 - 2
netbox/project-static/img/connectors/power-outlet/iec-60309-3p-e-9h.svg

@@ -1,4 +1,4 @@
 <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64">
-<g fill="none" stroke="#000" stroke-width="3" stroke-linejoin="round"><path d="M28.13 59.73A28 28 0 1 1 35.87 59.73A3.89 3.89 0 1 1 28.13 59.73Z"/></g>
-<g fill="#000"><circle cx="20.06" cy="32" r="4.44"/><circle cx="32" cy="20.06" r="3.33"/><circle cx="43.94" cy="32" r="3.33"/><circle cx="32" cy="43.94" r="3.33"/></g>
+<g fill="none" stroke="#000" stroke-width="3" stroke-linejoin="round"><path d="M28.39 56.02A26.13 26.13 0 1 1 35.61 56.02A3.63 3.63 0 1 1 28.39 56.02Z"/></g>
+<g fill="#000"><circle cx="20.85" cy="30.13" r="4.15"/><circle cx="32" cy="18.99" r="3.11"/><circle cx="43.15" cy="30.13" r="3.11"/><circle cx="32" cy="41.28" r="3.11"/></g>
 </svg>

+ 2 - 2
netbox/project-static/img/connectors/power-outlet/iec-60309-3p-n-e-4h.svg

@@ -1,4 +1,4 @@
 <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64">
-<g fill="none" stroke="#000" stroke-width="3" stroke-linejoin="round"><path d="M28.65 59.8A28 28 0 1 1 35.35 59.8A3.42 3.42 0 1 1 28.65 59.8Z"/></g>
-<g fill="#000"><circle cx="43.21" cy="38.47" r="3.91"/><circle cx="29.31" cy="44.67" r="2.93"/><circle cx="19.12" cy="33.35" r="2.93"/><circle cx="26.73" cy="20.17" r="2.93"/><circle cx="41.62" cy="23.34" r="2.93"/></g>
+<g fill="none" stroke="#000" stroke-width="3" stroke-linejoin="round"><path d="M28.87 56.16A26.17 26.17 0 1 1 35.13 56.16A3.2 3.2 0 1 1 28.87 56.16Z"/></g>
+<g fill="#000"><circle cx="42.48" cy="36.23" r="3.65"/><circle cx="29.48" cy="42.01" r="2.74"/><circle cx="19.96" cy="31.44" r="2.74"/><circle cx="27.08" cy="19.11" r="2.74"/><circle cx="41" cy="22.07" r="2.74"/></g>
 </svg>

+ 2 - 2
netbox/project-static/img/connectors/power-outlet/iec-60309-3p-n-e-6h.svg

@@ -1,4 +1,4 @@
 <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64">
-<g fill="none" stroke="#000" stroke-width="3" stroke-linejoin="round"><path d="M28.65 59.8A28 28 0 1 1 35.35 59.8A3.42 3.42 0 1 1 28.65 59.8Z"/></g>
-<g fill="#000"><circle cx="32" cy="44.95" r="3.91"/><circle cx="19.68" cy="36" r="2.93"/><circle cx="24.39" cy="21.52" r="2.93"/><circle cx="39.61" cy="21.52" r="2.93"/><circle cx="44.32" cy="36" r="2.93"/></g>
+<g fill="none" stroke="#000" stroke-width="3" stroke-linejoin="round"><path d="M28.87 56.16A26.17 26.17 0 1 1 35.13 56.16A3.2 3.2 0 1 1 28.87 56.16Z"/></g>
+<g fill="#000"><circle cx="32" cy="42.28" r="3.65"/><circle cx="20.49" cy="33.91" r="2.74"/><circle cx="24.89" cy="20.38" r="2.74"/><circle cx="39.11" cy="20.38" r="2.74"/><circle cx="43.51" cy="33.91" r="2.74"/></g>
 </svg>

+ 2 - 2
netbox/project-static/img/connectors/power-outlet/iec-60309-3p-n-e-9h.svg

@@ -1,4 +1,4 @@
 <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64">
-<g fill="none" stroke="#000" stroke-width="3" stroke-linejoin="round"><path d="M28.65 59.8A28 28 0 1 1 35.35 59.8A3.42 3.42 0 1 1 28.65 59.8Z"/></g>
-<g fill="#000"><circle cx="19.05" cy="32" r="3.91"/><circle cx="28" cy="19.68" r="2.93"/><circle cx="42.48" cy="24.39" r="2.93"/><circle cx="42.48" cy="39.61" r="2.93"/><circle cx="28" cy="44.32" r="2.93"/></g>
+<g fill="none" stroke="#000" stroke-width="3" stroke-linejoin="round"><path d="M28.87 56.16A26.17 26.17 0 1 1 35.13 56.16A3.2 3.2 0 1 1 28.87 56.16Z"/></g>
+<g fill="#000"><circle cx="19.9" cy="30.17" r="3.65"/><circle cx="28.26" cy="18.66" r="2.74"/><circle cx="41.79" cy="23.06" r="2.74"/><circle cx="41.79" cy="37.29" r="2.74"/><circle cx="28.26" cy="41.68" r="2.74"/></g>
 </svg>

+ 2 - 2
netbox/project-static/img/connectors/power-outlet/iec-60309-p-n-e-4h.svg

@@ -1,4 +1,4 @@
 <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64">
-<g fill="none" stroke="#000" stroke-width="3" stroke-linejoin="round"><path d="M27.58 59.65A28 28 0 1 1 36.42 59.65A4.42 4.42 0 0 1 27.58 59.65Z"/></g>
-<g fill="#000"><circle cx="41.58" cy="37.53" r="5.06"/><circle cx="22.42" cy="37.53" r="3.79"/><circle cx="32" cy="20.94" r="3.79"/></g>
+<g fill="none" stroke="#000" stroke-width="3" stroke-linejoin="round"><path d="M27.87 55.9A26.11 26.11 0 1 1 36.13 55.9A4.13 4.13 0 0 1 27.87 55.9Z"/></g>
+<g fill="#000"><circle cx="40.93" cy="35.27" r="4.72"/><circle cx="23.07" cy="35.27" r="3.54"/><circle cx="32" cy="19.8" r="3.54"/></g>
 </svg>

+ 2 - 2
netbox/project-static/img/connectors/power-outlet/iec-60309-p-n-e-6h.svg

@@ -1,4 +1,4 @@
 <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64">
-<g fill="none" stroke="#000" stroke-width="3" stroke-linejoin="round"><path d="M27.58 59.65A28 28 0 1 1 36.42 59.65A4.42 4.42 0 0 1 27.58 59.65Z"/></g>
-<g fill="#000"><circle cx="32" cy="43.06" r="5.06"/><circle cx="22.42" cy="26.47" r="3.79"/><circle cx="41.58" cy="26.47" r="3.79"/></g>
+<g fill="none" stroke="#000" stroke-width="3" stroke-linejoin="round"><path d="M27.87 55.9A26.11 26.11 0 1 1 36.13 55.9A4.13 4.13 0 0 1 27.87 55.9Z"/></g>
+<g fill="#000"><circle cx="32" cy="40.43" r="4.72"/><circle cx="23.07" cy="24.96" r="3.54"/><circle cx="40.93" cy="24.96" r="3.54"/></g>
 </svg>

+ 2 - 2
netbox/project-static/img/connectors/power-outlet/iec-60309-p-n-e-9h.svg

@@ -1,4 +1,4 @@
 <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64">
-<g fill="none" stroke="#000" stroke-width="3" stroke-linejoin="round"><path d="M27.58 59.65A28 28 0 1 1 36.42 59.65A4.42 4.42 0 0 1 27.58 59.65Z"/></g>
-<g fill="#000"><circle cx="20.94" cy="32" r="5.06"/><circle cx="37.53" cy="22.42" r="3.79"/><circle cx="37.53" cy="41.58" r="3.79"/></g>
+<g fill="none" stroke="#000" stroke-width="3" stroke-linejoin="round"><path d="M27.87 55.9A26.11 26.11 0 1 1 36.13 55.9A4.13 4.13 0 0 1 27.87 55.9Z"/></g>
+<g fill="#000"><circle cx="21.68" cy="30.11" r="4.72"/><circle cx="37.16" cy="21.18" r="3.54"/><circle cx="37.16" cy="39.05" r="3.54"/></g>
 </svg>

+ 3 - 3
netbox/project-static/img/connectors/power-port/iec-60309-2p-e-4h.svg

@@ -1,5 +1,5 @@
 <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64">
-<g fill="none" stroke="#000" stroke-width="3" stroke-linejoin="round"><path d="M35.83 59.74A28 28 0 1 0 28.17 59.74A3.86 3.86 0 1 0 35.83 59.74Z"/></g>
-<g fill="none" stroke="#000" stroke-width="2" stroke-linejoin="round"><circle cx="32" cy="32" r="24.4"/></g>
-<g fill="#000"><circle cx="22.24" cy="37.63" r="4.51"/><circle cx="41.76" cy="37.63" r="3.22"/><circle cx="32" cy="20.74" r="3.22"/></g>
+<g fill="none" stroke="#000" stroke-width="3" stroke-linejoin="round"><path d="M35.56 55.92A26.08 26.08 0 1 0 28.44 55.92A3.6 3.6 0 1 0 35.56 55.92Z"/></g>
+<g fill="none" stroke="#000" stroke-width="2" stroke-linejoin="round"><circle cx="32" cy="30.08" r="22.72"/></g>
+<g fill="#000"><circle cx="22.91" cy="35.33" r="4.2"/><circle cx="41.09" cy="35.33" r="3"/><circle cx="32" cy="19.59" r="3"/></g>
 </svg>

+ 3 - 3
netbox/project-static/img/connectors/power-port/iec-60309-2p-e-6h.svg

@@ -1,5 +1,5 @@
 <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64">
-<g fill="none" stroke="#000" stroke-width="3" stroke-linejoin="round"><path d="M35.83 59.74A28 28 0 1 0 28.17 59.74A3.86 3.86 0 1 0 35.83 59.74Z"/></g>
-<g fill="none" stroke="#000" stroke-width="2" stroke-linejoin="round"><circle cx="32" cy="32" r="24.4"/></g>
-<g fill="#000"><circle cx="32" cy="43.26" r="4.51"/><circle cx="41.76" cy="26.37" r="3.22"/><circle cx="22.24" cy="26.37" r="3.22"/></g>
+<g fill="none" stroke="#000" stroke-width="3" stroke-linejoin="round"><path d="M35.56 55.92A26.08 26.08 0 1 0 28.44 55.92A3.6 3.6 0 1 0 35.56 55.92Z"/></g>
+<g fill="none" stroke="#000" stroke-width="2" stroke-linejoin="round"><circle cx="32" cy="30.08" r="22.72"/></g>
+<g fill="#000"><circle cx="32" cy="40.57" r="4.2"/><circle cx="41.09" cy="24.84" r="3"/><circle cx="22.91" cy="24.84" r="3"/></g>
 </svg>

+ 3 - 3
netbox/project-static/img/connectors/power-port/iec-60309-2p-e-9h.svg

@@ -1,5 +1,5 @@
 <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64">
-<g fill="none" stroke="#000" stroke-width="3" stroke-linejoin="round"><path d="M35.83 59.74A28 28 0 1 0 28.17 59.74A3.86 3.86 0 1 0 35.83 59.74Z"/></g>
-<g fill="none" stroke="#000" stroke-width="2" stroke-linejoin="round"><circle cx="32" cy="32" r="24.4"/></g>
-<g fill="#000"><circle cx="43.26" cy="32" r="4.51"/><circle cx="26.37" cy="22.24" r="3.22"/><circle cx="26.37" cy="41.76" r="3.22"/></g>
+<g fill="none" stroke="#000" stroke-width="3" stroke-linejoin="round"><path d="M35.56 55.92A26.08 26.08 0 1 0 28.44 55.92A3.6 3.6 0 1 0 35.56 55.92Z"/></g>
+<g fill="none" stroke="#000" stroke-width="2" stroke-linejoin="round"><circle cx="32" cy="30.08" r="22.72"/></g>
+<g fill="#000"><circle cx="42.49" cy="30.08" r="4.2"/><circle cx="26.75" cy="20.99" r="3"/><circle cx="26.75" cy="39.17" r="3"/></g>
 </svg>

+ 3 - 3
netbox/project-static/img/connectors/power-port/iec-60309-3p-e-4h.svg

@@ -1,5 +1,5 @@
 <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64">
-<g fill="none" stroke="#000" stroke-width="3" stroke-linejoin="round"><path d="M35.37 59.8A28 28 0 1 0 28.63 59.8A3.39 3.39 0 1 0 35.37 59.8Z"/></g>
-<g fill="none" stroke="#000" stroke-width="2" stroke-linejoin="round"><circle cx="32" cy="32" r="24.21"/></g>
-<g fill="#000"><circle cx="21.47" cy="38.08" r="3.96"/><circle cx="38.08" cy="42.53" r="2.83"/><circle cx="42.53" cy="25.92" r="2.83"/><circle cx="25.92" cy="21.47" r="2.83"/></g>
+<g fill="none" stroke="#000" stroke-width="3" stroke-linejoin="round"><path d="M35.16 56.41A26.3 26.3 0 1 0 28.84 56.41A3.19 3.19 0 1 0 35.16 56.41Z"/></g>
+<g fill="none" stroke="#000" stroke-width="2" stroke-linejoin="round"><circle cx="32" cy="30.3" r="22.74"/></g>
+<g fill="#000"><circle cx="22.11" cy="36.01" r="3.72"/><circle cx="37.71" cy="40.19" r="2.66"/><circle cx="41.89" cy="24.59" r="2.66"/><circle cx="26.29" cy="20.41" r="2.66"/></g>
 </svg>

+ 3 - 3
netbox/project-static/img/connectors/power-port/iec-60309-3p-e-6h.svg

@@ -1,5 +1,5 @@
 <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64">
-<g fill="none" stroke="#000" stroke-width="3" stroke-linejoin="round"><path d="M35.37 59.8A28 28 0 1 0 28.63 59.8A3.39 3.39 0 1 0 35.37 59.8Z"/></g>
-<g fill="none" stroke="#000" stroke-width="2" stroke-linejoin="round"><circle cx="32" cy="32" r="24.21"/></g>
-<g fill="#000"><circle cx="32" cy="44.16" r="3.96"/><circle cx="44.16" cy="32" r="2.83"/><circle cx="32" cy="19.84" r="2.83"/><circle cx="19.84" cy="32" r="2.83"/></g>
+<g fill="none" stroke="#000" stroke-width="3" stroke-linejoin="round"><path d="M35.16 56.41A26.3 26.3 0 1 0 28.84 56.41A3.19 3.19 0 1 0 35.16 56.41Z"/></g>
+<g fill="none" stroke="#000" stroke-width="2" stroke-linejoin="round"><circle cx="32" cy="30.3" r="22.74"/></g>
+<g fill="#000"><circle cx="32" cy="41.72" r="3.72"/><circle cx="43.42" cy="30.3" r="2.66"/><circle cx="32" cy="18.88" r="2.66"/><circle cx="20.58" cy="30.3" r="2.66"/></g>
 </svg>

+ 3 - 3
netbox/project-static/img/connectors/power-port/iec-60309-3p-e-9h.svg

@@ -1,5 +1,5 @@
 <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64">
-<g fill="none" stroke="#000" stroke-width="3" stroke-linejoin="round"><path d="M35.37 59.8A28 28 0 1 0 28.63 59.8A3.39 3.39 0 1 0 35.37 59.8Z"/></g>
-<g fill="none" stroke="#000" stroke-width="2" stroke-linejoin="round"><circle cx="32" cy="32" r="24.21"/></g>
-<g fill="#000"><circle cx="44.16" cy="32" r="3.96"/><circle cx="32" cy="19.84" r="2.83"/><circle cx="19.84" cy="32" r="2.83"/><circle cx="32" cy="44.16" r="2.83"/></g>
+<g fill="none" stroke="#000" stroke-width="3" stroke-linejoin="round"><path d="M35.16 56.41A26.3 26.3 0 1 0 28.84 56.41A3.19 3.19 0 1 0 35.16 56.41Z"/></g>
+<g fill="none" stroke="#000" stroke-width="2" stroke-linejoin="round"><circle cx="32" cy="30.3" r="22.74"/></g>
+<g fill="#000"><circle cx="43.42" cy="30.3" r="3.72"/><circle cx="32" cy="18.88" r="2.66"/><circle cx="20.58" cy="30.3" r="2.66"/><circle cx="32" cy="41.72" r="2.66"/></g>
 </svg>

+ 3 - 3
netbox/project-static/img/connectors/power-port/iec-60309-3p-n-e-4h.svg

@@ -1,5 +1,5 @@
 <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64">
-<g fill="none" stroke="#000" stroke-width="3" stroke-linejoin="round"><path d="M34.97 59.84A28 28 0 1 0 29.03 59.84A2.99 2.99 0 1 0 34.97 59.84Z"/></g>
-<g fill="none" stroke="#000" stroke-width="2" stroke-linejoin="round"><circle cx="32" cy="32" r="24.36"/></g>
-<g fill="#000"><circle cx="20.55" cy="38.61" r="3.49"/><circle cx="34.75" cy="44.94" r="2.5"/><circle cx="45.15" cy="33.38" r="2.5"/><circle cx="37.38" cy="19.92" r="2.5"/><circle cx="22.17" cy="23.15" r="2.5"/></g>
+<g fill="none" stroke="#000" stroke-width="3" stroke-linejoin="round"><path d="M34.81 56.83A26.49 26.49 0 1 0 29.19 56.83A2.83 2.83 0 1 0 34.81 56.83Z"/></g>
+<g fill="none" stroke="#000" stroke-width="2" stroke-linejoin="round"><circle cx="32" cy="30.49" r="23.04"/></g>
+<g fill="#000"><circle cx="21.16" cy="36.75" r="3.31"/><circle cx="34.6" cy="42.73" r="2.36"/><circle cx="44.44" cy="31.8" r="2.36"/><circle cx="37.09" cy="19.06" r="2.36"/><circle cx="22.7" cy="22.12" r="2.36"/></g>
 </svg>

+ 3 - 3
netbox/project-static/img/connectors/power-port/iec-60309-3p-n-e-6h.svg

@@ -1,5 +1,5 @@
 <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64">
-<g fill="none" stroke="#000" stroke-width="3" stroke-linejoin="round"><path d="M34.97 59.84A28 28 0 1 0 29.03 59.84A2.99 2.99 0 1 0 34.97 59.84Z"/></g>
-<g fill="none" stroke="#000" stroke-width="2" stroke-linejoin="round"><circle cx="32" cy="32" r="24.36"/></g>
-<g fill="#000"><circle cx="32" cy="45.23" r="3.49"/><circle cx="44.58" cy="36.09" r="2.5"/><circle cx="39.77" cy="21.3" r="2.5"/><circle cx="24.23" cy="21.3" r="2.5"/><circle cx="19.42" cy="36.09" r="2.5"/></g>
+<g fill="none" stroke="#000" stroke-width="3" stroke-linejoin="round"><path d="M34.81 56.83A26.49 26.49 0 1 0 29.19 56.83A2.83 2.83 0 1 0 34.81 56.83Z"/></g>
+<g fill="none" stroke="#000" stroke-width="2" stroke-linejoin="round"><circle cx="32" cy="30.49" r="23.04"/></g>
+<g fill="#000"><circle cx="32" cy="43" r="3.31"/><circle cx="43.9" cy="34.36" r="2.36"/><circle cx="39.35" cy="20.37" r="2.36"/><circle cx="24.65" cy="20.37" r="2.36"/><circle cx="20.1" cy="34.36" r="2.36"/></g>
 </svg>

+ 3 - 3
netbox/project-static/img/connectors/power-port/iec-60309-3p-n-e-9h.svg

@@ -1,5 +1,5 @@
 <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64">
-<g fill="none" stroke="#000" stroke-width="3" stroke-linejoin="round"><path d="M34.97 59.84A28 28 0 1 0 29.03 59.84A2.99 2.99 0 1 0 34.97 59.84Z"/></g>
-<g fill="none" stroke="#000" stroke-width="2" stroke-linejoin="round"><circle cx="32" cy="32" r="24.36"/></g>
-<g fill="#000"><circle cx="45.23" cy="32" r="3.49"/><circle cx="36.09" cy="19.42" r="2.5"/><circle cx="21.3" cy="24.23" r="2.5"/><circle cx="21.3" cy="39.77" r="2.5"/><circle cx="36.09" cy="44.58" r="2.5"/></g>
+<g fill="none" stroke="#000" stroke-width="3" stroke-linejoin="round"><path d="M34.81 56.83A26.49 26.49 0 1 0 29.19 56.83A2.83 2.83 0 1 0 34.81 56.83Z"/></g>
+<g fill="none" stroke="#000" stroke-width="2" stroke-linejoin="round"><circle cx="32" cy="30.49" r="23.04"/></g>
+<g fill="#000"><circle cx="44.51" cy="30.49" r="3.31"/><circle cx="35.87" cy="18.59" r="2.36"/><circle cx="21.88" cy="23.13" r="2.36"/><circle cx="21.88" cy="37.84" r="2.36"/><circle cx="35.87" cy="42.39" r="2.36"/></g>
 </svg>

+ 3 - 3
netbox/project-static/img/connectors/power-port/iec-60309-p-n-e-4h.svg

@@ -1,5 +1,5 @@
 <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64">
-<g fill="none" stroke="#000" stroke-width="3" stroke-linejoin="round"><path d="M35.83 59.74A28 28 0 1 0 28.17 59.74A3.86 3.86 0 1 0 35.83 59.74Z"/></g>
-<g fill="none" stroke="#000" stroke-width="2" stroke-linejoin="round"><circle cx="32" cy="32" r="24.4"/></g>
-<g fill="#000"><circle cx="22.24" cy="37.63" r="4.51"/><circle cx="41.76" cy="37.63" r="3.22"/><circle cx="32" cy="20.74" r="3.22"/></g>
+<g fill="none" stroke="#000" stroke-width="3" stroke-linejoin="round"><path d="M35.56 55.92A26.08 26.08 0 1 0 28.44 55.92A3.6 3.6 0 1 0 35.56 55.92Z"/></g>
+<g fill="none" stroke="#000" stroke-width="2" stroke-linejoin="round"><circle cx="32" cy="30.08" r="22.72"/></g>
+<g fill="#000"><circle cx="22.91" cy="35.33" r="4.2"/><circle cx="41.09" cy="35.33" r="3"/><circle cx="32" cy="19.59" r="3"/></g>
 </svg>

+ 3 - 3
netbox/project-static/img/connectors/power-port/iec-60309-p-n-e-6h.svg

@@ -1,5 +1,5 @@
 <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64">
-<g fill="none" stroke="#000" stroke-width="3" stroke-linejoin="round"><path d="M35.83 59.74A28 28 0 1 0 28.17 59.74A3.86 3.86 0 1 0 35.83 59.74Z"/></g>
-<g fill="none" stroke="#000" stroke-width="2" stroke-linejoin="round"><circle cx="32" cy="32" r="24.4"/></g>
-<g fill="#000"><circle cx="32" cy="43.26" r="4.51"/><circle cx="41.76" cy="26.37" r="3.22"/><circle cx="22.24" cy="26.37" r="3.22"/></g>
+<g fill="none" stroke="#000" stroke-width="3" stroke-linejoin="round"><path d="M35.56 55.92A26.08 26.08 0 1 0 28.44 55.92A3.6 3.6 0 1 0 35.56 55.92Z"/></g>
+<g fill="none" stroke="#000" stroke-width="2" stroke-linejoin="round"><circle cx="32" cy="30.08" r="22.72"/></g>
+<g fill="#000"><circle cx="32" cy="40.57" r="4.2"/><circle cx="41.09" cy="24.84" r="3"/><circle cx="22.91" cy="24.84" r="3"/></g>
 </svg>

+ 3 - 3
netbox/project-static/img/connectors/power-port/iec-60309-p-n-e-9h.svg

@@ -1,5 +1,5 @@
 <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64">
-<g fill="none" stroke="#000" stroke-width="3" stroke-linejoin="round"><path d="M35.83 59.74A28 28 0 1 0 28.17 59.74A3.86 3.86 0 1 0 35.83 59.74Z"/></g>
-<g fill="none" stroke="#000" stroke-width="2" stroke-linejoin="round"><circle cx="32" cy="32" r="24.4"/></g>
-<g fill="#000"><circle cx="43.26" cy="32" r="4.51"/><circle cx="26.37" cy="22.24" r="3.22"/><circle cx="26.37" cy="41.76" r="3.22"/></g>
+<g fill="none" stroke="#000" stroke-width="3" stroke-linejoin="round"><path d="M35.56 55.92A26.08 26.08 0 1 0 28.44 55.92A3.6 3.6 0 1 0 35.56 55.92Z"/></g>
+<g fill="none" stroke="#000" stroke-width="2" stroke-linejoin="round"><circle cx="32" cy="30.08" r="22.72"/></g>
+<g fill="#000"><circle cx="42.49" cy="30.08" r="4.2"/><circle cx="26.75" cy="20.99" r="3"/><circle cx="26.75" cy="39.17" r="3"/></g>
 </svg>

+ 1 - 1
netbox/project-static/img/connectors/power-port/nema-5-20p.svg

@@ -1,4 +1,4 @@
 <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64">
 <g fill="none" stroke="#000" stroke-width="3" stroke-linejoin="round"><circle cx="32" cy="32" r="28"/></g>
-<g fill="#000"><path d="M25.98 25.56L21.78 25.56L21.78 45.16L25.98 45.16Z"/><path d="M23.88 32.7L11 32.7L11 36.9L23.88 36.9Z"/><path d="M44.74 28.78L40.54 28.78L40.54 41.94L44.74 41.94Z"/><path d="M36.2 11.84L27.8 11.84L27.8 15.76A4.2 4.2 0 0 0 36.2 15.76Z"/></g>
+<g fill="#000"><path d="M23.88 32.7L11 32.7L11 36.9L23.88 36.9Z"/><path d="M44.74 28.78L40.54 28.78L40.54 41.94L44.74 41.94Z"/><path d="M36.2 11.84L27.8 11.84L27.8 15.76A4.2 4.2 0 0 0 36.2 15.76Z"/></g>
 </svg>

+ 1 - 1
netbox/project-static/img/connectors/power-port/nema-6-20p.svg

@@ -1,4 +1,4 @@
 <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64">
 <g fill="none" stroke="#000" stroke-width="3" stroke-linejoin="round"><circle cx="32" cy="32" r="28"/></g>
-<g fill="#000"><path d="M27.1 24.72L22.9 24.72L22.9 45.72L27.1 45.72Z"/><path d="M25 33.54L9.88 33.54L9.88 37.74L25 37.74Z"/><path d="M50.34 34.1L37.18 34.1L37.18 38.3L50.34 38.3Z"/><path d="M36.2 11.84L27.8 11.84L27.8 15.76A4.2 4.2 0 0 0 36.2 15.76Z"/></g>
+<g fill="#000"><path d="M27.1 29.06L22.9 29.06L22.9 42.22L27.1 42.22Z"/><path d="M50.34 34.1L37.18 34.1L37.18 38.3L50.34 38.3Z"/><path d="M36.2 11.84L27.8 11.84L27.8 15.76A4.2 4.2 0 0 0 36.2 15.76Z"/></g>
 </svg>

+ 0 - 4
netbox/project-static/styles/custom/_misc.scss

@@ -100,10 +100,6 @@ img.plugin-icon {
   object-fit: contain;
   vertical-align: middle;
 }
-.choice-image-lg {
-  width: 4rem;
-  height: 4rem;
-}
 
 html[data-bs-theme='dark'] {
   // Assuming icon is black/white line art, invert it and tone down brightness

+ 8 - 17
netbox/templates/dcim/inc/cable_termination.html

@@ -24,6 +24,14 @@
             {{ term.device|linkify }}
             <i class="mdi mdi-chevron-right" aria-hidden="true"></i>
             {{ term|linkify }}
+            {% if term.type %}
+              <span class="text-secondary ms-1">
+                {% if term.get_type_image %}
+                  <img src="{% static term.get_type_image %}" class="choice-image" alt="" />
+                {% endif %}
+                {{ term.get_type_display }}
+              </span>
+            {% endif %}
             <a href="{% action_url term 'trace' pk=term.pk %}" class="btn btn-sm btn-primary" title="{% trans "Trace" %}">
               <i class="mdi mdi-transit-connection-variant" aria-hidden="true"></i>
             </a>
@@ -31,23 +39,6 @@
           {% endfor %}
         </td>
       </tr>
-      {% if terminations.0.type %}
-        <tr>
-          <th scope="row">{% trans "Type" %}</th>
-          <td>
-            {% for term in terminations %}
-              {% ifchanged term.type %}
-                <div>
-                  {% if term.get_type_image %}
-                    <img src="{% static term.get_type_image %}" class="choice-image choice-image-lg me-2" alt="" />
-                  {% endif %}
-                  {{ term.get_type_display|placeholder }}
-                </div>
-              {% endifchanged %}
-            {% endfor %}
-          </td>
-        </tr>
-      {% endif %}
     {% elif terminations.0.power_panel %}
       {# Power feed #}
       <tr>

+ 1 - 1
netbox/templates/ui/attrs/choice.html

@@ -1,7 +1,7 @@
 {% load static %}
 {% if image %}
   <span class="d-inline-flex align-items-center gap-2">
-    <img src="{% static image %}" class="choice-image choice-image-lg" alt="" />
+    <img src="{% static image %}" class="choice-image" alt="" />
     {% if bg_color %}{% badge value bg_color=bg_color %}{% else %}{{ value }}{% endif %}
   </span>
 {% elif bg_color %}

+ 26 - 72
netbox/utilities/tests/test_forms.py

@@ -1043,56 +1043,58 @@ class HTMXSelectTestCase(TestCase):
         self.assertEqual(widget.attrs['hx-include'], '#form_fields')
 
 
-class DescriptionSelectTestCase(TestCase):
+class StaticSelectTestCase(TestCase):
     """
-    Validate the rendering of option descriptions in static select fields.
+    Validate the rendering of option descriptions and images in static select fields.
     """
     class ExampleChoices(ChoiceSet):
         FOO = 'foo'
         BAR = 'bar'
         CHOICES = (
-            Choice(FOO, 'Foo', description='Description of foo'),
+            Choice(FOO, 'Foo', description='Description of foo', image='foo.svg'),
             Choice(BAR, 'Bar'),
         )
 
-    def test_choiceset_descriptions_populate_widget(self):
-        field = ChoiceField(choices=self.ExampleChoices)
-        self.assertEqual(field.widget.descriptions, {self.ExampleChoices.FOO: 'Description of foo'})
-
-    def test_multiplechoicefield_descriptions_populate_widget(self):
-        field = MultipleChoiceField(choices=self.ExampleChoices)
-        self.assertEqual(field.widget.descriptions, {self.ExampleChoices.FOO: 'Description of foo'})
+    def test_choiceset_populates_widget(self):
+        for field_class in (ChoiceField, MultipleChoiceField, TypedChoiceField):
+            with self.subTest(field_class=field_class.__name__):
+                field = field_class(choices=self.ExampleChoices)
+                self.assertEqual(field.widget.descriptions, {self.ExampleChoices.FOO: 'Description of foo'})
+                self.assertEqual(field.widget.images, {self.ExampleChoices.FOO: 'foo.svg'})
 
     def test_show_descriptions_false_suppresses_descriptions(self):
         field = ChoiceField(choices=self.ExampleChoices, show_descriptions=False)
         self.assertEqual(field.widget.descriptions, {})
 
-    def test_add_blank_choice_preserves_descriptions(self):
+    def test_add_blank_choice_preserves_attrs(self):
         field = ChoiceField(choices=add_blank_choice(self.ExampleChoices))
         self.assertEqual(field.widget.descriptions, {self.ExampleChoices.FOO: 'Description of foo'})
+        self.assertEqual(field.widget.images, {self.ExampleChoices.FOO: 'foo.svg'})
 
-    def test_data_description_rendered_on_option(self):
+    @override_settings(STATIC_URL='/static/')
+    def test_data_attrs_rendered_on_option(self):
         field = ChoiceField(choices=self.ExampleChoices)
         html = field.widget.render('test', None)
         self.assertInHTML(
-            '<option value="foo" data-description="Description of foo">Foo</option>',
+            '<option value="foo" data-description="Description of foo" data-image="/static/foo.svg">Foo</option>',
             html
         )
-        # Options without a description should not receive the attribute
+        # Options without a description or image should not receive the attributes
         self.assertInHTML('<option value="bar">Bar</option>', html)
 
-    def test_choiceset_without_descriptions(self):
-        class NoDescriptions(ChoiceSet):
+    def test_choiceset_without_attrs(self):
+        class NoAttrs(ChoiceSet):
             CHOICES = (('a', 'A'),)
 
-        field = ChoiceField(choices=NoDescriptions)
+        field = ChoiceField(choices=NoAttrs)
         self.assertEqual(field.widget.descriptions, {})
+        self.assertEqual(field.widget.images, {})
 
-    def test_descriptions_refresh_when_choices_reassigned(self):
-        """Reassigning a field's choices after construction should refresh the widget's description map."""
+    def test_attrs_refresh_when_choices_reassigned(self):
+        """Reassigning a field's choices after construction should refresh the widget's description and image maps."""
         class OtherChoices(ChoiceSet):
             CHOICES = (
-                Choice('baz', 'Baz', description='Description of baz'),
+                Choice('baz', 'Baz', description='Description of baz', image='baz.svg'),
             )
 
         field = ChoiceField(choices=self.ExampleChoices)
@@ -1100,16 +1102,13 @@ class DescriptionSelectTestCase(TestCase):
 
         field.choices = OtherChoices
         self.assertEqual(field.widget.descriptions, {'baz': 'Description of baz'})
+        self.assertEqual(field.widget.images, {'baz': 'baz.svg'})
 
     def test_show_descriptions_false_suppresses_on_reassignment(self):
         field = ChoiceField(choices=self.ExampleChoices, show_descriptions=False)
         field.choices = self.ExampleChoices
         self.assertEqual(field.widget.descriptions, {})
 
-    def test_typedchoicefield_populates_descriptions(self):
-        field = TypedChoiceField(choices=self.ExampleChoices)
-        self.assertEqual(field.widget.descriptions, {self.ExampleChoices.FOO: 'Description of foo'})
-
     def test_typedchoicefield_empty_value_defaults_to_none(self):
         """A blank selection on a TypedChoiceField resolves to None (for storage as NULL) rather than ''."""
         field = TypedChoiceField(choices=add_blank_choice(self.ExampleChoices), required=False)
@@ -1122,10 +1121,11 @@ class DescriptionSelectTestCase(TestCase):
         self.assertInHTML('<option value="x" data-description="Description X">X</option>', html)
         self.assertInHTML('<option value="y">Y</option>', html)
 
-    def test_deepcopy_does_not_share_descriptions(self):
-        widget = Select(choices=[('x', 'X')], descriptions={'x': 'Description X'})
+    def test_deepcopy_does_not_share_attrs(self):
+        widget = Select(choices=[('x', 'X')], descriptions={'x': 'Description X'}, images={'x': 'x.svg'})
         clone = copy.deepcopy(widget)
         self.assertIsNot(widget.descriptions, clone.descriptions)
+        self.assertIsNot(widget.images, clone.images)
         widget.descriptions['y'] = 'leaked'
         self.assertNotIn('y', clone.descriptions)
 
@@ -1155,49 +1155,3 @@ class DescriptionSelectTestCase(TestCase):
         self.assertTrue(calls)
         # And descriptions are still collected as normal
         self.assertEqual(field.widget.descriptions, {self.ExampleChoices.FOO: 'Description of foo'})
-
-
-class ImageSelectTestCase(TestCase):
-    """
-    Validate the rendering of option images in static select fields.
-    """
-    class ExampleChoices(ChoiceSet):
-        FOO = 'foo'
-        BAR = 'bar'
-        CHOICES = (
-            Choice(FOO, 'Foo', image='foo.svg'),
-            Choice(BAR, 'Bar'),
-        )
-
-    def test_choiceset_images_populate_widget(self):
-        for field_class in (ChoiceField, MultipleChoiceField, TypedChoiceField):
-            with self.subTest(field_class=field_class.__name__):
-                field = field_class(choices=self.ExampleChoices)
-                self.assertEqual(field.widget.images, {self.ExampleChoices.FOO: 'foo.svg'})
-
-    def test_add_blank_choice_preserves_images(self):
-        field = ChoiceField(choices=add_blank_choice(self.ExampleChoices))
-        self.assertEqual(field.widget.images, {self.ExampleChoices.FOO: 'foo.svg'})
-
-    def test_images_refresh_when_choices_reassigned(self):
-        class OtherChoices(ChoiceSet):
-            CHOICES = (
-                Choice('baz', 'Baz', image='baz.svg'),
-            )
-
-        field = ChoiceField(choices=self.ExampleChoices)
-        field.choices = OtherChoices
-        self.assertEqual(field.widget.images, {'baz': 'baz.svg'})
-
-    @override_settings(STATIC_URL='/static/')
-    def test_data_image_rendered_on_option(self):
-        field = ChoiceField(choices=self.ExampleChoices)
-        html = field.widget.render('test', None)
-        self.assertInHTML('<option value="foo" data-image="/static/foo.svg">Foo</option>', html)
-        # Options without an image should not receive the attribute
-        self.assertInHTML('<option value="bar">Bar</option>', html)
-
-    def test_deepcopy_does_not_share_images(self):
-        widget = Select(choices=[('x', 'X')], images={'x': 'x.svg'})
-        clone = copy.deepcopy(widget)
-        self.assertIsNot(widget.images, clone.images)

+ 26 - 14
scripts/generate_connector_images.py

@@ -180,23 +180,25 @@ def arc_slot(cx, cy, radius, start, end, width):
 #
 
 class Transform:
-    def __init__(self, scale, mirror):
+    def __init__(self, scale, mirror, centre):
         self.scale = scale
         self.mirror = mirror
+        self.centre = centre
 
     def point(self, x, y):
-        x *= self.scale
-        return SIZE / 2 + (-x if self.mirror else x), SIZE / 2 + y * self.scale
+        x = (x - self.centre[0]) * self.scale
+        return SIZE / 2 + (-x if self.mirror else x), SIZE / 2 + (y - self.centre[1]) * self.scale
 
 
 class Drawing:
     """
-    The face of a connector. width and height give the extent of the face (in mm) about its centre, which is
-    scaled to fill the frame.
+    The face of a connector. width and height give the extent of the face (in mm) about centre (by default the
+    origin), which is scaled to fill the frame.
     """
-    def __init__(self, width, height):
+    def __init__(self, width, height, centre=(0, 0)):
         self.width = width
         self.height = height
+        self.centre = centre
         self.elements = []
 
     def outline(self, *shapes):
@@ -212,7 +214,7 @@ class Drawing:
         return self
 
     def svg(self, mirror=False):
-        tx = Transform(CONTENT / max(self.width, self.height), mirror)
+        tx = Transform(CONTENT / max(self.width, self.height), mirror, self.centre)
         groups = {
             'outline': f'<g fill="none" stroke="#000" stroke-width="{OUTLINE}" stroke-linejoin="round">',
             'detail': f'<g fill="none" stroke="#000" stroke-width="{DETAIL}" stroke-linejoin="round">',
@@ -329,13 +331,15 @@ IEC_60309_SIZES = {
 def iec_60309(contacts, hour, male=False):
     radius, key_offset, pin_circle, shroud = IEC_60309_SIZES[contacts]
     if male:
-        outer = shroud[1]
-        drawing = Drawing(2 * outer, 2 * outer).outline(keyed_circle(outer, 3, outer + 0.2))
-        drawing.detail(Circle(0, 0, shroud[0]))
-        earth_r, line_r = 3.5, 2.5
+        radius, key_offset, key_r, earth_r, line_r = shroud[1], shroud[1] + 0.2, 3, 3.5, 2.5
     else:
-        drawing = Drawing(2 * radius, 2 * radius).outline(keyed_circle(radius, 3.5, key_offset))
-        earth_r, line_r = 4.0, 3.0
+        key_r, earth_r, line_r = 3.5, 4.0, 3.0
+    # The key projects below the circle
+    bottom = key_offset + key_r
+    drawing = Drawing(2 * radius, radius + bottom, centre=(0, (bottom - radius) / 2))
+    drawing.outline(keyed_circle(radius, key_r, key_offset))
+    if male:
+        drawing.detail(Circle(0, 0, shroud[0]))
     for i in range(contacts):
         x, y = polar(0, 0, pin_circle, hour * 30 + i * 360 / contacts)
         drawing.fill(Circle(x, y, earth_r if i == 0 else line_r))
@@ -427,6 +431,13 @@ NEMA_STRAIGHT = {
     ),
 }
 
+# Plugs whose blades don't match their receptacle's slots: the T-shaped slots of 5-20R and 6-20R also accept
+# 15 A plugs. Drawn in receptacle orientation (and mirrored like the other plugs).
+NEMA_STRAIGHT_PLUGS = {
+    '5-20': lambda: nema(nema_h(0.52, 0.1, 0.46), nema_v(-0.38, 0.12, 0.47)),
+    '6-20': lambda: nema(nema_v(0.25, 0.13, 0.47), nema_h(-0.42, 0.15, 0.47)),
+}
+
 
 #
 # NEMA locking ("twist-lock") receptacles (face radius = 1; oriented as on the NEMA configuration chart). Each
@@ -1174,7 +1185,8 @@ def iec_60309_types(male=False):
 def nema_types(male=False):
     """Return a drawing function for each NEMA (straight-blade and locking) and California Style type."""
     suffix = 'p' if male else 'r'
-    types = {f'nema-{name}{suffix}': func for name, func in {**NEMA_STRAIGHT, **NEMA_LOCKING}.items()}
+    faces = {**NEMA_STRAIGHT, **NEMA_LOCKING, **(NEMA_STRAIGHT_PLUGS if male else {})}
+    types = {f'nema-{name}{suffix}': func for name, func in faces.items()}
     if male:
         types = {value: mirrored(func) for value, func in types.items()}
     for (female_value, male_value), (slots, lugs, recess) in CALIFORNIA_STYLE.items():

Some files were not shown because too many files changed in this diff