On Feb 24, 2005, at 10:29 PM, Joachim M=E5rtensson wrote:
> Joachim M=E5rtensson wrote:
>> Thanks, I have borrowed threading code from the original Web Services =
>> Tool. Every thing works, no blocking at all, again: Thank you! =20
>> However I want to update some text that is displayed just under the =20=
>> toolbar, just as in the WST app.
>> However everytime I call the update method my app locks, and has to =20=
>> be force quitted.
>> Here is the code:
>> def setStatusTextFieldMessage_(self, aMessage):
>> if not aMessage:
>> aMessage =3D "Displaying information about " =20
>> +`len(self._methodList)` +" methods."
>> "setStringValue:", aMessage, 0)
>> def reloadVisibleData_(self, sender):
>> if self._working:
>> # don't start a new job while there's an unfinished one
>> self.setStatusTextFieldMessage_("Checking ...") # This works
>> url =3D self._server
>> self._workerThread.scheduleWork(self.getMethods, url)
>> self.setStatusTextFieldMessage_("Found %d methods." % =20
>> def getMethods(self, url):
>> pool =3D NSAutoreleasePool.alloc().init()
>> self._methodList =3D
>> self.startWorking() # Start Process indicator
>> filelist =3DGlobDirectoryWalker(url, "*.m")
>> for filename in filelist:
>> ab =3D len(self._methodList)
>> self.setStatusTextFieldMessage_("Found %d methods." % ab) =20=
>> #This does not
>> Again thanks a lot for all your answers so far, they have been very =20=
> Replying to my own mail, sorry. I have found the problem, I forgot to =20=
> make the string unicode, everything now works as it should.
> "setStringValue:", unicode(aMessage), 0)
> Maybe someone can explain why this is needed when using threads but =20=
> not otherwise?
You *should* be doing it 100% of the time. I'm not sure why it creates =20=
a problem here, specifically.. something to do with the timing of the =20=
release or the identity change I guess. *Maybe* a GIL problem... If =20
you can reduce it to a minimal example that reproduces this issue, then =20=
I'm sure someone will diagnose it.