mirror of
https://forge.apps.education.fr/blender-edutech/ropy.git
synced 2024-01-27 08:23:20 +01:00
Transport du fichier de configuration dans le répertoire de travail
This commit is contained in:
parent
048555173e
commit
7e5fe114dd
BIN
ropy-32.blend
BIN
ropy-32.blend
Binary file not shown.
14
rp.py
14
rp.py
@ -267,6 +267,7 @@ def terrain_run ():
|
||||
scene.objects['Points']['nbligne'] = len(file_txt.split("\n"))-28 # 28 lignes utilisées de base
|
||||
file.close()
|
||||
scene.objects['Rover']['stop'] = False
|
||||
scene.objects['Points-Twins-text']['Text'] = "Connection fermée."
|
||||
if python_validation(scene.objects['Commands']['script']):
|
||||
runpy.run_path(scene.objects['Commands']['script'], run_name='start') # Execution du script utilisateur
|
||||
|
||||
@ -715,6 +716,13 @@ def mode(cont):
|
||||
# Mission et level : data/mission/level -> [1][0].text, [1][1].text)
|
||||
rp_config_tree[1][0].text=str(scene.objects['Points']['mission'])
|
||||
rp_config_tree[1][1].text=str(scene.objects['Points']['level'])
|
||||
# Upgrade : data/upgrade/i -> [2][i].text)
|
||||
upgrade_card=("battery", "beacon", "paint", "speed")
|
||||
for i in range(len(upgrade_card)):
|
||||
if scene.objects['Points']["upgrade_"+upgrade_card[i]] == True:
|
||||
rp_config_tree[2][i].text="True"
|
||||
else:
|
||||
rp_config_tree[2][i].text="False"
|
||||
config_save()
|
||||
|
||||
# Sortir
|
||||
@ -1275,8 +1283,10 @@ def store_close():
|
||||
upgrade_card=("battery", "beacon", "paint", "speed")
|
||||
for i in range(len(upgrade_card)):
|
||||
if scene.objects["Store-"+upgrade_card[i]+"-card"]['upgraded'] == True:
|
||||
scene.objects['Points']["upgrade_"+upgrade_card[i]]=True
|
||||
rp_config_tree[2][i].text="True"
|
||||
else:
|
||||
scene.objects['Points']["upgrade_"+upgrade_card[i]]=False
|
||||
rp_config_tree[2][i].text="False"
|
||||
config_save()
|
||||
|
||||
@ -1364,7 +1374,7 @@ def file_open():
|
||||
|
||||
# Récupérer le nom du fchier
|
||||
stout = scene.objects['Commands']['file_proc'].communicate()
|
||||
if stout[0][:-1] != 'None':
|
||||
if stout[0][:-1] != 'None' and len(stout[0][:-1])>0 :
|
||||
scene.objects['Commands']['script'] = stout[0][:-1]
|
||||
scene.objects['Script-text']['Text']=scene.objects['Commands']['script']
|
||||
config_load()
|
||||
@ -1385,6 +1395,8 @@ def config_save():
|
||||
|
||||
def config_load():
|
||||
fichier_xml=os.path.join(os.path.split((scene.objects['Commands']['script']))[0], "rp_config.xml")
|
||||
if os.path.exists(fichier_xml) ==False:
|
||||
return
|
||||
rp_config2 = ET.parse(fichier_xml)
|
||||
rp_config_tree2 = rp_config2.getroot()
|
||||
|
||||
|
@ -23,4 +23,4 @@
|
||||
<paint>False</paint>
|
||||
<speed>False</speed>
|
||||
</upgrade>
|
||||
</data>
|
||||
</data>
|
||||
|
@ -1141,14 +1141,14 @@ def rp_jumeau(port="auto", speed=115200):
|
||||
scene.objects['Commands']['twins_speed'] = speed
|
||||
scene.objects['Commands']['twins_readline'] = ""
|
||||
if board =="":
|
||||
scene.objects['Points-Twins-text']['Text'] = "Connection ouverte :\n"+device+" - "+str(speed)+" baud"
|
||||
scene.objects['Points-Twins-text']['Text'] = "Connection ouverte :\n"+device+" - "+str(speed)+" baud."
|
||||
else:
|
||||
scene.objects['Points-Twins-text']['Text'] = "Connection ouverte :\n"+board+"\n"+device+" - "+str(speed)+" baud"
|
||||
scene.objects['Points-Twins-text']['Text'] = "Connection ouverte :\n"+board+"\n"+device+" - "+str(speed)+" baud."
|
||||
rp_tempo (0.1)
|
||||
print (twins_serial)
|
||||
else:
|
||||
scene.objects['Commands']['twins'] = False
|
||||
scene.objects['Points-Twins-text']['Text'] = "Port "+device+" pas prêt"
|
||||
scene.objects['Points-Twins-text']['Text'] = "Port "+device+" pas prêt."
|
||||
|
||||
##
|
||||
# Recherche automatique du port
|
||||
@ -1208,7 +1208,7 @@ def rp_jumeau_close():
|
||||
global twins_serial
|
||||
twins_serial.close() # Fermer proprement le port série
|
||||
scene.objects['Commands']['twins'] = False
|
||||
scene.objects['Points-Twins-text']['Text'] = "Connection fermée"
|
||||
scene.objects['Points-Twins-text']['Text'] = "Connection fermée."
|
||||
|
||||
# Configuration de la vitesse et des temps
|
||||
# FIXME : Bug dans le transfert des données
|
||||
|
Loading…
Reference in New Issue
Block a user