Skip to main content

TreeView is a note taking that written to text file and view in tree-view outline.

Project description

TreeView

Writing an outline note with tree-view look.

Installation

pip install treeview-karjakak

Usage

from treeview import TreeView, conftv

# To configure the childs (by default 50 childs, and 4 spaces)
TreeView = conftv(TreeView, 5, 1)
print(dict(TreeView.childs))

w = 'Amazing Grace'
with TreeView('test') as tv:

    # First time write on note as parent
    tv.writetree(w)

    # Write it with loop in childs 
    for i in range(5):
        tv.quickchild(w, child = f'child{i+1}')
        
    # Edit the parent
    tv.edittree('Amazing Grace, how sweet the sound')
    print('-'* 12)
    tv.readtree()
    print('-'* 12)
    
    # Edit again in row 4 to child2
    tv.edittree('Mantaaaaaaap!', row = 4, child = 'child2')
    print('-'* 12)
    tv.readtree()
    print('-'* 12)
    
    # Write new parent
    tv.addparent('Wow good job')
    print('-'* 12)
    tv.readtree()
    print('-'* 12)
    
    # Edit again in row 6 to child5
    tv.edittree('Wow good job buddy', row = 6, child = 'child5')
    print('-'* 12)
    tv.readtree()
    print('-'* 12)
    
    # Write again new childs
    tv.quickchild('Totally awesome', child = 'child1')
    print('-'* 12)
    tv.readtree()
    print('-'* 12)
    tv.quickchild('This is quick child edit', child = 'child2')
    print('-'* 12)
    tv.readtree()
    print('-'* 12)
    tv.quickchild('Thank You', child = 'child1')
    print('-'* 12)
    tv.readtree()
    print('-'* 12)
    
    # Delete row 10
    tv.delrow(10)
    print('-'* 12)
    tv.readtree()
    print('-'* 12)
    
    # Insert to row 8 as child1
    tv.insertrow('God bless you', row = 8, child = 'child1' )
    print('-'* 12)
    tv.readtree()
    print('-'* 12)
    
    # Moving position from row 6 to row 4
    tv.movetree(6, 4)
    print('-'* 12)
    tv.readtree()
    print('-'* 12)
    
    # Moving position of child in row 6 as child1
    tv.movechild(6, child = 'child1')
    print('-'* 12)
    tv.readtree()
    print('-'* 12)
    
    # Print an iterator to dict
    pprint(dict(tv.insighttree()))
    
    # Create spaces between rows
    for i in range(1, tv.getdatanum()+4, 2):
        if i == 15:
            break
        tv.insertspace(i)
    print('-'* 12)
    tv.readtree()
    print('-'* 12)
    pprint(dict(tv.insighttree()))
    
    # Backup note as json file
    tv.backuptv()
    del tv, w, i

Result:

{'child1': 1, 'child2': 2, 'child3': 3, 'child4': 4, 'child5': 5}
------------
Amazing Grace, how sweet the sound:
 -Amazing Grace
  -Amazing Grace
   -Amazing Grace
    -Amazing Grace
     -Amazing Grace
------------
------------
Amazing Grace, how sweet the sound:
 -Amazing Grace
  -Amazing Grace
   -Amazing Grace
  -Mantaaaaaaap!
     -Amazing Grace
------------
------------
Amazing Grace, how sweet the sound:
 -Amazing Grace
  -Amazing Grace
   -Amazing Grace
  -Mantaaaaaaap!
     -Amazing Grace

Wow good job:
------------
------------
Amazing Grace, how sweet the sound:
 -Amazing Grace
  -Amazing Grace
   -Amazing Grace
  -Mantaaaaaaap!
     -Amazing Grace
     -Wow good job buddy

Wow good job:
------------
------------
Amazing Grace, how sweet the sound:
 -Amazing Grace
  -Amazing Grace
   -Amazing Grace
  -Mantaaaaaaap!
     -Amazing Grace
     -Wow good job buddy

Wow good job:
 -Totally awesome
------------
------------
Amazing Grace, how sweet the sound:
 -Amazing Grace
  -Amazing Grace
   -Amazing Grace
  -Mantaaaaaaap!
     -Amazing Grace
     -Wow good job buddy

Wow good job:
 -Totally awesome
  -This is quick child edit
------------
------------
Amazing Grace, how sweet the sound:
 -Amazing Grace
  -Amazing Grace
   -Amazing Grace
  -Mantaaaaaaap!
     -Amazing Grace
     -Wow good job buddy

Wow good job:
 -Totally awesome
  -This is quick child edit
 -Thank You
------------
------------
Amazing Grace, how sweet the sound:
 -Amazing Grace
  -Amazing Grace
   -Amazing Grace
  -Mantaaaaaaap!
     -Amazing Grace
     -Wow good job buddy

Wow good job:
 -Totally awesome
 -Thank You
------------
------------
Amazing Grace, how sweet the sound:
 -Amazing Grace
  -Amazing Grace
   -Amazing Grace
  -Mantaaaaaaap!
     -Amazing Grace
     -Wow good job buddy
 -God bless you

Wow good job:
 -Totally awesome
 -Thank You
------------
------------
Amazing Grace, how sweet the sound:
 -Amazing Grace
  -Amazing Grace
   -Amazing Grace
     -Wow good job buddy
  -Mantaaaaaaap!
     -Amazing Grace
 -God bless you

Wow good job:
 -Totally awesome
 -Thank You
------------
------------
Amazing Grace, how sweet the sound:
 -Amazing Grace
  -Amazing Grace
   -Amazing Grace
     -Wow good job buddy
  -Mantaaaaaaap!
 -Amazing Grace
 -God bless you

Wow good job:
 -Totally awesome
 -Thank You
------------
{0: ('parent', 'Amazing Grace, how sweet the sound:\n'),
 1: ('child1', '-Amazing Grace\n'),
 2: ('child2', '-Amazing Grace\n'),
 3: ('child3', '-Amazing Grace\n'),
 4: ('child5', '-Wow good job buddy\n'),
 5: ('child2', '-Mantaaaaaaap!\n'),
 6: ('child1', '-Amazing Grace\n'),
 7: ('child1', '-God bless you\n'),
 8: ('space', '\n'),
 9: ('parent', 'Wow good job:\n'),
 10: ('child1', '-Totally awesome\n'),
 11: ('child1', '-Thank You\n')}
------------
Amazing Grace, how sweet the sound:

 -Amazing Grace

  -Amazing Grace

   -Amazing Grace

     -Wow good job buddy

  -Mantaaaaaaap!

 -Amazing Grace

 -God bless you

Wow good job:
 -Totally awesome
 -Thank You
------------
{0: ('parent', 'Amazing Grace, how sweet the sound:\n'),
 1: ('space', '\n'),
 2: ('child1', '-Amazing Grace\n'),
 3: ('space', '\n'),
 4: ('child2', '-Amazing Grace\n'),
 5: ('space', '\n'),
 6: ('child3', '-Amazing Grace\n'),
 7: ('space', '\n'),
 8: ('child5', '-Wow good job buddy\n'),
 9: ('space', '\n'),
 10: ('child2', '-Mantaaaaaaap!\n'),
 11: ('space', '\n'),
 12: ('child1', '-Amazing Grace\n'),
 13: ('space', '\n'),
 14: ('child1', '-God bless you\n'),
 15: ('space', '\n'),
 16: ('parent', 'Wow good job:\n'),
 17: ('child1', '-Totally awesome\n'),
 18: ('child1', '-Thank You\n')}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

treeview-karjakak-1.7.5.tar.gz (10.5 kB view details)

Uploaded Source

Built Distribution

treeview_karjakak-1.7.5-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file treeview-karjakak-1.7.5.tar.gz.

File metadata

  • Download URL: treeview-karjakak-1.7.5.tar.gz
  • Upload date:
  • Size: 10.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.6

File hashes

Hashes for treeview-karjakak-1.7.5.tar.gz
Algorithm Hash digest
SHA256 cf28ad73b835c3e63ed7c0be2999a7e2bbae4edd1498ae0febd864a367e2c4ef
MD5 6e75861b78e54324846b78a65719b3d3
BLAKE2b-256 d39811b6f4cbb1a7a0be270956b533677990143f0e3162e02b3cdf6667f91b97

See more details on using hashes here.

File details

Details for the file treeview_karjakak-1.7.5-py3-none-any.whl.

File metadata

  • Download URL: treeview_karjakak-1.7.5-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.6

File hashes

Hashes for treeview_karjakak-1.7.5-py3-none-any.whl
Algorithm Hash digest
SHA256 367002fceb798f21ee4d5e6fbe7fe8877f04d4f265e789db97196b0cb69777a4
MD5 955a75fb252a1f9973749f9cf878bb90
BLAKE2b-256 1c633645c66c07ccc2931d306a94a8820c648e51a7bffd5e56351463f49e7260

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page