Browse Source

页面调整

master
忱 沈 5 months ago
parent
commit
50040fecb6
  1. 65
      applications/lvgl/guider/custom/custom.c
  2. 1
      applications/lvgl/guider/generated/gui_guider.h
  3. 2747
      applications/lvgl/guider/generated/guider_fonts/lv_font_simsun_24.c
  4. 2326
      applications/lvgl/guider/generated/guider_fonts/lv_font_simsun_30.c
  5. 4
      applications/lvgl/guider/generated/setup_scr_screen.c
  6. 4
      applications/lvgl/ui_data_csv.c
  7. 2
      applications/lvgl/ui_data_csv.h
  8. 16
      applications/lvgl/ui_data_labels.c

65
applications/lvgl/guider/custom/custom.c

@ -61,11 +61,33 @@ static void table_style_cb(lv_event_t *e)
dsc->rect_dsc->bg_color = lv_color_hex(0x007185); // 蓝色背景
dsc->rect_dsc->bg_opa = LV_OPA_COVER;
dsc->label_dsc->color = lv_color_hex(0xFFFFFF); // 白色文字
dsc->label_dsc->font = &lv_font_simsun_24;
}
else if ((table == guider_ui.screen_w_list)&&(row == Work_step_row)) {
dsc->rect_dsc->bg_color = lv_color_hex(0x007185); // 蓝色背景
dsc->rect_dsc->bg_opa = LV_OPA_COVER;
dsc->label_dsc->color = lv_color_hex(0xFFFFFF); // 白色文字
dsc->label_dsc->font = &lv_font_simsun_24;
}
}
}
}
static void table_step_cb(lv_event_t *e)
{
lv_event_code_t code = lv_event_get_code(e);
lv_obj_t *table = lv_event_get_target(e);
if (code == LV_EVENT_DRAW_PART_BEGIN) {
lv_obj_draw_part_dsc_t *dsc = lv_event_get_param(e);
// 检查是否是单元格绘制
if (dsc->part == LV_PART_ITEMS && dsc->id < LV_TABLE_CELL_NONE) {
uint16_t row = dsc->id / lv_table_get_col_cnt(table);
//uint16_t col = dsc->id % lv_table_get_col_cnt(table);
if (row == Work_step_row) {
dsc->rect_dsc->bg_color = lv_color_hex(0x007185); // 蓝色背景
dsc->rect_dsc->bg_opa = LV_OPA_COVER;
dsc->label_dsc->color = lv_color_hex(0xFFFFFF); // 白色文字
dsc->label_dsc->font = &lv_font_simsun_24;
}
}
}
@ -130,8 +152,7 @@ static void table_click_event_cb(lv_event_t *e) {
// 初始化样式
void table_style_init(lv_obj_t *container)
{
//guider_ui.screen_list_inf = lv_table_create(guider_ui.screen_inf_list);
lv_obj_add_event_cb(container, table_style_cb, LV_EVENT_DRAW_PART_BEGIN, NULL);
//lv_obj_add_event_cb(container, table_style_cb, LV_EVENT_DRAW_PART_BEGIN, NULL);
lv_obj_add_event_cb(container, table_click_event_cb, LV_EVENT_CLICKED, NULL);
lv_obj_set_pos(container, 0, 0);
@ -165,7 +186,7 @@ void table_style_init(lv_obj_t *container)
lv_obj_set_style_pad_right(container, 10, LV_PART_ITEMS|LV_STATE_DEFAULT);
lv_obj_set_style_text_color(container, lv_color_hex(0xFFFFFF), LV_PART_ITEMS|LV_STATE_CHECKED);
lv_obj_set_style_text_font(container, &lv_font_simsun_14, LV_PART_ITEMS|LV_STATE_CHECKED);
lv_obj_set_style_text_font(container, &lv_font_simsun_24, LV_PART_ITEMS|LV_STATE_CHECKED);
lv_obj_set_style_text_opa(container, 255, LV_PART_ITEMS|LV_STATE_CHECKED);
lv_obj_set_style_text_align(container, LV_TEXT_ALIGN_CENTER, LV_PART_ITEMS|LV_STATE_CHECKED);
lv_obj_set_style_bg_opa(container, 255, LV_PART_ITEMS|LV_STATE_CHECKED);
@ -196,16 +217,46 @@ void custom_init(lv_ui *ui)
lv_obj_set_style_pad_all(ui->screen_w_io_tab_4, 0, LV_PART_MAIN);
lv_obj_set_scroll_dir(ui->screen_w_io_tab_4, LV_DIR_NONE);
//table_style_init();
//
guider_ui.screen_list_inf = lv_table_create(guider_ui.screen_inf_list);
table_style_init(guider_ui.screen_list_inf);
lv_table_set_col_cnt(guider_ui.screen_list_inf,6);
lv_obj_add_event_cb(guider_ui.screen_list_inf, table_style_cb, LV_EVENT_DRAW_PART_BEGIN, NULL);
lv_table_set_col_cnt(guider_ui.screen_list_inf,2);
lv_table_set_col_width(guider_ui.screen_list_inf, 0, 350);
lv_table_set_col_width(guider_ui.screen_list_inf, 1, 360);
lv_table_set_cell_value(guider_ui.screen_list_inf,0,0,"工单");
lv_table_set_cell_value(guider_ui.screen_list_inf,0,1,"工艺");
//
guider_ui.screen_w_list_NAME = lv_table_create(guider_ui.screen_tabview_tab_1);
lv_obj_set_pos(guider_ui.screen_w_list_NAME, 0, 0);
lv_obj_set_size(guider_ui.screen_w_list_NAME, 300, 50);
table_style_init(guider_ui.screen_w_list_NAME);
lv_obj_add_event_cb(guider_ui.screen_w_list_NAME, table_style_cb, LV_EVENT_DRAW_PART_BEGIN, NULL);
lv_table_set_row_cnt(guider_ui.screen_w_list_NAME,1);
lv_table_set_col_width(guider_ui.screen_w_list_NAME, 0, 50);
lv_table_set_col_width(guider_ui.screen_w_list_NAME, 1, 250);
lv_table_set_cell_value(guider_ui.screen_w_list_NAME,0,0,"");
lv_table_set_cell_value(guider_ui.screen_w_list_NAME,0,1,"工艺");
guider_ui.screen_w_list = lv_table_create(guider_ui.screen_step_list);
table_style_init(guider_ui.screen_w_list);
lv_obj_add_event_cb(guider_ui.screen_w_list, table_step_cb, LV_EVENT_DRAW_PART_BEGIN, NULL);
lv_table_set_col_cnt(guider_ui.screen_w_list,2);
lv_table_set_row_cnt(guider_ui.screen_w_list,6);
lv_table_set_row_cnt(guider_ui.screen_w_list,2);
lv_table_set_col_width(guider_ui.screen_w_list, 0, 50);
lv_table_set_col_width(guider_ui.screen_w_list, 1, 250);
lv_obj_set_style_height(guider_ui.screen_w_list, 100, LV_PART_ITEMS | LV_STATE_DEFAULT);
lv_obj_set_style_min_height(guider_ui.screen_w_list, 100, LV_PART_ITEMS | LV_STATE_DEFAULT);
lv_obj_set_style_max_height(guider_ui.screen_w_list, 100, LV_PART_ITEMS | LV_STATE_DEFAULT);
//
lv_obj_set_size(guider_ui.screen_text_inf, 550, 230);
lv_label_set_text(guider_ui.screen_text_inf,"");
/* Add your codes here */
}

1
applications/lvgl/guider/generated/gui_guider.h

@ -454,6 +454,7 @@ typedef struct
lv_obj_t *g_kb_top_layer;
lv_obj_t *screen_w_list;
lv_obj_t *screen_list_inf;
lv_obj_t *screen_w_list_NAME;
}lv_ui;
typedef void (*ui_setup_scr_t)(lv_ui * ui);

2747
applications/lvgl/guider/generated/guider_fonts/lv_font_simsun_24.c

File diff suppressed because it is too large

2326
applications/lvgl/guider/generated/guider_fonts/lv_font_simsun_30.c

File diff suppressed because it is too large

4
applications/lvgl/guider/generated/setup_scr_screen.c

@ -476,8 +476,8 @@ void setup_scr_screen(lv_ui *ui)
//Write codes screen_step_list
ui->screen_step_list = lv_obj_create(ui->screen_tabview_tab_1);
lv_obj_set_pos(ui->screen_step_list, 0, 0);
lv_obj_set_size(ui->screen_step_list, 300, 495);
lv_obj_set_pos(ui->screen_step_list, 0, 50);
lv_obj_set_size(ui->screen_step_list, 300, 445);
lv_obj_set_scrollbar_mode(ui->screen_step_list, LV_SCROLLBAR_MODE_OFF);
//Write style for screen_step_list, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.

4
applications/lvgl/ui_data_csv.c

@ -165,7 +165,7 @@ int parse_csv_string(const char *csv_data, UserData *user)
static UserData *user = NULL;
extern struct rt_memheap sdram_heap;
int parse_csv_to_table(lv_obj_t *container, const char *csv_data) {
int parse_csv_to_table(lv_obj_t *container, const char *csv_data,int flags) {
if (container == NULL || csv_data == NULL) {
return -1;
}
@ -192,7 +192,7 @@ int parse_csv_to_table(lv_obj_t *container, const char *csv_data) {
// 填充表格数据
for (int i = 0; i < user->total_rows; i++) {
for (int j = 0; j < user->max_cols; j++) {
const char *val = csv_get_cell(user, i, j);
const char *val = csv_get_cell(user, i + flags, j);
lv_table_set_cell_value(container, i, j, val ? val : "");
}
}

2
applications/lvgl/ui_data_csv.h

@ -10,7 +10,7 @@
#ifndef APPLICATIONS_LVGL_UI_DATA_CSV_H_
#define APPLICATIONS_LVGL_UI_DATA_CSV_H_
int parse_csv_to_table(lv_obj_t *container, const char *csv_data);
int parse_csv_to_table(lv_obj_t *container, const char *csv_data,int flags);
int parse_csv_to_inf(lv_obj_t *container, const char *csv_data ,int W_data,int H_data);
#endif /* APPLICATIONS_LVGL_UI_DATA_CSV_H_ */

16
applications/lvgl/ui_data_labels.c

@ -323,7 +323,7 @@ void Work_Program_ui(void)
rt_snprintf(sqlSELECT, sizeof(sqlSELECT),"%s'%s' LIMIT 16;",select_WorkOrder_DATA,time_str);
db_send_select(DB_CMD_SELECT, sqlSELECT, 500,select_data_ui);
// 表格绘图
parse_csv_to_table(guider_ui.screen_list_inf, select_data_ui);
parse_csv_to_table(guider_ui.screen_list_inf, select_data_ui,0);
}
}
else
@ -331,9 +331,12 @@ void Work_Program_ui(void)
// 查询工艺数据
db_send_select(DB_CMD_SELECT, select_Program_DATA, 500,select_data_ui);
// 表格绘图
parse_csv_to_table(guider_ui.screen_list_inf, select_data_ui);
parse_csv_to_table(guider_ui.screen_list_inf, select_data_ui,0);
}
lv_table_set_col_cnt(guider_ui.screen_w_list,2);
lv_table_set_row_cnt(guider_ui.screen_w_list,1);
lv_table_set_col_width(guider_ui.screen_w_list, 0, 50);
lv_table_set_col_width(guider_ui.screen_w_list, 1, 250);
}
//工单页面的步骤信息表
@ -344,13 +347,16 @@ void Work_Program_step_ui(char* str_data)
// 安全格式化
rt_snprintf(sqlSELECT, sizeof(sqlSELECT),"%s'%s' ORDER BY Step ASC;",select_WorkorderSteps_DATA,str_data);
db_send_select(DB_CMD_SELECT, sqlSELECT, 500,select_data_ui);
// 表格绘图
parse_csv_to_table(guider_ui.screen_w_list, select_data_ui);
if((select_data_ui[0]=='N')&&(select_data_ui[1]=='o'))return;
parse_csv_to_table(guider_ui.screen_w_list, select_data_ui,1);
lv_table_set_col_width(guider_ui.screen_w_list, 0, 50);
lv_table_set_col_width(guider_ui.screen_w_list, 1, 250);
rt_snprintf(sqlSELECT, sizeof(sqlSELECT),"%s WorkOrder = '%s' LIMIT 1;",select_Workorderinf_DATA,str_data);
db_send_select(DB_CMD_SELECT, sqlSELECT, 500,select_data_ui);
//信息显示
parse_csv_to_inf(guider_ui.screen_text_inf,select_data_ui,550,230);
}
@ -359,8 +365,10 @@ void Work_Program_step_ui(char* str_data)
// 安全格式化
rt_snprintf(sqlSELECT, sizeof(sqlSELECT),"%s'%s' ORDER BY Step ASC;",select_ProgramSteps_DATA,str_data);
db_send_select(DB_CMD_SELECT, sqlSELECT, 500,select_data_ui);
// 表格绘图
parse_csv_to_table(guider_ui.screen_w_list, select_data_ui);
if((select_data_ui[0]=='N')&&(select_data_ui[1]=='o'))return;
parse_csv_to_table(guider_ui.screen_w_list, select_data_ui,1);
lv_table_set_col_width(guider_ui.screen_w_list, 0, 50);
lv_table_set_col_width(guider_ui.screen_w_list, 1, 250);

Loading…
Cancel
Save