-
Notifications
You must be signed in to change notification settings - Fork 3
/
preferences.py
74 lines (61 loc) · 2.1 KB
/
preferences.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/env python
import sys
import os
import subprocess
import string
import socket
import tempfile
import pygame
import time
from configure import parseOutputconf
class Preferences(object):
def __init__(self):
self.aLonLat = False
self.aGPS = False
self.aBroadcast = False
def pgsetting(self):
#self.pgconn = PgConn()
#self.pgconn.show()
x=1
def setSettings(self, key, value):
if key == 'actionLonLat':
self.aLonLat = value
self.aGPS = not value
self.aBcast = not value
elif key == 'actionGPS':
self.aGPS = value
self.aBcast = not value
self.aLonLat = not value
elif key == 'actionBroadcast':
self.aBcast = value
self.aLonLat = not value
self.aGPS = not value
else:
print 'implement the setting: ' + key
def getSettings(self, key):
if key == 'actionLonLat':
return self.aLonLat
elif key == 'actionGPS':
return self.aGPS
elif key == 'actionBroadcast':
return self.aBcast
else:
print 'implement the setting: ' + key
#print 'None'
return None
def paramConnection(self, t):
try :
if t not in ('H','P','D'):
print "Unknown type:" + t + " Use H/P/D for host/password/data"
if t == 'H':
host = str(parseOutputconf()['host'])
return host
elif t == 'P':
port = parseOutputconf()['pport']
return int(port)
elif t == 'D':
data = parseOutputconf()['dport']
return data
except :
print 'Use preference Panel to set preference'
self.worningmessage('Use the preference setting to set TCP preference')