Exemplo n.º 1
0
 def draw_images_menu(self):
     menu_option = [img.tags for img in self.docker_client.images.list()]
     selection = SelectionMenu.get_selection(
         menu_option,
         title='Select an image to initialize container',
         subtitle='It is recommended to Save Image after running ' +
         'install script')
     return self.docker_client.images.list()[selection]
Exemplo n.º 2
0
    def test_current_menu(self):
        menu = []
        self.menu_thread = ThreadedReturnGetter(SelectionMenu.get_selection, args=[["One", "Two", "Three"]],
                                                kwargs={"_menu": menu})

        self.menu_thread.start()
        while not menu:
            continue
        menu = menu[0]
        menu.wait_for_start(10)
        self.assertIsInstance(CursesMenu.currently_active_menu, SelectionMenu)
        self.assertIs(CursesMenu.currently_active_menu, menu)

        selection_menu = SelectionMenu(strings=["a", "b", "c"], title="Select a letter")
        selection_menu.start()
        selection_menu.wait_for_start(10)
        self.assertIs(CursesMenu.currently_active_menu, selection_menu)
Exemplo n.º 3
0
 def draw_options_menu(self):
     menu_option = [
         'Open Terminal -- opens a terminal window attached to container',
         'Stop -- stops the container',
         'Save Image -- commits container to image',
         'Build Image -- runs docker build (caution)'
     ]
     selection = SelectionMenu.get_selection(menu_option)
     return selection
Exemplo n.º 4
0
def promptForRegion(regionData):
    regionNames = [region["data"]["name"] for region in regionData["regions"]]
    title = "Creating a new cluster. Select your Elastic Cloud region"
    selection = SelectionMenu.get_selection(regionNames, title=title)
    if selection > (len(regionNames) - 1):
        sys.exit("Canceled region selection")
    else:
        selectedRegion = regionData["regions"][selection]
        # print(selectedRegion)
        return selectedRegion["identifier"]
Exemplo n.º 5
0
 def prompt_device(cls):
     device_name = input("输入你的手机名字,空值是随机生成:") or choice(
         cls.random_device_list)
     carrier = cls.random_carrier_list[SelectionMenu.get_selection(
         cls.random_carrier_list, title="选择你的运营商:", exit_option=False)]
     android_version = input("输入你的系统版本号,空值是随机生成:") or choice(
         cls.random_android_version)
     os_name = f"{device_name}运营商:{carrier}\n{android_version}"
     device_id = input("输入手机的 IMEI,空值是随机生成:") or uuid4()
     return DeviceInfo(os_name, device_id)
Exemplo n.º 6
0
    def build_menu(self):
        '''
		Build a dynamic menu starting from the config
		read by a json converted to a dict
		'''
        self.layouts = self.get_layout_list(
            self.raw_json['globals']['layout_home'])
        selection_menu = SelectionMenu.get_selection(self.layouts)
        self.logger.info("[Dyn_menu] Selected the %s option: " %
                         self.layouts[int(selection_menu)])
        return self.layouts[int(selection_menu)]
 def test_init(self):
     selection_menu_1 = SelectionMenu(["1", "2", "3"])
     selection_menu_2 = SelectionMenu(["4", "5"], "selection_menu_2",
                                      "test_init", True)
     selection_menu_3 = SelectionMenu(strings=["6", "7", "8", "9"],
                                      title="selection_menu_3",
                                      subtitle="test_init",
                                      show_exit_option=False)
     self.assertIsNone(selection_menu_1.title)
     self.assertEqual(selection_menu_2.title, "selection_menu_2")
     self.assertEqual(selection_menu_3.title, "selection_menu_3")
     self.assertIsNone(selection_menu_1.subtitle)
     self.assertEqual(selection_menu_2.subtitle, "test_init")
     self.assertEqual(selection_menu_3.subtitle, "test_init")
     self.assertTrue(selection_menu_1.show_exit_option)
     self.assertTrue(selection_menu_2.show_exit_option)
     self.assertFalse(selection_menu_3.show_exit_option)
     self.assertEqual(selection_menu_1.items[1].text, "2")
     self.assertEqual(selection_menu_2.items[0].text, "4")
     self.assertEqual(selection_menu_3.items[3].text, "9")
Exemplo n.º 8
0
def selection_menu_example():
    bool_list = ['~/logs', '~/Backup']
    submenu2 = SelectionMenu(bool_list, "What directory location?")
    submenu2.show()
    submenu2.join()
    selection = submenu2.selected_option
    print('\nselection is: %s\n' % str(selection))
Exemplo n.º 9
0
def pick_release(all_versions):
    releases = list(all_versions.keys())
    if 'cursesmenu' in sys.modules:
        selection = SelectionMenu.get_selection(
            releases, title='Pick a release to verify')
        if selection < len(releases):
            version = releases[selection]
        else:
            sys.exit(0)
    else:
        print('  '.join(releases))
        version = input('enter version to sanity check: ')
    return all_versions[version]
Exemplo n.º 10
0
def step_impl(context):
    context.menu = CursesMenu("Test Menu", "Subtitle")
    context.menu_item = MenuItem("NORMAL", "Menu Item")
    context.menu.append_item(context.menu_item)
    context.function_item = FunctionItem("NORMAL", "Call a Python function",
                                         input, ["Enter an input"])
    context.menu.append_item(context.function_item)
    context.command_item = CommandItem("NORMAL", "Run a console command",
                                       "ipconfig /all")
    context.menu.append_item(context.command_item)
    context.selection_menu = SelectionMenu(["item1", "item2", "item3"])
    context.selection_submenu_item = SubmenuItem("NORMAL", "Submenu item",
                                                 context.selection_menu)
    context.menu.append_item(context.selection_submenu_item)
    pass
Exemplo n.º 11
0
    def __init__(self, stdscr):
        self.stdscr = stdscr

        self.docker_client = docker.from_env()

        # Check if docker server is running
        try:
            self.docker_client.info()
        except Exception:
            assert False, 'Is Docker server running?'

        # Attempt to load container, if can't then later ask user to select image
        self.container = None
        # If container is currently running
        if "RustyROS" in [
                x.name for x in self.docker_client.containers.list()
        ]:
            self.container = self.docker_client.containers.get('RustyROS')
        # Check if container is stopped, but still exists
        else:
            try:
                self.container = self.docker_client.containers.get('RustyROS')
                self.container.start()
            except Exception:
                self.container = None

        # if no docker images are avaliable, go ahead and build one
        if not self.docker_client.images.list():
            self.brand_new_docker_image()

        # attempt to find what kind of terminal emulator is being used
        self.terminal = None
        aval_term = self.find_avaliable_terminal()
        assert aval_term is not None, 'No terminal found'
        # Ask for a selection from user
        selection = SelectionMenu.get_selection(
            aval_term, title='Select a terminal')
        if selection > len(aval_term):
            return
        self.terminal = aval_term[selection]

        # run curses stuff
        self.draw()
    def test_current_menu(self):
        menu = []
        self.menu_thread = ThreadedReturnGetter(SelectionMenu.get_selection,
                                                args=[["One", "Two", "Three"]],
                                                kwargs={"_menu": menu})

        self.menu_thread.start()
        while not menu:
            continue
        menu = menu[0]
        menu.wait_for_start(timeout=10)
        self.assertIsInstance(CursesMenu.currently_active_menu, SelectionMenu)
        self.assertIs(CursesMenu.currently_active_menu, menu)

        selection_menu = SelectionMenu(strings=["a", "b", "c"],
                                       title="Select a letter")
        selection_menu.start()
        selection_menu.wait_for_start(timeout=10)
        self.assertIs(CursesMenu.currently_active_menu, selection_menu)
Exemplo n.º 13
0
import lh3.api
import os
import sys
import tempfile

parser = argparse.ArgumentParser(description='Edit users')
parser.add_argument('-u', '--username', help='user name')

args = parser.parse_args()
client = lh3.api.Client()

users = client.all('users').get_list()
if args.username:
    user = next(user for user in users if user['name'] == args.username)
else:
    selection = SelectionMenu.get_selection([user['name'] for user in users])
    user = users[selection]

details = client.api().get('v1', '/users/{}'.format(user['id']))
print(details)

_, temp = tempfile.mkstemp(suffix='.tmp')
with open(temp, 'w') as f:
    f.write("name: {}\n".format(user['name']))
    for k, v in details.items():
        f.write("{}: {}\n".format(k, v))
    f.write("password:\n")
    f.flush()

EDITOR = os.environ.get('EDITOR', 'vim')
call([EDITOR, temp])
Exemplo n.º 14
0
 def test_select(self):
     selection_menu = SelectionMenu(strings=["a", "b", "c"], title="Select a letter")
     selection_menu.start()
     selection_menu.wait_for_start(timeout=10)
     selection_menu.go_down()
     selection_menu.select()
     selection_menu.join(timeout=10)
     self.assertFalse(selection_menu.is_alive())
     self.assertEqual(selection_menu.selected_option, 1)
Exemplo n.º 15
0
# requirements:
#   PyGithub
#   curses-menu
#
from github import Github
from cursesmenu import SelectionMenu

# config
g = Github("add token with public repo read rights here")
org = g.get_organization("ComputationalRadiationPhysics")
repo = org.get_repo("picongpu")
milestones = repo.get_milestones(sort="asc", state="all")

m_list = map(lambda m: m.title, milestones)
print(list(m_list))
menu = SelectionMenu(m_list, "Select a Milestone")
menu.show()
menu.join()
m_sel = menu.selected_option

print(m_list[m_sel], milestones[m_sel].number)

# get pulls (all pulls are also issues but not vice versa)
issues = repo.get_issues(state="closed", sort="updated", direction="asc", milestone=milestones[m_sel])
# Use this in the future, but pagination seems broken in it:
#search_string = 'repo:ComputationalRadiationPhysics/picongpu type:pr is:merged milestone:"'+milestones[m_sel].title+'"'
#print(search_string)
#issues = g.search_issues(search_string)


# categories
Exemplo n.º 16
0
                        required=True)
    args = parser.parse_args()

    #####################################################
    #####################################################
    print ("1. Loading Dataset")
    dataset = ds.PinterestDataset(args.dataset)
    dataset.init_from_file()

    cfg_folder = os.path.join(dataset.dnn_dir, "_configs")
    config_list = [f for f in os.listdir(cfg_folder)
                   if os.path.isfile(os.path.join(cfg_folder, f))]

    selection = \
        SelectionMenu.get_selection(config_list, title='DNN - Trainer',
                                    subtitle="Please select configuration file\
                                              from list", exit_option=True)
    if selection == len(config_list):
        print ("No choice made. Exit...")
        exit()

    # Some General Config
    with open(os.path.join(cfg_folder, config_list[selection]), 'r') \
            as outfile:
        config = json.load(outfile)

    print ("Selected Config File:", config_list[selection])

    for key, val in config["meta"].iteritems():
        print ('\t{0:<20} :: {1:<50}'.format(key, val))
Exemplo n.º 17
0
            return release['assets']


def gpg_sanity_check():
    pass


# main starts here for now
signal.signal(signal.SIGINT, signal_handler)

all_release_info = augur_app_all_releases()
release_versions = all_release_versions(all_release_info)

# promt for version
if 'cursesmenu' in sys.modules:
    selection = SelectionMenu.get_selection(release_versions,
                                            title='Pick a release to verify')
    if selection < len(release_versions):
        version = release_versions[selection]
    else:
        sys.exit(0)
else:
    print('  '.join(release_versions))
    version = input('enter version to sanity check')

file_extensions = ['dmg', 'deb', 'exe', 'snap']
assets = assets_for_version(all_release_info, version)

headers['Accept'] = 'application/octet-stream'

comparison = {}
for asset in assets:
Exemplo n.º 18
0
def make_character():
    race = list(race_trait.keys())
    Class = list(class_ability.keys())

    #Pick Race
    menu = SelectionMenu(race,'Select a Race:',show_exit_option=False)
    menu.show()
    menu.join()
    selection = menu.selected_option
    character['race'] = race[selection]

    #Pick Class
    menu = SelectionMenu(Class,'Select a Class:',show_exit_option=False)
    menu.show()
    menu.join()
    selection = menu.selected_option
    character['class'] = Class[selection]

    #Assign initial abilities and characteristics
    character['age'] = random.randint(int(race_trait[character['race']]['min_age']),\
                                int(race_trait[character['race']]['max_age']))
    character['str'] = random.randint(3,18)
    character['int'] = random.randint(3,18)
    character['dex'] = random.randint(3,18)
    character['con'] = random.randint(3,18)
    character['wis'] = random.randint(3,18)
    character['cha'] = random.randint(3,18)
    character['numHD'] = 1
    character['level'] = 1
    character['xp'] = 0
    character['ac'] = 10

    #Determine starting Gold
    character['gold'] = 0
    rolls = 0
    wealth_rolls = int(class_ability[character['class']]['WR'])
    while rolls < wealth_rolls:
        rolls += 1
        character['gold'] += random.randint(1,4) * 10
        #print(f"{character['gold']} after roll {rolls}.")
        #input()
    character['max_hp'] = calc_initial_abilities(character)
    character['hp'] = character['max_hp']
    #Reduce initial max_hp to test healing
    #if character['max_hp'] < 6:
    #    character['hp'] = character['max_hp']
    #else:
    #    character['hp'] = character['max_hp'] - 5

    return race, Class
Exemplo n.º 19
0
    def brand_new_docker_image(self):
        if os.path.isfile('./.Dockerfile_old'):
            assert False, 'Previous build abruptly closed. "git log" and remove bad files, or git reset'
        self.stdscr.clear()

        # Check if user has an ssh directory
        ssh_dir = os.path.expanduser("~/.ssh")
        if os.path.isdir(ssh_dir):
            # Store all files in a list
            ssh_key_files = [
                f for f in os.listdir(ssh_dir)
                if os.path.isfile(os.path.join(ssh_dir, f))
            ]
            # Ask for a selection from user
            selection = SelectionMenu.get_selection(
                ssh_key_files,
                title='Select a ssh key (i.e. for github)?',
                subtitle='This will copy the selected ssh key to docker image')
            # Check if user did not select exit
            if (selection < len(ssh_key_files)):
                # Copy the ssh key to relative path for docker
                shutil.copy(ssh_dir + '/' + ssh_key_files[selection], '.')
                # Replace the template placeholder with correct key and location
                with open('./Dockerfile', 'r') as input_file, open(
                        './.Dockerfile_tmp', 'w') as output_file:
                    for line in input_file:
                        if line.strip() == '# COPY ssh_github_key':
                            output_file.write(
                                'COPY ' + ssh_key_files[selection] +
                                ' /home/mil/.ssh/' + ssh_key_files[selection] +
                                '\n')
                        else:
                            output_file.write(line)

                    # Store the old Dockerfile
                    shutil.copy('./Dockerfile', './.Dockerfile_old')
                    # Replace the orignal Dockerfile with filled-template file
                    os.rename('./.Dockerfile_tmp', './Dockerfile')

        self.stdscr.clear()
        height, width = self.stdscr.getmaxyx()
        text = "Building image..." [:width - 1]
        text1 = "To view build process:" [:width - 1]
        text2 = "docker ps" [:width - 1]
        text3 = "docker attach NAME" [:width - 1]

        # Find center of window
        x = int((width // 2) - (len(text) // 2) - len(text) % 2)
        y = int((height // 2) - 2)

        self.stdscr.addstr(y, x, text)
        self.stdscr.addstr(y + 1, x, text1)
        self.stdscr.addstr(y + 2, x, text2)
        self.stdscr.addstr(y + 3, x, text3)
        self.stdscr.refresh()

        # Assume dockerfile is in the same relative directory
        self.docker_client.images.build(path='./', tag='mil_image:latest')

        # If user made a selection for ssh key
        if os.path.isfile(
                './.Dockerfile_old') and selection < len(ssh_key_files):
            # Return back to the original Dockerfile
            os.rename('./.Dockerfile_old', './Dockerfile')
            # Delete the copy of ssh key
            os.remove(ssh_key_files[selection])
Exemplo n.º 20
0
# _menu["store-list"]=["SHA", "JEW", "INT"]
# _menu["l3fwrules"] = ["l3fwrules_004", "l3fwrules_005", "l3fwrules_006", "l3fwrules_007"]

_menu["main"] = [
    "networks", "stores", "l3fwrules", "s2svpnrules", "vlans", "convert"
]
_menu["networks"] = ["actions", "settings"]
_menu["stores"] = ["actions", "settings"]
_menu["l3fwrules"] = ["actions", "settings"]
_menu["s2s"] = ["actions", "settings"]
_menu["networks"] = ["actions", "settings"]
_menu["store-list"] = ["SHA", "JEW", "INT"]
_menu["l3fwrules"] = [
    "l3fwrules_004", "l3fwrules_005", "l3fwrules_006", "l3fwrules_007"
]

menu_in_use = _menu["main"]

while True:
    selection = SelectionMenu.get_selection(menu_in_use)
    # print (selection)
    # time.sleep(3)
    if selection == len(menu_in_use):
        os._exit(0)
    item = menu_in_use[selection]
    curses.wrapper(draw, item)
    if menu_in_use is _menu["main"]:
        menu_in_use = _menu[item]
    else:
        menu_in_use = _menu["main"]
Exemplo n.º 21
0
	def gameMode(self):
		game_list = ["Host A New Game", "Connect To A Game"]
		menu = SelectionMenu(game_list, "CHESS")
		menu.show()
		menu.join()
		self._gameType = menu.selected_option
Exemplo n.º 22
0
    def process_inbox(self):
        """Display interactive prompts for user to process inbox items."""

        # FIFO. For each item, the user will be guided
        # by interactive prompts to create a new item based on inbox item. New
        # item will be given same timestamp as the inbox item. (Conceptually, the
        # item is being 'moved' or 'changed'.) When item is successfully
        # processed, it will be dequeued (removed), and loop will continue with
        # next (now first) item in queue. Loop until no items are left.

        d = self.d['inbox'].items
        inbox = deque(d.keys())

        while len(inbox):
            key = inbox[0]
            menu_title = f"[Inbox Item]: {d[key]['title']}"
            menu_subtitle = f"What is it? ({len(inbox)-1} items remaining)')"
            selections = [
                ("Next Action: It can be done in one step"),  # 0
                (
                    "Do It Now: It will take less than 2 minutes, so "  # 1
                    "do it!"),
                ("Calendar: It happens on a specific date/time"),  # 2
                ("Waiting For: Someone else needs to do it"),  # 3
                (
                    "Projects: It's an outcome that will take multiple "  # 4
                    "steps to accomplish"),
                (
                    "Maybe Someday: You're not fully committed to doing it "  # 5
                    "yet, but might want to think about it again later."),
                ("Delete: It's not important. Forget about it."),  # 6
                ("Skip")  # 7
            ]
            menu = SelectionMenu(selections,
                                 title=menu_title,
                                 subtitle=menu_subtitle)
            menu.show()
            menu.join()
            selection = menu.selected_option

            if selection == 0:  # Next Action
                self.d['next_actions'].i_new_item(key)
                taskID = inbox.popleft()
                quickstart.delete_g_task(taskID, 'inbox')
                continue
            elif selection == 1:  # Do in 2 Min
                print("Do it now!")
                input("Press any key to start 2 min timer...")
                timer(120)
                done = input("Done? (y/n): ").lower()
                if 'y' in done:
                    taskID = inbox.popleft()
                    quickstart.complete_g_task(taskID, 'inbox')
                else:
                    continue  # repeat loop with same item
            elif selection == 2:  # Calendar
                self.d['calendar'].i_new_item(key)
                taskID = inbox.popleft()
                quickstart.delete_g_task(taskID, 'inbox')
                continue
            elif selection == 3:  # Waiting For
                self.d['waiting_for'].i_new_item(key)
                taskID = inbox.popleft()
                quickstart.delete_g_task(taskID, 'inbox')
                continue
            elif selection == 4:  # Project
                self.d['projects'].i_new_item(key)
                taskID = inbox.popleft()
                quickstart.delete_g_task(taskID, 'inbox')
                continue
            elif selection == 5:  # Maybe Someday
                self.d['maybe_someday'].add(d[key]['title'], key)
                taskID = inbox.popleft()
                quickstart.delete_g_task(taskID, 'inbox')
                continue
            # elif 'r' in actionable:
            #     # TODO: add reference list
            #     print('Not implemented')
            #     continue
            elif selection == 6:  # Delete
                taskID = inbox.popleft()
                quickstart.delete_g_task(taskID, 'inbox')
                print('Item deleted.')
                continue
            elif selection == 7:  # Skip
                print(
                    "SKIPPING NOT ALLOWED! You must process Inbox items "
                    "one by one, FIFO. You'll have to make a decision "
                    "eventually...do it now. You can decide to not decide..."
                    " That's ok. Choose Maybe Someday. Say, 'I'm choosing not "
                    "to commit to this right now. Maybe I'll reconsider at "
                    "a later time.")
            else:
                break
Exemplo n.º 23
0
import os
import sys
import tempfile

parser = argparse.ArgumentParser(description='Edit a FAQ template')
parser.add_argument('-f', '--faq', help='faq name')
parser.add_argument('-t', '--template', help='template name')

args = parser.parse_args()
client = lh3.api.Client()

faqs = client.all('faqs').get_list()
if args.faq:
    faq = (faq for faq in faqs if faq['name'] == faq_name).next()
else:
    selection = SelectionMenu.get_selection([f['name'] for f in faqs])
    faq = faqs[selection]

faq_id = faq['id']
templates = client.one(
    'faqs', faq_id).all('templates').get_list(params={'format': 'json'})
if args.template:
    template_name = args.template
    if template_name.find('.html') == -1:
        template_name += '.html'
    template_name = unicode(template_name, 'utf-8')
    template = (template for template in templates
                if template['name'] == template_name).next()
else:
    selection = SelectionMenu.get_selection([t['name'] for t in templates])
    template = templates[selection]
Exemplo n.º 24
0
def step_impl(context):
    context.selection_menu = SelectionMenu(["item1", "item2", "item3"])
    context.selection_submenu_item = SubmenuItem("NORMAL", "Submenu item",
                                                 context.selection_menu)
    context.menu.append_item(context.selection_submenu_item)
    pass
Exemplo n.º 25
0
# Create the menu
menu = CursesMenu("Title", "Subtitle")

# Create some items

# MenuItem is the base class for all items, it doesn't do anything when selected
menu_item = MenuItem("Menu Item")

# A FunctionItem runs a Python function when selected
function_item = FunctionItem("Call a Python function", input,
                             ["Enter an input"])

# A CommandItem runs a console command
command_item = CommandItem("Run a console command", "touch hello.txt")

# A SelectionMenu constructs a menu from a list of strings
selection_menu = SelectionMenu(["item1", "item2", "item3"])

# A SubmenuItem lets you add a menu (the selection_menu above, for example)
# as a submenu of another menu
submenu_item = SubmenuItem("Submenu item", selection_menu, menu)

# Once we're done creating them, we just add the items to the menu
menu.append_item(menu_item)
menu.append_item(function_item)
menu.append_item(command_item)
menu.append_item(submenu_item)

# Finally, we call show to show the menu and allow the user to interact
menu.show()
Exemplo n.º 26
0
# requirements:
#   PyGithub
#   curses-menu
#
from github import Github
from cursesmenu import SelectionMenu

# config
#          see: https://github.com/settings/tokens
g = Github("add token with public repo read rights here")
org = g.get_organization("ComputationalRadiationPhysics")
repo = org.get_repo("picongpu")
milestones = repo.get_milestones(sort="asc", state="all")

m_list = list(map(lambda m: m.title, milestones))
menu = SelectionMenu(m_list, "Select a Milestone")
menu.show()
menu.join()
m_sel = menu.selected_option

print(m_list[m_sel], milestones[m_sel].number)

# get pulls (all pulls are also issues but not vice versa)
issues = repo.get_issues(state="closed", sort="updated", direction="asc",
                         milestone=milestones[m_sel])
# Use this in the future, but pagination seems broken in it:
# search_string = 'repo:ComputationalRadiationPhysics/picongpu ' +
#                 'type:pr is:merged milestone:"'+milestones[m_sel].title+'"'
# print(search_string)
# issues = g.search_issues(search_string)
Exemplo n.º 27
0

def third_selection(res):
    for names in res.keys():
        with open(f'{names}.txt', 'w') as text_file:
            print(
                f'Dear {names},\nThank you for your very kind donation of ${sum(res[names])}.\nIt will be put to very good use.\nSincerely,\n-The Team',
                file=text_file)


if __name__ == "__main__":
    donors = {
        'Batman': [100, 50, 30],
        'Ironman': [70, 80],
        'Hulk': [10],
        'Spiderman': [40, 20],
        'Superman': [40, 60, 10]
    }
    a_list = [
        'Send a Thank You', 'Create a Report', 'Send letters to everyone'
    ]
    selection_dict = {
        0: first_selection,
        1: second_selection,
        2: third_selection
    }
    while True:
        selection = SelectionMenu.get_selection(a_list)
        if selection == 3:
            break
        selection_dict.get(selection)(donors)
 def test_select(self):
     selection_menu = SelectionMenu(strings=["a", "b", "c"],
                                    title="Select a letter")
     selection_menu.start()
     selection_menu.wait_for_start(timeout=10)
     selection_menu.go_down()
     selection_menu.select()
     selection_menu.join(timeout=10)
     self.assertFalse(selection_menu.is_alive())
     self.assertEqual(selection_menu.selected_option, 1)