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


Python navigation.Navigation類代碼示例

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


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

示例1: traverse

 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,代碼行數:25,代碼來源:tdd.py

示例2: Torpedo

class Torpedo(MovableSeaObject):
    def __init__(self, sea):
        MovableSeaObject.__init__(self, sea, max_speed=42, max_turn_rate_hour=math.radians(720)*60)
        self.navigation = Navigation(self)
        self.deep = 100
        self.armed = False
        self.fuel = 100 * 40 # seconds at 40 knots

    def launch(self, pos, speed = 40):
        self.navigation.set_destination(pos)
        self.speed = speed

    def get_deep(self):
        return self.deep

    def get_fuel_consumption(self, time_elapsed):
        # 1 fuel unit per second per knot
        return 1.0 * time_elapsed * self.navigation.get_actual_speed()

    def turn(self, time_elapsed):
        MovableSeaObject.turn(self, time_elapsed)
        self.fuel -= self.get_fuel_consumption(time_elapsed)
        if self.fuel <= 0:
            self.navigation.MAX_SPEED = 0
            self.MAX_SPEED = 0

    def explode(self):
        self.sea.report_explosion(self.get_pos())
開發者ID:ftfarias,項目名稱:PySubsim,代碼行數:28,代碼來源:sea_object.py

示例3: diritems

 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,代碼行數:8,代碼來源:tdd.py

示例4: test_main_menu

 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,代碼行數:9,代碼來源:tests.py

示例5: test_traverse_all

    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,代碼行數:14,代碼來源:tdd.py

示例6: test_traverse_all

    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,代碼行數:14,代碼來源:tdd.py

示例7: test_list_latest_movies

    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,代碼行數:15,代碼來源:tests.py

示例8: Ship

class Ship(MovableSeaObject):
    def __init__(self, sea):
        MovableSeaObject.__init__(self, sea)
        self.navigation = Navigation(self)

    def get_deep(self):
        return 0

    def get_pos(self):
        return self.pos

    def turn(self, time_elapsed):
        MovableSeaObject.turn(self, time_elapsed)

    def add_waypoint(self, dest):
        self.navigation.add_waypoint(dest)
開發者ID:ftfarias,項目名稱:PySubsim,代碼行數:16,代碼來源:sea_object.py

示例9: test_search_dispatch

    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,代碼行數:16,代碼來源:tests.py

示例10: __init__

    def __init__(self):
        
      # Debugging purposes
      self.print_velocities = rospy.get_param('print_velocities')

      # Where and when should you use this?
      self.stop_robot = False

      # Create the needed objects
      self.sonar_aggregation = SonarDataAggregator()
      self.laser_aggregation = LaserDataAggregator()
      self.navigation  = Navigation()

      self.linear_velocity  = 0
      self.angular_velocity = 0

      # Check if the robot moves with target or just wanders
      self.move_with_target = rospy.get_param("calculate_target")

      # The timer produces events for sending the speeds every 110 ms
      rospy.Timer(rospy.Duration(0.11), self.publishSpeeds)
      self.velocity_publisher = rospy.Publisher(\
              rospy.get_param('speeds_pub_topic'), Twist,\
              queue_size = 10)

      # Read the velocities architecture
      self.velocity_arch = rospy.get_param("velocities_architecture")
      print "The selected velocities architecture is " + self.velocity_arch
開發者ID:ApostolosPournaras,項目名稱:autonomous_systems_architectures,代碼行數:28,代碼來源:speeds_assignment.py

示例11: setUp

 def setUp(self):
     self.dialog = Xbmcgui.Dialog()
     self.dialog.select = MagicMock(name='select')
     xbmcgui = Xbmcgui()
     xbmcgui.Dialog = MagicMock(name='Dialog')
     xbmcgui.Dialog.return_value = self.dialog
     self.navigation = Navigation(None, None, xbmcgui, [None, 1])
開發者ID:shahraam,項目名稱:Halowrepo,代碼行數:7,代碼來源:tests.py

示例12: render_preference_panel

 def render_preference_panel(self, req, panel):
     nav = Navigation(self.env)
     if panel == 'navigation':
         nav.save(req)
         
     nav_choices = nav.get_display_choices()
     selected = {'display_nav': nav.get_display(req),
                 'wiki.href': nav.get_wiki_href(req),
                 'tickets.href': nav.get_ticket_href(req)}
     system_defaults = {'display_nav': nav.get_system_default_display(), 
                        'wiki.href': nav.get_system_default_wiki_href(),
                        'tickets.href': nav.get_system_default_tickets_href()}
     
     data = {'selected': selected,
             'nav_choices': nav_choices,
             'choices_doc': CHOICES_DOC,
             'system_defaults': system_defaults}
     return 'prefs_display.html', data
開發者ID:nyuhuhuu,項目名稱:trachacks,代碼行數:18,代碼來源:nav_prefs.py

示例13: __init__

 def __init__(self, parent=None):
     super(GLWidget, self).__init__(parent)
     self.parent = parent
     self.setMouseTracking(True)
     
     self.nav = Navigation()
     self.navInterface = NavigationInterface(self.nav)
     self.dataDisplay = DataDisplay()
     
     # self.navigateSignal.connect(self.navigateEvent)
     SIGNALS.navigateSignal.connect(self.navigateEvent)
開發者ID:ggoret,項目名稱:codecamp-esrf-2014,代碼行數:11,代碼來源:glwidget.py

示例14: __init__

 def __init__(self, sea):
     MovableSeaObject.__init__(self, sea, 15)
     self.nav = Navigation(self)
     self.sea = sea
     self.nav.destination = None
     self.bands_swim = Bands().add_random([10, 20], [60, 80])
     self.bands_swim_sing = self.bands_swim.add_random([2000, 5000], [120, 150], times=3)
     self.deep = random.randint(10, 20)
     print ("Swim: " + str(self.bands_swim))
     print ("Sing: " + str(self.bands_swim_sing))
     self.singing = False
     self.counter = (random.randint(5, 10) + random.gauss(6, 5)) / 60
開發者ID:ftfarias,項目名稱:PySubsim,代碼行數:12,代碼來源:sea_object.py

示例15: __init__

 def __init__(self, webserver_queue=None, looprate=0.2):
   self.arduino = Arduino()
   self.navigation = Navigation(self.arduino)
   self.state = State.COLLECT_spin_and_search_cone
   # Define constants
   self.looprate = looprate
   # Variables updated from webserver
   self.webserver_queue = webserver_queue
   self.mode = "auto"
   self.manual_direction = "stop"
   # Variables used by states
   self.start_time = None
   self.ready_to_deliver = False
開發者ID:zacharylawrence,項目名稱:ENEE408I-Team-9,代碼行數:13,代碼來源:driver.py


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