diff --git a/apps/modes_gui b/apps/modes_gui
index 5183070..450edf6 100755
--- a/apps/modes_gui
+++ b/apps/modes_gui
@@ -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)
diff --git a/res/modes_rx.ui b/res/modes_rx.ui
index 30a57de..161b3e9 100644
--- a/res/modes_rx.ui
+++ b/res/modes_rx.ui
@@ -7,7 +7,7 @@
0
0
686
- 413
+ 449
@@ -917,6 +917,37 @@
true
+
+
+
+ 630
+ 370
+ 41
+ 27
+
+
+
+
+
+
+ 515
+ 370
+ 111
+ 20
+
+
+
+ Reports/second
+
+
+ tab_dataview
+ label_14
+ button_start
+ check_adsbonly
+ list_aircraft
+ lineEdit
+ line_reports
+ label_33