Temp commit. Not yet working.
This commit is contained in:
parent
33349efd7f
commit
c2d0ca6051
@ -279,7 +279,7 @@ class mainwindow(QtGui.QMainWindow):
|
|||||||
my_position = None
|
my_position = None
|
||||||
|
|
||||||
self._cpr_dec = air_modes.cpr_decoder(my_position)
|
self._cpr_dec = air_modes.cpr_decoder(my_position)
|
||||||
self.datamodelout = dashboard_output(self._cpr_dec, self.datamodel, self._publisher)
|
# self.datamodelout = dashboard_output(self._cpr_dec, self.datamodel, self._publisher)
|
||||||
|
|
||||||
self.lock = threading.Lock() #grab a lock to ensure sql and kml don't step on each other
|
self.lock = threading.Lock() #grab a lock to ensure sql and kml don't step on each other
|
||||||
|
|
||||||
@ -313,7 +313,6 @@ class mainwindow(QtGui.QMainWindow):
|
|||||||
self.live_data_changed_signal.emit)
|
self.live_data_changed_signal.emit)
|
||||||
|
|
||||||
#create SQL database for KML and dashboard displays
|
#create SQL database for KML and dashboard displays
|
||||||
<<<<<<< HEAD
|
|
||||||
self.dbwriter = air_modes.output_sql(self._cpr_dec, self.dbname, self.lock, self._publisher)
|
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)
|
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_position, self._jsonfile.name)
|
||||||
@ -326,11 +325,6 @@ class mainwindow(QtGui.QMainWindow):
|
|||||||
self.ui.mapView.setPage(page)
|
self.ui.mapView.setPage(page)
|
||||||
self.ui.mapView.load( QtCore.QUrl( QtCore.QUrl.fromLocalFile("/tmp/mode_s.html") ) )
|
self.ui.mapView.load( QtCore.QUrl( QtCore.QUrl.fromLocalFile("/tmp/mode_s.html") ) )
|
||||||
self.ui.mapView.show()
|
self.ui.mapView.show()
|
||||||
=======
|
|
||||||
self.dbwriter = air_modes.output_sql(my_position, self.dbname, self.lock)
|
|
||||||
self.dbwriter.subscribe("new_adsb", self.datamodel.update_all)
|
|
||||||
self._relay.subscribe("dl_data", self.dbwriter.insert) #now the db will update itself
|
|
||||||
>>>>>>> GUI model ripped up and replaced with QSqlQueryModel. Not working but committing before I kill the child in row 15.
|
|
||||||
|
|
||||||
#output to update reports/sec widget
|
#output to update reports/sec widget
|
||||||
self._relay.subscribe("dl_data", self.increment_reportspersec)
|
self._relay.subscribe("dl_data", self.increment_reportspersec)
|
||||||
|
@ -55,6 +55,12 @@ class ICAOViewDelegate(QtGui.QStyledItemDelegate):
|
|||||||
painter.setPen(QtGui.QColor(0, 0, 0, alpha))
|
painter.setPen(QtGui.QColor(0, 0, 0, alpha))
|
||||||
painter.drawText(option.rect.left()+3, option.rect.top(), option.rect.width(), option.rect.height(), option.displayAlignment, paintstr)
|
painter.drawText(option.rect.left()+3, option.rect.top(), option.rect.width(), option.rect.height(), option.displayAlignment, paintstr)
|
||||||
|
|
||||||
|
#class dashboard_sql_model(QtCore.QAbstractTableModel):
|
||||||
|
# def __init__(self, parent):
|
||||||
|
# QtCore.QAbstractTableModel.__init__(self, parent)
|
||||||
|
|
||||||
|
# def update(self, icao):
|
||||||
|
|
||||||
#TODO must add libqt4-sql, libqt4-sql-sqlite, python-qt4-sql to dependencies
|
#TODO must add libqt4-sql, libqt4-sql-sqlite, python-qt4-sql to dependencies
|
||||||
#TODO looks like you're going to have to either integrate this into sql.py (ugh!) or find a way to keep it in sync
|
#TODO looks like you're going to have to either integrate this into sql.py (ugh!) or find a way to keep it in sync
|
||||||
#seems like it wants to have control over maintaining data currency
|
#seems like it wants to have control over maintaining data currency
|
||||||
@ -62,6 +68,13 @@ class ICAOViewDelegate(QtGui.QStyledItemDelegate):
|
|||||||
class dashboard_sql_model(QtSql.QSqlQueryModel):
|
class dashboard_sql_model(QtSql.QSqlQueryModel):
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
QtSql.QSqlQueryModel.__init__(self, parent)
|
QtSql.QSqlQueryModel.__init__(self, parent)
|
||||||
|
self._query = """select tab1.icao, tab1.seen, tab1.lat, tab1.lon, tab1.alt, speed, heading, vertical, ident, type
|
||||||
|
from (select * from (select * from positions order by seen desc) group by icao) tab1
|
||||||
|
left join (select * from (select * from vectors order by seen desc) group by icao) tab2
|
||||||
|
on tab1.icao=tab2.icao
|
||||||
|
left join (select * from (select * from ident)) tab3
|
||||||
|
on tab1.icao=tab3.icao
|
||||||
|
where tab1.seen > datetime('now', '-1 minute')"""
|
||||||
self._sql = None
|
self._sql = None
|
||||||
self._db = QtSql.QSqlDatabase("QSQLITE")
|
self._db = QtSql.QSqlDatabase("QSQLITE")
|
||||||
self._db.setDatabaseName("adsb.db") #TODO specify this elsewhere
|
self._db.setDatabaseName("adsb.db") #TODO specify this elsewhere
|
||||||
@ -69,16 +82,9 @@ class dashboard_sql_model(QtSql.QSqlQueryModel):
|
|||||||
#what is this i don't even
|
#what is this i don't even
|
||||||
#fetches the combined data of all three tables for all ICAOs seen in the last minute.
|
#fetches the combined data of all three tables for all ICAOs seen in the last minute.
|
||||||
#FIXME PyQt's SQLite gives you different results than the SQLite browser
|
#FIXME PyQt's SQLite gives you different results than the SQLite browser
|
||||||
self.setQuery("""select tab1.icao, tab1.seen, tab1.lat, tab1.lon, tab1.alt, speed, heading, vertical, ident, type
|
self.setQuery(self._query, self._db)
|
||||||
from (select * from (select * from positions order by seen desc) group by icao) tab1
|
|
||||||
left join (select * from (select * from vectors order by seen desc) group by icao) tab2
|
|
||||||
on tab1.icao=tab2.icao
|
|
||||||
left join (select * from (select * from ident)) tab3
|
|
||||||
on tab1.icao=tab3.icao
|
|
||||||
where tab1.seen > datetime('now', '-1 hour')""", self._db)
|
|
||||||
|
|
||||||
#the big club
|
#the big club
|
||||||
def update_all(self, icao):
|
def update_all(self, icao):
|
||||||
# self.beginInsertRows(QtCore.QModelIndex(), 1, 1)
|
self.setQuery(self._query, self._db)
|
||||||
self.dataChanged.emit(self.createIndex(0, 0), self.createIndex(self.rowCount(), self.columnCount()))
|
#self.dataChanged.emit(self.createIndex(0, 0), self.createIndex(self.rowCount(), self.columnCount()))
|
||||||
# self.endInsertRows()
|
|
||||||
|
Loading…
Reference in New Issue
Block a user