taobin_project/xml/menu_gen_org.py
2020-12-21 21:24:08 +07:00

132 lines
5.7 KiB
Python

if menu_count >= 16:
scroll_height = 1670
else:
scroll_height = 1400
out_xml('<FrameScroll> \r\n')
out_xml('<X> 0 </X>\r\n')
out_xml('<Y> 497 </Y>\r\n')
out_xml('<Width> 1080 </Width>\r\n')
out_xml('<Height> 1500 </Height>\r\n')
out_xml('<ScrollHeight> ' + str(scroll_height) + ' </ScrollHeight>\r\n')
out_xml('<Scroll> "Vertical" </Scroll>\r\n')
for i in range( menu_count):
i_str = str(i + 1)
out_xml( '\t; button i='+ i_str + ' ' + product_code[i]+ ' \r\n')
out_xml( '\t<Button>\r\n')
out_xml( '\t<X> ' + str(x_button[i]) + ' </X> \r\n')
out_xml( '\t<Y> ' + str(y_button[i]) + ' </Y> \r\n')
out_xml( '\t<State> $' + product_code[i] + '.Button </State> \r\n')
out_xml( '\t<Filename> Var( "' + default_dir + '" + $'+ product_code[i] +'.image ) </Filename>\r\n')
out_xml( '\t<FilenamePress> Var( "' + default_dir_press + '" + $'+ product_code[i] +'.image ) " </FilenamePress>\r\n')
out_xml( '\t<FilenameDisable> Var( "' + default_dir_disable + '" + $'+ product_code[i] +'.image ) " </FilenameDisable>\r\n')
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')
out_xml( '\t\tVar SelectDrink = "'+ product_code[i] +'"\r\n')
out_xml( '\t\tVar NameDrink = $' + product_code[i] + '.NameE\r\n')
out_xml( '\t\tVar NameDrinkTH = $' + product_code[i] + '.Name\r\n')
out_xml( '\t\tVar DrinkDescriptionTH = $' + product_code[i] + '.description\r\n')
out_xml( '\t\tVar DrinkDescription = $' + product_code[i] + '.descriptionE\r\n')
out_xml( '\t\tVar PriceDrink = $' + product_code[i] + '.Price\r\n')
out_xml( '\t\tVar PictureDrink = "' + default_dir2 + '" + $'+ product_code[i] +'.image\r\n')
out_xml( '\t\tTopping "Load" SelectDrink\r\n')
#out_xml( '\t\tSAVELOG NameDrink\r\n')
out_xml( '\t\tVar PriceShowValue = charOfBaht + PriceDrink\r\n')
#out_xml( '\t\tVar PriceShowValue = "Free"\r\n')
out_xml( '\t\tOpen "ROOT/taobin_project/xml/page_topping_alter.xml"\r\n')
out_xml( '\t</EventOnClick>\r\n')
out_xml( '\t</Button>\r\n')
for i in range( menu_count):
if RoadShow :
out_xml( '\t<Text>\r\n')
out_xml( '\t<X> ' + str(x_button[i] + 164) + ' </X>\r\n')
out_xml( '\t<Y> ' + str(y_button[i] + 12) + ' </Y>\r\n')
out_xml( '\t<Width>200</Width>\r\n')
out_xml( '\t<Size> 27 </Size>\r\n')
out_xml( '\t<Font> KanitTTF </Font>\r\n')
out_xml( '\t<Color> 0xB78F24 </Color>\r\n')
out_xml( '\t<Value> "Free!" </Value>\r\n')
out_xml( '\t</Text>\r\n')
out_xml( '\t<Text>\r\n')
else:
out_xml( '\t<Text>\r\n')
out_xml( '\t<X> ' + str(x_button[i] + 182) + ' </X>\r\n')
out_xml( '\t<Y> ' + str(y_button[i] + 12) + ' </Y>\r\n')
out_xml( '\t<State> ShowPrice </State>\r\n')
out_xml( '\t<Align> "Hurr" </Align>\r\n')
out_xml( '\t<Width>150</Width>\r\n')
out_xml( '\t<Size> 27 </Size>\r\n')
out_xml( '\t<Font> KanitTTF </Font>\r\n')
out_xml( '\t<Color> 0xB78F24 </Color>\r\n')
out_xml( '\t<Value> $' + product_code[i] + '.Price </Value>\r\n')
out_xml( '\t</Text>\r\n')
out_xml( '\t<Text>\r\n')
out_xml( '\t<X> ' + str(x_button[i] + 164) + ' </X>\r\n')
out_xml( '\t<Y> ' + str(y_button[i] + 12) + ' </Y>\r\n')
out_xml( '\t<State> ShowPrice </State>\r\n')
out_xml( '\t<Width>20</Width>\r\n')
out_xml( '\t<Size> 27 </Size>\r\n')
out_xml( '\t<Font> KanitTTF </Font>\r\n')
out_xml( '\t<Color> 0xB78F24 </Color>\r\n')
out_xml( '\t<Value> "฿"" </Value>\r\n')
out_xml( '\t</Text>\r\n')
out_xml( '\t<Text>\r\n')
out_xml( '\t<X> ' + str(x_button[i] + 16) + ' </X>\r\n')
out_xml( '\t<Y> ' + str(y_button[i] + 190) + ' </Y>\r\n')
out_xml( '\t<Size> 24 </Size>\r\n')
out_xml( '\t<Width>220</Width>\r\n')
out_xml( '\t<Mode> "multi2" </Mode>\r\n')
out_xml( '\t<Font> KanitMediumTTF </Font>\r\n')
out_xml( '\t<Color> 0x322B26 </Color>\r\n')
out_xml( '\t<State> showthaiText </State>\r\n')
out_xml( '\t<Value> $' + product_code[i] + '.Name </Value>\r\n')
out_xml( '\t</Text>\r\n')
out_xml( '\t<Text>\r\n')
out_xml( '\t<X> ' + str(x_button[i] + 16) + ' </X>\r\n')
out_xml( '\t<Y> ' + str(y_button[i] + 246) + ' </Y>\r\n')
out_xml( '\t<Size> 14 </Size>\r\n')
out_xml( '\t<Width>220</Width>\r\n')
out_xml( '\t<Font> KanitMediumTTF </Font>\r\n')
out_xml( '\t<Color> 0x6F5F51 </Color>\r\n')
out_xml( '\t<State> showthaiText </State>\r\n')
out_xml( '\t<Value> $' + product_code[i] + '.description </Value>\r\n')
out_xml( '\t</Text>\r\n')
out_xml( '\t<Text>\r\n')
out_xml( '\t<X> ' + str(x_button[i] + 16) + ' </X>\r\n')
out_xml( '\t<Y> ' + str(y_button[i] + 190) + ' </Y>\r\n')
out_xml( '\t<Size> 22 </Size>\r\n')
out_xml( '\t<Width>220</Width>\r\n')
out_xml( '\t<Mode> "multi2" </Mode>\r\n')
out_xml( '\t<Font> KanitMediumTTF </Font>\r\n')
out_xml( '\t<Color> 0x322B26 </Color>\r\n')
out_xml( '\t<State> showengText </State>\r\n')
out_xml( '\t<Value> $' + product_code[i] + '.NameE </Value>\r\n')
out_xml( '\t</Text>\r\n')
out_xml( '\t<Text>\r\n')
out_xml( '\t<X> ' + str(x_button[i] + 16) + ' </X>\r\n')
out_xml( '\t<Y> ' + str(y_button[i] + 246) + ' </Y>\r\n')
out_xml( '\t<Size> 14 </Size>\r\n')
out_xml( '\t<Width>220</Width>\r\n')
out_xml( '\t<Font> KanitMediumTTF </Font>\r\n')
out_xml( '\t<Color> 0x6F5F51 </Color>\r\n')
out_xml( '\t<State> showengText </State>\r\n')
out_xml( '\t<Value> $' + product_code[i] + '.descriptionE </Value>\r\n')
out_xml( '\t</Text>\r\n')
out_xml('</FrameScroll>\r\n')