All pastes #353287 Raw Edit

Nagappan

public python v1 · immutable
·published 2007-02-13 08:19 UTC
rendered paste body
def waittillguiexist (windowName, guiTimeOut = None):	""" If the given window name exist, this function returns 1. If window doesnot exist, 	then this function returns 0. Difference between guiexist and waitguiexist is, 	waitguiexist waits for maximum 30 seconds. Still the window doesn't appear, 	then 0 is returned. We can set the environment variable 'GUI_TIMEOUT' to change 	the default waiting time.	INPUT: waittillguiexist ('<window name>')	OUTPUT: returns 1 on success and 0 on no existing window """	try:		_requestId  = str (random.randint (0, sys.maxint))		if guiTimeOut and type (guiTimeOut) == int:			guiTimeOut = str (guiTimeOut)		else:			guiTimeOut = os.getenv ('GUI_TIMEOUT')			if guiTimeOut is None:				guiTimeOut = str (30)		_message = generatexml (command.WAITTILLGUIEXIST, _requestId, windowName, guiTimeOut)		sendpacket (_message)		_responseStatus, _responseData = getresponse (_requestId)		if _responseStatus [0] != 0:			return 0		return 1	except LdtpExecutionError, msg:		raise LdtpExecutionError (str (msg))def waittillguinotexist (windowName, guiTimeOut = None):	""" If the given window name does not exist, this function returns 1. If window exist, 	then this function returns 0. Difference between guiexist and waitguinotexist is, 	waitguinotexist waits for maximum 30 seconds. Still the window does not disappear, 	then 0 is returned. We can set the environment variable 'GUI_TIMEOUT' to change the 	default waiting time.	INPUT: waittillguinotexist ('<window name>')	OUTPUT: returns 1 on success and 0 on no existing window """	try:		if guiTimeOut and type (guiTimeOut) == int:			guiTimeOut = str (guiTimeOut)		else:			guiTimeOut = os.getenv ('GUI_TIMEOUT')			if guiTimeOut is None:				guiTimeOut = str (30)		_requestId  = str (random.randint (0, sys.maxint))		_message = generatexml (command.WAITTILLGUINOTEXIST, _requestId, windowName, guiTimeOut)		sendpacket (_message)		_responseStatus, _responseData = getresponse (_requestId)		if _responseStatus [0] != 0:			return 0		return 1	except LdtpExecutionError, msg:		raise LdtpExecutionError (str (msg))