當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。