1868329c3f8753f34be1bb2cb65359ff794acf51
1 from ya2
.lib
.gui
import Text
, Img
2 from ya2
.engine
.gui
.page
import Page
, PageGui
, PageFacade
3 from ya2
.engine
.gui
.imgbtn
import ImgBtn
6 class MainPageGui(PageGui
):
8 def build(self
, back_btn
=True, exit_behav
=False):
10 self
.__build
_version
()
11 self
.__build
_dependencies
()
13 self
.transition_enter()
15 def __build_social(self
):
16 sites
= self
.props
.gameprops
.social_sites
17 menu_props
= self
.props
.gameprops
.menu_props
18 left
= (len(sites
) - 1) / 2.0 * .15
21 parent
='bottomcenter',
23 pos
=(-left
+ i
*.15, .1),
24 frame_col
=(1, 1, 1, 1),
25 frame_texture
=menu_props
.social_imgs_dirpath
% site
[0],
26 cmd
=self
.eng
.open_browser
,
28 **menu_props
.imgbtn_args
)
29 for i
, site
in enumerate(sites
)]
30 self
.add_widgets(buttons
)
32 def __build_version(self
):
34 _('version: ') + self
.eng
.version
, parent
='bottomleft',
35 pos
=(.02, .02), scale
=.04, fg
=(.8, .8, .8, 1), align
='left',
36 font
=self
.props
.gameprops
.menu_props
.font
, wordwrap
=256)
37 self
.add_widgets([txt
])
39 def __build_dependencies(self
):
41 _('made with heart with panda3d, panda3d-simplepbr, panda3d-gltf'),
42 parent
='bottomright', pos
=(-.09, .02), scale
=.04, wordwrap
=128,
43 fg
=(.8, .8, .8, 1), align
='right',
44 font
=self
.props
.gameprops
.menu_props
.font
)
46 'assets/images/gui/p3d.dds', scale
=.04,
47 parent
=base
.a2dBottomRight
, pos
=(-.04, .04))
48 self
.add_widgets([txt
, img
])
51 class MainPage(Page
, PageFacade
):
54 def __init__(self
, mainpage_props
):
55 Page
.__init
__(self
, mainpage_props
)
56 PageFacade
.__init
__(self
)