def __on_play_clicked(self, button): """ Play radio @param button as Gtk.Button """ track = Track() track.set_radio_id(self._radio_id) App().player.load(track)
def __on_play_clicked(self, button): """ Play radio @param button as Gtk.Button """ if App().player.is_locked: return True track = Track() track.set_radio_id(self.__radio_id) App().player.load(track)
def __init__(self, radio_id, radios): """ Init Popover @param radio_id as int @param radios as Radios """ Popover.__init__(self) self.connect("map", self.__on_map) self.__radio_id = radio_id self.__radios = radios self.__start = 0 self.__orig_pixbufs = {} self.__cancellable = Gio.Cancellable() self.__stack = Gtk.Stack() self.__stack.set_transition_duration(1000) self.__stack.set_transition_type(Gtk.StackTransitionType.CROSSFADE) self.__stack.show() builder = Gtk.Builder() builder.add_from_resource("/org/gnome/Lollypop/RadioPopover.ui") builder.connect_signals(self) self.__view = Gtk.FlowBox() self.__view.set_selection_mode(Gtk.SelectionMode.NONE) self.__view.connect("child-activated", self.__on_activate) self.__view.set_max_children_per_line(100) self.__view.set_property("row-spacing", 10) self.__view.show() builder.get_object("viewport").add(self.__view) self.__name_entry = builder.get_object("name") self.__uri_entry = builder.get_object("uri") self.__image_button = builder.get_object("image_button") self.__save_button = builder.get_object("save_button") self.__spinner = builder.get_object("spinner") self.__stack.add_named(builder.get_object("spinner-grid"), "spinner") self.__stack.add_named(builder.get_object("notfound"), "notfound") self.__stack.add_named(builder.get_object("logo"), "logo") self.__stack.add_named(builder.get_object("widget"), "widget") self.__stack.set_visible_child_name("widget") self.add(self.__stack) track = Track() if radio_id is not None: track.set_radio_id(radio_id) rating = RatingWidget(track) rating.show() builder.get_object("widget").attach(rating, 0, 2, 2, 1) builder.get_object("delete_button").show() self.__name_entry.set_text(radios.get_name(radio_id)) uri = self.__radios.get_uri(radio_id) if uri: self.__uri_entry.set_text(uri)