!126 pika_lvgl_v0.3.1_1664293694542

Merge pull request !126 from pikabot/pika_lvgl_v0.3.1_1664293694542
This commit is contained in:
李昂 2022-09-27 15:49:46 +00:00 committed by Gitee
commit 1ecc573bf9
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 208 additions and 58 deletions

View File

@ -6,12 +6,15 @@
#ifdef PIKASCRIPT
#include "BaseObj.h"
#include "PikaStdData_Dict.h"
#include "pika_lvgl.h"
#include "pika_lvgl_arc.h"
#include "pika_lvgl_bar.h"
#include "pika_lvgl_btn.h"
#include "pika_lvgl_checkbox.h"
#include "pika_lvgl_dropdown.h"
#include "pika_lvgl_img.h"
#include "pika_lvgl_img_dsc_t.h"
#include "pika_lvgl_label.h"
#include "pika_lvgl_lv_obj.h"
#include "pika_lvgl_roller.h"
@ -44,31 +47,31 @@ void pika_lvgl_arc_set_angles(PikaObj* self, int start, int end) {
lv_arc_set_angles(lv_obj, start, end);
}
int pika_lvgl_arc_get_angle_end(PikaObj *self){
int pika_lvgl_arc_get_angle_end(PikaObj* self) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return lv_arc_get_angle_end(lv_obj);
}
int pika_lvgl_arc_get_angle_start(PikaObj *self){
int pika_lvgl_arc_get_angle_start(PikaObj* self) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return lv_arc_get_angle_start(lv_obj);
}
int pika_lvgl_arc_get_bg_angle_end(PikaObj *self){
int pika_lvgl_arc_get_bg_angle_end(PikaObj* self) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return lv_arc_get_bg_angle_end(lv_obj);
}
int pika_lvgl_arc_get_bg_angle_start(PikaObj *self){
int pika_lvgl_arc_get_bg_angle_start(PikaObj* self) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return lv_arc_get_bg_angle_start(lv_obj);
}
int pika_lvgl_arc_get_max_value(PikaObj *self){
int pika_lvgl_arc_get_max_value(PikaObj* self) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return lv_arc_get_max_value(lv_obj);
}
int pika_lvgl_arc_get_min_value(PikaObj *self){
int pika_lvgl_arc_get_min_value(PikaObj* self) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return lv_arc_get_min_value(lv_obj);
}
int pika_lvgl_arc_get_mode(PikaObj *self){
int pika_lvgl_arc_get_mode(PikaObj* self) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return lv_arc_get_mode(lv_obj);
}
@ -76,40 +79,40 @@ int pika_lvgl_arc_get_mode(PikaObj *self){
// lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
// return lv_arc_get_rotation(lv_obj);
// }
int pika_lvgl_arc_get_value(PikaObj *self){
int pika_lvgl_arc_get_value(PikaObj* self) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return lv_arc_get_value(lv_obj);
}
void pika_lvgl_arc_set_mode(PikaObj *self, int mode){
void pika_lvgl_arc_set_mode(PikaObj* self, int mode) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_arc_set_mode(lv_obj, mode);
}
void pika_lvgl_arc_set_range(PikaObj *self, int min, int max){
void pika_lvgl_arc_set_range(PikaObj* self, int min, int max) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_arc_set_range(lv_obj, min, max);
}
void pika_lvgl_arc_set_rotation(PikaObj *self, int rotation){
void pika_lvgl_arc_set_rotation(PikaObj* self, int rotation) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_arc_set_rotation(lv_obj, rotation);
}
void pika_lvgl_arc_set_start_angle(PikaObj *self, int start){
void pika_lvgl_arc_set_start_angle(PikaObj* self, int start) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_arc_set_start_angle(lv_obj, start);
}
void pika_lvgl_arc_set_value(PikaObj *self, int value){
void pika_lvgl_arc_set_value(PikaObj* self, int value) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_arc_set_value(lv_obj, value);
}
void pika_lvgl_arc_set_bg_end_angle(PikaObj *self, int angle){
void pika_lvgl_arc_set_bg_end_angle(PikaObj* self, int angle) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_arc_set_bg_end_angle(lv_obj, angle);
}
void pika_lvgl_arc_set_bg_start_angle(PikaObj *self, int start){
void pika_lvgl_arc_set_bg_start_angle(PikaObj* self, int start) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_arc_set_bg_start_angle(lv_obj, start);
}
void pika_lvgl_arc_set_change_rate(PikaObj *self, int rate){
void pika_lvgl_arc_set_change_rate(PikaObj* self, int rate) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_arc_set_change_rate(lv_obj, rate);
}
@ -125,35 +128,35 @@ void pika_lvgl_bar_set_value(PikaObj* self, int value, int anim) {
lv_bar_set_value(lv_obj, value, value);
}
int pika_lvgl_bar_get_max_value(PikaObj *self){
int pika_lvgl_bar_get_max_value(PikaObj* self) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return lv_bar_get_max_value(lv_obj);
return lv_bar_get_max_value(lv_obj);
}
int pika_lvgl_bar_get_min_value(PikaObj *self){
int pika_lvgl_bar_get_min_value(PikaObj* self) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return lv_bar_get_min_value(lv_obj);
return lv_bar_get_min_value(lv_obj);
}
int pika_lvgl_bar_get_mode(PikaObj *self){
int pika_lvgl_bar_get_mode(PikaObj* self) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return lv_bar_get_mode(lv_obj);
return lv_bar_get_mode(lv_obj);
}
int pika_lvgl_bar_get_start_value(PikaObj *self){
int pika_lvgl_bar_get_start_value(PikaObj* self) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return lv_bar_get_start_value(lv_obj);
return lv_bar_get_start_value(lv_obj);
}
int pika_lvgl_bar_get_value(PikaObj *self){
int pika_lvgl_bar_get_value(PikaObj* self) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return lv_bar_get_value(lv_obj);
return lv_bar_get_value(lv_obj);
}
void pika_lvgl_bar_set_mode(PikaObj *self, int mode){
void pika_lvgl_bar_set_mode(PikaObj* self, int mode) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_bar_set_mode(lv_obj, mode);
}
void pika_lvgl_bar_set_range(PikaObj *self, int min, int max){
void pika_lvgl_bar_set_range(PikaObj* self, int min, int max) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_bar_set_range(lv_obj, min, max);
}
void pika_lvgl_bar_set_start_value(PikaObj *self, int start_value, int anim){
void pika_lvgl_bar_set_start_value(PikaObj* self, int start_value, int anim) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_bar_set_start_value(lv_obj, start_value, anim);
}
@ -175,14 +178,14 @@ void pika_lvgl_checkbox_set_text(PikaObj* self, char* txt) {
lv_checkbox_set_text(lv_obj, txt);
}
void pika_lvgl_checkbox_set_text_static(PikaObj *self, char* txt){
void pika_lvgl_checkbox_set_text_static(PikaObj* self, char* txt) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_checkbox_set_text_static(lv_obj, txt);
}
char* pika_lvgl_checkbox_get_text(PikaObj *self){
char* pika_lvgl_checkbox_get_text(PikaObj* self) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return (char*) lv_checkbox_get_text(lv_obj);
return (char*)lv_checkbox_get_text(lv_obj);
}
void pika_lvgl_dropdown___init__(PikaObj* self, PikaObj* parent) {
@ -196,19 +199,19 @@ void pika_lvgl_dropdown_set_options(PikaObj* self, char* options) {
lv_dropdown_set_options(lv_obj, options);
}
void pika_lvgl_dropdown_add_option(PikaObj *self, char* options, int pos){
void pika_lvgl_dropdown_add_option(PikaObj* self, char* options, int pos) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_dropdown_add_option(lv_obj, options, pos);
}
void pika_lvgl_dropdown_clear_options(PikaObj *self){
void pika_lvgl_dropdown_clear_options(PikaObj* self) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_dropdown_clear_options(lv_obj);
}
void pika_lvgl_dropdown_close(PikaObj *self){
void pika_lvgl_dropdown_close(PikaObj* self) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_dropdown_close(lv_obj);
}
int pika_lvgl_dropdown_get_dir(PikaObj *self){
int pika_lvgl_dropdown_get_dir(PikaObj* self) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return lv_dropdown_get_dir(lv_obj);
}
@ -216,67 +219,67 @@ int pika_lvgl_dropdown_get_dir(PikaObj *self){
// lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
// return obj_getObj(lv_dropdown_get_list(lv_obj));
// }
int pika_lvgl_dropdown_get_option_cnt(PikaObj *self){
int pika_lvgl_dropdown_get_option_cnt(PikaObj* self) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return lv_dropdown_get_option_cnt(lv_obj);
}
int pika_lvgl_dropdown_get_option_index(PikaObj *self, char* txt){
int pika_lvgl_dropdown_get_option_index(PikaObj* self, char* txt) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return lv_dropdown_get_option_index(lv_obj, txt);
}
char* pika_lvgl_dropdown_get_options(PikaObj *self){
char* pika_lvgl_dropdown_get_options(PikaObj* self) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return (char*) lv_dropdown_get_options(lv_obj);
return (char*)lv_dropdown_get_options(lv_obj);
}
int pika_lvgl_dropdown_get_selected(PikaObj *self){
int pika_lvgl_dropdown_get_selected(PikaObj* self) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return lv_dropdown_get_selected(lv_obj);
}
int pika_lvgl_dropdown_get_selected_highlight(PikaObj *self){
int pika_lvgl_dropdown_get_selected_highlight(PikaObj* self) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return lv_dropdown_get_selected_highlight(lv_obj);
}
char* pika_lvgl_dropdown_get_selected_str(PikaObj *self){
char* pika_lvgl_dropdown_get_selected_str(PikaObj* self) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
obj_setBytes(self, "_buff",NULL, 128);
obj_setBytes(self, "_buff", NULL, 128);
char* _buff = (char*)obj_getBytes(self, "_buff");
lv_dropdown_get_selected_str(lv_obj, _buff, 128);
return _buff;
}
char* pika_lvgl_dropdown_get_symbol(PikaObj *self){
char* pika_lvgl_dropdown_get_symbol(PikaObj* self) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return (char*)lv_dropdown_get_symbol(lv_obj);
}
char* pika_lvgl_dropdown_get_text(PikaObj *self){
char* pika_lvgl_dropdown_get_text(PikaObj* self) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return (char*)lv_dropdown_get_text(lv_obj);
}
int pika_lvgl_dropdown_is_open(PikaObj *self){
int pika_lvgl_dropdown_is_open(PikaObj* self) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return lv_dropdown_is_open(lv_obj);
}
void pika_lvgl_dropdown_open(PikaObj *self){
void pika_lvgl_dropdown_open(PikaObj* self) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_dropdown_open(lv_obj);
}
void pika_lvgl_dropdown_set_dir(PikaObj *self, int dir){
void pika_lvgl_dropdown_set_dir(PikaObj* self, int dir) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_dropdown_set_dir(lv_obj, dir);
}
void pika_lvgl_dropdown_set_selected(PikaObj *self, int sel_opt){
void pika_lvgl_dropdown_set_selected(PikaObj* self, int sel_opt) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_dropdown_set_selected(lv_obj, sel_opt);
}
void pika_lvgl_dropdown_set_selected_hightlight(PikaObj *self, int en){
void pika_lvgl_dropdown_set_selected_hightlight(PikaObj* self, int en) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_dropdown_set_selected_highlight(lv_obj, en);
}
void pika_lvgl_dropdown_set_symbol(PikaObj *self, char* symbol){
void pika_lvgl_dropdown_set_symbol(PikaObj* self, char* symbol) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_dropdown_set_symbol(lv_obj, symbol);
}
void pika_lvgl_dropdown_set_text(PikaObj *self, char* txt){
void pika_lvgl_dropdown_set_text(PikaObj* self, char* txt) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_dropdown_set_text(lv_obj, txt);
}
@ -361,4 +364,105 @@ void pika_lvgl_textarea_set_one_line(PikaObj* self, int en) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_textarea_set_one_line(lv_obj, en);
}
void pika_lvgl_img___init__(PikaObj* self, PikaObj* parent) {
lv_obj_t* lv_parent = obj_getPtr(parent, "lv_obj");
lv_obj_t* lv_obj = lv_img_create(lv_parent);
obj_setPtr(self, "lv_obj", lv_obj);
}
int pika_lvgl_img_get_angle(PikaObj* self) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return lv_img_get_angle(lv_obj);
}
int pika_lvgl_img_get_antialias(PikaObj* self) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return lv_img_get_antialias(lv_obj);
}
int pika_lvgl_img_get_offset_x(PikaObj* self) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return lv_img_get_offset_x(lv_obj);
}
int pika_lvgl_img_get_offset_y(PikaObj* self) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return lv_img_get_offset_y(lv_obj);
}
int pika_lvgl_img_get_size_mode(PikaObj* self) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return lv_img_get_size_mode(lv_obj);
}
int pika_lvgl_img_get_zoom(PikaObj* self) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return lv_img_get_zoom(lv_obj);
}
void pika_lvgl_img_set_angle(PikaObj* self, int angle) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_img_set_angle(lv_obj, angle);
}
void pika_lvgl_img_set_antialias(PikaObj* self, int antialias) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_img_set_antialias(lv_obj, antialias);
}
void pika_lvgl_img_set_offset_x(PikaObj* self, int x) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_img_set_offset_x(lv_obj, x);
}
void pika_lvgl_img_set_offset_y(PikaObj* self, int y) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_img_set_offset_y(lv_obj, y);
}
void pika_lvgl_img_set_pivot(PikaObj* self, int x, int y) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_img_set_pivot(lv_obj, x, y);
}
void pika_lvgl_img_set_size_mode(PikaObj* self, int mode) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_img_set_size_mode(lv_obj, mode);
}
void pika_lvgl_img_dsc_t___init__(PikaObj* self, PikaObj* dsc_dict) {
// obj_setRef(self, "dsc_dict", dsc_dict);
// PikaDict* dsc_dict_ = obj_getPtr(dsc_dict, "dict");
// PikaObj* header = dict_getPtr(dsc_dict_, "header");
// PikaDict* header_ = obj_getPtr(header, "dict");
// lv_img_dsc_t img_dsc = {
// .data = dict_getBytes(dsc_dict_, "data"),
// .data_size = dict_getInt(dsc_dict_, "data_size"),
// .header =
// {
// .always_zero = 0,
// .cf = LV_IMG_SRC_FILE,
// },
// };
extern const lv_img_dsc_t asset_evue_designer;
obj_setStruct(self, "img_dsc", asset_evue_designer);
}
void pika_lvgl_img_set_src(PikaObj* self, PikaObj* src) {
obj_setRef(self, "src", src);
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_img_dsc_t* img_dsc = obj_getStruct(src, "img_dsc");
lv_img_set_src(lv_obj, img_dsc);
}
PikaObj* pika_lvgl_img_get_src(PikaObj* self) {
return obj_getPtr(self, "src");
}
void pika_lvgl_img_set_zoom(PikaObj* self, int zoom) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_img_set_zoom(lv_obj, zoom);
}
#endif

View File

@ -133,12 +133,14 @@ class STATE:
ANY: int
def __init__(self): ...
class TEXT_DECOR:
NONE:int
UNDERLINE:int
STRIKETHROUGH:int
NONE: int
UNDERLINE: int
STRIKETHROUGH: int
def __init__(self): ...
class lv_event:
def get_code(self) -> int: ...
def get_target(self) -> lv_obj: ...
@ -305,7 +307,7 @@ class lv_obj:
def refresh_self_size(self) -> int: ...
def refr_pos(self): ...
def move_to(self, x: int, y: int): ...
def move_children_by(self, x_diff: int, y_diff: int,ignore_floating: int): ...
def move_children_by(self, x_diff: int, y_diff: int, ignore_floating: int): ...
def transform_point(self, p: point_t, recursive: int, inv: int): ...
# def get_transformed_area(self, area: lv_area_t, recursive: int, inv: int): ...
@ -433,6 +435,49 @@ class table(lv_obj):
def set_cell_value(self, row: int, col: int, txt: str): ...
class img_dsc_t:
def __init__(self, dsc_dict: dict): ...
class img(lv_obj):
def __init__(self, parent: lv_obj): ...
"""
void lv_img_set_src(lv_obj_t * obj, const void * src);
void lv_img_set_offset_x(lv_obj_t * obj, lv_coord_t x);
void lv_img_set_offset_y(lv_obj_t * obj, lv_coord_t y);
void lv_img_set_angle(lv_obj_t * obj, int16_t angle);
void lv_img_set_pivot(lv_obj_t * obj, lv_coord_t x, lv_coord_t y);
void lv_img_set_zoom(lv_obj_t * obj, uint16_t zoom);
void lv_img_set_antialias(lv_obj_t * obj, bool antialias);
void lv_img_set_size_mode(lv_obj_t * obj, lv_img_size_mode_t mode);
const void * lv_img_get_src(lv_obj_t * obj);
lv_coord_t lv_img_get_offset_x(lv_obj_t * obj);
lv_coord_t lv_img_get_offset_y(lv_obj_t * obj);
uint16_t lv_img_get_angle(lv_obj_t * obj);
void lv_img_get_pivot(lv_obj_t * obj, lv_point_t * pivot);
uint16_t lv_img_get_zoom(lv_obj_t * obj);
bool lv_img_get_antialias(lv_obj_t * obj);
lv_img_size_mode_t lv_img_get_size_mode(lv_obj_t * obj);
"""
def set_src(self, src: img_dsc_t): ...
def set_offset_x(self, x: int): ...
def set_offset_y(self, y: int): ...
def set_angle(self, angle: int): ...
def set_pivot(self, x: int, y: int): ...
def set_zoom(self, zoom: int): ...
def set_antialias(self, antialias: int): ...
def set_size_mode(self, mode: int): ...
def get_src(self) -> img_dsc_t: ...
def get_offset_x(self) -> int: ...
def get_offset_y(self) -> int: ...
def get_angle(self) -> int: ...
# def get_pivot(self) -> lv_point: ...
def get_zoom(self) -> int: ...
def get_antialias(self) -> int: ...
def get_size_mode(self) -> int: ...
class textarea(lv_obj):
def __init__(self, parent: lv_obj): ...
def set_one_line(en: int): ...

View File

@ -227,7 +227,8 @@ releases = [
"v0.2.0 871fbf701c24c9c05792d3c551c44b699f4de7bf",
"v0.2.1 72e84f05ae9e50c17f49c3f910a9f4b6066c7f6a",
"v0.2.2 90f979ae0b566b74a6605f1ac8ed6cc549c40719",
"v0.3.0 22c18b5f7175fa2f283a6b73af63ba3790f3fc3a"
"v0.3.0 22c18b5f7175fa2f283a6b73af63ba3790f3fc3a",
"v0.3.1 49f2cbd0c94801c00eee9d28ce00e5adf2243a77"
]
[[packages]]