本文整理汇总了Python中lollypop.selectionlist.SelectionList.hide方法的典型用法代码示例。如果您正苦于以下问题:Python SelectionList.hide方法的具体用法?Python SelectionList.hide怎么用?Python SelectionList.hide使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lollypop.selectionlist.SelectionList
的用法示例。
在下文中一共展示了SelectionList.hide方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from lollypop.selectionlist import SelectionList [as 别名]
# 或者: from lollypop.selectionlist.SelectionList import hide [as 别名]
#.........这里部分代码省略.........
"""
view = self._stack.get_visible_child()
if view:
view.update_children()
def reload_view(self):
"""
Reload current view
"""
values_two = self._list_two.get_selected_ids()
if not values_two:
values_one = self._list_one.get_selected_ids()
if not values_one:
values_one = [Type.POPULARS]
self._list_one.select_ids([])
self._list_one.select_ids(values_one)
if self._list_two.is_visible():
self._list_two.select_ids([])
self._list_two.select_ids(values_two)
def pulse(self, pulse):
"""
Make progress bar visible/pulse if pulse is True
@param pulse as bool
"""
if pulse and not self._progress.is_visible():
self._progress.show()
if self._pulse_timeout is None:
self._pulse_timeout = GLib.timeout_add(500, self._pulse)
else:
if self._pulse_timeout is not None:
GLib.source_remove(self._pulse_timeout)
self._pulse_timeout = None
self._progress.hide()
def on_scan_finished(self, scanner):
"""
Mark force scan as False, update lists
@param scanner as CollectionScanner
"""
self._update_lists(scanner)
def add_fake_phone(self):
"""
Emulate an Android Phone
"""
self._devices_index -= 1
dev = Device()
dev.id = self._devices_index
dev.name = "Android phone"
dev.uri = "file:///tmp/android/"
d = Gio.File.new_for_uri(dev.uri+"Internal Memory")
if not d.query_exists(None):
d.make_directory_with_parents(None)
d = Gio.File.new_for_uri(dev.uri+"SD Card")
if not d.query_exists(None):
d.make_directory_with_parents(None)
self._devices[self._devices_index] = dev
############
# Private #
############
def _pulse(self):
"""
Make progress bar pulse while visible
@param pulse as bool
示例2: __init__
# 需要导入模块: from lollypop.selectionlist import SelectionList [as 别名]
# 或者: from lollypop.selectionlist.SelectionList import hide [as 别名]
#.........这里部分代码省略.........
items.append((Type.RANDOMS, _("Random albums")))
items.append((Type.PLAYLISTS, _("Playlists")))
items.append((Type.RADIOS, _("Radios")))
if self._show_genres:
items.append((Type.ALL, _("All artists")))
else:
items.append((Type.ALL, _("All albums")))
return items
"""
Setup list for genres
@param list as SelectionList
@param update as bool, if True, just update entries
@thread safe
"""
def _setup_list_genres(self, selection_list, update):
sql = Lp.db.get_cursor()
selection_list.mark_as_artists(False)
items = self._get_headers()
items.append((Type.SEPARATOR, ''))
items += Lp.genres.get(sql)
if update:
selection_list.update_values(items)
else:
selection_list.populate(items)
sql.close()
"""
Hide list two base on current artist list
"""
def _pre_setup_list_artists(self, selection_list):
if selection_list == self._list_one:
if self._list_two.is_visible():
self._list_two.hide()
self._list_two_restore = Type.NONE
"""
Setup list for artists
@param list as SelectionList
@param update as bool, if True, just update entries
@thread safe
"""
def _setup_list_artists(self, selection_list, genre_id, update):
GLib.idle_add(self._pre_setup_list_artists, selection_list)
sql = Lp.db.get_cursor()
items = []
selection_list.mark_as_artists(True)
if selection_list == self._list_one:
items = self._get_headers()
if Lp.albums.get_compilations(genre_id, sql):
items.append((Type.COMPILATIONS, _("Compilations")))
items.append((Type.SEPARATOR, ''))
items += Lp.artists.get(genre_id, sql)
if update:
selection_list.update_values(items)
else:
selection_list.populate(items)
sql.close()
"""
Setup list for playlists
@param update as bool
@thread safe
"""
def _setup_list_playlists(self, update):
示例3: __init__
# 需要导入模块: from lollypop.selectionlist import SelectionList [as 别名]
# 或者: from lollypop.selectionlist.SelectionList import hide [as 别名]
#.........这里部分代码省略.........
@param playlist name as str
"""
from lollypop.view_playlists import PlaylistEditView
view = PlaylistEditView(playlist_id)
view.show()
self.__stack.add(view)
self.__stack.set_visible_child(view)
self.__stack.clean_old_views(view)
view.populate()
def get_view_width(self):
"""
Return view width
@return width as int
"""
return self.__stack.get_allocation().width
def stop_all(self):
"""
Stop current view from processing
"""
view = self.__stack.get_visible_child()
if view is not None:
self.__stack.clean_old_views(None)
def show_genres(self, show):
"""
Show/Hide genres
@param bool
"""
self.__show_genres = show
self.__list_one.clear()
self.__list_two.clear()
self.__list_two.hide()
self.__update_list_one(None)
self.__list_one.select_ids([Type.POPULARS])
def destroy_current_view(self):
"""
Destroy current view
"""
view = self.__stack.get_visible_child()
for child in self.__stack.get_children():
if child != view:
self.__stack.set_visible_child(child)
self.__stack.clean_old_views(child)
break
@property
def view(self):
"""
Disable overlays
"""
return self.__stack.get_visible_child()
@property
def progress(self):
"""
Progress bar
@return ProgressBar
"""
return self.__progress
def add_remove_from(self, value, list_one, add):
"""
Add or remove value to list
示例4: DeviceManagerWidget
# 需要导入模块: from lollypop.selectionlist import SelectionList [as 别名]
# 或者: from lollypop.selectionlist.SelectionList import hide [as 别名]
class DeviceManagerWidget(Gtk.Bin, MtpSync):
"""
Widget for synchronize mtp devices
"""
__gsignals__ = {
'sync-finished': (GObject.SignalFlags.RUN_FIRST, None, ())
}
def __init__(self, parent):
"""
Init widget
@param device as Device
@param parent as Gtk.Widget
"""
Gtk.Bin.__init__(self)
MtpSync.__init__(self)
self.__parent = parent
self.__stop = False
self._uri = None
builder = Gtk.Builder()
builder.add_from_resource('/org/gnome/Lollypop/DeviceManagerWidget.ui')
widget = builder.get_object('widget')
self.__error_label = builder.get_object('error-label')
self.__switch_albums = builder.get_object('switch_albums')
self.__switch_albums.set_state(Lp().settings.get_value('sync-albums'))
self.__switch_mp3 = builder.get_object('switch_mp3')
self.__switch_normalize = builder.get_object('switch_normalize')
if not self._check_encoder_status():
self.__switch_mp3.set_sensitive(False)
self.__switch_normalize.set_sensitive(False)
self.__switch_mp3.set_tooltip_text(_("You need to install " +
"gstreamer-plugins-ugly"))
else:
self.__switch_mp3.set_state(Lp().settings.get_value('convert-mp3'))
self.__menu_items = builder.get_object('menu-items')
self.__menu = builder.get_object('menu')
self.__model = Gtk.ListStore(bool, str, int)
self.__selection_list = SelectionList(False)
self.__selection_list.connect('item-selected',
self.__on_item_selected)
widget.attach(self.__selection_list, 1, 1, 1, 1)
self.__selection_list.set_hexpand(True)
self.__view = builder.get_object('view')
self.__view.set_model(self.__model)
builder.connect_signals(self)
self.add(widget)
self.__infobar = builder.get_object('infobar')
self.__infobar_label = builder.get_object('infobarlabel')
renderer0 = Gtk.CellRendererToggle()
renderer0.set_property('activatable', True)
renderer0.connect('toggled', self.__on_item_toggled)
column0 = Gtk.TreeViewColumn(" ✓", renderer0, active=0)
column0.set_clickable(True)
column0.connect('clicked', self.__on_column0_clicked)
renderer1 = CellRendererAlbum()
self.__column1 = Gtk.TreeViewColumn("", renderer1, album=2)
renderer2 = Gtk.CellRendererText()
renderer2.set_property('ellipsize-set', True)
renderer2.set_property('ellipsize', Pango.EllipsizeMode.END)
self.__column2 = Gtk.TreeViewColumn("", renderer2, markup=1)
self.__column2.set_expand(True)
self.__view.append_column(column0)
self.__view.append_column(self.__column1)
self.__view.append_column(self.__column2)
def populate(self):
"""
Populate playlists
@thread safe
"""
self.__model.clear()
self.__stop = False
if Lp().settings.get_value('sync-albums'):
self.__selection_list.clear()
self.__setup_list_artists(self.__selection_list)
self.__column1.set_visible(True)
self.__column2.set_title(_("Albums"))
self.__selection_list.show()
self.__selection_list.select_ids([Type.ALL])
else:
playlists = [(Type.LOVED, Lp().playlists.LOVED)]
playlists += Lp().playlists.get()
self.__append_playlists(playlists)
self.__column1.set_visible(False)
self.__column2.set_title(_("Playlists"))
self.__selection_list.hide()
def set_uri(self, uri):
"""
#.........这里部分代码省略.........
示例5: __init__
# 需要导入模块: from lollypop.selectionlist import SelectionList [as 别名]
# 或者: from lollypop.selectionlist.SelectionList import hide [as 别名]
#.........这里部分代码省略.........
def _setup_list_artists(self, selection_list, genre_id, update):
"""
Setup list for artists
@param list as SelectionList
@param update as bool, if True, just update entries
@thread safe
"""
def load():
sql = Lp.db.get_cursor()
artists = Lp.artists.get(genre_id, sql)
compilations = Lp.albums.get_compilations(genre_id, sql)
sql.close()
return (artists, compilations)
def setup(artists, compilations):
if selection_list == self._list_one:
items = self._get_headers()
items.append((Type.SEPARATOR, ""))
else:
items = []
if compilations:
items.append((Type.COMPILATIONS, _("Compilations")))
items += artists
selection_list.mark_as_artists(True)
if update:
selection_list.update_values(items)
else:
selection_list.populate(items)
if selection_list == self._list_one:
if self._list_two.is_visible():
self._list_two.hide()
self._list_two_restore = Type.NONE
loader = Loader(target=load, view=selection_list, on_finished=lambda r: setup(*r))
loader.start()
def _setup_list_playlists(self, update):
"""
Setup list for playlists
@param update as bool
@thread safe
"""
playlists = [(Type.LOVED, Lp.playlists._LOVED)]
playlists += [(Type.POPULARS, _("Popular tracks"))]
playlists += [(Type.RECENTS, _("Recently played"))]
playlists += [(Type.NEVER, _("Never played"))]
playlists += [(Type.RANDOMS, _("Random tracks"))]
playlists.append((Type.SEPARATOR, ""))
playlists += Lp.playlists.get()
if update:
self._list_two.update_values(playlists)
else:
self._list_two.mark_as_artists(False)
self._list_two.populate(playlists)
def _update_view_device(self, device_id):
"""
Update current view with device view,
Use existing view if available
@param device id as int
"""
device = self._devices[device_id]
child = self._stack.get_child_by_name(device.uri)