本文整理汇总了Python中lollypop.selectionlist.SelectionList.will_be_selected方法的典型用法代码示例。如果您正苦于以下问题:Python SelectionList.will_be_selected方法的具体用法?Python SelectionList.will_be_selected怎么用?Python SelectionList.will_be_selected使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lollypop.selectionlist.SelectionList
的用法示例。
在下文中一共展示了SelectionList.will_be_selected方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from lollypop.selectionlist import SelectionList [as 别名]
# 或者: from lollypop.selectionlist.SelectionList import will_be_selected [as 别名]
#.........这里部分代码省略.........
dev.uri = uri
self._devices[self._devices_index] = dev
if show:
self._list_one.add_value((dev.id, dev.name))
def _remove_device(self, mount):
"""
Remove volume from device list
@param mount as Gio.Mount
"""
if mount.get_volume() is None:
return
uri = mount.get_default_location().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 not selected_ids:
return
if selected_ids[0] == Type.PLAYLISTS:
self._list_two.clear()
self._list_two.show()
if not self._list_two.will_be_selected():
self._update_view_playlists()
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([], selected_ids)
else:
self._update_view_artists([], selected_ids)
else:
self._list_two.clear()
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, [])
def _on_list_populated(self, selection_list):
"""
Add device to list one and update db
示例2: __init__
# 需要导入模块: from lollypop.selectionlist import SelectionList [as 别名]
# 或者: from lollypop.selectionlist.SelectionList import will_be_selected [as 别名]
#.........这里部分代码省略.........
dev.name = name
dev.uri = uri
self.__devices[self.__devices_index] = dev
if show:
self.__list_one.add_value((dev.id, dev.name))
def __remove_device(self, mount):
"""
Remove volume from device list
@param mount as Gio.Mount
"""
uri = mount.get_default_location().get_uri()
for dev in self.__devices.values():
if dev.uri == uri:
self.__list_one.remove_value(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.selected_ids
if not selected_ids:
return
self.__list_two.clear()
if selected_ids[0] == Type.PLAYLISTS:
if Lp().settings.get_value('show-navigation-list'):
self.__list_two.show()
if not self.__list_two.will_be_selected():
self.__update_view_playlists()
self.__update_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] == Type.CHARTS:
self.__list_two.show()
self.__update_list_charts()
self.__update_view_albums(selected_ids, [])
elif selected_ids[0] in [Type.POPULARS,
Type.LOVED,
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([], selected_ids)
else:
self.__update_view_artists([], selected_ids)
else:
self.__update_list_artists(self.__list_two, selected_ids, False)
if Lp().settings.get_value('show-navigation-list'):
self.__list_two.show()
if not self.__list_two.will_be_selected():
示例3: __init__
# 需要导入模块: from lollypop.selectionlist import SelectionList [as 别名]
# 或者: from lollypop.selectionlist.SelectionList import will_be_selected [as 别名]
#.........这里部分代码省略.........
self._list_one.add_value((dev.id, dev.name))
"""
Remove volume from device list
@param volume as Gio.Volume
"""
def _remove_device(self, 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)
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
@param selected id as int
"""
def _on_list_one_selected(self, selection_list, selected_id):
if selected_id == Type.PLAYLISTS:
start_new_thread(self._setup_list_playlists, (False,))
self._list_two.clear()
self._list_two.show()
if not self._list_two.will_be_selected():
self._update_view_playlists(None)
elif selected_id < Type.DEVICES:
self._list_two.hide()
if not self._list_two.will_be_selected():
self._update_view_device(selected_id)
elif selected_id in [Type.POPULARS,
Type.RECENTS,
Type.RANDOMS]:
self._list_two.hide()
self._update_view_albums(selected_id)
elif selected_id == Type.RADIOS:
self._list_two.hide()
self._update_view_radios()
elif selection_list.is_marked_as_artists():
self._list_two.hide()
if selected_id == Type.ALL:
self._update_view_albums(selected_id)
elif selected_id == Type.COMPILATIONS:
self._update_view_albums(None, True)
else:
self._update_view_artists(selected_id, None)
else:
self._list_two.clear()
start_new_thread(self._setup_list_artists,
(self._list_two, selected_id, False))
self._list_two.show()
if not self._list_two.will_be_selected():
self._update_view_albums(selected_id, False)
"""
Add device to list one and update db
@param selection list as SelectionList
示例4: __init__
# 需要导入模块: from lollypop.selectionlist import SelectionList [as 别名]
# 或者: from lollypop.selectionlist.SelectionList import will_be_selected [as 别名]
#.........这里部分代码省略.........
dev.name = volume.get_name()
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, selected_id):
"""
Update view based on selected object
@param list as SelectionList
@param selected id as int
"""
if selected_id == Type.PLAYLISTS:
self._list_two.clear()
self._list_two.show()
if not self._list_two.will_be_selected():
self._update_view_playlists(None)
self._setup_list_playlists(False)
elif selected_id < Type.DEVICES:
self._list_two.hide()
if not self._list_two.will_be_selected():
self._update_view_device(selected_id)
elif selected_id in [Type.POPULARS, Type.RECENTS, Type.RANDOMS]:
self._list_two.hide()
self._update_view_albums(selected_id)
elif selected_id == Type.RADIOS:
self._list_two.hide()
self._update_view_radios()
elif selection_list.is_marked_as_artists():
self._list_two.hide()
if selected_id == Type.ALL:
self._update_view_albums(selected_id)
elif selected_id == Type.COMPILATIONS:
self._update_view_albums(None, True)
else:
self._update_view_artists(selected_id, None)
else:
self._list_two.clear()
self._setup_list_artists(self._list_two, selected_id, False)
self._list_two.show()
if not self._list_two.will_be_selected():
self._update_view_albums(selected_id, False)
def _on_list_populated(self, selection_list):
"""
Add device to list one and update db
@param selection list as SelectionList
"""
for dev in self._devices.values():
self._list_one.add_value((dev.id, dev.name))
def _on_list_two_selected(self, selection_list, selected_id):
"""
Update view based on selected object
@param list as SelectionList
@param selected id as int
"""
genre_id = self._list_one.get_selected_id()
if genre_id == Type.PLAYLISTS:
self._update_view_playlists(selected_id)
elif selected_id == Type.COMPILATIONS:
self._update_view_albums(genre_id, True)
else:
self._update_view_artists(selected_id, genre_id)
def _on_mount_added(self, vm, mnt):
"""
On volume mounter
@param vm as Gio.VolumeMonitor
@param mnt as Gio.Mount
"""
self._add_device(mnt.get_volume())
def _on_mount_removed(self, vm, mnt):
"""
On volume removed, clean selection list
@param vm as Gio.VolumeMonitor
@param mnt as Gio.Mount
"""
self._remove_device(mnt.get_volume())