Exemple #1
0
 def __init__(self, parent=None):
     QWidget.__init__(self, parent)
     self.uploadthread = UP()
     self.parent = parent
     self.ui = Stream_Form()
     self.ui.setupUi(self)
     self.initSignals()
     self.show()
Exemple #2
0
class StreamWidget(QWidget):
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)
        self.uploadthread = UP()
        self.parent = parent
        self.ui = Stream_Form()
        self.ui.setupUi(self)
        self.initSignals()
        self.show()

    def filedialog(self):
        dialog = QFileDialog()
        self.path = dialog.getOpenFileName()
        self.ui.lineEdit.setText(self.path)

    def stream(self):
        path = self.ui.lineEdit.text()
        self.uploadthread.config(path)
        print('stream started')
        self.uploadthread.start()

    def updatePercent(self, msg):
        self.ui.progressBar.setValue(msg)
        self.ui.progressBar.update()

    def makeBusy(self):
        self.ui.progressBar.setMinimum(0)
        self.ui.progressBar.setMaximum(0)
        self.ui.progressBar.update()

    def unmakeBusy(self):
        self.ui.progressBar.setMinimum(0)
        self.ui.progressBar.setMaximum(100)
        self.ui.progressBar.update()

    def initSignals(self):
        QObject.connect(self.ui.pushButton, SIGNAL('clicked()'), self.filedialog)
        QObject.connect(self.ui.pushButton_2, SIGNAL('clicked()'), self.stream)
        QObject.connect(self.uploadthread, SIGNAL('updatePercent(int)'), self.updatePercent)
        QObject.connect(self.uploadthread,SIGNAL('makeBusy()'), self.makeBusy)
        QObject.connect(self.uploadthread, SIGNAL('unmakeBusy()'), self.unmakeBusy)