1:2 split
This commit is contained in:
parent
67649fa7c0
commit
fb2aa6be2e
1 changed files with 15 additions and 9 deletions
|
@ -21,18 +21,28 @@ class MainWindow(Gtk.ApplicationWindow):
|
||||||
# Main horizontal box to split the screen
|
# Main horizontal box to split the screen
|
||||||
main_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
|
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 = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
||||||
left_box.set_valign(Gtk.Align.CENTER)
|
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_label = Gtk.Label(label="Left Side")
|
||||||
left_box.append(left_label)
|
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 = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
||||||
right_box.set_hexpand(True)
|
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
|
# Create list store and view
|
||||||
list_store = Gtk.StringList()
|
list_store = Gtk.StringList()
|
||||||
list_view = Gtk.ListView()
|
list_view = Gtk.ListView()
|
||||||
|
@ -53,10 +63,6 @@ class MainWindow(Gtk.ApplicationWindow):
|
||||||
scrolled.set_child(list_view)
|
scrolled.set_child(list_view)
|
||||||
right_box.append(scrolled)
|
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)
|
self.set_child(main_box)
|
||||||
|
|
||||||
def _setup_list_item(self, factory: Gtk.SignalListItemFactory, list_item: Gtk.ListItem) -> None:
|
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:
|
def _populate_file_list(self, list_store: Gtk.StringList) -> None:
|
||||||
# TODO: Implement proper version sort (strverscmp equivalent)
|
# TODO: Implement proper version sort (strverscmp equivalent)
|
||||||
|
|
||||||
directories: list[str] = []
|
directories: list[str] = [".."]
|
||||||
files: list[str] = []
|
files: list[str] = []
|
||||||
|
|
||||||
with os.scandir(".") as it:
|
with os.scandir(".") as it:
|
||||||
|
|
Loading…
Reference in a new issue