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


Python SelectionList.set_mode方法代码示例

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


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

示例1: __init__

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

#.........这里部分代码省略.........
            dev.uri = uri
            self._devices[self._devices_index] = dev
            self._list_one.add_value((dev.id, dev.name))

    def _remove_device(self, volume):
        """
            Remove volume from device list
            @param volume as Gio.Volume
        """
        if volume is None:
            return
        root = volume.get_activation_root()
        if root is None:
            return

        uri = root.get_uri()
        for dev in self._devices.values():
            if dev.uri == uri:
                self._list_one.remove(dev.id)
                child = self._stack.get_child_by_name(uri)
                if child is not None:
                    child.destroy()
                del self._devices[dev.id]
            break

    def _on_list_one_selected(self, selection_list):
        """
            Update view based on selected object
            @param list as SelectionList
        """
        selected_ids = self._list_one.get_selected_ids()
        if selected_ids[0] == Type.PLAYLISTS:
            self._list_two.clear()
            self._list_two.set_mode(Gtk.SelectionMode.SINGLE)
            self._list_two.show()
            if not self._list_two.will_be_selected():
                self._update_view_playlists(None)
            self._setup_list_playlists(False)
        elif Type.DEVICES - 999 < selected_ids[0] < Type.DEVICES:
            self._list_two.hide()
            if not self._list_two.will_be_selected():
                self._update_view_device(selected_ids[0])
        elif selected_ids[0] in [Type.POPULARS,
                                 Type.RECENTS,
                                 Type.RANDOMS]:
            self._list_two.hide()
            self._update_view_albums(selected_ids)
        elif selected_ids[0] == Type.RADIOS:
            self._list_two.hide()
            self._update_view_radios()
        elif selection_list.is_marked_as_artists():
            self._list_two.hide()
            if selected_ids[0] == Type.ALL:
                self._update_view_albums(selected_ids)
            elif selected_ids[0] == Type.COMPILATIONS:
                self._update_view_albums([], True)
            else:
                self._update_view_artists(selected_ids, [])
        else:
            self._list_two.clear()
            self._list_two.set_mode(Gtk.SelectionMode.MULTIPLE)
            self._setup_list_artists(self._list_two, selected_ids, False)
            self._list_two.show()
            if not self._list_two.will_be_selected():
                self._update_view_albums(selected_ids, False)
开发者ID:halkernel,项目名称:lollypop,代码行数:69,代码来源:container.py


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