taobin_project/inter/sgp/xml/menu_new_layout_gen_v2.py

1096 lines
55 KiB
Python

if "v2" in param:
def tryGetFromMap(map: dict, expected_key: str):
# if expected_key is not None and "s" in expected_key:
# print("check keylist", (expected_key in map.keys()), f".{map[expected_key]}.")
try:
return map[expected_key]
except:
return None
def appendValueInMap(
map: dict,
expected_key: str,
value_to_set: str
):
if tryGetFromMap(map, expected_key) is None:
return
# print("get", expected_key, tryGetFromMap(map, expected_key))
map[expected_key] += value_to_set
def adjustPosition(value: str, modifiers):
result = modifiers(int(value))
return result
def removePartOfText(value: str, part: str, repl = None):
if repl != None:
return value.replace(part, repl)
return value.replace(part, "")
def packExport(key: str | list):
return {
"source": season_pass_menu_script,
"key": key,
"append": appendValueInMap
}
def cloneTextExport(key: str | list, mods=None, remove=None, replace=None, block_output=False, block_append=False):
return {
"source": season_pass_menu_big_btn_ui,
"key": key,
"append": appendValueInMap,
"adjust": adjustPosition,
"remove": removePartOfText,
"remove_target": remove,
"replace_by": replace,
"modifiers": mods,
"no_output": block_output,
"no_append": block_append
}
def GenMenuProductCodeBlock(spl, str_hot_product_code, str_cold_product_code, str_blend_product_code):
gen_ss = "set-" in spl[idx_img][8]
if (str_hot_product_code.startswith('52-01') or str_cold_product_code.startswith('52-01') or str_blend_product_code.startswith('52-01')) and gen_season_pass and current_file_name == "page_catalog_group_recommend_multi_pro.skt":
return
#print(" size " + str( len(spl)) + " img=" + spl[ idx_img][1] )
out_xml( '\t; ==================> Len = ' + str(len(spl)) + '\r\n', store_block={
"product_code": f"{str_hot_product_code}.{str_cold_product_code}.{str_blend_product_code}",
"point": "init",
"from_ss": gen_ss
})
menu_img = spl[ idx_img][1]
out_xml( '\t; '+ str_hot_product_code + ' ' + str_cold_product_code + ' ' + str_blend_product_code+ ' \r\n')
out_xml( '<Block>\r\n')
out_xml('\t<MarginLeft> 33 </MarginLeft>\r\n')
out_xml('\t<MarginTop> 22 </MarginTop>\r\n')
out_xml('\t<Width> 225 </Width>\r\n')
out_xml('\t<Height> 296 </Height>\r\n')
str_con = ""
str_con_var = ""
#print("#########################################################################################################################")
#print( str( spl))
#print("#########################################################################################################################")
if str_hot_product_code != '-':
str_con += str_hot_product_code + '.Button,'
if str_cold_product_code != '-':
str_con += str_cold_product_code + '.Button,'
if str_blend_product_code != '-':
str_con += str_blend_product_code + '.Button,'
if str_hot_product_code != '-':
str_con_var += str_hot_product_code + '-'
if str_cold_product_code != '-':
str_con_var += str_cold_product_code + '-'
if str_blend_product_code != '-':
str_con_var += str_blend_product_code + '-'
str_con_var = str_con_var.replace("-", "")
if touch_less_gen == True or (multi_pro_gen and gen_season_pass):
str_con += "Disable=Invisible,"
str_con += "$Sum" + str_con_var
out_xml( '\t<State> Flag( '+ str_con + ') </State> \r\n')
pd_code_1 = str_hot_product_code
pd_stage1 = '$' + str_hot_product_code + '.Button'
if str_hot_product_code == "-" or len(str_hot_product_code) == 0 :
pd_code_1 = pd_code_available
pd_stage1 = '"Disable2"'
pd_code_2 = str_cold_product_code
pd_stage2 = '$' + str_cold_product_code + '.Button'
if str_cold_product_code == "-" or len(str_cold_product_code) == 0:
pd_code_2 = pd_code_available
pd_stage2 = '"Disable2"'
pd_code_3 = str_blend_product_code
pd_stage3 = '$' + str_blend_product_code + '.Button'
if str_blend_product_code == "-" or len(str_blend_product_code) == 0:
pd_code_3 = pd_code_available
pd_stage3 = '"Disable2"'
out_xml( '\t<Button>\r\n')
out_xml( '\t<State> $Sum' + str_con_var +' </State> \r\n')
out_xml( '\t<Filename> "' + new_default_dir + '/'+ menu_img +'" </Filename>\r\n')
out_xml( '\t<FilenamePress> "' + new_default_dir_press + '/'+ menu_img +'" </FilenamePress>\r\n')
out_xml( '\t<FilenameDisable> "' + new_default_dir_disable + '/'+ menu_img +'" </FilenameDisable>\r\n')
# season_pass
menu_key = None
menu_key_overlay = None
if "set-" in spl[idx_img][8]:
if "," in spl[idx_img][8]:
set_season_pass = spl[idx_img][8].split(",")
# expect set-1-sm set-2 ...
for set_season_pass_item in set_season_pass:
current_set_season_pass = set_season_pass_item.split("-")[1]
is_sm = False
is_v1 = False
if "sm" in set_season_pass_item:
is_sm = True
if pd_code_1.startswith('52-01') or pd_code_2.startswith('52-01') or pd_code_3.startswith('52-01'):
is_v1 = True
if int(current_set_season_pass) not in season_pass_menu.keys():
season_pass_menu[int(current_set_season_pass)] = []
print("Add season: ", season_pass_menu)
if not is_v1:
# season_pass_menu[int(current_set_season_pass)].append(spl)
# if "#" not in pd_code_1 and (pd_code_1+f".{spl[ idx_name][1]}") not in season_pass_menu[int(current_set_season_pass)]:
# season_pass_menu[int(current_set_season_pass)].append(pd_code_1+f".{spl[ idx_name][1]}")
# if "#" not in pd_code_2 and (pd_code_2+f".{spl[ idx_name][1]}") not in season_pass_menu[int(current_set_season_pass)]:
# season_pass_menu[int(current_set_season_pass)].append(pd_code_2+f".{spl[ idx_name][1]}")
# if "#" not in pd_code_3 and (pd_code_3+f".{spl[ idx_name][1]}") not in season_pass_menu[int(current_set_season_pass)]:
# season_pass_menu[int(current_set_season_pass)].append(pd_code_3+f".{spl[ idx_name][1]}")
if is_sm and f"{str_hot_product_code}.{str_cold_product_code}.{str_blend_product_code}.sm" not in season_pass_menu[int(current_set_season_pass)]:
season_pass_menu[int(current_set_season_pass)].append(f"{str_hot_product_code}.{str_cold_product_code}.{str_blend_product_code}.sm")
elif not is_sm and f"{str_hot_product_code}.{str_cold_product_code}.{str_blend_product_code}" not in season_pass_menu[int(current_set_season_pass)]:
season_pass_menu[int(current_set_season_pass)].append(f"{str_hot_product_code}.{str_cold_product_code}.{str_blend_product_code}")
if menu_key == None and menu_key_overlay == None:
menu_key = []
menu_key_overlay = []
menu_key.append(f"s{current_set_season_pass}.{pd_code_1}.{pd_code_2}.{pd_code_3}")
menu_key_overlay.append(f"s{current_set_season_pass}.{pd_code_1}.{pd_code_2}.{pd_code_3}.overlay")
print("menu key list", menu_key, "sm=", is_sm)
key = menu_key[len(menu_key) - 1]
if key not in season_pass_menu_script.keys() and key not in season_pass_menu_big_btn_ui.keys() and not is_sm and not is_v1:
print("add expect not sm ", key)
season_pass_menu_script[key] = ""
season_pass_menu_big_btn_ui[key] = ""
season_pass_menu_big_btn_ui[key + ".overlay"] = ""
else:
season_n = spl[idx_img][8].split('-')[1]
is_sm = False
is_v1 = False
if "sm" in spl[idx_img][8]:
is_sm = True
if pd_code_1.startswith('52-01') or pd_code_2.startswith('52-01') or pd_code_3.startswith('52-01'):
is_v1 = True
print("season_n ", season_n, int(season_n),"gen_season_pass=" , gen_season_pass)
# print("Is season map exist? ", season_pass_menu)
if int(season_n) not in season_pass_menu.keys():
season_pass_menu[int(season_n)] = []
print("Add season: ", season_pass_menu)
print("Add menu: ", spl)
if not is_v1:
# season_pass_menu[int(season_n)].append(spl)
# if "#" not in pd_code_1 and (pd_code_1+f".{spl[ idx_name][1]}") not in season_pass_menu[int(season_n)]:
# season_pass_menu[int(season_n)].append(pd_code_1+f".{spl[ idx_name][1]}")
# if "#" not in pd_code_2 and (pd_code_2+f".{spl[ idx_name][1]}") not in season_pass_menu[int(season_n)]:
# season_pass_menu[int(season_n)].append(pd_code_2+f".{spl[ idx_name][1]}")
# if "#" not in pd_code_3 and (pd_code_3+f".{spl[ idx_name][1]}") not in season_pass_menu[int(season_n)]:
# season_pass_menu[int(season_n)].append(pd_code_3+f".{spl[ idx_name][1]}")
if is_sm and f"{str_hot_product_code}.{str_cold_product_code}.{str_blend_product_code}.sm" not in season_pass_menu[int(season_n)]:
season_pass_menu[int(season_n)].append(f"{str_hot_product_code}.{str_cold_product_code}.{str_blend_product_code}.sm")
elif not is_sm and f"{str_hot_product_code}.{str_cold_product_code}.{str_blend_product_code}" not in season_pass_menu[int(season_n)]:
season_pass_menu[int(season_n)].append(f"{str_hot_product_code}.{str_cold_product_code}.{str_blend_product_code}")
# generate key for storing script
menu_key = f"s{season_n}.{pd_code_1}.{pd_code_2}.{pd_code_3}"
menu_key_overlay = menu_key + ".overlay"
print(menu_key, menu_key not in season_pass_menu_script.keys(), is_sm, is_v1)
if menu_key not in season_pass_menu_script.keys() and menu_key not in season_pass_menu_big_btn_ui.keys() and not is_sm and not is_v1:
season_pass_menu_script[menu_key] = ""
season_pass_menu_big_btn_ui[menu_key] = ""
season_pass_menu_big_btn_ui[menu_key_overlay] = ""
else:
menu_key = f"{pd_code_1}.{pd_code_2}.{pd_code_3}"
menu_key_overlay = menu_key + ".overlay"
# if menu_key not in menu_script.keys():
# menu_script[menu_key] = ""
# overlay
overlay_position = "_"+spl[idx_img][7]
overlay_string1 = ""
overlay_string2 = ""
overlay_string3 = ""
gradePD1 = getOverlayGrade(pd_code_1)
gradePD2 = getOverlayGrade(pd_code_2)
gradePD3 = getOverlayGrade(pd_code_3)
gradePD1Sugar = getOverlayGradeSugar(pd_code_1)
gradePD2Sugar = getOverlayGradeSugar(pd_code_2)
gradePD3Sugar = getOverlayGradeSugar(pd_code_3)
overlay_string_for_topping_first_open = ""
###
print("gradePD1 ", gradePD1, "gradePD2 ", gradePD2, "gradePD3 ", gradePD3)
print("gradePD1 ", gradePD1Sugar, "gradePD2 ", gradePD2Sugar, "gradePD3 ", gradePD3Sugar)
if gradePD1 != None or gradePD2 != None or gradePD3 != None:
if getOverlayGrade(pd_code_1) != None:
overlay_string1 += 'xmlpro( '+pd_code_1+', '+'"ROOT/taobin_project/inter/sgp/image/menu_overlay_set/grade'+gradePD1+ "/button_overlay_"+ gradePD1Sugar + overlay_position+'.png")'
if getOverlayGrade(pd_code_2) != None:
overlay_string2 += 'xmlpro( '+pd_code_2+', '+'"ROOT/taobin_project/inter/sgp/image/menu_overlay_set/grade'+gradePD2+ "/button_overlay_"+ gradePD2Sugar + overlay_position+'.png")'
if getOverlayGrade(pd_code_3) != None:
overlay_string3 += 'xmlpro( '+pd_code_3+', '+'"ROOT/taobin_project/inter/sgp/image/menu_overlay_set/grade'+gradePD3+ "/button_overlay_"+ gradePD3Sugar + overlay_position+'.png")'
# Overlay Tag for catalog page
# TODO: check if cold pd is available first then blend and hot
overlay_tag1 = overlay_string1.replace("button_overlay_", "button_overlay_catalog_")
overlay_tag2 = overlay_string2.replace("button_overlay_", "button_overlay_catalog_")
overlay_tag3 = overlay_string3.replace("button_overlay_", "button_overlay_catalog_")
if overlay_string2 != "":
out_xml( '\t<OverlayImage> ' + overlay_tag2 + ' </OverlayImage>\r\n', export_to=cloneTextExport(menu_key_overlay))
overlay_string_for_topping_first_open = overlay_string2
elif overlay_string3 != "":
out_xml( '\t<OverlayImage> ' + overlay_tag3 + ' </OverlayImage>\r\n', export_to=cloneTextExport(menu_key_overlay))
overlay_string_for_topping_first_open = overlay_string3
elif overlay_string1 != "":
out_xml( '\t<OverlayImage> ' + overlay_tag1 + ' </OverlayImage>\r\n', export_to=cloneTextExport(menu_key_overlay))
overlay_string_for_topping_first_open = overlay_string1
out_xml( '\t<Sound> "/mnt/sdcard/coffeevending/wav/click.wav" </Sound>\r\n')
out_xml( '\t<Volume> SoundVolume </Volume>\r\n')
out_xml( '\t<EventOnClick> \r\n')
# Default
#out_xml( '\t\tVar NameDrink = "' + spl[ idx_of_eng_des].replace("\\n", " ") + '"\r\n')
#out_xml( '\t\tVar NameDrinkTH = "' + spl[ idx_of_eng].replace("\\n", " ") + '"\r\n')
#out_xml( '\t\tVar DrinkDescriptionTH = "' + spl[ idx_of_thai].replace("\\n", " ") + '"\r\n')
#out_xml( '\t\tVar DrinkDescription = "' + spl[ idx_of_thai_des].replace("\\n", " ") + '"\r\n')
out_xml( '\t\tVar PictureDrink = "' + new_default_dir2 + '" + \"' + menu_img + '\"\r\n', export_to=packExport(menu_key))
if gen_ss:
print("start copy script use key ========== ", menu_key)
out_xml( '\t\tVar OpenFromXML = CurrentXMLFileName2\r\n', export_to=packExport(menu_key))
out_xml( '\t\tVar PriceD1 = $' + str_hot_product_code + '.Price\r\n', export_to=packExport(menu_key))
out_xml( '\t\tVar PriceD2 = $' + str_cold_product_code + '.Price\r\n', export_to=packExport(menu_key))
out_xml( '\t\tVar PriceD3 = $' + str_blend_product_code + '.Price\r\n', export_to=packExport(menu_key))
out_xml( '\t\tVar PD_CODE1 = "' + pd_code_1 + '"\r\n', export_to=packExport(menu_key))
out_xml( '\t\tVar PD_CODE2 = "' + pd_code_2 + '"\r\n', export_to=packExport(menu_key))
out_xml( '\t\tVar PD_CODE3 = "' + pd_code_3 + '"\r\n', export_to=packExport(menu_key))
out_xml( '\t\t; begin lang \r\n', export_to=packExport(menu_key))
for x in range( max_can_have_lang):
if x < len( spl[ idx_name]):
out_xml( '\t\tVar aliasName['+ str(x) +'] = "'+ spl[ idx_name][ x + 1]+'"\r\n', export_to=packExport(menu_key))
out_xml( '\t\tVar aliasDesc['+ str(x) +'] = "'+ spl[ idx_desc][ x + 1]+'"\r\n', export_to=packExport(menu_key))
for x in range( max_can_have_lang):
out_xml( '\t\tVar NameLang[0]['+ str(x) +'] = "'+ get_name_lang( pd_code_1 , x)+'"\r\n', export_to=packExport(menu_key))
for x in range( max_can_have_lang):
out_xml( '\t\tVar DescLang[0]['+ str(x) +'] = "'+ get_desc_lang( pd_code_1 , x)+'"\r\n', export_to=packExport(menu_key))
for x in range( max_can_have_lang):
out_xml( '\t\tVar NameLang[1]['+ str(x) +'] = "'+ get_name_lang( pd_code_2 , x)+'"\r\n', export_to=packExport(menu_key))
for x in range( max_can_have_lang):
out_xml( '\t\tVar DescLang[1]['+ str(x) +'] = "'+ get_desc_lang( pd_code_2 , x)+'"\r\n', export_to=packExport(menu_key))
for x in range( max_can_have_lang):
out_xml( '\t\tVar NameLang[2]['+ str(x) +'] = "'+ get_name_lang( pd_code_3 , x)+'"\r\n', export_to=packExport(menu_key))
for x in range( max_can_have_lang):
out_xml( '\t\tVar DescLang[2]['+ str(x) +'] = "'+ get_desc_lang( pd_code_3 , x)+'"\r\n', export_to=packExport(menu_key))
out_xml( '\t\t; end lang \r\n', export_to=packExport(menu_key))
out_xml( '\t\tVar PD_STAGE_1 = ' + pd_stage1 + '\r\n', export_to=packExport(menu_key))
out_xml( '\t\tVar PD_STAGE_2 = ' + pd_stage2 + '\r\n', export_to=packExport(menu_key))
out_xml( '\t\tVar PD_STAGE_3 = ' + pd_stage3 + '\r\n', export_to=packExport(menu_key))
out_xml( '\t\tVar SelectCountDrinkType = 0\r\n', export_to=packExport(menu_key))
out_xml( '\t\tVar DefaultDrinkType = 0\r\n', export_to=packExport(menu_key))
out_xml( '\t\tIf PD_STAGE_1 = "Enable" Then\r\n', export_to=packExport(menu_key))
out_xml( '\t\t\tVar SelectCountDrinkType = SelectCountDrinkType + 1\r\n', export_to=packExport(menu_key))
out_xml( '\t\t\tVar DefaultDrinkType = 1\r\n', export_to=packExport(menu_key))
out_xml( '\t\tEndIf\r\n', export_to=packExport(menu_key))
out_xml( '\t\tIf PD_STAGE_2 = "Enable" Then\r\n', export_to=packExport(menu_key))
out_xml( '\t\t\tVar SelectCountDrinkType = SelectCountDrinkType + 1\r\n', export_to=packExport(menu_key))
out_xml( '\t\t\tVar DefaultDrinkType = 2\r\n', export_to=packExport(menu_key))
out_xml( '\t\tEndIf\r\n', export_to=packExport(menu_key))
out_xml( '\t\tIf PD_STAGE_3 = "Enable" Then\r\n', export_to=packExport(menu_key))
out_xml( '\t\t\tVar SelectCountDrinkType = SelectCountDrinkType + 1\r\n', export_to=packExport(menu_key))
out_xml( '\t\t\tVar DefaultDrinkType = 3\r\n', export_to=packExport(menu_key))
out_xml( '\t\tEndIf\r\n', export_to=packExport(menu_key))
out_xml( '\t\tIf PD_STAGE_2 = "Enable" Then\r\n', export_to=packExport(menu_key))
#out_xml( '\t\t\tVar PD_STAGE_2 = "Enable"\r\n')
out_xml( '\t\t\tTopping "Load" "'+ str_cold_product_code +'"\r\n', export_to=packExport(menu_key))
out_xml( '\t\tElse\r\n', export_to=packExport(menu_key))
out_xml( '\t\t\tIf PD_STAGE_1 = "Enable" Then\r\n', export_to=packExport(menu_key))
#out_xml( '\t\t\t\tVar PD_STAGE_1 = "Enable"\r\n')
out_xml( '\t\t\tTopping "Load" "'+ str_hot_product_code +'"\r\n', export_to=packExport(menu_key))
out_xml( '\t\t\tElse\r\n', export_to=packExport(menu_key))
#out_xml( '\t\t\t\tVar PD_STAGE_3 = "Enable"\r\n')
out_xml( '\t\t\tTopping "Load" "'+ str_blend_product_code +'"\r\n', export_to=packExport(menu_key))
out_xml( '\t\t\tEndIf\r\n', export_to=packExport(menu_key))
out_xml( '\t\tEndIf\r\n', export_to=packExport(menu_key))
#out_xml( '\t\tVar menu_name_eng_hot = $' + pd_code_1 + '.NameE\r\n')
#out_xml( '\t\tVar menu_desc_eng_hot = $' + pd_code_1 + '.descriptionE\r\n')
#out_xml( '\t\tVar menu_name_thai_hot = $' + pd_code_1 + '.Name\r\n')
#out_xml( '\t\tVar menu_desc_thai_hot = $' + pd_code_1 + '.description\r\n')
#out_xml( '\t\t\r\n')
#out_xml( '\t\tVar menu_name_eng_cold = $' + pd_code_2 + '.NameE\r\n')
#out_xml( '\t\tVar menu_desc_eng_cold = $' + pd_code_2 + '.descriptionE\r\n')
#out_xml( '\t\tVar menu_name_thai_cold = $' + pd_code_2 + '.Name\r\n')
#out_xml( '\t\tVar menu_desc_thai_cold = $' + pd_code_2 + '.description\r\n')
#out_xml( '\t\t\r\n')
#out_xml( '\t\tVar menu_name_eng_blender = $' + pd_code_3 + '.NameE\r\n')
#out_xml( '\t\tVar menu_desc_eng_blender = $' + pd_code_3 + '.descriptionE\r\n')
#out_xml( '\t\tVar menu_name_thai_blender = $' + pd_code_3 + '.Name\r\n')
#out_xml( '\t\tVar menu_desc_thai_blender = $' + pd_code_3 + '.description\r\n')
out_xml( '\t\t\r\n', export_to=packExport(menu_key))
out_xml( '\t\tDEBUGVAR PD_STAGE_1\r\n', export_to=packExport(menu_key))
out_xml( '\t\tDEBUGVAR PD_STAGE_2\r\n', export_to=packExport(menu_key))
out_xml( '\t\tDEBUGVAR PD_STAGE_3\r\n', export_to=packExport(menu_key))
out_xml( '\t\tVar SelectDrinkType = 0\r\n', export_to=packExport(menu_key))
# Overlay Filter
out_xml( '\t\tVar OverlayMenuFilter = \"\"\r\n', export_to=packExport(menu_key))
out_xml( '\t\tVar OverlayMenuFilter1 = \"\"\r\n', export_to=packExport(menu_key))
out_xml( '\t\tVar OverlayMenuFilter2 = \"\"\r\n', export_to=packExport(menu_key))
out_xml( '\t\tVar OverlayMenuFilter3 = \"\"\r\n', export_to=packExport(menu_key))
def get_overlay_filter( stage: int, pd_code: str, assign_args: str) -> str:
# overlay stage
overlay_stage = "OverlayMenuFilter"+str(stage)
overlay_stage_value = "OverlayMenuFilter"+str(stage)+"_Value"
# if block
if_block = "\n\t\tIf PD_STAGE_"+str(stage)+" = \"Enable\" Then\r\n"
if_block += "\t\t\tVar "+overlay_stage+" = \""+pd_code+"\"\r\n"
if_block += "\t\t\tVar "+overlay_stage_value+" !assigned "+assign_args+"\r\n"
if_block += "\t\t\tDEBUGVAR "+overlay_stage+"\r\n"
if_block += "\t\t\tDEBUGVAR "+overlay_stage_value+"\r\n"
# else block
else_block = "\t\tElse\r\n"
else_block += "\t\t\tVar OverlayMenuFilter = \"\"\r\n"
else_block += "\t\tEndIf\r\n"
if pd_code == "":
return ""
else:
return if_block + else_block
if overlay_string1 != "":
out_xml( get_overlay_filter(1, pd_code_1, overlay_string1), export_to=packExport(menu_key))
if overlay_string2 != "":
out_xml( get_overlay_filter(2, pd_code_2, overlay_string2), export_to=packExport(menu_key))
if overlay_string3 != "":
out_xml(get_overlay_filter(3, pd_code_3, overlay_string3), export_to=packExport(menu_key))
out_xml( '\t\tVar OverlayMenuFilter = "' + overlay_string_for_topping_first_open + '\"\r\n', export_to=packExport(menu_key))
out_xml( '\t\t\r\n', export_to=packExport(menu_key))
out_xml( '\t\t\r\n', export_to=packExport(menu_key))
out_xml( '\t\tOpen "ROOT/taobin_project/xml/page_topping_select6.lxml"\r\n')
out_xml( '\t\t\r\n', export_to=packExport(menu_key))
# if menu_key.startswith("s"):
# print(f"preview script of {menu_key}", tryGetFromMap(season_pass_menu_script, menu_key))
out_xml( '\t</EventOnClick>\r\n')
out_xml( '\t</Button>\r\n')
out_xml( '\t<Text>\r\n', export_to=cloneTextExport(menu_key))
out_xml( '\t<X> 16 </X>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t<Y> 164 </Y>\r\n',export_to=cloneTextExport(
menu_key,
lambda y_pos: y_pos * 2 + 30))
out_xml( '\t<Size> 22 </Size>\r\n',export_to=cloneTextExport(
menu_key,
lambda y_pos: int(y_pos * 1.5)))
out_xml( '\t<Width> 222 </Width>\r\n',export_to=cloneTextExport(
menu_key,
lambda y_pos: int(y_pos * 1.5)))
out_xml( '\t<Mode> "multi2" </Mode>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t<Font> KanitMediumTTF </Font>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t<Color> 0x322B26 </Color>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t<LanguageGroup>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t\t<LanguageSlot1>' + spl[ idx_name][ idx_lang_eng] + '</LanguageSlot1>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t\t<LanguageSlot2>' + spl[ idx_name][ idx_lang_thai] + '</LanguageSlot2>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t\t<LanguageSlot3>' + spl[ idx_name][ idx_lang_eng] + '</LanguageSlot3>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t\t<LanguageSlot4>' + spl[ idx_name][ idx_lang_thai] + '</LanguageSlot4>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t\t<LanguageSlot5>' + spl[ idx_name][ idx_lang_malay] + '</LanguageSlot5>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t\t<LanguageSlot6>' + spl[ idx_name][ idx_lang_thai] + '</LanguageSlot6>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t</LanguageGroup>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t</Text>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t<Text>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t<X> 16 </X>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t<Y> 220 </Y>\r\n',export_to=cloneTextExport(menu_key, lambda y_pos: y_pos * 2 + 10))
out_xml( '\t<Size> 14 </Size>\r\n',export_to=cloneTextExport(menu_key, lambda y_pos: int(y_pos + 11)))
out_xml( '\t<Width> 222 </Width>\r\n',export_to=cloneTextExport(menu_key, lambda y_pos: int(y_pos * 1.5)))
out_xml( '\t<Font> KanitMediumTTF </Font>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t<Color> 0x6F5F51 </Color>\r\n',export_to=cloneTextExport(menu_key))
#out_xml( '\t<State> showthaiText </State>\r\n')
out_xml( '\t<LanguageGroup>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t\t<LanguageSlot1>' + spl[ idx_desc][ idx_lang_eng].replace("\n","\\n") + '</LanguageSlot1>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t\t<LanguageSlot2>' + spl[ idx_desc][ idx_lang_thai] + '</LanguageSlot2>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t\t<LanguageSlot3>' + spl[ idx_desc][ idx_lang_eng] + '</LanguageSlot3>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t\t<LanguageSlot4>' + spl[ idx_desc][ idx_lang_thai] + '</LanguageSlot4>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t\t<LanguageSlot5>' + spl[ idx_desc][ idx_lang_malay] + '</LanguageSlot5>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t\t<LanguageSlot6>' + spl[ idx_desc][ idx_lang_thai] + '</LanguageSlot6>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t</LanguageGroup>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t</Text>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t<Image>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t<X> 16 </X>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t<Y> 264 </Y>\r\n',export_to=cloneTextExport(menu_key, lambda y_pos: y_pos * 2 + 10))
if gen_ss and (not is_sm or ", " in spl[idx_img][8]):
# expect season mode
out_xml('\t<Width> 390 </Width>\r\n',export_to=cloneTextExport(menu_key, block_output=True))
out_xml('\t<Height> 44 </Height>\r\n',export_to=cloneTextExport(menu_key, block_output=True))
else:
if gen_ss:
print("use normal: caused by multi_pro_gen=",multi_pro_gen,",is_sm=", is_sm )
out_xml( '\t<Filename> Var( DirImage2 + "option_deactive.png" ) </Filename>\r\n',export_to=cloneTextExport(menu_key, block_append=True))
if gen_ss and (not is_sm or ", " in spl[idx_img][8]):
out_xml('\t<Filename> "ROOT/taobin_project/inter/sgp/image/event/season_pass/drink_option_en/option_deactive.png" </Filename>\r\n', export_to=cloneTextExport(menu_key, block_output=True))
out_xml( '\t</Image>\r\n',export_to=cloneTextExport(menu_key))
ice_tab_hot_show = True
shw = "$" + str_hot_product_code + ".Button"
if str_hot_product_code == "-" :
shw = '"Invisible"'
ice_tab_hot_show = False
if len(str_hot_product_code) == 0 :
shw = '"Invisible"'
ice_tab_hot_show = False
out_xml( '\t<Image>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t<X> 16 </X>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t<Y> 264 </Y>\r\n',export_to=cloneTextExport(
menu_key,
lambda y_pos: y_pos * 2 + 10))
if gen_ss and (not is_sm or ", " in spl[idx_img][8]):
# expect season mode
out_xml('\t<Width> 134 </Width>\r\n',export_to=cloneTextExport(menu_key, block_output=True))
out_xml('\t<Height> 44 </Height>\r\n',export_to=cloneTextExport(menu_key, block_output=True))
out_xml( '\t<State> ' + shw + ' </State>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t<Filename> Var( DirImage2 + "hot.png" ) </Filename>\r\n',export_to=cloneTextExport(menu_key, block_append=True))
out_xml( '\t<FilenameDisable> Var( DirImage2 + "hot_db.png" ) </FilenameDisable>\r\n',export_to=cloneTextExport(menu_key, block_append=True))
if gen_ss and (not is_sm or "," in spl[idx_img][8]):
out_xml( '\t<Filename> "ROOT/taobin_project/inter/sgp/image/event/season_pass/drink_option_en/hot.png" </Filename>\r\n',export_to=cloneTextExport(menu_key, block_output=True))
out_xml( '\t<FilenameDisable> "ROOT/taobin_project/inter/sgp/image/event/season_pass/drink_option_en/hot_db.png" </FilenameDisable>\r\n',export_to=cloneTextExport(menu_key, block_output=True))
out_xml( '\t</Image>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t<Text>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t<X> TextPriceMenuHotX </X>\r\n',export_to=cloneTextExport(
menu_key,
mods=lambda y_pos: y_pos * 2 - 10,
remove="TextPriceMenuHotX",
replace="48"))
out_xml( '\t<Y> TextPriceMenuY </Y>\r\n',export_to=cloneTextExport(
menu_key,
mods=lambda y_pos: y_pos * 2 + 15,
remove="TextPriceMenuY",
replace="264"))
out_xml( '\t<Size> TextPriceMenuSize </Size>\r\n',export_to=cloneTextExport(
menu_key,
mods=lambda y_pos: int(y_pos + 11),
remove="TextPriceMenuSize",
replace="12"
))
out_xml( '\t<Width> 220 </Width>\r\n',export_to=cloneTextExport(
menu_key,
mods=lambda w: int(w * 2)))
out_xml( '\t<Font> KanitMediumTTF </Font>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t<Color> 0x6F5F51 </Color>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t<ColorDisable> 0xEAE6E1 </ColorDisable>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t<State> ' + shw + ' </State>\r\n',export_to=cloneTextExport(menu_key))
#out_xml( '\t<Value> Var( "฿" + $' + spl[ idx_hot_product_code] + '.Price ) </Value>\r\n')
if "free" in param:
out_xml( '\t<Value> "Free" </Value>\r\n',export_to=cloneTextExport(menu_key))
else:
out_xml( '\t<Value> StringFmt( $' + str_hot_product_code + '.Price , DisplayFormat, PreScaleConvertShow) </Value>; test\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t</Text>\r\n',export_to=cloneTextExport(menu_key))
ice_tab_ice_show = True
shw = "$" + str_cold_product_code + ".Button"
if str_cold_product_code == "-" :
shw = '"Invisible"'
ice_tab_ice_show = False
if len(str_cold_product_code) == 0 :
shw = '"Invisible"'
ice_tab_ice_show = False
out_xml( '\t<Image>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t<X> 81 </X>\r\n',export_to=cloneTextExport(
menu_key,
mods=lambda x: x + 65
))
out_xml( '\t<Y> 264 </Y>\r\n',export_to=cloneTextExport(
menu_key,
lambda y_pos: y_pos * 2 + 10))
if gen_ss and (not is_sm or ", " in spl[idx_img][8]):
# expect season mode
out_xml('\t<Width> 134 </Width>\r\n',export_to=cloneTextExport(menu_key, block_output=True))
out_xml('\t<Height> 44 </Height>\r\n',export_to=cloneTextExport(menu_key, block_output=True))
if pd_code_2 == "51-05-02-0016":
out_xml( '\t<Filename> Var( DirImage2 + "normal.png" ) </Filename>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t<FilenameDisable> Var( DirImage2 + "cold_db.png" ) </FilenameDisable>\r\n',export_to=cloneTextExport(menu_key))
else:
out_xml( '\t<Filename> Var( DirImage2 + "cold.png" ) </Filename>\r\n',export_to=cloneTextExport(menu_key, block_append=True))
out_xml( '\t<FilenameDisable> Var( DirImage2 + "cold_db.png" ) </FilenameDisable>\r\n',export_to=cloneTextExport(menu_key, block_append=True))
if gen_ss and (not is_sm or "," in spl[idx_img][8]):
out_xml( '\t<Filename> "ROOT/taobin_project/inter/sgp/image/event/season_pass/drink_option_en/cold.png" </Filename>\r\n',export_to=cloneTextExport(menu_key, block_output=True))
out_xml( '\t<FilenameDisable> "ROOT/taobin_project/inter/sgp/image/event/season_pass/drink_option_en/cold_db.png" </FilenameDisable>\r\n',export_to=cloneTextExport(menu_key, block_output=True))
out_xml( '\t<State> ' + shw + ' </State>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t</Image>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t<Text>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t<X> 113 </X>\r\n',export_to=cloneTextExport(
menu_key,
mods=lambda y_pos: y_pos * 2 - 10,
))
out_xml( '\t<Y> TextPriceMenuY </Y>\r\n',export_to=cloneTextExport(
menu_key,
mods=lambda y_pos: y_pos * 2 + 15,
replace="264",
remove="TextPriceMenuY"
))
out_xml( '\t<Size> TextPriceMenuSize </Size>\r\n',export_to=cloneTextExport(
menu_key,
mods=lambda y_pos: int(y_pos + 11),
remove="TextPriceMenuSize",
replace="12"))
out_xml( '\t<Width> 220 </Width>\r\n',export_to=cloneTextExport(
menu_key,
mods=lambda w: int(w * 2)))
out_xml( '\t<Font> KanitMediumTTF </Font>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t<Color> 0x6F5F51 </Color>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t<ColorDisable> 0xEAE6E1 </ColorDisable>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t<State> ' + shw + ' </State>\r\n',export_to=cloneTextExport(menu_key))
if "inter" in param:
if "free" in param:
out_xml( '\t<Value> "Free" </Value>\r\n',export_to=cloneTextExport(menu_key))
else:
out_xml( '\t<Value> StringFmt( $' + str_cold_product_code + '.Price , DisplayFormat, PreScaleConvertShow) </Value>; test\r\n',export_to=cloneTextExport(menu_key))
else:
out_xml( '\t<Value> Var( "฿" + $' + str_cold_product_code + '.Price ) </Value>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t</Text>\r\n',export_to=cloneTextExport(menu_key))
ice_tab_blend_show = True
shw = "$" + str_blend_product_code + ".Button"
if str_blend_product_code == "-" :
shw = '"Invisible"'
ice_tab_blend_show = False
if len(str_blend_product_code) == 0 :
shw = '"Invisible"'
ice_tab_blend_show = False
out_xml( '\t<Image>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t<X> 146 </X>\r\n',export_to=cloneTextExport(
menu_key,
mods=lambda x: x + 130
))
out_xml( '\t<Y> 264 </Y>\r\n',export_to=cloneTextExport(
menu_key,
mods=lambda y_pos: y_pos * 2 + 10
))
if gen_ss and (not is_sm or ", " in spl[idx_img][8]):
# expect season mode
out_xml('\t<Width> 134 </Width>\r\n',export_to=cloneTextExport(menu_key, block_output=True))
out_xml('\t<Height> 44 </Height>\r\n',export_to=cloneTextExport(menu_key, block_output=True))
out_xml( '\t<Filename> Var( DirImage2 + "blend.png" ) </Filename>\r\n',export_to=cloneTextExport(menu_key, block_append=True))
out_xml( '\t<FilenameDisable> Var( DirImage2 + "blend_db.png" ) </FilenameDisable>\r\n',export_to=cloneTextExport(menu_key, block_append=True))
if gen_ss and (not is_sm or "," in spl[idx_img][8]):
out_xml( '\t<Filename> "ROOT/taobin_project/inter/sgp/image/event/season_pass/drink_option_en/blend.png" </Filename>\r\n',export_to=cloneTextExport(menu_key, block_output=True))
out_xml( '\t<FilenameDisable> "ROOT/taobin_project/inter/sgp/image/event/season_pass/drink_option_en/blend_db.png" </FilenameDisable>\r\n',export_to=cloneTextExport(menu_key, block_output=True))
out_xml( '\t<State> ' + shw + ' </State>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t</Image>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t<Text>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t<X> TextPriceMenuBlendX </X>\r\n',export_to=cloneTextExport(
menu_key,
lambda y_pos: y_pos * 2 - 10,
replace="180",
remove="TextPriceMenuBlendX"
))
out_xml( '\t<Y> TextPriceMenuY </Y>\r\n',export_to=cloneTextExport(
menu_key,
mods=lambda y_pos: y_pos * 2 + 15,
remove="TextPriceMenuY",
replace="264"
))
out_xml( '\t<Size> TextPriceMenuSize </Size>\r\n',export_to=cloneTextExport(
menu_key,
mods=lambda y_pos: int(y_pos + 11),
remove="TextPriceMenuSize",
replace="12"))
out_xml( '\t<Width> 220 </Width>\r\n',export_to=cloneTextExport(
menu_key,
mods=lambda w: int(w * 2)))
out_xml( '\t<Font> KanitRegularTTF </Font>\r\n',export_to=cloneTextExport(menu_key))
#out_xml( '\t<Align> end </Align>\r\n')
out_xml( '\t<Color> 0x6F5F51 </Color>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t<ColorDisable> 0xEAE6E1 </ColorDisable>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t<State> ' + shw + ' </State>\r\n',export_to=cloneTextExport(menu_key))
if "inter" in param:
if "free" in param:
out_xml( '\t<Value> " Free" </Value>\r\n',export_to=cloneTextExport(menu_key))
else:
out_xml( '\t<Value> StringFmt( $' + str_blend_product_code + '.Price , DisplayFormat, PreScaleConvertShow) </Value>; test\r\n',export_to=cloneTextExport(menu_key))
else:
out_xml( '\t<Value> Var( "฿" + $' + str_blend_product_code + '.Price ) </Value>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t</Text>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t<Image>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t<X> 81 </X>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t<Y> 264 </Y>\r\n',export_to=cloneTextExport(
menu_key,
lambda y_pos: y_pos * 2 + 10))
out_xml( '\t<State> \r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t\teval( \r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t\tIf ICE_PROCESS_STATUS = 2 Then\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t\t\r\n',export_to=cloneTextExport(menu_key))
if ice_tab_hot_show == True:
#out_xml( '\t\t\tDEBUGVAR $Sum' + str_con_var +'\r\n')
out_xml( '\t\t\tIf $Sum' + str_con_var +' = "Disable" Then\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t\t\t\tVar ice_tab_process_show = "Disable"\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t\t\tElse\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t\t\t\tVar ice_tab_process_show = "Enable"\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t\t\tEndIf\r\n',export_to=cloneTextExport(menu_key))
else:
out_xml( '\t\t\tVar ice_tab_process_show = "Invisible"\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t\t\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t\tElse\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t\t\tVar ice_tab_process_show = "Invisible"\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t\tEndIf\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t\tVar return = ice_tab_process_show\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t\t)\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t</State>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t<Filename> "ROOT/taobin_project/image/drink_option/ice_tab_unavalible.png" </Filename>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t<FilenameDisable> "ROOT/taobin_project/image/drink_option/ice_tab_unavalible_dis.png" </FilenameDisable>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t</Image>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t<Image>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t<X> 49 </X>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t<Y> 117 </Y>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t<State> \r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t\teval( \r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t\t\tIf $Sum' + str_con_var +' = "Disable" Then\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t\t\t\tSTRCONTAIN "ERR" $' + pd_code_1 + '.TAG tag1_is_disable\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t\t\t\tSTRCONTAIN "ERR" $' + pd_code_2 + '.TAG tag2_is_disable\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t\t\t\tSTRCONTAIN "ERR" $' + pd_code_3 + '.TAG tag3_is_disable\r\n',export_to=cloneTextExport(menu_key))
#out_xml( '\t\t\t\tDEBUGVAR $' + pd_code_1 + '.TAG\r\n')
#out_xml( '\t\t\t\tDEBUGVAR $' + pd_code_2 + '.TAG\r\n')
#out_xml( '\t\t\t\tDEBUGVAR $' + pd_code_3 + '.TAG\r\n')
out_xml( '\t\t\t\tVar return = "Invisible"\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t\t\t\tIf tag1_is_disable = "true" Then\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t\t\t\t\tVar return = "Enable"\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t\t\t\tEndIf\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t\t\t\tIf tag2_is_disable = "true" Then\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t\t\t\t\tVar return = "Enable"\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t\t\t\tEndIf\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t\t\t\tIf tag3_is_disable = "true" Then\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t\t\t\t\tVar return = "Enable"\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t\t\t\tEndIf\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t\t\tElse\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t\t\t\t\tVar return = "Invisible"\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t\t\tEndIf\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t\t)\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t</State>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t<Filename> "ROOT/taobin_project/image//img_menu_err2.png" </Filename>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t</Image>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t<Text>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t<X> 84 </X>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t<Y> 266 </Y>\r\n',export_to=cloneTextExport(
menu_key,
lambda y_pos: y_pos * 2 + 10))
out_xml( '\t<Size> 10 </Size>\r\n',export_to=cloneTextExport(
menu_key,
lambda y_pos: y_pos + 11
))
out_xml( '\t<Font> OpunMediumTTF </Font>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t<Color> 0xDE794E </Color>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t<State> ice_tab_process_show </State>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t<Value> ice_show_open </Value>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t</Text>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t<Text>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t<X> 48 </X>\r\n',export_to=cloneTextExport(
menu_key,
lambda y_pos: y_pos * 2
))
out_xml( '\t<Y> 116 </Y>\r\n',export_to=cloneTextExport(
menu_key,
lambda y_pos: y_pos * 2
))
out_xml( '\t<Size> 32 </Size>\r\n',export_to=cloneTextExport(
menu_key))
out_xml( '\t<Width> 128 </Width>\r\n',export_to=cloneTextExport(
menu_key,
lambda y_pos: y_pos * 2
))
out_xml( '\t<Height> 64 </Height>\r\n',export_to=cloneTextExport(
menu_key,
lambda y_pos: y_pos * 2
))
out_xml( '\t<Mode> "disable-show" </Mode>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t<State> $Sum' + str_con_var +' </State> \r\n',export_to=cloneTextExport(menu_key))
# if gen_ss and not is_sm:
# out_xml('\t<Color> 0x322B26 </Color>',export_to=cloneTextExport(menu_key, block_output=True))
# out_xml( '\t<Value> \"UNAVAILABLE\" </Value>\r\n',export_to=cloneTextExport(menu_key, block_output=True))
out_xml( '\t<Language>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t\t<ID> 000013 </ID> \r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t</Language>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t<Align> center-vertical-horizontal </Align>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '\t</Text>\r\n',export_to=cloneTextExport(menu_key))
out_xml( '</Block>\r\n', store_block={
"product_code": f"{str_hot_product_code}.{str_cold_product_code}.{str_blend_product_code}",
"point": "end",
"from_ss": gen_ss
})
def GenMenuBlock(spl, idx_hot_product_code, idx_cold_product_code, idx_blend_product_code):
GenMenuProductCodeBlock(spl, spl[ idx_name][ idx_hot_product_code], spl[ idx_name][ idx_cold_product_code] , spl[ idx_name][ idx_blend_product_code] )
idx_lang_malay = 5
idx_lang_japan = 4
idx_lang_china = 3
idx_lang_thai = 2
idx_lang_eng = 1
idx_name = 0
idx_desc = 1
idx_img = 2
idx_hot_product_code = 7
idx_cold_product_code = idx_hot_product_code + 1
idx_blend_product_code = idx_cold_product_code + 1
#
idx_hot_product_code2 = idx_hot_product_code
idx_cold_product_code2 = idx_cold_product_code
idx_blend_product_code2 = idx_blend_product_code
idx_of_eng = 2
idx_of_eng_des = 3
idx_of_thai = 0
idx_of_thai_des = 1
print ("--------------------------------------------------------------------------------------------------------------------------")
if current_file_name == "page_catalog_group_recommend.skt":
touch_less_gen = True
else:
touch_less_gen = False
if current_file_name == "page_catalog_group_recommend_multi_pro.skt":
multi_pro_gen = True
else:
multi_pro_gen = False
print("Found multi pro skt: ", multi_pro_gen )
out_xml('<FrameScroll> \r\n')
if touch_less_gen == True:
out_xml('<Max> 16 </Max>\r\n')
elif multi_pro_gen:
out_xml('<Max> 4 </Max>\r\n')
out_xml('<X> 10 </X>\r\n')
out_xml('<Y> 497 </Y>\r\n')
out_xml('<Width> 1080 </Width>\r\n')
out_xml('<ScrollHeight> "auto" </ScrollHeight>\r\n')
out_xml('<Scroll> "Vertical" </Scroll>\r\n')
if multi_pro_gen:
out_xml('<Column> 2 </Column>\r\n')
else:
out_xml('<Column> 4 </Column>\r\n')
out_xml('<Script>\r\n')
print("current_file_name " + current_file_name)
if touch_less_gen == False or multi_pro_gen:
out_xml('\t Var block_index_override = 0\r\n')
out_xml('\t Var block_index_move = 0\r\n')
else:
out_xml('\t Var block_index_override = 4\r\n')
out_xml('\t Var block_index_move = 1\r\n')
#out_xml('\t Var block_index_override = 4\r\n')
#out_xml('\t Var block_index_move = 1\r\n')
#out_xml('\tIf Seeker = "curr" Then\r\n')
#out_xml('\t\tVar TouchLessStg = "Enable"\r\n')
#out_xml('\t\tVar TouchLessQrStg = "Enable"\r\n')
#out_xml('\tElse\r\n')
#out_xml('\t\tVar TouchLessStg = "Disable"\r\n')
#out_xml('\t\tVar TouchLessQrStg = "Invisible"\r\n')
#out_xml('\tEndIf\r\n')
#out_xml('\tIf WebAppShow = "Invisible" Then\r\n')
#out_xml('\t\tVar TouchLessStg = "Disable"\r\n')
#out_xml('\t\tVar TouchLessQrStg = "Invisible"\r\n')
#out_xml('\tEndIf\r\n')
out_xml('</Script>\r\n')
pd_code_available = '##-##-##-####'
count = 0
count_test = 0
#if touch_less_gen == True:
# out_xml( '<Block>\r\n')
# out_xml('\t<MarginLeft> 33 </MarginLeft>\r\n')
# out_xml('\t<MarginTop> 22 </MarginTop>\r\n')
# out_xml('\t<Width> 225 </Width>\r\n')
# out_xml('\t<Height> 296 </Height>\r\n')
# out_xml('\t<State> "Enable" </State> \r\n')
# out_xml('\t<Image>\r\n')
# out_xml('\t<X> 0 </X>\r\n')
# out_xml('\t<Y> 0 </Y>\r\n')
# out_xml('\t<State> TouchLessStg </State> \r\n')
# out_xml('\t<Filename> Var( DirImage + "/touch_less_order.png" )</Filename>\r\n')
# out_xml('\t<FilenameDisable> Var( DirImage + "/touch_less_order_db.png" )</FilenameDisable>\r\n')
# out_xml('\t</Image>\r\n')
# out_xml('\t<QRCode>\r\n')
# out_xml('\t<X> 40 </X>\r\n')
# out_xml('\t<Y> 153 </Y>\r\n')
# out_xml('\t<Width> 150 </Width>\r\n')
# out_xml('\t<Color> "0xeae6e1" </Color>\r\n')
# out_xml('\t<QRColor> "0x513C2F" </Color>\r\n')
# out_xml('\t<Height> 150 </Height>\r\n')
#
# #out_xml('\t<State> TouchLessQrStg </State>\r\n')
# #out_xml('\t<Service> "Herr" </Service>\r\n')
# out_xml('\t<State> TouchLessQrStg </State>\r\n')
# out_xml('\t<Service> testservice </Service>\r\n')
#
# out_xml('\t</QRCode>\r\n')
# out_xml('</Block>\r\n')
out_xml(';dummy_layout.inc\r\n')
#
#out_xml('; menu_new_list '+ str(len(menu_new_list))+'\r\n')
def GenListMenu():
for spl in menu_new_list:
# print("menu_new_list",spl)
#product_code = s
#if spl[ idx_of_eng] == "IGNORE":
# continue
if len(spl) == 1:
if spl[0].startswith("TAG"):
out_xml( '\t;' + spl[0] + '\r\n')
print("Have TAGESP")
continue
print( '\t; '+ spl[ idx_name][ idx_hot_product_code] + ' ' + spl[ idx_name][ idx_cold_product_code] + ' ' + spl[ idx_name][ idx_blend_product_code] + ' \r\n')
# print(spl[ idx_name][ idx_hot_product_code] ,spl[ idx_name][ idx_cold_product_code],spl[ idx_name][ idx_blend_product_code])
if "," in spl[ idx_name][ idx_hot_product_code] and "," in spl[ idx_name][ idx_cold_product_code] and "," in spl[ idx_name][ idx_blend_product_code]:
#print(" hot = " + spl[ idx_name][ idx_hot_product_code])
hot_pd = spl[ idx_name][ idx_hot_product_code].split(',')
cold_pd = spl[ idx_name][ idx_cold_product_code].split(',')
blend_pd = spl[ idx_name][ idx_blend_product_code].split(',')
#print(' size = ' + str( len( hot_pd)) + ' size = ' + str( len( cold_pd)) + ' size = ' + str( len( blend_pd)) + '\r\n')
list_size = len( hot_pd)
# TODO: add check by season
if gen_season_pass and multi_pro_gen and current_file_name == "page_catalog_group_recommend_multi_pro.skt":
# check with season_pass_menu
# 1. is spl[2][8] has any set-X define
season_setx = spl[idx_img][8].split('-')
# print("expect season define", season_setx)
print("current ---> ",current_file_name)
if len(season_setx) == 1:
print("skip by multi pro and season flag")
continue
# current_season = season_setx[1]
is_bot_right = len(season_setx) > 2 and season_setx[2] != None and season_setx[2] == 'sm'
if not is_bot_right:
continue
for idx in range( list_size):
# use_v2 = hot_pd[1] != '-' or cold_pd[ 1] != '-' or blend_pd[ 1] != '-'
# if list_size > 1 and gen_season_pass and idx == 0 and spl[idx_img][8].endswith('-sm') and use_v2:
# continue
print(' hot = ' + hot_pd[ idx] + ' cold = ' + cold_pd[ idx]+ ' blend_pd = ' + blend_pd[ idx] + '\r\n')
if hot_pd[ idx] == '-' and cold_pd[ idx] == '-' and blend_pd[ idx] == '-':
print("\t\t==> ignore ")
else:
print("\t\t==> gen ")
GenMenuProductCodeBlock(spl, hot_pd[ idx], cold_pd[ idx], blend_pd[ idx] )
else:
GenMenuBlock(spl, idx_hot_product_code, idx_cold_product_code, idx_blend_product_code)
#out_xml( '\t; parallel '+ spl[ idx_name][ idx_hot_product_code2] + ' ' + spl[ idx_name][ idx_cold_product_code2] + ' ' + spl[ idx_name][ idx_blend_product_code2] + ' \r\n')
print("++++++++++++++++++++++++++++++ " + str( count_test) , spl, idx_hot_product_code, idx_cold_product_code, idx_blend_product_code, len(spl[idx_name]))
#count_test = count_test + 1
#if count_test > 5 :
# break
if len( spl[idx_name] ) >= 11:
if spl[ idx_name][ idx_hot_product_code2] != "-" or spl[ idx_name][ idx_cold_product_code2] != "-" or spl[ idx_name][ idx_blend_product_code2] != "-":
GenMenuBlock(spl, idx_hot_product_code2, idx_cold_product_code2, idx_blend_product_code2)
if multi_pro_gen:
print("multi_pro_gen")
for i in range(1, 5):
out_xml(';block'+str(i)+'\r\n')
out_xml('\t<Block>\r\n')
out_xml('\t\t<State> \"Enable\" </State> \r\n')
# out_xml('\t\t<MarginTop> 22 </MarginTop>\r\n')
# out_xml('\t\t<MarginLeft> 33 </MarginLeft>\r\n')
out_xml('\t\t<Width> 516 </Width>\r\n')
out_xml('\t\t<Height> 636 </Height>\r\n')
out_xml('\t\t<FrameScroll>\r\n')
out_xml('\t\t\t<Max> 4 </Max>\r\n')
out_xml('\t\t\t<X> 0 </X>\r\n')
out_xml('\t\t\t<Y> 0 </Y>\r\n')
out_xml('\t\t\t<Width> 516 </Width>\r\n')
out_xml('\t\t\t<Height> 636 </Height>\r\n')
out_xml('\t\t\t<ScrollHeight> "auto" </ScrollHeight>\r\n')
out_xml('\t\t\t<Scroll> "Vertical" </Scroll>\r\n')
out_xml('\t\t\t<Column> 2 </Column>\r\n')
out_xml('\t\t\t<Script>\r\n')
out_xml('\t\t\t\tVar block_index_override = 0\r\n')
out_xml('\t\t\t\tVar block_index_move = 0\r\n')
out_xml('\t\t\t</Script>\r\n')
out_xml(";season-sm-block"+'\r\n')
GenListMenu()
out_xml(";end-season-sm-block"+'\r\n')
out_xml('\t\t</FrameScroll>\r\n')
out_xml('\t\t</Block>\r\n')
out_xml(';endblock'+str(i)+'\r\n')
else:
out_xml('; menu_new_list '+ str(len(menu_new_list))+'\r\n')
GenListMenu()
out_xml('</FrameScroll>\r\n')
out_xml('; Cart\r\n')
out_xml('<Button>\r\n')
out_xml('<X> 915 </X>\r\n')
out_xml('<Y> 1769 </Y>\r\n')
out_xml('<State> showCart </State>\r\n')
out_xml('<Filename> cart_image_bn </Filename>\r\n')
out_xml('<FilenamePress> cart_image_bp </FilenamePress>\r\n')
out_xml('<Sound> "/mnt/sdcard/coffeevending/wav/click.wav" </Sound>\r\n')
out_xml('<Volume> SoundVolume </Volume>\r\n')
out_xml('<EventClick> \r\n')
out_xml('\tOpen "ROOT/taobin_project/xml/page_payment_multi.xml"\r\n')
out_xml('</EventClick>\r\n')
out_xml('</Button>\r\n')
# if "v2" in param: