Re-create on_btn_clicked() to simplify future changes

merge-requests/64/head
Hugo Posnic 2016-12-17 23:55:19 +01:00
parent 925f44e44f
commit 076d81303b
2 changed files with 9 additions and 7 deletions

View File

@ -218,9 +218,7 @@ class ManjaroHello():
def on_action_clicked(self, action, _=None):
"""Event for differents actions."""
name = action.get_name()
if name in ("welcome", "readme", "release", "involved"):
self.builder.get_object("stack").set_visible_child(self.builder.get_object(name + "page"))
elif name == "installgui":
if name == "installgui":
subprocess.call(["sudo", "-E", "calamares"])
elif name == "installcli":
subprocess.call(["sudo cli-installer"])
@ -233,6 +231,10 @@ class ManjaroHello():
dialog.run()
dialog.hide()
def on_btn_clicked(self, btn):
"""Event for clicked button."""
self.builder.get_object("stack").set_visible_child(self.builder.get_object(btn.get_name() + "page"))
def on_link_clicked(self, link, _=None):
"""Event for clicked link."""
webbrowser.open_new_tab(self.urls[link.get_name()])

View File

@ -171,7 +171,7 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="on_action_clicked" swapped="no"/>
<signal name="clicked" handler="on_btn_clicked" swapped="no"/>
</object>
<packing>
<property name="left_attach">0</property>
@ -185,7 +185,7 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="on_action_clicked" swapped="no"/>
<signal name="clicked" handler="on_btn_clicked" swapped="no"/>
</object>
<packing>
<property name="left_attach">0</property>
@ -213,7 +213,7 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="on_action_clicked" swapped="no"/>
<signal name="clicked" handler="on_btn_clicked" swapped="no"/>
</object>
<packing>
<property name="left_attach">2</property>
@ -577,7 +577,7 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="image">homeicon</property>
<signal name="clicked" handler="on_action_clicked" swapped="no"/>
<signal name="clicked" handler="on_btn_clicked" swapped="no"/>
</object>
</child>
<child>