separate find_options from options
This commit is contained in:
parent
2f8c7d82c5
commit
c272cba222
23
src/tree.py
23
src/tree.py
|
@ -3,6 +3,7 @@ from pathlib import Path
|
||||||
|
|
||||||
from src.colors import RED, YELLOW, GREEN, CYAN , BLUE, PURPLE
|
from src.colors import RED, YELLOW, GREEN, CYAN , BLUE, PURPLE
|
||||||
import src.tree_repr as _tree_repr
|
import src.tree_repr as _tree_repr
|
||||||
|
import src.tree_find as _tree_find
|
||||||
|
|
||||||
class NerdTree():
|
class NerdTree():
|
||||||
'''
|
'''
|
||||||
|
@ -211,14 +212,15 @@ class NerdTree():
|
||||||
|
|
||||||
items = rootnode.get('children') or []
|
items = rootnode.get('children') or []
|
||||||
|
|
||||||
nodefound = rootnode.get('found')
|
if isinstance(self, _tree_find.NerdTreeFind):
|
||||||
if nodefound:
|
nodefound = rootnode.get('found')
|
||||||
if self.opts['dont_show_children_nodes'] or self.opts['show_subtree_info']:
|
if nodefound:
|
||||||
if rootnode.get('subtree_items'):
|
if self.find_opts['dont_show_children_nodes'] or self.find_opts['show_subtree_info']:
|
||||||
hnum, unit = _tree_repr.format(rootnode['subtree_size'])
|
if rootnode.get('subtree_items'):
|
||||||
nerd_tree_txt += ' (%s item(s)/%s%s ▾)' % (rootnode['subtree_items'], hnum, unit)
|
hnum, unit = _tree_repr.format(rootnode['subtree_size'])
|
||||||
|
nerd_tree_txt += ' (%s item(s)/%s%s ▾)' % (rootnode['subtree_items'], hnum, unit)
|
||||||
|
|
||||||
if self.opts['dont_show_children_nodes']: items = []
|
if self.find_opts['dont_show_children_nodes']: items = []
|
||||||
|
|
||||||
for n, item in enumerate(items):
|
for n, item in enumerate(items):
|
||||||
# if item['name'] in _tree_repr.ITEMS_TO_EXCLUDE:
|
# if item['name'] in _tree_repr.ITEMS_TO_EXCLUDE:
|
||||||
|
@ -241,9 +243,10 @@ class NerdTree():
|
||||||
treeline = _tree_repr.produce_treeline(prec_seps, (sep, {'name' : ' '})) + ' ' + self.tree_from_struct(item, prec_seps=seps)
|
treeline = _tree_repr.produce_treeline(prec_seps, (sep, {'name' : ' '})) + ' ' + self.tree_from_struct(item, prec_seps=seps)
|
||||||
else:
|
else:
|
||||||
treeline = _tree_repr.produce_treeline(prec_seps, (sep, item))
|
treeline = _tree_repr.produce_treeline(prec_seps, (sep, item))
|
||||||
if item.get('found') and self.opts['show_subtree_info']:
|
if isinstance(self, _tree_find.NerdTreeFind):
|
||||||
hnum, unit = _tree_repr.format(item['size'])
|
if item.get('found') and self.find_opts['show_subtree_info']:
|
||||||
treeline += ' (%s%s)' % (hnum, unit)
|
hnum, unit = _tree_repr.format(item['size'])
|
||||||
|
treeline += ' (%s%s)' % (hnum, unit)
|
||||||
|
|
||||||
nerd_tree_txt += '\n' + treeline
|
nerd_tree_txt += '\n' + treeline
|
||||||
|
|
||||||
|
|
|
@ -101,8 +101,8 @@ class NerdTreeFind(NerdTree):
|
||||||
dont_show_children_nodes = self.find_opts['dont_show_children_nodes'] if self.find_opts.get('dont_show_children_nodes') is not None else False
|
dont_show_children_nodes = self.find_opts['dont_show_children_nodes'] if self.find_opts.get('dont_show_children_nodes') is not None else False
|
||||||
show_subtree_info = self.find_opts['show_subtree_info'] if self.find_opts.get('show_subtree_info') is not None else False
|
show_subtree_info = self.find_opts['show_subtree_info'] if self.find_opts.get('show_subtree_info') is not None else False
|
||||||
|
|
||||||
self.opts['dont_show_children_nodes'] = dont_show_children_nodes
|
# self.opts['dont_show_children_nodes'] = dont_show_children_nodes
|
||||||
self.opts['show_subtree_info'] = show_subtree_info
|
# self.opts['show_subtree_info'] = show_subtree_info
|
||||||
|
|
||||||
|
|
||||||
tree_struct = {}
|
tree_struct = {}
|
||||||
|
|
Loading…
Reference in New Issue