diff --git a/classes/utils/configs.py b/classes/utils/configs.py index f2764bf..56ce785 100644 --- a/classes/utils/configs.py +++ b/classes/utils/configs.py @@ -16,19 +16,20 @@ class ConfigurationFile(): (base, ext) = os.path.splitext(os.path.basename(app_path)) self.app_name = base self.cfg_file = self.app_name + ".yaml" - self.use_path = "" + self.use_path = self.cfg_file self.config = [] + self.paths = [] + self.paths.append(".") # local first + # grab from env + self.paths.append(self.cfg_path) # program location def find_config(self): - # local first - if os.path.isfile(self.cfg_file): - self.use_path = self.cfg_file - return 1 - elif os.path.isfile(self.cfg_path + "/" + self.cfg_file): - self.use_path = self.cfg_path + "/" + self.cfg_file - return 1 - else: - print("Config file not found:", self.cfg_file) + for path in self.paths: + cfg = path + "/" + self.cfg_file + if os.path.isfile(cfg): + self.use_path = cfg + return 1 + print("Config file not found:", self.cfg_file) return 0 def read_config(self): @@ -42,7 +43,15 @@ class ConfigurationFile(): return self.config def write_config(self, config): + self.config = config with open(self.use_path, 'w') as f: f.write(yaml.dump(config)) f.close() - \ No newline at end of file + + 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 diff --git a/gps_tool/MainWindow.py b/gps_tool/MainWindow.py index e65ae7f..b3d01bf 100644 --- a/gps_tool/MainWindow.py +++ b/gps_tool/MainWindow.py @@ -143,6 +143,11 @@ class Ui_MainWindow(object): font1.setBold(True) font1.setWeight(75) 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) self.menubar = QMenuBar(MainWindow) self.menubar.setObjectName(u"menubar") @@ -186,5 +191,6 @@ class Ui_MainWindow(object): self.toggleLogging.setText(QCoreApplication.translate("MainWindow", u"Start", 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.txtCount.setText(QCoreApplication.translate("MainWindow", u"0", None)) # retranslateUi diff --git a/gps_tool/gps_tool.py b/gps_tool/gps_tool.py index 1a18577..6c6bd55 100755 --- a/gps_tool/gps_tool.py +++ b/gps_tool/gps_tool.py @@ -101,6 +101,7 @@ class QtGPSWindow(MainWindow): self.log_enabled = 0 self.dirname = "." + self.num_count = 0 self.num_points = 0 self.my_thread = DataThread() @@ -150,6 +151,8 @@ class QtGPSWindow(MainWindow): point.time = datetime.now() self.gpx_segment.points.append(point) self.num_points += 1 + self.num_count += 1 + self.txtCount.setText(str(self.num_count)) elif report['class'] == 'SKY': self.txtHDOP.setText(str(getattr(report, 'hdop', 0.0))) diff --git a/gps_tool/mainwindow.ui b/gps_tool/mainwindow.ui index c1742fb..3a6110d 100644 --- a/gps_tool/mainwindow.ui +++ b/gps_tool/mainwindow.ui @@ -481,6 +481,28 @@ GPS Tool (gpsd client) + + + + 150 + 10 + 61 + 16 + + + + QFrame::Panel + + + QFrame::Sunken + + + 0 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + +