本文整理汇总了Python中miro.frontends.widgets.widgetstatestore.WidgetStateStore.get_repeat_track方法的典型用法代码示例。如果您正苦于以下问题:Python WidgetStateStore.get_repeat_track方法的具体用法?Python WidgetStateStore.get_repeat_track怎么用?Python WidgetStateStore.get_repeat_track使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类miro.frontends.widgets.widgetstatestore.WidgetStateStore
的用法示例。
在下文中一共展示了WidgetStateStore.get_repeat_track方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: toggle_repeat
# 需要导入模块: from miro.frontends.widgets.widgetstatestore import WidgetStateStore [as 别名]
# 或者: from miro.frontends.widgets.widgetstatestore.WidgetStateStore import get_repeat_track [as 别名]
def toggle_repeat(self):
if self.repeat == WidgetStateStore.get_repeat_playlist():
self.set_repeat(WidgetStateStore.get_repeat_track())
elif self.repeat == WidgetStateStore.get_repeat_track():
self.set_repeat(WidgetStateStore.get_repeat_off())
elif self.repeat == WidgetStateStore.get_repeat_off():
self.set_repeat(WidgetStateStore.get_repeat_playlist())
#handle unknown values
else:
self.set_repeat(WidgetStateStore.get_repeat_off())
示例2: find_next_item
# 需要导入模块: from miro.frontends.widgets.widgetstatestore import WidgetStateStore [as 别名]
# 或者: from miro.frontends.widgets.widgetstatestore.WidgetStateStore import get_repeat_track [as 别名]
def find_next_item(self, not_skipped_by_user=True):
#if track repeat is on and the user doesn't skip,
#shuffle doesn't matter
if ((self.repeat == WidgetStateStore.get_repeat_track()
and not_skipped_by_user)):
return self.currently_playing
elif ((not self.shuffle and
self.repeat == WidgetStateStore.get_repeat_playlist()
and self.is_playing_last_item())):
return self._find_playable(self.model.get_first_info())
elif (self.shuffle and self.repeat == WidgetStateStore.get_repeat_off()
or self.shuffle and self.repeat == WidgetStateStore.get_repeat_track()):
next_item = self.next_shuffle_item()
if next_item is None:
self.shuffle_upcoming = self.generate_upcoming_shuffle_items()
self.shuffle_history = []
return None #stop playback
else:
# Remove currently playing item from history if it
# was removed from the playlist.
if not self.shuffle_history:
logging.info('find_next_item: shuffle history empty: '
'case 1')
else:
if self._is_playing_filtered_item():
self.shuffle_history.pop()
self.shuffle_history.append(next_item.id)
return next_item
elif self.shuffle and WidgetStateStore.get_repeat_playlist():
next_item = self.next_shuffle_item()
if next_item is None:
#populate with new items
self.shuffle_upcoming = self.generate_upcoming_shuffle_items()
next_item = self.next_shuffle_item()
if next_item is None:
#17492 - nothing playable in list
return None
# Remove currently playing item from history if it
# was removed from the playlist.
if not self.shuffle_history:
logging.info('find_next_item: shuffle history empty: case 2')
else:
if self._is_playing_filtered_item():
self.shuffle_history.pop()
self.shuffle_history.append(next_item.id)
return next_item
else:
if self._is_playing_filtered_item():
return self.model.get_first_info()
else:
next_item = self.model.get_next_info(self.currently_playing.id)
return self._find_playable(next_item)
示例3: select_next_item
# 需要导入模块: from miro.frontends.widgets.widgetstatestore import WidgetStateStore [as 别名]
# 或者: from miro.frontends.widgets.widgetstatestore.WidgetStateStore import get_repeat_track [as 别名]
def select_next_item(self, skipped_by_user=False):
if (self.repeat == WidgetStateStore.get_repeat_track() and
not skipped_by_user):
next_item = self.currently_playing
else:
next_item = self.navigation_strategy.next_item()
self._change_currently_playing(next_item)
示例4: handle_repeat
# 需要导入模块: from miro.frontends.widgets.widgetstatestore import WidgetStateStore [as 别名]
# 或者: from miro.frontends.widgets.widgetstatestore.WidgetStateStore import get_repeat_track [as 别名]
def handle_repeat(self, obj):
if app.playback_manager.repeat == WidgetStateStore.get_repeat_playlist():
self.repeat.set_image('repeat-on')
self.queue_redraw()
elif app.playback_manager.repeat == WidgetStateStore.get_repeat_track():
self.repeat.set_image('repeat-1')
self.queue_redraw()
else:
self.repeat.set_image('repeat')
self.queue_redraw()
示例5: generate_upcoming_shuffle_items
# 需要导入模块: from miro.frontends.widgets.widgetstatestore import WidgetStateStore [as 别名]
# 或者: from miro.frontends.widgets.widgetstatestore.WidgetStateStore import get_repeat_track [as 别名]
def generate_upcoming_shuffle_items(self):
if not self.shuffle:
return []
elif self.repeat == WidgetStateStore.get_repeat_off() or self.repeat == WidgetStateStore.get_repeat_track():
# random order
items = self.get_all_playable_items()
shuffle(items)
# do not include currently playing item
if self.currently_playing:
try:
items.remove(self.currently_playing.id)
except ValueError:
pass
return items
elif self.repeat == WidgetStateStore.get_repeat_playlist():
# random items
items = self.get_all_playable_items()
if items:
return self.random_sequence(items, self.currently_playing.id)
else:
return []
else:
return []