Added counter to gps_tool
This commit is contained in:
@ -16,19 +16,20 @@ class ConfigurationFile():
|
|||||||
(base, ext) = os.path.splitext(os.path.basename(app_path))
|
(base, ext) = os.path.splitext(os.path.basename(app_path))
|
||||||
self.app_name = base
|
self.app_name = base
|
||||||
self.cfg_file = self.app_name + ".yaml"
|
self.cfg_file = self.app_name + ".yaml"
|
||||||
self.use_path = ""
|
self.use_path = self.cfg_file
|
||||||
self.config = []
|
self.config = []
|
||||||
|
self.paths = []
|
||||||
|
self.paths.append(".") # local first
|
||||||
|
# grab from env
|
||||||
|
self.paths.append(self.cfg_path) # program location
|
||||||
|
|
||||||
def find_config(self):
|
def find_config(self):
|
||||||
# local first
|
for path in self.paths:
|
||||||
if os.path.isfile(self.cfg_file):
|
cfg = path + "/" + self.cfg_file
|
||||||
self.use_path = self.cfg_file
|
if os.path.isfile(cfg):
|
||||||
return 1
|
self.use_path = cfg
|
||||||
elif os.path.isfile(self.cfg_path + "/" + self.cfg_file):
|
return 1
|
||||||
self.use_path = self.cfg_path + "/" + self.cfg_file
|
print("Config file not found:", self.cfg_file)
|
||||||
return 1
|
|
||||||
else:
|
|
||||||
print("Config file not found:", self.cfg_file)
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
def read_config(self):
|
def read_config(self):
|
||||||
@ -42,7 +43,15 @@ class ConfigurationFile():
|
|||||||
return self.config
|
return self.config
|
||||||
|
|
||||||
def write_config(self, config):
|
def write_config(self, config):
|
||||||
|
self.config = config
|
||||||
with open(self.use_path, 'w') as f:
|
with open(self.use_path, 'w') as f:
|
||||||
f.write(yaml.dump(config))
|
f.write(yaml.dump(config))
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
def get_config(self, name):
|
||||||
|
if name in self.config:
|
||||||
|
return self.config[name]
|
||||||
|
return ""
|
||||||
|
|
||||||
|
def set_config(self, name, val):
|
||||||
|
self.config[name] = val
|
||||||
|
|||||||
@ -143,6 +143,11 @@ class Ui_MainWindow(object):
|
|||||||
font1.setBold(True)
|
font1.setBold(True)
|
||||||
font1.setWeight(75)
|
font1.setWeight(75)
|
||||||
self.label_14.setFont(font1)
|
self.label_14.setFont(font1)
|
||||||
|
self.txtCount = QLabel(self.centralwidget)
|
||||||
|
self.txtCount.setObjectName(u"txtCount")
|
||||||
|
self.txtCount.setGeometry(QRect(150, 10, 61, 16))
|
||||||
|
self.txtCount.setFrameShape(QFrame.Panel)
|
||||||
|
self.txtCount.setFrameShadow(QFrame.Sunken)
|
||||||
MainWindow.setCentralWidget(self.centralwidget)
|
MainWindow.setCentralWidget(self.centralwidget)
|
||||||
self.menubar = QMenuBar(MainWindow)
|
self.menubar = QMenuBar(MainWindow)
|
||||||
self.menubar.setObjectName(u"menubar")
|
self.menubar.setObjectName(u"menubar")
|
||||||
@ -186,5 +191,6 @@ class Ui_MainWindow(object):
|
|||||||
self.toggleLogging.setText(QCoreApplication.translate("MainWindow", u"Start", None))
|
self.toggleLogging.setText(QCoreApplication.translate("MainWindow", u"Start", None))
|
||||||
self.label_12.setText(QCoreApplication.translate("MainWindow", u"GPX Data Logging:", None))
|
self.label_12.setText(QCoreApplication.translate("MainWindow", u"GPX Data Logging:", None))
|
||||||
self.label_14.setText(QCoreApplication.translate("MainWindow", u"GPS Tool (gpsd client)", None))
|
self.label_14.setText(QCoreApplication.translate("MainWindow", u"GPS Tool (gpsd client)", None))
|
||||||
|
self.txtCount.setText(QCoreApplication.translate("MainWindow", u"0", None))
|
||||||
# retranslateUi
|
# retranslateUi
|
||||||
|
|
||||||
|
|||||||
@ -101,6 +101,7 @@ class QtGPSWindow(MainWindow):
|
|||||||
|
|
||||||
self.log_enabled = 0
|
self.log_enabled = 0
|
||||||
self.dirname = "."
|
self.dirname = "."
|
||||||
|
self.num_count = 0
|
||||||
self.num_points = 0
|
self.num_points = 0
|
||||||
|
|
||||||
self.my_thread = DataThread()
|
self.my_thread = DataThread()
|
||||||
@ -150,6 +151,8 @@ class QtGPSWindow(MainWindow):
|
|||||||
point.time = datetime.now()
|
point.time = datetime.now()
|
||||||
self.gpx_segment.points.append(point)
|
self.gpx_segment.points.append(point)
|
||||||
self.num_points += 1
|
self.num_points += 1
|
||||||
|
self.num_count += 1
|
||||||
|
self.txtCount.setText(str(self.num_count))
|
||||||
|
|
||||||
elif report['class'] == 'SKY':
|
elif report['class'] == 'SKY':
|
||||||
self.txtHDOP.setText(str(getattr(report, 'hdop', 0.0)))
|
self.txtHDOP.setText(str(getattr(report, 'hdop', 0.0)))
|
||||||
|
|||||||
@ -481,6 +481,28 @@
|
|||||||
<string>GPS Tool (gpsd client)</string>
|
<string>GPS Tool (gpsd client)</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QLabel" name="txtCount">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>150</x>
|
||||||
|
<y>10</y>
|
||||||
|
<width>61</width>
|
||||||
|
<height>16</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::Panel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Sunken</enum>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>0</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenuBar" name="menubar">
|
<widget class="QMenuBar" name="menubar">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
|
|||||||
Reference in New Issue
Block a user