Ejemplo n.º 1
0
 def test_menu_2(test):
     setinput("1")
     result = show_menu(test.entries, returns="desc")
     test.assertEqual("foo", result)
Ejemplo n.º 2
0
 def test_menu_2(self):
     setinput("1")
     result = show_menu(self.entries, returns="desc")
     self.assertEqual("foo", result)
Ejemplo n.º 3
0
 def test_menu_1(test):
     setinput("1")
     result = show_menu(test.entries)
     test.assertEqual("1", result)
Ejemplo n.º 4
0
 def test_menu_1(self):
     setinput("1")
     result = show_menu(self.entries)
     self.assertEqual("1", result)
Ejemplo n.º 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
Ejemplo n.º 6
0
 def test_menu_2(test):
     setinput("1")
     result = show_menu(test.entries, returns="desc")
     test.assertEqual("foo", result)
Ejemplo n.º 7
0
 def test_menu_1(test):
     setinput("1")
     result = show_menu(test.entries)
     test.assertEqual("1", result)
Ejemplo n.º 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