-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainExample.py
More file actions
65 lines (51 loc) · 1.61 KB
/
mainExample.py
File metadata and controls
65 lines (51 loc) · 1.61 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Main program
Created on March 20 2019
@author: Jesús Cid Sueiro
"""
import os
import pathlib
import argparse
# Local imports
from code.menu_navigator.menu_navigator import MenuNavigator
from code.task_manager import TaskManager
# ########################
# Main body of application
# ########################
# ####################
# Read input arguments
# settings
parser = argparse.ArgumentParser()
parser.add_argument('--p', type=str, default=None,
help="path to a new or an existing project")
parser.add_argument('--source', type=str, default='../source_data',
help="path to the source data folder")
args = parser.parse_args()
# Read project_path
project_path = args.p
if args.p is None:
while project_path is None or project_path == "":
project_path = input('-- Write the path to the project to load or '
'create: ')
if os.path.isdir(args.p):
option = 'load'
else:
option = 'create'
active_options = None
query_needed = False
# Create task manager object
tm = TaskManager(project_path, path2source=args.source)
# ########################
# Prepare user interaction
# ########################
paths2data = {'input': pathlib.Path('example_folder', 'input'),
'imported': pathlib.Path('example_folder', 'imported')}
path2menu = pathlib.Path('config', 'options_menu.yaml')
# ##############
# Call navigator
# ##############
menu = MenuNavigator(tm, path2menu, paths2data)
menu.front_page(title="An Application example using menuNavigator")
menu.navigate(option, active_options)