Commit Graph

570 Commits

Author SHA1 Message Date
Émilie Feral
2b53ea748d [apps/code] Typo 2020-06-04 14:50:09 +02:00
Léa Saviot
34a4a3311a [apps/code] Add test on variable_box_controller 2020-06-04 14:50:09 +02:00
Léa Saviot
5412410723 [apps/code] Remove duplicates in the variable box
Example script:
from turtle import *
hideturtle()

We had "hideturtle" in the local variables, and "hideturtle()" in the
imported. Now we should only have the latter.
2020-06-04 14:50:09 +02:00
Léa Saviot
40d98389d4 [apps/code] Cleaner code in VariableBoxController::loadCurrentVariablesInScript 2020-06-04 14:50:09 +02:00
Léa Saviot
6b558c3328 [apps/code] Replace if with assertion 2020-06-04 14:50:09 +02:00
Léa Saviot
b466a8711b [apps/code] Remove dead code 2020-06-04 14:50:09 +02:00
Léa Saviot
38443c0e83 [apps/code] Fix VariableBoxController::empty
No scenario, but it seems right to reset m_shortenResultCharCount
2020-06-04 14:50:09 +02:00
Léa Saviot
c102bf2e4e [apps/code] Fix again variable_box_controller
Scenario: add the script
from matplotlib.pyplot import *\nfrom math import *\n\ng=9.81\n\ndef x(t,v_0,alpha):\n  return v_0*cos(alpha)*t\ndef y(t,v_0,alpha,h_0):\n  return -0.5*g*t**2+v_0*sin(alpha)*t+h_0\n\ndef vx(v_0,alpha):\n  return v_0*cos(alpha)\ndef vy(t,v_0,alpha):\n  return -g*t+v_0*sin(alpha)\n\ndef t_max(v_0,alpha,h_0):\n  return (v_0*sin(alpha)+sqrt((v_0**2)*(sin(alpha)**2)+2*g*h_0))/g\n\ndef simulation(v_0=15,alpha=pi/4,h_0=2):\n  tMax=t_max(v_0,alpha,h_0)\n  accuracy=1/10**(floor(log10(tMax))-1)\n  T_MAX=floor(tMax*accuracy)+1\n  X=[x(t/accuracy,v_0,alpha) for t in range(T_MAX)]\n  Y=[y(t/accuracy,v_0,alpha,h_0) for t in range(T_MAX)]\n  VX=[vx(v_0,alpha) for t in range(T_MAX)]\n  VY=[vy(t/accuracy,v_0,alpha) for t in range(T_MAX)]\n  for i in range(T_MAX):\n    arrow(X[i],Y[i],VX[i]/accuracy,VY[i]/accuracy)\n  grid()\n  show()tan(if :\n    \n  celse:\n  )c
then autocomplete after the last c.
2020-06-04 14:50:09 +02:00
Léa Saviot
5d49f5dca2 [apps/code] Fix VariableBoxController::addNodesFromImportMaybe
Scenario: write a ascrip "from matplotlib.pyplot0 import *" than open
the variable box
2020-06-04 14:50:09 +02:00
Léa Saviot
9d8eb1dbb6 [apps/code] Fix misnamed i18n 2020-06-04 14:50:09 +02:00
Léa Saviot
2bea3f3d47 [apps/code] Fix again VariableBoxController::loadCurrentVariablesInScript 2020-06-04 14:50:09 +02:00
Léa Saviot
00291c8974 [apps/code] Fix var initialisation in variable_box_controller 2020-06-04 14:50:09 +02:00
Arthur
472cfc012c [matplotlib] Added colors to the toolbox in python
Change-Id: I3ff3d4fb3552bcb8c375c77651db3b7c44991646
2020-06-04 14:50:09 +02:00
Léa Saviot
691c6739af [apps/variable_box_controller] Fix loadCurrentVariablesInScript
Scenario: write the script:

def squares():
  for i in range(660):
    forward(L)lo)

Put the cursor right of "lo" and press backspace.
2020-06-04 14:50:08 +02:00
Émilie Feral
f2a1c635ef [apps/code] I18n: Missing translations 2020-06-04 14:50:08 +02:00
Léa Saviot
d41b93c711 [apps/code] Put back the squares script template 2020-06-04 14:50:07 +02:00
Léa Saviot
6dfccc6edf Revert "[apps/code] EXE event accepts autocompletion"
This reverts commit 5a96fd0e5de4a9bda30900e0c81a0b15f3fe081a.
2020-06-04 14:50:07 +02:00
Léa Saviot
0b88bb0767 [apps/code] Reset m_autocompletionResultIndex when addingAutocompletion 2020-06-04 14:50:07 +02:00
Léa Saviot
a53edf5202 [apps/code] Remove TODOs 2020-06-04 14:50:07 +02:00
Léa Saviot
f763bb50ac [apps/code] Do not display subtitles in var box from console 2020-06-04 14:50:07 +02:00
Léa Saviot
780c593c26 [apps/code] Autocompletion for "abs" proposes parentheses 2020-06-04 14:50:06 +02:00
Léa Saviot
b070eaad45 [apps/code] Remove double call to addAutocompletion 2020-06-04 14:50:06 +02:00
Léa Saviot
c915eb0b27 [apps/code] Do not autocomplete with arguments
Eg : arr|ow(x,y,dx,dy) should give arrow(|,,,)
2020-06-04 14:50:06 +02:00
Léa Saviot
e4aac3f9c6 [apps/code] Remove more TODOs 2020-06-04 14:50:06 +02:00
Léa Saviot
8142e1d344 [apps/code] Remove TODO comment 2020-06-04 14:50:06 +02:00
Léa Saviot
0dac6b5bac [apps/code] Replace int with size_t 2020-06-04 14:50:06 +02:00
Léa Saviot
7ef17960c8 [apps/code/variable_box_controller] More TODOs removal 2020-06-04 14:50:06 +02:00
Léa Saviot
714410287a [apps/code] Remove TODOs 2020-06-04 14:50:06 +02:00
Léa Saviot
68867e45e7 [apps] Factorize isDisplayingEmptyController
Because we can now, it might need to be de-factorized later, if more
classes inherit from alternate_empty_nested_menu_controller
2020-06-04 14:50:06 +02:00
Léa Saviot
c5f2f7cf83 [apps/code] Remove TODO comments 2020-06-04 14:50:06 +02:00
Léa Saviot
43d0ab5ea7 [apps] Rename displayEmptyController -> displayEmptyControllerIfNeeded 2020-06-04 14:50:06 +02:00
Léa Saviot
e28f4ed7e2 [apps/code/variable_box_controller] Use std::min 2020-06-04 14:50:06 +02:00
Léa Saviot
59db24c518 [apps/code/variable_box_controller] Comment out unused variables 2020-06-04 14:50:06 +02:00
Léa Saviot
f306b51fc5 [apps/escher] Move ModalViewEmptyController to escher 2020-06-04 14:50:06 +02:00
Léa Saviot
790cb374df [apps/code] i18n in alphabetical order 2020-06-04 14:50:06 +02:00
Léa Saviot
8ed902ceb2 [app/code] Comment about ContentFetchedFromConsoleStatus in Script 2020-06-04 14:50:06 +02:00
Léa Saviot
cf6b9d580b [apps/code] rename Script::scriptContent() -> Script::content() 2020-06-04 14:50:06 +02:00
Léa Saviot
6d7b294bca [apps/escher] Rename ToolboxMessageTree::children -> childAtIndex 2020-06-04 14:50:06 +02:00
Léa Saviot
bba5b237d2 [apps/code] Display different varbox titles from editor and console 2020-06-04 14:50:06 +02:00
Léa Saviot
5986716031 [apps/code] Fix first varbox row that never appeared again
After scrolling down
2020-06-04 14:50:06 +02:00
Léa Saviot
2fbf5d2d9f [apps/code] No variables starting with underscore in imported variables
In the variable box
2020-06-04 14:50:06 +02:00
Léa Saviot
ccca872a0f [appx/code] Empty variable box before loading it in the console 2020-06-04 14:50:06 +02:00
Léa Saviot
0c82334a96 [apps/code] Fix preventing module importations in varbox from console 2020-06-04 14:50:06 +02:00
Léa Saviot
5ffcb77c69 [apps/code] Fix missing return 2020-06-04 14:50:06 +02:00
Léa Saviot
ac654f0097 [apps/code] Load varbox before returning it in console 2020-06-04 14:50:06 +02:00
Léa Saviot
d1c8bbdaf7 [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.
2020-06-04 14:50:06 +02:00
Léa Saviot
9e973adbab [apps/code] VarBox from console 2020-06-04 14:50:06 +02:00
Léa Saviot
c81420c4b2 [apps/code] EXE event accepts autocompletion 2020-06-04 14:50:06 +02:00
Léa Saviot
d8cab18eb3 [apps/code] Do not display varbox source name if it does not fit 2020-06-04 14:50:06 +02:00
Léa Saviot
4fb0a7e467 [apps/code] properly display the importation source
- It sould be nameOfScript.py, not just nameOfScript, when the source is
a script
- Fix the source for script name variables. For instance, "from
script1 import *" should display the node "script1" with the source "script1.py"
- If a script has the same name as a module, the module will be imported
and not the script, so do not load its variables (even if the module is
not in the toolbox).
2020-06-04 14:50:06 +02:00