Tame thumbnail a bit
This commit is contained in:
parent
fa98ed28b2
commit
82cb252eb5
2 changed files with 8 additions and 14 deletions
lazy_player
|
@ -19,7 +19,6 @@ from gi.repository import Gdk, GLib, Gst, Gtk, Pango # NOQA: E402
|
|||
|
||||
|
||||
class MainWindow(Gtk.ApplicationWindow):
|
||||
file_info_label: Gtk.Label
|
||||
stack: Gtk.Stack
|
||||
list_view: Gtk.ListView
|
||||
list_model: FileListModel
|
||||
|
@ -99,21 +98,18 @@ class MainWindow(Gtk.ApplicationWindow):
|
|||
|
||||
# Left third (1/3 width)
|
||||
left_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
||||
left_box.set_valign(Gtk.Align.CENTER)
|
||||
left_box.set_valign(Gtk.Align.START)
|
||||
left_box.set_halign(Gtk.Align.FILL)
|
||||
|
||||
# Create image widget for thumbnail with fixed 16:9 aspect
|
||||
# Create image widget for thumbnail
|
||||
self.thumbnail_image = Gtk.Picture()
|
||||
self.thumbnail_image.set_name("thumbnail-image")
|
||||
self.thumbnail_image.set_size_request(384, 216) # 16:9 aspect ratio
|
||||
self.thumbnail_image.set_can_shrink(True)
|
||||
self.thumbnail_image.set_keep_aspect_ratio(True)
|
||||
self.thumbnail_image.set_resource(None)
|
||||
left_box.append(self.thumbnail_image)
|
||||
|
||||
self.file_info_label = Gtk.Label(label="")
|
||||
self.file_info_label.set_wrap(True)
|
||||
left_box.append(self.file_info_label)
|
||||
|
||||
# Right two-thirds (2/3 width)
|
||||
right_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
||||
right_box.set_hexpand(True)
|
||||
|
@ -274,11 +270,8 @@ class MainWindow(Gtk.ApplicationWindow):
|
|||
position: int,
|
||||
n_items: int,
|
||||
):
|
||||
if selection_model.get_selected() == Gtk.INVALID_LIST_POSITION:
|
||||
self.file_info_label.set_text("")
|
||||
else:
|
||||
if selection_model.get_selected() != Gtk.INVALID_LIST_POSITION:
|
||||
file_item = self.selection
|
||||
self.file_info_label.set_text(file_item.name)
|
||||
|
||||
# Update thumbnail if available
|
||||
if file_item.thumbnail:
|
||||
|
@ -474,9 +467,6 @@ class MainWindow(Gtk.ApplicationWindow):
|
|||
|
||||
self.list_model.set_items(items)
|
||||
|
||||
if items:
|
||||
self.file_info_label.set_text(items[0].name)
|
||||
|
||||
|
||||
class App(Gtk.Application):
|
||||
def __init__(self, thumbnailer: Thumbnailer):
|
||||
|
|
|
@ -33,3 +33,7 @@ listview > row {
|
|||
border-radius: 8px;
|
||||
margin: 32px;
|
||||
}
|
||||
|
||||
#thumbnail-image {
|
||||
margin: 8px;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue