-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
executable file
·46 lines (33 loc) · 1.14 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env python3
import curses
import scene_handler
import sys
import args_parser
import notebooks
handle_input = 0
def tsnb(stdscr, parsed_args):
# Initialize the colors
curses.use_default_colors()
curses.init_pair(1, -1, curses.COLOR_BLUE) # Selection
curses.init_pair(2, curses.COLOR_CYAN, -1) # Tree-Symbols
if parsed_args.notebook_id == None:
# Start off in notebook_selection_scene
import notebook_selection_scene
notebook_selection_scene.init(stdscr)
scene_handler.scene = notebook_selection_scene
else:
# Start off in selected notebook_editing_scene
import notebook_editing_scene
notebook_editing_scene.init(stdscr, parsed_args.notebook_id)
scene_handler.scene = notebook_editing_scene
run = True
while run:
scene_handler.scene.redraw(stdscr)
stdscr.refresh()
c = stdscr.getch()
run = scene_handler.scene.handle_input(stdscr, c)
notebooks.save_notebooks()
if __name__ == "__main__":
args = sys.argv[1:len(sys.argv)]
parsed_args = args_parser.parse(args)
curses.wrapper(tsnb, parsed_args)