Cleaned up code and concepts in UI
This commit is contained in:
parent
d00e036a7e
commit
95aa86fbd0
|
@ -30,30 +30,14 @@ 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_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):
|
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 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):
|
def toggle_sidebar(self):
|
||||||
"""
|
"""
|
||||||
Sets the sidebar position to open or closed
|
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)
|
Sets the active mode from stack. Mode is the name of the mode (string)
|
||||||
"""
|
"""
|
||||||
|
self.main_stack.set_visible_child_full("main_"+mode, Gtk.StackTransitionType.CROSSFADE)
|
||||||
if not self.__STACK_OK:
|
self.side_stack.set_visible_child_full("side_"+mode, Gtk.StackTransitionType.CROSSFADE)
|
||||||
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)
|
|
||||||
|
|
||||||
class AboutDialog(Gtk.AboutDialog):
|
class AboutDialog(Gtk.AboutDialog):
|
||||||
|
|
||||||
|
|
|
@ -48,71 +48,79 @@
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkStack" id="side_stack">
|
<object class="GtkStack" id="side_stack">
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox" id="side_box_run">
|
<object class="GtkStackPage">
|
||||||
<property name="halign">center</property>
|
<property name="name">side_run</property>
|
||||||
<child>
|
<property name="child">
|
||||||
<object class="GtkLabel" id="labelsiderun">
|
<object class="GtkLabel" id="labelsiderun">
|
||||||
<property name="justify">center</property>
|
<property name="justify">center</property>
|
||||||
<property name="label" translatable="yes"><b>Sidebar: run mode</b></property>
|
<property name="label" translatable="yes"><b>Sidebar: run mode</b></property>
|
||||||
<property name="use-markup">True</property>
|
<property name="use-markup">True</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</property>
|
||||||
</object>
|
</object>
|
||||||
<object class="GtkBox" id="side_box_presentation">
|
</child>
|
||||||
<property name="halign">center</property>
|
|
||||||
<child>
|
<child>
|
||||||
|
<object class="GtkStackPage">
|
||||||
|
<property name="name">side_presentation</property>
|
||||||
|
<property name="child">
|
||||||
<object class="GtkLabel" id="labelsidepresentation">
|
<object class="GtkLabel" id="labelsidepresentation">
|
||||||
<property name="justify">center</property>
|
<property name="justify">center</property>
|
||||||
<property name="label" translatable="yes"><b>Sidebar: presentation mode</b></property>
|
<property name="label" translatable="yes"><b>Sidebar: presentation mode</b></property>
|
||||||
<property name="use-markup">True</property>
|
<property name="use-markup">True</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</property>
|
||||||
</object>
|
</object>
|
||||||
<object class="GtkBox" id="side_box_edit">
|
</child>
|
||||||
<property name="halign">center</property>
|
|
||||||
<child>
|
<child>
|
||||||
|
<object class="GtkStackPage">
|
||||||
|
<property name="name">side_edit</property>
|
||||||
|
<property name="child">
|
||||||
<object class="GtkLabel" id="labelsideedit">
|
<object class="GtkLabel" id="labelsideedit">
|
||||||
<property name="justify">center</property>
|
<property name="justify">center</property>
|
||||||
<property name="label" translatable="yes"><b>Sidebar: edit mode</b></property>
|
<property name="label" translatable="yes"><b>Sidebar: edit mode</b></property>
|
||||||
<property name="use-markup">True</property>
|
<property name="use-markup">True</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkStack" id="main_stack">
|
<object class="GtkStack" id="main_stack">
|
||||||
<property name="halign">center</property>
|
|
||||||
<child>
|
|
||||||
<object class="GtkBox" id="main_box_run">
|
|
||||||
<child>
|
<child>
|
||||||
|
<object class="GtkStackPage">
|
||||||
|
<property name="name">main_run</property>
|
||||||
|
<property name="child">
|
||||||
<object class="GtkLabel">
|
<object class="GtkLabel">
|
||||||
<property name="halign">center</property>
|
<property name="halign">center</property>
|
||||||
<property name="label" translatable="yes"><b>Main zone: run mode</b></property>
|
<property name="label" translatable="yes"><b>Main zone: run mode</b></property>
|
||||||
<property name="use-markup">True</property>
|
<property name="use-markup">True</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</property>
|
||||||
</object>
|
</object>
|
||||||
<object class="GtkBox" id="main_box_presentation">
|
</child>
|
||||||
<property name="halign">center</property>
|
|
||||||
<child>
|
<child>
|
||||||
|
<object class="GtkStackPage">
|
||||||
|
<property name="name">main_presentation</property>
|
||||||
|
<property name="child">
|
||||||
<object class="GtkLabel">
|
<object class="GtkLabel">
|
||||||
<property name="halign">center</property>
|
<property name="halign">center</property>
|
||||||
<property name="label" translatable="yes"><b>Main zone: presentation mode</b></property>
|
<property name="label" translatable="yes"><b>Main zone: presentation mode</b></property>
|
||||||
<property name="use-markup">True</property>
|
<property name="use-markup">True</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</property>
|
||||||
</object>
|
</object>
|
||||||
<object class="GtkBox" id="main_box_edit">
|
</child>
|
||||||
<property name="halign">center</property>
|
|
||||||
<child>
|
<child>
|
||||||
|
<object class="GtkStackPage">
|
||||||
|
<property name="name">main_edit</property>
|
||||||
|
<property name="child">
|
||||||
<object class="GtkLabel">
|
<object class="GtkLabel">
|
||||||
<property name="halign">center</property>
|
<property name="halign">center</property>
|
||||||
<property name="label" translatable="yes"><b>Main zone: edit mode</b></property>
|
<property name="label" translatable="yes"><b>Main zone: edit mode</b></property>
|
||||||
<property name="use-markup">True</property>
|
<property name="use-markup">True</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
|
Loading…
Reference in New Issue