当前位置: 首页>>代码示例>>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;未经允许,请勿转载。