From ccaf200dbea96dc9bc1a3e5d414ecca83b4d6044 Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Fri, 29 Jul 2022 10:59:57 +0200 Subject: [PATCH] Mode icon + default run mode --- gemgraph/main.py | 2 ++ gemgraph/window.py | 12 ++++++++---- ui/gemgraph.ui | 4 ++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/gemgraph/main.py b/gemgraph/main.py index 4fe60c0..6948671 100644 --- a/gemgraph/main.py +++ b/gemgraph/main.py @@ -51,6 +51,8 @@ class GemGraphApplication(Adw.Application): if not win: win = GemGraphWindow(application=self) + # Display run mode by default + win.stack_switch_mode("run") win.present() def on_about_action(self, widget, _): diff --git a/gemgraph/window.py b/gemgraph/window.py index fb0cac6..7a5bf6a 100644 --- a/gemgraph/window.py +++ b/gemgraph/window.py @@ -30,13 +30,16 @@ class GemGraphWindow(Gtk.ApplicationWindow): main_stack = Gtk.Template.Child() side_stack = Gtk.Template.Child() main_paned = Gtk.Template.Child() + main_button_mode = Gtk.Template.Child() + + __mode_icon = { + "mode_edit":"document-edit-symbolic" , + "mode_run":"system-run-symbolic" , + "mode_presentation":"video-display-symbolic" + } 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 toggle_sidebar(self): """ @@ -55,6 +58,7 @@ class GemGraphWindow(Gtk.ApplicationWindow): """ self.main_stack.set_visible_child_full("main_"+mode, Gtk.StackTransitionType.CROSSFADE) self.side_stack.set_visible_child_full("side_"+mode, Gtk.StackTransitionType.CROSSFADE) + self.main_button_mode.props.icon_name = self.__mode_icon["mode_"+mode] class AboutDialog(Gtk.AboutDialog): diff --git a/ui/gemgraph.ui b/ui/gemgraph.ui index 9543ec1..825d635 100644 --- a/ui/gemgraph.ui +++ b/ui/gemgraph.ui @@ -157,13 +157,13 @@ True - run-start-symbolic + system-run-symbolic _Run app.runmode True - run-start-symbolic + video-display-symbolic _Presentation app.presentmode True