small cleanups

This commit is contained in:
Martin Wagner 2021-08-13 22:05:14 +02:00
parent 526b423da3
commit 00abbd1495

View File

@ -842,10 +842,7 @@ class Client(MPDClient):
pass
def toggle_option(self, option): # repeat, random, single, consume
state=self.status()[option]
if state != "1" and state != "0": # support single oneshot
state="1"
new_state=(int(state)+1)%2 # toggle 0,1
new_state=int(self.status()[option] == "0")
func=getattr(self, option)
func(new_state)
@ -2334,8 +2331,7 @@ class AlbumWindow(FocusFrame):
row_num=len(self._store)
for i in range(0, row_num):
path=Gtk.TreePath(i)
treeiter=self._store.get_iter(path)
if self._store.get_value(treeiter, 4) == album:
if self._store[path][4] == album:
self._iconview.set_cursor(path, None, False)
self._iconview.select_path(path)
self._iconview.scroll_to_path(path, True, 0, 0)
@ -2477,10 +2473,9 @@ class AlbumWindow(FocusFrame):
GLib.idle_add(self._artist_popover.open, artist, genre, widget, event.x-h, event.y-v)
def _on_item_activated(self, widget, path):
treeiter=self._store.get_iter(path)
album=self._store.get_value(treeiter, 4)
year=self._store.get_value(treeiter, 5)
artist=self._store.get_value(treeiter, 6)
album=self._store[path][4]
year=self._store[path][5]
artist=self._store[path][6]
genre=self._artist_window.genre_select.get_selected()
self._client.album_to_playlist(album, artist, year, genre)