summaryrefslogtreecommitdiff
path: root/tomorrowtheground.py
diff options
context:
space:
mode:
Diffstat (limited to 'tomorrowtheground.py')
-rwxr-xr-xtomorrowtheground.py56
1 files changed, 43 insertions, 13 deletions
diff --git a/tomorrowtheground.py b/tomorrowtheground.py
index 5553b42..8ab6383 100755
--- a/tomorrowtheground.py
+++ b/tomorrowtheground.py
@@ -10,25 +10,55 @@ def signal_handler(signal, frame):
signal.signal(signal.SIGINT, signal_handler)
-import gpspoller
-gpsp=""
-if len(sys.argv)>1:
- gpsp = GpsPoller(sys.argv[1])
- gpsp.start()
-
from latLng import *
from layers import *
from xml2obj import *
-doc=xml2obj(open("ttg01.xml"))
+
+if len(sys.argv)<2:
+ print "usage: tomorrowtheground {configfile}"
+
+doc=xml2obj(open(sys.argv[1]))
gpslayers=[]
-for i in doc.gps.index:
- #catch invalid xml
- g=indexlayer(i.file,i.ll1,i.ll2)
- for t in i.trigger:
- g.triggers.append(trigger(int(t.id),t.command,t.param))
- gpslayers.append(g)
+
+#catch invalid xml
+try:
+ for i in doc.gps.index:
+ #catch invalid xml
+ try:
+ g=indexlayer(i.file,i.ll1,i.ll2)
+ for t in i.trigger:
+ g.triggers.append(trigger(int(t.id),t.command,t.param))
+ gpslayers.append(g)
+ except:
+ print "error parsing xml index entry"
+except:
+ print "no index layers found"
+
+#catch invalid xml
+try:
+ for i in doc.gps.scale:
+ #catch invalid xml
+ try:
+ g=scalelayer(i.file,i.ll1,i.ll2)
+ g.setcommand(i.command)
+ gpslayers.append(g)
+ except:
+ print "error parsing xml index entry"
+except:
+ print "no scale layers found"
+import gpspoller
+gpsp=""
+
+try:
+ if len(sys.argv)>1:
+ gpsp = GpsPoller(doc.gpsdevice)
+ gpsp.start()
+except:
+ print "gps device not found"
+
+
import socket
GUI_IP="127.0.0.1"