gen_image.py
2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
########################################################
# 1. gen xml image for system resgenerator
# 2. copy file to image zip
########################################################
from read_config import g_bg_list1
from read_config import g_bg_list2
from read_config import g_bg_path_list1
from read_config import g_bg_path_list2
g_root_path = "plutommi\\"
g_path1 = "Service\\vk3Srv\\Res\\"
def copyImage():
lcd_size = get_lcd_size()
# this part not implement.
def getSlicePath(path, slice_root):
temp_str = ""
index = path.find(slice_root)
if index == -1:
return temp_str
temp_str = path[0:index + len(slice_root)]
return temp_str
def addImageDefines():
b = True
add_begin = 'RESOURCE_BASE_RANGE'
add_end = ['/* please add new resource base table above this line */','RESOURCE_BASE_TABLE_END()']
root_f = '../../../../'
mmi_res_range_name = 'plutommi\\mmi\\Inc\\mmi_res_range_def.h'
line_list = []
file_path = os.path.join(root_f, mmi_res_range_name)
m = open(file_path,'r')
f = m.readlines()
for line in f:
if line in add_begin:
str = '''RESOURCE_BASE_RANGE(SRV_VK3, %s),\n'''%(len(g_bg_list)+20)
line_list.append(str)
line_list.append(line)
if line in add_end and b:
b = False
str = '''
/****************************************************************************
* vkv3 res
*****************************************************************************/
#define VIRTUAL_KEYBOARD_BASE ( (U16) GET_RESOURCE_BASE(SRV_VK3))
#define SRV_CNMGR_BASE_MAX ((U16) GET_RESOURCE_MAX(SRV_VK3))
RESOURCE_BASE_TABLE_ITEM_PATH(SRV_VK3, ".\\service\\Vk3Srv\\Res\\")
/*****************************************************************************/
'''
line_list.append(str)
line_list.append(line)
else:
line_list.append(line)
m.close()
file = open(file_path,'w')
for i in line_list:
file.write(i)
file.close()
def main():
genXmlImage()
if __name__ == "__main__":
main()