move native fill to a helper to work around being unable to call a subclass show method from the native superclass

This commit is contained in:
Roy Hooper 2020-01-01 17:30:17 -05:00
parent 8129a8503a
commit 12193913a8
15 changed files with 89 additions and 46 deletions

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-12-12 15:33-0800\n"
"POT-Creation-Date: 2020-01-01 17:29-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -600,6 +600,10 @@ msgstr ""
msgid "Expected a Characteristic"
msgstr ""
#: shared-bindings/_pixelbuf/__init__.c
msgid "Expected a PixelBuf instance"
msgstr ""
#: shared-bindings/_bleio/Characteristic.c
msgid "Expected a Service"
msgstr ""
@ -1078,7 +1082,6 @@ msgid "Sample rate must be positive"
msgstr ""
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#, c-format
msgid "Sample rate too high. It must be less than %d"
msgstr "Nilai sampel terlalu tinggi. Nilai harus kurang dari %d"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-12-13 13:44-0500\n"
"POT-Creation-Date: 2020-01-01 17:29-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -589,6 +589,10 @@ msgstr ""
msgid "Expected a Characteristic"
msgstr ""
#: shared-bindings/_pixelbuf/__init__.c
msgid "Expected a PixelBuf instance"
msgstr ""
#: shared-bindings/_bleio/Characteristic.c
msgid "Expected a Service"
msgstr ""
@ -1062,7 +1066,6 @@ msgid "Sample rate must be positive"
msgstr ""
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#, c-format
msgid "Sample rate too high. It must be less than %d"
msgstr ""

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-12-12 15:33-0800\n"
"POT-Creation-Date: 2020-01-01 17:29-0500\n"
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
"Last-Translator: Pascal Deneaux\n"
"Language-Team: Sebastian Plamauer, Pascal Deneaux\n"
@ -593,6 +593,10 @@ msgstr "Erwartet ein(e) %q"
msgid "Expected a Characteristic"
msgstr "Characteristic wird erwartet"
#: shared-bindings/_pixelbuf/__init__.c
msgid "Expected a PixelBuf instance"
msgstr ""
#: shared-bindings/_bleio/Characteristic.c
msgid "Expected a Service"
msgstr "Ein Service wird erwartet"
@ -1079,7 +1083,6 @@ msgid "Sample rate must be positive"
msgstr "Abtastrate muss positiv sein"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#, c-format
msgid "Sample rate too high. It must be less than %d"
msgstr "Abtastrate zu hoch. Wert muss unter %d liegen"

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-12-12 15:33-0800\n"
"POT-Creation-Date: 2020-01-01 17:29-0500\n"
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -589,6 +589,10 @@ msgstr ""
msgid "Expected a Characteristic"
msgstr ""
#: shared-bindings/_pixelbuf/__init__.c
msgid "Expected a PixelBuf instance"
msgstr ""
#: shared-bindings/_bleio/Characteristic.c
msgid "Expected a Service"
msgstr ""
@ -1062,7 +1066,6 @@ msgid "Sample rate must be positive"
msgstr ""
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#, c-format
msgid "Sample rate too high. It must be less than %d"
msgstr ""

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-12-12 15:33-0800\n"
"POT-Creation-Date: 2020-01-01 17:29-0500\n"
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
"Last-Translator: \n"
"Language-Team: @sommersoft, @MrCertainly\n"
@ -593,6 +593,10 @@ msgstr ""
msgid "Expected a Characteristic"
msgstr ""
#: shared-bindings/_pixelbuf/__init__.c
msgid "Expected a PixelBuf instance"
msgstr ""
#: shared-bindings/_bleio/Characteristic.c
msgid "Expected a Service"
msgstr ""
@ -1066,7 +1070,6 @@ msgid "Sample rate must be positive"
msgstr ""
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#, c-format
msgid "Sample rate too high. It must be less than %d"
msgstr ""

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-12-13 13:44-0500\n"
"POT-Creation-Date: 2020-01-01 17:29-0500\n"
"PO-Revision-Date: 2018-08-24 22:56-0500\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -595,6 +595,10 @@ msgstr "Se espera un %q"
msgid "Expected a Characteristic"
msgstr "Se esperaba una Característica."
#: shared-bindings/_pixelbuf/__init__.c
msgid "Expected a PixelBuf instance"
msgstr ""
#: shared-bindings/_bleio/Characteristic.c
msgid "Expected a Service"
msgstr ""
@ -1080,7 +1084,6 @@ msgid "Sample rate must be positive"
msgstr "Sample rate debe ser positivo"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#, c-format
msgid "Sample rate too high. It must be less than %d"
msgstr "Frecuencia de muestreo demasiado alta. Debe ser menor a %d"

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-12-12 15:33-0800\n"
"POT-Creation-Date: 2020-01-01 17:29-0500\n"
"PO-Revision-Date: 2018-12-20 22:15-0800\n"
"Last-Translator: Timothy <me@timothygarcia.ca>\n"
"Language-Team: fil\n"
@ -602,6 +602,10 @@ msgstr "Umasa ng %q"
msgid "Expected a Characteristic"
msgstr "Hindi mabasa and Characteristic."
#: shared-bindings/_pixelbuf/__init__.c
msgid "Expected a PixelBuf instance"
msgstr ""
#: shared-bindings/_bleio/Characteristic.c
msgid "Expected a Service"
msgstr ""
@ -1086,7 +1090,6 @@ msgid "Sample rate must be positive"
msgstr "Sample rate ay dapat positibo"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#, c-format
msgid "Sample rate too high. It must be less than %d"
msgstr "Sample rate ay masyadong mataas. Ito ay dapat hindi hiigit sa %d"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 0.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-12-13 13:44-0500\n"
"POT-Creation-Date: 2020-01-01 17:29-0500\n"
"PO-Revision-Date: 2019-04-14 20:05+0100\n"
"Last-Translator: Pierrick Couturier <arofarn@arofarn.info>\n"
"Language-Team: fr\n"
@ -605,6 +605,10 @@ msgstr "Attendu un %q"
msgid "Expected a Characteristic"
msgstr "Une 'Characteristic' est attendue"
#: shared-bindings/_pixelbuf/__init__.c
msgid "Expected a PixelBuf instance"
msgstr ""
#: shared-bindings/_bleio/Characteristic.c
msgid "Expected a Service"
msgstr ""
@ -1100,7 +1104,6 @@ msgid "Sample rate must be positive"
msgstr "Le taux d'échantillonage doit être positif"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#, c-format
msgid "Sample rate too high. It must be less than %d"
msgstr "Taux d'échantillonage trop élevé. Doit être inf. à %d"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-12-12 15:33-0800\n"
"POT-Creation-Date: 2020-01-01 17:29-0500\n"
"PO-Revision-Date: 2018-10-02 16:27+0200\n"
"Last-Translator: Enrico Paganin <enrico.paganin@mail.com>\n"
"Language-Team: \n"
@ -602,6 +602,10 @@ msgstr "Atteso un %q"
msgid "Expected a Characteristic"
msgstr "Non è possibile aggiungere Characteristic."
#: shared-bindings/_pixelbuf/__init__.c
msgid "Expected a PixelBuf instance"
msgstr ""
#: shared-bindings/_bleio/Characteristic.c
msgid "Expected a Service"
msgstr ""
@ -1096,7 +1100,6 @@ msgid "Sample rate must be positive"
msgstr "STA deve essere attiva"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#, c-format
msgid "Sample rate too high. It must be less than %d"
msgstr ""

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-12-12 15:33-0800\n"
"POT-Creation-Date: 2020-01-01 17:29-0500\n"
"PO-Revision-Date: 2019-05-06 14:22-0700\n"
"Last-Translator: \n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -593,6 +593,10 @@ msgstr "%q 이 예상되었습니다."
msgid "Expected a Characteristic"
msgstr "특성(Characteristic)이 예상되었습니다."
#: shared-bindings/_pixelbuf/__init__.c
msgid "Expected a PixelBuf instance"
msgstr ""
#: shared-bindings/_bleio/Characteristic.c
msgid "Expected a Service"
msgstr ""
@ -1066,7 +1070,6 @@ msgid "Sample rate must be positive"
msgstr ""
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#, c-format
msgid "Sample rate too high. It must be less than %d"
msgstr ""

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-12-13 13:44-0500\n"
"POT-Creation-Date: 2020-01-01 17:29-0500\n"
"PO-Revision-Date: 2019-03-19 18:37-0700\n"
"Last-Translator: Radomir Dopieralski <circuitpython@sheep.art.pl>\n"
"Language-Team: pl\n"
@ -592,6 +592,10 @@ msgstr "Oczekiwano %q"
msgid "Expected a Characteristic"
msgstr "Oczekiwano charakterystyki"
#: shared-bindings/_pixelbuf/__init__.c
msgid "Expected a PixelBuf instance"
msgstr ""
#: shared-bindings/_bleio/Characteristic.c
msgid "Expected a Service"
msgstr ""
@ -1067,7 +1071,6 @@ msgid "Sample rate must be positive"
msgstr "Częstotliwość próbkowania musi być dodatnia"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#, c-format
msgid "Sample rate too high. It must be less than %d"
msgstr "Zbyt wysoka częstotliwość próbkowania. Musi być mniejsza niż %d"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-12-12 15:33-0800\n"
"POT-Creation-Date: 2020-01-01 17:29-0500\n"
"PO-Revision-Date: 2018-10-02 21:14-0000\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -597,6 +597,10 @@ msgstr "Esperado um"
msgid "Expected a Characteristic"
msgstr "Não é possível adicionar Característica."
#: shared-bindings/_pixelbuf/__init__.c
msgid "Expected a PixelBuf instance"
msgstr ""
#: shared-bindings/_bleio/Characteristic.c
msgid "Expected a Service"
msgstr ""
@ -1079,7 +1083,6 @@ msgid "Sample rate must be positive"
msgstr ""
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#, c-format
msgid "Sample rate too high. It must be less than %d"
msgstr "Taxa de amostragem muito alta. Deve ser menor que %d"

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: circuitpython-cn\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-12-13 13:44-0500\n"
"POT-Creation-Date: 2020-01-01 17:29-0500\n"
"PO-Revision-Date: 2019-04-13 10:10-0700\n"
"Last-Translator: hexthat\n"
"Language-Team: Chinese Hanyu Pinyin\n"
@ -593,6 +593,10 @@ msgstr "Yùqí %q"
msgid "Expected a Characteristic"
msgstr "Yùqí de tèdiǎn"
#: shared-bindings/_pixelbuf/__init__.c
msgid "Expected a PixelBuf instance"
msgstr ""
#: shared-bindings/_bleio/Characteristic.c
msgid "Expected a Service"
msgstr "Yùqí fúwù"
@ -1072,7 +1076,6 @@ msgid "Sample rate must be positive"
msgstr "Cǎiyàng lǜ bìxū wèi zhèng shù"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#, c-format
msgid "Sample rate too high. It must be less than %d"
msgstr "Cǎiyàng lǜ tài gāo. Tā bìxū xiǎoyú %d"

View File

@ -341,25 +341,6 @@ STATIC mp_obj_t pixelbuf_pixelbuf_show(mp_obj_t self_in) {
STATIC MP_DEFINE_CONST_FUN_OBJ_1(pixelbuf_pixelbuf_show_obj, pixelbuf_pixelbuf_show);
//| .. method:: fill(color)
//|
//| Fills the entire buffer with the given color.
//|
STATIC mp_obj_t pixelbuf_pixelbuf_fill(mp_obj_t self_in, mp_obj_t value) {
pixelbuf_pixelbuf_obj_t *self = native_pixelbuf(self_in);
for (size_t offset = 0; offset < self->bytes; offset+= self->pixel_step) {
pixelbuf_set_pixel(self->buf + offset, self->two_buffers ? (self->rawbuf + offset) : NULL,
self->brightness, value, &self->byteorder, self->byteorder.is_dotstar);
}
if (self->auto_write)
call_show(self_in);
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(pixelbuf_pixelbuf_fill_obj, pixelbuf_pixelbuf_fill);
//| .. method:: __getitem__(index)
//|
//| Returns the pixel value at the given index.
@ -464,7 +445,6 @@ STATIC const mp_rom_map_elem_t pixelbuf_pixelbuf_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_buf), MP_ROM_PTR(&pixelbuf_pixelbuf_buf_obj)},
{ MP_ROM_QSTR(MP_QSTR_byteorder), MP_ROM_PTR(&pixelbuf_pixelbuf_byteorder_str)},
{ MP_ROM_QSTR(MP_QSTR_show), MP_ROM_PTR(&pixelbuf_pixelbuf_show_obj)},
{ MP_ROM_QSTR(MP_QSTR_fill), MP_ROM_PTR(&pixelbuf_pixelbuf_fill_obj)},
};
STATIC MP_DEFINE_CONST_DICT(pixelbuf_pixelbuf_locals_dict, pixelbuf_pixelbuf_locals_dict_table);

View File

@ -82,10 +82,34 @@ const int32_t colorwheel(float pos) {
}
}
//| .. function:: fill(pixelbuf, color)
//|
//| Fills the given pixelbuf with the given color.
//|
STATIC mp_obj_t pixelbuf_fill(mp_obj_t pixelbuf_in, mp_obj_t value) {
mp_obj_t obj = mp_instance_cast_to_native_base(pixelbuf_in, &pixelbuf_pixelbuf_type);
if (obj == MP_OBJ_NULL)
mp_raise_TypeError(translate("Expected a PixelBuf instance"));
pixelbuf_pixelbuf_obj_t *pixelbuf = MP_OBJ_TO_PTR(obj);
for (size_t offset = 0; offset < pixelbuf->bytes; offset+= pixelbuf->pixel_step) {
pixelbuf_set_pixel(pixelbuf->buf + offset, pixelbuf->two_buffers ? (pixelbuf->rawbuf + offset) : NULL,
pixelbuf->brightness, value, &pixelbuf->byteorder, pixelbuf->byteorder.is_dotstar);
}
if (pixelbuf->auto_write)
call_show(pixelbuf_in);
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(pixelbuf_fill_obj, pixelbuf_fill);
STATIC const mp_rom_map_elem_t pixelbuf_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR__pixelbuf) },
{ MP_ROM_QSTR(MP_QSTR_PixelBuf), MP_ROM_PTR(&pixelbuf_pixelbuf_type) },
{ MP_ROM_QSTR(MP_QSTR_wheel), MP_ROM_PTR(&pixelbuf_wheel_obj) },
{ MP_ROM_QSTR(MP_QSTR_fill), MP_ROM_PTR(&pixelbuf_fill_obj) },
};
STATIC MP_DEFINE_CONST_DICT(pixelbuf_module_globals, pixelbuf_module_globals_table);