Commit Graph

11363 Commits

Author SHA1 Message Date
Arthur Camouseigt
68ff71f72a [matplotlib/modpyplot.cpp] Modified the way to add mp_float
To prevent crashes caused by failed casts from char to float, removed optimization.

Change-Id: Ia91aafa007538b6c05f7aace5e5962989d313c98
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
Émilie Feral
8b64851903 [poincare] Multiplication::shallowBeautify: handle edge case: the
expression contains a unit but we can't extract it (2^_min for instance)
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
59bf8bbcf4 [matplotlib] Added cyan color to the color palette
Change-Id: I29476d8148ad98285505adc460b90628573518fa
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
Arthur
fe7c4b1a8a [python/turtle] Added write method
Allows user to print strings with the turtle

Change-Id: I06a3832f6fa36d29506be10c48a1b2fb34cb69fb
2020-06-04 14:50:09 +02:00
Arthur
7cd0b7e0e0 [matplotlib] Removed useless initializers in PlotStore constructor
Change-Id: Idea0ce07cbc800139539f9d3fb27811920645184
2020-06-04 14:50:09 +02:00
Arthur
13d0bcf676 [matplotlib] Modified isEmpty method for showing axis
Added a condition for being considered empty.
Allows axis("on") or axis((0,1,2,3)) to display something with show()
This behavior is the same as the python module

Change-Id: If5f3b07c280ee9ead2bc23d23cbbb4f01da7eae5
2020-06-04 14:50:09 +02:00
Émilie Feral
d8666a52d3 [python] matplotlib: fix tests about arrow function 2020-06-04 14:50:09 +02:00
Émilie Feral
0c9fb57b33 [python] matplotlib: check float type of the head_width arg of arrow function 2020-06-04 14:50:09 +02:00
Émilie Feral
9b7c47a7f0 [python] matplotlib: arrow can have up to 6 args 2020-06-04 14:50:09 +02:00
Émilie Feral
12db7a5093 [apps/shared] Change default shape of arrow in CurveView (to match
matplotlib shape)
2020-06-04 14:50:09 +02:00
Émilie Feral
083f959b7b [python] matplotlib: Enable to change the arrow shape via the head_width
arg
2020-06-04 14:50:09 +02:00
Émilie Feral
c826c53659 [apps/shared] CurveView: change drawArrow API to take arrow shape
arguments in float instead of coordinates
2020-06-04 14:50:09 +02:00
Émilie Feral
0f8f82b94b [python] matplotlib: Add a parameter to to arrow to set the arrow width 2020-06-04 14:50:09 +02:00
Émilie Feral
e92b56b78e [apps/shared] CurveView: change drawArrow arguments (new definition of
arrow shape)
2020-06-04 14:50:09 +02:00
Émilie Feral
e2c06cbb44 [python] matplotlib: add color argument to plot, scatter, hist, bar and
arrow
2020-06-04 14:50:08 +02:00
Émilie Feral
a22990943b [python] matplotlib: missing static keyword 2020-06-04 14:50:08 +02:00
Émilie Feral
273d10dc26 [python] Change names: ColorParse::ParseColor --> Color::Parse 2020-06-04 14:50:08 +02:00
Émilie Feral
5aaa6723d0 [apps/calculation] Fix duplicate removal in unit additional results
This fixes the following bug: input _ns, go to additional results -->
crash
2020-06-04 14:50:08 +02:00
Émilie Feral
5725ba1c14 [escher] LayoutField: reset selection when clearing layout 2020-06-04 14:50:08 +02:00
Émilie Feral
80015ca6aa [apps/shared] RoundCursorView: fix potential black trail when redrawing
cursor (issue #1458 on GitHub)
2020-06-04 14:50:08 +02:00
Émilie Feral
9a3e2c960f [escher] LayoutField: update the grey squares when using insertion
cursor
2020-06-04 14:50:08 +02:00
Émilie Feral
79e7626dc3 [escher] LayoutField: the insertion cursor can't point to an EmptyLayout
as it might be destroyed

This fixes the following crash: input 1, OK, input ans/[], go up to the history --> crash
2020-06-04 14:50:08 +02:00
Émilie Feral
a53379781f [apps/shared] Fix comment 2020-06-04 14:50:08 +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
03367cfdf6 [poincare] Makefile: POINCARE_TREE_LOG is by set by default when DEBUG=1 2020-06-04 14:50:08 +02:00
Émilie Feral
b596488a01 [poincare] Multiplication::shallowBeautify: removeUnit can only be
called on reduced expression

This fixes the following bug: input i+10*sqrt(i)
2020-06-04 14:50:08 +02:00
Émilie Feral
a4c591dea6 [apps/calculation] additional_outputs: fix complex range for infinite
values
2020-06-04 14:50:08 +02:00
Émilie Feral
6a0d65b049 [apps/calculation] additional_outputs: the complex illustration chose
its range to be orthornomal
2020-06-04 14:50:08 +02:00
Émilie Feral
d3bd086125 [apps/graph] Fix order of actions to edit the function name, we should
update the bufferSize before setting the text

This fixes the following bug: add a function, rename it "f123456",
change its type to a polar function, rename it --> crash
2020-06-04 14:50:08 +02:00
Émilie Feral
465fa5c63f [escher] TextField: fix insertTextAtLocation (confusion between size and
length)

This fixes the following bug: in a textfield, input '000', clear, input
'00', backspace --> crash
2020-06-04 14:50:08 +02:00
Émilie Feral
ab69c0069c [python] Fix alignement issues in MicroPython::collectRootsAtAddress 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
7d5304686d [apps/scrollable_multiple_expressions_view] Add TODO comment 2020-06-04 14:50:08 +02:00
Léa Saviot
b096d6f5e4 [escher/table_view] COding style 2020-06-04 14:50:08 +02:00
Léa Saviot
44af4b1fde [escher/table_view] Fix numberOfDisplayableRows/Columns
Did not take into account the margin so was too big sometimes
2020-06-04 14:50:08 +02:00
Léa Saviot
515aa543d3 [escher/table_view] Remove dead code 2020-06-04 14:50:08 +02:00
Léa Saviot
12a45ef8e6 [escher/poincare] Coding style 2020-06-04 14:50:08 +02:00
Léa Saviot
9d5e58f32b [escher/scroll_view] Do not compute offset if view invisible 2020-06-04 14:50:08 +02:00