Commit fe6842af authored by Philipp Hörist's avatar Philipp Hörist

Assistant: Add get_page()

Use get_page() instead of page specific methods
parent 1452e842
Pipeline #4662 passed with stages
in 5 minutes and 57 seconds
......@@ -114,11 +114,8 @@ class Assistant(Gtk.ApplicationWindow, EventHelper):
self._set_buttons_visible(buttons)
self._ui.stack.set_visible_child_full(name, transition)
def get_error_page(self):
return self._pages['error']
def get_success_page(self):
return self._pages['success']
def get_page(self, name):
return self._pages[name]
def _set_buttons_visible(self, buttons):
for button in self._buttons.values():
......
......@@ -20,6 +20,16 @@ class TestAssistant(Assistant):
self.add_default_page('error')
self.add_default_page('success')
success_page = self.get_page('success')
success_page.set_title('Success')
success_page.set_heading('Success Heading')
success_page.set_text('This is the success text')
error_page = self.get_page('error')
error_page.set_title('Error')
error_page.set_heading('Error Heading')
error_page.set_text('This is the error text')
self.add_button('forward', 'Forward', 'suggested-action')
self.add_button('close', 'Close', 'destructive-action')
self.add_button('back', 'Back')
......@@ -77,17 +87,9 @@ class TestAssistant(Assistant):
self.set_default_button('forward')
elif page_name == 'success':
success_page = self.get_success_page()
success_page.set_title('Success')
success_page.set_heading('Success Heading')
success_page.set_text('This is the success text')
self.set_default_button('forward')
elif page_name == 'error':
error_page = self.get_error_page()
error_page.set_title('Error')
error_page.set_heading('Error Heading')
error_page.set_text('This is the error text')
self.set_default_button('back')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment