當前位置: 首頁>>代碼示例>>Python>>正文


Python NextPopover.destroy方法代碼示例

本文整理匯總了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()
開發者ID:yoseforb,項目名稱:lollypop,代碼行數:104,代碼來源:toolbar_end.py


注:本文中的lollypop.pop_next.NextPopover.destroy方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。