dia r4369 - in trunk: . plug-ins/python



Author: hans
Date: Sun Apr  5 20:05:25 2009
New Revision: 4369
URL: http://svn.gnome.org/viewvc/dia?rev=4369&view=rev

Log:
2009-04-05  Hans Breuer  <hans breuer org>

	* plug-ins/python/wdeps.py : intended tinting on win32, too.
	* plug-ins/python/dot2dia.py : don't let a single unknown color make
	the whole import fail


Modified:
   trunk/ChangeLog
   trunk/plug-ins/python/dot2dia.py
   trunk/plug-ins/python/wdeps.py

Modified: trunk/plug-ins/python/dot2dia.py
==============================================================================
--- trunk/plug-ins/python/dot2dia.py	(original)
+++ trunk/plug-ins/python/dot2dia.py	Sun Apr  5 20:05:25 2009
@@ -203,7 +203,10 @@
 		obj, h1, h2 = nodeType.create(x-w/2, y-h/2) # Dot pos is center, Dia (usually) uses top/left
 		obj.move_handle(h2, (x+w/2, y+h/2), 0, 0) # resize the object
 		if n.parms.has_key('fillcolor') :
-			obj.properties['fill_colour'] = n.parms['fillcolor'] # same color syntax
+			try :
+				obj.properties['fill_colour'] = n.parms['fillcolor'] # same color syntax?
+			except :
+				print "Failed to apply:", n.parms['fillcolor']
 		layer.add_object(obj)
 		AddLabel (layer, (x,y), n.name, n.FontSize(), 1)
 		obj.properties['meta'] = n.parms # copy all (remaining) parameters

Modified: trunk/plug-ins/python/wdeps.py
==============================================================================
--- trunk/plug-ins/python/wdeps.py	(original)
+++ trunk/plug-ins/python/wdeps.py	Sun Apr  5 20:05:25 2009
@@ -139,6 +139,7 @@
 		# avoids infinite recursion on circular dependencies
 		dAll[sFrom] = None
 		delayLoad = 0
+		directDeps = []
 		for s in sDump :
 			r = re.match ("^    (.*\.dll)", s, re.IGNORECASE)
 			# the delay load switch is flipped once
@@ -159,11 +160,17 @@
 					#print name, len(arr)
 					node.AddEdge (name, arr, delayLoad)
 					arr = []
-					nDepth = nDepth + 1
-					GetDepsWin32 (name, dAll, nMaxDepth-nDepth+1, nDepth)
-					nDepth = nDepth - 1
+					directDeps.append(name)
+					GetDepsWin32 (name, dAll, nMaxDepth-nDepth+2, nDepth+1)
 		# add to all nodes
 		dAll[sFrom] = node
+		# restore original depth (independent of how the recurison works)
+		for sd in directDeps :
+			if sd in dAll.keys() :
+				try :
+					dAll[sd].depth = nDepth + 1 
+				except AttributeError, msg :
+					print "FIXME:", sd, msg
 	
 def GetDepsPosix (sFrom, dAll, nMaxDepth, nDepth=0) :
 	"calculates the dependents of the passed in so"
@@ -176,7 +183,7 @@
 		dAll[sFromName] = Node (sFromName, nDepth) # needed here so other algoritm can remove it ;)
 		return
 	if not sFromName in dAll.keys() :
-		print "Creating", sFromName, nDepth
+		#print "Creating", sFromName, nDepth
 		node = Node (sFromName, nDepth)
 		sPath = sFrom
 		#TODO: work with relative pathes? Current dir?
@@ -789,10 +796,11 @@
 					sPrefix = "// " + string.join(edge.symbols, ", ") + "\n// "
 				if edge.delayLoad :
 					# putting 'weight' and 'constraint' seems to be too much for dot
-					#sStyle = "weight=%f,style=dotted" % (math.log10(math.sqrt(edge.weight)),)
-					sStyle = "style=dotted,constraint=false"
+					sStyle = "weight=%f,style=dotted" % (math.log10(math.sqrt(edge.weight+.1)),)
+					# even using constraint at all seems to often crash dot
+					#sStyle = "style=dotted,constraint=false"
 				else :
-					sStyle = "weight=%f" % (math.log10(edge.weight),)
+					sStyle = "weight=%f" % (math.log10(edge.weight+.1),)
 				if edge.weight <= nSymbols :
 					#f.write ('"%s" -> "%s" [weight=%f,label=%s]\n' % (node.name, edge.name, math.log(1)-0.5, edge.symbols[0]))
 					f.write ('%s"%s" -> "%s" [fontsize=6,label="%s",%s]\n' 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]