Hi,

Nice and clear example!

Fwiw, this code seems to run fine on nuke-6.3v2_64 Linux.



cheers
johan


On 20/08/11 06:36, [email protected] wrote:

Hi,
I've been migrating some of my PyQt tools to the new Qt setup with 6.3. For the most part its been straight forward but Im having problems with tools that utilizes worker threads. Specifically when I'm emitting signals from a worker QThread and connecting that to my Dialog thread. 
If Im not connecting to the emitting signals in the Dialog everything works fine. Any ideas what I'm doing wrong? I added an example that works fine in Nuke 6.2 with the old Qt setup but instantly crashes when it gets a signal in 6.3.

Cheers
Christoffer Hulusjö

Here is an example at pastebin, http://pastebin.com/4kgM56yv
Below is same example attached.

--------------------------------------------------------------------------
from PyQt4 import QtCore, QtGui
import time

class WorkerThread(QtCore.QThread):
   
    progressEvent = QtCore.pyqtSignal(QtCore.QString)
   
    def __init__(self, parent=None):
        super(WorkerThread, self).__init__(parent)
       
    def run(self):
        self.progressEvent.emit('Starting processing..')
        time.sleep(2)
        self.progressEvent.emit('Finished processing..')       
       

class UserInterfaceDialog(QtGui.QDialog):
   
  
    def __init__(self, parent=None):
        super(UserInterfaceDialog, self).__init__(parent)

        self.workerThread = WorkerThread()
        self.workerThread.progressEvent.connect(self.setStatus)
       
        self.statusBox = QtGui.QTextEdit('Idle..')
        self.startButton = QtGui.QPushButton('Start worker thread')
       
        self.startButton.clicked.connect(self.startButtonClicked)

        hBox = QtGui.QVBoxLayout()
        hBox.addWidget(self.statusBox)
        hBox.addWidget(self.startButton)

        self.setLayout(hBox)

    def setStatus(self, statusMessage):
        self.statusBox.setText(statusMessage)
   
    def startButtonClicked(self):
        self.workerThread.start()
       
dialog = None

def testNuke62():
    from nukescripts import pyQtAppUtils

    def initPyQtDialog(pyQtApp):
        app = pyQtApp.getApplication(['UserInterfaceDialog'])
        dialog = UserInterfaceDialog()
        dialog.show()
        app.exec_()

    pyQtApp = pyQtAppUtils.pyQtAppHelper(start = True)
    pyQtApp.run(initPyQtDialog, (pyQtApp,))
  
   
def testNuke63():
    global dialog
    dialog = UserInterfaceDialog()
    dialog.show()

testNuke63()



_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to