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

Rewrite GUI

parent 272fd36c
# Este arquivo define a interface a ser utilizada # Este arquivo define a interface a ser utilizada
device: device:
type: instrument-interface type: mock
location: "/dev/ttyUSB0" location: "/dev/ttyUSB0"
channels: channels:
- id: 0 - id: 0
......
This diff is collapsed.
from time import sleep from time import sleep
from PyQt5.QtCore import QThread from PyQt5.QtCore import QThread
from pyqtgraph import AxisItem, InfiniteLine, mkColor, mkPen from pyqtgraph import AxisItem, InfiniteLine, mkColor, mkPen, setConfigOption
from interfaces import * from interfaces import *
from config import Config from config import Config
...@@ -24,6 +24,8 @@ class Graph(QThread): ...@@ -24,6 +24,8 @@ class Graph(QThread):
except FileNotFoundError: except FileNotFoundError:
self.running = False self.running = False
graph.setBackground((240, 240, 240))
def run(self): def run(self):
while self.running: while self.running:
data = self.interface.readAll() data = self.interface.readAll()
......
...@@ -22,10 +22,10 @@ class MainThread(QThread): ...@@ -22,10 +22,10 @@ class MainThread(QThread):
def run(self): def run(self):
self.ui.samplingCBox.currentIndexChanged.connect(self._updateSamplingRate) self.ui.samplingCBox.currentIndexChanged.connect(self._updateSamplingRate)
self.ui.startTimerButton.pressed.connect(self._startTimer) #self.ui.startTimerButton.pressed.connect(self._startTimer)
self.ui.stopTimerButton.pressed.connect(self._stopTimer) #self.ui.stopTimerButton.pressed.connect(self._stopTimer)
self.ui.startRegTimerButton.pressed.connect(self._startTimer) #self.ui.startRegTimerButton.pressed.connect(self._startTimer)
self.ui.stopRegTimerButton.pressed.connect(self._stopTimer) #self.ui.stopRegTimerButton.pressed.connect(self._stopTimer)
self.graph.start() self.graph.start()
while True: while True:
...@@ -52,9 +52,9 @@ class MainThread(QThread): ...@@ -52,9 +52,9 @@ class MainThread(QThread):
self.upTimer.update() self.upTimer.update()
if self.downTimer.active: if self.downTimer.active:
self.downTimer.update() self.downTimer.update()
self.ui.currentTimeLabel.setText(datetime.now().strftime("%H:%M:%S")) #self.ui.currentTimeLabel.setText(datetime.now().strftime("%H:%M:%S"))
self.ui.timerLabel.setText(self.upTimer.getTimeString()) #self.ui.timerLabel.setText(self.upTimer.getTimeString())
self.ui.regTimerLabel.setText(self.downTimer.getTimeString()) #self.ui.regTimerLabel.setText(self.downTimer.getTimeString())
def _startTimer(self): def _startTimer(self):
btn = self.sender() btn = self.sender()
......
This diff is collapsed.
import sys import sys
from PyQt5 import QtWidgets from PyQt5 import QtWidgets, QtCore
from ui.CalibracaoPressaoW import Ui_CalibracaoPressaoW from ui.CalibracaoPressaoW import Ui_CalibracaoPressaoW
from threads.MainThread import MainThread from threads.MainThread import MainThread
class Ui_MainWindow(object): class Ui_MainWindow(object):
def __init__(self): 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.app = QtWidgets.QApplication(sys.argv)
self.dialog = QtWidgets.QMainWindow() self.dialog = QtWidgets.QMainWindow()
...@@ -13,6 +15,7 @@ class Ui_MainWindow(object): ...@@ -13,6 +15,7 @@ class Ui_MainWindow(object):
self.ui = Ui_CalibracaoPressaoW() self.ui = Ui_CalibracaoPressaoW()
self.ui.setupUi(self.dialog) self.ui.setupUi(self.dialog)
print(self.ui)
main_thread = MainThread(self.ui) main_thread = MainThread(self.ui)
main_thread.finished.connect(self.app.exit) main_thread.finished.connect(self.app.exit)
main_thread.start() main_thread.start()
......
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