Commit 7c70e970 authored by Pedro Henrique Kopper's avatar Pedro Henrique Kopper

Rewrite GUI

parent 272fd36c
# Este arquivo define a interface a ser utilizada
device:
type: instrument-interface
type: mock
location: "/dev/ttyUSB0"
channels:
- id: 0
......
This diff is collapsed.
from time import sleep
from PyQt5.QtCore import QThread
from pyqtgraph import AxisItem, InfiniteLine, mkColor, mkPen
from pyqtgraph import AxisItem, InfiniteLine, mkColor, mkPen, setConfigOption
from interfaces import *
from config import Config
......@@ -24,6 +24,8 @@ class Graph(QThread):
except FileNotFoundError:
self.running = False
graph.setBackground((240, 240, 240))
def run(self):
while self.running:
data = self.interface.readAll()
......@@ -65,4 +67,4 @@ class Graph(QThread):
else:
pltItem.setLabel("right", text=channel["name"], units=channel["unit"])
pltItem.setLabel("bottom", text="Tempo", units="s")
\ No newline at end of file
pltItem.setLabel("bottom", text="Tempo", units="s")
......@@ -22,10 +22,10 @@ class MainThread(QThread):
def run(self):
self.ui.samplingCBox.currentIndexChanged.connect(self._updateSamplingRate)
self.ui.startTimerButton.pressed.connect(self._startTimer)
self.ui.stopTimerButton.pressed.connect(self._stopTimer)
self.ui.startRegTimerButton.pressed.connect(self._startTimer)
self.ui.stopRegTimerButton.pressed.connect(self._stopTimer)
#self.ui.startTimerButton.pressed.connect(self._startTimer)
#self.ui.stopTimerButton.pressed.connect(self._stopTimer)
#self.ui.startRegTimerButton.pressed.connect(self._startTimer)
#self.ui.stopRegTimerButton.pressed.connect(self._stopTimer)
self.graph.start()
while True:
......@@ -52,9 +52,9 @@ class MainThread(QThread):
self.upTimer.update()
if self.downTimer.active:
self.downTimer.update()
self.ui.currentTimeLabel.setText(datetime.now().strftime("%H:%M:%S"))
self.ui.timerLabel.setText(self.upTimer.getTimeString())
self.ui.regTimerLabel.setText(self.downTimer.getTimeString())
#self.ui.currentTimeLabel.setText(datetime.now().strftime("%H:%M:%S"))
#self.ui.timerLabel.setText(self.upTimer.getTimeString())
#self.ui.regTimerLabel.setText(self.downTimer.getTimeString())
def _startTimer(self):
btn = self.sender()
......@@ -74,4 +74,4 @@ class MainThread(QThread):
self.upTimer.clear()
else:
self.downTimer.stop()
self.downTimer.clear()
\ No newline at end of file
self.downTimer.clear()
This diff is collapsed.
import sys
from PyQt5 import QtWidgets
from PyQt5 import QtWidgets, QtCore
from ui.CalibracaoPressaoW import Ui_CalibracaoPressaoW
from threads.MainThread import MainThread
class Ui_MainWindow(object):
def __init__(self):
# Faz o app funcionar em telas burguesas safadas com DPI alto
QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling, True)
self.app = QtWidgets.QApplication(sys.argv)
self.dialog = QtWidgets.QMainWindow()
......@@ -13,8 +15,9 @@ class Ui_MainWindow(object):
self.ui = Ui_CalibracaoPressaoW()
self.ui.setupUi(self.dialog)
print(self.ui)
main_thread = MainThread(self.ui)
main_thread.finished.connect(self.app.exit)
main_thread.start()
self.dialog.showMaximized()
\ No newline at end of file
self.dialog.showMaximized()
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