class LayoutTemperature(QHBoxLayout):
    def __init__(self, parent):
        super(LayoutTemperature, self).__init__()
        self.settings(parent)

    def settings(self, parent):
        # CRIANDO O GRUPOBOXTEMPS PARA POR OS LABELS E LCD'S
        self.groupBoxTemps = QGroupBox(parent)

        # CRIANDO O LABEL PARA INFORMAR O QUE O LCD ESTÁ MOSTRANDO
        self.lbTemp1 = QLabel(self.groupBoxTemps)
        self.lbTemp1.setGeometry(QRect(70, 10, 127, 10))
        self.lbTemp1.setMaximumSize(QSize(16777215, 10))
        self.lbTemp1.setText("Termometro 1")
        self.lbTemp1.setAlignment(Qt.AlignCenter)

        # CRIANDO O LABEL PARA INFORMAR O QUE O LCD ESTÁ MOSTRANDO
        self.lbTemp2 = QLabel(self.groupBoxTemps)
        self.lbTemp2.setGeometry(QRect(330, 10, 130, 10))
        self.lbTemp2.setMaximumSize(QSize(16777215, 10))
        self.lbTemp2.setText("Termometro 2")
        self.lbTemp2.setAlignment(Qt.AlignCenter)

        # CRIANDO O LCD PARA INFORMAR A TEMPERATURA DO TERMOMETRO 1
        self.lcdTemp1 = QLCDNumber(self.groupBoxTemps)
        self.lcdTemp1.setGeometry(QRect(30, 30, 211, 71))
        self.lcdTemp1.display("00.00")
        self.lcdTemp1.setDigitCount(6)

        # CRIANDO O LCD PARA INFORMAR A TEMPERATURA DO TERMOMETRO 2
        self.lcdTemp2 = QLCDNumber(self.groupBoxTemps)
        self.lcdTemp2.setGeometry(QRect(290, 30, 211, 71))
        self.lcdTemp2.display("00.00")
        self.lcdTemp2.setDigitCount(6)

        # COLOCANDO LAYOUT NO GRUPOBOXTEMPS
        self.addWidget(self.groupBoxTemps)
示例#2
0
class LayoutTemperature(QHBoxLayout):
    def __init__(self, parent):
        super(LayoutTemperature, self).__init__()
        self.settings(parent)

    def settings(self, parent):
        # CRIANDO O GRUPOBOXTEMPS PARA POR OS LABELS E LCD'S
        self.groupBoxTemps = QGroupBox(parent)

        # CRIANDO O LABEL PARA INFORMAR O QUE O LCD ESTÁ MOSTRANDO
        self.lbTemp1 = QLabel(self.groupBoxTemps)
        self.lbTemp1.setGeometry(QRect(70, 10, 127, 10))
        self.lbTemp1.setMaximumSize(QSize(16777215, 10))
        self.lbTemp1.setText("Termometro 1")
        self.lbTemp1.setAlignment(Qt.AlignCenter)

        # CRIANDO O LABEL PARA INFORMAR O QUE O LCD ESTÁ MOSTRANDO
        self.lbTemp2 = QLabel(self.groupBoxTemps)
        self.lbTemp2.setGeometry(QRect(330, 10, 130, 10))
        self.lbTemp2.setMaximumSize(QSize(16777215, 10))
        self.lbTemp2.setText("Termometro 2")
        self.lbTemp2.setAlignment(Qt.AlignCenter)

        # CRIANDO O LCD PARA INFORMAR A TEMPERATURA DO TERMOMETRO 1
        self.lcdTemp1 = QLCDNumber(self.groupBoxTemps)
        self.lcdTemp1.setGeometry(QRect(30, 30, 211, 71))
        self.lcdTemp1.display("00.00")
        self.lcdTemp1.setDigitCount(6)

        # CRIANDO O LCD PARA INFORMAR A TEMPERATURA DO TERMOMETRO 2
        self.lcdTemp2 = QLCDNumber(self.groupBoxTemps)
        self.lcdTemp2.setGeometry(QRect(290, 30, 211, 71))
        self.lcdTemp2.display("00.00")
        self.lcdTemp2.setDigitCount(6)

        # COLOCANDO LAYOUT NO GRUPOBOXTEMPS
        self.addWidget(self.groupBoxTemps)
示例#3
0
class LayoutTimeCurrent(QVBoxLayout):
    def __init__(self, parent):
        super(LayoutTimeCurrent, self).__init__()
        self.settings(parent)

    def settings(self, parent):
        # CRIANDO O GRUPOBOXTIMECURRENTE PARA COLOCAR  O LABEL E O LCD
        # PARA CONTROLAR O TEMPO
        self.groupBoxTimeCurrent = QGroupBox(parent)

        # CRIANDO O LABEL DE INFORMAR O QUE É O LCD ESTÁ MOSTRANDO
        self.lbTimeCurrent = QLabel(self.groupBoxTimeCurrent)
        self.lbTimeCurrent.setGeometry(QRect(230, 0, 91, 20))
        self.lbTimeCurrent.setMaximumSize(QSize(16777215, 20))
        self.lbTimeCurrent.setText("Tempo percorrido")

        # CRIANDO O LCD PARA MOSTRAR O TEMPO PERCORRIDO
        self.lcdTimeCurrent = QLCDNumber(self.groupBoxTimeCurrent)
        self.lcdTimeCurrent.setGeometry(QRect(140, 20, 251, 81))
        self.lcdTimeCurrent.setDigitCount(8)
        self.lcdTimeCurrent.display("00:00:00")

        # COLOCANDO LAYOUT NO GRUPOBOXTIMECURRENT
        self.addWidget(self.groupBoxTimeCurrent)
class LayoutTimeCurrent(QVBoxLayout):
    def __init__(self, parent):
        super(LayoutTimeCurrent, self).__init__()
        self.settings(parent)

    def settings(self, parent):
        # CRIANDO O GRUPOBOXTIMECURRENTE PARA COLOCAR  O LABEL E O LCD
        # PARA CONTROLAR O TEMPO
        self.groupBoxTimeCurrent = QGroupBox(parent)

        # CRIANDO O LABEL DE INFORMAR O QUE É O LCD ESTÁ MOSTRANDO
        self.lbTimeCurrent = QLabel(self.groupBoxTimeCurrent)
        self.lbTimeCurrent.setGeometry(QRect(230, 0, 91, 20))
        self.lbTimeCurrent.setMaximumSize(QSize(16777215, 20))
        self.lbTimeCurrent.setText("Tempo percorrido")

        # CRIANDO O LCD PARA MOSTRAR O TEMPO PERCORRIDO
        self.lcdTimeCurrent = QLCDNumber(self.groupBoxTimeCurrent)
        self.lcdTimeCurrent.setGeometry(QRect(140, 20, 251, 81))
        self.lcdTimeCurrent.setDigitCount(8)
        self.lcdTimeCurrent.display("00:00:00")

        # COLOCANDO LAYOUT NO GRUPOBOXTIMECURRENT
        self.addWidget(self.groupBoxTimeCurrent)
示例#5
0
class MainWindow(QWidget):
    # set up signals
    resetClicked = pyqtSignal()
    inputChanged = pyqtSignal()
    input_one = None

    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)

        # --------------------------------------------------------

        # main window
        self.setObjectName("Multiply")
        self.resize(400, 300)

        # label
        self.label = QLabel(self)
        self.label.setGeometry(QRect(20, 10, 250, 50))
        self.label.setText("Multiply two numbers!")
        # self.label.show()

        # input frame
        self.input_frame = QFrame(self)
        self.input_frame.setGeometry(QRect(20, 60, 350, 130))
        self.input_frame.setFrameShape(QFrame.StyledPanel)
        self.input_frame.setFrameShadow(QFrame.Raised)

        # set the layout of the frame
        self.verticalLayout = QVBoxLayout(self.input_frame)
        self.verticalLayout.setObjectName("verticalLayout")

        # first input
        self.input_one = QDoubleSpinBox(self.input_frame)
        self.input_one.setObjectName("input_one")
        self.input_one.setDecimals(4)
        self.input_one.setSingleStep(0.01)

        self.verticalLayout.addWidget(self.input_one)

        # second input
        self.input_two = QDoubleSpinBox(self.input_frame)
        self.input_two.setObjectName("input_two")
        self.input_two.setDecimals(4)
        self.input_two.setSingleStep(0.01)

        self.verticalLayout.addWidget(self.input_two)

        # LCD result
        self.result_lcd = QLCDNumber(self)
        self.result_lcd.setObjectName("result_lcd")
        self.result_lcd.setGeometry(QRect(20, 200, 350, 80))
        self.result_lcd.setDigitCount(10)
        self.result_lcd.setSmallDecimalPoint(True)

        # Reset Button
        self.reset_button = QPushButton(self)
        self.reset_button.setGeometry(QRect(270, 10, 100, 30))
        self.reset_button.setObjectName("reset_button")
        self.reset_button.setText("Reset")

        # --------------------------------------------------------

        # connect slots

        self.reset_button.clicked.connect(self.onResetClick)
        self.input_one.valueChanged.connect(self.onInputChanged)
        self.input_two.valueChanged.connect(self.onInputChanged)

        # define slots

    def onResetClick(self):
        self.resetClicked.emit()

    def onInputChanged(self):
        self.inputChanged.emit()

    def setResult(self, value):
        self.result_lcd.display(value)
示例#6
0
class Ui_MainWindow(QMainWindow):
    def __init__(self):
        super(Ui_MainWindow, self).__init__(None)
        self.setupUi()
        self.serial = ComunicacaoArduino.start_communication()
        self.controle = ControlInterface()
        self.dadosTempo = []
        self.dados = []

    def startThreadTime(self):
        self.controle.starThreadTime(self)

    def startThreadMonitora(self):
        self.buttonStart.setDisabled(True)
        self.buttonStop.setDisabled(False)
        self.controle.starThreadMonitora(self.serial, self)

    def stopThreadMonitora(self):
        self.controle.stopThreadMonitora()
        self.controle.starThreadGravadora(self.LEditArqDes.text(), self.dados)

    def stopThreadTime(self):
        self.controle.stopThreadTime()

    def startThreads(self):
        if self.LEditArqDes.text() != '':
            self.startThreadMonitora()
            self.startThreadTime()
        else:
            reply = QMessageBox.critical(self, 'Aviso', "Selecione onde quer salvar o arquivo!", QMessageBox.Ok)

    def stopThreads(self):
        self.stopThreadMonitora()
        self.stopThreadTime()

    def setTemps(self, temps):
        self.lcdTemp1.display(temps[0])
        self.lcdTemp2.display(temps[1])
        temps.append(self.dadosTempo[len(self.dadosTempo)-1])
        self.dados.append(temps)

    def setTime(self, time):
        if time not in self.dadosTempo:
            self.lcdTime.display(time)
            self.dadosTempo.append(time)

    def setupUi(self):
        self.setMaximumSize(580, 460)
        self.setMinimumSize(580, 460)

        self.centralWidget = QWidget(self)
        self.setCentralWidget(self.centralWidget)

        self.gridLayout = QGridLayout(self.centralWidget)
        self.gridLayout.setMargin(11)
        self.gridLayout.setSpacing(6)

        self.cboxSetupAndActions()
        self.cboxTemps()
        self.currentTime()

    def cboxSetupAndActions(self):
        self.HLayoutSetupAndActions = QHBoxLayout()
        self.HLayoutSetupAndActions.setMargin(11)
        self.HLayoutSetupAndActions.setSpacing(6)

        self.groupBoxSetupAndActions = QGroupBox(self.centralWidget)
        self.groupBoxSetupAndActions.setTitle("Configurações e Ações")

        self.buttonStart = QPushButton(self.groupBoxSetupAndActions)
        self.buttonStart.setGeometry(QRect(270, 80, 121, 23))
        self.buttonStart.setText("Start")
        self.buttonStart.clicked.connect(self.startThreads)
        icon = QIcon()
        icon.addPixmap(QPixmap("View\\Imagens\\start_icon.png"), QIcon.Normal, QIcon.Off)
        self.buttonStart.setIcon(icon)

        self.buttonStop = QPushButton(self.groupBoxSetupAndActions)
        self.buttonStop.setGeometry(QRect(400, 80, 121, 23))
        self.buttonStop.setText("Stop")
        self.buttonStop.clicked.connect(self.stopThreads)
        self.buttonStop.setDisabled(True)

        self.LbArqDes = QLabel("Selecione onde quer salvar o novo arquivo:", self.groupBoxSetupAndActions)
        self.LbArqDes.setGeometry(QRect(20, 20, 220, 16))

        self.LEditArqDes = QLineEdit(self.groupBoxSetupAndActions)
        self.LEditArqDes.setReadOnly(True)
        self.LEditArqDes.setGeometry(QRect(20, 40, 350, 21))

        self.BtnBrowser2 = QPushButton("Browser...", self.groupBoxSetupAndActions)
        self.BtnBrowser2.clicked.connect(self.pegaArqDestino)
        self.BtnBrowser2.setGeometry(QRect(370, 39, 80, 23))
        icon = QIcon()
        icon.addPixmap(QPixmap(("View\\Imagens\\pasta.png")), QIcon.Normal, QIcon.Off)
        self.BtnBrowser2.setIcon(icon)

        self.HLayoutSetupAndActions.addWidget(self.groupBoxSetupAndActions)

        self.gridLayout.addLayout(self.HLayoutSetupAndActions, 2, 0, 1, 1)

    def cboxTemps(self):
        self.hlLcdsTemp = QHBoxLayout()
        self.hlLcdsTemp.setMargin(11)
        self.hlLcdsTemp.setSpacing(6)

        self.groupBoxLcdsTemp = QGroupBox(self.centralWidget)

        self.lbTemp1 = QLabel(self.groupBoxLcdsTemp)
        self.lbTemp1.setGeometry(QRect(70, 10, 127, 10))
        self.lbTemp1.setText('Termômetro 1')
        self.lbTemp1.setAlignment(Qt.AlignCenter)

        self.lbTemp2 = QLabel(self.groupBoxLcdsTemp)
        self.lbTemp2.setGeometry(QRect(330, 10, 130, 10))
        self.lbTemp2.setText('Termômetro 2')
        self.lbTemp2.setAlignment(Qt.AlignCenter)

        self.lcdTemp1 = QLCDNumber(self.groupBoxLcdsTemp)
        self.lcdTemp1.setGeometry(QRect(30, 30, 211, 71))
        self.lcdTemp1.display("00.00")

        self.lcdTemp2 = QLCDNumber(self.groupBoxLcdsTemp)
        self.lcdTemp2.setGeometry(QRect(290, 30, 211, 71))
        self.lcdTemp2.display("00.00")

        self.hlLcdsTemp.addWidget(self.groupBoxLcdsTemp)

        self.gridLayout.addLayout(self.hlLcdsTemp, 0, 0, 1, 1)

    def currentTime(self):
        self.verticalLayout_3 = QVBoxLayout()
        self.verticalLayout_3.setMargin(11)
        self.verticalLayout_3.setSpacing(6)

        self.groupBox_2 = QGroupBox(self.centralWidget)
        self.groupBox_2.setTitle("")

        self.lbCurrentTime = QLabel(self.groupBox_2)
        self.lbCurrentTime.setGeometry(QRect(230, 0, 91, 20))
        self.lbCurrentTime.setText("Tempo percorrido")

        self.lcdTime = QLCDNumber(self.groupBox_2)
        self.lcdTime.setGeometry(QRect(140, 20, 251, 81))
        self.lcdTime.setDigitCount(8)
        self.lcdTime.display("00:00:00")

        self.verticalLayout_3.addWidget(self.groupBox_2)

        self.gridLayout.addLayout(self.verticalLayout_3, 1, 0, 1, 1)

    def pegaArqDestino(self):
        reply = QMessageBox.information(self, 'Aviso', "Selecione a pasta para salvar o arquivo",
                                              QMessageBox.Ok)
        self.nome_arquivoDestino = QFileDialog.getSaveFileName(self, "Selecionar o local para salvar o arquivo",
                                                                     filter="All(*.csv)")  ##Abre um arquivo
        self.LEditArqDes.setText(self.nome_arquivoDestino)