本文整理汇总了Python中miro.frontends.widgets.widgetstatestore.WidgetStateStore.get_repeat_playlist方法的典型用法代码示例。如果您正苦于以下问题:Python WidgetStateStore.get_repeat_playlist方法的具体用法?Python WidgetStateStore.get_repeat_playlist怎么用?Python WidgetStateStore.get_repeat_playlist使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类miro.frontends.widgets.widgetstatestore.WidgetStateStore
的用法示例。
在下文中一共展示了WidgetStateStore.get_repeat_playlist方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: toggle_repeat
# 需要导入模块: from miro.frontends.widgets.widgetstatestore import WidgetStateStore [as 别名]
# 或者: from miro.frontends.widgets.widgetstatestore.WidgetStateStore import get_repeat_playlist [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_playlist [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: handle_repeat
# 需要导入模块: from miro.frontends.widgets.widgetstatestore import WidgetStateStore [as 别名]
# 或者: from miro.frontends.widgets.widgetstatestore.WidgetStateStore import get_repeat_playlist [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()
示例4: _create_navigation_strategy
# 需要导入模块: from miro.frontends.widgets.widgetstatestore import WidgetStateStore [as 别名]
# 或者: from miro.frontends.widgets.widgetstatestore.WidgetStateStore import get_repeat_playlist [as 别名]
def _create_navigation_strategy(self):
if self.item_list.item_in_list(self.currently_playing.id):
initial_item = self.currently_playing
else:
initial_item = None
repeat = (self.repeat == WidgetStateStore.get_repeat_playlist())
if self.shuffle:
self.navigation_strategy = ShuffleNavigationStrategy(
initial_item, self.item_list, repeat)
else:
self.navigation_strategy = LinearNavigationStrategy(
initial_item, self.item_list, repeat)
示例5: find_previous_item
# 需要导入模块: from miro.frontends.widgets.widgetstatestore import WidgetStateStore [as 别名]
# 或者: from miro.frontends.widgets.widgetstatestore.WidgetStateStore import get_repeat_playlist [as 别名]
def find_previous_item(self):
if self.shuffle:
if not self.shuffle_history:
return None
current_item = self.shuffle_history.pop()
# Only add the currently playing item to upcoming shuffle items
# if it exists in the playlist
if not self._is_playing_filtered_item():
self.shuffle_upcoming.append(current_item)
return self.prev_shuffle_item()
elif (not self.shuffle
and self.repeat == WidgetStateStore.get_repeat_playlist()
and self.is_playing_first_item()):
last_item = self._find_playable(self.model.get_last_info(), True)
return last_item
else:
if self._is_playing_filtered_item():
return None
else:
prev_item = self.model.get_prev_info(self.currently_playing.id)
return self._find_playable(prev_item, backwards=True)
示例6: generate_upcoming_shuffle_items
# 需要导入模块: from miro.frontends.widgets.widgetstatestore import WidgetStateStore [as 别名]
# 或者: from miro.frontends.widgets.widgetstatestore.WidgetStateStore import get_repeat_playlist [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 []