[apps/code] The console marks imported script for the var box

After lauching the console, if we fetch a script we mark it as fetched.
When the variable box displays variables from imported scripts, it scans
all the variables from the scripts marked as fetched.
This commit is contained in:
Léa Saviot
2020-04-29 16:54:28 +02:00
committed by Émilie Feral
parent 9e973adbab
commit d1c8bbdaf7
13 changed files with 66 additions and 42 deletions

View File

@@ -2,15 +2,15 @@
namespace Code {
constexpr ScriptTemplate emptyScriptTemplate(".py", "\x01" R"(from math import *
constexpr ScriptTemplate emptyScriptTemplate(".py", "\x01\x00" R"(from math import *
)");
constexpr ScriptTemplate squaresScriptTemplate("squares.py", "\x01" R"(
constexpr ScriptTemplate squaresScriptTemplate("squares.py", "\x01\x00" R"(
#from math import sin as stew, cos as cabbage
from math import *
)");
/*constexpr ScriptTemplate squaresScriptTemplate("squares.py", "\x01" R"(
/*constexpr ScriptTemplate squaresScriptTemplate("squares.py", "\x01\x00" R"(
import math
import math as m
import math, cmath
@@ -31,7 +31,7 @@ from math import sin as stew
from math import sin, cos
from math import sin as stew, cos as cabbage
*/
constexpr ScriptTemplate mandelbrotScriptTemplate("mandelbrot.py", "\x01" R"(# This script draws a Mandelbrot fractal set
constexpr ScriptTemplate mandelbrotScriptTemplate("mandelbrot.py", "\x01\x00" R"(# This script draws a Mandelbrot fractal set
# N_iteration: degree of precision
import kandinsky
def mandelbrot(N_iteration):
@@ -51,7 +51,7 @@ def mandelbrot(N_iteration):
# Draw a pixel colored in 'col' at position (x,y)
kandinsky.set_pixel(x,y,col))");
constexpr ScriptTemplate polynomialScriptTemplate("polynomial.py", "\x01" R"(from math import *
constexpr ScriptTemplate polynomialScriptTemplate("polynomial.py", "\x01\x00" R"(from math import *
# roots(a,b,c) computes the solutions of the equation a*x**2+b*x+c=0
def roots(a,b,c):
delta = b*b-4*a*c
@@ -64,7 +64,7 @@ def roots(a,b,c):
else:
return None)");
constexpr ScriptTemplate parabolaScriptTemplate("parabola.py", "\x01" R"(from matplotlib.pyplot import *
constexpr ScriptTemplate parabolaScriptTemplate("parabola.py", "\x01\x00" R"(from matplotlib.pyplot import *
from math import *
g=9.81