else: output( out_lck, "Option " + str(int_option) + " not available") elif int_option == 2: client.parallel_downloads = loop_int_input( out_lck, "Insert the number of parallel downloads: ") elif int_option == 3: client.part_size = loop_int_input( out_lck, "Insert the new part size: ") if __name__ == "__main__": app = QtWidgets.QApplication(sys.argv) mainwindow = main_window.Ui_MainWindow() mainwindow.show() # download_window = download.Ui_MainWindow() # download_window.show() main = Main() main.print_trigger.connect(mainwindow.print_on_main_panel) main.download_trigger.connect(mainwindow.update_progress) main.download_progress_trigger.connect(mainwindow.download_progress) main.start() sys.exit(app.exec_())
def __init__(self): super().__init__() self.ui = main_window.Ui_MainWindow() self.ui.setupUi(self) self._buildSignalAndSlot()
def _translate(context, text, disambig): return QtCore.QCoreApplication.translate(context, text, disambig, _encoding) except AttributeError: def _translate(context, text, disambig): return QtCore.QCoreApplication.translate(context, text, disambig) class MyThread(QtCore.QThread): print_trigger = QtCore.pyqtSignal(str, str) def __init__(self, parent=None): super(MyThread, self).__init__(parent) def run(self): time.sleep(random.random()*5) # random sleep to imitate working if __name__ == '__main__': app = QtWidgets.QApplication(sys.argv) mainwindow = MainWindow.Ui_MainWindow() mainwindow.show() threads = [] # this will keep a reference to threads for i in range(10): thread = MyThread() # create a thread thread.print_trigger.connect(mainwindow.print_on_main_panel) # connect to it's signal thread.start() # start the thread threads.append(thread) # keep a reference sys.exit(app.exec_())