diff --git a/gemgraph/window.py b/gemgraph/window.py index 8364bdc..fb0cac6 100644 --- a/gemgraph/window.py +++ b/gemgraph/window.py @@ -30,30 +30,14 @@ class GemGraphWindow(Gtk.ApplicationWindow): main_stack = Gtk.Template.Child() side_stack = Gtk.Template.Child() main_paned = Gtk.Template.Child() - main_box_edit = Gtk.Template.Child() - main_box_run = Gtk.Template.Child() - main_box_presentation = Gtk.Template.Child() - side_box_edit = Gtk.Template.Child() - side_box_run = Gtk.Template.Child() - side_box_presentation = Gtk.Template.Child() - - __STACK_OK = False def __init__(self, **kwargs): super().__init__(**kwargs) + # Show the "edit" page by default + self.main_stack.set_visible_child_full("main_edit", Gtk.StackTransitionType.CROSSFADE) + self.side_stack.set_visible_child_full("side_edit", Gtk.StackTransitionType.CROSSFADE) - def init_stack(self): - # Init both mode stacks - self.main_stack.add_named(self.main_box_edit, "main_box_edit") - self.main_stack.add_named(self.main_box_run, "main_box_run") - self.main_stack.add_named(self.main_box_presentation, - "main_box_presentation") - self.side_stack.add_named(self.side_box_edit, "side_box_edit") - self.side_stack.add_named(self.side_box_run, "side_box_run") - self.side_stack.add_named(self.side_box_presentation, - "side_box_presentation") - def toggle_sidebar(self): """ Sets the sidebar position to open or closed @@ -69,13 +53,8 @@ class GemGraphWindow(Gtk.ApplicationWindow): """ Sets the active mode from stack. Mode is the name of the mode (string) """ - - if not self.__STACK_OK: - self.init_stack() - self.__STACK_OK = True - - main_newmode = self.main_stack.set_visible_child_name ("main_box_"+mode) - side_newmode = self.side_stack.set_visible_child_name ("side_box_"+mode) + self.main_stack.set_visible_child_full("main_"+mode, Gtk.StackTransitionType.CROSSFADE) + self.side_stack.set_visible_child_full("side_"+mode, Gtk.StackTransitionType.CROSSFADE) class AboutDialog(Gtk.AboutDialog): diff --git a/ui/gemgraph.ui b/ui/gemgraph.ui index eed91b8..9543ec1 100644 --- a/ui/gemgraph.ui +++ b/ui/gemgraph.ui @@ -48,71 +48,79 @@ - - center - + + side_run + center <b>Sidebar: run mode</b> True - + - - center - + + + + side_presentation + center <b>Sidebar: presentation mode</b> True - + - - center - + + + + side_edit + center <b>Sidebar: edit mode</b> True - + - center - - + + main_run + center <b>Main zone: run mode</b> True - + - - center - + + + + main_presentation + center <b>Main zone: presentation mode</b> True - + - - center - + + + + main_edit + center <b>Main zone: edit mode</b> True - +