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 time import sleep
from PyQt5.QtCore import QThread from PyQt5.QtCore import QThread
from pyqtgraph import AxisItem, mkColor, mkPen from pyqtgraph import AxisItem, InfiniteLine, mkColor, mkPen
from interfaces import * from interfaces import *
from config import Config from config import Config
...@@ -40,6 +40,10 @@ class Graph(QThread): ...@@ -40,6 +40,10 @@ class Graph(QThread):
def stop(self): 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): def _configurePlots(self):
first = True first = True
pltItem = self.graph.getPlotItem() pltItem = self.graph.getPlotItem()
......
...@@ -60,11 +60,13 @@ class MainThread(QThread): ...@@ -60,11 +60,13 @@ class MainThread(QThread):
btn = self.sender() btn = self.sender()
timer = self.upTimer if btn == self.ui.startTimerButton else self.downTimer timer = self.upTimer if btn == self.ui.startTimerButton else self.downTimer
if btn.text() == "Iniciar": if btn.text() == "Iniciar":
self.ui.startTimeLabel.setText(datetime.now().strftime("%H:%M:%S"))
btn.setText("Parar") btn.setText("Parar")
timer.start() timer.start()
else: else:
btn.setText("Iniciar") btn.setText("Iniciar")
timer.stop() timer.stop()
self.graph.addMarker(datetime.now().strftime("%H:%M:%S"))
def _stopTimer(self): def _stopTimer(self):
if self.sender == self.ui.stopTimerButton: 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