Merge pull request #84 from devnulling/master

Add API Field, update markerwithlabel.js source
pull/86/head
bistromath 8 years ago
commit e8c2a47278

@ -87,6 +87,8 @@ 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,6 +411,10 @@ 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:
@ -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

@ -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;
}
</style>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false">
<script type="text/javascript" src="http://maps.google.com/maps/api/js?key=%s">
</script>
<script type="text/javascript" src="http://google-maps-utility-library-v3.googlecode.com/svn/tags/markerwithlabel/1.1.9/src/markerwithlabel.js">
<script type="text/javascript" src="https://raw.githubusercontent.com/googlemaps/v3-utility-library/master/markerwithlabel/src/markerwithlabel.js">
</script>
<script type="text/javascript">
var map;
@ -152,4 +152,4 @@ def html_template(my_position, json_file):
<div id="map_canvas" style="width:100%%; height:100%%">
</div>
</body>
</html>""" % (my_position[0], my_position[1], json_file)
</html>""" % (my_apikey, my_position[0], my_position[1], json_file)

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>687</width>
<height>422</height>
<width>719</width>
<height>454</height>
</rect>
</property>
<property name="sizePolicy">
@ -102,8 +102,8 @@
<rect>
<x>10</x>
<y>20</y>
<width>236</width>
<height>251</height>
<width>241</width>
<height>281</height>
</rect>
</property>
<property name="title">
@ -307,7 +307,7 @@
<property name="geometry">
<rect>
<x>10</x>
<y>200</y>
<y>190</y>
<width>221</width>
<height>22</height>
</rect>
@ -320,7 +320,7 @@
<property name="geometry">
<rect>
<x>10</x>
<y>220</y>
<y>210</y>
<width>221</width>
<height>22</height>
</rect>
@ -329,6 +329,16 @@
<string>Use DC blocking filter</string>
</property>
</widget>
<widget class="QLineEdit" name="line_my_api_key">
<property name="geometry">
<rect>
<x>90</x>
<y>250</y>
<width>121</width>
<height>27</height>
</rect>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="group_output">
<property name="geometry">
@ -549,6 +559,19 @@
</property>
</widget>
</widget>
<widget class="QLabel" name="label_34">
<property name="geometry">
<rect>
<x>20</x>
<y>270</y>
<width>67</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>API Key</string>
</property>
</widget>
</widget>
<widget class="QWidget" name="dashboard">
<attribute name="title">
@ -1031,7 +1054,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>687</width>
<width>719</width>
<height>25</height>
</rect>
</property>

Loading…
Cancel
Save