当前位置: 首页>>代码示例>>Python>>正文


Python Menu.select方法代码示例

本文整理汇总了Python中menu.Menu.select方法的典型用法代码示例。如果您正苦于以下问题:Python Menu.select方法的具体用法?Python Menu.select怎么用?Python Menu.select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在menu.Menu的用法示例。


在下文中一共展示了Menu.select方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_select_shouldShowLoadingWhileGettingItemsAsynchronously

# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import select [as 别名]
def test_select_shouldShowLoadingWhileGettingItemsAsynchronously():
    asyncFolder = mocks.NeverLoadingFolder("Dynamic", [])
    dynamicMainFolder = mocks.Folder("Main", [asyncFolder])
    menu = Menu(dynamicMainFolder)
    menu.select()
    assert asyncFolder.loadItemsCnt == 0
    assert menu.item() is menu._loadingItem
开发者ID:spielzeugland,项目名称:kodi-control-panel,代码行数:9,代码来源:menu_test.py

示例2: test_select_shouldLoadAsyncFolders

# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import select [as 别名]
def test_select_shouldLoadAsyncFolders():
    asyncFolder = mocks.SynchronAsyncFolder("Dynamic", [])
    dynamicMainFolder = mocks.Folder("Main", [asyncFolder])
    menu = Menu(dynamicMainFolder)
    menu.select()
    assert asyncFolder.loadItemsCnt == 1
    assert menu._currentItems == asyncFolder._itemsToLoad
开发者ID:spielzeugland,项目名称:kodi-control-panel,代码行数:9,代码来源:menu_test.py

示例3: test_mainFolder_shouldReturnCurrentMainFolder

# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import select [as 别名]
def test_mainFolder_shouldReturnCurrentMainFolder():
    menu = Menu(mainFolder)
    menu.select()
    assert menu.folder() is folder1
    assert menu.mainFolder() is folder1
    menu.select()
    assert menu.folder() is folder1a
    assert menu.mainFolder() is folder1
    menu.back().back()
    assert menu.mainFolder() is None
开发者ID:spielzeugland,项目名称:kodi-control-panel,代码行数:12,代码来源:menu_test.py

示例4: main

# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import select [as 别名]
def main():
    ser = serial.Serial('/dev/ttyAMA0', 7600, timeout=0)

    menu = Menu(MENU_STRUCTURE, 20, 4, output='lcd')
    menu.show()

    while True:
        data = ser.read(8).strip()

        if data:
            if data == 'c':     # clockwise
                menu.down()
            elif data == 'a':   # anti-clockwise
                menu.up()
            elif data == 'p':   # press
                menu.select()
            menu.show()
        sleep(0.01)
开发者ID:damianmoore,项目名称:hub-ui,代码行数:20,代码来源:service.py

示例5: main

# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import select [as 别名]
def main():
    menu = Menu(MENU_STRUCTURE, 20, 4, output='terminal')

    def show():
        for i in range(20):
            print('')
        menu.show()

    show()
    kgen = getch(0.1)

    while True:
        key = kgen.next()

        if key:
            if key == 'B':
                menu.down()
            elif key == 'A':
                menu.up()
            elif key in [' ', '\n']:
                menu.select()
            show()
开发者ID:damianmoore,项目名称:hub-ui,代码行数:24,代码来源:simulator.py

示例6: test_select_shouldOpenFolderAndShowItsFirstEntry

# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import select [as 别名]
def test_select_shouldOpenFolderAndShowItsFirstEntry():
    menu = Menu(mainFolder)
    menu.moveBy(1)
    menu.select()
    assert menu.folder() is folder2
    assert menu.item() is folder2a
开发者ID:spielzeugland,项目名称:kodi-control-panel,代码行数:8,代码来源:menu_test.py

示例7: test_select_shouldShowRetryActionWhenLoadingFolderFailed_Asynchronously

# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import select [as 别名]
def test_select_shouldShowRetryActionWhenLoadingFolderFailed_Asynchronously():
    asyncFolder = mocks.FailingSynchronAsyncFolder("Dynamic", Exception(""))
    dynamicMainFolder = mocks.Folder("Main", [asyncFolder])
    menu = Menu(dynamicMainFolder)
    menu.select()
    assert isinstance(menu.item(), _RetryAction)
开发者ID:spielzeugland,项目名称:kodi-control-panel,代码行数:8,代码来源:menu_test.py

示例8: test_select_shouldExecuteSelectedAction

# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import select [as 别名]
def test_select_shouldExecuteSelectedAction():
    action = mocks.Action("Action")
    folder = mocks.Folder("Folder", [action])
    menu = Menu(folder)
    menu.select()
    assert action.runCnt == 1
开发者ID:spielzeugland,项目名称:kodi-control-panel,代码行数:8,代码来源:menu_test.py

示例9: test_select_shouldAddMessageForFailingFolder

# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import select [as 别名]
def test_select_shouldAddMessageForFailingFolder():
    someException = Exception("exception text")
    failingFolder = mocks.FailingFolder("my failing folder", someException)
    folder = mocks.Folder("Folder", [failingFolder])
    menu = Menu(folder)
    menu.select()
开发者ID:spielzeugland,项目名称:kodi-control-panel,代码行数:8,代码来源:menu_test.py

示例10: test_select_shouldAddMessageForFailingAction

# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import select [as 别名]
def test_select_shouldAddMessageForFailingAction():
    someException = Exception("exception text")
    action = mocks.FailingAction("My Failing Action", someException)
    folder = mocks.Folder("Folder", [action])
    menu = Menu(folder)
    menu.select()
开发者ID:spielzeugland,项目名称:kodi-control-panel,代码行数:8,代码来源:menu_test.py

示例11: test_back

# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import select [as 别名]
def test_back():
    menu = Menu(mainFolder)
    menu.select()
    menu.back()
    assert menu.folder() is mainFolder
开发者ID:spielzeugland,项目名称:kodi-control-panel,代码行数:7,代码来源:menu_test.py

示例12: test_back_shouldRememberIndex

# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import select [as 别名]
def test_back_shouldRememberIndex():
    menu = Menu(mainFolder)
    menu.moveBy(1)
    menu.select()
    menu.back()
    assert menu.item() is folder2
开发者ID:spielzeugland,项目名称:kodi-control-panel,代码行数:8,代码来源:menu_test.py

示例13: test_select_emptyFolder_shouldDoNothing

# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import select [as 别名]
def test_select_emptyFolder_shouldDoNothing():
    menu = Menu(emptyFolder, showBackItem=False)
    assert menu.item() is menu._emptyItem
    menu.select()
    assert menu.item() is menu._emptyItem
开发者ID:spielzeugland,项目名称:kodi-control-panel,代码行数:7,代码来源:menu_test.py

示例14: main

# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import select [as 别名]
def main():
  pygame.init()
  pygame.mixer.music.load("rematch.mp3")
  pygame.mixer.music.play(-1)
  screen = pygame.display.set_mode((1000, 1000))
  clock = pygame.time.Clock()
  
  game_map = Map(0)
  player = Character( game_map, 23, 1 )
  
  prevKeys = {}
  
  menu = Menu()
  while True:
    for e in pygame.event.get():
      if e.type == QUIT or (e.type == KEYDOWN and e.key == K_ESCAPE):
        pygame.quit()
        return
    key = pygame.key.get_pressed()
    
    if key[K_DOWN] and not prevKeys[K_DOWN]:
      menu.move(1)
    if key[K_UP] and not prevKeys[K_UP]:
      menu.move(-1)
    if key[K_RETURN] and not prevKeys[K_RETURN]:
      r = menu.select()
      if r == -1:
        pygame.quit()
        return
      elif r == 1:
        break
        
    prevKeys = key
    
    menu.draw(screen)
    pygame.display.flip()
    
  
  while True:
    
    clock.tick(30)
    for e in pygame.event.get():
      if e.type == QUIT or (e.type == KEYDOWN and e.key == K_ESCAPE):
        pygame.quit()
        return
    key = pygame.key.get_pressed()
    
    if key[K_LSHIFT]:
      if key[K_UP] and not prevKeys[K_UP]:
        player.attack_up()
      elif key[K_DOWN] and not prevKeys[K_DOWN]:
        player.attack_down()
      elif key[K_LEFT] and not prevKeys[K_LEFT]:
        player.attack_left()
      elif key[K_RIGHT] and not prevKeys[K_RIGHT]:
        player.attack_right()
    else:
      if key[K_UP] and not prevKeys[K_UP]:
        player.move_up()
      elif key[K_DOWN] and not prevKeys[K_DOWN]:
        player.move_down()
      elif key[K_LEFT] and not prevKeys[K_LEFT]:
        player.move_left()
      elif key[K_RIGHT] and not prevKeys[K_RIGHT]:
        player.move_right()
    
    while game_map.isWin(player.position.real, player.position.imag):
      screen.blit(winScreen,(0,0))
      pygame.display.flip()
      for e in pygame.event.get():
        if e.type == QUIT or (e.type == KEYDOWN and e.key == K_ESCAPE):
          pygame.quit()
          return
    
    prevKeys = key
    game_map.draw(screen)
    player.draw(screen)
    
    
    
    pygame.display.flip()
开发者ID:origamize,项目名称:GameJamFall2011,代码行数:83,代码来源:main.py

示例15: test_select_shouldLeaveRootFolder

# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import select [as 别名]
def test_select_shouldLeaveRootFolder():
    menu = Menu(mainFolder)
    menu.select()
    assert menu.isRoot() is False
开发者ID:spielzeugland,项目名称:kodi-control-panel,代码行数:6,代码来源:menu_test.py


注:本文中的menu.Menu.select方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。