sys.stdout.template.writeQueueing

Here are the examples of the python api sys.stdout.template.writeQueueing taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

Example 1

Project: TrustRouter Source File: toolmenu.py
def HandleToolCommand(cmd, code):
	import traceback
	import re
	global tools
	(menuString, pyCmd, desc) = tools[cmd]
	win32ui.SetStatusText("Executing tool %s" % desc, 1)
	pyCmd = re.sub('\\\\n','\n', pyCmd)
	win32ui.DoWaitCursor(1)
	oldFlag = None
	try:
		oldFlag = sys.stdout.template.writeQueueing
		sys.stdout.template.writeQueueing = 0
	except (NameError, AttributeError):
		pass
	
	try:
		exec("%s\n" % pyCmd)
		worked=1
	except SystemExit:
		# The program raised a SystemExit - ignore it.
		worked = 1
	except:
		print("Failed to execute command:\n%s" % pyCmd)
		traceback.print_exc()
		worked=0
	if oldFlag is not None:
		sys.stdout.template.writeQueueing = oldFlag
	win32ui.DoWaitCursor(0)
	if worked:
		text = "Completed successfully."
	else:
		text = "Error executing %s." % desc
	win32ui.SetStatusText(text, 1)