Mode icon + default run mode

This commit is contained in:
Adrien Bourmault 2022-07-29 10:59:57 +02:00
parent 95aa86fbd0
commit ccaf200dbe
No known key found for this signature in database
GPG Key ID: 6EB408FE0ACEC664
3 changed files with 12 additions and 6 deletions

View File

@ -51,6 +51,8 @@ class GemGraphApplication(Adw.Application):
if not win: if not win:
win = GemGraphWindow(application=self) win = GemGraphWindow(application=self)
# Display run mode by default
win.stack_switch_mode("run")
win.present() win.present()
def on_about_action(self, widget, _): def on_about_action(self, widget, _):

View File

@ -30,13 +30,16 @@ class GemGraphWindow(Gtk.ApplicationWindow):
main_stack = Gtk.Template.Child() main_stack = Gtk.Template.Child()
side_stack = Gtk.Template.Child() side_stack = Gtk.Template.Child()
main_paned = 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): def __init__(self, **kwargs):
super().__init__(**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): 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.main_stack.set_visible_child_full("main_"+mode, Gtk.StackTransitionType.CROSSFADE)
self.side_stack.set_visible_child_full("side_"+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): class AboutDialog(Gtk.AboutDialog):

View File

@ -157,13 +157,13 @@
<attribute name="use-icon">True</attribute> <attribute name="use-icon">True</attribute>
</item> </item>
<item> <item>
<attribute name="icon">run-start-symbolic</attribute> <attribute name="icon">system-run-symbolic</attribute>
<attribute name="label" translatable="yes">_Run</attribute> <attribute name="label" translatable="yes">_Run</attribute>
<attribute name="action">app.runmode</attribute> <attribute name="action">app.runmode</attribute>
<attribute name="use-icon">True</attribute> <attribute name="use-icon">True</attribute>
</item> </item>
<item> <item>
<attribute name="icon">run-start-symbolic</attribute> <attribute name="icon">video-display-symbolic</attribute>
<attribute name="label" translatable="yes">_Presentation</attribute> <attribute name="label" translatable="yes">_Presentation</attribute>
<attribute name="action">app.presentmode</attribute> <attribute name="action">app.presentmode</attribute>
<attribute name="use-icon">True</attribute> <attribute name="use-icon">True</attribute>