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") windows=("Doc", "Doc_chap-general", "Doc_chap-missions", "Doc_chap-rover", "Doc_chap-python", "About")
for window in windows: for window in windows:
scene.objects[window].setVisible(False,True) scene.objects[window].setVisible(False,True)
rp_doc.init()
## ##
# Highlight des commandes # Highlight des commandes
@ -802,7 +803,7 @@ def tablet_open ():
# scene.objects['Book-cmd-underlay'].setVisible(True,False) # scene.objects['Book-cmd-underlay'].setVisible(True,False)
# Initialisation de la tablette # Initialisation de la tablette
rp_doc.init() rp_doc.open()
## ##
# Enteindre la tablette # 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_ly']=scene.objects["Doc_chap-"+page].worldPosition.y
scene.objects["Doc_chap-"+page]['init_lz']=scene.objects["Doc_chap-"+page].worldPosition.z 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 # Placer la tablette
# scene.objects['Doc'].worldPosition = [0, -21, 15.75] # scene.objects['Doc'].worldPosition = [0, -21, 15.75]
scene.objects['Doc'].worldPosition = [0, -21, 15.8] scene.objects['Doc'].worldPosition = [0, -21, 15.8]
@ -219,16 +228,37 @@ def init():
scene.objects['Doc_title'].setVisible(False,True) scene.objects['Doc_title'].setVisible(False,True)
scene.objects['Doc_text'].setVisible(False,True) scene.objects['Doc_text'].setVisible(False,True)
# sound_play (sndbuff_book_open) # sound_play (sndbuff_book_open)
# 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
# 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-general'].color = color_doc_activate
# scene.objects['Doc-general-text'].color = color_doc_activate
## ##
# Fermeture du livre # Fermeture du livre
## ##
@ -269,7 +299,8 @@ def hl (cont):
scene.objects[name].color = color_doc_hl scene.objects[name].color = color_doc_hl
scene.objects[name_text].color = color_doc_hl scene.objects[name_text].color = color_doc_hl
else: # Carte 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].color = color_doc_activate
scene.objects[name_text].color = color_doc_activate scene.objects[name_text].color = color_doc_activate
scene.objects[name_icon].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].color = color_doc_fct
scene.objects[name_text].color = color_doc_fct scene.objects[name_text].color = color_doc_fct
else: # Carte 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].color = color_doc_activate
scene.objects[name_text].color = color_doc_activate scene.objects[name_text].color = color_doc_activate
scene.objects[name_icon].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']['page_chap'] = name_chap
scene.objects['Doc_chap-'+name_chap].worldPosition = scene.objects['Doc'].worldPosition scene.objects['Doc_chap-'+name_chap].worldPosition = scene.objects['Doc'].worldPosition
scene.objects['Doc_chap-'+name_chap].setVisible(True,True) 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 # 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 : if cont.sensors['Click'].status == JUST_ACTIVATED and cont.sensors['MO'].positive :
# sound_play (sndbuff_book_flip) # sound_play (sndbuff_book_flip)
obj = cont.owner obj = cont.owner
name_chap = scene.objects['Doc']['page_chap']
name_fct= obj.name[:-7] name_fct= obj.name[:-7]
# Enlever l'ancienne carte # Enlever l'ancienne carte
if scene.objects['Doc']['page_fct'] != "": if scene.objects['Doc_chap-'+name_chap]['page_fct'] !="":
scene.objects[scene.objects['Doc']['page_fct']].color = color_doc_fct scene.objects[scene.objects['Doc_chap-'+name_chap]['page_fct']].color = color_doc_fct
scene.objects[scene.objects['Doc']['page_fct']+'-text'].color = color_doc_fct scene.objects[scene.objects['Doc_chap-'+name_chap]['page_fct']+'-text'].color = color_doc_fct
scene.objects[scene.objects['Doc']['page_fct']+'-icon'].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 # 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].color = color_doc_activate
scene.objects[name_fct+'-icon'].color = color_doc_activate scene.objects[name_fct+'-icon'].color = color_doc_activate
scene.objects[name_fct+'-text'].color = color_doc_activate scene.objects[name_fct+'-text'].color = color_doc_activate