mirror of
https://github.com/SoongNoonien/mpdevil.git
synced 2023-08-10 21:12:44 +03:00
use get_cursor where possible
This commit is contained in:
parent
f240215b1f
commit
6f188128ae
@ -1507,13 +1507,12 @@ class SongsList(TreeView):
|
|||||||
self.emit("button-clicked")
|
self.emit("button-clicked")
|
||||||
|
|
||||||
def show_info(self):
|
def show_info(self):
|
||||||
if (treeiter:=self._selection.get_selected()[1]) is not None:
|
if (path:=self.get_cursor()[0]) is not None:
|
||||||
path=self._store.get_path(treeiter)
|
|
||||||
self._song_popover.open(self._store[path][3], self, *self.get_popover_point(path))
|
self._song_popover.open(self._store[path][3], self, *self.get_popover_point(path))
|
||||||
|
|
||||||
def add_to_playlist(self, mode):
|
def add_to_playlist(self, mode):
|
||||||
if (treeiter:=self._selection.get_selected()[1]) is not None:
|
if (path:=self.get_cursor()[0]) is not None:
|
||||||
self._client.files_to_playlist([self._store.get_value(treeiter, 3)], mode)
|
self._client.files_to_playlist([self._store[path][3]], mode)
|
||||||
|
|
||||||
class AlbumPopover(Gtk.Popover):
|
class AlbumPopover(Gtk.Popover):
|
||||||
def __init__(self, client, settings):
|
def __init__(self, client, settings):
|
||||||
@ -1961,15 +1960,12 @@ class ArtistList(SelectionList):
|
|||||||
return self.get_artist_at_path(self.get_path_selected())
|
return self.get_artist_at_path(self.get_path_selected())
|
||||||
|
|
||||||
def add_to_playlist(self, mode):
|
def add_to_playlist(self, mode):
|
||||||
selected_rows=self._selection.get_selected_rows()
|
if (path:=self.get_cursor()[0]) is not None:
|
||||||
if selected_rows is not None:
|
|
||||||
path=selected_rows[1][0]
|
|
||||||
artist,genre=self.get_artist_at_path(path)
|
artist,genre=self.get_artist_at_path(path)
|
||||||
self._client.artist_to_playlist(artist, genre, mode)
|
self._client.artist_to_playlist(artist, genre, mode)
|
||||||
|
|
||||||
def show_info(self):
|
def show_info(self):
|
||||||
if (treeiter:=self._selection.get_selected()[1]) is not None:
|
if (path:=self.get_cursor()[0]) is not None:
|
||||||
path=self._store.get_path(treeiter)
|
|
||||||
artist,genre=self.get_artist_at_path(path)
|
artist,genre=self.get_artist_at_path(path)
|
||||||
self._artist_popover.open(artist, genre, self, *self.get_popover_point(path))
|
self._artist_popover.open(artist, genre, self, *self.get_popover_point(path))
|
||||||
|
|
||||||
@ -2218,9 +2214,7 @@ class AlbumList(Gtk.IconView):
|
|||||||
self.set_sensitive(True)
|
self.set_sensitive(True)
|
||||||
|
|
||||||
def show_info(self):
|
def show_info(self):
|
||||||
paths=self.get_selected_items()
|
if (path:=self.get_cursor()[1]) is not None:
|
||||||
if len(paths) > 0:
|
|
||||||
path=paths[0]
|
|
||||||
cell=self.get_cell_rect(path, None)[1]
|
cell=self.get_cell_rect(path, None)[1]
|
||||||
rect=self.get_allocation()
|
rect=self.get_allocation()
|
||||||
x=max(min(rect.x+cell.width//2, rect.x+rect.width), rect.x)
|
x=max(min(rect.x+cell.width//2, rect.x+rect.width), rect.x)
|
||||||
@ -2229,9 +2223,8 @@ class AlbumList(Gtk.IconView):
|
|||||||
self._album_popover.open(*tags, self, x, y)
|
self._album_popover.open(*tags, self, x, y)
|
||||||
|
|
||||||
def add_to_playlist(self, mode):
|
def add_to_playlist(self, mode):
|
||||||
paths=self.get_selected_items()
|
if (path:=self.get_cursor()[1]) is not None:
|
||||||
if len(paths) != 0:
|
self._path_to_playlist(path, mode)
|
||||||
self._path_to_playlist(paths[0], mode)
|
|
||||||
|
|
||||||
def _on_cover_size_changed(self, *args):
|
def _on_cover_size_changed(self, *args):
|
||||||
if self._client.connected():
|
if self._client.connected():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user