本文整理汇总了Python中lollypop.pop_next.NextPopover.destroy方法的典型用法代码示例。如果您正苦于以下问题:Python NextPopover.destroy方法的具体用法?Python NextPopover.destroy怎么用?Python NextPopover.destroy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lollypop.pop_next.NextPopover
的用法示例。
在下文中一共展示了NextPopover.destroy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ToolbarEnd
# 需要导入模块: from lollypop.pop_next import NextPopover [as 别名]
# 或者: from lollypop.pop_next.NextPopover import destroy [as 别名]
#.........这里部分代码省略.........
"""
def on_current_changed(self, player):
# Do not show next popover non internal tracks as
# tags will be readed on the fly
if player.next_track.id is not None and\
player.next_track.id >= 0 and\
(player.is_party() or
Lp.settings.get_enum('shuffle') == Shuffle.TRACKS):
self._pop_next.update()
if player.is_party():
self._pop_next.set_relative_to(self._party_btn)
else:
self._pop_next.set_relative_to(self._shuffle_btn)
self._pop_next.show()
else:
self._pop_next.hide()
"""
Update buttons on status changed
@param player as Player
"""
def on_status_changed(self, player):
if player.is_playing():
# Party mode can be activated
# via Fullscreen class, so check button state
self._party_btn.set_active(player.is_party())
#######################
# PRIVATE #
#######################
"""
Set shuffle icon
"""
def _set_shuffle_icon(self):
shuffle = Lp.settings.get_enum('shuffle')
if shuffle == Shuffle.NONE:
self._shuffle_btn_image.set_from_icon_name(
"media-playlist-consecutive-symbolic",
Gtk.IconSize.SMALL_TOOLBAR)
else:
self._shuffle_btn_image.set_from_icon_name(
"media-playlist-shuffle-symbolic",
Gtk.IconSize.SMALL_TOOLBAR)
"""
Mark shuffle button as active when shuffle active
@param settings as Gio.Settings, value as str
"""
def _shuffle_btn_aspect(self, settings, value):
self._set_shuffle_icon()
"""
Activate party button
@param action as Gio.SimpleAction
@param param as GLib.Variant
"""
def _activate_party_button(self, action=None, param=None):
self._party_btn.set_active(not self._party_btn.get_active())
"""
Show search widget on search button clicked
@param obj as Gtk.Button or Gtk.Action
"""
def _on_search_btn_clicked(self, obj, param=None):
self._search.show()
"""
Show queue widget on queue button clicked
@param button as Gtk.Button
"""
def _on_queue_btn_clicked(self, button):
self._queue.show()
"""
Set party mode on if party button active
@param obj as Gtk.button
"""
def _on_party_btn_toggled(self, button):
active = self._party_btn.get_active()
self._shuffle_btn.set_sensitive(not active)
if not Lp.settings.get_value('dark-ui'):
settings = Gtk.Settings.get_default()
settings.set_property("gtk-application-prefer-dark-theme", active)
Lp.player.set_party(active)
# We need to show the popover only in this case
# In other cases, "current-changed" will trigger it
if active and Lp.player.is_playing():
self.on_current_changed(Lp.player)
"""
On party change, sync toolbar
@param player as Player
@param is party as bool
"""
def _on_party_changed(self, player, is_party):
# GTK fail to change colors on popover, so destroy it
self._pop_next.destroy()
self._pop_next = NextPopover()
if self._party_btn.get_active() != is_party:
self._activate_party_button()