diff --git a/OpenDirDL/opendirdl.py b/OpenDirDL/opendirdl.py index 67c6394..4993ef6 100644 --- a/OpenDirDL/opendirdl.py +++ b/OpenDirDL/opendirdl.py @@ -143,7 +143,7 @@ from voussoirkit import bytestring from voussoirkit import downloady from voussoirkit import fusker from voussoirkit import treeclass -from voussoirkit import pathtree +import pathtree sys.path.append('D:\\git\\else\\threadqueue'); import threadqueue DOWNLOAD_CHUNK = 16 * bytestring.KIBIBYTE diff --git a/OpenDirDL/pathtree.py b/OpenDirDL/pathtree.py new file mode 100644 index 0000000..c9ecc1b --- /dev/null +++ b/OpenDirDL/pathtree.py @@ -0,0 +1,292 @@ +import argparse +import sys +import os + +from voussoirkit import bytestring +from voussoirkit import treeclass + +HTML_TREE_HEAD = ''' + + + + + + + + + +''' + +HTML_FORMAT_DIRECTORY = ''' +
+ +{directory_anchor} +
+' + else: + # This helps put some space between sibling directories + yield '| ' * (depth) + + if depth == 0: + if footer is not None: + yield footer + if use_html: + yield '\n' + + + +def pathtree_argparse(args): + from voussoirkit import safeprint + from voussoirkit import spinal + paths = spinal.walk_generator() + paths = [{'path': path.absolute_path, 'size': path.size} for path in paths] + tree = from_paths(paths, '.') + recursive_get_size(tree) + + if args.output_file: + output_file = open(args.output_file, 'w', encoding='utf-8') + else: + output_file = None + + for line in recursive_print_node(tree, use_html=args.use_html): + if output_file: + print(line, file=output_file) + else: + safeprint.safeprint(line) + +def main(argv): + parser = argparse.ArgumentParser() + + parser.add_argument('output_file', nargs='?', default=None) + parser.add_argument('--html', dest='use_html', action='store_true') + parser.set_defaults(func=pathtree_argparse) + + args = parser.parse_args(argv) + args.func(args) + +if __name__ == '__main__': + main(sys.argv[1:]) diff --git a/VoxelSphereGenerator/voxelspheregenerator.py b/VoxelSphereGenerator/voxelspheregenerator.py index 6935b10..9e2ba5a 100644 --- a/VoxelSphereGenerator/voxelspheregenerator.py +++ b/VoxelSphereGenerator/voxelspheregenerator.py @@ -137,6 +137,7 @@ def voxelspheregenerator(WIDTH, HEIGH, DEPTH, WALL_THICKNESS=None, specific=None #layer_image.paste(dot, box=(pixel_coord_x, pixel_coord_y)) # Mark the corner pieces + furthest_y = math.floor(furthest_y) for y in range(furthest_y, math.ceil(RAD_Y-1)): for x in range(furthest_x, math.ceil(RAD_X-1)): is_corner = ( @@ -175,7 +176,7 @@ def voxelspheregenerator(WIDTH, HEIGH, DEPTH, WALL_THICKNESS=None, specific=None # Start at the center top of the circle and walk along the edge. # Every time the walker 'falls' down, mark the distance. def put_counterhelper(start_x, end_x, y): - if start_x == end_x: + if start_x > end_x: return y = (HEIGH + 1) - y span = end_x - start_x @@ -187,7 +188,7 @@ def voxelspheregenerator(WIDTH, HEIGH, DEPTH, WALL_THICKNESS=None, specific=None end_x = x start_y = None while x >= y and y < RAD_Y: - print(x, y, start_y) + #print(x, y, start_y) pixel = layer_matrix[x][y] if pixel is None: y += 1