예제 #1
0
파일: table.py 프로젝트: zzcandor/FeelUOwn
    def show_songs(self, songs=None, songs_g=None, show_count=False):
        self.container.current_table = self.songs_table
        self.toolbar.show()

        if show_count:
            if songs is not None:
                self.meta_widget.songs_count = len(songs)
            if songs_g is not None:
                count = songs_g.count
                self.meta_widget.songs_count = -1 if count is None else count

        songs = songs or []
        logger.debug('Show songs in table, total: %d', len(songs))
        source_name_map = {
            p.identifier: p.name
            for p in self._app.library.list()
        }
        model = SongsTableModel(source_name_map=source_name_map,
                                songs_g=songs_g,
                                songs=songs,
                                parent=self.songs_table)
        filter_model = SongFilterProxyModel(self.songs_table)
        filter_model.setSourceModel(model)
        self.songs_table.setModel(filter_model)
        self.songs_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
    def show_songs(self, songs=None, songs_g=None, show_count=False):
        if show_count:
            if songs is not None:
                self.meta_widget.songs_count = len(songs)
            if songs_g is not None:
                count = songs_g.count
                self.meta_widget.songs_count = -1 if count is None else count

        self.albums_table.hide()
        songs_table = self.songs_table

        songs = songs or []
        logger.debug('Show songs in table, total: %d', len(songs))
        source_name_map = {
            p.identifier: p.name
            for p in self._app.library.list()
        }
        songs_table.setModel(
            SongsTableModel(source_name_map=source_name_map,
                            songs_g=songs_g,
                            songs=songs,
                            parent=songs_table))
        songs_table.scrollToTop()
        songs_table.show()
        self.meta_widget.toolbar.songs_mode()
예제 #3
0
파일: table.py 프로젝트: wuliaotc/FeelUOwn
    def show_songs(self, reader, show_count=False):
        reader = wrap(reader)
        self.container.current_table = self.songs_table
        self.toolbar.show()

        if show_count:
            count = reader.count
            self.meta_widget.songs_count = -1 if count is None else count

        source_name_map = {p.identifier: p.name for p in self._app.library.list()}
        model = SongsTableModel(
            source_name_map=source_name_map,
            reader=reader,
            parent=self.songs_table)
        filter_model = SongFilterProxyModel(self.songs_table)
        filter_model.setSourceModel(model)
        self.songs_table.setModel(filter_model)
        self.songs_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)