1 from sys
import platform
2 from os
import environ
, system
3 from webbrowser
import open_new_tab
4 from panda3d
.core
import TextNode
, \
5 TextProperties
, TextPropertiesManager
6 from direct
.gui
.DirectGui
import DirectButton
7 from direct
.gui
.OnscreenText
import OnscreenText
8 from ya2
.utils
.gfx
import DirectGuiMixin
9 from pmachines
.gui
.base_page
import BasePage
12 class CreditsPage(BasePage
):
14 def __init__(self
, menu
, test_positions
, gui_args
, option_file
, running_functional_tests
):
15 super().__init
__(menu
, running_functional_tests
)
16 self
._test
_positions
= test_positions
17 self
._option
_file
= option_file
18 self
._running
_functional
_tests
= running_functional_tests
19 for k
in list(self
._test
_positions
.keys()): del self
._test
_positions
[k
]
21 tp_scale
= TextProperties()
22 tp_scale
.set_text_scale(.64)
23 TextPropertiesManager
.getGlobalPtr().setProperties('scale', tp_scale
)
24 self
._widgets
+= [OnscreenText(
25 _('Code and gfx\n \1scale\1Flavio Calva\2\n\n\nMusic\n \1scale\1Stefan Grossmann\2'),
26 pos
=(-.9, .55), font
=gui_args
.button
['text_font'],
27 scale
=gui_args
.button
['scale'], fg
=gui_args
.button
['text_fg'],
28 align
=TextNode
.A_left
)]
29 self
._widgets
+= [DirectButton(
30 text
=_('Website'), pos
=(-.6, 1, .29), command
=self
.on_website
,
31 **gui_args
.button |
{'scale': .08})]
32 self
._widgets
+= [OnscreenText(
33 _('Special thanks to:\n \1scale\1rdb\2\n \1scale\1Luisa Tenuta\2\n \1scale\1Damiana Ercolani\2'),
34 pos
=(.1, .55), font
=gui_args
.button
['text_font'],
35 scale
=gui_args
.button
['scale'], fg
=gui_args
.button
['text_fg'],
36 align
=TextNode
.A_left
)]
37 self
._widgets
+= [DirectButton(
38 text
=_('Back'), pos
=(0, 1, -.8), command
=self
.on_back
,
40 self
._widgets
[-1].__class
__ = type('DirectButtonMixed', (DirectButton
, DirectGuiMixin
), {})
41 self
._test
_positions
['back'] = self
._widgets
[-1].pos_pixel()
42 self
.accept('enforce_resolution', self
.enforce_resolution
)
45 if platform
.startswith('linux'):
46 environ
['LD_LIBRARY_PATH'] = ''
47 system('xdg-open https://www.ya2.it')
49 open_new_tab('https://www.ya2.it')