本文整理汇总了Python中lollypop.selectionlist.SelectionList类的典型用法代码示例。如果您正苦于以下问题:Python SelectionList类的具体用法?Python SelectionList怎么用?Python SelectionList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SelectionList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _setup_view
def _setup_view(self):
self._paned_main_list = Gtk.HPaned()
self._paned_list_view = Gtk.HPaned()
vgrid = Gtk.Grid()
vgrid.set_orientation(Gtk.Orientation.VERTICAL)
self._list_one = SelectionList()
self._list_one.widget.show()
self._list_two = SelectionList()
self._list_one.connect('item-selected', self._on_list_one_selected)
self._list_one.connect('populated', self._on_list_one_populated)
self._list_two.connect('item-selected', self._on_list_two_selected)
self._list_two.connect('populated', self._on_list_two_populated)
self._progress = Gtk.ProgressBar()
vgrid.add(self._stack)
vgrid.add(self._progress)
vgrid.show()
separator = Gtk.Separator()
separator.show()
self._paned_list_view.add1(self._list_two.widget)
self._paned_list_view.add2(vgrid)
self._paned_main_list.add1(self._list_one.widget)
self._paned_main_list.add2(self._paned_list_view)
self._paned_main_list.set_position(
Objects.settings.get_value(
"paned-mainlist-width").get_int32())
self._paned_list_view.set_position(
Objects.settings.get_value(
"paned-listview-width").get_int32())
self._paned_main_list.show()
self._paned_list_view.show()
示例2: _setup_view
def _setup_view(self):
self._paned_main_list = Gtk.Paned.new(Gtk.Orientation.HORIZONTAL)
self._paned_list_view = Gtk.Paned.new(Gtk.Orientation.HORIZONTAL)
vgrid = Gtk.Grid()
vgrid.set_orientation(Gtk.Orientation.VERTICAL)
self._list_one = SelectionList()
self._list_one.show()
self._list_two = SelectionList()
self._list_one.connect('item-selected', self._on_list_one_selected)
self._list_one.connect('populated', self._on_list_populated)
self._list_two.connect('item-selected', self._on_list_two_selected)
self._progress = Gtk.ProgressBar()
self._progress.set_property('hexpand', True)
vgrid.add(self._stack)
vgrid.add(self._progress)
vgrid.show()
separator = Gtk.Separator()
separator.show()
self._paned_list_view.add1(self._list_two)
self._paned_list_view.add2(vgrid)
self._paned_main_list.add1(self._list_one)
self._paned_main_list.add2(self._paned_list_view)
self._paned_main_list.set_position(
Lp.settings.get_value('paned-mainlist-width').get_int32())
self._paned_list_view.set_position(
Lp.settings.get_value('paned-listview-width').get_int32())
self._paned_main_list.show()
self._paned_list_view.show()
示例3: _setup_view
def _setup_view(self):
self._paned_main_list = Gtk.HPaned()
self._paned_list_view = Gtk.HPaned()
vgrid = Gtk.Grid()
vgrid.set_orientation(Gtk.Orientation.VERTICAL)
self._toolbar = Toolbar()
self._toolbar.header_bar.show()
self._toolbar.get_view_genres_btn().connect("toggled", self._setup_list_one)
self._list_one = SelectionList("Genre")
self._list_two = SelectionList("Artist")
self._list_one_signal = None
self._list_two_signal = None
self._loading = True
loading_view = LoadingView()
self._stack = Gtk.Stack()
self._stack.add(loading_view)
self._stack.set_visible_child(loading_view)
self._stack.set_transition_duration(500)
self._stack.set_transition_type(Gtk.StackTransitionType.CROSSFADE)
self._stack.show()
self._progress = Gtk.ProgressBar()
vgrid.add(self._stack)
vgrid.add(self._progress)
vgrid.show()
DESKTOP = environ.get("XDG_CURRENT_DESKTOP")
if DESKTOP and ("GNOME" in DESKTOP or "Pantheon" in DESKTOP):
self.set_titlebar(self._toolbar.header_bar)
self._toolbar.header_bar.set_show_close_button(True)
self.add(self._paned_main_list)
else:
hgrid = Gtk.Grid()
hgrid.set_orientation(Gtk.Orientation.VERTICAL)
hgrid.add(self._toolbar.header_bar)
hgrid.add(self._paned_main_list)
hgrid.show()
self.add(hgrid)
separator = Gtk.Separator()
separator.show()
self._paned_list_view.add1(self._list_two.widget)
self._paned_list_view.add2(vgrid)
self._paned_main_list.add1(self._list_one.widget)
self._paned_main_list.add2(self._paned_list_view)
self._paned_main_list.set_position(Objects["settings"].get_value("paned-mainlist-width").get_int32())
self._paned_list_view.set_position(Objects["settings"].get_value("paned-listview-width").get_int32())
self._paned_main_list.show()
self._paned_list_view.show()
self.show()
示例4: _setup_view
def _setup_view(self):
self._box = Gtk.Grid()
self._toolbar = Toolbar(self._db, self._player)
self.set_titlebar(self._toolbar.header_bar)
self._toolbar.header_bar.show()
self._toolbar.get_infobox().connect("button-press-event", self._show_current_album)
self._list_genres = SelectionList("Genre", 150)
self._list_artists = SelectionList("Artist", 200)
self._view = LoadingView()
separator = Gtk.Separator()
separator.show()
self._box.add(self._list_genres.widget)
self._box.add(separator)
self._box.add(self._list_artists.widget)
self._box.add(self._view)
self.add(self._box)
self._box.show()
self.show()
示例5: __setup_view
def __setup_view(self):
"""
Setup window main view:
- genre list
- artist list
- main view as artist view or album view
"""
self._paned_main_list = Gtk.Paned.new(Gtk.Orientation.HORIZONTAL)
self._paned_list_view = Gtk.Paned.new(Gtk.Orientation.HORIZONTAL)
vgrid = Gtk.Grid()
vgrid.set_orientation(Gtk.Orientation.VERTICAL)
self.__list_one = SelectionList()
if Lp().settings.get_value('show-navigation-list'):
self.__list_one.show()
self.__list_two = SelectionList()
self.__list_one.connect('item-selected', self.__on_list_one_selected)
self.__list_one.connect('populated', self.__on_list_populated)
self.__list_two.connect('item-selected', self.__on_list_two_selected)
self.__progress = ProgressBar()
self.__progress.set_property('hexpand', True)
vgrid.add(self.__stack)
vgrid.add(self.__progress)
vgrid.show()
self._paned_list_view.add1(self.__list_two)
self._paned_list_view.add2(vgrid)
self._paned_main_list.add1(self.__list_one)
self._paned_main_list.add2(self._paned_list_view)
self._paned_main_list.set_position(
Lp().settings.get_value('paned-mainlist-width').get_int32())
self._paned_list_view.set_position(
Lp().settings.get_value('paned-listview-width').get_int32())
self._paned_main_list.show()
self._paned_list_view.show()
示例6: _setup_view
def _setup_view(self):
"""
Setup window main view:
- genre list
- artist list
- main view as artist view or album view
"""
self._paned_main_list = Gtk.Paned.new(Gtk.Orientation.HORIZONTAL)
self._paned_list_view = Gtk.Paned.new(Gtk.Orientation.HORIZONTAL)
vgrid = Gtk.Grid()
vgrid.set_orientation(Gtk.Orientation.VERTICAL)
self._list_one = SelectionList()
self._list_one.show()
self._list_two = SelectionList()
self._list_one.connect("item-selected", self._on_list_one_selected)
self._list_one.connect("populated", self._on_list_populated)
self._list_two.connect("item-selected", self._on_list_two_selected)
self._progress = Gtk.ProgressBar()
self._progress.set_property("hexpand", True)
vgrid.add(self._stack)
vgrid.add(self._progress)
vgrid.show()
separator = Gtk.Separator()
separator.show()
self._paned_list_view.add1(self._list_two)
self._paned_list_view.add2(vgrid)
self._paned_main_list.add1(self._list_one)
self._paned_main_list.add2(self._paned_list_view)
self._paned_main_list.set_position(Lp.settings.get_value("paned-mainlist-width").get_int32())
self._paned_list_view.set_position(Lp.settings.get_value("paned-listview-width").get_int32())
self._paned_main_list.show()
self._paned_list_view.show()
示例7: __init__
#.........这里部分代码省略.........
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
"""
if self._progress.is_visible() and not Lp().scanner.is_locked():
self._progress.pulse()
return True
else:
self._progress.set_fraction(0.0)
return False
def _setup_view(self):
"""
Setup window main view:
- genre list
- artist list
- main view as artist view or album view
"""
self._paned_main_list = Gtk.Paned.new(Gtk.Orientation.HORIZONTAL)
self._paned_list_view = Gtk.Paned.new(Gtk.Orientation.HORIZONTAL)
vgrid = Gtk.Grid()
vgrid.set_orientation(Gtk.Orientation.VERTICAL)
self._list_one = SelectionList(SelectionMode.LIMITED)
self._list_one.show()
self._list_two = SelectionList(SelectionMode.NORMAL)
self._list_one.connect('item-selected', self._on_list_one_selected)
self._list_one.connect('populated', self._on_list_populated)
self._list_two.connect('item-selected', self._on_list_two_selected)
self._progress = Gtk.ProgressBar()
self._progress.set_property('hexpand', True)
vgrid.add(self._stack)
vgrid.add(self._progress)
vgrid.show()
self._paned_list_view.add1(self._list_two)
self._paned_list_view.add2(vgrid)
self._paned_main_list.add1(self._list_one)
self._paned_main_list.add2(self._paned_list_view)
self._paned_main_list.set_position(
Lp().settings.get_value('paned-mainlist-width').get_int32())
self._paned_list_view.set_position(
Lp().settings.get_value('paned-listview-width').get_int32())
self._paned_main_list.show()
self._paned_list_view.show()
def _get_saved_view_state(self):
"""
Get save view state
@return (list one id, list two id)
"""
list_one_ids = [Type.POPULARS]
list_two_ids = [Type.NONE]
if Lp().settings.get_value('save-state'):
示例8: __init__
#.........这里部分代码省略.........
"""
Update current view
"""
def update_view(self):
view = self._stack.get_visible_child()
if view:
start_new_thread(view.update_covers, ())
"""
Mark force scan as False, update lists
@param scanner as CollectionScanner
"""
def on_scan_finished(self, scanner):
if self._list_one.is_populating() or self._list_two.is_populating():
GLib.timeout_add(500, self.on_scan_finished, scanner)
else:
self._update_lists(scanner)
############
# Private #
############
"""
Setup window main view:
- genre list
- artist list
- main view as artist view or album view
"""
def _setup_view(self):
self._paned_main_list = Gtk.Paned.new(Gtk.Orientation.HORIZONTAL)
self._paned_list_view = Gtk.Paned.new(Gtk.Orientation.HORIZONTAL)
vgrid = Gtk.Grid()
vgrid.set_orientation(Gtk.Orientation.VERTICAL)
self._list_one = SelectionList()
self._list_one.show()
self._list_two = SelectionList()
self._list_one.connect('item-selected', self._on_list_one_selected)
self._list_one.connect('populated', self._on_list_populated)
self._list_two.connect('item-selected', self._on_list_two_selected)
self._progress = Gtk.ProgressBar()
self._progress.set_property('hexpand', True)
vgrid.add(self._stack)
vgrid.add(self._progress)
vgrid.show()
separator = Gtk.Separator()
separator.show()
self._paned_list_view.add1(self._list_two)
self._paned_list_view.add2(vgrid)
self._paned_main_list.add1(self._list_one)
self._paned_main_list.add2(self._paned_list_view)
self._paned_main_list.set_position(
Lp.settings.get_value('paned-mainlist-width').get_int32())
self._paned_list_view.set_position(
Lp.settings.get_value('paned-listview-width').get_int32())
self._paned_main_list.show()
self._paned_list_view.show()
"""
Get save view state
@return (list one id, list two id)
"""
def _get_saved_view_state(self):
list_one_id = Type.POPULARS
示例9: __init__
#.........这里部分代码省略.........
self._stack.clean_old_views(None)
"""
Show/Hide genres
@param bool
"""
def show_genres(self, show):
self._show_genres = show
self._update_list_one(None)
"""
Destroy current view
"""
def destroy_current_view(self):
view = self._stack.get_visible_child()
view.hide()
GLib.timeout_add(2000, view.destroy)
############
# Private #
############
"""
Setup window main view:
- genre list
- artist list
- main view as artist view or album view
"""
def _setup_view(self):
self._paned_main_list = Gtk.HPaned()
self._paned_list_view = Gtk.HPaned()
vgrid = Gtk.Grid()
vgrid.set_orientation(Gtk.Orientation.VERTICAL)
self._list_one = SelectionList()
self._list_one.widget.show()
self._list_two = SelectionList()
self._list_one.connect('item-selected', self._on_list_one_selected)
self._list_one.connect('populated', self._on_list_one_populated)
self._list_two.connect('item-selected', self._on_list_two_selected)
self._list_two.connect('populated', self._on_list_two_populated)
self._progress = Gtk.ProgressBar()
vgrid.add(self._stack)
vgrid.add(self._progress)
vgrid.show()
separator = Gtk.Separator()
separator.show()
self._paned_list_view.add1(self._list_two.widget)
self._paned_list_view.add2(vgrid)
self._paned_main_list.add1(self._list_one.widget)
self._paned_main_list.add2(self._paned_list_view)
self._paned_main_list.set_position(
Objects.settings.get_value(
"paned-mainlist-width").get_int32())
self._paned_list_view.set_position(
Objects.settings.get_value(
"paned-listview-width").get_int32())
self._paned_main_list.show()
self._paned_list_view.show()
"""
Restore saved view
"""
def _restore_view_state(self):
示例10: Window
#.........这里部分代码省略.........
size_setting = Objects["settings"].get_value('window-size')
if isinstance(size_setting[0], int) and isinstance(size_setting[1], int):
self.resize(size_setting[0], size_setting[1])
else:
self.set_size_request(800, 600)
position_setting = Objects["settings"].get_value('window-position')
if len(position_setting) == 2 \
and isinstance(position_setting[0], int) \
and isinstance(position_setting[1], int):
self.move(position_setting[0], position_setting[1])
if Objects["settings"].get_value('window-maximized'):
self.maximize()
self.connect("window-state-event", self._on_window_state_event)
self.connect("configure-event", self._on_configure_event)
"""
Setup window main view:
- genre list
- artist list
- main view as artist view or album view
"""
def _setup_view(self):
self._paned_main_list = Gtk.HPaned()
self._paned_list_view = Gtk.HPaned()
vgrid = Gtk.Grid()
vgrid.set_orientation(Gtk.Orientation.VERTICAL)
self._toolbar = Toolbar()
self._toolbar.header_bar.show()
self._toolbar.get_view_genres_btn().connect("toggled", self._setup_list_one)
self._list_one = SelectionList("Genre")
self._list_two = SelectionList("Artist")
self._list_one_signal = None
self._list_two_signal = None
self._loading = True
loading_view = LoadingView()
self._stack = Gtk.Stack()
self._stack.add(loading_view)
self._stack.set_visible_child(loading_view)
self._stack.set_transition_duration(500)
self._stack.set_transition_type(Gtk.StackTransitionType.CROSSFADE)
self._stack.show()
self._progress = Gtk.ProgressBar()
vgrid.add(self._stack)
vgrid.add(self._progress)
vgrid.show()
DESKTOP = environ.get("XDG_CURRENT_DESKTOP")
if DESKTOP and ("GNOME" in DESKTOP or "Pantheon" in DESKTOP):
self.set_titlebar(self._toolbar.header_bar)
self._toolbar.header_bar.set_show_close_button(True)
self.add(self._paned_main_list)
else:
hgrid = Gtk.Grid()
hgrid.set_orientation(Gtk.Orientation.VERTICAL)
hgrid.add(self._toolbar.header_bar)
hgrid.add(self._paned_main_list)
hgrid.show()
self.add(hgrid)
示例11: Window
#.........这里部分代码省略.........
"""
def _setup_window(self):
self.set_size_request(200, 100)
self.set_icon_name('lollypop')
size_setting = self._settings.get_value('window-size')
if isinstance(size_setting[0], int) and isinstance(size_setting[1], int):
self.resize(size_setting[0], size_setting[1])
position_setting = self._settings.get_value('window-position')
if len(position_setting) == 2 \
and isinstance(position_setting[0], int) \
and isinstance(position_setting[1], int):
self.move(position_setting[0], position_setting[1])
if self._settings.get_value('window-maximized'):
self.maximize()
self.connect("window-state-event", self._on_window_state_event)
self.connect("configure-event", self._on_configure_event)
"""
Setup window main view:
- genre list
- artist list
- main view as artist view or album view
"""
def _setup_view(self):
self._box = Gtk.Grid()
self._toolbar = Toolbar(self._db, self._player)
self.set_titlebar(self._toolbar.header_bar)
self._toolbar.header_bar.show()
self._toolbar.get_infobox().connect("button-press-event", self._show_current_album)
self._list_genres = SelectionList("Genre", 150)
self._list_artists = SelectionList("Artist", 200)
self._view = LoadingView()
separator = Gtk.Separator()
separator.show()
self._box.add(self._list_genres.widget)
self._box.add(separator)
self._box.add(self._list_artists.widget)
self._box.add(self._view)
self.add(self._box)
self._box.show()
self.show()
"""
Run collection update on mapped window
Pass _update_genre() as collection scanned callback
"""
def _on_mapped_window(self, obj, data):
if self._db.is_empty():
self._scanner.update(self._update_genres)
else:
genres = self._db.get_all_genres()
self._update_genres(genres)
"""
Update genres list with genres
"""
def _update_genres(self, genres):
genres.insert(0, (-1, _("All genres")))
genres.insert(0, (-2, _("Populars albums")))
self._list_genres.populate(genres)
示例12: __init__
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)
示例13: DeviceManagerWidget
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):
"""
#.........这里部分代码省略.........
示例14: __init__
#.........这里部分代码省略.........
if self.__list_two.was_visible:
self.__list_two.show()
Lp().settings.set_value('show-navigation-list',
GLib.Variant('b',
self.__list_one.is_visible()))
############
# PRIVATE #
############
def __pulse(self):
"""
Make progress bar pulse while visible
@param pulse as bool
"""
if self.__progress.is_visible() and not Lp().scanner.is_locked():
self.__progress.pulse()
return True
else:
self.__progress.set_fraction(0.0, self)
return False
def __setup_view(self):
"""
Setup window main view:
- genre list
- artist list
- main view as artist view or album view
"""
self._paned_main_list = Gtk.Paned.new(Gtk.Orientation.HORIZONTAL)
self._paned_list_view = Gtk.Paned.new(Gtk.Orientation.HORIZONTAL)
vgrid = Gtk.Grid()
vgrid.set_orientation(Gtk.Orientation.VERTICAL)
self.__list_one = SelectionList()
if Lp().settings.get_value('show-navigation-list'):
self.__list_one.show()
self.__list_two = SelectionList()
self.__list_one.connect('item-selected', self.__on_list_one_selected)
self.__list_one.connect('populated', self.__on_list_populated)
self.__list_two.connect('item-selected', self.__on_list_two_selected)
self.__progress = ProgressBar()
self.__progress.set_property('hexpand', True)
vgrid.add(self.__stack)
vgrid.add(self.__progress)
vgrid.show()
self._paned_list_view.add1(self.__list_two)
self._paned_list_view.add2(vgrid)
self._paned_main_list.add1(self.__list_one)
self._paned_main_list.add2(self._paned_list_view)
self._paned_main_list.set_position(
Lp().settings.get_value('paned-mainlist-width').get_int32())
self._paned_list_view.set_position(
Lp().settings.get_value('paned-listview-width').get_int32())
self._paned_main_list.show()
self._paned_list_view.show()
def __get_saved_view_state(self):
"""
Get save view state
@return (list one id, list two id)
"""
list_one_ids = [Type.POPULARS]
list_two_ids = [Type.NONE]
示例15: __init__
#.........这里部分代码省略.........
self._stack.clean_old_views(child)
break
def update_view(self):
"""
Update current view
"""
view = self._stack.get_visible_child()
if view:
view.update_covers()
def on_scan_finished(self, scanner):
"""
Mark force scan as False, update lists
@param scanner as CollectionScanner
"""
self._update_lists(scanner)
############
# Private #
############
def _setup_view(self):
"""
Setup window main view:
- genre list
- artist list
- main view as artist view or album view
"""
self._paned_main_list = Gtk.Paned.new(Gtk.Orientation.HORIZONTAL)
self._paned_list_view = Gtk.Paned.new(Gtk.Orientation.HORIZONTAL)
vgrid = Gtk.Grid()
vgrid.set_orientation(Gtk.Orientation.VERTICAL)
self._list_one = SelectionList()
self._list_one.show()
self._list_two = SelectionList()
self._list_one.connect("item-selected", self._on_list_one_selected)
self._list_one.connect("populated", self._on_list_populated)
self._list_two.connect("item-selected", self._on_list_two_selected)
self._progress = Gtk.ProgressBar()
self._progress.set_property("hexpand", True)
vgrid.add(self._stack)
vgrid.add(self._progress)
vgrid.show()
separator = Gtk.Separator()
separator.show()
self._paned_list_view.add1(self._list_two)
self._paned_list_view.add2(vgrid)
self._paned_main_list.add1(self._list_one)
self._paned_main_list.add2(self._paned_list_view)
self._paned_main_list.set_position(Lp.settings.get_value("paned-mainlist-width").get_int32())
self._paned_list_view.set_position(Lp.settings.get_value("paned-listview-width").get_int32())
self._paned_main_list.show()
self._paned_list_view.show()
def _get_saved_view_state(self):
"""
Get save view state
@return (list one id, list two id)
"""
list_one_id = Type.POPULARS
list_two_id = Type.NONE
if Lp.settings.get_value("save-state"):