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


Python SelectionList.add_device方法代码示例

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


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

示例1: __init__

# 需要导入模块: from lollypop.selectionlist import SelectionList [as 别名]
# 或者: from lollypop.selectionlist.SelectionList import add_device [as 别名]

#.........这里部分代码省略.........
    def _update_view_albums(self, object_id, genre_id):
        view = AlbumView(object_id)
        self._stack.add(view)
        view.show()
        start_new_thread(view.populate, (genre_id,))
        self._stack.set_visible_child(view)
        self._stack.clean_old_views(view)

    """
        Update current view with playlist view
        @param playlist id as int
    """
    def _update_view_playlists(self, playlist_id):
        view = None
        if playlist_id is not None:
            for (p_id, p_str) in Objects.playlists.get():
                if p_id == playlist_id:
                    view = PlaylistView(p_str, self._stack)
                    break
        else:
            view = PlaylistManageView(-1, None, False,
                                      self._stack.get_allocated_width()/2)
        if view:
            view.show()
            self._stack.add(view)
            self._stack.set_visible_child(view)
            start_new_thread(view.populate, ())
            self._stack.clean_old_views(view)

    """
        Add volume to device list
        @param volume as Gio.Volume
    """
    def _add_device(self, volume):
        if volume is None:
            return
        root = volume.get_activation_root()
        if root is None:
            return
        path = root.get_path()
        if path and path.find('mtp:') != -1:
            self._devices_index -= 1
            dev = Device()
            dev.id = self._devices_index
            dev.name = volume.get_name()
            dev.path = path
            self._devices[self._devices_index] = dev
            self._list_one.add_device(dev.name, dev.id)

    """
        Remove volume from device list
        @param volume as Gio.Volume
    """
    def _remove_device(self, volume):
        for dev in self._devices.values():
            if not os.path.exists(dev.path):
                self._list_one.remove(dev.id)
                device = self._devices[dev.id]
                if device.view:
                    device.view.destroy()
                del self._devices[dev.id]
            break

    """
        Update view based on selected object
        @param list as SelectionList
开发者ID:mank319,项目名称:lollypop,代码行数:70,代码来源:container.py


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