diff --git a/app/ui/main_app_window.py b/app/ui/main_app_window.py index 0e1405df..eb6fba60 100644 --- a/app/ui/main_app_window.py +++ b/app/ui/main_app_window.py @@ -320,46 +320,59 @@ 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) + # Layout + if self._settings.is_darwin and self._settings.alternate_layout: + self._main_paned = builder.get_object("main_data_paned") + self._fav_paned = builder.get_object("fav_bouquets_paned") + self._fav_box = self._fav_paned.get_child1() + self._bouquets_box = self._fav_paned.get_child2() + self._left_ar_bq_button = builder.get_object("left_arrow_bq_button") + self._left_ar_bq_button.bind_property("visible", builder.get_object("right_arrow_bq_button"), "visible", 4) + self._left_ar_bq_button.set_visible(True) + 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) + 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) + 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) + 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) + 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_paned = builder.get_object("main_data_paned") - services_box = main_paned.get_child1() - fav_paned = main_paned.get_child2() - main_paned.remove(services_box) + services_box = self._main_paned.get_child1() + self._main_paned.remove(services_box) + self._main_paned.remove(self._fav_paned) + self._main_paned.pack1(self._fav_paned, True, True) + self._main_paned.pack2(services_box, True, True) - if not self._settings.bq_details_first: - bouquets_box = fav_paned.get_child2() - fav_paned.remove(bouquets_box) - fav_paned.pack2(services_box, True, False) - main_paned.pack1(bouquets_box, True, False) - else: - main_paned.remove(fav_paned) - main_paned.pack1(fav_paned, True, True) - main_paned.pack2(services_box) + self._left_ar_bq_button.set_visible(not self._settings.bq_details_first) + self.init_bq_position() + + def init_bq_position(self): + self._fav_paned.remove(self._fav_box) + self._fav_paned.remove(self._bouquets_box) + + if self._settings.bq_details_first: + self._fav_paned.pack1(self._fav_box, False, False) + self._fav_paned.pack2(self._bouquets_box, False, False) + else: + self._fav_paned.pack1(self._bouquets_box, False, False) + self._fav_paned.pack2(self._fav_box, False, False) def do_startup(self): Gtk.Application.do_startup(self) @@ -445,6 +458,8 @@ class Application(Gtk.Application): remote_action = Gio.SimpleAction.new_stateful("on_remote", None, GLib.Variant.new_boolean(False)) remote_action.connect("change-state", self.on_control) self.add_action(remote_action) + # Layout + self.set_action("on_switch_fav_position", self.on_switch_fav_position) def set_action(self, name, fun, enabled=True): ac = Gio.SimpleAction.new(name, None) @@ -643,6 +658,12 @@ class Application(Gtk.Application): return move_items(key, self._fav_view if self._fav_view.is_focus() else self._bouquets_view) + def on_switch_fav_position(self, action, value=None): + visible = self._left_ar_bq_button.get_visible() + self._settings.bq_details_first = visible + self._left_ar_bq_button.set_visible(not visible) + self.init_bq_position() + # ***************** Copy - Cut - Paste *********************# def on_services_copy(self, view): diff --git a/app/ui/main_window.glade b/app/ui/main_window.glade index c31af5e3..85ad9d90 100644 --- a/app/ui/main_window.glade +++ b/app/ui/main_window.glade @@ -2314,15 +2314,81 @@ Author: Dmitriy Yefremov False vertical - + True False - 2 - 2 - Bouquet details - - - + 2 + 2 + 2 + + + False + True + Toggle display position + app.on_switch_fav_position + none + + + True + False + 12 + pan-end-symbolic-rtl + + + + + + False + True + 0 + + + + + True + False + 2 + 2 + Bouquet details + + + + + + False + True + 3 + + + + + False + True + Toggle display position + app.on_switch_fav_position + none + True + + + True + False + 12 + pan-end-symbolic + + + + + + False + True + end + 2 + + False diff --git a/app/ui/style.css b/app/ui/style.css index d8dd2178..ae27fd50 100644 --- a/app/ui/style.css +++ b/app/ui/style.css @@ -36,6 +36,13 @@ margin: 0px; } +.arrow-button { + padding: 0px; + margin: 1px; + min-width: 12px; + min-height: 12px; +} + .group {} .group :first-child {