| 1 |
|
| 2 |
|
| 3 |
from svginstr import * |
| 4 |
import sys |
| 5 |
|
| 6 |
__author__ = "Melchior FRANZ < mfranz # aon : at >" |
| 7 |
__url__ = "http://gitorious.org/svginstr/" |
| 8 |
__version__ = "0.2" |
| 9 |
__license__ = "GPL v2+" |
| 10 |
__doc__ = """ |
| 11 |
""" |
| 12 |
|
| 13 |
|
| 14 |
try: |
| 15 |
a = Instrument("asi.svg", 512, 512, "test face; " + __version__) |
| 16 |
a.disc(98, color = 'black') |
| 17 |
a.disc(1) |
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
a.angle = lambda x: x * 300.0 / 115.0 - 145.0 |
| 22 |
|
| 23 |
|
| 24 |
l = 50 |
| 25 |
|
| 26 |
|
| 27 |
compress = 0.8 |
| 28 |
|
| 29 |
a.arc(44, 100 + 27 * compress, l+3, width = 8, color = "green") |
| 30 |
a.arc(100 + 27 * compress, 100 + 58 * compress, l+3, width = 8, color = "yellow") |
| 31 |
a.arc(33, 85, l, width = 3, color = "white") |
| 32 |
|
| 33 |
for i in range(35, 100, 5): |
| 34 |
a.tick(i, l, 58, 2) |
| 35 |
|
| 36 |
for i in range(100, 152, int(5 * compress + 0.5)): |
| 37 |
a.tick(i, l, 58, 2) |
| 38 |
|
| 39 |
for i in range(40, 100, 10): |
| 40 |
a.tick(i, l, 65, 2) |
| 41 |
|
| 42 |
for i in range(100, 155, int(10 * compress + 0.5)): |
| 43 |
a.tick(i, l, 65, 2) |
| 44 |
|
| 45 |
a.tick(100 + 58 * compress, l, 60, color="red") |
| 46 |
|
| 47 |
|
| 48 |
mph = 0.8689 |
| 49 |
k = 30 |
| 50 |
for i in range(40, 100, int(10 * mph)): |
| 51 |
a.tick(i, k, k + 6, 1) |
| 52 |
for i in range(40 + int(65 * mph), 150, int(10 * mph * compress)): |
| 53 |
a.tick(i, k, k + 6, 1) |
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
s = 13 |
| 60 |
|
| 61 |
a.at(0,-70).text("AIRSPEED", size = 10, font_family = "Lucida Sans", color = "white") |
| 62 |
a.at(0,-55).text("KNOTS", size = 10, font_family = "Lucida Sans", color = "white") |
| 63 |
a.at(60,-42).text(40, size = s, font_family = "Lucida Sans", color = "white") |
| 64 |
a.at(75,20).text(60, size = s, font_family = "Lucida Sans", color = "white") |
| 65 |
a.at(35,72).text(80, size = s, font_family = "Lucida Sans", color = "white") |
| 66 |
a.at(-40,72).text(100, size = s, font_family = "Lucida Sans", color = "white") |
| 67 |
a.at(-75,30).text(120, size = s, font_family = "Lucida Sans", color = "white") |
| 68 |
a.at(-75,-20).text(140, size = s, font_family = "Lucida Sans", color = "white") |
| 69 |
a.at(-45,-57).text(160, size = s, font_family = "Lucida Sans", color = "white") |
| 70 |
|
| 71 |
|
| 72 |
s = 7 |
| 73 |
a.at(16,-18).text(40, size = s, font_family = "Lucida Sans", color = "white") |
| 74 |
a.at(22,2).text(60, size = s, font_family = "Lucida Sans", color = "white") |
| 75 |
a.at(16,20).text(80, size = s, font_family = "Lucida Sans", color = "white") |
| 76 |
a.at(0,27).text(100, size = s, font_family = "Lucida Sans", color = "white") |
| 77 |
a.at(-14,22).text(120, size = s, font_family = "Lucida Sans", color = "white") |
| 78 |
a.at(-19,13).text(140, size = s, font_family = "Lucida Sans", color = "white") |
| 79 |
a.at(-22,0).text(160, size = s, font_family = "Lucida Sans", color = "white") |
| 80 |
a.at(-17,-14).text(180, size = s, font_family = "Lucida Sans", color = "white") |
| 81 |
a.at(0,-20).text("MPH", size = s, font_family = "Lucida Sans", color = "white") |
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
except Error as e: |
| 90 |
print >>sys.stderr, "\033[31;1m%s\033[m\n" % e |
| 91 |
|