예제 #1
0
 def _show_model_with_cover(self, reader, table, model_cls, filter_model_cls):
     self.container.current_table = table
     filter_model = filter_model_cls()
     source_name_map = {p.identifier: p.name for p in self._app.library.list()}
     model = model_cls(reader,
                       fetch_cover_wrapper(self._app.img_mgr),
                       source_name_map=source_name_map)
     filter_model.setSourceModel(model)
     table.setModel(filter_model)
     table.scrollToTop()
     disconnect_slots_if_has(self._app.ui.magicbox.filter_text_changed)
     self._app.ui.magicbox.filter_text_changed.connect(filter_model.filter_by_text)
예제 #2
0
async def render(req, **kwargs):
    app = req.ctx['app']
    provider = app.library.get('netease')

    playlists = provider._user.rec_playlists
    view = ExploreView()
    model = PlaylistListModel(wrap(playlists), fetch_cover_wrapper(
        app.img_mgr), {p.identifier: p.name
                       for p in app.library.list()})
    filter_model = PlaylistFilterProxyModel()
    filter_model.setSourceModel(model)
    view.playlist_list_view.setModel(filter_model)
    view.playlist_list_view.show_playlist_needed.connect(
        lambda model: app.browser.goto(model=model))
    app.ui.right_panel.set_body(view)