Commit f9982b09 authored by Pedro Henrique Kopper's avatar Pedro Henrique Kopper
Browse files

Fatals on interface not found, dinamically finds home dir

parent cb8aa8ee
from datetime import datetime
from pathlib import Path
from PyQt5.QtCore import QTimer
from pyqtgraph import AxisItem, InfiniteLine, mkColor, mkPen, setConfigOption
from interfaces import *
......@@ -20,8 +21,9 @@ class Graph():
self.device = self.config["device"]
today = datetime.now().strftime("%Y-%m-%d-%H:%M:%S")
self.logFile = open("/home/phckopper/logs/{}-calib.csv".format(today), "w")
logger("[LOGS]", "Salvando dados em: /home/phckopper/logs/{}-calib.csv".format(today))
home = str(Path.home())
self.logFile = open("{}/logs/{}-calib.csv".format(home, today), "w")
logger("[LOGS]", "Salvando dados em: {}/logs/{}-calib.csv".format(home, today))
self._configurePlots()
self.lastupdated = 0
......@@ -29,8 +31,9 @@ class Graph():
try:
self.interface = INTERFACES[self.device["type"]](logger, self.device["location"], self.device["channels"])
except FileNotFoundError:
except:
self.running = False
logger("[FATAL", "Erro ao abrir a interface!")
self.graph.setBackground((240, 240, 240))
......
......@@ -53,6 +53,8 @@ class MainThread():
def _log(self, tag, msg):
self.ui.consoleView.setText("{} {}\n{}".format(tag, msg, self.ui.consoleView.text()))
if "FATAL" in tag:
_fatal(msg)
def _playPause(self):
if self.graph.running:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment