[apps/code] Fix console reloading that did not occur often enough

Scenario:
Write a script that prints "abc"
Open the console -> prints "abc"
Modify the script to print "ab"
Go back to the console -> "ab" not printed !
This commit is contained in:
Léa Saviot
2018-12-11 17:05:45 +01:00
committed by EmilieNumworks
parent 460c21801f
commit ce1cdaacc3
3 changed files with 3 additions and 8 deletions

View File

@@ -45,7 +45,7 @@ ConsoleController::ConsoleController(Responder * parentResponder, App * pythonDe
}
bool ConsoleController::loadPythonEnvironment() {
if(pythonEnvironmentIsLoaded()) {
if (m_pythonDelegate->isPythonUser(this)) {
return true;
}
emptyOutputAccumulationBuffer();
@@ -60,16 +60,12 @@ bool ConsoleController::loadPythonEnvironment() {
}
void ConsoleController::unloadPythonEnvironment() {
if (pythonEnvironmentIsLoaded()) {
if (!m_pythonDelegate->isPythonUser(nullptr)) {
m_consoleStore.startNewSession();
m_pythonDelegate->deinitPython();
}
}
bool ConsoleController::pythonEnvironmentIsLoaded() {
return m_pythonDelegate->isPythonUser(this);
}
void ConsoleController::autoImport() {
for (int i = 0; i < m_scriptStore->numberOfScripts(); i++) {
autoImportScript(m_scriptStore->scriptAtIndex(i));