From 372e92527754ed8f993903c9c439a529a47becef Mon Sep 17 00:00:00 2001 From: Nick Foster Date: Sat, 14 Jul 2012 15:43:09 -0700 Subject: [PATCH] Well, the ICAO lineedit works in hex now, but I don't like the way it went in. --- apps/modes_gui | 13 ++++++--- res/modes_rx.ui | 75 +++++++++++++++++++++++++++++++++++++++---------- 2 files changed, 69 insertions(+), 19 deletions(-) diff --git a/apps/modes_gui b/apps/modes_gui index 70a3c21..5c2095e 100755 --- a/apps/modes_gui +++ b/apps/modes_gui @@ -70,12 +70,13 @@ class mainwindow(QtGui.QMainWindow): self.ui.list_aircraft.setItemDelegate(self.icaodelegate) self.dashboard_mapper = QtGui.QDataWidgetMapper() self.dashboard_mapper.setModel(self.datamodel) + self.dashboard_mapper.addMapping(self.ui.line_icao, 0) #self.dashboard_mapper.addMapping(self.ui.prog_rssi, 2) self.dashboard_mapper.addMapping(self.ui.line_latitude, 3) self.dashboard_mapper.addMapping(self.ui.line_longitude, 4) self.dashboard_mapper.addMapping(self.ui.line_alt, 5) self.dashboard_mapper.addMapping(self.ui.line_speed, 6) - #self.dashboard_mapper.addMapping(self.ui.compass_heading, 7) + self.dashboard_mapper.addMapping(self.ui.compass_heading, 7) self.dashboard_mapper.addMapping(self.ui.line_climb, 8) self.dashboard_mapper.addMapping(self.ui.line_ident, 9) self.dashboard_mapper.addMapping(self.ui.line_type, 10) @@ -89,7 +90,7 @@ class mainwindow(QtGui.QMainWindow): #hook up the update signal self.ui.list_aircraft.selectionModel().currentRowChanged.connect(self.dashboard_mapper.setCurrentModelIndex) - self.ui.list_aircraft.selectionModel().currentRowChanged.connect(self.update_heading_widget) + #self.ui.list_aircraft.selectionModel().currentRowChanged.connect(self.update_heading_widget) self.ui.list_aircraft.selectionModel().currentRowChanged.connect(self.update_rssi_widget) def update_heading_widget(self, index): @@ -219,6 +220,7 @@ class mainwindow(QtGui.QMainWindow): self.livedata = air_modes.modes_output_print(my_position) #add output for live data box + #TODO: this doesn't handle large volumes of data well; i get segfaults. #self.outputs.append(self.output_live_data) #create SQL database for KML and dashboard displays @@ -243,7 +245,7 @@ class ICAOViewDelegate(QtGui.QStyledItemDelegate): if index.model().data(index.model().index(index.row(), 9)) != QtCore.QVariant(): paintstr = index.model().data(index.model().index(index.row(), 9)).toString() else: - paintstr = "%06x" % index.model().data(index.model().index(index.row(), 0)).toInt()[0] + paintstr = index.model().data(index.model().index(index.row(), 0)).toString() last_report = index.model().data(index.model().index(index.row(), 1)).toDouble()[0] age = (time.time() - last_report) max_age = 60. #age at which it grays out @@ -285,7 +287,10 @@ class dashboard_data_model(QtCore.QAbstractTableModel): if self._precisions[index.column()] is not None: return QtCore.QVariant("%.*f" % (self._precisions[index.column()], self._data[index.row()][index.column()])) else: - return QtCore.QVariant(self._data[index.row()][index.column()]) + if self._colnames[index.column()] == "icao": + return QtCore.QVariant("%06x" % self._data[index.row()][index.column()]) #return as hex string + else: + return QtCore.QVariant(self._data[index.row()][index.column()]) def setData(self, index, value, role=QtCore.Qt.EditRole): self.lock.acquire() diff --git a/res/modes_rx.ui b/res/modes_rx.ui index aa8e2c9..30a57de 100644 --- a/res/modes_rx.ui +++ b/res/modes_rx.ui @@ -478,7 +478,7 @@ 480 - 30 + 60 21 17 @@ -491,7 +491,7 @@ 480 - 60 + 90 21 17 @@ -530,7 +530,7 @@ 120 - 150 + 240 118 23 @@ -546,7 +546,7 @@ 10 - 150 + 240 101 17 @@ -572,7 +572,7 @@ 360 - 30 + 60 51 20 @@ -585,7 +585,7 @@ 350 - 60 + 90 61 20 @@ -598,7 +598,7 @@ 370 - 120 + 150 51 20 @@ -624,7 +624,7 @@ 410 - 30 + 60 71 27 @@ -637,7 +637,7 @@ 410 - 60 + 90 71 27 @@ -650,7 +650,7 @@ 410 - 120 + 150 71 27 @@ -663,7 +663,7 @@ 410 - 150 + 180 121 27 @@ -676,7 +676,7 @@ 370 - 150 + 180 51 20 @@ -741,7 +741,7 @@ 410 - 90 + 120 71 27 @@ -754,7 +754,7 @@ 480 - 90 + 120 31 17 @@ -767,7 +767,7 @@ 370 - 90 + 120 41 20 @@ -792,6 +792,51 @@ 4 + + + + 370 + 30 + 51 + 20 + + + + ICAO + + + + + + 410 + 30 + 71 + 27 + + + + + + + true + + + + + + -20 + 30 + 161 + 91 + + + + true + + + 4 + +