Example showing tree progress view
515837
def tree():
    """"""

    #############
    # Test data #
    #############

    # For this example, we're obviously going to be feeding fictitious data
    #   to ProgressTree, so here it is
    leaf_values = [Value(0) for i in range(6)]
    bd_defaults = dict(type=Bar, kwargs=dict(max_value=10))

    test_d = {
        "Warp Jump": {
            "1) Prepare fuel": {
                "Load Tanks": {
                    "Tank 1": BarDescriptor(value=leaf_values[0], **bd_defaults),
                    "Tank 2": BarDescriptor(value=leaf_values[1], **bd_defaults),
                },
                "Refine tylium ore": BarDescriptor(
                    value=leaf_values[2], **bd_defaults
                ),
            },
            "2) Calculate jump co-ordinates": {
                "Resolve common name to co-ordinates": {
                    "Querying resolution from baseship": BarDescriptor(
                        value=leaf_values[3], **bd_defaults
                    ),
                },
            },
            "3) Perform jump": {
                "Check FTL drive readiness": BarDescriptor(
                    value=leaf_values[4], **bd_defaults
                ),
                "Juuuuuump!": BarDescriptor(value=leaf_values[5],
                                            **bd_defaults)
            }
        }
    }

    # We'll use this function to bump up the leaf values
    def incr_value(obj):
        for val in leaf_values:
            if val.value < 10:
                val.value += 1
                break

    # And this to check if we're to stop drawing
    def are_we_done(obj):
        return all(val.value == 10 for val in leaf_values)

    ###################
    # The actual code #
    ###################

    # Create blessings.Terminal instance
    t = Terminal()
    # Initialize a ProgressTree instance
    n = ProgressTree(term=t)
    # We'll use the make_room method to make sure the terminal
    #   is filled out with all the room we need
    n.make_room(test_d)

    while not are_we_done(test_d):
        sleep(0.2 * random.random())
        # After the cursor position is first saved (in the first draw call)
        #   this will restore the cursor back to the top so we can draw again
        n.cursor.restore()
        # We use our incr_value method to bump the fake numbers
        incr_value(test_d)
        # Actually draw out the bars
        n.draw(test_d, BarDescriptor(bd_defaults))
766450
def progress_patch(self, _=False):
        
        from .progress import ShellProgressView
        self.cli_ctx.progress_controller.init_progress(ShellProgressView())
        return self.cli_ctx.progress_controller
584201
private void adaptProgressBar() {
        LayoutInflater inflater = LayoutInflater.from(getContext());
        View view = inflater.inflate(getCustomMessageId(), getRootView(), false);
        getDialog().setCustomMessage(view);
        View progressView = view.findViewById(R.id.progress_bar);
        progressBar =
                progressView instanceof CircularProgressBar ? (CircularProgressBar) progressView :
                        null;
        adaptProgressBarColor();
        adaptProgressBarSize();
        adaptProgressBarThickness();
        adaptMessageTextSize();
    }
739644
public static void main(String[] args) {
		// get the sample tree
		TreeForTreeLayout<TextInBox> tree = SampleTreeFactory
				.createSampleTree();

		// setup the tree layout configuration
		double gapBetweenLevels = 50;
		double gapBetweenNodes = 10;
		DefaultConfiguration<TextInBox> configuration = new DefaultConfiguration<TextInBox>(
				gapBetweenLevels, gapBetweenNodes);

		// create the NodeExtentProvider for TextInBox nodes
		TextInBoxNodeExtentProvider nodeExtentProvider = new TextInBoxNodeExtentProvider();

		// create the layout
		TreeLayout<TextInBox> treeLayout = new TreeLayout<TextInBox>(tree,
				nodeExtentProvider, configuration);

		// Generate the SVG and write it to System.out
		SVGForTextInBoxTree generator = new SVGForTextInBoxTree(treeLayout);
		System.out.println(generator.getSVG());
	}
242348
def progress_indicator(self, fmt=None, interval=100, values=None):
        
        return ProgressIndicator(self.io, fmt, interval, values)
572277
def main(self, standalone=False):
        
        window = _Tkinter.Tk()
        sc = _TreeWidget.ScrolledCanvas(window, bg="white",\
                                       highlightthickness=0, takefocus=1)
        sc.frame.pack(expand=1, fill="both")
        item = _ReferrerTreeItem(window, self.get_tree(), self)
        node = _TreeNode(sc.canvas, None, item)
        node.expand()
        if standalone:
            window.mainloop()
91795
def _progress_aware(self):
        """"""
        from dvc.progress import progress

        if not progress.is_finished:
            progress._print()
        progress.clearln()
1265470
private static void displayInventoryTree(AdUnit root, Map<String, List<AdUnit>> treeMap) {
    displayInventoryTreeHelper(root, treeMap, 0);
  }
516849
def set_tree(self, tree):
        
        self.tree = tree
        self.__record_progress(Status.DOWNLOAD_FILES)
914987
def tree(self):
        
        self.msg.template(78)
        print("| Dependencies\n"
              "| -- Packages")
        self.msg.template(78)
        self.data()
        for pkg, dep in self.dmap.iteritems():
            print("+ {0}{1}{2}".format(self.green, pkg, self.endc))
            print("|")
            for d in dep:
                print("+-- {0}".format(d))
                print("|")
            sys.stdout.write("\x1b[1A{0}\n".format(" "))
            sys.stdout.flush()
        self.summary()
        if self.image:
            Graph(self.image).dependencies(self.dmap)
384742
def treewalk(self, root, parsed, unparsed):
        
        suggestions = dict()
        if not unparsed:
            logger.debug("no tokens left unparsed. returning %s, %s", parsed, suggestions)
            return parsed, unparsed, suggestions

        token = unparsed.pop().strip()
        logger.debug("begin parsing at %s w/ tokens: %s", root.node, unparsed)
        if root.node == token:
            logger.debug("root node: %s matches next token:%s", root.node, token)
            parsed.append(token)
            if self.peekForOption(unparsed):  # check for localFlags and globalFlags
                logger.debug("option(s) upcoming %s", unparsed)
                parsed_opts, unparsed, suggestions = self.evalOptions(root, list(), unparsed[:])
                if parsed_opts:
                    logger.debug("parsed option(s): %s", parsed_opts)
                    parsed.extend(parsed_opts)
            if unparsed and not self.peekForOption(unparsed):  # unparsed bits without options
                logger.debug("begin subtree %s parsing", root.node)
                for child in root.children:
                    parsed_subtree, unparsed, suggestions = self.treewalk(child, list(), unparsed[:])
                    if parsed_subtree:  # subtree returned further parsed tokens
                        parsed.extend(parsed_subtree)
                        logger.debug("subtree at: %s has matches. %s, %s", child.node, parsed, unparsed)
                        break
                else:
                    # no matches found in command tree
                    # return children of root as suggestions
                    logger.debug("no matches in subtree: %s. returning children as suggestions", root.node)
                    for child in root.children:
                        suggestions[child.node] = child.help
        else:
            logger.debug("no token or option match")
            unparsed.append(token)
        return parsed, unparsed, suggestions
173843
function (e, data) {
                var $this = $(this),
                    progress = Math.floor(data.loaded / data.total * 100),
                    globalProgressNode = $this.find('.fileupload-progress'),
                    extendedProgressNode = globalProgressNode
                        .find('.progress-extended');
                if (extendedProgressNode.length) {
                    extendedProgressNode.html(
                        ($this.data('blueimp-fileupload') || $this.data('fileupload'))
                            ._renderExtendedProgress(data)
                    );
                }
                globalProgressNode
                    .find('.progress')
                    .attr('aria-valuenow', progress)
                    .find('.bar').css(
                        'width',
                        progress + '%'
                    );
            }
43331
def create_tree_view(self, model=None):
        
        tree_view = Gtk.TreeView()
        if model is not None:
            tree_view.set_model(model)
        return tree_view
1297478
def progress_bar(items_total, items_progress, columns=40, base_char='.', progress_char='#', percentage=False, prefix='', postfix=''):
    
    bins_total = int(float(items_total) / columns) + 1
    bins_progress = int((float(items_progress) / float(items_total)) * bins_total) + 1
    progress = prefix
    progress += progress_char * bins_progress
    progress += base_char * (bins_total - bins_progress)
    if percentage:
        progress_percentage = float(items_progress) / float(items_total) * 100
        # Round the percentage to two decimals
        postfix = ' ' + str(round(progress_percentage, 2)) + '% ' + postfix
    progress += postfix
    return progress
447254
def visualize(tree, max_level=100, node_width=10, left_padding=5):
    

    height = min(max_level, tree.height()-1)
    max_width = pow(2, height)

    per_level = 1
    in_level  = 0
    level     = 0

    for node in level_order(tree, include_all=True):

        if in_level == 0:
            print()
            print()
            print(' '*left_padding, end=' ')

        width = int(max_width*node_width/per_level)

        node_str = (str(node.data) if node else '').center(width)
        print(node_str, end=' ')

        in_level += 1

        if in_level == per_level:
            in_level   = 0
            per_level *= 2
            level     += 1

        if level > height:
            break

    print()
    print()
204808
def progress(arr, options = {})
      bar = ProgressBar.new arr.length, options
      bar.show
      arr.each { |v| bar.increment yield(v) }
    end
1350707
private long grow(PrintStream out, List<ItemSet> list, TotalSupportTree ttree, FPTree.Node node, int[] itemset, int support) {
        int height = 0;
        for (FPTree.Node currentNode = node; currentNode != null; currentNode = currentNode.parent) {
            height ++;
        }

        int n = 0;
        if (height > 0) {
            int[] items = new int[height];
            int i = 0;
            for (FPTree.Node currentNode = node; currentNode != null; currentNode = currentNode.parent) {
                items[i ++] = currentNode.id;
            }

            int[] itemIndexStack = new int[height];
            int itemIndexStackPos = 0;
            itemset = insert(itemset, items[itemIndexStack[itemIndexStackPos]]);
            collect(out, list, ttree, itemset, support);
            n ++;
            while (itemIndexStack[0] < height - 1) {
                if (itemIndexStack[itemIndexStackPos] < height - 1) {
                    itemIndexStackPos ++;
                    itemIndexStack[itemIndexStackPos] = itemIndexStack[itemIndexStackPos - 1] + 1;
                    itemset = insert(itemset, items[itemIndexStack[itemIndexStackPos]]);
                    collect(out, list, ttree, itemset, support);
                    n ++;
                } else {
                    itemset = drop(itemset);
                    if (itemset != null) {
                        itemIndexStackPos --;
                        itemIndexStack[itemIndexStackPos] = itemIndexStack[itemIndexStackPos] + 1;
                        itemset[0] = items[itemIndexStack[itemIndexStackPos]];
                        collect(out, list, ttree, itemset, support);
                        n ++;
                    }
                }
            }
        }

        return n;
    }