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


Python Navigation.dispatch方法代码示例

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


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

示例1: traverse

# 需要导入模块: from navigation import Navigation [as 别名]
# 或者: from navigation.Navigation import dispatch [as 别名]
 def traverse(self, dir_items, stack):
     print '***** stack: ' + str(stack)
     i = 0
     for (handle, url, listitem, isFolder) in dir_items:
         i += 1
         params = url.split('?')[1]
         if isFolder or (self.traverse_video and url.find('plugin') == 0):
             self.xbmcplugin.reset()
             swe = swefilmer.Swefilmer(self.xbmc, self.xbmcplugin,
                                       self.xbmcgui, self.xbmcaddon)
             nav = Navigation(self.xbmc, self.xbmcplugin, self.xbmcgui,
                              self.xbmcaddon, swe, 'plugin', '1',
                              '?' + params)
             if listitem.caption == nav.localize(30301):
                 continue
             stack.append(i)
             print '***** selecting %d: %s' % (i, listitem.caption)
             nav.dispatch()
             new_list = deepcopy(self.xbmcplugin.dir_items)
             self.traverse(new_list, stack)
         else:
             pass
     if len(stack) > 0:
         stack.pop()
     return
开发者ID:ABZTV,项目名称:HALOW-LIVE-TV,代码行数:27,代码来源:tdd.py

示例2: diritems

# 需要导入模块: from navigation import Navigation [as 别名]
# 或者: from navigation.Navigation import dispatch [as 别名]
 def diritems(self, params=None):
     self.xbmcplugin.reset()
     swe = swefilmer.Swefilmer(self.xbmc, self.xbmcplugin, self.xbmcgui,
                               self.addon)
     nav = Navigation(self.xbmc, self.xbmcplugin, self.xbmcgui,
                      self.addon, swe, 'plugin', '1', params)
     nav.dispatch()
     return self.xbmcplugin.dir_items
开发者ID:nghdallas,项目名称:Halowrepo,代码行数:10,代码来源:tdd.py

示例3: test_main_menu

# 需要导入模块: from navigation import Navigation [as 别名]
# 或者: from navigation.Navigation import dispatch [as 别名]
 def test_main_menu(self):
     argv = ['plugin.video.dreamfilm', '1']
     xbmc = Xbmc()
     xbmcplugin = Xbmcplugin()
     xbmcgui = Xbmcgui()
     df = dreamfilm.Dreamfilm()
     navigation = Navigation(df, xbmc, xbmcplugin, xbmcgui, argv)
     navigation.dispatch()
     self.assertEqual(len(xbmcplugin.dir_items), 8)
开发者ID:TheSilencer001,项目名称:dreamfilm-xbmc,代码行数:11,代码来源:tests.py

示例4: test_traverse_all

# 需要导入模块: from navigation import Navigation [as 别名]
# 或者: from navigation.Navigation import dispatch [as 别名]
    def test_traverse_all(self):
        self.xbmcplugin.reset()
        swe = swefilmer.Swefilmer(self.xbmc, self.xbmcplugin, self.xbmcgui,
                                  self.xbmcaddon)
        nav = Navigation(self.xbmc, self.xbmcplugin, self.xbmcgui,
                         self.xbmcaddon, swe, 'plugin', '1', '')
        self.assertEquals(nav.plugin_url, 'plugin')
        self.assertEquals(nav.handle, 1)
        self.assertEquals(nav.params, {})

        # call with no parameters
        nav.dispatch()
        self.traverse_video = True
        self.traverse(self.xbmcplugin.dir_items, [])
开发者ID:ABZTV,项目名称:HALOW-LIVE-TV,代码行数:16,代码来源:tdd.py

示例5: test_traverse_all

# 需要导入模块: from navigation import Navigation [as 别名]
# 或者: from navigation.Navigation import dispatch [as 别名]
    def test_traverse_all(self):
        argv = ['plugin', '1', '']
        self.streamtv = streamtv.Streamtv(self.xbmc, self.xbmcplugin,
                                          self.xbmcgui, self.xbmcaddon)
        nav = Navigation(self.xbmc, self.xbmcplugin, self.xbmcgui,
                         self.xbmcaddon, self.streamtv, argv)
        self.assertEquals(nav.plugin_url, 'plugin')
        self.assertEquals(nav.handle, 1)
        self.assertEquals(nav.params, {})

        # call with no parameters
        nav.dispatch()
        self.traverse_video = False
        self.traverse(self.xbmcplugin.dir_items, [])
开发者ID:kokangit,项目名称:xbmc-streamtv,代码行数:16,代码来源:tdd.py

示例6: test_list_latest_movies

# 需要导入模块: from navigation import Navigation [as 别名]
# 或者: from navigation.Navigation import dispatch [as 别名]
    def test_list_latest_movies(self):
        url = 'plugin.video.dreamfilm'
        params = Navigation.encode_parameters({'action': 'latestmovies'})
        argv = [url, 1, params]
        xbmc = Xbmc()
        xbmcplugin = Xbmcplugin()
        xbmcgui = Xbmcgui()
        df = dreamfilm.Dreamfilm()
        with open('fixtures/startpage.html') as f:
            df._latest_movie_html = mock.MagicMock(return_value=f.read())

        navigation = Navigation(df, xbmc, xbmcplugin, xbmcgui, argv)
        navigation.dispatch()

        self.assertEqual(len(xbmcplugin.dir_items), 12)
开发者ID:TheSilencer001,项目名称:dreamfilm-xbmc,代码行数:17,代码来源:tests.py

示例7: test_search_dispatch

# 需要导入模块: from navigation import Navigation [as 别名]
# 或者: from navigation.Navigation import dispatch [as 别名]
    def test_search_dispatch(self):
        # Mock
        xbmc = Xbmc()
        xbmcplugin = Xbmcplugin()
        xbmcgui = Xbmcgui()
        xbmc.Keyboard.getText = mock.MagicMock(return_value='bad')
        df = dreamfilm.Dreamfilm()

        with open('fixtures/search.html') as f:
            df._search = mock.MagicMock(return_value=f.read())

        params = Navigation.encode_parameters({'action': 'search'})
        argv = ['plugin.video.dreamfilm', '1', params]
        navigation = Navigation(df, xbmc, xbmcplugin, xbmcgui, argv)
        navigation.dispatch()
        self.assertEqual(len(xbmcplugin.dir_items), 3)
开发者ID:TheSilencer001,项目名称:dreamfilm-xbmc,代码行数:18,代码来源:tests.py

示例8: traverse

# 需要导入模块: from navigation import Navigation [as 别名]
# 或者: from navigation.Navigation import dispatch [as 别名]
 def traverse(self, dir_items, stack):
     print '***** stack: ' + str(stack)
     self.streamtv = streamtv.Streamtv(self.xbmc, self.xbmcplugin,
                                       self.xbmcgui, self.xbmcaddon)
     i = 0
     for (handle, url, listitem, isFolder) in dir_items:
         i += 1
         params = url.split('?')[1]
         if isFolder or (self.traverse_video and url.find('plugin') == 0):
             stack.append(i)
             print '***** selecting %d: %s' % (i, listitem.caption)
             argv = ['plugin', '1', '?' + params]
             self.xbmcplugin.reset()
             nav = Navigation(self.xbmc, self.xbmcplugin, self.xbmcgui,
                              self.xbmcaddon, self.streamtv, argv)
             nav.dispatch()
             new_list = deepcopy(self.xbmcplugin.dir_items)
             self.traverse(new_list, stack)
         else:
             pass
     if len(stack) > 0:
         stack.pop()
     return
开发者ID:kokangit,项目名称:xbmc-streamtv,代码行数:25,代码来源:tdd.py

示例9: test_navigation

# 需要导入模块: from navigation import Navigation [as 别名]
# 或者: from navigation.Navigation import dispatch [as 别名]
    def test_navigation(self):
        argv = ['plugin', '1', '']
        self.streamtv = streamtv.Streamtv(self.xbmc, self.xbmcplugin,
                                          self.xbmcgui, self.xbmcaddon)
        nav = Navigation(self.xbmc, self.xbmcplugin, self.xbmcgui,
                         self.xbmcaddon, self.streamtv, argv)
        self.assertEquals(nav.plugin_url, 'plugin')
        self.assertEquals(nav.handle, 1)
        self.assertEquals(nav.params, {})

        # call with no parameters
        nav.dispatch()
        self.assertTrue(len(self.xbmcplugin.dir_items) > 0)
        self.assertEquals(self.xbmcplugin.dir_items[0][2].caption, 'Alla')

        # select first item in list
        params = self.xbmcplugin.dir_items[0][1].split('?')[1]
        argv = ['plugin', '1', '?' + params]
        self.xbmcplugin.reset()
        nav = Navigation(self.xbmc, self.xbmcplugin, self.xbmcgui,
                         self.xbmcaddon, self.streamtv, argv)
        nav.dispatch()
        self.assertTrue(len(self.xbmcplugin.dir_items) > 0)
开发者ID:kokangit,项目名称:xbmc-streamtv,代码行数:25,代码来源:tdd.py

示例10: Navigation

# 需要导入模块: from navigation import Navigation [as 别名]
# 或者: from navigation.Navigation import dispatch [as 别名]
# -*- coding: utf-8 -*-
import sys
import xbmcplugin
import xbmcgui
import xbmcaddon
import xbmc
from navigation import Navigation

navigation = Navigation(xbmc, xbmcplugin, xbmcgui, xbmcaddon, sys.argv)
navigation.dispatch()
开发者ID:HALOW96,项目名称:xbmc-streamtv,代码行数:12,代码来源:default.py

示例11: Xbmc

# 需要导入模块: from navigation import Navigation [as 别名]
# 或者: from navigation.Navigation import dispatch [as 别名]
from navigation import Navigation
import dreamfilm
from mocks import Xbmc, Xbmcgui, Xbmcplugin

if __name__ == '__main__':
    argv = ['./offline.py', 1]
    history = []
    history.append(argv)
    while True:
        xbmc = Xbmc()
        xbmcplugin = Xbmcplugin()
        xbmcgui = Xbmcgui()
        navigation = Navigation(dreamfilm.Dreamfilm(), xbmc, xbmcplugin, xbmcgui, argv)
        ret = navigation.dispatch()
        if ret == Xbmc.BACK:
            history = history[:-1]
            argv = history[-1]
            continue

        if not xbmcplugin.dir_items:
            continue

        for idx, item in enumerate(xbmcplugin.dir_items):
            print "%d) %s" % (idx, item[2].caption)
        print "Enter number for menu option or '..' to go back"
        inp = raw_input('>> ')
        if inp == "..":
            history = history[:-1]
            argv = history[-1]
            continue
开发者ID:Fjobbe,项目名称:dreamfilm-xbmc,代码行数:32,代码来源:offline_tester.py


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