I have to convert a QGIS plugin (2.2.0-Valmiera 32 bits) from a QDialog to
a QDockWidget. While succeeding in doing the conversion (the plugin is now
docked), the threads which are launched from the plugin do not work
anymore. Any idea why this happens and how to solve this? Here is an
example showing my problem using only a QPushButton that starts a thread:

First, my plugDockDialog.py file:

class PlugDockDialog(QDockWidget, Ui_PlugDock): def __init__(self):
QDockWidget.__init__(self, None) self.setupUi(self)

and (the significant parts of) my plugDock.py file:

class PlugDock: def __init__(self, iface): self.iface = iface self.dlg =
PlugDockDialog() self.iface.addDockWidget( Qt.RightDockWidgetArea, self.dlg
) cmd = self.dlg.findChild(QPushButton,"cmdGo")
cmd.clicked.connect(self.cmdGoClick) # Thread method @staticmethod def
myfunc(i): time.sleep(3) print "Docking thread %d is finished..." % i #
Click method def cmdGoClick(self): t = Thread(target=self.myfunc,
args=(1,)) t.start()

Thank you for your help!
_______________________________________________
Qgis-developer mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to