diff --git a/apps/code/catalog.de.i18n b/apps/code/catalog.de.i18n index b002d9025..1721b0fea 100644 --- a/apps/code/catalog.de.i18n +++ b/apps/code/catalog.de.i18n @@ -63,6 +63,7 @@ PythonFloor = "Floor" PythonFmod = "a modulo b" PythonFrExp = "Mantissa and exponent of x: (m,e)" PythonGamma = "Gamma function" +PythonGetPalette = "Themenpalette erhalten" PythonGetPixel = "Return pixel (x,y) color" PythonGetrandbits = "Integer with k random bits" PythonGrid = "Toggle the visibility of the grid" @@ -101,36 +102,36 @@ PythonMathFunction = "math module function prefix" PythonMatplotlibPyplotFunction = "matplotlib.pyplot module prefix" PythonMax = "Maximum" PythonMin = "Minimum" -PythonModf = "Fractional and integer parts of x" -PythonMonotonic = "Value of a monotonic clock" -PythonOct = "Convert integer to octal" -PythonPhase = "Phase of z" -PythonPlot = "Plot y versus x as lines" -PythonPolar = "z in polar coordinates" -PythonPop = "Remove and return the last item" -PythonPower = "x raised to the power y" -PythonPrint = "Print object" -PythonRadians = "Convert x from degrees to radians" -PythonRandint = "Random integer in [a,b]" -PythonRandom = "Floating point number in [0,1[" -PythonRandomFunction = "random module function prefix" -PythonRandrange = "Random number in range(start,stop)" -PythonRangeStartStop = "List from start to stop-1" -PythonRangeStop = "List from 0 to stop-1" -PythonRect = "Convert to cartesian coordinates" -PythonRemove = "Remove the first occurrence of x" -PythonReverse = "Reverse the elements of the list" -PythonRound = "Round to n digits" -PythonScatter = "Draw a scatter plot of y versus x" -PythonSeed = "Initialize random number generator" -PythonSetPixel = "Color pixel (x,y)" -PythonShow = "Display the figure" -PythonSin = "Sine" -PythonSinh = "Hyperbolic sine" -PythonSleep = "Suspend the execution for t seconds" -PythonSort = "Sort the list" -PythonSqrt = "Wurzel" -PythonSum = "Sum the items of a list" +PythonModf = "Bruch- und Ganzzahl-Anteile von x" +PythonMonotonic = "Wert einer monotonen Uhr" +PythonOct = "Ganzzahl in Oktal umwandeln" +PythonPhase = "Phase von z" +PythonPlot = "Plotten von y gegen x als Linien" +PythonPolar = "z in Polarkoordinaten" +PythonPop = "Letztes Element abnehmen" +PythonPower = "x erhöht mit der Potenz y" +PythonPrint = "Objekt drucken" +PythonRadians = "x von Grad in Bogenmaß umrechnen" +PythonRandint = "Zufällige Ganzzahl in [a,b]" +PythonRandom = "Fließkommazahl in [0,1]" +PythonRandomFunction = "Random-Modul Funktionspräfix" +PythonRandrange = "Zufallszahl im Bereich(start,stop)" +PythonRangeStartStop = "Liste von Start bis Stop-1" +PythonRangeStop = "Liste von 0 bis Stop-1" +PythonRect = "In kartesische Koordinaten" +PythonRemove = "Entferne das erste Vorkommen von x" +PythonReverse = "Kehrt die Elemente der Liste um" +PythonRound = "Runden auf n Stellen" +PythonScatter = "Streudiagramm von y gg. x zeichnen" +PythonSeed = "Zufallszahlengenerator initiieren" +PythonSetPixel = "Pixel (x,y) einfärben" +PythonShow = "Figur anzeigen" +PythonSin = "Sinus" +PythonSinh = "Hyperbolischer Sinus" +PythonSleep = "Ausführung aussetzen für t Sekunden" +PythonSort = "Die Liste sortieren" +PythonSqrt = "Quadratwurzel" +PythonSum = "Summe der Elemente einer Liste" PythonTan = "Tangens" PythonTanh = "Hyperbolic tangent" PythonText = "Display a text at (x,y) coordinates" diff --git a/apps/code/catalog.en.i18n b/apps/code/catalog.en.i18n index 458ec1eeb..1a826ecf0 100644 --- a/apps/code/catalog.en.i18n +++ b/apps/code/catalog.en.i18n @@ -62,6 +62,7 @@ PythonFloor = "Floor" PythonFmod = "a modulo b" PythonFrExp = "Mantissa and exponent of x: (m,e)" PythonGamma = "Gamma function" +PythonGetPalette = "Get theme palette" PythonGetPixel = "Return pixel (x,y) color" PythonGetrandbits = "Integer with k random bits" PythonGrid = "Toggle the visibility of the grid" diff --git a/apps/code/catalog.es.i18n b/apps/code/catalog.es.i18n index 4ac5de287..ff6de6a86 100644 --- a/apps/code/catalog.es.i18n +++ b/apps/code/catalog.es.i18n @@ -62,6 +62,7 @@ PythonFloor = "Floor" PythonFmod = "a modulo b" PythonFrExp = "Mantissa and exponent of x: (m,e)" PythonGamma = "Gamma function" +PythonGetPalette = "Get theme palette" PythonGetPixel = "Return pixel (x,y) color" PythonGetrandbits = "Integer with k random bits" PythonGrid = "Toggle the visibility of the grid" diff --git a/apps/code/catalog.fr.i18n b/apps/code/catalog.fr.i18n index e3c3c22b8..05725e9c7 100644 --- a/apps/code/catalog.fr.i18n +++ b/apps/code/catalog.fr.i18n @@ -62,6 +62,7 @@ PythonFloor = "Partie entière" PythonFmod = "a modulo b" PythonFrExp = "Mantisse et exposant de x : (m,e)" PythonGamma = "Fonction gamma" +PythonGetPalette = "Obtient la palette du thème" PythonGetPixel = "Renvoie la couleur du pixel (x,y)" PythonGetrandbits = "Nombre aléatoire sur k bits" PythonGrid = "Affiche ou masque la grille" diff --git a/apps/code/catalog.hu.i18n b/apps/code/catalog.hu.i18n index 2749d3789..a9349ac9c 100644 --- a/apps/code/catalog.hu.i18n +++ b/apps/code/catalog.hu.i18n @@ -62,6 +62,7 @@ PythonFloor = "Egész része" PythonFmod = "a modulo b" PythonFrExp = "X mantissája és kiállítója" PythonGamma = "Gamma funkció" +PythonGetPalette = "Téma paletta beszerzése" PythonGetPixel = "Visszatéríti (x,y) színét" PythonGetrandbits = "Váletlenszám visszatérítése k biten" PythonGrid = "Rács megjelenítése/elrejtése" diff --git a/apps/code/catalog.it.i18n b/apps/code/catalog.it.i18n index e4fdd0f26..9cd02959a 100644 --- a/apps/code/catalog.it.i18n +++ b/apps/code/catalog.it.i18n @@ -62,6 +62,7 @@ PythonFloor = "Parte intera" PythonFmod = "a modulo b" PythonFrExp = "Mantissa ed esponente di x : (m,e)" PythonGamma = "Funzione gamma" +PythonGetPalette = "Ottieni la tavolozza del tema" PythonGetPixel = "Restituisce colore del pixel(x,y)" PythonGetrandbits = "Numero aleatorio con k bit" PythonGrid = "Attiva la visibilità della griglia" diff --git a/apps/code/catalog.nl.i18n b/apps/code/catalog.nl.i18n index 8a8d4265b..31b2f1d60 100644 --- a/apps/code/catalog.nl.i18n +++ b/apps/code/catalog.nl.i18n @@ -62,6 +62,7 @@ PythonFloor = "Vloer" PythonFmod = "a modulo b" PythonFrExp = "Mantisse en exponent van x: (m,e)" PythonGamma = "Gammafunctie" +PythonGetPalette = "Thema palet krijgen" PythonGetPixel = "Geef pixel (x,y) kleur (rgb)" PythonGetrandbits = "Integer met k willekeurige bits" PythonGrid = "Verander zichtbaarheid raster" diff --git a/apps/code/catalog.pt.i18n b/apps/code/catalog.pt.i18n index f432b28ce..a06882d6a 100644 --- a/apps/code/catalog.pt.i18n +++ b/apps/code/catalog.pt.i18n @@ -62,6 +62,7 @@ PythonFloor = "Parte inteira" PythonFmod = "a módulo b" PythonFrExp = "Coeficiente e expoente de x: (m, e)" PythonGamma = "Função gama" +PythonGetPalette = "Obter paleta temática" PythonGetPixel = "Devolve a cor do pixel (x,y)" PythonGetrandbits = "Número inteiro aleatório com k bits" PythonGrid = "Alterar visibilidade da grelha" diff --git a/apps/code/catalog.universal.i18n b/apps/code/catalog.universal.i18n index e6fa758a6..1b5b3684b 100644 --- a/apps/code/catalog.universal.i18n +++ b/apps/code/catalog.universal.i18n @@ -69,6 +69,7 @@ PythonCommandFloor = "floor(x)" PythonCommandFmod = "fmod(a,b)" PythonCommandFrExp = "frexp(x)" PythonCommandGamma = "gamma(x)" +PythonCommandGetPalette = "get_palette()" PythonCommandGetPixel = "get_pixel(x,y)" PythonCommandGetrandbits = "getrandbits(k)" PythonCommandGrid = "grid()" diff --git a/apps/code/python_toolbox.cpp b/apps/code/python_toolbox.cpp index 0036acdb3..c11a09632 100644 --- a/apps/code/python_toolbox.cpp +++ b/apps/code/python_toolbox.cpp @@ -197,7 +197,8 @@ const ToolboxMessageTree KandinskyModuleChildren[] = { ToolboxMessageTree::Leaf(I18n::Message::PythonCommandDrawCircle, I18n::Message::PythonDrawCircle), ToolboxMessageTree::Leaf(I18n::Message::PythonCommandFillRect, I18n::Message::PythonFillRect), ToolboxMessageTree::Leaf(I18n::Message::PythonCommandFillCircle, I18n::Message::PythonFillCircle), - ToolboxMessageTree::Leaf(I18n::Message::PythonCommandFillPolygon, I18n::Message::PythonFillPolygon) + ToolboxMessageTree::Leaf(I18n::Message::PythonCommandFillPolygon, I18n::Message::PythonFillPolygon), + ToolboxMessageTree::Leaf(I18n::Message::PythonCommandGetPalette, I18n::Message::PythonGetPalette) }; const ToolboxMessageTree IonModuleChildren[] = { diff --git a/python/port/genhdr/qstrdefs.in.h b/python/port/genhdr/qstrdefs.in.h index 20dec6a7a..65478063f 100644 --- a/python/port/genhdr/qstrdefs.in.h +++ b/python/port/genhdr/qstrdefs.in.h @@ -429,6 +429,13 @@ Q(large_font) Q(small_font) Q(wait_vblank) Q(get_keys) +Q(get_palette) + +Q(PrimaryText) +Q(SecondaryText) +Q(AccentText) +Q(Toolbar) +Q(HomeBackground) // Keys QSTRs Q(left) diff --git a/python/port/mod/kandinsky/modkandinsky.cpp b/python/port/mod/kandinsky/modkandinsky.cpp index ff55f3f15..29218376c 100644 --- a/python/port/mod/kandinsky/modkandinsky.cpp +++ b/python/port/mod/kandinsky/modkandinsky.cpp @@ -2,9 +2,11 @@ extern "C" { #include "modkandinsky.h" #include } +#include #include #include #include "port.h" +#include static mp_obj_t TupleForKDColor(KDColor c) { @@ -245,3 +247,14 @@ mp_obj_t modkandinsky_get_keys() { return result; } + +mp_obj_t modkandinsky_get_palette() { + mp_obj_t modkandinsky_palette_table = mp_obj_new_dict(0); + mp_obj_dict_store(modkandinsky_palette_table, MP_ROM_QSTR(MP_QSTR_PrimaryText), TupleForKDColor(Palette::PrimaryText)); + mp_obj_dict_store(modkandinsky_palette_table, MP_ROM_QSTR(MP_QSTR_SecondaryText), TupleForKDColor(Palette::SecondaryText)); + mp_obj_dict_store(modkandinsky_palette_table, MP_ROM_QSTR(MP_QSTR_AccentText), TupleForKDColor(Palette::AccentText)); + mp_obj_dict_store(modkandinsky_palette_table, MP_ROM_QSTR(MP_QSTR_Toolbar), TupleForKDColor(Palette::Toolbar)); + mp_obj_dict_store(modkandinsky_palette_table, MP_ROM_QSTR(MP_QSTR_HomeBackground), TupleForKDColor(Palette::HomeBackground)); + + return modkandinsky_palette_table; +} diff --git a/python/port/mod/kandinsky/modkandinsky.h b/python/port/mod/kandinsky/modkandinsky.h index 4d4024aef..3ce71155a 100644 --- a/python/port/mod/kandinsky/modkandinsky.h +++ b/python/port/mod/kandinsky/modkandinsky.h @@ -11,3 +11,4 @@ mp_obj_t modkandinsky_fill_circle(size_t n_args, const mp_obj_t *args); mp_obj_t modkandinsky_fill_polygon(size_t n_args, const mp_obj_t *args); mp_obj_t modkandinsky_wait_vblank(); mp_obj_t modkandinsky_get_keys(); +mp_obj_t modkandinsky_get_palette(); diff --git a/python/port/mod/kandinsky/modkandinsky_table.c b/python/port/mod/kandinsky/modkandinsky_table.c index 1cc76c73c..ce962e4c1 100644 --- a/python/port/mod/kandinsky/modkandinsky_table.c +++ b/python/port/mod/kandinsky/modkandinsky_table.c @@ -11,6 +11,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(modkandinsky_fill_circle_obj, 4, 4, m STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(modkandinsky_fill_polygon_obj, 2, 2, modkandinsky_fill_polygon); STATIC MP_DEFINE_CONST_FUN_OBJ_0(modkandinsky_wait_vblank_obj, modkandinsky_wait_vblank); STATIC MP_DEFINE_CONST_FUN_OBJ_0(modkandinsky_get_keys_obj, modkandinsky_get_keys); +STATIC MP_DEFINE_CONST_FUN_OBJ_0(modkandinsky_get_palette_obj, modkandinsky_get_palette); STATIC const mp_rom_map_elem_t modkandinsky_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_kandinsky) }, @@ -27,6 +28,7 @@ STATIC const mp_rom_map_elem_t modkandinsky_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_small_font), mp_const_false }, { MP_ROM_QSTR(MP_QSTR_wait_vblank), (mp_obj_t)&modkandinsky_wait_vblank_obj }, { MP_ROM_QSTR(MP_QSTR_get_keys), (mp_obj_t)&modkandinsky_get_keys_obj }, + { MP_ROM_QSTR(MP_QSTR_get_palette), (mp_obj_t)&modkandinsky_get_palette_obj }, }; STATIC MP_DEFINE_CONST_DICT(modkandinsky_module_globals, modkandinsky_module_globals_table);