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():
# Mise en place : Fermeture
while (fdc_f() ==False) :
# jumeau()
for i in range (5):
gyr(True)
mot_f(True)
mot_f(False)
tempo(0.25)
gyr(False)
tempo(0.25)
# Fonctionnement normal
while True :
# Ouverture
if bp_int() or bp_ext() :
while fdc_o() ==False:
gyr(True)
mot_o(True)
gyr(False)
mot_o(False)
# # Mise en place : Fermeture
# while (fdc_f() ==False) :
# gyr(True)
# mot_f(True)
# mot_f(False)
# gyr(False)
tempo(2) # Temporisation
# # Fonctionnement normal
# while True :
# Fermeture
while fdc_f() ==False:
gyr(True)
mot_f(True)
gyr(False)
mot_f(False)
# # Ouverture
# if bp_int() or bp_ext() :
# while fdc_o() ==False:
# gyr(True)
# mot_o(True)
# 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 ...
# 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

44
twin.py
View File

@ -26,8 +26,7 @@ import twin_about # About
# UPBGE scene
scene = bge.logic.getCurrentScene()
system=importlib.import_module(scene.objects['System']['name']) # Système
# scene.objects['Commands']['debug_fps']=False
system=importlib.import_module(scene.objects['System']['script'][:-4]) # Système
# Memory
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():
# 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))
# UI : Commands
scene.objects['Run-Hl'].setVisible(False,False)
scene.objects['Pause-Hl'].setVisible(False,False)
scene.objects['ResetView-Hl'].setVisible(False,False)
scene.objects['Doc-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=("Doc", "Doc_chap-general", "Doc_chap-system", "Doc_chap-python", "About")
for window in windows:
@ -166,27 +172,19 @@ def cmd_hl(cont):
scene.objects['Doc-cmd-Hl'].setVisible(True,False)
# Text
# text_hl ={"Run":"Exécuter (F5)",
# "Stop":"Stop et initialisation (F6)",
text_hl ={"Run":"Exécuter (F5)",
"Stop":"Stop et initialisation (F6)",
# "Pause":"Pause (F5)",
# "Aim-cmd":"Afficher/cacher l'objectif",
# "Doc-cmd-colbox":"Documentation",
# "Store-cmd":"Boutique",
# "Task-cmd":"Liste des tâches",
# "Task_close-cmd":"Fermer la liste des tâches",
# "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)
"Doc-cmd-colbox":"Documentation",
"ResetView": "Reset de la vue (Touche Début)",
"About-cmd": "A propos"}
scene.objects['Cmd-text']['Text']= text_hl[obj.name]
scene.objects['Cmd-text'].setVisible(True,False)
# Désactivation
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'].setVisible(False,False)
scene.objects['Cmd-text']['Text']= ""
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":
scene.objects[obj.name+'-Hl'].setVisible(False,True)
obj.setVisible(True,True)
@ -465,8 +463,8 @@ def cycle_run ():
scene.objects['System']['thread_cmd']=True
system.system_reset()
time.sleep(0.125)
if python_validation(scene.objects['System']['name']+'_cmd'):
runpy.run_module(scene.objects['System']['name']+'_cmd', run_name='start') # Execution du script utilisateur
if python_validation(scene.objects['System']['script']+'.py'):
runpy.run_module(scene.objects['System']['script'], run_name='start') # Execution du script utilisateur
# Arrêt de la pause
else:
@ -488,8 +486,8 @@ def cycle_stop ():
def cycle_end (cont):
if cont.sensors['End cycle'].positive:
scene.objects['System']['run']=False
if python_validation(scene.objects['System']['name']+'_cmd'):
runpy.run_module(scene.objects['System']['name']+'_cmd', run_name='stop') # Fin du script utilisateur
if python_validation(scene.objects['System']['script']+'.py'):
runpy.run_module(scene.objects['System']['script'], run_name='stop') # Fin du script utilisateur
# Commandes
scene.objects['Pause'].setVisible(False,False)

View File

@ -37,7 +37,7 @@ ACTIVATE = bge.logic.KX_INPUT_ACTIVE
card_description ={}
# 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()
card_description.update(system.get_card_description())