Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Zielke <kg4gjy@takeovertheworld.org>2009-05-26 05:15:14 (GMT)
committer Jack Zielke <kg4gjy@takeovertheworld.org>2009-05-26 05:15:14 (GMT)
commit22fed72ecf4d7d2d37003bc998227783c4051775 (patch)
tree45cbbd70904663a9cc3343e2e0990ac7e8f0e4c1
parent7468a2bc8bf2e4d328fd519f49fe650a89eb92fd (diff)
version 3 - no journal, can not send messages, gui update
-rw-r--r--MANIFEST4
-rw-r--r--NEWS1
-rw-r--r--TODO1
-rw-r--r--activity/activity.info8
-rwxr-xr-xaprs.py355
-rw-r--r--locale/en/activity.linfo2
-rwxr-xr-xsetup.py2
7 files changed, 186 insertions, 187 deletions
diff --git a/MANIFEST b/MANIFEST
index 6750e8e..dd3de42 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -6,9 +6,9 @@ README
locale
locale/en
locale/en/LC_MESSAGES
-locale/en/LC_MESSAGES/org.laptop.APRS.mo
+locale/en/LC_MESSAGES/org.laptop.APRSXO.mo
locale/en/activity.linfo
activity
-activity/activity-aprs.svg
+activity/activity-aprs-xo.svg
activity/activity.info
aprs.py
diff --git a/NEWS b/NEWS
index c75c936..3d71ce4 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,4 @@
September 14 2008 - version 0 started
September 20 2008 - version 1 - no journal, no messaging
September 22 2008 - version 2 - no journal, can not send messages, gui update
+September 25 2008 - version 3 - no journal, can not send messages, gui update
diff --git a/TODO b/TODO
index cec5e21..a23850b 100644
--- a/TODO
+++ b/TODO
@@ -7,5 +7,6 @@ cleanup timers on disconnect
cleanup old acks in self.sent_acks{}
cleanup old timers in self.timers[]
+send a default filter command like: s//A/X ?
auto reconnect?
aprs.laptop.org?
diff --git a/activity/activity.info b/activity/activity.info
index cf8dd05..413fc49 100644
--- a/activity/activity.info
+++ b/activity/activity.info
@@ -1,6 +1,6 @@
[Activity]
-name = APRS
-activity_version= 2
-service_name = org.laptop.APRS
-icon = activity-aprs
+name = APRS-XO
+activity_version= 3
+service_name = org.laptop.APRSXO
+icon = activity-aprs-xo
exec = sugar-activity aprs.APRSActivity
diff --git a/aprs.py b/aprs.py
index 901b28a..37749fc 100755
--- a/aprs.py
+++ b/aprs.py
@@ -27,8 +27,11 @@ from gettext import gettext as _
from sugar import profile
from sugar.activity import activity
from sugar.bundle.activitybundle import ActivityBundle
+from sugar.graphics.menuitem import MenuItem
from sugar.graphics.toolbutton import ToolButton
+TESTING = False
+
HOST = 'rotate.aprs2.net'
#HOST = '192.168.50.6'
PORT = 14580
@@ -43,9 +46,10 @@ del bundle
class APRSActivity(activity.Activity):
def __init__(self, handle):
activity.Activity.__init__(self, handle)
- self.set_title(_('APRS Activity'))
+# self.set_title(_('APRS-XO Activity'))
+ self.set_title("APRS-XO Activity")
- self.connect('destroy', self.onDestroy)
+# self.connect("destroy", self.onDestroy)
self.sock = None
self.location = "home"
@@ -53,6 +57,8 @@ class APRSActivity(activity.Activity):
self.sent_acks = {}
self.timers = []
self.validating = False
+ self.help = True
+ self.messagebox = False
titlefont = pango.FontDescription('Sans bold 8')
mediumfont = pango.FontDescription('Sans 6.5')
@@ -131,8 +137,8 @@ class APRSActivity(activity.Activity):
infobox = gtk.VBox(False, 4)
# more info radio box?
-# infolabel = gtk.Label("Without a ham license you can only communicate with other XO's on the Internet.\nWith a ham license you can communicate worldwide with wireless and radio.")
- infolabel = gtk.Label("With a ham license you can communicate worldwide with wireless and radio.\nWithout a ham license you can only communicate with other XO's on the\nInternet.")
+# infolabel = gtk.Label("With a ham license you can communicate worldwide with wireless and radio.\nWithout a ham license you can only communicate with other XO's on the\nInternet.")
+ infolabel = gtk.Label("With a ham license you can communicate worldwide with wireless and radio.")
infolabel.set_alignment(0, 0)
infolabel.modify_font(smallfont)
infobox.pack_start(infolabel, False, False, 0)
@@ -149,95 +155,53 @@ class APRSActivity(activity.Activity):
separator.show()
# identifiers box
- identbox = gtk.HBox(False, 4)
+ identbox = gtk.VBox(False, 4)
identbox.set_border_width(8)
- leftidentbox = gtk.VBox(False, 4)
-# leftidentbox.set_border_width(8)
identlabel = gtk.Label("Identifiers")
identlabel.set_alignment(0, 0)
identlabel.modify_font(titlefont)
- leftidentbox.pack_start(identlabel, False, False, 0)
+ identbox.pack_start(identlabel, False, False, 0)
identlabel.show()
- spacerlabel = gtk.Label(" ")
- spacerlabel.modify_font(verysmallfont)
- leftidentbox.pack_start(spacerlabel, False, False, 0)
- spacerlabel.show()
-
- bottomleftidentbox = gtk.HBox(False, 0)
+ bottomidentbox = gtk.HBox(False, 10)
calllabel1 = gtk.Label("Callsign: ")
- calllabel1.set_alignment(0, 0.2)
- bottomleftidentbox.pack_start(calllabel1, False, False, 0)
+ calllabel1.set_alignment(0, 0.5)
+ bottomidentbox.pack_start(calllabel1, False, False, 0)
calllabel1.show()
- callbox = gtk.VBox(False, 4)
self.calltext = gtk.Entry()
self.calltext.set_max_length(9)
- self.calltext.set_width_chars(6)
+ self.calltext.set_width_chars(9)
self.calltext.connect("changed", self.disable_beacon)
- callbox.pack_start(self.calltext, False, False, 0)
+ bottomidentbox.pack_start(self.calltext, False, False, 0)
self.calltext.show()
- calllabel2 = gtk.Label("If a ham radio operator")
- calllabel2.set_alignment(0, 0)
- calllabel2.modify_font(smallfont)
- callbox.pack_start(calllabel2, False, False, 0)
- calllabel2.show()
-
- bottomleftidentbox.pack_start(callbox, False, False, 0)
- callbox.show()
-
- leftidentbox.pack_start(bottomleftidentbox, False, False, 0)
- bottomleftidentbox.show()
-
- identbox.pack_start(leftidentbox, False, False, 0)
- leftidentbox.show()
-
- rightidentbox = gtk.VBox(False, 4)
-# rightidentbox.set_border_width(8)
-
- toprightidentbox = gtk.HBox(False, 4)
- namelabel = gtk.Label("First Name: ")
- namelabel.set_alignment(0, 0.5)
- toprightidentbox.pack_start(namelabel, False, False, 0)
- namelabel.show()
+ passlabel1 = gtk.Label("Password: ")
+ passlabel1.set_alignment(0, 0.5)
+ bottomidentbox.pack_start(passlabel1, False, False, 0)
+ passlabel1.show()
- self.nametext = gtk.Entry()
- self.nametext.set_max_length(36)
- self.nametext.set_width_chars(15)
- self.nametext.set_text(firstName)
- self.nametext.connect("changed", self.disable_beacon)
- toprightidentbox.pack_start(self.nametext, False, False, 0)
- self.nametext.show()
- rightidentbox.pack_start(toprightidentbox, False, False, 0)
- toprightidentbox.show()
+# bottomrightidentbox = gtk.VBox(False, 0)
- bottomrightidentbox = gtk.HBox(False, 0)
+ self.passtext = gtk.Entry()
+ self.passtext.set_max_length(5)
+ self.passtext.set_width_chars(5)
+ bottomidentbox.pack_start(self.passtext, False, False, 0)
+ self.passtext.show()
- ziplabel1 = gtk.Label("Zip Code: ")
- ziplabel1.set_alignment(0, 0.5)
- bottomrightidentbox.pack_start(ziplabel1, False, False, 0)
- ziplabel1.show()
+ identbox.pack_start(bottomidentbox, False, False, 0)
+ bottomidentbox.show()
- self.ziptext = gtk.Entry()
- self.ziptext.set_max_length(5)
- self.ziptext.set_width_chars(5)
- bottomrightidentbox.pack_start(self.ziptext, False, False, 0)
- self.ziptext.show()
+ passlabel2 = gtk.Label("optional")
+ passlabel2.set_alignment(0.68, 0)
+ passlabel2.modify_font(smallfont)
+ identbox.pack_start(passlabel2, False, False, 0)
+ passlabel2.show()
- rightidentbox.pack_start(bottomrightidentbox, False, False, 0)
- bottomrightidentbox.show()
-
- ziplabel2 = gtk.Label("otherwise your call will be XZZZZZ")
- ziplabel2.set_alignment(0, 0)
- ziplabel2.modify_font(smallfont)
- rightidentbox.pack_start(ziplabel2, False, False, 0)
- ziplabel2.show()
-
- identbox.pack_start(rightidentbox, False, False, 0)
- rightidentbox.show()
+ # bottomidentbox.pack_start(bottomrightidentbox, False, False, 0)
+ # bottomrightidentbox.show()
leftwin.pack_start(identbox, False, False, 0)
identbox.show()
@@ -252,25 +216,31 @@ class APRSActivity(activity.Activity):
# topstationbox = gtk.HBox(False, 8)
- stationlabel = gtk.Label("Station Text")
+ stationlabel = gtk.Label("Station Comment")
stationlabel.set_alignment(0, 0)
stationlabel.modify_font(titlefont)
# topstationbox.pack_start(stationlabel, False, False, 0)
stationbox.pack_start(stationlabel, False, False, 0)
stationlabel.show()
+ # so the text box does not fill all Horizontal space
+ stationtextbox = gtk.HBox()
+
self.stationtext = gtk.Entry()
- self.stationtext.set_max_length(36)
- self.stationtext.set_width_chars(36)
+ self.stationtext.set_max_length(43)
+ self.stationtext.set_width_chars(43)
+ self.stationtext.set_text("%s's XO at home." % firstName)
self.stationtext.connect("changed", self.disable_beacon)
# topstationbox.pack_start(self.stationtext, False, False, 0)
- stationbox.pack_start(self.stationtext, False, False, 0)
+ stationtextbox.pack_start(self.stationtext, False, False, 0)
self.stationtext.show()
+ stationbox.pack_start(stationtextbox, False, False, 0)
+ stationtextbox.show()
# stationbox.pack_start(topstationbox, False, False, 0)
# topstationbox.show()
- stationhelp = gtk.Label("Enter up to 36 characters, most important first since some\ndisplays can only see the first 20 or 28.")
+ stationhelp = gtk.Label("Optional description of current position, status, or destination.\nEnter up to 43 characters, most important first since some\ndisplays can only see the first 20 or 28.")
stationhelp.set_alignment(0, 0)
# stationhelp.modify_font(mediumfont)
stationbox.pack_start(stationhelp, False, False, 0)
@@ -396,58 +366,20 @@ class APRSActivity(activity.Activity):
toppositbox.pack_start(topleftpositbox, False, False, 0)
topleftpositbox.show()
- toprightpositbox = gtk.VBox(False, 0)
+ toprightpositbox = gtk.VBox(False, 4)
+ toprightpositbox.set_border_width(10)
- loclabel = gtk.Label("Location Type:")
- loclabel.set_alignment(0, 0)
+ loclabel = gtk.Label("-OR- Zip Code:")
+ loclabel.set_alignment(0.3, 0)
toprightpositbox.pack_start(loclabel, False, False, 0)
loclabel.show()
- locbox = gtk.HBox(False, 0)
-
- leftlocbox = gtk.VBox(False, 0)
-
- locbutton = gtk.RadioButton(None, "home")
- locbutton.connect("toggled", self.set_location, "home")
- locbutton.set_active(True)
- leftlocbox.pack_start(locbutton, False, False, 0)
- locbutton.show()
-
- locbutton = gtk.RadioButton(locbutton, "work")
- locbutton.connect("toggled", self.set_location, "work")
- leftlocbox.pack_start(locbutton, False, False, 0)
- locbutton.show()
-
- locbutton = gtk.RadioButton(locbutton, "school")
- locbutton.connect("toggled", self.set_location, "school")
- leftlocbox.pack_start(locbutton, False, False, 0)
- locbutton.show()
-
- locbox.pack_start(leftlocbox, False, False, 0)
- leftlocbox.show()
-
- rightlocbox = gtk.VBox(False, 0)
-
- locbutton = gtk.RadioButton(locbutton, "club")
- locbutton.connect("toggled", self.set_location, "club")
- rightlocbox.pack_start(locbutton, False, False, 0)
- locbutton.show()
-
- locbutton = gtk.RadioButton(locbutton, "visiting")
- locbutton.connect("toggled", self.set_location, "visiting")
- rightlocbox.pack_start(locbutton, False, False, 0)
- locbutton.show()
-
- locbutton = gtk.RadioButton(locbutton, "other")
- locbutton.connect("toggled", self.set_location, "other")
- rightlocbox.pack_start(locbutton, False, False, 0)
- locbutton.show()
-
- locbox.pack_start(rightlocbox, False, False, 0)
- rightlocbox.show()
-
- toprightpositbox.pack_start(locbox, False, False, 0)
- locbox.show()
+ self.ziptext = gtk.Entry()
+ self.ziptext.set_max_length(5)
+ self.ziptext.set_width_chars(5)
+ self.ziptext.connect("changed", self.disable_beacon)
+ toprightpositbox.pack_start(self.ziptext, False, False, 0)
+ self.ziptext.show()
toppositbox.pack_start(toprightpositbox, False, False, 0)
toprightpositbox.show()
@@ -510,8 +442,7 @@ class APRSActivity(activity.Activity):
messageview.set_justification(gtk.JUSTIFY_LEFT)
messageview.modify_font(smallfont)
-# self.messagebuffer.set_text("Welcome to APRS-XO.\n\nThis program sends your position information to a server\nthat will then display your location on a webpage. This\nprogram requires an active Internet connection to work.\n\nSelect an APRS Site\nSelecting a button will copy the URI to the clipboard.\n\nIndentifiers\nIf you are not a ham radio operator enter your first name\nand zip code.\n\nIf you are a ham radio operator enter your first name,\ncallsign, and position data. If position is unknown, leave\nthe callsign field blank and enter your 5 digit zip code.\n\nStation Text\nData in the Station Text field will appear after your location\ninformation on the website.\n\nBeacon\nWhen selected, sends location data every 10 minutes. The\nbeacon will automatically stop when you edit personal\ninformation. Must be manually reselected after edit\ncompletion.\n\nAPRS Copyright (c) Bob Bruninga WB4APR\n\n")
- self.messagebuffer.set_text("Welcome to APRS-XO.\n\nThis program sends your position information to a server\nthat will then display your location on a webpage. This\nprogram requires an active Internet connection to work.\n\nSelect an APRS Site\nSelecting a button will copy the URI to the clipboard.\n\nIndentifiers\nIf you are not a ham radio operator enter your first name\nand zip code.\n\nIf you are a ham radio operator enter your first name,\ncallsign, and position data. If position is unknown, leave\nthe callsign field blank and enter your 5 digit zip code.")
+ self.messagebuffer.set_text("Welcome to APRS-XO.\n\nThis program sends your position information to a server\nthat will then display your location on a webpage. This\nprogram requires an active Internet connection to work.\n\nSelect an APRS Site\nSelecting a button will copy the URI to the clipboard.\n\nIndentifiers\nEnter your callsign and optionally an aprsd password\n\nStation Comment\nData in the Station Comment field will appear after your\nlocation information on the website.")
self.messagewindow = gtk.ScrolledWindow()
self.messagewindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_ALWAYS)
@@ -537,7 +468,7 @@ class APRSActivity(activity.Activity):
self.messagetext = gtk.Entry()
self.messagetext.set_max_length(67)
- self.messagetext.set_width_chars(27)
+ self.messagetext.set_width_chars(28)
self.messagetext.modify_font(smallfont)
self.messagetext.connect("activate", self.send_message, self.messagetext)
messagebox.pack_start(self.messagetext, False, False, 0)
@@ -558,7 +489,7 @@ class APRSActivity(activity.Activity):
statusview.set_justification(gtk.JUSTIFY_LEFT)
statusview.modify_font(smallfont)
- self.statusbuffer.set_text("Station Text\nData in the Station Text field will appear after your location\ninformation on the website.\n\nBeacon\nWhen selected, sends location data every 10 minutes. The\nbeacon will automatically stop when you edit personal\ninformation. Must be manually reselected after edit\ncompletion.\n\nAPRS Copyright (c) Bob Bruninga WB4APR\n\n")
+ self.statusbuffer.set_text("Position\nEnter your lat/lon. You may leave the decimal minutes (mm)\nblank for position ambiguity. If you do not know your lat/lon,\nenter your 5 digit zip code instead.\n\nBeacon\nWhen selected, sends location data every 10 minutes. The\nbeacon will automatically stop when you edit personal\ninformation. Must be manually reselected after edit\ncompletion.\n\nThis message will self destruct when you press Connect\n\nAPRS Copyright (c) Bob Bruninga WB4APR\n\n")
self.statuswindow = gtk.ScrolledWindow()
self.statuswindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_ALWAYS)
@@ -571,7 +502,7 @@ class APRSActivity(activity.Activity):
self.rawtext = gtk.Entry()
self.rawtext.set_max_length(128)
- self.rawtext.set_width_chars(38)
+ self.rawtext.set_width_chars(39)
self.rawtext.modify_font(smallfont)
self.rawtext.connect("activate", self.raw_send)
self.rawbox.pack_start(self.rawtext, False, False, 0)
@@ -591,6 +522,24 @@ class APRSActivity(activity.Activity):
win.pack_start(rightwin, False, False, 0)
rightwin.show()
+ # for quick testing
+ if (TESTING):
+ self.calltext.set_text("kg4gjy")
+ self.passtext.set_text("18107")
+ self.latDDtext.set_text("35")
+ self.latMMtext.set_text("7")
+ self.latmmtext.set_text("42")
+ self.latcombo.set_active(0)
+ self.lonDDDtext.set_text("85")
+ self.lonMMtext.set_text("6")
+ self.lonmmtext.set_text("93")
+ self.loncombo.set_active(0)
+# self.nametext.set_text("Jack")
+# self.locbutton.set_active(0)
+ self.stationtext.set_text("")
+ self.ziptext.set_text("")
+ self.beaconbutton.set_active(True)
+
win.show()
def clear_status(self, button=None):
@@ -603,8 +552,14 @@ class APRSActivity(activity.Activity):
def connect_aprs(self, button):
if (self.sock == None):
- self.clear_message()
- self.clear_status()
+
+ if (self.help):
+ self.clear_status()
+# self.clear_message()
+ self.messagebuffer.set_text("Message Window")
+ self.messagebox = True
+ self.help = False
+
if (self.validate_data() == False):
return False
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
@@ -633,10 +588,8 @@ class APRSActivity(activity.Activity):
self.status_write("Port Full.\n")
self.disconnect_aprs(button)
- # hidden feature
- # if you have callsign, zip code and position - send zip as password
- if (self.calltext.get_text() != "" and self.ziptext.get_text() != "" and self.latDDtext.get_text() != "DD"):
- sendme = "user %s pass %s vers aprs_xo %d\n" % (self.calltext.get_text(), self.ziptext.get_text(), VERSION)
+ if (self.calltext.get_text() != "" and self.passtext.get_text() != ""):
+ sendme = "user %s pass %s vers aprs_xo %d filter m/300\n" % (self.calltext.get_text(), self.passtext.get_text(), VERSION)
else:
sendme = "user %s vers aprs_xo %d\n" % (self.calltext.get_text(), VERSION)
self.sock.sendall(sendme)
@@ -650,11 +603,15 @@ class APRSActivity(activity.Activity):
# if (response.find("unverified") == -1):
# self.rawbox.show()
+ self.status_write("\n")
+
self.input_watch = gobject.io_add_watch(self.sock, gobject.IO_IN, self.recv_data)
# send banner
sendme = "%s>APRS-XO v%s\n" % (self.calltext.get_text(), VERSION)
self.sock.sendall(sendme)
+ self.status_write("%s>\n" % self.calltext.get_text())
+ self.status_write("APRS-XO v%s\n\n" % VERSION)
self.send_beacon()
self.output_watch = gobject.timeout_add(10 * 60 * 1000, self.send_beacon)
@@ -691,42 +648,47 @@ class APRSActivity(activity.Activity):
return False
else:
# self.status_write(recv_data)
+ # find uri's
+ webaddy = recv_data.lower().find("http")
+ if (webaddy != -1):
+ recv_data = ("%s\n%s" % (recv_data[:webaddy], recv_data[webaddy:]))
+
+ # for now just cut the line at the first ":" unless it looks like a comment
+ if (recv_data[0] == "#"):
+ self.status_write("%s\n\n" % recv_data)
+ else:
+ cuthere = recv_data.find(":")
+ self.status_write("%s\n" % recv_data[:cuthere+1])
- # for now just cut the line at the first ":"
- cuthere = recv_data.find(":")
- self.status_write("%s\n" % recv_data[:cuthere+1])
+ # some incoming lines end in \n and some do not
+ if (recv_data[-1:] == "\n"):
+ self.status_write("%s\n" % recv_data[cuthere+1:])
+ else:
+ self.status_write("%s\n\n" % recv_data[cuthere+1:])
- # some incoming lines end in \n and some do not
- if (recv_data[-1:] == "\n"):
- self.status_write("%s\n" % recv_data[cuthere+1:])
- else:
- self.status_write("%s\n\n" % recv_data[cuthere+1:])
+ self.msg_check(recv_data)
- self.msg_check(recv_data)
return True
def send_beacon(self):
if (self.beaconbutton.get_active()):
- beacon = "%s>APOLPC:=%s%s.%s%sX%s%s.%s%sA%s's XO at %s. %s\n" % (self.calltext.get_text(), self.latDDtext.get_text(), self.latMMtext.get_text(), self.latmmtext.get_text(), self.latcombo.get_active_text(), self.lonDDDtext.get_text(), self.lonMMtext.get_text(), self.lonmmtext.get_text(), self.loncombo.get_active_text(), self.nametext.get_text(), self.location, self.stationtext.get_text())
- try:
- self.sock.sendall(beacon)
- except:
+ beacon = "=%s%s.%s%sX%s%s.%s%sA%s" % (self.latDDtext.get_text(), self.latMMtext.get_text(), self.latmmtext.get_text(), self.latcombo.get_active_text(), self.lonDDDtext.get_text(), self.lonMMtext.get_text(), self.lonmmtext.get_text(), self.loncombo.get_active_text(), self.stationtext.get_text())
+ if (self.send_data(beacon)):
+ return True
+ else:
self.status_write("\nProblem sending beacon - STOPPED")
return False
- self.status_write("%s" % beacon)
- return True
- else:
- return True
def send_data(self, msg):
- text = "%s>APOLPC:%s\n" % (self.calltext.get_text(), msg)
+ path = "%s>APOLPC:" % self.calltext.get_text()
try:
- self.sock.sendall(text)
+ self.sock.sendall("%s%s\n" % (path, msg))
except:
- self.status_write("Problem sending message\n")
+ self.status_write("Problem sending packet\n")
self.sock = None
return False
- self.status_write("%s\n" % text)
+ self.status_write("%s\n" % path)
+ self.status_write("%s\n\n" % msg)
return True
def send_ack(self, msg):
@@ -759,21 +721,12 @@ class APRSActivity(activity.Activity):
self.validating = True
beaconchecked = self.beaconbutton.get_active()
- if (self.nametext.get_text() == ""):
- self.status_write("First Name is required\n")
- stop_here = True
-
if (self.calltext.get_text() == "" and self.ziptext.get_text() == ""):
self.status_write("A callsign or zip code must be provided.\n")
- self.validating = False
- return False
-
- if (stop_here):
- self.validating = False
return False
# convert zip to position
- if (self.calltext.get_text() == "" and self.ziptext.get_text() != "" and self.latDDtext.get_text() == "DD"):
+ if (self.ziptext.get_text() != ""):
self.status_write("Attempting to set location from zip code\n")
self.ziptext.set_text(self.ziptext.get_text().zfill(5))
try:
@@ -803,7 +756,8 @@ class APRSActivity(activity.Activity):
return False
A = random.randrange(0,9)
O = random.randrange(0,9)
- self.calltext.set_text("X%s-%d%d" % (self.ziptext.get_text(), A, O))
+ if (self.calltext.get_text() == ""):
+ self.calltext.set_text("X%s-%d%d" % (self.ziptext.get_text(), A, O))
try:
(lat, lon, junk) = response.split(',', 2)
except:
@@ -900,13 +854,25 @@ class APRSActivity(activity.Activity):
self.beaconbutton.set_active(beaconchecked)
self.validating = False
- def onDestroy(self, junk=None ):
+# def onDestroy(self, junk=None ):
+# if (self.sock != None):
+# self.disconnect()
+
+ def close( self ):
+ self.hide()
if (self.sock != None):
self.disconnect()
+ activity.Activity.close( self )
# def write_file(self, filename):
-# # does not appear to run so commented out for now
+ # does not appear to run
+ # from self.save() returns:
+ # TypeError: object of type 'dbus.Int32' has no len()
+
+# self.metadata['mime_type'] = 'text/plain'
+
# self.metadata['callsign'] = self.calltext.get_text()
+# self.metadata['password'] = self.passtext.get_text()
# self.metadata['latDD'] = self.latDDtext.get_text()
# self.metadata['latMM'] = self.latMMtext.get_text()
# self.metadata['latmm'] = self.latmmtext.get_text()
@@ -915,17 +881,30 @@ class APRSActivity(activity.Activity):
# self.metadata['lonMM'] = self.lonMMtext.get_text()
# self.metadata['lonmm'] = self.lonmmtext.get_text()
# self.metadata['lon'] = self.loncombo.get_active()
-# self.metadata['nick_name'] = self.nametext.get_text()
-# self.metadata['location'] = self.location
+## self.metadata['nick_name'] = self.nametext.get_text()
+## self.metadata['location'] = self.location
# self.metadata['stationtext'] = self.stationtext.get_text()
-# self.metadata['site'] = self.site
-# self.metadata['zip'] = self.ziptext.get_text()
+## self.metadata['zip'] = self.ziptext.get_text()
# self.metadata['beacon'] = self.beaconbutton.get_active()
# # should save list of callsigns used in outgoing messages
# def read_file(self, filename):
-# # does not appear to run so commented out for now
+# # does not appear to run
# self.calltext.set_text(self.metadata.get('callsign', ""))
+# self.passtext.set_text(self.metadata.get('password', ""))
+# self.latDDtext.set_text(self.metadata.get('latDD', "00"))
+# self.latMMtext.set_text(self.metadata.get('latMM', "00"))
+# self.latmmtext.set_text(self.metadata.get('latmm', "00"))
+## self.latcombo.set_active(self.metadata.get('lat', ""))
+# self.lonDDDtext.set_text(self.metadata.get('lonDDD', "000"))
+# self.lonMMtext.set_text(self.metadata.get('lonMM', "00"))
+# self.lonmmtext.set_text(self.metadata.get('lonmm', "00"))
+## self.loncombo.set_active(self.metadata.get('lon', ""))
+## self.nametext.set_text(self.metadata.get('nick_name', "Joe"))
+## self.locbutton.set_active(self.metadata.get('location', ""))
+# self.stationtext.set_text(self.metadata.get('stationtext', "test text"))
+# self.ziptext.set_text(self.metadata.get('zip', ""))
+## self.beaconbutton.set_active(self.metadata.get('beacon', ""))
def msg_check(self, data):
# a quick "does it look like a message?" check
@@ -935,7 +914,8 @@ class APRSActivity(activity.Activity):
if (firstcheck != -1 and secondcheck != -1):
# great, it looks kinda like a message, is it to me?
tocall = data[firstcheck+2:firstcheck+11]
- if (tocall.strip().upper() == self.calltext.get_text()):
+ strippedtocall = tocall.strip().upper()
+ if (strippedtocall == self.calltext.get_text()):
sequence_end = data.find("}")
if (sequence_end == -1):
sequence = data[secondcheck+1:-1]
@@ -943,7 +923,6 @@ class APRSActivity(activity.Activity):
sequence = data[secondcheck+1:sequence_end]
fromcall = data[:data.find(">")]
message = data[firstcheck+12:secondcheck]
- self.message_write("%s> %s" % (fromcall, message))
ackmessage = ":%s:ack%s" % (fromcall, sequence)
self.send_data(ackmessage)
id = "%s-%s" % (fromcall, sequence)
@@ -951,9 +930,27 @@ class APRSActivity(activity.Activity):
self.timers.append(gobject.timeout_add(30 * 1000, self.send_ack, ackmessage))
self.timers.append(gobject.timeout_add(60 * 1000, self.send_ack, ackmessage))
self.timers.append(gobject.timeout_add(120 * 1000, self.send_ack, ackmessage))
+ else:
+ if (self.messagebox):
+ self.clear_message()
+ self.messagebox = False
+ self.message_write("%s> %s\n" % (fromcall, message))
self.sent_acks[id] = time.time() # to help a cleanup thread later
self.sent_acks[fromcall] = sequence # to help with reply acks later
+ else:
+ # is it a message that does not get acked?
+ if (firstcheck != -1):
+ tocall = data[firstcheck+2:firstcheck+11]
+ strippedtocall = tocall.strip().upper()
+ if (strippedtocall == "ALL" or strippedtocall == "QST" or strippedtocall == "CQ" or strippedtocall[:3] == "BLN" or strippedtocall[:3] == "NWS"):
+ fromcall = data[:data.find(">")]
+ message = data[firstcheck+12:-1]
+ # for now, display them every time
+ if (self.messagebox):
+ self.clear_message()
+ self.messagebox = False
+ self.message_write("%s:%s> %s\n" % (fromcall, strippedtocall, message))
def disable_beacon(self, widget, data=None):
if (self.sock != None):
@@ -971,12 +968,12 @@ class APRSActivity(activity.Activity):
self.status_write("Problem sending message\n")
self.sock = None
return False
- self.status_write(msg)
+ self.status_write("%s\n" % msg)
self.rawtext.set_text("")
return True
def send_message(self, widget, data=None):
- self.status_write("This version of APRS-XO can not send messages.\n")
+ self.message_write("This version of APRS-XO can not send messages.\n")
self.messagetext.set_text("")
def clipboard(self):
diff --git a/locale/en/activity.linfo b/locale/en/activity.linfo
index 9c05e71..7c973ee 100644
--- a/locale/en/activity.linfo
+++ b/locale/en/activity.linfo
@@ -1,2 +1,2 @@
[Activity]
-name = APRS
+name = APRS-XO
diff --git a/setup.py b/setup.py
index 93b4ce8..b5b0c1f 100755
--- a/setup.py
+++ b/setup.py
@@ -1,3 +1,3 @@
#!/usr/bin/env python
from sugar.activity import bundlebuilder
-bundlebuilder.start("APRS")
+bundlebuilder.start("APRSXO")