Ajout du texte du highlight

This commit is contained in:
Philippe Roy 2022-12-18 00:55:45 +01:00
parent 7e53b6d868
commit fbf4ca47bb
8 changed files with 62 additions and 57 deletions

View File

@ -37,33 +37,40 @@ from porcou_lib import * # Bibliothèque portail coulissant
############################################################################### ###############################################################################
def commandes(): def commandes():
# jumeau()
# Mise en place : Fermeture for i in range (5):
while (fdc_f() ==False) :
gyr(True) gyr(True)
mot_f(True) tempo(0.25)
mot_f(False) gyr(False)
gyr(False) tempo(0.25)
# Fonctionnement normal
while True :
# Ouverture # # Mise en place : Fermeture
if bp_int() or bp_ext() : # while (fdc_f() ==False) :
while fdc_o() ==False: # gyr(True)
gyr(True) # mot_f(True)
mot_o(True) # mot_f(False)
gyr(False) # gyr(False)
mot_o(False)
tempo(2) # Temporisation # # Fonctionnement normal
# while True :
# Fermeture # # Ouverture
while fdc_f() ==False: # if bp_int() or bp_ext() :
gyr(True) # while fdc_o() ==False:
mot_f(True) # gyr(True)
gyr(False) # mot_o(True)
mot_f(False) # gyr(False)
# mot_o(False)
# tempo(2) # Temporisation
# # Fermeture
# while fdc_f() ==False:
# gyr(True)
# mot_f(True)
# gyr(False)
# mot_f(False)
# # Ecrire votre code ici ... # # Ecrire votre code ici ...
# gyr(True) # Activer le gyrophare # gyr(True) # Activer le gyrophare

View File

@ -1 +1 @@
/home/phroy/Bureau/seriousgames/blender-edutech/git/digital_twin/twin.py /home/phroy/Documents/blender-edutech/git/digital_twin/twin.py

View File

@ -1 +1 @@
/home/phroy/Bureau/seriousgames/blender-edutech/git/digital_twin/twin_about.py /home/phroy/Documents/blender-edutech/git/digital_twin/twin_about.py

View File

@ -1 +1 @@
/home/phroy/Bureau/seriousgames/blender-edutech/git/digital_twin/twin_config.xml /home/phroy/Documents/blender-edutech/git/digital_twin/twin_config.xml

View File

@ -1 +1 @@
/home/phroy/Bureau/seriousgames/blender-edutech/git/digital_twin/twin_doc.py /home/phroy/Documents/blender-edutech/git/digital_twin/twin_doc.py

46
twin.py
View File

@ -26,8 +26,7 @@ import twin_about # About
# UPBGE scene # UPBGE scene
scene = bge.logic.getCurrentScene() scene = bge.logic.getCurrentScene()
system=importlib.import_module(scene.objects['System']['name']) # Système system=importlib.import_module(scene.objects['System']['script'][:-4]) # Système
# scene.objects['Commands']['debug_fps']=False
# Memory # Memory
sys.setrecursionlimit(10**5) # Limite sur la récursivité (valeur par défaut : 1000) -> segfault de Blender sys.setrecursionlimit(10**5) # Limite sur la récursivité (valeur par défaut : 1000) -> segfault de Blender
@ -117,14 +116,21 @@ def keyboard(cont):
## ##
def cmd_init(): def cmd_init():
# Fichier de config (screen size : data/config/screen/width-> [0][0].text, height-> [0][1].text) # Fichier de config (screen size : data/config/screen/width-> [0][0].text, height-> [0][1].text)
bge.render.setWindowSize(int(twin_config_tree[0][0].text),int(twin_config_tree[0][1].text)) bge.render.setWindowSize(int(twin_config_tree[0][0].text),int(twin_config_tree[0][1].text))
# UI : Commands
scene.objects['Run-Hl'].setVisible(False,False) scene.objects['Run-Hl'].setVisible(False,False)
scene.objects['Pause-Hl'].setVisible(False,False) scene.objects['Pause-Hl'].setVisible(False,False)
scene.objects['ResetView-Hl'].setVisible(False,False) scene.objects['ResetView-Hl'].setVisible(False,False)
scene.objects['Doc-cmd-Hl'].setVisible(False,False) scene.objects['Doc-cmd-Hl'].setVisible(False,False)
scene.objects['About-cmd-Hl'].setVisible(False,False) scene.objects['About-cmd-Hl'].setVisible(False,False)
# UI : Text, ...
scene.objects['Cmd-text']['Text']=""
scene.objects['Cmd-text'].setVisible(True,False)
# Windows # Windows
windows=("Doc", "Doc_chap-general", "Doc_chap-system", "Doc_chap-python", "About") windows=("Doc", "Doc_chap-general", "Doc_chap-system", "Doc_chap-python", "About")
for window in windows: for window in windows:
@ -166,27 +172,19 @@ def cmd_hl(cont):
scene.objects['Doc-cmd-Hl'].setVisible(True,False) scene.objects['Doc-cmd-Hl'].setVisible(True,False)
# Text # Text
# text_hl ={"Run":"Exécuter (F5)", text_hl ={"Run":"Exécuter (F5)",
# "Stop":"Stop et initialisation (F6)", "Stop":"Stop et initialisation (F6)",
# "Pause":"Pause (F5)", # "Pause":"Pause (F5)",
# "Aim-cmd":"Afficher/cacher l'objectif", "Doc-cmd-colbox":"Documentation",
# "Doc-cmd-colbox":"Documentation", "ResetView": "Reset de la vue (Touche Début)",
# "Store-cmd":"Boutique", "About-cmd": "A propos"}
# "Task-cmd":"Liste des tâches", scene.objects['Cmd-text']['Text']= text_hl[obj.name]
# "Task_close-cmd":"Fermer la liste des tâches", scene.objects['Cmd-text'].setVisible(True,False)
# "ResetView": "Reset de la vue (Touche Début)",
# "About-cmd": "A propos",
# "Speed_down": "Moins vite (-)",
# "Speed_up": "Plus vite (+)",
# "Sound-cmd": "Muet",
# "NoSound-cmd": "Rétablir le son"}
# scene.objects['Cmd-text']['Text']= text_hl[obj.name]
# scene.objects['Cmd-text'].setVisible(True,False)
# Désactivation # Désactivation
if cont.sensors['MO'].status == JUST_RELEASED and (scene.objects['System']['manip_mode']==0 or scene.objects['System']['manip_mode']==9): if cont.sensors['MO'].status == JUST_RELEASED and (scene.objects['System']['manip_mode']==0 or scene.objects['System']['manip_mode']==9):
# scene.objects['Cmd-text']['Text']= "" scene.objects['Cmd-text']['Text']= ""
# scene.objects['Cmd-text'].setVisible(False,False) scene.objects['Cmd-text'].setVisible(False,False)
if obj.name!="Run" and obj.name!="Pause" and obj.name!="Stop" and obj.name!="Doc-cmd-colbox": if obj.name!="Run" and obj.name!="Pause" and obj.name!="Stop" and obj.name!="Doc-cmd-colbox":
scene.objects[obj.name+'-Hl'].setVisible(False,True) scene.objects[obj.name+'-Hl'].setVisible(False,True)
obj.setVisible(True,True) obj.setVisible(True,True)
@ -465,8 +463,8 @@ def cycle_run ():
scene.objects['System']['thread_cmd']=True scene.objects['System']['thread_cmd']=True
system.system_reset() system.system_reset()
time.sleep(0.125) time.sleep(0.125)
if python_validation(scene.objects['System']['name']+'_cmd'): if python_validation(scene.objects['System']['script']+'.py'):
runpy.run_module(scene.objects['System']['name']+'_cmd', run_name='start') # Execution du script utilisateur runpy.run_module(scene.objects['System']['script'], run_name='start') # Execution du script utilisateur
# Arrêt de la pause # Arrêt de la pause
else: else:
@ -488,8 +486,8 @@ def cycle_stop ():
def cycle_end (cont): def cycle_end (cont):
if cont.sensors['End cycle'].positive: if cont.sensors['End cycle'].positive:
scene.objects['System']['run']=False scene.objects['System']['run']=False
if python_validation(scene.objects['System']['name']+'_cmd'): if python_validation(scene.objects['System']['script']+'.py'):
runpy.run_module(scene.objects['System']['name']+'_cmd', run_name='stop') # Fin du script utilisateur runpy.run_module(scene.objects['System']['script'], run_name='stop') # Fin du script utilisateur
# Commandes # Commandes
scene.objects['Pause'].setVisible(False,False) scene.objects['Pause'].setVisible(False,False)

View File

@ -37,7 +37,7 @@ ACTIVATE = bge.logic.KX_INPUT_ACTIVE
card_description ={} card_description ={}
# Documentation du sytème # Documentation du sytème
system=importlib.import_module(scene.objects['System']['name']+'_doc') # Système system=importlib.import_module(scene.objects['System']['script'][:-4]+'_doc') # Système
system_card = system.get_system_card() system_card = system.get_system_card()
card_description.update(system.get_card_description()) card_description.update(system.get_card_description())