[code/emscripten] On emscripten, fixed waiting after a Python drawing.

The user can now push OK or Back to remove a Python drawing.

Change-Id: I293064a9458f8c0c6d0da5351500600fd9e82706
This commit is contained in:
Léa Saviot
2017-11-21 09:44:23 +01:00
parent 8dfeaa1f63
commit 9d82804ff3
4 changed files with 46 additions and 1 deletions

View File

@@ -41,6 +41,10 @@ void MicroPython::ExecutionEnvironment::didModifyFramebuffer() {
m_framebufferHasBeenModified = true;
}
void MicroPython::ExecutionEnvironment::didCleanFramebuffer() {
m_framebufferHasBeenModified = false;
}
void MicroPython::ExecutionEnvironment::runCode(const char * str) {
assert(sCurrentExecutionEnvironment == nullptr);
sCurrentExecutionEnvironment = this;
@@ -93,6 +97,8 @@ void MicroPython::ExecutionEnvironment::runCode(const char * str) {
/* End of mp_obj_print_exception. */
}
#ifdef __EMSCRIPTEN__
#else
while (m_framebufferHasBeenModified) {
int timeout = 3000;
Ion::Events::Event event = Ion::Events::getEvent(&timeout);
@@ -101,6 +107,7 @@ void MicroPython::ExecutionEnvironment::runCode(const char * str) {
redraw();
}
}
#endif
assert(sCurrentExecutionEnvironment == this);
sCurrentExecutionEnvironment = nullptr;

View File

@@ -13,6 +13,8 @@ public:
ExecutionEnvironment();
static ExecutionEnvironment * currentExecutionEnvironment();
void didModifyFramebuffer();
bool isFramebufferModified() const { return m_framebufferHasBeenModified; }
void didCleanFramebuffer();
void runCode(const char * );
virtual void printText(const char * text, size_t length) {
}