예제 #1
0
파일: gui.py 프로젝트: bhuztez/gglfm
 def _setup_child(self):
     playlist_view = self._setup_playlist_view()
     self.list_range = playlist_view.get_vscrollbar()
     self.list_range.connect('value-changed', self.on_position_changed)
     
     self.child = playlist_view
     self.ap_manager = AutoPagerManager(self.load_search, self._append_songs, self.need_page)
예제 #2
0
파일: gui.py 프로젝트: bhuztez/gglfm
class SearchTab(AbstractTab, PlaylistMixin):
    STOCK_ID = gtk.STOCK_FIND

    def _setup_child(self):
        playlist_view = self._setup_playlist_view()
        self.list_range = playlist_view.get_vscrollbar()
        self.list_range.connect('value-changed', self.on_position_changed)
        
        self.child = playlist_view
        self.ap_manager = AutoPagerManager(self.load_search, self._append_songs, self.need_page)

    @threaded
    def load_search(self, page=0):
        results = client.search(self.key[1], page * 20)
        if results:
            self.ap_manager.on_received(results.songList.song)
        else:
            self.ap_manager.on_received(None)

    def need_page(self):
        page_size = self.list_range.get_adjustment().page_size
        position = self.list_range.get_value()
        bottom = self.list_range.get_adjustment().upper
        return (position + page_size * 2 > bottom)

    def on_position_changed(self, range_):
        if self.need_page():
            self.ap_manager.next_page()