Beispiel #1
0
 def test_menu_2(test):
     setinput("1")
     result = show_menu(test.entries, returns="desc")
     test.assertEqual("foo", result)
Beispiel #2
0
 def test_menu_2(self):
     setinput("1")
     result = show_menu(self.entries, returns="desc")
     self.assertEqual("foo", result)
Beispiel #3
0
 def test_menu_1(test):
     setinput("1")
     result = show_menu(test.entries)
     test.assertEqual("1", result)
Beispiel #4
0
 def test_menu_1(self):
     setinput("1")
     result = show_menu(self.entries)
     self.assertEqual("1", result)
Beispiel #5
0
from qprompt import MenuEntry, show_menu, ask_yesno


def foo():
    print("foo")


def bar(a):
    print("bar %r" % (a))


val = {'a': 42}
entries = [MenuEntry("1", "Item A", foo, None, None)]
entries.append(MenuEntry("2", "Item B", bar, None, val))
entries.append(MenuEntry("q", "Quit", None, None, None))
compact = ask_yesno("Use compact menu?")
while "q" != show_menu(entries, compact=compact):
    pass
Beispiel #6
0
 def test_menu_2(test):
     setinput("1")
     result = show_menu(test.entries, returns="desc")
     test.assertEqual("foo", result)
Beispiel #7
0
 def test_menu_1(test):
     setinput("1")
     result = show_menu(test.entries)
     test.assertEqual("1", result)
Beispiel #8
0
from qprompt import MenuEntry, show_menu, ask_yesno
def foo():
    print("foo")
def bar(a):
    print("bar %r" % (a))
val = {'a':42}
entries = []
entries.append(MenuEntry("1", "Item A", foo, None, None))
entries.append(MenuEntry("2", "Item B", bar, None, val))
entries.append(MenuEntry("q", "Quit", None, None, None))
compact = ask_yesno("Use compact menu?")
while "q" != show_menu(entries, compact=compact):
    pass