mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[python] modkandinsky: fill_rect and draw_string calls might take some
time. As "micropython_port_vm_hook_loop" is not called while we are executing module code, we add an extra check for user interruption in module functions.
This commit is contained in:
committed by
LeaNumworks
parent
0db66f1784
commit
49aa58446b
@@ -70,6 +70,10 @@ mp_obj_t modkandinsky_draw_string(size_t n_args, const mp_obj_t * args) {
|
||||
KDColor backgroundColor = (n_args >= 5) ? ColorForTuple(args[4]) : KDColorWhite;
|
||||
MicroPython::ExecutionEnvironment::currentExecutionEnvironment()->displaySandbox();
|
||||
KDIonContext::sharedContext()->drawString(text, point, KDFont::LargeFont, textColor, backgroundColor);
|
||||
/* drawString function might take some time to execute so we add an extra check
|
||||
* for user interruption (to avoid freezing in an infinite loop calling
|
||||
* 'drawString' for instance). */
|
||||
micropython_port_interrupt_if_needed();
|
||||
return mp_const_none;
|
||||
}
|
||||
|
||||
@@ -83,5 +87,9 @@ mp_obj_t modkandinsky_fill_rect(size_t n_args, const mp_obj_t * args) {
|
||||
KDColor color = ColorForTuple(args[4]);
|
||||
MicroPython::ExecutionEnvironment::currentExecutionEnvironment()->displaySandbox();
|
||||
KDIonContext::sharedContext()->fillRect(rect, color);
|
||||
/* fillRect function might take some time to execute so we add an extra check
|
||||
* for user interruption (to avoid freezing in an infinite loop calling
|
||||
* 'fillRect' for instance). */
|
||||
micropython_port_interrupt_if_needed();
|
||||
return mp_const_none;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user