Added in speed/vs fetching. Need to figure out your datamodel.
This commit is contained in:
parent
8439e0e5f3
commit
f2f344538a
@ -195,14 +195,47 @@ class mainwindow(QtGui.QMainWindow):
|
||||
self.ui.text_livedata.append(msgstr)
|
||||
self.ui.text_livedata.verticalScrollBar().setSliderPosition(self.ui.text_livedata.verticalScrollBar().maximum())
|
||||
|
||||
#refresh dashboard display with info from clicked aircraft.
|
||||
#this can either be on-click (hence the name for auto slot) or
|
||||
#due to a database update.
|
||||
def on_list_aircraft_clicked(self, index):
|
||||
icao = long(str(index.data().toString()), 16)
|
||||
#ok now let's fetch the info for this icao and update the display
|
||||
print icao
|
||||
self.db = sqlite3.connect(self.dbname)
|
||||
|
||||
#get ident
|
||||
q = "select ident from ident where icao=%i" % icao
|
||||
cursor = self.db.cursor()
|
||||
cursor.execute(q)
|
||||
ident = cursor.fetchall()
|
||||
self.ui.line_ident.clear()
|
||||
if len(ident) > 0:
|
||||
self.ui.line_ident.insert(ident[-1][0])
|
||||
|
||||
#get vector info
|
||||
q = "select seen, speed, heading, vertical from vectors where icao=%i order by seen desc limit 1" % icao
|
||||
cursor.execute(q)
|
||||
r = cursor.fetchall()
|
||||
speed = "-"
|
||||
vs = "-"
|
||||
heading = 0
|
||||
seen = time.time()
|
||||
if len(r) != 0:
|
||||
seen = r[0][0]
|
||||
speed = "%i" % r[0][1]
|
||||
heading = r[0][2]
|
||||
vs = "%i" % r[0][3]
|
||||
|
||||
self.ui.line_speed.clear()
|
||||
self.ui.line_climb.clear()
|
||||
self.ui.line_speed.insert(speed)
|
||||
self.ui.line_climb.insert(vs)
|
||||
|
||||
#eventually: set up a QTimer or whatever and have it self-update and emit dataChanged()
|
||||
#better yet just have the SQL interface yell and say hey that line changed.
|
||||
#on selected aircraft or on update for visible aircraft, emit signal to update current dashboard display.
|
||||
#maybe the datamodel should be responsible for inserting data into the SQL db as well, making this the
|
||||
#main interface. this could subclass modes_sql for insert functionality. then you get the ability to
|
||||
#invalidate on update.
|
||||
class modes_datamodel(QtCore.QAbstractListModel):
|
||||
def __init__(self, dbname):
|
||||
QtCore.QAbstractListModel.__init__(self)
|
||||
@ -222,6 +255,7 @@ class modes_datamodel(QtCore.QAbstractListModel):
|
||||
if role != QtCore.Qt.DisplayRole:
|
||||
return QtCore.QVariant()
|
||||
|
||||
#TODO eventually find a way to populate the ICAOs with fading according to age
|
||||
icaoquery = "select distinct icao from positions order by icao"
|
||||
cursor = self.db.cursor()
|
||||
cursor.execute(icaoquery)
|
||||
|
@ -24,7 +24,7 @@
|
||||
</rect>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="title">
|
||||
@ -602,7 +602,7 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>370</x>
|
||||
<y>90</y>
|
||||
<y>120</y>
|
||||
<width>51</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
@ -654,7 +654,7 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>410</x>
|
||||
<y>90</y>
|
||||
<y>120</y>
|
||||
<width>71</width>
|
||||
<height>27</height>
|
||||
</rect>
|
||||
@ -667,7 +667,7 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>410</x>
|
||||
<y>120</y>
|
||||
<y>150</y>
|
||||
<width>121</width>
|
||||
<height>27</height>
|
||||
</rect>
|
||||
@ -680,7 +680,7 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>370</x>
|
||||
<y>120</y>
|
||||
<y>150</y>
|
||||
<width>51</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
@ -741,6 +741,45 @@
|
||||
<string>Longitude</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="line_climb">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>410</x>
|
||||
<y>90</y>
|
||||
<width>71</width>
|
||||
<height>27</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_30">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>480</x>
|
||||
<y>90</y>
|
||||
<width>31</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>ft/s</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_31">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>370</x>
|
||||
<y>90</y>
|
||||
<width>41</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Climb</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="browsertab">
|
||||
<attribute name="title">
|
||||
|
Loading…
Reference in New Issue
Block a user