From f74eead20bb868d999d5f79bfe289f1c0e57ab82 Mon Sep 17 00:00:00 2001 From: DYefremov Date: Fri, 18 Dec 2020 22:18:13 +0300 Subject: [PATCH] added alternate layout support --- app/ui/main_app_window.py | 33 +++++++++++++++++++++++++++++++++ app/ui/main_window.glade | 5 +++-- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/app/ui/main_app_window.py b/app/ui/main_app_window.py index 12dd5fdf..ed3016f9 100644 --- a/app/ui/main_app_window.py +++ b/app/ui/main_app_window.py @@ -321,6 +321,39 @@ class Application(Gtk.Application): style_provider.load_from_path(UI_RESOURCES_PATH + "style.css") self._status_bar_box.get_style_context().add_provider_for_screen(Gdk.Screen.get_default(), style_provider, Gtk.STYLE_PROVIDER_PRIORITY_USER) + self.init_layout(builder) + + def init_layout(self, builder): + """ Initializes an alternate layout, if enabled. """ + if self._settings.is_darwin and self._settings.alternate_layout: + top_box = builder.get_object("top_box") + top_toolbar = builder.get_object("top_toolbar") + top_toolbar.set_margin_left(0) + top_toolbar.set_margin_right(10) + + extra_box = builder.get_object("toolbar_extra_tools_box") + extra_box.set_margin_left(10) + extra_box.set_margin_right(0) + extra_box.reorder_child(self._ftp_button, 0) + extra_box.reorder_child(builder.get_object("add_bouquet_tool_button"), 2) + + top_box.set_child_packing(extra_box, False, True, 0, Gtk.PackType.START) + top_box.set_child_packing(top_toolbar, False, True, 0, Gtk.PackType.END) + top_box.reorder_child(extra_box, 0) + top_box.reorder_child(top_toolbar, 1) + + center_box = builder.get_object("center_box") + center_box.reorder_child(self._ftp_revealer, 0) + center_box.reorder_child(self._control_revealer, 1) + center_box.reorder_child(builder.get_object("main_box"), 2) + + main_data_paned = builder.get_object("main_data_paned") + ch1 = main_data_paned.get_child1() + ch2 = main_data_paned.get_child2() + main_data_paned.remove(ch2) + main_data_paned.remove(ch1) + main_data_paned.pack1(ch2, True, True) + main_data_paned.pack2(ch1) def do_startup(self): Gtk.Application.do_startup(self) diff --git a/app/ui/main_window.glade b/app/ui/main_window.glade index f2c43fd8..86292bc3 100644 --- a/app/ui/main_window.glade +++ b/app/ui/main_window.glade @@ -1277,7 +1277,7 @@ Author: Dmitriy Yefremov False True - 2 + 0 @@ -1317,6 +1317,7 @@ Author: Dmitriy Yefremov 32 True True + Control app.on_remote @@ -1360,7 +1361,7 @@ Author: Dmitriy Yefremov False True end - 2 + 1