Commits

Ralph Bean committed 8481dc7

changed sampled to use tw2.core

Comments (0)

Files changed (1)

tw2/protovis/hierarchies/samples.py

 import math
 import random
 import os
-def build_tree(root, depth=0):
+
+tw2core_location = "/".join(
+    __import__('tw2.core', fromlist=['core']).__file__.split('/')[:-1])
+
+def build_tree(root=tw2core_location, depth=0):
     result = {}
-    if depth > 3 or 'development-deps' in root:
+    if depth > 3:
         return result
     tups = os.walk(root)
     d, dirs, files = [e for e in tups][0]
     for dir in dirs:
         result[dir] = build_tree("%s/%s" % (d, dir), depth=depth+1)
     for file in files:
+        if file.endswith('.pyc') or file.endswith('.pyo'):
+            continue
         result[file] = int(os.path.getsize("%s/%s" % (d, file))) + 1
     return result
 
     p_height = 500
     p_width = 500
     p_orient = 'radial'
-    p_breadth = 25
-    p_depth = 60
+    p_breadth = 29 
+    p_depth = 100
     def prepare(self):
-        self.p_data = build_tree('.')
+        self.p_data = build_tree() # of tw2.core
         super(DemoNodeLinkTree, self).prepare()
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.