taobin_project/xml/v3/menu_new_layout_gen_v3.py
2025-04-09 10:53:45 +07:00

545 lines
23 KiB
Python

if "v3" in param:
if current_file_name == "page_catalog_group_recommend.skt":
recommend_page = True
button_add_string = "Var OpenFromInstMenuTab = 0"
else:
recommend_page = False
button_add_string = ""
out_xml('<ScrollableCatalog>\n')
out_xml('\t<X> 0 </X>\n')
out_xml('\t<Y> 497 </Y>\n')
out_xml('\t<Width> 1080 </Width>\n')
out_xml('\t<Height> 1423 </Height>\n')
out_xml('\t<Configuration>\n')
out_xml('\t\t<MenuNameTextConfiguration>\n')
out_xml('\t\t\t<Font> KanitMediumTTF </Font>\n')
out_xml('\t\t\t<Color> 0x322B26 </Color>\n')
out_xml('\t\t\t<ColorDisable> 0xEAE6E1 </ColorDisable>\n')
out_xml('\t\t\t<AutoResizeConfiguration>\n')
out_xml('\t\t\t\t<Min> 16 </Min>\n')
out_xml('\t\t\t\t<Max> 22 </Max>\n')
out_xml('\t\t\t\t<AdjustStep> 1 </AdjustStep>\n')
out_xml('\t\t\t</AutoResizeConfiguration>\n')
out_xml('\t\t</MenuNameTextConfiguration>\n')
out_xml('\t\t<MenuDescriptionTextConfiguration>\n')
out_xml('\t\t\t<Font> KanitMediumTTF </Font>\n')
out_xml('\t\t\t<Color> 0x322B26 </Color>\n')
out_xml('\t\t\t<ColorDisable> 0xEAE6E1 </ColorDisable>\n')
out_xml('\t\t\t<AutoResizeConfiguration>\n')
out_xml('\t\t\t\t<Min> 10 </Min>\n')
out_xml('\t\t\t\t<Max> 14 </Max>\n')
out_xml('\t\t\t\t<AdjustStep> 1 </AdjustStep>\n')
out_xml('\t\t\t</AutoResizeConfiguration>\n')
out_xml('\t\t</MenuDescriptionTextConfiguration>\n')
out_xml('\t\t<MenuPriceTextConfiguration>\n')
out_xml('\t\t\t<Font> KanitRegularTTF </Font>\n')
out_xml('\t\t\t<Color> 0x6F5F51 </Color>\n')
out_xml('\t\t\t<ColorDisable> 0xEAE6E1 </ColorDisable>\n')
out_xml('\t\t\t<AutoResizeConfiguration>\n')
out_xml('\t\t\t\t<Min> 4 </Min>\n')
out_xml('\t\t\t\t<Max> 20 </Max>\n')
out_xml('\t\t\t\t<AdjustStep> 1 </AdjustStep>\n')
out_xml('\t\t\t</AutoResizeConfiguration>\n')
out_xml('\t\t</MenuPriceTextConfiguration>\n')
out_xml('\t\t<MenuHotPriceLabel>\n')
out_xml('\t\t\teval(\n')
out_xml('\t\t\t\tIf show_eng = "true" Then\n')
out_xml('\t\t\t\t\tVar return = "Hot"\n')
out_xml('\t\t\t\tElse\n')
out_xml('\t\t\t\t\tVar return = "ร้อน"\n')
out_xml('\t\t\t\tEndIf\n')
out_xml('\t\t\t)\n')
out_xml('\t\t</MenuHotPriceLabel>\n')
out_xml('\t\t<MenuIcePriceLabel>\n')
out_xml('\t\t\teval(\n')
out_xml('\t\t\t\tIf show_eng = "true" Then\n')
out_xml('\t\t\t\t\tVar return = "Ice"\n')
out_xml('\t\t\t\tElse\n')
out_xml('\t\t\t\t\tVar return = "เย็น"\n')
out_xml('\t\t\t\tEndIf\n')
out_xml('\t\t\t)\n')
out_xml('\t\t</MenuIcePriceLabel>\n')
out_xml('\t\t<MenuBlendPriceLabel>\n')
out_xml('\t\t\teval(\n')
out_xml('\t\t\t\tIf show_eng = "true" Then\n')
out_xml('\t\t\t\t\tVar return ="Blend"\n')
out_xml('\t\t\t\tElse\n')
out_xml('\t\t\t\t\tVar return = "ปั่น"\n')
out_xml('\t\t\t\tEndIf\n')
out_xml('\t\t\t)\n')
out_xml('\t\t</MenuBlendPriceLabel>\n')
out_xml('\t\t<MenuUnavailableLabel>\n')
out_xml('\t\t\teval(\n')
out_xml('\t\t\t\tIf show_eng = "true" Then\n')
out_xml('\t\t\t\t\tVar return ="UNAVAILABLE"\n')
out_xml('\t\t\t\tElse\n')
out_xml('\t\t\t\t\tVar return = "หมด"\n')
out_xml('\t\t\t\tEndIf\n')
out_xml('\t\t\t)\n')
out_xml('\t\t</MenuUnavailableLabel>\n')
out_xml('\t</Configuration>\n')
out_xml('\t<Menus>\n')
out_xml(';banners\n')
count_test = 0
count = 0
pd_code_available = '##-##-##-####'
def GenMenuV3(spl):
out_xml( '\t\t; ==================> Len = ' + str(len(spl)) + '\n')
menu_img = spl[7]
out_xml( '\t\t; '+ spl[4] + ' ' + spl[5] + ' ' + spl[6]+ ' \n')
str_con = ""
str_con_var = ""
if spl[4] != '-':
str_con += spl[4] + '.Button,'
if spl[5] != '-':
str_con += spl[5] + '.Button,'
if spl[6] != '-':
str_con += spl[6] + '.Button,'
if spl[4] != '-':
str_con_var += spl[4] + '-'
if spl[5] != '-':
str_con_var += spl[5] + '-'
if spl[6] != '-':
str_con_var += spl[6] + '-'
str_con_var = str_con_var.replace("-", "")
if re.match(r'(\d{4})/(\d{2})/(\d{2})T(\d{2}):(\d{2}):(\d{2})', spl[12].strip()):
str_con += f'DateTimeStart="{spl[12].strip()}",'
if re.match(r'(\d{4})/(\d{2})/(\d{2})T(\d{2}):(\d{2}):(\d{2})', spl[13].strip()):
str_con += f'DateTimeEnd="{spl[13].strip()}",'
if re.match(r'^\w.*', spl[14].strip()):
str_con += f'Var={spl[14].strip()},'
if recommend_page:
str_con += "Disable=Invisible,"
str_con += "$Sum" + str_con_var
out_xml('\t\t<Menu>\n')
out_xml('\t\t<State> Flag( '+ str_con + ') </State>\n')
pd_code_1 = spl[4]
pd_stage1 = '$' + spl[4] + '.Button'
if spl[4] == "-" or len(spl[4]) == 0 :
pd_code_1 = pd_code_available
pd_stage1 = '"Disable2"'
pd_code_2 = spl[5]
pd_stage2 = '$' + spl[5] + '.Button'
if spl[5] == "-" or len(spl[5]) == 0:
pd_code_2 = pd_code_available
pd_stage2 = '"Disable2"'
pd_code_3 = spl[6]
pd_stage3 = '$' + spl[6] + '.Button'
if spl[6] == "-" or len(spl[6]) == 0:
pd_code_3 = pd_code_available
pd_stage3 = '"Disable2"'
if menu_img.startswith("#"):
out_xml( '\t\t<IdleImage> '+ menu_img[1:] + '_resting </IdleImage>\n')
out_xml( '\t\t<PressImage> '+ menu_img[1:] + '_press </PressImage>\n')
out_xml( '\t\t<DisableImage> '+ menu_img[1:] + '_disable </DisableImage>\n')
else:
out_xml( '\t\t<IdleImage> "' + new_default_dir + '/'+ menu_img +'" </IdleImage>\n')
out_xml( '\t\t<PressImage> "' + new_default_dir_press + '/'+ menu_img +'" </PressImage>\n')
out_xml( '\t\t<DisableImage> "' + new_default_dir_disable + '/'+ menu_img +'" </DisableImage>\n')
if spl[1] != "None":
out_xml('\t\t<Name>\n')
out_xml('\t\t\teval(\n')
out_xml('\t\t\t\tIf show_eng = "true" Then\n')
out_xml('\t\t\t\t\tVar return = "' + spl[1] + '"\n')
out_xml('\t\t\t\tElse\n')
out_xml('\t\t\t\t\tVar return = "' + spl[0] + '"\n')
out_xml('\t\t\t\tEndIf\n')
out_xml('\t\t\t)\n')
out_xml('\t\t</Name>\n')
out_xml('\t\t<Description>\n')
out_xml('\t\t\teval(\n')
out_xml('\t\t\t\tIf show_eng = "true" Then\n')
out_xml('\t\t\t\t\tVar return = "' + spl[3] + '"\n')
out_xml('\t\t\t\tElse\n')
out_xml('\t\t\t\t\tVar return = "' + spl[2] + '"\n')
out_xml('\t\t\t\tEndIf\n')
out_xml('\t\t\t)\n')
out_xml('\t\t</Description>\n')
out_xml('\t\t<HotState> ' + pd_stage1 + ' </HotState>\n')
out_xml('\t\t<IceState> ' + pd_stage2 + ' </IceState>\n')
out_xml('\t\t<BlendState> ' + pd_stage3 + ' </BlendState>\n')
out_xml('\t\t<HotPrice> StringFmt( $' + pd_code_1 + '.Price , DisplayFormat, PreScaleConvertShow) </HotPrice>\n')
out_xml('\t\t<IcePrice> StringFmt( $' + pd_code_2 + '.Price , DisplayFormat, PreScaleConvertShow) </IcePrice>\n')
out_xml('\t\t<BlendPrice> StringFmt( $' + pd_code_3 + '.Price , DisplayFormat, PreScaleConvertShow) </BlendPrice>\n')
out_xml('\t\t<IceProcessingState>\n')
out_xml('\t\t\teval(\n')
out_xml('\t\t\t\tIf ICE_PROCESS_STATUS = 2 Then\n')
out_xml('\t\t\t\t\tIf $Sum510201003951020200395102030039 = "Disable" Then\n')
out_xml('\t\t\t\t\t\tVar ice_tab_process_show = "Disable"\n')
out_xml('\t\t\t\t\tElse\n')
out_xml('\t\t\t\t\t\tVar ice_tab_process_show = "Enable"\n')
out_xml('\t\t\t\t\tEndIf\n')
out_xml('\t\t\t\tElse\n')
out_xml('\t\t\t\t\tVar ice_tab_process_show = "Invisible"\n')
out_xml('\t\t\t\tEndIf\n')
out_xml('\t\t\t\tVar return = ice_tab_process_show\n')
out_xml('\t\t\t)\n')
out_xml('\t\t</IceProcessingState>\n')
out_xml('\t\t<IceProcessingImage> "ROOT/taobin_project/image/drink_option/ice_tab_unavalible.png" </IceProcessingImage>\n')
out_xml('\t\t<IceProcessingDisableImage> "ROOT/taobin_project/image/drink_option/ice_tab_unavalible_dis.png" </IceProcessingDisableImage>\n')
out_xml('\t\t<EventOnClick>\n')
if menu_img.startswith("#"):
out_xml( '\t\tVar PictureDrink = bn_oreo_vo_get1_full_path\r\n')
else:
out_xml( '\t\tVar PictureDrink = "' + new_default_dir2 + '" + \"' + menu_img + '\"\r\n')
out_xml('\t\t\tVar OpenFromXML = CurrentXMLFileName2\n')
out_xml('\t\t\tVar PriceD1 = $' + pd_code_1 + '.Price\n')
out_xml('\t\t\tVar PriceD2 = $' + pd_code_2 + '.Price\n')
out_xml('\t\t\tVar PriceD3 = $' + pd_code_3 + '.Price\n')
out_xml('\t\t\tVar PD_CODE1 = "' + pd_code_1 + '"\n')
out_xml('\t\t\tVar PD_CODE2 = "' + pd_code_2 + '"\n')
out_xml('\t\t\tVar PD_CODE3 = "' + pd_code_3 + '"\n')
out_xml('\t\t\tVar PD_STAGE_1 = ' + pd_stage1 + '\n')
out_xml('\t\t\tVar PD_STAGE_2 = ' + pd_stage2 + '\n')
out_xml('\t\t\tVar PD_STAGE_3 = ' + pd_stage3 + '\n')
if len( spl) > 11:
if spl[4] != '-':
menu_xml_var = 'xmlpro( '+spl[4]+', "ROOT/taobin_project/image/menu_overlay_set/button_overlay_pic_%s_'+ spl[11] +'.png")'
elif spl[6] != '-':
menu_xml_var = 'xmlpro( '+spl[6]+', "ROOT/taobin_project/image/menu_overlay_set/button_overlay_pic_%s_'+ spl[11] +'.png")'
else:
menu_xml_var = 'xmlpro( '+spl[5]+', "ROOT/taobin_project/image/menu_overlay_set/button_overlay_pic_%s_'+ spl[11] +'.png")'
if len( menu_xml_var) > 0:
out_xml( '\t\t\tVar OverlayMenuFilter !assigned ' + menu_xml_var + '\n')
out_xml( '\t\t\tDEBUGVAR OverlayMenuFilter\n')
out_xml( '\t\t\tVar SelectCountDrinkType = 0\n')
out_xml( '\t\t\tVar DefaultDrinkType = 0\n')
out_xml( '\t\t\tIf PD_STAGE_1 = "Enable" Then\n')
out_xml( '\t\t\t\tVar SelectCountDrinkType = SelectCountDrinkType + 1\n')
out_xml( '\t\t\t\tVar DefaultDrinkType = 1\n')
out_xml( '\t\t\tEndIf\n')
out_xml( '\t\t\tIf PD_STAGE_2 = "Enable" Then\n')
out_xml( '\t\t\t\tVar SelectCountDrinkType = SelectCountDrinkType + 1\n')
out_xml( '\t\t\t\tVar DefaultDrinkType = 2\n')
out_xml( '\t\t\tEndIf\n')
out_xml( '\t\t\tIf PD_STAGE_3 = "Enable" Then\n')
out_xml( '\t\t\t\tVar SelectCountDrinkType = SelectCountDrinkType + 1\n')
out_xml( '\t\t\t\tVar DefaultDrinkType = 3\n')
out_xml( '\t\t\tEndIf\n')
out_xml( '\t\t\tIf PD_STAGE_2 = "Enable" Then\n')
#out_xml( \t'\t\t\tVar PD_STAGE_2 = "Enable"\n')
out_xml( '\t\t\t\tTopping "Load" "'+ spl[5].replace("-alter", "") +'"\n')
out_xml( '\t\t\tElse\n')
out_xml( '\t\t\t\tIf PD_STAGE_1 = "Enable" Then\n')
#out_xml( \t'\t\t\t\tVar PD_STAGE_1 = "Enable"\n')
out_xml( '\t\t\t\tTopping "Load" "'+ spl[4].replace("-alter", "") +'"\n')
out_xml( '\t\t\t\tElse\n')
#out_xml( \t'\t\t\t\tVar PD_STAGE_3 = "Enable"\n')
out_xml( '\t\t\t\tTopping "Load" "'+ spl[6].replace("-alter", "") +'"\n')
out_xml( '\t\t\t\tEndIf\n')
out_xml( '\t\t\tEndIf\n')
out_xml( '\t\t\tVar menu_name_eng_hot = $' + pd_code_1 + '.NameE\n')
out_xml( '\t\t\tVar menu_desc_eng_hot = $' + pd_code_1 + '.descriptionE\n')
out_xml( '\t\t\tVar menu_name_thai_hot = $' + pd_code_1 + '.Name\n')
out_xml( '\t\t\tVar menu_desc_thai_hot = $' + pd_code_1 + '.description\n')
out_xml( '\t\t\t\n')
out_xml( '\t\t\tVar menu_name_eng_cold = $' + pd_code_2 + '.NameE\n')
out_xml( '\t\t\tVar menu_desc_eng_cold = $' + pd_code_2 + '.descriptionE\n')
out_xml( '\t\t\tVar menu_name_thai_cold = $' + pd_code_2 + '.Name\n')
out_xml( '\t\t\tVar menu_desc_thai_cold = $' + pd_code_2 + '.description\n')
out_xml( '\t\t\t\n')
out_xml( '\t\t\tVar menu_name_eng_blender = $' + pd_code_3 + '.NameE\n')
out_xml( '\t\t\tVar menu_desc_eng_blender = $' + pd_code_3 + '.descriptionE\n')
out_xml( '\t\t\tVar menu_name_thai_blender = $' + pd_code_3 + '.Name\n')
out_xml( '\t\t\tVar menu_desc_thai_blender = $' + pd_code_3 + '.description\n')
out_xml( '\t\t\t\n')
out_xml( '\t\t\tDEBUGVAR PD_STAGE_1\n')
out_xml( '\t\t\tDEBUGVAR PD_STAGE_2\n')
out_xml( '\t\t\tDEBUGVAR PD_STAGE_3\n')
out_xml( '\t\t\tVar SelectDrinkType = 0\n')
out_xml( '\t\t\t'+ button_add_string +'\n')
out_xml( '\t\t\tOpen "ROOT/taobin_project/xml/page_topping_select5.xml"\n')
out_xml('\t\t</EventOnClick>\n')
out_xml('\t\t</Menu>\n\n')
if spl[8] != '-' or spl[9] != '-' or spl[10] != '-':
menu_img = spl[7]
out_xml( '\t\t; '+ spl[8] + ' ' + spl[9] + ' ' + spl[10]+ ' \n')
str_con = ""
str_con_var = ""
if spl[8] != '-':
str_con += spl[8] + '.Button,'
if spl[9] != '-':
str_con += spl[9] + '.Button,'
if spl[10] != '-':
str_con += spl[10] + '.Button,'
if spl[8] != '-':
str_con_var += spl[8] + '-'
if spl[9] != '-':
str_con_var += spl[9] + '-'
if spl[10] != '-':
str_con_var += spl[10] + '-'
str_con_var = str_con_var.replace("-", "")
if re.match(r'(\d{4})/(\d{2})/(\d{2})T(\d{2}):(\d{2}):(\d{2})', spl[12].strip()):
str_con += f'DateTimeStart="{spl[12].strip()}",'
if re.match(r'(\d{4})/(\d{2})/(\d{2})T(\d{2}):(\d{2}):(\d{2})', spl[13].strip()):
str_con += f'DateTimeEnd="{spl[13].strip()}",'
if re.match(r'^\w.*', spl[14].strip()):
str_con += f'Var={spl[14].strip()},'
if recommend_page:
str_con += "Disable=Invisible,"
str_con += "$Sum" + str_con_var
out_xml('\t\t<Menu>\n')
out_xml('\t\t<State> Flag( '+ str_con + ') </State>\n')
pd_code_1 = spl[8]
pd_stage1 = '$' + spl[8] + '.Button'
if spl[8] == "-" or len(spl[8]) == 0 :
pd_code_1 = pd_code_available
pd_stage1 = '"Disable2"'
pd_code_2 = spl[9]
pd_stage2 = '$' + spl[9] + '.Button'
if spl[9] == "-" or len(spl[9]) == 0:
pd_code_2 = pd_code_available
pd_stage2 = '"Disable2"'
pd_code_3 = spl[10]
pd_stage3 = '$' + spl[10] + '.Button'
if spl[10] == "-" or len(spl[10]) == 0:
pd_code_3 = pd_code_available
pd_stage3 = '"Disable2"'
if menu_img.startswith("#"):
out_xml( '\t\t<IdleImage> '+ menu_img[1:] + '_resting </IdleImage>\n')
out_xml( '\t\t<PressImage> '+ menu_img[1:] + '_press </PressImage>\n')
out_xml( '\t\t<DisableImage> '+ menu_img[1:] + '_disable </DisableImage>\n')
else:
out_xml( '\t\t<IdleImage> "' + new_default_dir + '/'+ menu_img +'" </IdleImage>\n')
out_xml( '\t\t<PressImage> "' + new_default_dir_press + '/'+ menu_img +'" </PressImage>\n')
out_xml( '\t\t<DisableImage> "' + new_default_dir_disable + '/'+ menu_img +'" </DisableImage>\n')
if spl[1] != "None":
out_xml('\t\t<Name>\n')
out_xml('\t\t\teval(\n')
out_xml('\t\t\t\tIf show_eng = "true" Then\n')
out_xml('\t\t\t\t\tVar return = "' + spl[1] + '"\n')
out_xml('\t\t\t\tElse\n')
out_xml('\t\t\t\t\tVar return = "' + spl[0] + '"\n')
out_xml('\t\t\t\tEndIf\n')
out_xml('\t\t\t)\n')
out_xml('\t\t</Name>\n')
out_xml('\t\t<Description>\n')
out_xml('\t\t\teval(\n')
out_xml('\t\t\t\tIf show_eng = "true" Then\n')
out_xml('\t\t\t\t\tVar return = "' + spl[3] + '"\n')
out_xml('\t\t\t\tElse\n')
out_xml('\t\t\t\t\tVar return = "' + spl[2] + '"\n')
out_xml('\t\t\t\tEndIf\n')
out_xml('\t\t\t)\n')
out_xml('\t\t</Description>\n')
out_xml('\t\t<HotState> ' + pd_stage1 + ' </HotState>\n')
out_xml('\t\t<IceState> ' + pd_stage2 + ' </IceState>\n')
out_xml('\t\t<BlendState> ' + pd_stage3 + ' </BlendState>\n')
out_xml('\t\t<HotPrice> StringFmt( $' + pd_code_1 + '.Price , DisplayFormat, PreScaleConvertShow) </HotPrice>\n')
out_xml('\t\t<IcePrice> StringFmt( $' + pd_code_2 + '.Price , DisplayFormat, PreScaleConvertShow) </IcePrice>\n')
out_xml('\t\t<BlendPrice> StringFmt( $' + pd_code_3 + '.Price , DisplayFormat, PreScaleConvertShow) </BlendPrice>\n')
out_xml('\t\t<IceProcessingState>\n')
out_xml('\t\t\teval(\n')
out_xml('\t\t\t\tIf ICE_PROCESS_STATUS = 2 Then\n')
out_xml('\t\t\t\t\tIf $Sum510201003951020200395102030039 = "Disable" Then\n')
out_xml('\t\t\t\t\t\tVar ice_tab_process_show = "Disable"\n')
out_xml('\t\t\t\t\tElse\n')
out_xml('\t\t\t\t\t\tVar ice_tab_process_show = "Enable"\n')
out_xml('\t\t\t\t\tEndIf\n')
out_xml('\t\t\t\tElse\n')
out_xml('\t\t\t\t\tVar ice_tab_process_show = "Invisible"\n')
out_xml('\t\t\t\tEndIf\n')
out_xml('\t\t\t\tVar return = ice_tab_process_show\n')
out_xml('\t\t\t)\n')
out_xml('\t\t</IceProcessingState>\n')
out_xml('\t\t<IceProcessingImage> "ROOT/taobin_project/image/drink_option/ice_tab_unavalible.png" </IceProcessingImage>\n')
out_xml('\t\t<IceProcessingDisableImage> "ROOT/taobin_project/image/drink_option/ice_tab_unavalible_dis.png" </IceProcessingDisableImage>\n')
out_xml('\t\t<EventOnClick>\n')
if menu_img.startswith("#"):
out_xml( '\t\tVar PictureDrink = bn_oreo_vo_get1_full_path\r\n')
else:
out_xml( '\t\tVar PictureDrink = "' + new_default_dir2 + '" + \"' + menu_img + '\"\r\n')
out_xml('\t\t\tVar OpenFromXML = CurrentXMLFileName2\n')
out_xml('\t\t\tVar PriceD1 = $' + pd_code_1 + '.Price\n')
out_xml('\t\t\tVar PriceD2 = $' + pd_code_2 + '.Price\n')
out_xml('\t\t\tVar PriceD3 = $' + pd_code_3 + '.Price\n')
out_xml('\t\t\tVar PD_CODE1 = "' + pd_code_1 + '"\n')
out_xml('\t\t\tVar PD_CODE2 = "' + pd_code_2 + '"\n')
out_xml('\t\t\tVar PD_CODE3 = "' + pd_code_3 + '"\n')
out_xml('\t\t\tVar PD_STAGE_1 = ' + pd_stage1 + '\n')
out_xml('\t\t\tVar PD_STAGE_2 = ' + pd_stage2 + '\n')
out_xml('\t\t\tVar PD_STAGE_3 = ' + pd_stage3 + '\n')
if len( spl) > 11:
if spl[8] != '-':
menu_xml_var = 'xmlpro( '+spl[8]+', "ROOT/taobin_project/image/menu_overlay_set/button_overlay_pic_%s_'+ spl[11] +'.png")'
elif spl[9] != '-':
menu_xml_var = 'xmlpro( '+spl[9]+', "ROOT/taobin_project/image/menu_overlay_set/button_overlay_pic_%s_'+ spl[11] +'.png")'
else:
menu_xml_var = 'xmlpro( '+spl[10]+', "ROOT/taobin_project/image/menu_overlay_set/button_overlay_pic_%s_'+ spl[11] +'.png")'
if len( menu_xml_var) > 0:
out_xml( '\t\t\tVar OverlayMenuFilter !assigned ' + menu_xml_var + '\n')
out_xml( '\t\t\tDEBUGVAR OverlayMenuFilter\n')
out_xml( '\t\t\tVar SelectCountDrinkType = 0\n')
out_xml( '\t\t\tVar DefaultDrinkType = 0\n')
out_xml( '\t\t\tIf PD_STAGE_1 = "Enable" Then\n')
out_xml( '\t\t\t\tVar SelectCountDrinkType = SelectCountDrinkType + 1\n')
out_xml( '\t\t\t\tVar DefaultDrinkType = 1\n')
out_xml( '\t\t\tEndIf\n')
out_xml( '\t\t\tIf PD_STAGE_2 = "Enable" Then\n')
out_xml( '\t\t\t\tVar SelectCountDrinkType = SelectCountDrinkType + 1\n')
out_xml( '\t\t\t\tVar DefaultDrinkType = 2\n')
out_xml( '\t\t\tEndIf\n')
out_xml( '\t\t\tIf PD_STAGE_3 = "Enable" Then\n')
out_xml( '\t\t\t\tVar SelectCountDrinkType = SelectCountDrinkType + 1\n')
out_xml( '\t\t\t\tVar DefaultDrinkType = 3\n')
out_xml( '\t\t\tEndIf\n')
out_xml( '\t\t\tIf PD_STAGE_2 = "Enable" Then\n')
#out_xml( \t'\t\t\tVar PD_STAGE_2 = "Enable"\n')
out_xml( '\t\t\t\tTopping "Load" "'+ spl[10].replace("-alter", "") +'"\n')
out_xml( '\t\t\tElse\n')
out_xml( '\t\t\t\tIf PD_STAGE_1 = "Enable" Then\n')
#out_xml( \t'\t\t\t\tVar PD_STAGE_1 = "Enable"\n')
out_xml( '\t\t\t\tTopping "Load" "'+ spl[8].replace("-alter", "") +'"\n')
out_xml( '\t\t\t\tElse\n')
#out_xml( \t'\t\t\t\tVar PD_STAGE_3 = "Enable"\n')
out_xml( '\t\t\t\tTopping "Load" "'+ spl[9].replace("-alter", "") +'"\n')
out_xml( '\t\t\t\tEndIf\n')
out_xml( '\t\t\tEndIf\n')
out_xml( '\t\t\tVar menu_name_eng_hot = $' + pd_code_1 + '.NameE\n')
out_xml( '\t\t\tVar menu_desc_eng_hot = $' + pd_code_1 + '.descriptionE\n')
out_xml( '\t\t\tVar menu_name_thai_hot = $' + pd_code_1 + '.Name\n')
out_xml( '\t\t\tVar menu_desc_thai_hot = $' + pd_code_1 + '.description\n')
out_xml( '\t\t\t\n')
out_xml( '\t\t\tVar menu_name_eng_cold = $' + pd_code_2 + '.NameE\n')
out_xml( '\t\t\tVar menu_desc_eng_cold = $' + pd_code_2 + '.descriptionE\n')
out_xml( '\t\t\tVar menu_name_thai_cold = $' + pd_code_2 + '.Name\n')
out_xml( '\t\t\tVar menu_desc_thai_cold = $' + pd_code_2 + '.description\n')
out_xml( '\t\t\t\n')
out_xml( '\t\t\tVar menu_name_eng_blender = $' + pd_code_3 + '.NameE\n')
out_xml( '\t\t\tVar menu_desc_eng_blender = $' + pd_code_3 + '.descriptionE\n')
out_xml( '\t\t\tVar menu_name_thai_blender = $' + pd_code_3 + '.Name\n')
out_xml( '\t\t\tVar menu_desc_thai_blender = $' + pd_code_3 + '.description\n')
out_xml( '\t\t\t\n')
out_xml( '\t\t\tDEBUGVAR PD_STAGE_1\n')
out_xml( '\t\t\tDEBUGVAR PD_STAGE_2\n')
out_xml( '\t\t\tDEBUGVAR PD_STAGE_3\n')
out_xml( '\t\t\tVar SelectDrinkType = 0\n')
out_xml( '\t\t\t'+ button_add_string +'\n')
out_xml( '\t\t\tOpen "ROOT/taobin_project/xml/page_topping_select5.xml"\n')
out_xml('\t\t</EventOnClick>\n')
out_xml('\t\t</Menu>\n\n')
def GenBanner(spl):
if re.match(r'(\d{4})/(\d{2})/(\d{2})T(\d{2}):(\d{2}):(\d{2})', spl[12].strip()):
str_con += f'DateTimeStart="{spl[12].strip()}",'
if re.match(r'(\d{4})/(\d{2})/(\d{2})T(\d{2}):(\d{2}):(\d{2})', spl[13].strip()):
str_con += f'DateTimeEnd="{spl[13].strip()}",'
if re.match(r'^\w.*', spl[14].strip()):
str_con += f'Var={spl[14].strip()},'
out_xml('\t\t<Banner>\n')
out_xml('\t\t\t<State> Flag( '+ str_con + ') </State>\n')
out_xml('\t\t\t<Type> ' + spl[4] + '</Type>\n')
out_xml('\t\t\t<Media>\n')
out_xml('\t\t\t\teval(\n')
out_xml('\t\t\t\t\tIf show_eng = "true" Then')
out_xml('\t\t\t\t\t\tVar return = ' + spl[5] + '\n')
out_xml('\t\t\t\t\tElse\n')
out_xml('\t\t\t\t\t\tVar return = ' + spl[6] + '\n')
out_xml('\t\t\t\t\tEndIf\n')
out_xml('\t\t\t\t)\n')
out_xml('\t\t\t</Media>\n')
out_xml('\t\t\t<EventOnClick>\n')
out_xml('\t\t\t\t' + spl[7] + '\n')
out_xml('\t\t\t</EventOnClick>\n')
out_xml('\t\t</Banner>\n')
def GenListMenu():
for spl in menu_new_list:
#product_code = s
if spl[0] == "IGNORE":
continue
if spl[0].startswith("TAG"):
out_xml( '\t;' + spl[0] + '\r\n')
continue
if spl[0].startswith("BANNER"):
GenBanner(spl)
else:
GenMenuV3(spl)
out_xml('\t\t; menu_new_list '+ str(len(menu_new_list))+'\n')
GenListMenu()
out_xml('\t</Menus>\n')
out_xml('</ScrollableCatalog>\n')