Commit 272fd36c authored by Pedro Henrique Kopper's avatar Pedro Henrique Kopper

Interface now adds markers to graph when starting/pausing a timer

parent 9f35a9a4
from time import sleep
from PyQt5.QtCore import QThread
from pyqtgraph import AxisItem, mkColor, mkPen
from pyqtgraph import AxisItem, InfiniteLine, mkColor, mkPen
from interfaces import *
from config import Config
......@@ -38,7 +38,11 @@ class Graph(QThread):
self.interval = interval/1000.0
def stop(self):
self.running = False
self.running = False
def addMarker(self, label):
marker = InfiniteLine(angle=90, pos=self.dataX[0][-1], label=label)
self.graph.getPlotItem().addItem(marker)
def _configurePlots(self):
first = True
......
......@@ -60,11 +60,13 @@ class MainThread(QThread):
btn = self.sender()
timer = self.upTimer if btn == self.ui.startTimerButton else self.downTimer
if btn.text() == "Iniciar":
self.ui.startTimeLabel.setText(datetime.now().strftime("%H:%M:%S"))
btn.setText("Parar")
timer.start()
else:
btn.setText("Iniciar")
timer.stop()
self.graph.addMarker(datetime.now().strftime("%H:%M:%S"))
def _stopTimer(self):
if self.sender == self.ui.stopTimerButton:
......
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