Commit | Line | Data |
---|---|---|
7ac52030 FC |
1 | from sys import exit |
2 | from xmlrpc.client import ServerProxy | |
9f095a28 | 3 | from ya2.utils.gui.base_page import BasePage, ButtonArgs |
7ac52030 FC |
4 | |
5 | ||
6 | class MainPage(BasePage): | |
7 | ||
9199c6aa | 8 | def _build_widgets(self): |
9f095a28 | 9 | play_args = ButtonArgs( |
9199c6aa FC |
10 | id='play', |
11 | text=_('Play'), | |
12 | pos=(0, .6), | |
13 | command=self._set_page, | |
14 | command_args=['play']) | |
15 | self._add_button(play_args) | |
9f095a28 | 16 | option_args = ButtonArgs( |
9199c6aa FC |
17 | id='options', |
18 | text=_('Options'), | |
19 | pos=(0, .2), | |
20 | command=self._set_page, | |
21 | command_args=['options']) | |
22 | self._add_button(option_args) | |
9f095a28 | 23 | credits_args = ButtonArgs( |
9199c6aa FC |
24 | id='credits', |
25 | text=_('Credits'), | |
26 | pos=(0, -.2), | |
27 | command=self._set_page, | |
28 | command_args=['credits']) | |
29 | self._add_button(credits_args) | |
9f095a28 | 30 | exit_args = ButtonArgs( |
9199c6aa FC |
31 | id='exit', |
32 | text=_('Exit'), | |
33 | pos=(0, -.6), | |
34 | command=self.__on_exit) | |
35 | self._add_button(exit_args) | |
36 | self._rearrange_buttons_width() | |
37 | ||
38 | def __on_exit(self): | |
39 | if self._page_info.running_functional_tests: | |
40 | ServerProxy('http://localhost:7000').destroy() | |
41 | exit() |