1 from os
.path
import exists
2 from os
import makedirs
4 from logging
import debug
, info
5 from importlib
import import_module
6 from inspect
import isclass
7 from panda3d
.core
import AmbientLight
, DirectionalLight
, Point3
, Texture
, \
8 TextPropertiesManager
, TextNode
, Spotlight
, PerspectiveLens
, BitMask32
9 from panda3d
.bullet
import BulletPlaneShape
, BulletGhostNode
10 from direct
.gui
.OnscreenImage
import OnscreenImage
11 from direct
.gui
.OnscreenText
import OnscreenText
12 from direct
.gui
.DirectGui
import DirectButton
, DirectFrame
13 from direct
.gui
.DirectGuiGlobals
import FLAT
, DISABLED
, NORMAL
14 from direct
.showbase
.DirectObject
import DirectObject
15 from pmachines
.items
.background
import Background
16 from pmachines
.gui
.sidepanel
import SidePanel
17 from ya2
.utils
.cursor
import MouseCursor
18 from ya2
.p3d
.gfx
import P3dGfxMgr
19 from ya2
.p3d
.p3d
import LibP3d
22 class Scene(DirectObject
):
24 def __init__(self
, world
, exit_cb
, auto_close_instr
, dbg_items
, reload_cb
, scenes
, pos_mgr
):
27 self
._exit
_cb
= exit_cb
28 self
._dbg
_items
= dbg_items
29 self
._reload
_cb
= reload_cb
30 self
._pos
_mgr
= pos_mgr
33 self
._enforce
_res
= ''
34 self
.accept('enforce_res', self
.enforce_res
)
36 self
._cursor
= MouseCursor(
37 'assets/images/buttons/arrowUpLeft.dds', (.04, 1, .04), (.5, .5, .5, 1),
42 self
._set
_mouse
_plane
()
47 self
._item
_active
= None
50 self
.__restore
_state
()
52 self
._set
_instructions
()
53 self
._bg
= Background()
54 self
._side
_panel
= SidePanel(world
, self
._mouse
_plane
_node
, (-5, 4), (-3, 1), 1, self
.items
)
55 self
._scene
_tsk
= taskMgr
.add(self
.on_frame
, 'on_frame')
67 def screenshot(self
, task
=None):
68 tex
= Texture('screenshot')
69 buffer = base
.win
.make_texture_buffer('screenshot', 512, 512, tex
, True )
70 cam
= base
.make_camera(buffer)
71 cam
.reparent_to(render
)
72 cam
.node().get_lens().set_fov(base
.camLens
.get_fov())
73 cam
.set_pos(0, -20, 0)
80 use_emission_maps
=False,
81 use_occlusion_maps
=True,
84 base
.graphicsEngine
.renderFrame()
85 base
.graphicsEngine
.renderFrame()
86 fname
= self
.__class
__.__name
__
87 if not exists('assets/images/scenes'):
88 makedirs('assets/images/scenes')
89 buffer.save_screenshot('assets/images/scenes/%s.png' % fname
)
91 # frameTexture=buffer.get_texture(), relief=FLAT,
92 # frameSize=(-.2, .2, -.2, .2))
93 return buffer.get_texture()
95 def current_bottom(self
):
97 for item
in self
.items
:
99 curr_bottom
= min(curr_bottom
, item
.get_bottom())
103 [itm
.destroy() for itm
in self
.items
]
107 self
._command
_idx
= 0
108 if hasattr(self
, '_success_txt'):
109 self
._success
_txt
.destroy()
110 del self
._success
_txt
111 self
.__right
_btn
['state'] = NORMAL
113 def enforce_res(self
, val
):
114 self
._enforce
_res
= val
115 info('enforce res: ' + val
)
118 self
.ignore('enforce_res')
122 self
._unset
_mouse
_plane
()
123 [itm
.destroy() for itm
in self
.items
]
125 self
._side
_panel
.destroy()
126 self
._cursor
.destroy()
127 taskMgr
.remove(self
._scene
_tsk
)
128 if hasattr(self
, '_success_txt'):
129 self
._success
_txt
.destroy()
131 def _set_camera(self
):
132 base
.camera
.set_pos(0, -20, 0)
133 base
.camera
.look_at(0, 0, 0)
135 def __load_img_btn(self
, path
, col
):
136 img
= OnscreenImage('assets/images/buttons/%s.dds' % path
)
137 img
.set_transparency(True)
143 def load_images_btn(path
, col
):
146 (.6, .6, .6, 1), # ready
147 (1, 1, 1, 1), # press
148 (.8, .8, .8, 1), # rollover
154 (.4, .1, .1, .4)]}[col
]
155 return [self
.__load
_img
_btn
(path
, col
) for col
in colors
]
156 abl
, abr
= base
.a2dBottomLeft
, base
.a2dBottomRight
158 ('home', self
.on_home
, NORMAL
, abl
, 'gray'),
159 ('information', self
._set
_instructions
, NORMAL
, abl
, 'gray'),
160 ('right', self
.on_play
, NORMAL
, abr
, 'green'),
161 #('next', self.on_next, DISABLED, abr, 'gray'),
162 #('previous', self.on_prev, DISABLED, abr, 'gray'),
163 #('rewind', self.reset, NORMAL, abr, 'gray')
167 for binfo
in btn_info
:
168 imgs
= load_images_btn(binfo
[0], binfo
[4])
169 if binfo
[3] == base
.a2dBottomLeft
:
173 sign
, num
= -1, num_r
175 fcols
= (.4, .4, .4, .14), (.3, .3, .3, .05)
177 image
=imgs
, scale
=.05, pos
=(sign
* (.06 + .11 * num
), 1, .06),
178 parent
=binfo
[3], command
=binfo
[1], state
=binfo
[2], relief
=FLAT
,
179 frameColor
=fcols
[0] if binfo
[2] == NORMAL
else fcols
[1],
180 rolloverSound
=loader
.load_sfx('assets/audio/sfx/rollover.ogg'),
181 clickSound
=loader
.load_sfx('assets/audio/sfx/click.ogg'))
182 btn
.set_transparency(True)
183 self
._pos
_mgr
.register(binfo
[0], LibP3d
.wdg_pos(btn
))
185 self
.__home
_btn
, self
.__info
_btn
, self
.__right
_btn
= btns
186 # , self.__next_btn, self.__prev_btn, self.__rewind_btn
188 self
._info
_txt
= OnscreenText(
189 '', parent
=base
.a2dTopRight
, scale
=0.04,
190 pos
=(-.03, -.06), fg
=(.9, .9, .9, 1), align
=TextNode
.A_right
)
192 def _unset_gui(self
):
194 self
.__home
_btn
, self
.__info
_btn
, self
.__right
_btn
,
195 #self.__next_btn, self.__prev_btn, self.__rewind_btn
197 [btn
.destroy() for btn
in btns
]
199 self
._info
_txt
.destroy()
201 def _set_spotlight(self
, name
, pos
, look_at
, color
, shadows
=False):
202 light
= Spotlight(name
)
204 light
.setLens(PerspectiveLens())
205 light_np
= render
.attach_new_node(light
)
206 light_np
.set_pos(pos
)
207 light_np
.look_at(look_at
)
208 light
.set_color(color
)
209 render
.set_light(light_np
)
212 def _set_lights(self
):
213 alight
= AmbientLight('alight') # for ao
214 alight
.set_color((.15, .15, .15, 1))
215 self
._alnp
= render
.attach_new_node(alight
)
216 render
.set_light(self
._alnp
)
217 self
._key
_light
= self
._set
_spotlight
(
218 'key light', (-5, -80, 5), (0, 0, 0), (2.8, 2.8, 2.8, 1))
219 self
._shadow
_light
= self
._set
_spotlight
(
220 'key light', (-5, -80, 5), (0, 0, 0), (.58, .58, .58, 1), True)
221 self
._shadow
_light
.node().set_shadow_caster(True, 2048, 2048)
222 self
._shadow
_light
.node().get_lens().set_film_size(2048, 2048)
223 self
._shadow
_light
.node().get_lens().set_near_far(1, 256)
224 self
._shadow
_light
.node().set_camera_mask(BitMask32(0x01))
226 def _unset_lights(self
):
227 for light
in [self
._alnp
, self
._key
_light
, self
._shadow
_light
]:
228 render
.clear_light(light
)
231 def _set_input(self
):
232 self
.accept('mouse1', self
.on_click_l
)
233 self
.accept('mouse1-up', self
.on_release
)
234 self
.accept('mouse3', self
.on_click_r
)
235 self
.accept('mouse3-up', self
.on_release
)
237 def _unset_input(self
):
238 for evt
in ['mouse1', 'mouse1-up', 'mouse3', 'mouse3-up']:
241 def _set_mouse_plane(self
):
242 shape
= BulletPlaneShape((0, -1, 0), 0)
243 #self._mouse_plane_node = BulletRigidBodyNode('mouse plane')
244 self
._mouse
_plane
_node
= BulletGhostNode('mouse plane')
245 self
._mouse
_plane
_node
.addShape(shape
)
246 #np = render.attachNewNode(self._mouse_plane_node)
247 #self._world.attachRigidBody(self._mouse_plane_node)
248 self
._world
.attach_ghost(self
._mouse
_plane
_node
)
250 def _unset_mouse_plane(self
):
251 self
._world
.remove_ghost(self
._mouse
_plane
_node
)
254 if not base
.mouseWatcherNode
.has_mouse(): return []
255 p_from
, p_to
= P3dGfxMgr
.world_from_to(base
.mouseWatcherNode
.get_mouse())
256 return self
._world
.ray_test_all(p_from
, p_to
).get_hits()
258 def _update_info(self
, item
):
261 txt
= '%.3f %.3f\n%.3f°' % (
262 item
._np
.get_x(), item
._np
.get_z(), item
._np
.get_r())
263 self
._info
_txt
['text'] = txt
265 def _on_click(self
, method
):
268 for hit
in self
._get
_hits
():
269 if hit
.get_node() == self
._mouse
_plane
_node
:
270 pos
= hit
.get_hit_pos()
271 for hit
in self
._get
_hits
():
272 for item
in [i
for i
in self
.items
if hit
.get_node() == i
.node
and i
.interactable
]:
273 if not self
._item
_active
:
274 self
._item
_active
= item
275 getattr(item
, method
)(pos
)
276 img
= 'move' if method
== 'on_click_l' else 'rotate'
277 if not (img
== 'rotate' and not item
._instantiated
):
278 self
._cursor
.set_image('assets/images/buttons/%s.dds' % img
)
280 def on_click_l(self
):
281 self
._on
_click
('on_click_l')
283 def on_click_r(self
):
284 self
._on
_click
('on_click_r')
286 def on_release(self
):
287 if self
._item
_active
and not self
._item
_active
._first
_command
:
288 self
._commands
= self
._commands
[:self
._command
_idx
]
289 self
._commands
+= [self
._item
_active
]
290 self
._command
_idx
+= 1
291 #self.__prev_btn['state'] = NORMAL
292 #fcols = (.4, .4, .4, .14), (.3, .3, .3, .05)
293 #self.__prev_btn['frameColor'] = fcols[0]
294 #if self._item_active._command_idx == len(self._item_active._commands) - 1:
295 # self.__next_btn['state'] = DISABLED
296 # self.__next_btn['frameColor'] = fcols[1]
297 self
._item
_active
= None
298 [item
.on_release() for item
in self
.items
]
299 self
._cursor
.set_image('assets/images/buttons/arrowUpLeft.dds')
302 for item
in self
.items
:
303 item
.repos_done
= False
304 self
.items
= sorted(self
.items
, key
=lambda itm
: itm
.__class
__.__name
__)
305 [item
.on_aspect_ratio_changed() for item
in self
.items
]
306 self
._side
_panel
.update(self
.items
)
307 max_x
= -float('inf')
308 for item
in self
.items
:
309 if not item
._instantiated
:
310 max_x
= max(item
._np
.get_x(), max_x
)
311 for item
in self
.items
:
312 if not item
._instantiated
:
315 def on_aspect_ratio_changed(self
):
318 def _win_condition(self
):
321 def _fail_condition(self
):
322 return all(itm
.fail_condition() for itm
in self
.items
) and not self
._paused
and self
._state
== 'playing'
324 def on_frame(self
, task
):
325 hits
= self
._get
_hits
()
327 for hit
in self
._get
_hits
():
328 if hit
.get_node() == self
._mouse
_plane
_node
:
329 pos
= hit
.get_hit_pos()
330 hit_nodes
= [hit
.get_node() for hit
in hits
]
331 if self
._item
_active
:
332 items_hit
= [self
._item
_active
]
334 items_hit
= [itm
for itm
in self
.items
if itm
.node
in hit_nodes
]
335 items_no_hit
= [itm
for itm
in self
.items
if itm
not in items_hit
]
336 [itm
.on_mouse_on() for itm
in items_hit
]
337 [itm
.on_mouse_off() for itm
in items_no_hit
]
338 if pos
and self
._item
_active
:
339 self
._item
_active
.on_mouse_move(pos
)
341 self
._update
_info
(items_hit
[0] if items_hit
else None)
342 if self
._win
_condition
():
343 self
._set
_fail
() if self
._enforce
_res
== 'fail' else self
._set
_win
()
344 elif self
._state
== 'playing' and self
._fail
_condition
():
345 self
._set
_win
() if self
._enforce
_res
== 'win' else self
._set
_fail
()
346 if any(itm
._overlapping
for itm
in self
.items
):
347 self
._cursor
.cursor_img
.img
.set_color(.9, .1, .1, 1)
349 self
._cursor
.cursor_img
.img
.set_color(.9, .9, .9, 1)
352 def cb_inst(self
, item
):
356 self
._state
= 'playing'
357 #self.__prev_btn['state'] = DISABLED
358 #self.__next_btn['state'] = DISABLED
359 self
.__right
_btn
['state'] = DISABLED
360 [itm
.play() for itm
in self
.items
]
363 self
._commands
[self
._command
_idx
].redo()
364 self
._command
_idx
+= 1
365 fcols
= (.4, .4, .4, .14), (.3, .3, .3, .05)
366 #self.__prev_btn['state'] = NORMAL
367 #self.__prev_btn['frameColor'] = fcols[0]
368 more_commands
= self
._command
_idx
< len(self
._commands
)
369 #self.__next_btn['state'] = NORMAL if more_commands else DISABLED
370 #self.__next_btn['frameColor'] = fcols[0] if more_commands else fcols[1]
373 self
._command
_idx
-= 1
374 self
._commands
[self
._command
_idx
].undo()
375 fcols
= (.4, .4, .4, .14), (.3, .3, .3, .05)
376 #self.__next_btn['state'] = NORMAL
377 #self.__next_btn['frameColor'] = fcols[0]
378 #self.__prev_btn['state'] = NORMAL if self._command_idx else DISABLED
379 #self.__prev_btn['frameColor'] = fcols[0] if self._command_idx else fcols[1]
384 def _set_instructions(self
):
387 mgr
= TextPropertiesManager
.get_global_ptr()
388 for name
in ['mouse_l', 'mouse_r']:
389 graphic
= OnscreenImage('assets/images/buttons/%s.dds' % name
)
390 graphic
.set_scale(.5)
391 graphic
.get_texture().set_minfilter(Texture
.FTLinearMipmapLinear
)
392 graphic
.get_texture().set_anisotropic_degree(2)
393 mgr
.set_graphic(name
, graphic
)
395 graphic
.set_transparency(True)
396 graphic
.detach_node()
397 frm
= DirectFrame(frameColor
=(.4, .4, .4, .06),
398 frameSize
=(-.6, .6, -.3, .3))
399 font
= base
.loader
.load_font('assets/fonts/Hanken-Book.ttf')
401 font
.set_pixels_per_unit(60)
402 font
.set_minfilter(Texture
.FTLinearMipmapLinear
)
403 font
.set_outline((0, 0, 0, 1), .8, .2)
404 self
._txt
= OnscreenText(
405 self
._instr
_txt
(), parent
=frm
, font
=font
, scale
=0.06,
406 fg
=(.9, .9, .9, 1), align
=TextNode
.A_left
)
407 u_l
= self
._txt
.textNode
.get_upper_left_3d()
408 l_r
= self
._txt
.textNode
.get_lower_right_3d()
409 w
, h
= l_r
[0] - u_l
[0], u_l
[2] - l_r
[2]
412 z
= h
/ 2 - font
.get_line_height() * self
._txt
['scale'][1]
413 z
+= (btn_scale
+ 2 * mar
) / 2
414 self
._txt
['pos'] = -w
/ 2, z
415 u_l
= self
._txt
.textNode
.get_upper_left_3d()
416 l_r
= self
._txt
.textNode
.get_lower_right_3d()
417 c_l_r
= l_r
[0], l_r
[1], l_r
[2] - 2 * mar
- btn_scale
418 fsz
= u_l
[0] - mar
, l_r
[0] + mar
, c_l_r
[2] - mar
, u_l
[2] + mar
419 frm
['frameSize'] = fsz
421 (.6, .6, .6, 1), # ready
422 (1, 1, 1, 1), # press
423 (.8, .8, .8, 1), # rollover
425 imgs
= [self
.__load
_img
_btn
('exitRight', col
) for col
in colors
]
427 image
=imgs
, scale
=btn_scale
,
428 pos
=(l_r
[0] - btn_scale
, 1, l_r
[2] - mar
- btn_scale
),
429 parent
=frm
, command
=self
.__on
_close
_instructions
, extraArgs
=[frm
],
430 relief
=FLAT
, frameColor
=(.6, .6, .6, .08),
431 rolloverSound
=loader
.load_sfx('assets/audio/sfx/rollover.ogg'),
432 clickSound
=loader
.load_sfx('assets/audio/sfx/click.ogg'))
433 btn
.set_transparency(True)
434 self
._pos
_mgr
.register('close_instructions', LibP3d
.wdg_pos(btn
))
437 loader
.load_sfx('assets/audio/sfx/success.ogg').play()
440 frm
= DirectFrame(frameColor
=(.4, .4, .4, .06),
441 frameSize
=(-.6, .6, -.3, .3))
442 font
= base
.loader
.load_font('assets/fonts/Hanken-Book.ttf')
444 font
.set_pixels_per_unit(60)
445 font
.set_minfilter(Texture
.FTLinearMipmapLinear
)
446 font
.set_outline((0, 0, 0, 1), .8, .2)
447 self
._txt
= OnscreenText(
450 font
=font
, scale
=0.2,
452 u_l
= self
._txt
.textNode
.get_upper_left_3d()
453 l_r
= self
._txt
.textNode
.get_lower_right_3d()
454 w
, h
= l_r
[0] - u_l
[0], u_l
[2] - l_r
[2]
457 z
= h
/ 2 - font
.get_line_height() * self
._txt
['scale'][1]
458 z
+= (btn_scale
+ 2 * mar
) / 2
459 self
._txt
['pos'] = 0, z
460 u_l
= self
._txt
.textNode
.get_upper_left_3d()
461 l_r
= self
._txt
.textNode
.get_lower_right_3d()
462 c_l_r
= l_r
[0], l_r
[1], l_r
[2] - 2 * mar
- btn_scale
463 fsz
= u_l
[0] - mar
, l_r
[0] + mar
, c_l_r
[2] - mar
, u_l
[2] + mar
464 frm
['frameSize'] = fsz
466 (.6, .6, .6, 1), # ready
467 (1, 1, 1, 1), # press
468 (.8, .8, .8, 1), # rollover
470 imgs
= [self
.__load
_img
_btn
('home', col
) for col
in colors
]
472 image
=imgs
, scale
=btn_scale
,
473 pos
=(-2.8 * btn_scale
, 1, l_r
[2] - mar
- btn_scale
),
474 parent
=frm
, command
=self
._on
_end
_home
, extraArgs
=[frm
],
475 relief
=FLAT
, frameColor
=(.6, .6, .6, .08),
476 rolloverSound
=loader
.load_sfx('assets/audio/sfx/rollover.ogg'),
477 clickSound
=loader
.load_sfx('assets/audio/sfx/click.ogg'))
478 btn
.set_transparency(True)
479 self
._pos
_mgr
.register('home_win', LibP3d
.wdg_pos(btn
))
480 imgs
= [self
.__load
_img
_btn
('rewind', col
) for col
in colors
]
482 image
=imgs
, scale
=btn_scale
,
483 pos
=(0, 1, l_r
[2] - mar
- btn_scale
),
484 parent
=frm
, command
=self
._on
_restart
, extraArgs
=[frm
],
485 relief
=FLAT
, frameColor
=(.6, .6, .6, .08),
486 rolloverSound
=loader
.load_sfx('assets/audio/sfx/rollover.ogg'),
487 clickSound
=loader
.load_sfx('assets/audio/sfx/click.ogg'))
488 self
._pos
_mgr
.register('replay', LibP3d
.wdg_pos(btn
))
489 btn
.set_transparency(True)
490 enabled
= self
._scenes
.index(self
.__class
__) < len(self
._scenes
) - 1
492 next_scene
= self
._scenes
[self
._scenes
.index(self
.__class
__) + 1]
495 imgs
= [self
.__load
_img
_btn
('right', col
) for col
in colors
]
497 image
=imgs
, scale
=btn_scale
,
498 pos
=(2.8 * btn_scale
, 1, l_r
[2] - mar
- btn_scale
),
499 parent
=frm
, command
=self
._on
_next
_scene
,
500 extraArgs
=[frm
, next_scene
], relief
=FLAT
,
501 frameColor
=(.6, .6, .6, .08),
502 rolloverSound
=loader
.load_sfx('assets/audio/sfx/rollover.ogg'),
503 clickSound
=loader
.load_sfx('assets/audio/sfx/click.ogg'))
504 btn
['state'] = NORMAL
if enabled
else DISABLED
505 self
._pos
_mgr
.register('next', LibP3d
.wdg_pos(btn
))
506 btn
.set_transparency(True)
509 loader
.load_sfx('assets/audio/sfx/success.ogg').play()
512 frm
= DirectFrame(frameColor
=(.4, .4, .4, .06),
513 frameSize
=(-.6, .6, -.3, .3))
514 font
= base
.loader
.load_font('assets/fonts/Hanken-Book.ttf')
516 font
.set_pixels_per_unit(60)
517 font
.set_minfilter(Texture
.FTLinearMipmapLinear
)
518 font
.set_outline((0, 0, 0, 1), .8, .2)
519 self
._txt
= OnscreenText(
520 _('You have failed!'),
522 font
=font
, scale
=0.2,
524 u_l
= self
._txt
.textNode
.get_upper_left_3d()
525 l_r
= self
._txt
.textNode
.get_lower_right_3d()
526 w
, h
= l_r
[0] - u_l
[0], u_l
[2] - l_r
[2]
529 z
= h
/ 2 - font
.get_line_height() * self
._txt
['scale'][1]
530 z
+= (btn_scale
+ 2 * mar
) / 2
531 self
._txt
['pos'] = 0, z
532 u_l
= self
._txt
.textNode
.get_upper_left_3d()
533 l_r
= self
._txt
.textNode
.get_lower_right_3d()
534 c_l_r
= l_r
[0], l_r
[1], l_r
[2] - 2 * mar
- btn_scale
535 fsz
= u_l
[0] - mar
, l_r
[0] + mar
, c_l_r
[2] - mar
, u_l
[2] + mar
536 frm
['frameSize'] = fsz
538 (.6, .6, .6, 1), # ready
539 (1, 1, 1, 1), # press
540 (.8, .8, .8, 1), # rollover
542 imgs
= [self
.__load
_img
_btn
('home', col
) for col
in colors
]
544 image
=imgs
, scale
=btn_scale
,
545 pos
=(-2.8 * btn_scale
, 1, l_r
[2] - mar
- btn_scale
),
546 parent
=frm
, command
=self
._on
_end
_home
, extraArgs
=[frm
],
547 relief
=FLAT
, frameColor
=(.6, .6, .6, .08),
548 rolloverSound
=loader
.load_sfx('assets/audio/sfx/rollover.ogg'),
549 clickSound
=loader
.load_sfx('assets/audio/sfx/click.ogg'))
550 self
._pos
_mgr
.register('home_win', LibP3d
.wdg_pos(btn
))
551 btn
.set_transparency(True)
552 imgs
= [self
.__load
_img
_btn
('rewind', col
) for col
in colors
]
554 image
=imgs
, scale
=btn_scale
,
555 pos
=(0, 1, l_r
[2] - mar
- btn_scale
),
556 parent
=frm
, command
=self
._on
_restart
, extraArgs
=[frm
],
557 relief
=FLAT
, frameColor
=(.6, .6, .6, .08),
558 rolloverSound
=loader
.load_sfx('assets/audio/sfx/rollover.ogg'),
559 clickSound
=loader
.load_sfx('assets/audio/sfx/click.ogg'))
560 self
._pos
_mgr
.register('replay', LibP3d
.wdg_pos(btn
))
561 btn
.set_transparency(True)
563 def _on_restart(self
, frm
):
564 self
.__on
_close
_instructions
(frm
)
567 def _on_end_home(self
, frm
):
568 self
.__on
_close
_instructions
(frm
)
571 def _on_next_scene(self
, frm
, scene
):
572 self
.__on
_close
_instructions
(frm
)
573 self
._reload
_cb
(scene
)
575 def __store_state(self
):
577 self
.__home
_btn
, self
.__info
_btn
, self
.__right
_btn
,
578 #self.__next_btn, self.__prev_btn, self.__rewind_btn
580 self
.__btn
_state
= [btn
['state'] for btn
in btns
]
582 btn
['state'] = DISABLED
583 [itm
.store_state() for itm
in self
.items
]
585 def __restore_state(self
):
587 self
.__home
_btn
, self
.__info
_btn
, self
.__right
_btn
,
588 #self.__next_btn, self.__prev_btn, self.__rewind_btn
590 for btn
, state
in zip(btns
, self
.__btn
_state
):
592 [itm
.restore_state() for itm
in self
.items
]
595 def __on_close_instructions(self
, frm
):
597 self
.__restore
_state
()