本文整理汇总了Python中navigation.Navigation类的典型用法代码示例。如果您正苦于以下问题:Python Navigation类的具体用法?Python Navigation怎么用?Python Navigation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Navigation类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: __removeGapNavigations
def __removeGapNavigations(self):
# We do a second pass over the navigations so that we remove any
# parts of the navigation that have been previously identified as being
# a navigation to a gap (a space between two method definitions).
finalNavigations = []
fromNav = None
toNav = None
foundGap = False
for navigation in self._navigations:
if not foundGap:
if navigation.fromFileNav is None:
if navigation.toFileNav.isGap:
fromNav = navigation.fromFileNav
foundGap = True
else:
finalNavigations.append(navigation)
elif not navigation.fromFileNav.isGap and navigation.toFileNav.isGap:
fromNav = navigation.fromFileNav
foundGap = True
elif navigation.fromFileNav.isGap and navigation.toFileNav.isGap:
raise RuntimeError('removeGapNavigations: cannot have a navigation with a fromFileNav that is a gap without a prior navigation with a gap in the toFileNav')
else:
if not navigation.isToSameMethod():
finalNavigations.append(navigation)
elif foundGap:
if navigation.fromFileNav.isGap and not navigation.toFileNav.isGap:
toNav = navigation.toFileNav
foundGap = False
newNavigation = Navigation(fromNav, toNav)
if not newNavigation.isToSameMethod():
finalNavigations.append(Navigation(fromNav, toNav))
elif navigation.fromFileNav.isGap and navigation.toFileNav.isGap:
continue
else:
raise RuntimeError('removeGapNavigations: cannot have a fromFileNav without a gap if the prior navigation had a gap in the toFileNav')
self._navigations = finalNavigations
开发者ID:IFT-SE,项目名称:pfis3,代码行数:38,代码来源:navpath.py
示例17: traverse
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,代码行数:23,代码来源:tdd.py
示例18: Interface
class Interface(object):
def __init__(self):
self._lcd_plate = LcdPlate()
self._navigation = Navigation()
self.initScreen()
def initScreen(self):
self._lcd_plate.clear()
self._lcd_plate.setBackLightCyan()
# Set the screen to the top of the menu
self._lcd_plate.message(self._navigation.currentItem())
def pressedDown(self):
self._navigation.moveDown()
def pressedLeft(self):
self._navigation.moveLeft()
def pressedRight(self):
self._navigation.moveRight()
def pressedSelect(self):
# TODO: Actually run the process that the navigation items expects
self._lcd_plate.clear()
self._lcd_plate.message("In Select")
def pressedUp(self):
self._navigation.moveUp()
def run(self):
while True:
for button in self._lcd_plate.buttons():
# Check if a button is pressed & there has been pause in pressing the buttons
if self._lcd_plate.pressedSinceLastCheck(button):
# Call function of the button pressed
getattr(self, 'pressed' + self._lcd_plate.titleOfButton(button))()
self.initScreen()
开发者ID:sjacres,项目名称:iot-chicken-coop,代码行数:42,代码来源:interface.py
示例19: QualitySelectTests
class QualitySelectTests(unittest.TestCase):
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])
def tearDown(self):
actual = self.navigation.quality_select_dialog(self.input)
self.assertEqual(actual, self.expected)
if self.dialog_arg:
self.dialog.select.assert_called_once_with("Quality Select", self.dialog_arg)
else:
self.assertFalse(self.dialog.select.called, "Dialog called!")
def test_only_one_input(self):
self.input = [("240p", "url_240")]
self.expected = "url_240"
self.dialog_arg = None
def test_select_first_url(self):
self.input = [("360p", "url_360"), ('720p', 'url_720')]
self.dialog_arg = ["360p", "720p"]
self.dialog.select.return_value = 0
self.expected = "url_360"
def test_select_second_url(self):
self.input = [("360p", "url_360"), ('720p', 'url_720')]
self.dialog_arg = ["360p", "720p"]
self.dialog.select.return_value = 1
self.expected = "url_720"
def test_unsorted_input(self):
self.input = [("1080p", "url_1080"), ('720p', 'url_720')]
self.dialog_arg = ["720p", "1080p"]
self.dialog.select.return_value = 1
self.expected = "url_1080"
def test_select_leading_whitespace_url(self):
self.input = [("360p", "url_360"), ('720p', ' url_720')]
self.dialog_arg = ["360p", "720p"]
self.dialog.select.return_value = 1
self.expected = "url_720"
开发者ID:daniel-lundin,项目名称:dreamfilm-xbmc,代码行数:47,代码来源:tests.py
示例20: test_navigation
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,代码行数:23,代码来源:tdd.py
注:本文中的navigation.Navigation类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论