Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/dialogs
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18684
Modified Files:
status.py
Log Message:
Allow the threaded status dialog to work in a pythonwin environment.
Index: status.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/dialogs/status.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** status.py 1 Jun 2002 08:16:42 -0000 1.2
--- status.py 5 Mar 2005 03:17:22 -0000 1.3
***************
*** 6,9 ****
--- 6,10 ----
import win32con
import win32api
+ import time
def MakeProgressDlgTemplate(caption, staticText = ""):
***************
*** 184,188 ****
t = ProgressThread(title, msg, maxticks)
t.CreateThread()
! t.createdEvent.wait(10) # timeout if things go terribly wrong.
return t.dialog
--- 185,199 ----
t = ProgressThread(title, msg, maxticks)
t.CreateThread()
! # Need to run a basic "PumpWaitingMessages" loop just incase we are
! # running inside Pythonwin.
! # Basic timeout incase things go terribly wrong. Ideally we should use
! # win32event.MsgWaitForMultipleObjects(), but we use a threading module
! # event - so use a dumb strategy
! end_time = time.time() + 10
! while time.time() < end_time:
! if t.createdEvent.isSet():
! break
! win32ui.PumpWaitingMessages()
! time.sleep(0.1)
return t.dialog
|