Exemplo n.º 1
0
def accs_menu():
    while True:
        menu = Menu("back", "hal", "hl", "int", "rbs", title = "Accounts")
        choice = menu.show()
        if choice == "back": 
            return
        else:
            run_hssa("Acc: " + choice, ";")
Exemplo n.º 2
0
 def should_ud_all_menu():
     """Curses menu for should_update_all."""
     newmenu = Menu("Yes", "No", title="Update all existing repositories?")
     choice = newmenu.show()
     if choice:
         return choice == "Yes"
     # Choice is None, user pressed Q.
     print("Exiting.")
     quit()
Exemplo n.º 3
0
 def should_dl_all_menu():
     """Curses menu for should_download_all."""
     newmenu = Menu("Yes", "No", title="Download all repositories?")
     choice = newmenu.show()
     if choice:
         return choice == "Yes"
     # Choice is None, user pressed Q.
     print("Exiting.")
     quit()
Exemplo n.º 4
0
 def should_ud_repo_menu(repo_name):
     """Curses version of should_update_repository."""
     menu_title = "Repository {} already exists. Update?".format(repo_name)
     menu = Menu("Yes", "No", title=menu_title)
     choice = menu.show()
     if choice:
         return choice == "Yes"
     # Choice is None, user pressed Q.
     print("Exiting.")
     quit()
Exemplo n.º 5
0
def _curses_should_update_all():
    """Curses menu for should_update_all. Will be patched over should_update_all if needed."""
    # Create a menu, show it, and get the user's choice.
    newmenu = Menu("Yes", "No", title="Update all existing repositories?")
    choice = newmenu.show()
    if choice:
        return choice == "Yes"
    # Choice is None, user pressed Q.
    print("Exiting.")
    quit()
Exemplo n.º 6
0
def _curses_should_download_all():
    """Curses menu for should_download_all."""
    # Create a menu, show it, and get the user's choice.
    newmenu = Menu("Yes", "No", title="Download all repositories?")
    choice = newmenu.show()
    if choice:
        return choice == "Yes"
    # Choice is None, so the user pressed Q.
    print("Exiting.")
    quit()
Exemplo n.º 7
0
def edit_menu():
    while True:
        menu = Menu("back", "coms", "etrans", "ntrans", 
                    title = "Edit input files")
        choice = menu.show()
        if choice == "back": return
        editor = os.getenv("EDITOR")
        fname = os.getenv("REDACT") + "/docs/accts2014/data/" + choice + ".txt"
        #fname = "/home/mcarter/redact/docs/accts2014/data/" + choice + ".txt"
        os.system(editor + " " + fname)
Exemplo n.º 8
0
def _curses_should_update_all():
    """Curses menu for should_update_all. Will be patched over should_update_all if needed."""
    # Create a menu, show it, and get the user's choice.
    newmenu = Menu("Yes", "No", title="Update all existing repositories?")
    choice = newmenu.show()
    if choice:
        return choice == "Yes"
    # Choice is None, user pressed Q.
    print("Exiting.")
    quit()
Exemplo n.º 9
0
def _curses_should_download_all():
    """Curses menu for should_download_all."""
    # Create a menu, show it, and get the user's choice.
    newmenu = Menu("Yes", "No", title="Download all repositories?")
    choice = newmenu.show()
    if choice:
        return choice == "Yes"
    # Choice is None, so the user pressed Q.
    print("Exiting.")
    quit()
Exemplo n.º 10
0
def _curses_should_update_repository(repo_name):
    """Curses version of should_update_repository."""
    # Create a menu, show it, and get the user's choice.
    menu_title = "Repository {} already exists. Update?".format(repo_name)
    menu = Menu("Yes", "No", title=menu_title)
    choice = menu.show()
    if choice:
        return choice == "Yes"
    # Choice is None, user pressed Q.
    print("Exiting.")
    quit()
Exemplo n.º 11
0
def main_menu():
    while True:
        menu = Menu("quit", "view", "snap", "accs", "edit",
                    title = "Main menu")
        choice = menu.show()

        if choice == "quit" : return
        elif choice == "view": view_menu()
        elif choice == "snap": os.system('snap')
        elif choice == "accs": accs_menu()
        elif choice == "edit": edit_menu()
        else : raise KeyError("Not all main menu items have benn covered")
Exemplo n.º 12
0
def view_menu():
    while True:
        menu = Menu("back", "FINANCIALS", "EPICS", "DPSS", "ETB", "ETRANS", 
                    "PORTFOLIOS", "RETURNS", title = "View accounts")
        choice = menu.show()
        if choice == "back": 
            return
        #elif choice == "EPICS": 
        #    choice = "EPICS: ALL"
        else: 
            choice += ":"
        run_hssa(choice, ".")
Exemplo n.º 13
0
def _curses_should_download_repository(repo):
    """Curses version of should_download_repo."""
    # Create a menu, show it, and get the user's choice.
    menu = Menu("Download",
                "Skip",
                "Download All",
                title=repo['name'],
                subtitle=repo['description'])
    choice = menu.show()
    # Convert our menu choice into a program-readable single character.
    choice_dict = {"Download": "y", "Skip": "n", "Download All": "a"}
    if choice:
        return choice_dict[choice]
    # Choice is None, user pressed Q.
    quit()
Exemplo n.º 14
0
 def should_dl_repo_menu(repo):
     """Curses version of should_download_repo."""
     menu = Menu("Download",
                 "Skip",
                 "Download All",
                 title=repo['name'],
                 subtitle=repo['description'])
     choice = menu.show()
     # Required for interchangeability with non-curses input.
     choice_dict = {"Download": "y",
                    "Skip": "n",
                    "Download All": "a"}
     if choice:
         return choice_dict[choice]
     # Choice is None, user pressed Q.
     quit()
Exemplo n.º 15
0
def _curses_should_download_repository(repo):
    """Curses version of should_download_repo."""
    # Create a menu, show it, and get the user's choice.
    menu = Menu("Download",
                "Skip",
                "Download All",
                title=repo['name'],
                subtitle=repo['description'])
    choice = menu.show()
    # Convert our menu choice into a program-readable single character.
    choice_dict = {"Download": "y",
                   "Skip": "n",
                   "Download All": "a"}
    if choice:
        return choice_dict[choice]
    # Choice is None, user pressed Q.
    quit()
Exemplo n.º 16
0
#!/usr/bin/python3
from SimpleMenu import Menu

new_menu = Menu("Choice A",
                "Choice B",
                "Choice C",
                title="Title",
                subtitle="Subtitle (Press Q to quit)")

choice = new_menu.show()

if choice is not None:
    print("You chose {}.".format(choice))
else:
    print("You quit the program.")