mirror of
https://github.com/SoongNoonien/mpdevil.git
synced 2023-08-10 21:12:44 +03:00
reworked tooltips in PlaybackControl
This commit is contained in:
parent
02dec1f5f8
commit
b1f9f0092d
@ -3000,23 +3000,22 @@ class PlaybackControl(Gtk.ButtonBox):
|
||||
|
||||
# widgets
|
||||
self._play_button_icon=AutoSizedIcon("media-playback-start-symbolic", "icon-size", self._settings)
|
||||
self._play_button=Gtk.Button(image=self._play_button_icon, action_name="mpd.toggle-play", can_focus=False)
|
||||
self._play_button=Gtk.Button(
|
||||
image=self._play_button_icon, action_name="mpd.toggle-play", tooltip_text=_("Play/Pause"), can_focus=False)
|
||||
self._stop_button=Gtk.Button(
|
||||
image=AutoSizedIcon("media-playback-stop-symbolic", "icon-size", self._settings), action_name="mpd.stop",
|
||||
can_focus=False, no_show_all=True
|
||||
)
|
||||
image=AutoSizedIcon("media-playback-stop-symbolic", "icon-size", self._settings), tooltip_text=_("Stop"),
|
||||
action_name="mpd.stop", can_focus=False, no_show_all=True)
|
||||
self._prev_button=Gtk.Button(
|
||||
image=AutoSizedIcon("media-skip-backward-symbolic", "icon-size", self._settings), action_name="mpd.prev", can_focus=False)
|
||||
image=AutoSizedIcon("media-skip-backward-symbolic", "icon-size", self._settings),
|
||||
tooltip_text=_("Previous title"), action_name="mpd.prev", can_focus=False)
|
||||
self._next_button=Gtk.Button(
|
||||
image=AutoSizedIcon("media-skip-forward-symbolic", "icon-size", self._settings), action_name="mpd.next", can_focus=False)
|
||||
image=AutoSizedIcon("media-skip-forward-symbolic", "icon-size", self._settings),
|
||||
tooltip_text=_("Next title"), action_name="mpd.next", can_focus=False)
|
||||
|
||||
# connect
|
||||
self._settings.connect("changed::mini-player", self._mini_player)
|
||||
self._settings.connect("changed::show-stop", self._mini_player)
|
||||
self._client.emitter.connect("state", self._on_state)
|
||||
self._client.emitter.connect("playlist", self._refresh_tooltips)
|
||||
self._client.emitter.connect("current_song", self._refresh_tooltips)
|
||||
self._client.emitter.connect("disconnected", self._on_disconnected)
|
||||
|
||||
# packing
|
||||
self.pack_start(self._prev_button, True, True, 0)
|
||||
@ -3025,21 +3024,6 @@ class PlaybackControl(Gtk.ButtonBox):
|
||||
self.pack_start(self._next_button, True, True, 0)
|
||||
self._mini_player()
|
||||
|
||||
def _refresh_tooltips(self, *args):
|
||||
status=self._client.status()
|
||||
song=status.get("song")
|
||||
length=status.get("playlistlength")
|
||||
if song is None or length is None:
|
||||
self._prev_button.set_tooltip_text("")
|
||||
self._next_button.set_tooltip_text("")
|
||||
else:
|
||||
elapsed=int(song)
|
||||
rest=int(length)-elapsed-1
|
||||
elapsed_songs=ngettext("{number} song", "{number} songs", elapsed).format(number=elapsed)
|
||||
rest_songs=ngettext("{number} song", "{number} songs", rest).format(number=rest)
|
||||
self._prev_button.set_tooltip_text(elapsed_songs)
|
||||
self._next_button.set_tooltip_text(rest_songs)
|
||||
|
||||
def _mini_player(self, *args):
|
||||
visibility=(self._settings.get_boolean("show-stop") and not self._settings.get_boolean("mini-player"))
|
||||
self._stop_button.set_property("visible", visibility)
|
||||
@ -3050,10 +3034,6 @@ class PlaybackControl(Gtk.ButtonBox):
|
||||
else:
|
||||
self._play_button_icon.set_property("icon-name", "media-playback-start-symbolic")
|
||||
|
||||
def _on_disconnected(self, *args):
|
||||
self._prev_button.set_tooltip_text("")
|
||||
self._next_button.set_tooltip_text("")
|
||||
|
||||
class SeekBar(Gtk.Box):
|
||||
def __init__(self, client):
|
||||
super().__init__(hexpand=True, margin_start=6, margin_right=6)
|
||||
|
Loading…
Reference in New Issue
Block a user