[code] Load Variable box content before compiling any other python code

to avoid memory exhaustion when displaying variable box
This commit is contained in:
Émilie Feral
2018-10-25 14:44:29 +02:00
parent c7e001a01d
commit a4f7d83805
7 changed files with 56 additions and 37 deletions

View File

@@ -1,11 +1,12 @@
#include "editor_controller.h"
#include "menu_controller.h"
#include "script_parameter_controller.h"
#include "variable_box_controller.h"
#include <apps/code/app.h>
#include "app.h"
#include <escher/metric.h>
#include <ion.h>
using namespace Shared;
namespace Code {
EditorController::EditorController(MenuController * menuController, App * pythonDelegate) :
@@ -14,7 +15,7 @@ EditorController::EditorController(MenuController * menuController, App * python
m_script(Ion::Storage::Record()),
m_menuController(menuController)
{
m_editorView.setTextAreaDelegates(pythonDelegate, this);
m_editorView.setTextAreaDelegates(this, this);
}
void EditorController::setScript(Script script) {
@@ -127,6 +128,16 @@ bool EditorController::textAreaDidReceiveEvent(TextArea * textArea, Ion::Events:
return false;
}
VariableBoxController * EditorController::variableBoxForInputEventHandler(InputEventHandler * textInput) {
VariableBoxController * varBox = static_cast<App *>(app())->variableBoxController();
varBox->loadFunctionsAndVariables();
return varBox;
}
InputEventHandlerDelegateApp * EditorController::inputEventHandlerDelegateApp() {
return static_cast<App *>(app());
}
StackViewController * EditorController::stackController() {
return static_cast<StackViewController *>(parentResponder());
}