Nate, that sounds promising. What I have now is using events that are posted by the worker thread and subscribed to by the progress dialog that is part of the main UI thread. I have two lingering issues:
1) I indicate what document (x of X) that I am processing. Although an event is posted for each one, the UI does not update smoothly enough to reflect each one. It jumps numbers, although I know the dialog is actually receiving and processing each event 2) There is a Cancel button on the dialog that responds correctly the first time. It asks "Are you sure", and if you hit No the processing continues (it is actually still happening in the background worker thread while waiting). The issue with this is that once No is clicked, then Cancel button will not respond to any future clicks I had originally looked at the callAfterInterval, but discarded it for some reason I cannot remember. What are you using for a synchronization object between threads? A Queue? Thanks for the info and any other feedback! -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Nate Lowrie Sent: Wednesday, July 07, 2010 3:09 PM To: Dabo Users list Subject: Re: [dabo-users] dabo.ui.yieldUI Douglas Buchanan wrote: > I am (hopefully) at the end of a long, arduous process of creating a progress > dialog that updates while other threads are running and doing the work. The > last hang-up I have occurs in this snippet of code: > > __workerThread = ReportWorkerThread(SendReport, args) > __workerThread.start() > while __workerThread.isAlive(): > dabo.ui.yieldUI() > if __workerThread == None: > break > if __workerThread != None: > if __workerThread._status != 'OK': > return > > The issue is that once dabo.ui.yieldUI is called in the code above, it has > the desired effect of allowing the worker thread the ability to post events > that are received by the progress dialog (dDialog), but the call into yieldUI > never returns until the dForm that this code is called from is closed. Is > there a better way to refresh/repaint the UI while the thread is processing? > The sad thing is that this works correctly on Windows, but on Linux it does > not. > Doug, I have done a few apps that use this approach. Basically, I have an intermediary object that handles all of the status fields I want to update. The worker thread will periodically set the status fields. I then have the UI thread (main thread) update the status every so often through a dabo.ui.callAfterInterval call. The status is updated by reading the status fields on the object. This is a pretty streamlined approach and the UI should be smooth and responsive. Regards, Nate _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users Searchable Archives: http://leafe.com/archives/search/dabo-users This message: http://leafe.com/archives/byMID/[email protected] _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users Searchable Archives: http://leafe.com/archives/search/dabo-users This message: http://leafe.com/archives/byMID/d4face13c6ced24b91be6f0ee804a8a54b679d5...@vmbx124.ihostexchange.net
