def __del_from_loved(self, action, variant): """ Remove from loved @param SimpleAction @param GVariant @param playlist name as str """ utils.set_loved(self._object_id, False)
def _del_from_loved(self, action, variant): """ Remove from loved @param SimpleAction @param GVariant @param playlist name as str """ utils.set_loved(self._object_id, False)
def __add_to_loved(self, action, variant): """ Add to loved @param SimpleAction @param GVariant @param playlist name as str """ utils.set_loved(self._object_id, True)
def _add_to_loved(self, action, variant): """ Add to loved @param SimpleAction @param GVariant @param playlist name as str """ utils.set_loved(self._object_id, True)
def _on_button_press(self, widget, event): """ On button press, toggle loved status @param widget as Gtk.EventBox @param event as Gdk.Event """ loved = not is_loved(self._track_id) set_loved(self._track_id, loved) self.set_opacity(0.8 if loved else 0.1)
def _on_player_action(self, action, param): """ Change player state @param action as Gio.SimpleAction @param param as GLib.Variant """ string = param.get_string() if string == "play_pause": Lp().player.play_pause() elif string == "play": Lp().player.play() elif string == "stop": Lp().player.stop() elif string == "next": Lp().player.next() elif string == "next_album": # In party or shuffle, just update next track if Lp().player.is_party() or\ Lp().settings.get_enum('shuffle') == Shuffle.TRACKS: Lp().player.set_next() # We send this signal to update next popover Lp().player.emit('queue-changed') else: Lp().player.set_next_context(NextContext.START_NEW_ALBUM) Lp().player.set_next() Lp().player.next() elif string == "prev": Lp().player.prev() elif string == "locked": if Lp().player.locked: Lp().player.set_state(PlayerState.NONE) else: Lp().player.set_state(PlayerState.LOCKED) elif string == "queued": if Lp().player.queued: Lp().player.set_state(PlayerState.NONE) else: Lp().player.set_state(PlayerState.QUEUED) elif string == "loved": if Lp().player.current_track.id is not None: isloved = is_loved(Lp().player.current_track.id) set_loved(Lp().player.current_track.id, not isloved) if Lp().notify is not None: if isloved: heart = "♡" else: heart = "❤" Lp().notify.send("%s - %s: %s" % ( ", ".join(Lp().player.current_track.artists), Lp().player.current_track.name, heart))
def __on_player_action(self, action, param): """ Change player state @param action as Gio.SimpleAction @param param as GLib.Variant """ string = param.get_string() if string == "play_pause": Lp().player.play_pause() elif string == "play": Lp().player.play() elif string == "stop": Lp().player.stop() elif string == "next": Lp().player.next() elif string == "next_album": # In party or shuffle, just update next track if Lp().player.is_party or\ Lp().settings.get_enum('shuffle') == Shuffle.TRACKS: Lp().player.set_next() # We send this signal to update next popover Lp().player.emit('queue-changed') else: Lp().player.set_next_context(NextContext.START_NEW_ALBUM) Lp().player.set_next() Lp().player.next() elif string == "prev": Lp().player.prev() elif string == "locked": Lp().player.lock() elif string == "volume": self.__toolbar.show_hide_volume_control() elif string == "show-genres": state = not Lp().settings.get_value('show-genres') Lp().settings.set_value('show-genres', GLib.Variant('b', state)) Lp().window.show_genres(state) elif string == "loved": if Lp().player.current_track.id is not None: isloved = is_loved(Lp().player.current_track.id) set_loved(Lp().player.current_track.id, not isloved) if Lp().notify is not None: if isloved: heart = "♡" else: heart = "❤" Lp().notify.send( "%s - %s: %s" % (", ".join(Lp().player.current_track.artists), Lp().player.current_track.name, heart))
def _on_button_press(self, widget, event): """ On button press, toggle loved status @param widget as Gtk.EventBox @param event as Gdk.Event """ if isinstance(self.__object, Album): loved = not self.__object.loved self.__object.set_loved(loved) self.__object.loved = loved else: loved = not is_loved(self.__object.id) set_loved(self.__object.id, loved) self.set_opacity(0.8 if loved else 0.2) return True
def __on_player_action(self, action, param): """ Change player state @param action as Gio.SimpleAction @param param as GLib.Variant """ string = param.get_string() if string == "play_pause": Lp().player.play_pause() elif string == "play": Lp().player.play() elif string == "stop": Lp().player.stop() elif string == "next": Lp().player.next() elif string == "next_album": Lp().player.skip_album() elif string == "prev": Lp().player.prev() elif string == "locked": Lp().player.lock() elif string == "hide_pane": self._hide_pane() elif string == "filter": if self.view is not None: self.view.set_search_mode() elif string == "volume": self.__toolbar.show_hide_volume_control() elif string == "show_genres": state = not Lp().settings.get_value("show-genres") Lp().settings.set_value("show-genres", GLib.Variant("b", state)) Lp().window.show_genres(state) elif string == "loved": if Lp().player.current_track.id is not None and\ Lp().player.current_track.id >= 0: isloved = is_loved(Lp().player.current_track.id) set_loved(Lp().player.current_track.id, not isloved) if Lp().notify is not None: if isloved: heart = "♡" else: heart = "❤" Lp().notify.send("%s - %s: %s" % ( ", ".join(Lp().player.current_track.artists), Lp().player.current_track.name, heart))
def __on_player_action(self, action, param): """ Change player state @param action as Gio.SimpleAction @param param as GLib.Variant """ string = param.get_string() if string == "play_pause": Lp().player.play_pause() elif string == "play": Lp().player.play() elif string == "stop": Lp().player.stop() elif string == "next": Lp().player.next() elif string == "next_album": Lp().player.skip_album() elif string == "prev": Lp().player.prev() elif string == "locked": Lp().player.lock() elif string == "hide_pane": self._hide_pane() elif string == "filter": if self.view is not None: self.view.set_search_mode() elif string == "volume": self.__toolbar.show_hide_volume_control() elif string == "show_genres": state = not Lp().settings.get_value('show-genres') Lp().settings.set_value('show-genres', GLib.Variant('b', state)) Lp().window.show_genres(state) elif string == "loved": if Lp().player.current_track.id is not None: isloved = is_loved(Lp().player.current_track.id) set_loved(Lp().player.current_track.id, not isloved) if Lp().notify is not None: if isloved: heart = "♡" else: heart = "❤" Lp().notify.send("%s - %s: %s" % ( ", ".join(Lp().player.current_track.artists), Lp().player.current_track.name, heart))