Signets dynammiques

This commit is contained in:
Philippe Roy 2022-08-21 03:03:11 +02:00
parent b34e4ab067
commit cb55e3b641
2 changed files with 67 additions and 19 deletions

3
rp.py
View File

@ -349,6 +349,7 @@ def cmd_init():
windows=("Doc", "Doc_chap-general", "Doc_chap-missions", "Doc_chap-rover", "Doc_chap-python", "About")
for window in windows:
scene.objects[window].setVisible(False,True)
rp_doc.init()
##
# Highlight des commandes
@ -802,7 +803,7 @@ def tablet_open ():
# scene.objects['Book-cmd-underlay'].setVisible(True,False)
# Initialisation de la tablette
rp_doc.init()
rp_doc.open()
##
# Enteindre la tablette

View File

@ -211,6 +211,15 @@ def init():
scene.objects["Doc_chap-"+page]['init_ly']=scene.objects["Doc_chap-"+page].worldPosition.y
scene.objects["Doc_chap-"+page]['init_lz']=scene.objects["Doc_chap-"+page].worldPosition.z
# Page par défaut
scene.objects['Doc']['page_chap'] = "general"
##
# Ouvrir la tablette
##
def open():
# Placer la tablette
# scene.objects['Doc'].worldPosition = [0, -21, 15.75]
scene.objects['Doc'].worldPosition = [0, -21, 15.8]
@ -220,13 +229,34 @@ def init():
scene.objects['Doc_text'].setVisible(False,True)
# sound_play (sndbuff_book_open)
# Placer le nouveau chapitre
name_chap = scene.objects['Doc']['page_chap']
scene.objects['Doc-'+name_chap].color = color_doc_activate
scene.objects['Doc-'+name_chap+'-text'].color = color_doc_activate
scene.objects['Doc_chap-'+name_chap].worldPosition = scene.objects['Doc'].worldPosition
scene.objects['Doc_chap-'+name_chap].setVisible(True,True)
# Afficher le texte de la carte active
if name_chap != "general":
if scene.objects['Doc_chap-'+name_chap]['page_fct'] !="":
name_fct = scene.objects['Doc_chap-'+name_chap]['page_fct']
scene.objects['Doc_title']['Text'] = card_description[name_fct][0]
scene.objects['Doc_text']['Text'] = card_description[name_fct][1]
scene.objects['Doc_title'].setVisible(True, False)
scene.objects['Doc_text'].setVisible(True, False)
else:
scene.objects['Doc_title'].setVisible(False,True)
scene.objects['Doc_text'].setVisible(False,True)
else:
scene.objects['Doc_title'].setVisible(False,True)
scene.objects['Doc_text'].setVisible(False,True)
# Placer la page Généralité (page par défaut)
scene.objects['Doc_chap-general'].worldPosition = scene.objects['Doc'].worldPosition
scene.objects['Doc_chap-general'].setVisible(True,True)
scene.objects['Doc']['page_chap'] = "general"
scene.objects['Doc']['page_fct'] = ""
scene.objects['Doc-general'].color = color_doc_activate
scene.objects['Doc-general-text'].color = color_doc_activate
# scene.objects['Doc_chap-general'].worldPosition = scene.objects['Doc'].worldPosition
# scene.objects['Doc_chap-general'].setVisible(True,True)
# scene.objects['Doc']['page_chap'] = "general"
# scene.objects['Doc-general'].color = color_doc_activate
# scene.objects['Doc-general-text'].color = color_doc_activate
##
@ -269,7 +299,8 @@ def hl (cont):
scene.objects[name].color = color_doc_hl
scene.objects[name_text].color = color_doc_hl
else: # Carte
if name == scene.objects['Doc']['page_fct'] :
name_chap = scene.objects['Doc']['page_chap']
if name == scene.objects['Doc_chap-'+name_chap]['page_fct'] :
scene.objects[name].color = color_doc_activate
scene.objects[name_text].color = color_doc_activate
scene.objects[name_icon].color = color_doc_activate
@ -297,7 +328,8 @@ def hl (cont):
scene.objects[name].color = color_doc_fct
scene.objects[name_text].color = color_doc_fct
else: # Carte
if name == scene.objects['Doc']['page_fct'] :
name_chap = scene.objects['Doc']['page_chap']
if name == scene.objects['Doc_chap-'+name_chap]['page_fct'] :
scene.objects[name].color = color_doc_activate
scene.objects[name_text].color = color_doc_activate
scene.objects[name_icon].color = color_doc_activate
@ -329,8 +361,22 @@ def chapter(cont):
scene.objects['Doc']['page_chap'] = name_chap
scene.objects['Doc_chap-'+name_chap].worldPosition = scene.objects['Doc'].worldPosition
scene.objects['Doc_chap-'+name_chap].setVisible(True,True)
scene.objects['Doc_title'].setVisible(False,True)
scene.objects['Doc_text'].setVisible(False,True)
# Afficher le texte de la carte active
if name_chap != "general":
if scene.objects['Doc_chap-'+name_chap]['page_fct'] !="":
name_fct = scene.objects['Doc_chap-'+name_chap]['page_fct']
scene.objects['Doc_title']['Text'] = card_description[name_fct][0]
scene.objects['Doc_text']['Text'] = card_description[name_fct][1]
scene.objects['Doc_title'].setVisible(True, False)
scene.objects['Doc_text'].setVisible(True, False)
else:
scene.objects['Doc_title'].setVisible(False,True)
scene.objects['Doc_text'].setVisible(False,True)
else:
scene.objects['Doc_title'].setVisible(False,True)
scene.objects['Doc_text'].setVisible(False,True)
##
# Afficher les details de la fonction à partir d'une carte
@ -340,16 +386,17 @@ def card (cont):
if cont.sensors['Click'].status == JUST_ACTIVATED and cont.sensors['MO'].positive :
# sound_play (sndbuff_book_flip)
obj = cont.owner
name_chap = scene.objects['Doc']['page_chap']
name_fct= obj.name[:-7]
# Enlever l'ancienne carte
if scene.objects['Doc']['page_fct'] != "":
scene.objects[scene.objects['Doc']['page_fct']].color = color_doc_fct
scene.objects[scene.objects['Doc']['page_fct']+'-text'].color = color_doc_fct
scene.objects[scene.objects['Doc']['page_fct']+'-icon'].color = color_doc_fct
if scene.objects['Doc_chap-'+name_chap]['page_fct'] !="":
scene.objects[scene.objects['Doc_chap-'+name_chap]['page_fct']].color = color_doc_fct
scene.objects[scene.objects['Doc_chap-'+name_chap]['page_fct']+'-text'].color = color_doc_fct
scene.objects[scene.objects['Doc_chap-'+name_chap]['page_fct']+'-icon'].color = color_doc_fct
# Afficher le texte de la carte
scene.objects['Doc']['page_fct']= name_fct
scene.objects['Doc_chap-'+name_chap]['page_fct'] = name_fct
scene.objects[name_fct].color = color_doc_activate
scene.objects[name_fct+'-icon'].color = color_doc_activate
scene.objects[name_fct+'-text'].color = color_doc_activate