From 2ffdcf6705e33fc5811c9c37209849884154fbc3 Mon Sep 17 00:00:00 2001 From: devnulling Date: Mon, 16 May 2016 22:17:50 -0700 Subject: [PATCH 1/3] Add API Key field --- res/modes_rx.ui | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/res/modes_rx.ui b/res/modes_rx.ui index 52e5793..bed98c9 100644 --- a/res/modes_rx.ui +++ b/res/modes_rx.ui @@ -6,8 +6,8 @@ 0 0 - 687 - 422 + 719 + 454 @@ -102,8 +102,8 @@ 10 20 - 236 - 251 + 241 + 281 @@ -307,7 +307,7 @@ 10 - 200 + 190 221 22 @@ -320,7 +320,7 @@ 10 - 220 + 210 221 22 @@ -329,6 +329,16 @@ Use DC blocking filter + + + + 90 + 250 + 121 + 27 + + + @@ -549,6 +559,19 @@ + + + + 20 + 270 + 67 + 17 + + + + API Key + + @@ -1031,7 +1054,7 @@ 0 0 - 687 + 719 25 From 49b7d87e7ac7d39945bc3a19885283b0ef2a9b33 Mon Sep 17 00:00:00 2001 From: devnulling Date: Mon, 16 May 2016 22:18:15 -0700 Subject: [PATCH 2/3] Add API Key field --- apps/modes_gui | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/apps/modes_gui b/apps/modes_gui index ca44ced..2d2bd1f 100755 --- a/apps/modes_gui +++ b/apps/modes_gui @@ -87,7 +87,9 @@ class mainwindow(QtGui.QMainWindow): self.ui.line_my_lat.insert(defaults["latitude"]) if defaults["longitude"] is not None: self.ui.line_my_lon.insert(defaults["longitude"]) - + if defaults["apikey"] is not None: + self.ui.line_my_api_key.insert(defaults["apikey"]) + #disable by default self.ui.check_adsbonly.setCheckState(QtCore.Qt.Unchecked) @@ -321,6 +323,11 @@ class mainwindow(QtGui.QMainWindow): except: my_position = None + try: + my_apikey = str(self.ui.line_my_api_key.text()) + except: + my_apikey = None + self._cpr_dec = air_modes.cpr_decoder(my_position) self.datamodelout = dashboard_output(self._cpr_dec, self.datamodel, self._publisher) @@ -359,7 +366,7 @@ class mainwindow(QtGui.QMainWindow): #create SQL database for KML and dashboard displays self.dbwriter = air_modes.output_sql(self._cpr_dec, self.dbname, self.lock, self._publisher) self.jsonpgen = air_modes.output_jsonp(self._jsonfile.name, self.dbname, my_position, self.lock, timeout=1) - htmlstring = air_modes.html_template(my_position, self._jsonfile.name) + htmlstring = air_modes.html_template(my_apikey, my_position, self._jsonfile.name) self._htmlfile.write(htmlstring) self._htmlfile.flush() class WebPage(QtWebKit.QWebPage): @@ -404,7 +411,11 @@ class mainwindow(QtGui.QMainWindow): self.prefs["longitude"] = float(self.ui.line_my_lon.text()) except: pass - + try: + self.prefs["apikey"] = self.ui.line_my_api_key.text() + except: + pass + def on_quit(self): if self.running is True: self._radio.close() @@ -463,6 +474,7 @@ class mainwindow(QtGui.QMainWindow): defaults["threshold"] = "5" defaults["latitude"] = None defaults["longitude"] = None + defaults["apikey"] = None prefs = ConfigParser.ConfigParser(defaults) prefs.optionxform = str From 0599c09198dcfccc3c387d0f6b76ad186f40652e Mon Sep 17 00:00:00 2001 From: devnulling Date: Mon, 16 May 2016 22:18:52 -0700 Subject: [PATCH 3/3] Add API Key field --- python/html_template.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/python/html_template.py b/python/html_template.py index 1e6e5b0..0ada669 100644 --- a/python/html_template.py +++ b/python/html_template.py @@ -2,7 +2,7 @@ #HTML template for Mode S map display #Nick Foster, 2013 -def html_template(my_position, json_file): +def html_template(my_apikey, my_position, json_file): if my_position is None: my_position = [37, -122] @@ -25,9 +25,9 @@ def html_template(my_position, json_file): white-space: nowrap; } - -