当前位置: 首页>>代码示例>>Python>>正文


Python SelectionList.get_selected_ids方法代码示例

本文整理汇总了Python中lollypop.selectionlist.SelectionList.get_selected_ids方法的典型用法代码示例。如果您正苦于以下问题:Python SelectionList.get_selected_ids方法的具体用法?Python SelectionList.get_selected_ids怎么用?Python SelectionList.get_selected_ids使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lollypop.selectionlist.SelectionList的用法示例。


在下文中一共展示了SelectionList.get_selected_ids方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from lollypop.selectionlist import SelectionList [as 别名]
# 或者: from lollypop.selectionlist.SelectionList import get_selected_ids [as 别名]
class Container:
    """
        Container for main view
    """
    def __init__(self):
        """
            Init container
        """
        self._pulse_timeout = None
        # Index will start at -VOLUMES
        self._devices = {}
        self._devices_index = Type.DEVICES
        self._show_genres = Lp().settings.get_value('show-genres')
        self._stack = ViewContainer(500)
        self._stack.show()

        self._setup_view()
        self._setup_scanner()

        (list_one_ids, list_two_ids) = self._get_saved_view_state()
        if list_one_ids and list_one_ids[0] != Type.NONE:
            self._list_one.select_ids(list_one_ids)
        if list_two_ids and list_two_ids[0] != Type.NONE:
            self._list_two.select_ids(list_two_ids)

        # Volume manager
        self._vm = Gio.VolumeMonitor.get()
        self._vm.connect('mount-added', self._on_mount_added)
        self._vm.connect('mount-removed', self._on_mount_removed)
        for mount in self._vm.get_mounts():
            self._add_device(mount, False)

        Lp().playlists.connect('playlists-changed',
                               self._update_playlists)

    def update_db(self):
        """
            Update db at startup only if needed
        """
        # Stop previous scan
        if Lp().scanner.is_locked():
            Lp().scanner.stop()
            GLib.timeout_add(250, self.update_db)
        else:
            # Something (device manager) is using progress bar
            if not self._progress.is_visible():
                Lp().scanner.update(self._progress)

    def get_genre_id(self):
        """
            Return current selected genre
            @return genre id as int
        """
        if self._show_genres:
            return self._list_one.get_selected_id()
        else:
            return None

    def init_list_one(self):
        """
            Init list one
        """
        self._update_list_one(None)

    def save_view_state(self):
        """
            Save view state
        """
        Lp().settings.set_value(
                            "list-one-ids",
                            GLib.Variant('ai',
                                         self._list_one.get_selected_ids()))
        Lp().settings.set_value(
                            "list-two-ids",
                            GLib.Variant('ai',
                                         self._list_two.get_selected_ids()))

    def show_playlist_manager(self, object_id, genre_ids,
                              artist_ids, is_album):
        """
            Show playlist manager for object_id
            Current view stay present in ViewContainer
            @param object id as int
            @param genre ids as [int]
            @param artist ids as [int]
            @param is_album as bool
        """
        view = PlaylistsManageView(object_id, genre_ids, artist_ids, is_album)
        view.populate()
        view.show()
        self._stack.add(view)
        self._stack.set_visible_child(view)

    def show_playlist_editor(self, playlist_id):
        """
            Show playlist editor for playlist
            Current view stay present in ViewContainer
            @param playlist id as int
            @param playlist name as str
        """
#.........这里部分代码省略.........
开发者ID:ktkr3d,项目名称:lollypop,代码行数:103,代码来源:container.py


注:本文中的lollypop.selectionlist.SelectionList.get_selected_ids方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。