Well, the ICAO lineedit works in hex now, but I don't like the way it went in.

This commit is contained in:
Nick Foster
2012-07-14 15:43:09 -07:00
parent 20dd8457ea
commit 372e925277
2 changed files with 69 additions and 19 deletions

View File

@@ -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()

View File

@@ -478,7 +478,7 @@
<property name="geometry">
<rect>
<x>480</x>
<y>30</y>
<y>60</y>
<width>21</width>
<height>17</height>
</rect>
@@ -491,7 +491,7 @@
<property name="geometry">
<rect>
<x>480</x>
<y>60</y>
<y>90</y>
<width>21</width>
<height>17</height>
</rect>
@@ -530,7 +530,7 @@
<property name="geometry">
<rect>
<x>120</x>
<y>150</y>
<y>240</y>
<width>118</width>
<height>23</height>
</rect>
@@ -546,7 +546,7 @@
<property name="geometry">
<rect>
<x>10</x>
<y>150</y>
<y>240</y>
<width>101</width>
<height>17</height>
</rect>
@@ -572,7 +572,7 @@
<property name="geometry">
<rect>
<x>360</x>
<y>30</y>
<y>60</y>
<width>51</width>
<height>20</height>
</rect>
@@ -585,7 +585,7 @@
<property name="geometry">
<rect>
<x>350</x>
<y>60</y>
<y>90</y>
<width>61</width>
<height>20</height>
</rect>
@@ -598,7 +598,7 @@
<property name="geometry">
<rect>
<x>370</x>
<y>120</y>
<y>150</y>
<width>51</width>
<height>20</height>
</rect>
@@ -624,7 +624,7 @@
<property name="geometry">
<rect>
<x>410</x>
<y>30</y>
<y>60</y>
<width>71</width>
<height>27</height>
</rect>
@@ -637,7 +637,7 @@
<property name="geometry">
<rect>
<x>410</x>
<y>60</y>
<y>90</y>
<width>71</width>
<height>27</height>
</rect>
@@ -650,7 +650,7 @@
<property name="geometry">
<rect>
<x>410</x>
<y>120</y>
<y>150</y>
<width>71</width>
<height>27</height>
</rect>
@@ -663,7 +663,7 @@
<property name="geometry">
<rect>
<x>410</x>
<y>150</y>
<y>180</y>
<width>121</width>
<height>27</height>
</rect>
@@ -676,7 +676,7 @@
<property name="geometry">
<rect>
<x>370</x>
<y>150</y>
<y>180</y>
<width>51</width>
<height>20</height>
</rect>
@@ -741,7 +741,7 @@
<property name="geometry">
<rect>
<x>410</x>
<y>90</y>
<y>120</y>
<width>71</width>
<height>27</height>
</rect>
@@ -754,7 +754,7 @@
<property name="geometry">
<rect>
<x>480</x>
<y>90</y>
<y>120</y>
<width>31</width>
<height>17</height>
</rect>
@@ -767,7 +767,7 @@
<property name="geometry">
<rect>
<x>370</x>
<y>90</y>
<y>120</y>
<width>41</width>
<height>20</height>
</rect>
@@ -792,6 +792,51 @@
<number>4</number>
</property>
</widget>
<widget class="QLabel" name="label_32">
<property name="geometry">
<rect>
<x>370</x>
<y>30</y>
<width>51</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>ICAO</string>
</property>
</widget>
<widget class="QLineEdit" name="line_icao">
<property name="geometry">
<rect>
<x>410</x>
<y>30</y>
<width>71</width>
<height>27</height>
</rect>
</property>
<property name="text">
<string/>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
<widget class="QwtCompass" name="compass_bearing">
<property name="geometry">
<rect>
<x>-20</x>
<y>30</y>
<width>161</width>
<height>91</height>
</rect>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="lineWidth">
<number>4</number>
</property>
</widget>
</widget>
<widget class="QWidget" name="browsertab">
<attribute name="title">