File: debug_objects.py

package info (click to toggle)
dia 0.97.3%2Bgit20160930-9
  • links: PTS
  • area: main
  • in suites: bullseye
  • size: 54,372 kB
  • sloc: ansic: 155,065; xml: 16,326; python: 6,641; cpp: 4,935; makefile: 3,833; sh: 540; perl: 137; sed: 19
file content (33 lines) | stat: -rw-r--r-- 1,050 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import sys, dia

# sys.path.insert(0, 'd:/graph/dia/dia')

def dia_debug_cb (data, flags) :
	"gets passed in the active diagram, flags are unused at the moment"
	for layer in data.layers :
		print "Layer :", layer.name
		for o in layer.objects :
			print str(o), str(o.bounding_box)

def dia_debug_props_cb (data, flags) :
	for layer in data.layers :
		print "Layer :", layer.name
		for o in layer.objects :
			print str(o)
			props = o.properties
			for s in props.keys() :
				print props[s].type + " " + s + " (visible=%d)" % props[s].visible
				try :
					p = props[s].value
				except :
					p = None
				print "\t" + str(p)

# dia-python keeps a reference to the renderer class and uses it on demand
dia.register_action ("DebugBoundingbox", "Dia BoundingBox Debugger", 
                     "/DisplayMenu/Debug/DebugExtensionStart", 
                     dia_debug_cb)

dia.register_action ("DebugProperty", "Dia Property API Debugger", 
                     "/DisplayMenu/Debug/DebugExtensionStart", 
                     dia_debug_props_cb)