| 1 | <title>{{ instance.getName }}</title> |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | <h1>{{ instance.getName }}</h1> |
|---|
| 5 | <ul> |
|---|
| 6 | {% for component in instance.getAllComponents %} |
|---|
| 7 | |
|---|
| 8 | <li>{{ component.getName }}</li> |
|---|
| 9 | <table cellpadding="0" cellspacing="0"`> |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | {% for property in component.getAllProperties %} |
|---|
| 13 | <tr> |
|---|
| 14 | <td> <form name="{{ property.getName }}-configure" action="/~webdemo/django/WebDash/configure/" method="post">{% csrf_token %} |
|---|
| 15 | {{ property.getName }} |
|---|
| 16 | {% with propKey=instance.getName|add:component.getName|add:property.getName %} |
|---|
| 17 | {% if propKey in map %} |
|---|
| 18 | {% for key, control in map.items %} |
|---|
| 19 | {% if key == propKey %} |
|---|
| 20 | <input type="{{ control }}" name="propValue" value="{{ property.getValue }}" /> |
|---|
| 21 | {% endif %} |
|---|
| 22 | {% endfor %} |
|---|
| 23 | {% else %} |
|---|
| 24 | {% if property.getWidget.type == "slider" %} |
|---|
| 25 | <input type="range" name="propValue" value="{{ property.getValue }}" /> |
|---|
| 26 | {% else %} |
|---|
| 27 | {% if property.getWidget.type == "spin" %} |
|---|
| 28 | <input type="number" name="propValue" value="{{ property.getValue }}" /> |
|---|
| 29 | {% else %} |
|---|
| 30 | {% if property.getWidget.type == "text" %} |
|---|
| 31 | <input type="text" name="propValue" value="{{ property.getValue }}" /> |
|---|
| 32 | {% endif %} |
|---|
| 33 | {% endif %} |
|---|
| 34 | {% endif %} |
|---|
| 35 | {% endif %} |
|---|
| 36 | {% endwith %} |
|---|
| 37 | <input type="hidden" name="waveform" value="{{ instance.getName }}" /> |
|---|
| 38 | <input type="hidden" name="component" value="{{ component.getName }}" /> |
|---|
| 39 | <input type="hidden" name="property" value="{{ property.getName }}" /> |
|---|
| 40 | <input type="submit" value="configure" /> |
|---|
| 41 | </form></td> |
|---|
| 42 | <td><form action="/~webdemo/django/WebDash/updateControls/" method="post">{% csrf_token %} |
|---|
| 43 | <select name="control"> |
|---|
| 44 | |
|---|
| 45 | {% for key, widgetArray in propMap.items %} |
|---|
| 46 | {% if key == property.name %} |
|---|
| 47 | {% for widget in widgetArray %} |
|---|
| 48 | {% if widget.type == "text" %} |
|---|
| 49 | <option value="text">Text</option> |
|---|
| 50 | {% endif %} |
|---|
| 51 | {% if widget.type == "spin" %} |
|---|
| 52 | <option value="spin">Spinner</option> |
|---|
| 53 | {% endif %} |
|---|
| 54 | {% if widget.type == "slider" %} |
|---|
| 55 | <option value="range">Slider</option> |
|---|
| 56 | {% endif %} |
|---|
| 57 | {% if widget.type == "checkbox" %} |
|---|
| 58 | <option value="checkbox">Checkbox</option> |
|---|
| 59 | {% endif %} |
|---|
| 60 | {% if widget.type == "listbox" %} |
|---|
| 61 | <option value="listbox">Listbox</option> |
|---|
| 62 | {% endif %} |
|---|
| 63 | {% endfor %} |
|---|
| 64 | {% endif %} |
|---|
| 65 | {% endfor %} |
|---|
| 66 | </select> |
|---|
| 67 | <input type="hidden" name="waveform" value="{{ instance.getName }}" /> |
|---|
| 68 | <input type="hidden" name="component" value="{{ component.getName }}" /> |
|---|
| 69 | <input type="hidden" name="property" value="{{ property.getName }}" /> |
|---|
| 70 | <input type="submit" value="Change"/> |
|---|
| 71 | </form></td> |
|---|
| 72 | |
|---|
| 73 | |
|---|
| 74 | </tr> |
|---|
| 75 | {% endfor %} |
|---|
| 76 | |
|---|
| 77 | </table> |
|---|
| 78 | {% endfor %} |
|---|
| 79 | |
|---|
| 80 | </ul> |
|---|
| 81 | |
|---|
| 82 | <h2>Block Diagram</h2> |
|---|
| 83 | <canvas id="myCanvas" width="10000" height="100"></canvas> |
|---|
| 84 | <script type="text/javascript"> |
|---|
| 85 | var c=document.getElementById("myCanvas"); |
|---|
| 86 | var cxt=c.getContext("2d"); |
|---|
| 87 | cxt.fillStyle="#FF0000"; |
|---|
| 88 | |
|---|
| 89 | {% for component in instance.getAllComponents %} |
|---|
| 90 | cxt.fillStyle={% cycle "\"#FF0000\"" "\"#000099\"" %}; |
|---|
| 91 | cxt.fillRect(50*{{ forloop.counter }},0,40,40); |
|---|
| 92 | {% endfor %} |
|---|
| 93 | </script> |
|---|
| 94 | <a href='/~webdemo/django/WebDash/'>Home</a> |
|---|
| 95 | |
|---|
| 96 | |
|---|
| 97 | |
|---|
| 98 | |
|---|