WIP
This commit is contained in:
@@ -99,30 +99,37 @@ class AlbumsPanel(Handy.Leaflet):
|
||||
)
|
||||
actionbar.pack_start(self.sort_type_combo)
|
||||
|
||||
self.filter_stack = Gtk.Stack(no_show_all=True)
|
||||
|
||||
self.alphabetical_type_combo, _ = self.make_combobox(
|
||||
(("by_name", "by album name", True), ("by_artist", "by artist name", True)),
|
||||
self.on_alphabetical_type_change,
|
||||
)
|
||||
actionbar.pack_start(self.alphabetical_type_combo)
|
||||
self.filter_stack.add(self.alphabetical_type_combo)
|
||||
|
||||
self.genre_combo, self.genre_combo_store = self.make_combobox(
|
||||
(), self.on_genre_change
|
||||
)
|
||||
actionbar.pack_start(self.genre_combo)
|
||||
self.filter_stack.add(self.genre_combo)
|
||||
|
||||
filter_time_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
|
||||
next_decade = (datetime.datetime.now().year // 10) * 10 + 10
|
||||
|
||||
self.from_year_label = Gtk.Label(label="from")
|
||||
actionbar.pack_start(self.from_year_label)
|
||||
filter_time_box.add(self.from_year_label)
|
||||
self.from_year_spin_button = Gtk.SpinButton.new_with_range(0, next_decade, 1)
|
||||
self.from_year_spin_button.connect("value-changed", self.on_year_changed)
|
||||
actionbar.pack_start(self.from_year_spin_button)
|
||||
filter_time_box.add(self.from_year_spin_button)
|
||||
|
||||
self.to_year_label = Gtk.Label(label="to")
|
||||
actionbar.pack_start(self.to_year_label)
|
||||
filter_time_box.add(self.to_year_label)
|
||||
self.to_year_spin_button = Gtk.SpinButton.new_with_range(0, next_decade, 1)
|
||||
self.to_year_spin_button.connect("value-changed", self.on_year_changed)
|
||||
actionbar.pack_start(self.to_year_spin_button)
|
||||
filter_time_box.add(self.to_year_spin_button)
|
||||
|
||||
self.filter_stack.add(filter_time_box)
|
||||
|
||||
actionbar.pack_start(self.filter_stack)
|
||||
|
||||
self.sort_toggle = IconButton(
|
||||
"view-sort-descending-symbolic", "Sort descending", relief=True
|
||||
@@ -213,34 +220,25 @@ class AlbumsPanel(Handy.Leaflet):
|
||||
|
||||
self.add(self.grid_box)
|
||||
|
||||
self.details_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
||||
self.details_box.get_style_context().add_class("details-panel")
|
||||
self.album_container = Sizer(natural_width=500)
|
||||
|
||||
details_top_bar_revealer = Gtk.Revealer(reveal_child=False)
|
||||
details_top_bar = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
|
||||
self.album_with_songs = AlbumWithSongs(scroll_contents=True)
|
||||
self.album_with_songs.get_style_context().add_class("details-panel")
|
||||
|
||||
back_button = IconButton("go-previous-symbolic")
|
||||
self.album_with_songs.connect("song-clicked", lambda _, *args: self.emit("song-clicked", *args))
|
||||
|
||||
def back_clicked(*_):
|
||||
def back_clicked(_):
|
||||
self.set_visible_child(self.grid_box)
|
||||
back_button.connect("clicked", back_clicked)
|
||||
self.album_with_songs.connect("back-clicked", back_clicked)
|
||||
|
||||
details_top_bar.pack_start(back_button, False, False, 0)
|
||||
|
||||
details_top_bar_revealer.add(details_top_bar)
|
||||
|
||||
self.details_box.pack_start(details_top_bar_revealer, False, False, 0)
|
||||
|
||||
self.album_with_songs = AlbumWithSongs(cover_art_size=100)
|
||||
self.details_box.pack_start(self.album_with_songs, True, True, 0)
|
||||
|
||||
self.add(self.details_box)
|
||||
self.album_container.add(self.album_with_songs)
|
||||
self.add(self.album_container)
|
||||
|
||||
def folded_changed(*_):
|
||||
if not self.get_folded():
|
||||
self.set_visible_child(self.grid_box)
|
||||
|
||||
details_top_bar_revealer.set_reveal_child(self.get_folded())
|
||||
self.album_with_songs.show_back_button = self.get_folded()
|
||||
self.connect("notify::folded", folded_changed)
|
||||
|
||||
|
||||
@@ -643,7 +641,7 @@ class AlbumsPanel(Handy.Leaflet):
|
||||
album = self.albums[child.get_index()]
|
||||
|
||||
if self.get_folded() and self.get_visible_child() == self.grid_box:
|
||||
self.set_visible_child(self.details_box)
|
||||
self.set_visible_child(self.album_container)
|
||||
|
||||
self.emit(
|
||||
"refresh-window",
|
||||
|
Reference in New Issue
Block a user