Exemplo n.º 1
0
    def run(self):
        if self.wav < 10:
            wav_base_path = self.datasetPath + 'sounds/0000' + str(self.wav)
        else:
            wav_base_path = self.datasetPath + 'sounds/000' + str(self.wav)

        path = wav_base_path + '_' + str(self.snr) + '.wav'
        self.play(path)
        QThread.exec(self)
Exemplo n.º 2
0
class Ui_MainWindow(object):
    client = Client()

    def setupUi(self, MainWindow):
        MainWindow.setObjectName("ChatRoom")
        MainWindow.resize(498, 266)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")

        self.pushButton = QtWidgets.QPushButton(self.centralwidget)
        self.pushButton.setGeometry(QtCore.QRect(300, 30, 141, 61))
        self.pushButton.setObjectName("pushButton_connect")
        self.pushButton.setFont(QtGui.QFont("Bahnschrift", 12))
        self.pushButton.setToolTip("<h3>Connect to the server</h3>")
        self.pushButton.setToolTipDuration(1500)
        self.pushButton.clicked.connect(self.connect_button_clicked)

        self.pushButton_2 = QtWidgets.QPushButton(self.centralwidget)
        self.pushButton_2.setGeometry(QtCore.QRect(300, 140, 141, 61))
        self.pushButton_2.setObjectName("pushButton_disconnect")
        self.pushButton_2.setFont(QtGui.QFont("Bahnschrift", 12))
        self.pushButton_2.setToolTip("<h3>Disconnect from the server</h3>")
        self.pushButton_2.setToolTipDuration(1500)

        self.label8 = QtWidgets.QLabel(self.centralwidget)
        self.label8.setFont(QtGui.QFont("Bahnschrift", 25))
        self.label8.setGeometry(70, 120, 150, 50)
        self.label8.setStyleSheet('color : brown')
        timer = QTimer(self.centralwidget)
        timer.timeout.connect(self.clock_fun)
        timer.start(1000)

        self.label9 = QtWidgets.QLabel(self.centralwidget)
        self.label9.setFont(QtGui.QFont("Bahnschrift", 15))
        self.label9.setGeometry(50, 175, 200, 50)
        date = QDate.currentDate().toString('dddd, MMM yyyy')

        self.label9.setText(date)

        MainWindow.setCentralWidget(self.centralwidget)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

    def connect_button_clicked(self):
        self.thread = QThread()
        self.thread.started(self.client.connect())
        self.client.moveToThread(self.thread)
        self.thread.exec()

    def clock_fun(self):
        current_time = QTime.currentTime()
        display_time = current_time.toString('hh:mm:ss')
        self.label8.setText(display_time)

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "ChatRoom"))
        self.pushButton.setText(_translate("MainWindow", "CONNECT"))
        self.pushButton_2.setText(_translate("MainWindow", "DISCONNECT"))