[code] Fixed the wait for user input after drawing using Python.

A SandboxController is now pushed on the StackViewController and sets the
KDIonContext::sharedContext before drawing, sets a white background and handles
user input after the Python computation to dismiss the drawing screen.

Change-Id: I51b0474365a85e845227379a16d090541fa8ded7
This commit is contained in:
Léa Saviot
2017-11-27 14:09:49 +01:00
parent 9a9ccc7a8c
commit 1ce6f36651
11 changed files with 98 additions and 110 deletions

View File

@@ -0,0 +1,31 @@
#include "sandbox_controller.h"
#include <apps/apps_container.h>
namespace Code {
SandboxController::SandboxController(Responder * parentResponder) :
ViewController(parentResponder),
m_solidColorView(KDColorWhite)
{
}
StackViewController * SandboxController::stackViewController() {
return static_cast<StackViewController *>(parentResponder());
}
void SandboxController::viewWillAppear() {
static_cast<AppsContainer *>(const_cast<Container *>(app()->container()))->redrawWindow();
}
bool SandboxController::handleEvent(Ion::Events::Event event) {
if (event == Ion::Events::Home || event == Ion::Events::OnOff) {
stackViewController()->pop();
return false;
}
if (event == Ion::Events::OK || event == Ion::Events::Back) {
stackViewController()->pop();
}
return true;
}
}