PyQT/QT problem with threads any suggestions

Questions about programming languages and debugging
Post Reply
User avatar
maboroshi
Dr. Mab
Dr. Mab
Posts: 1624
Joined: 28 Aug 2005, 16:00
18

PyQT/QT problem with threads any suggestions

Post by maboroshi »

I am trying to update a QPixMap QLabel image on each successful iteration in my video function however the threading breaks on this function I am wondering what I am doing wrong. Its like the threading is non existent when I run this function

What I see happening is a problem in the threading it sends the entire loop before the signal sends its data back. I am confused why it's doing this

The code in Question I posted below but the full code is available on suck-o code

Code: Select all

    def video(self):
    
        cam = Device()
        cam.setResolution(640, 480)
        for i in range(10):
            a = datetime.datetime.now().strftime("%Y%m%dT%H%M%S%ms")
            b = str(a)
            try:
                cam.saveSnapshot(os.getcwd() + '\\camImages\\' + '%s.png' % (b))
            except:
                print "missed image"
                continue
            self.clientAll(chr(CMD_VIDEO), os.getcwd() + '\\camImages\\' + '%s.png' % (b))
      
    def viewVideo(self, msg):
        print msg
        self.myVideo.setPixmap(QPixmap(msg))

Edit * I am using a signal to call the View Video Function

Let me explain: In my main GUI class I have it threaded I use this to initiate a signal

Code: Select all


    self.thread.mySignal5.connect(self.viewVideo)

Then I have those functions I posted earlier (see above). In my Worker/Threading class I initiate mySignal5 like this

Code: Select all


    mySignal5 = pyqtSignal('PyQt_PyObject')

Then in my run function where I run my server, I have:

Code: Select all


    elif cmd == CMD_VIDEO:
        self.mySignal5.emit(msg)
        #print msg
here is the code in its entirety :-)

http://code.suck-o.com/42399

Post Reply