class WebcastSearchView(gtk.VBox): def __init__(self, source_tab): gtk.VBox.__init__(self) self.source_tab = source_tab self.webcast_view = MultiDragWebcastView() self.webcast_view.connect_after("double-click-item", self.__on_double_click_item) self.webcast_view_sw = self.webcast_view.get_scrolled_window() self.search_prompt = SearchPrompt(_("Radio")) self.add(self.webcast_view_sw) def start_search_songs(self, keyword): songs = self.webcast_view.get_search_songs(keyword) if songs: self.webcast_view.add_webcasts(songs) switch_tab(self, self.webcast_view_sw) else: self.search_prompt.update_keyword(keyword) switch_tab(self, self.search_prompt) def __on_double_click_item(self, *args): Dispatcher.emit("switch-source", self.source_tab)
class RadioSearchView(gtk.VBox): def __init__(self, source_tab): gtk.VBox.__init__(self) self.source_tab = source_tab self.radio_view = RadioIconView(tag=TAG_SEARCH, limit=24, padding_y=10, has_add=False) self.radio_view_sw = self.radio_view.get_scrolled_window() self.radio_view.fetch_failed = self.switch_to_search_prompt self.radio_view.fetch_successed = self.switch_to_radio_view self.radio_view.connect_after("single-click-item", self.on_radio_view_click_item) self.search_prompt = SearchPrompt(_("MusicFM")) self.add(self.radio_view_sw) self.keyword = "" def start_search_songs(self, keyword): self.radio_view.clear_items(add_more=False) switch_tab(self, self.radio_view_sw) self.radio_view.set_keyword(keyword) self.radio_view.start_fetch_channels() self.keyword = keyword def switch_to_radio_view(self): switch_tab(self, self.radio_view_sw) def switch_to_search_prompt(self): self.search_prompt.update_keyword(self.keyword) switch_tab(self, self.search_prompt) def on_radio_view_click_item(self, widget, item, x, y): if item: if not hasattr(item, "is_more") and item.mask_flag: Dispatcher.emit("switch-source", self.source_tab)
def __init__(self, source_tab): gtk.VBox.__init__(self) self.source_tab = source_tab self.song_view = MultiDragSongView() self.search_prompt = SearchPrompt(_("Library")) self.add(self.song_view) self.song_view.connect("double-click-item", self.__on_double_click_item)
def __init__(self, source_tab): gtk.VBox.__init__(self) self.source_tab = source_tab self.webcast_view = MultiDragWebcastView() self.webcast_view.connect_after("double-click-item", self.__on_double_click_item) self.webcast_view_sw = self.webcast_view.get_scrolled_window() self.search_prompt = SearchPrompt(_("Radio")) self.add(self.webcast_view_sw)
def __init__(self, source_tab): gtk.VBox.__init__(self) self.source_tab = source_tab self.radio_view = RadioIconView(tag=TAG_SEARCH, limit=24, padding_y=10, has_add=False) self.radio_view_sw = self.radio_view.get_scrolled_window() self.radio_view.fetch_failed = self.switch_to_search_prompt self.radio_view.fetch_successed = self.switch_to_radio_view self.radio_view.connect_after("single-click-item", self.on_radio_view_click_item) self.search_prompt = SearchPrompt(_("MusicFM")) self.add(self.radio_view_sw) self.keyword = ""
class LocalSearchView(gtk.VBox): def __init__(self, source_tab): gtk.VBox.__init__(self) self.source_tab = source_tab self.song_view = MultiDragSongView() self.search_prompt = SearchPrompt(_("Library")) self.add(self.song_view) self.song_view.connect("double-click-item", self.__on_double_click_item) def start_search_songs(self, keyword): songs = self.song_view.get_search_songs(keyword) if songs: self.song_view.add_songs(songs) switch_tab(self, self.song_view) else: self.search_prompt.update_keyword(keyword) switch_tab(self, self.search_prompt) def __on_double_click_item(self, *args): Dispatcher.emit("switch-source", self.source_tab)