Example #1
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))
 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)
 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)
Example #4
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
Example #5
0
#   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
bugs = {
  "core": [],
Example #6
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
Example #7
0
#   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)


# categories
Example #8
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