Changeset 7340:8e7d2cffe83c in orange


Ignore:
Timestamp:
02/03/11 21:37:21 (3 years ago)
Author:
markotoplak
Branch:
default
Convert:
13970c93e3e844a6775155494d6bc7c3199ad9c7
Message:

Applied patch from yang on Wed Feb 02, 2011 1:52.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orange/orngTree.py

    r6538 r7340  
    11import orange 
     2import base64 
    23from warnings import warn 
    34 
     
    595596        if node.branches: 
    596597            if node.distribution.abs < self.minExamples or len(internalName)-1 > self.maxDepth: 
    597                 self.fle.write('%s [ shape="plaintext" label="..." ]\n' % internalName) 
     598                self.fle.write('%s [ shape="plaintext" label="..." ]\n' % _quoteName(internalName)) 
    598599                return 
    599600                 
     
    601602            if self.nodeStr: 
    602603                label += "\\n" + self.formatString(self.nodeStr, node, parent) 
    603             self.fle.write('%s [ shape=%s label="%s"]\n' % (internalName, self.nodeShape, label)) 
     604            self.fle.write('%s [ shape=%s label="%s"]\n' % (_quoteName(internalName), self.nodeShape, label)) 
    604605             
    605606            for i, branch in enumerate(node.branches): 
    606607                if branch: 
    607608                    internalBranchName = internalName+chr(i+65) 
    608                     self.fle.write('%s -> %s [ label="%s" ]\n' % (internalName, internalBranchName, node.branchDescriptions[i])) 
     609                    self.fle.write('%s -> %s [ label="%s" ]\n' % (_quoteName(internalName), _quoteName(internalBranchName), node.branchDescriptions[i])) 
    609610                    self.dotTree0(branch, node, internalBranchName) 
    610611                     
     
    618619        self.fle.write("}\n") 
    619620 
     621def _quoteName(x): 
     622    return '"%s"' % (base64.b64encode(x)) 
    620623 
    621624def dumpTree(tree, leafStr = "", nodeStr = "", **argkw): 
Note: See TracChangeset for help on using the changeset viewer.