#@+leo
#@+node:0::@file plugins/mod_trace_tags.py
#@+body
"""Trace tags handler"""

from leoPlugins import *
from leoGlobals import *

tagCount = 0


#@+others
#@+node:1::trace_tags
#@+body
def trace_tags (tag,keywords):

	# Almost all tags have both c and v keys in the keywords dict.
	if tag not in ("start1","end1","open1","open2"):
		c = keywords.get("c")
		v = keywords.get("v")
		if not c:
			print tag, "c = None"
		if not v:
			if tag not in ("select1","select2","unselect1","unselect2"):
				print tag, "v = None"
	
	if tag not in (
		"bodykey1","bodykey2","dragging1","dragging2",
		"headkey1","headkey2","idle"):
	
		global tagCount ; tagCount += 1 # Count all other hooks.
	
		if tag in ("command1","command2"):
			print tagCount,tag,keywords.get("label")
		elif tag in ("open1","open2"):
			print tagCount,tag,keywords.get("fileName")
		else:
			if 1: # Brief
				print tagCount,tag
			else: # Verbose
				keys = keywords.items()
				keys.sort()
				for key,value in keys:
					print tagCount,tag,key,value
				print
#@-body
#@-node:1::trace_tags
#@-others


if 1: # Register the handlers...
	registerHandler("all", trace_tags)
	
	import mod_trace_tags
	es("...trace all tags v1.1: " + plugin_date(mod_trace_tags))
#@-body
#@-node:0::@file plugins/mod_trace_tags.py
#@-leo
