mirror of
https://forge.apps.education.fr/blender-edutech/jumeaux-numeriques.git
synced 2024-01-27 06:56:18 +01:00
Ajout du texte du highlight
This commit is contained in:
parent
7e53b6d868
commit
fbf4ca47bb
@ -6,7 +6,7 @@ from porcou_lib import * # Bibliothèque portail coulissant
|
||||
###############################################################################
|
||||
|
||||
###############################################################################
|
||||
# Instructions élémentaires pour le portail coulissant
|
||||
# Instructions élémentaires pour le portail coulissant
|
||||
#
|
||||
# Actions (ordre = True ou False) :
|
||||
# - Gyrophare : gyr (True|False)
|
||||
@ -14,17 +14,17 @@ from porcou_lib import * # Bibliothèque portail coulissant
|
||||
# - Fermer le portail (moteur sens horaire) : mot_f (True|False)
|
||||
# - Emetteur pour le capteur barrage IR : ir_emet(True|False)
|
||||
#
|
||||
# Capteurs (valeur retournée = True ou False) :
|
||||
# Capteurs (valeur retournée = True ou False) :
|
||||
# - Capteur fin de course portail ouvert : fdc_o()
|
||||
# - Capteur fin de course portail fermé : fdc_f()
|
||||
# - Capteur barrage IR (absence d'obstacle) : ir_recep()
|
||||
#
|
||||
# Pupitre (valeur retournée = True ou False) :
|
||||
# Pupitre (valeur retournée = True ou False) :
|
||||
# - Bouton poussoir coté rue : bp_ext()
|
||||
# - Bouton poussoir coté cour : bp_int()
|
||||
#
|
||||
# Gestion du temps :
|
||||
# - Temporisation en seconde : tempo(duree)
|
||||
# Gestion du temps :
|
||||
# - Temporisation en seconde : tempo(duree)
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
@ -37,39 +37,46 @@ 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)
|
||||
gyr(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
|
||||
# while True:
|
||||
# pass
|
||||
|
||||
|
||||
fin() # A garder
|
||||
|
||||
|
||||
|
Binary file not shown.
@ -1 +1 @@
|
||||
/home/phroy/Bureau/seriousgames/blender-edutech/git/digital_twin/twin.py
|
||||
/home/phroy/Documents/blender-edutech/git/digital_twin/twin.py
|
@ -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
|
@ -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
|
@ -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
46
twin.py
@ -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)",
|
||||
# "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)
|
||||
text_hl ={"Run":"Exécuter (F5)",
|
||||
"Stop":"Stop et initialisation (F6)",
|
||||
# "Pause":"Pause (F5)",
|
||||
"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)
|
||||
|
@ -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())
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user