improved autoscroll making browsing in single mode more comfortable

This commit is contained in:
Martin Wagner 2020-08-09 22:24:04 +02:00
parent defa7f2aec
commit 27173f62cf
3 changed files with 175 additions and 155 deletions

View File

@ -2119,6 +2119,11 @@ class PlaylistView(Gtk.Box):
self.settings=settings
self.playlist_version=None
# buttons
self.back_to_song_button=Gtk.Button(image=Gtk.Image.new_from_icon_name("go-previous-symbolic", Gtk.IconSize.BUTTON))
self.back_to_song_button.set_tooltip_text(_("Scroll to current song"))
self.back_to_song_button.set_relief(Gtk.ReliefStyle.NONE)
# Store
# (track, disc, title, artist, album, duration, date, genre, file, weight)
self.store=Gtk.ListStore(str, str, str, str, str, str, str, str, str, Pango.Weight)
@ -2175,26 +2180,29 @@ class PlaylistView(Gtk.Box):
# audio infos
audio=AudioType(self.client)
audio.set_margin_end(3)
audio.set_xalign(1)
audio.set_ellipsize(Pango.EllipsizeMode.END)
# playlist info
self.playlist_info=Gtk.Label()
self.playlist_info.set_margin_start(3)
self.playlist_info.set_xalign(0)
self.playlist_info.set_ellipsize(Pango.EllipsizeMode.END)
# status bar
status_bar=Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=12)
status_bar.set_property("border-width", 3)
status_bar=Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
status_bar.set_property("border-width", 1)
status_bar.pack_start(self.back_to_song_button, False, False, 0)
self.playlist_info.set_margin_start(3)
status_bar.pack_start(self.playlist_info, True, True, 0)
audio.set_margin_end(5)
audio.set_margin_start(12)
status_bar.pack_end(audio, False, False, 0)
# connect
self.treeview.connect("row-activated", self.on_row_activated)
self.key_press_event=self.treeview.connect("key-press-event", self.on_key_press_event)
self.treeview.connect("button-press-event", self.on_button_press_event)
self.back_to_song_button.connect("clicked", self.scroll_to_selected_title)
self.client.emitter.connect("playlist_changed", self.on_playlist_changed)
self.client.emitter.connect("current_song_changed", self.on_song_changed)
@ -2228,7 +2236,7 @@ class PlaylistView(Gtk.Box):
self.columns[i].set_visible(visibilities[i])
self.treeview.append_column(self.columns[i])
def scroll_to_selected_title(self):
def scroll_to_selected_title(self, *args):
treeview, treeiter=self.selection.get_selected()
if not treeiter == None:
path=treeview.get_path(treeiter)
@ -2242,7 +2250,7 @@ class PlaylistView(Gtk.Box):
else:
self.playlist_info.set_text("")
def refresh_selection(self): # Gtk.TreePath(len(self.store) is used to generate an invalid TreePath (needed to unset cursor)
def refresh_selection(self, scroll=True): # Gtk.TreePath(len(self.store) is used to generate an invalid TreePath (needed to unset cursor)
self.treeview.set_cursor(Gtk.TreePath(len(self.store)), None, False)
for row in self.store: # reset bold text
row[9]=Pango.Weight.BOOK
@ -2251,7 +2259,8 @@ class PlaylistView(Gtk.Box):
path=Gtk.TreePath(int(song))
self.selection.select_path(path)
self.store[path][9]=Pango.Weight.BOLD
self.scroll_to_selected_title()
if scroll:
self.scroll_to_selected_title()
except:
self.selection.unselect_all()
@ -2328,7 +2337,10 @@ class PlaylistView(Gtk.Box):
self.playlist_version=version
def on_song_changed(self, *args):
self.refresh_selection()
if self.client.wrapped_call("status")["state"] == "play":
self.refresh_selection()
else:
self.refresh_selection(False)
def on_disconnected(self, *args):
self.clear()

152
po/de.po
View File

@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-08-04 19:29+0200\n"
"PO-Revision-Date: 2020-08-04 19:33+0200\n"
"POT-Creation-Date: 2020-08-09 22:22+0200\n"
"PO-Revision-Date: 2020-08-09 22:23+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: de\n"
@ -38,23 +38,23 @@ msgstr "Unbekannter Interpret"
msgid "Unknown Album"
msgstr "Unbekanntes Album"
#: mpdevil.py:1026 mpdevil.py:1395 mpdevil.py:2140 mpdevil.py:2811
#: mpdevil.py:1026 mpdevil.py:1291 mpdevil.py:2145 mpdevil.py:2823
msgid "No"
msgstr "Nr."
#: mpdevil.py:1031 mpdevil.py:1400 mpdevil.py:2146 mpdevil.py:2811
#: mpdevil.py:1031 mpdevil.py:1296 mpdevil.py:2151 mpdevil.py:2823
msgid "Title"
msgstr "Titel"
#: mpdevil.py:1037 mpdevil.py:1539 mpdevil.py:2149 mpdevil.py:2811
#: mpdevil.py:1037 mpdevil.py:1435 mpdevil.py:2154 mpdevil.py:2823
msgid "Artist"
msgstr "Interpret"
#: mpdevil.py:1043 mpdevil.py:2152 mpdevil.py:2811
#: mpdevil.py:1043 mpdevil.py:2157 mpdevil.py:2823
msgid "Album"
msgstr "Album"
#: mpdevil.py:1049 mpdevil.py:1406 mpdevil.py:2155 mpdevil.py:2811
#: mpdevil.py:1049 mpdevil.py:1302 mpdevil.py:2160 mpdevil.py:2823
msgid "Length"
msgstr "Länge"
@ -75,44 +75,44 @@ msgstr "Öffnen"
msgid "hits: %i"
msgstr "Treffer: %i"
#: mpdevil.py:1211
msgid "searching..."
msgstr "suche..."
#: mpdevil.py:1215
msgid "lyrics not found"
msgstr "Liedtext nicht gefunden"
#: mpdevil.py:1449
#: mpdevil.py:1345
msgid "all genres"
msgstr "Alle Genres"
#: mpdevil.py:1537
#: mpdevil.py:1433
msgid "Album Artist"
msgstr "Albuminterpret"
#: mpdevil.py:1540
#: mpdevil.py:1436
msgid "all artists"
msgstr "Alle Interpreten"
#: mpdevil.py:1686
#: mpdevil.py:1582
#, python-format
msgid "%(total_tracks)i titles on %(discs)i discs (%(total_length)s)"
msgstr "%(total_tracks)i Titel auf %(discs)i CDs (%(total_length)s)"
#: mpdevil.py:1688 mpdevil.py:2241
#: mpdevil.py:1584 mpdevil.py:2249
#, python-format
msgid "%(total_tracks)i titles (%(total_length)s)"
msgstr "%(total_tracks)i Titel (%(total_length)s)"
#: mpdevil.py:1863
#: mpdevil.py:1759
msgid "Back to current album"
msgstr "Zurück zu aktuellem Album"
#: mpdevil.py:1865
#: mpdevil.py:1761
msgid "Search"
msgstr "Suche"
#: mpdevil.py:1938
msgid "searching..."
msgstr "suche..."
#: mpdevil.py:1942
msgid "lyrics not found"
msgstr "Liedtext nicht gefunden"
#: mpdevil.py:2010
#, python-format
msgid ""
@ -122,107 +122,111 @@ msgstr ""
"%(bitrate)s kb/s, %(frequency)s kHz, %(resolution)i bit, %(channels)i "
"Kanäle, %(file_type)s"
#: mpdevil.py:2143 mpdevil.py:2811
#: mpdevil.py:2124
msgid "Scroll to current song"
msgstr "Gehe zu aktuellem Lied"
#: mpdevil.py:2148 mpdevil.py:2823
msgid "Disc"
msgstr "CD"
#: mpdevil.py:2158 mpdevil.py:2811
#: mpdevil.py:2163 mpdevil.py:2823
msgid "Year"
msgstr "Jahr"
#: mpdevil.py:2161 mpdevil.py:2811
#: mpdevil.py:2166 mpdevil.py:2823
msgid "Genre"
msgstr "Genre"
#: mpdevil.py:2351
#: mpdevil.py:2363
msgid "Show lyrics"
msgstr "Zeige Liedtext"
#: mpdevil.py:2450
#: mpdevil.py:2462
msgid "Main cover size:"
msgstr "Größe des Haupt-Covers:"
#: mpdevil.py:2451
#: mpdevil.py:2463
msgid "Album view cover size:"
msgstr "Covergröße in Albumliste:"
#: mpdevil.py:2452
#: mpdevil.py:2464
msgid "Button icon size:"
msgstr "Symbolgröße der Knöpfe:"
#: mpdevil.py:2462
#: mpdevil.py:2474
msgid "Sort albums by:"
msgstr "Sortiere Alben nach:"
#: mpdevil.py:2462
#: mpdevil.py:2474
msgid "name"
msgstr "Name"
#: mpdevil.py:2462
#: mpdevil.py:2474
msgid "year"
msgstr "Jahr"
#: mpdevil.py:2463
#: mpdevil.py:2475
msgid "Position of playlist:"
msgstr "Wiedergabelistenposition:"
#: mpdevil.py:2463
#: mpdevil.py:2475
msgid "bottom"
msgstr "unten"
#: mpdevil.py:2463
#: mpdevil.py:2475
msgid "right"
msgstr "rechts"
#: mpdevil.py:2480
#: mpdevil.py:2492
msgid "Use Client-side decoration"
msgstr "Benutze \"Client-side decoration\""
#: mpdevil.py:2481
#: mpdevil.py:2493
msgid "Show stop button"
msgstr "Zeige Stopp-Knopf"
#: mpdevil.py:2482
#: mpdevil.py:2494
msgid "Show lyrics button"
msgstr "Zeige Liedtext-Knopf"
#: mpdevil.py:2483
#: mpdevil.py:2495
msgid "Show initials in artist view"
msgstr "Zeige Anfangsbuchstaben in Interpretenliste"
#: mpdevil.py:2484
#: mpdevil.py:2496
msgid "Show tooltips in album view"
msgstr "Zeige Tooltips in Albumliste"
#: mpdevil.py:2485
#: mpdevil.py:2497
msgid "Use 'Album Artist' tag"
msgstr "Benutze \"Album Artist\" Tag"
#: mpdevil.py:2486
#: mpdevil.py:2498
msgid "Send notification on title change"
msgstr "Sende Benachrichtigung bei Titelwechsel"
#: mpdevil.py:2487
#: mpdevil.py:2499
msgid "Stop playback on quit"
msgstr "Wiedergabe beim Beenden stoppen"
#: mpdevil.py:2488
#: mpdevil.py:2500
msgid "Play selected albums and titles immediately"
msgstr "Ausgewählte Alben und Titel sofort abspielen"
#: mpdevil.py:2499
#: mpdevil.py:2511
msgid "<b>View</b>"
msgstr "<b>Ansicht</b>"
#: mpdevil.py:2502
#: mpdevil.py:2514
msgid "<b>Behavior</b>"
msgstr "<b>Verhalten</b>"
#: mpdevil.py:2533
#: mpdevil.py:2545
msgid "(restart required)"
msgstr "(Neustart erforderlich)"
#: mpdevil.py:2614
#: mpdevil.py:2626
msgid ""
"The first image in the same directory as the song file matching this regex "
"will be displayed. %AlbumArtist% and %Album% will be replaced by the "
@ -232,109 +236,109 @@ msgstr ""
"regulären Ausdruck entspricht, wird angezeigt. %AlbumArtist% und %Album% "
"werden durch die entsprechenden Tags des Liedes ersetzt."
#: mpdevil.py:2616
#: mpdevil.py:2628
msgid "Profile:"
msgstr "Profil:"
#: mpdevil.py:2618
#: mpdevil.py:2630
msgid "Name:"
msgstr "Name:"
#: mpdevil.py:2620
#: mpdevil.py:2632
msgid "Host:"
msgstr "Host:"
#: mpdevil.py:2622
#: mpdevil.py:2634
msgid "Password:"
msgstr "Passwort:"
#: mpdevil.py:2624
#: mpdevil.py:2636
msgid "Music lib:"
msgstr "Musikverzeichnis:"
#: mpdevil.py:2626
#: mpdevil.py:2638
msgid "Cover regex:"
msgstr "Cover-Regex:"
#: mpdevil.py:2749
#: mpdevil.py:2761
msgid "Choose directory"
msgstr "Verzeichnis Wählen"
#: mpdevil.py:2783
#: mpdevil.py:2795
msgid "Choose the order of information to appear in the playlist:"
msgstr ""
"Lege die Reihenfolge fest, in der Informationen in der Wiedergabeliste "
"angezeigt werden sollen:"
#: mpdevil.py:2925 mpdevil.py:3435
#: mpdevil.py:2937 mpdevil.py:3447
msgid "Settings"
msgstr "Einstellungen"
#: mpdevil.py:2939
#: mpdevil.py:2951
msgid "General"
msgstr "Allgemein"
#: mpdevil.py:2940
#: mpdevil.py:2952
msgid "Profiles"
msgstr "Profile"
#: mpdevil.py:2941
#: mpdevil.py:2953
msgid "Playlist"
msgstr "Wiedergabeliste"
#: mpdevil.py:3200
#: mpdevil.py:3212
msgid "Random mode"
msgstr "Zufallsmodus"
#: mpdevil.py:3202
#: mpdevil.py:3214
msgid "Repeat mode"
msgstr "Dauerschleife"
#: mpdevil.py:3204
#: mpdevil.py:3216
msgid "Single mode"
msgstr "Einzelstückmodus"
#: mpdevil.py:3206
#: mpdevil.py:3218
msgid "Consume mode"
msgstr "Wiedergabeliste verbrauchen"
#: mpdevil.py:3283
#: mpdevil.py:3295
msgid "Stats"
msgstr "Statistik"
#: mpdevil.py:3336
#: mpdevil.py:3348
msgid "A small MPD client written in python"
msgstr ""
#: mpdevil.py:3428
#: mpdevil.py:3440
msgid "Select profile"
msgstr "Profil auswählen"
#: mpdevil.py:3436
#: mpdevil.py:3448
msgid "Help"
msgstr "Hilfe"
#: mpdevil.py:3437
#: mpdevil.py:3449
msgid "About"
msgstr "Über"
#: mpdevil.py:3438
#: mpdevil.py:3450
msgid "Quit"
msgstr "Beenden"
#: mpdevil.py:3441
#: mpdevil.py:3453
msgid "Save window layout"
msgstr "Fensterlayout speichern"
#: mpdevil.py:3442
#: mpdevil.py:3454
msgid "Update database"
msgstr "Datenbank aktualisieren"
#: mpdevil.py:3443
#: mpdevil.py:3455
msgid "Server stats"
msgstr "Serverstatistik"
#: mpdevil.py:3449
#: mpdevil.py:3461
msgid "Menu"
msgstr "Menü"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-08-04 19:29+0200\n"
"POT-Creation-Date: 2020-08-09 22:22+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -37,23 +37,23 @@ msgstr ""
msgid "Unknown Album"
msgstr ""
#: mpdevil.py:1026 mpdevil.py:1395 mpdevil.py:2140 mpdevil.py:2811
#: mpdevil.py:1026 mpdevil.py:1291 mpdevil.py:2145 mpdevil.py:2823
msgid "No"
msgstr ""
#: mpdevil.py:1031 mpdevil.py:1400 mpdevil.py:2146 mpdevil.py:2811
#: mpdevil.py:1031 mpdevil.py:1296 mpdevil.py:2151 mpdevil.py:2823
msgid "Title"
msgstr ""
#: mpdevil.py:1037 mpdevil.py:1539 mpdevil.py:2149 mpdevil.py:2811
#: mpdevil.py:1037 mpdevil.py:1435 mpdevil.py:2154 mpdevil.py:2823
msgid "Artist"
msgstr ""
#: mpdevil.py:1043 mpdevil.py:2152 mpdevil.py:2811
#: mpdevil.py:1043 mpdevil.py:2157 mpdevil.py:2823
msgid "Album"
msgstr ""
#: mpdevil.py:1049 mpdevil.py:1406 mpdevil.py:2155 mpdevil.py:2811
#: mpdevil.py:1049 mpdevil.py:1302 mpdevil.py:2160 mpdevil.py:2823
msgid "Length"
msgstr ""
@ -74,44 +74,44 @@ msgstr ""
msgid "hits: %i"
msgstr ""
#: mpdevil.py:1211
msgid "searching..."
msgstr ""
#: mpdevil.py:1215
msgid "lyrics not found"
msgstr ""
#: mpdevil.py:1449
#: mpdevil.py:1345
msgid "all genres"
msgstr ""
#: mpdevil.py:1537
#: mpdevil.py:1433
msgid "Album Artist"
msgstr ""
#: mpdevil.py:1540
#: mpdevil.py:1436
msgid "all artists"
msgstr ""
#: mpdevil.py:1686
#: mpdevil.py:1582
#, python-format
msgid "%(total_tracks)i titles on %(discs)i discs (%(total_length)s)"
msgstr ""
#: mpdevil.py:1688 mpdevil.py:2241
#: mpdevil.py:1584 mpdevil.py:2249
#, python-format
msgid "%(total_tracks)i titles (%(total_length)s)"
msgstr ""
#: mpdevil.py:1863
#: mpdevil.py:1759
msgid "Back to current album"
msgstr ""
#: mpdevil.py:1865
#: mpdevil.py:1761
msgid "Search"
msgstr ""
#: mpdevil.py:1938
msgid "searching..."
msgstr ""
#: mpdevil.py:1942
msgid "lyrics not found"
msgstr ""
#: mpdevil.py:2010
#, python-format
msgid ""
@ -119,213 +119,217 @@ msgid ""
"channels, %(file_type)s"
msgstr ""
#: mpdevil.py:2143 mpdevil.py:2811
#: mpdevil.py:2124
msgid "Scroll to current song"
msgstr ""
#: mpdevil.py:2148 mpdevil.py:2823
msgid "Disc"
msgstr ""
#: mpdevil.py:2158 mpdevil.py:2811
#: mpdevil.py:2163 mpdevil.py:2823
msgid "Year"
msgstr ""
#: mpdevil.py:2161 mpdevil.py:2811
#: mpdevil.py:2166 mpdevil.py:2823
msgid "Genre"
msgstr ""
#: mpdevil.py:2351
#: mpdevil.py:2363
msgid "Show lyrics"
msgstr ""
#: mpdevil.py:2450
#: mpdevil.py:2462
msgid "Main cover size:"
msgstr ""
#: mpdevil.py:2451
#: mpdevil.py:2463
msgid "Album view cover size:"
msgstr ""
#: mpdevil.py:2452
#: mpdevil.py:2464
msgid "Button icon size:"
msgstr ""
#: mpdevil.py:2462
#: mpdevil.py:2474
msgid "Sort albums by:"
msgstr ""
#: mpdevil.py:2462
#: mpdevil.py:2474
msgid "name"
msgstr ""
#: mpdevil.py:2462
#: mpdevil.py:2474
msgid "year"
msgstr ""
#: mpdevil.py:2463
#: mpdevil.py:2475
msgid "Position of playlist:"
msgstr ""
#: mpdevil.py:2463
#: mpdevil.py:2475
msgid "bottom"
msgstr ""
#: mpdevil.py:2463
#: mpdevil.py:2475
msgid "right"
msgstr ""
#: mpdevil.py:2480
#: mpdevil.py:2492
msgid "Use Client-side decoration"
msgstr ""
#: mpdevil.py:2481
#: mpdevil.py:2493
msgid "Show stop button"
msgstr ""
#: mpdevil.py:2482
#: mpdevil.py:2494
msgid "Show lyrics button"
msgstr ""
#: mpdevil.py:2483
#: mpdevil.py:2495
msgid "Show initials in artist view"
msgstr ""
#: mpdevil.py:2484
#: mpdevil.py:2496
msgid "Show tooltips in album view"
msgstr ""
#: mpdevil.py:2485
#: mpdevil.py:2497
msgid "Use 'Album Artist' tag"
msgstr ""
#: mpdevil.py:2486
#: mpdevil.py:2498
msgid "Send notification on title change"
msgstr ""
#: mpdevil.py:2487
#: mpdevil.py:2499
msgid "Stop playback on quit"
msgstr ""
#: mpdevil.py:2488
#: mpdevil.py:2500
msgid "Play selected albums and titles immediately"
msgstr ""
#: mpdevil.py:2499
#: mpdevil.py:2511
msgid "<b>View</b>"
msgstr ""
#: mpdevil.py:2502
#: mpdevil.py:2514
msgid "<b>Behavior</b>"
msgstr ""
#: mpdevil.py:2533
#: mpdevil.py:2545
msgid "(restart required)"
msgstr ""
#: mpdevil.py:2614
#: mpdevil.py:2626
msgid ""
"The first image in the same directory as the song file matching this regex "
"will be displayed. %AlbumArtist% and %Album% will be replaced by the "
"corresponding tags of the song."
msgstr ""
#: mpdevil.py:2616
#: mpdevil.py:2628
msgid "Profile:"
msgstr ""
#: mpdevil.py:2618
#: mpdevil.py:2630
msgid "Name:"
msgstr ""
#: mpdevil.py:2620
#: mpdevil.py:2632
msgid "Host:"
msgstr ""
#: mpdevil.py:2622
#: mpdevil.py:2634
msgid "Password:"
msgstr ""
#: mpdevil.py:2624
#: mpdevil.py:2636
msgid "Music lib:"
msgstr ""
#: mpdevil.py:2626
#: mpdevil.py:2638
msgid "Cover regex:"
msgstr ""
#: mpdevil.py:2749
#: mpdevil.py:2761
msgid "Choose directory"
msgstr ""
#: mpdevil.py:2783
#: mpdevil.py:2795
msgid "Choose the order of information to appear in the playlist:"
msgstr ""
#: mpdevil.py:2925 mpdevil.py:3435
#: mpdevil.py:2937 mpdevil.py:3447
msgid "Settings"
msgstr ""
#: mpdevil.py:2939
#: mpdevil.py:2951
msgid "General"
msgstr ""
#: mpdevil.py:2940
#: mpdevil.py:2952
msgid "Profiles"
msgstr ""
#: mpdevil.py:2941
#: mpdevil.py:2953
msgid "Playlist"
msgstr ""
#: mpdevil.py:3200
#: mpdevil.py:3212
msgid "Random mode"
msgstr ""
#: mpdevil.py:3202
#: mpdevil.py:3214
msgid "Repeat mode"
msgstr ""
#: mpdevil.py:3204
#: mpdevil.py:3216
msgid "Single mode"
msgstr ""
#: mpdevil.py:3206
#: mpdevil.py:3218
msgid "Consume mode"
msgstr ""
#: mpdevil.py:3283
#: mpdevil.py:3295
msgid "Stats"
msgstr ""
#: mpdevil.py:3336
#: mpdevil.py:3348
msgid "A small MPD client written in python"
msgstr ""
#: mpdevil.py:3428
#: mpdevil.py:3440
msgid "Select profile"
msgstr ""
#: mpdevil.py:3436
#: mpdevil.py:3448
msgid "Help"
msgstr ""
#: mpdevil.py:3437
#: mpdevil.py:3449
msgid "About"
msgstr ""
#: mpdevil.py:3438
#: mpdevil.py:3450
msgid "Quit"
msgstr ""
#: mpdevil.py:3441
#: mpdevil.py:3453
msgid "Save window layout"
msgstr ""
#: mpdevil.py:3442
#: mpdevil.py:3454
msgid "Update database"
msgstr ""
#: mpdevil.py:3443
#: mpdevil.py:3455
msgid "Server stats"
msgstr ""
#: mpdevil.py:3449
#: mpdevil.py:3461
msgid "Menu"
msgstr ""