From fb2aa6be2e472da22c2d622036d370dc4bb63e01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Hamal=20Dvo=C5=99=C3=A1k?= <mordae@anilinux.org> Date: Sat, 8 Mar 2025 20:33:46 +0100 Subject: [PATCH] 1:2 split --- lazy_player/__init__.py | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/lazy_player/__init__.py b/lazy_player/__init__.py index 173371f..6dcaa38 100644 --- a/lazy_player/__init__.py +++ b/lazy_player/__init__.py @@ -21,18 +21,28 @@ class MainWindow(Gtk.ApplicationWindow): # Main horizontal box to split the screen main_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL) - # Left half + # Create a grid to handle the 1:2 ratio + grid = Gtk.Grid() + grid.set_column_homogeneous(True) + grid.set_hexpand(True) + + # Left third (1/3 width) left_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) left_box.set_valign(Gtk.Align.CENTER) - left_box.set_halign(Gtk.Align.CENTER) + left_box.set_halign(Gtk.Align.FILL) left_label = Gtk.Label(label="Left Side") left_box.append(left_label) - left_box.set_hexpand(True) - # Right half - File list + # Right two-thirds (2/3 width) right_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) right_box.set_hexpand(True) + # Attach boxes to grid with specific column spans + grid.attach(left_box, 0, 0, 1, 1) + grid.attach(right_box, 1, 0, 2, 1) + + main_box.append(grid) + # Create list store and view list_store = Gtk.StringList() list_view = Gtk.ListView() @@ -53,10 +63,6 @@ class MainWindow(Gtk.ApplicationWindow): scrolled.set_child(list_view) right_box.append(scrolled) - # Add both halves to main box - main_box.append(left_box) - main_box.append(right_box) - self.set_child(main_box) def _setup_list_item(self, factory: Gtk.SignalListItemFactory, list_item: Gtk.ListItem) -> None: @@ -72,7 +78,7 @@ class MainWindow(Gtk.ApplicationWindow): def _populate_file_list(self, list_store: Gtk.StringList) -> None: # TODO: Implement proper version sort (strverscmp equivalent) - directories: list[str] = [] + directories: list[str] = [".."] files: list[str] = [] with os.scandir(".") as it: