New feature: reports per second widget. Lets you know you're actively receiving things.
This commit is contained in:
@@ -58,6 +58,8 @@ class mainwindow(QtGui.QMainWindow):
|
||||
self.kmlgen = None #necessary bc we stop its thread in shutdown
|
||||
self.dbinput = None
|
||||
self.dbname = "air_modes.db"
|
||||
self.num_reports = 0
|
||||
self.last_report = 0
|
||||
|
||||
self.datamodel = dashboard_data_model(None)
|
||||
self.ui.list_aircraft.setModel(self.datamodel)
|
||||
@@ -107,6 +109,16 @@ class mainwindow(QtGui.QMainWindow):
|
||||
bearing = index.model().data(index.model().index(index.row(), self.datamodel._colnames.index("bearing"))).toDouble()[0]
|
||||
self.ui.compass_bearing.setValue(bearing)
|
||||
|
||||
def increment_reportspersec(self, msg):
|
||||
self.num_reports += 1
|
||||
|
||||
def update_reportspersec(self):
|
||||
dt = time.time() - self.last_report
|
||||
if dt >= 1.0:
|
||||
self.last_report = time.time()
|
||||
self.ui.line_reports.setText("%i" % self.num_reports)
|
||||
self.num_reports = 0
|
||||
|
||||
def compass_widgets_dataChanged(self, startIndex, endIndex):
|
||||
index = self.ui.list_aircraft.selectionModel().currentIndex()
|
||||
if index.row() in range(startIndex.row(), endIndex.row()+1): #the current aircraft was affected
|
||||
@@ -191,6 +203,9 @@ class mainwindow(QtGui.QMainWindow):
|
||||
if self.dbinput is not None: self.dbinput.close()
|
||||
self.dbinput = None
|
||||
|
||||
self.num_reports = 0
|
||||
self.ui.line_reports.setText("0")
|
||||
|
||||
self.ui.button_start.setText("Start")
|
||||
|
||||
else: #we aren't already running, let's get this party started
|
||||
@@ -246,6 +261,10 @@ class mainwindow(QtGui.QMainWindow):
|
||||
self.dbwriter = air_modes.modes_output_sql(my_position, self.dbname)
|
||||
self.outputs.append(self.dbwriter.output) #now the db will update itself
|
||||
|
||||
#output to update reports/sec widget
|
||||
self.outputs.append(self.increment_reportspersec)
|
||||
self.updates.append(self.update_reportspersec)
|
||||
|
||||
#create output handler thread
|
||||
self.output_handler = output_handler(self.outputs, self.updates, self.queue)
|
||||
|
||||
|
||||
+32
-1
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>686</width>
|
||||
<height>413</height>
|
||||
<height>449</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -917,6 +917,37 @@
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="line_reports">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>630</x>
|
||||
<y>370</y>
|
||||
<width>41</width>
|
||||
<height>27</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_33">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>515</x>
|
||||
<y>370</y>
|
||||
<width>111</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Reports/second</string>
|
||||
</property>
|
||||
</widget>
|
||||
<zorder>tab_dataview</zorder>
|
||||
<zorder>label_14</zorder>
|
||||
<zorder>button_start</zorder>
|
||||
<zorder>check_adsbonly</zorder>
|
||||
<zorder>list_aircraft</zorder>
|
||||
<zorder>lineEdit</zorder>
|
||||
<zorder>line_reports</zorder>
|
||||
<zorder>label_33</zorder>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menubar">
|
||||
<property name="geometry">
|
||||
|
||||
Reference in New Issue
Block a user