當前位置: 首頁>>代碼示例>>Python>>正文


Python termenu.Termenu類代碼示例

本文整理匯總了Python中termenu.Termenu的典型用法代碼示例。如果您正苦於以下問題:Python Termenu類的具體用法?Python Termenu怎麽用?Python Termenu使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Termenu類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_scroll_bottom_cursor_top

 def test_scroll_bottom_cursor_top(self):
     menu = Termenu(OPTIONS, height=3)
     menu.scroll = len(OPTIONS) - 3
     menu.cursor = 0
     assert strmenu(menu) == "(97) 98 99"
     menu._on_up()
     assert strmenu(menu) == "(96) 97 98"
開發者ID:koreno,項目名稱:termenu,代碼行數:7,代碼來源:test.py

示例2: test_scroll_almost_bottom_cursor_bottom

 def test_scroll_almost_bottom_cursor_bottom(self):
     menu = Termenu(OPTIONS, height=4)
     menu.scroll = len(OPTIONS) - 5
     menu.cursor = 3
     assert strmenu(menu) == "95 96 97 (98)"
     menu._on_pageDown()
     assert strmenu(menu) == "96 97 98 (99)"
開發者ID:koreno,項目名稱:termenu,代碼行數:7,代碼來源:test.py

示例3: test_multiple_plugins_no_call_prev

 def test_multiple_plugins_no_call_prev(self):
     plugins = [self.SamplePlugin(False), self.SamplePlugin(False), self.SamplePlugin(False)]
     menu = Termenu(OPTIONS, height=4, plugins=plugins)
     assert strmenu(menu) == "(01) 02 03 04"
     menu._on_key("down")
     assert strmenu(menu) == "(01) 02 03 04"
     assert [p.ran for p in plugins] == [False, False, True]
開發者ID:koreno,項目名稱:termenu,代碼行數:7,代碼來源:test.py

示例4: test_scroll_bottom_cursor_bottom

 def test_scroll_bottom_cursor_bottom(self):
     menu = Termenu(OPTIONS, height=3)
     menu.scroll = len(OPTIONS) - 3
     menu.cursor = 2
     assert strmenu(menu) == "97 98 (99)"
     menu._on_down()
     assert strmenu(menu) == "97 98 (99)"
開發者ID:koreno,項目名稱:termenu,代碼行數:7,代碼來源:test.py

示例5: test_multiple

 def test_multiple(self):
     menu = Termenu(zip(OPTIONS, RESULTS), height=4)
     assert strmenu(menu) == "(01) 02 03 04"
     menu._on_space()
     menu._on_space()
     assert strmenu(menu) == "01 02 (03) 04"
     assert menu.get_result() == ["result-01", "result-02"]
開發者ID:koreno,項目名稱:termenu,代碼行數:7,代碼來源:test.py

示例6: test_single

 def test_single(self):
     menu = Termenu(zip(OPTIONS, RESULTS), height=4)
     assert strmenu(menu) == "(01) 02 03 04"
     menu._on_down()
     menu._on_down()
     assert strmenu(menu) == "01 02 (03) 04"
     assert menu.get_result() == ["result-03"]
開發者ID:koreno,項目名稱:termenu,代碼行數:7,代碼來源:test.py

示例7: test_multiple_plugins_all

 def test_multiple_plugins_all(self):
     plugins = [self.SamplePlugin(True), self.SamplePlugin(True), self.SamplePlugin(True)]
     menu = Termenu(OPTIONS, height=4, plugins=plugins)
     assert strmenu(menu) == "(01) 02 03 04"
     menu._on_key("down")
     assert strmenu(menu) == "01 (02) 03 04"
     assert [p.ran for p in plugins] == [True, True, True]
開發者ID:koreno,項目名稱:termenu,代碼行數:7,代碼來源:test.py

示例8: test_esc

 def test_esc(self):
     menu = Termenu("one two three four five six seven".split(), height=4, plugins=[FilterPlugin()])
     assert strmenu(menu) == "(one) two three four"
     menu._on_key("e")
     menu._on_key("n")
     assert strmenu(menu) == "(seven)"
     menu._on_key("esc")
     assert strmenu(menu) == "(one) two three four"
開發者ID:koreno,項目名稱:termenu,代碼行數:8,代碼來源:test.py

示例9: test_select

 def test_select(self):
     menu = Termenu(OPTIONS, height=4)
     assert strmenu(menu) == "(01) 02 03 04"
     menu._on_space()
     menu._on_space()
     assert strmenu(menu) == "01 02 (03) 04"
     assert " ".join(menu.get_result()) == "01 02"
     assert " ".join(menu.get_result()) == "01 02"
開發者ID:koreno,項目名稱:termenu,代碼行數:8,代碼來源:test.py

示例10: test_case_insensitive

 def test_case_insensitive(self):
     menu = Termenu("ONE TWO THREE FOUR FIVE SIX SEVEN".split(), height=4, plugins=[FilterPlugin()])
     menu._on_key("e")
     assert strmenu(menu) == "(ONE) THREE FIVE SEVEN"
開發者ID:koreno,項目名稱:termenu,代碼行數:4,代碼來源:test.py

示例11: test_selected

 def test_selected(self):
     menu = Termenu(OPTIONS, height=4)
     menu._on_down()
     menu._on_space()
     menu._on_space()
     assert [menu._decorate_flags(i)["selected"] for i in xrange(4)] == [False, True, True, False]
開發者ID:koreno,項目名稱:termenu,代碼行數:6,代碼來源:test.py

示例12: test_active

 def test_active(self):
     menu = Termenu(OPTIONS, height=4)
     assert menu._decorate("text", active=True) == " " + active("text") + "  "
開發者ID:koreno,項目名稱:termenu,代碼行數:3,代碼來源:test.py

示例13: test_filter

 def test_filter(self):
     menu = Termenu(OPTIONS, height=4, plugins=[FilterPlugin()])
     menu._on_key("4")
     assert strmenu(menu) == "(04) 14 24 34"
開發者ID:koreno,項目名稱:termenu,代碼行數:4,代碼來源:test.py

示例14: test_active_selected

 def test_active_selected(self):
     menu = Termenu(OPTIONS, height=4)
     assert menu._decorate("text", active=True, selected=True) == "*" + active_selected("text") + "  "
開發者ID:koreno,項目名稱:termenu,代碼行數:3,代碼來源:test.py

示例15: test_cursor_bottom

 def test_cursor_bottom(self):
     menu = Termenu(OPTIONS, height=3)
     menu.cursor = 2
     assert strmenu(menu) == "01 02 (03)"
     menu._on_down()
     assert strmenu(menu) == "02 03 (04)"
開發者ID:koreno,項目名稱:termenu,代碼行數:6,代碼來源:test.py


注:本文中的termenu.Termenu類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。