def runner(): app = QApplication(sys.argv) window = QMainWindow() ui = Ui_MainWindow() ui.setupUi(window) cam = CameraDevice() thread = QThread() cam.moveToThread(thread) thread.start() thread.setPriority(QThread.LowestPriority) atexit.register(cam.capture.release) cam.video_signal.connect(ui.set_image) ui.preview_on.clicked.connect(cam.preview_on) ui.preview_on.clicked.connect(cam.startVideo) ui.preview_off.clicked.connect(cam.preview_off) # ui.preview_off.clicked.disconnect(cam.startVideo) window.show() sys.exit(app.exec_())
import signal import sys import atexit import time from PyQt4.QtGui import QApplication, QDialog, QMainWindow from PyQt4.QtCore import QThread, SIGNAL from vise.vision.CameraDeviceProcess import CameraDevice from vise.ui.main_window import Ui_MainWindow from multiprocessing import Process, Queue, Pipe from vise.utils.Emitter import Emitter if __name__ == '__main__': app = QApplication(sys.argv) mother_pipe, child_pipe = Pipe() queue = Queue() emitter = Emitter(mother_pipe) window = QMainWindow() ui = Ui_MainWindow(queue,emitter) ui.setupUi(window) # ui.connect(ui.emitter, SIGNAL('data(QImage)'), ui.set_image) # form = Form(queue, emitter) CameraDevice(child_pipe, queue).start() # ChildProc(child_pipe, queue).start() # form.show() window.show() app.exec_()