Advertisement
lukibeni

python kód

Oct 11th, 2014
368
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.46 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. '''
  3. Created on 2014.10.11.
  4.  
  5. @author: lukibeni
  6. '''
  7. import android
  8. import threading
  9. import sys
  10.  
  11. def warehouseSelect():
  12.     droid.dialogCreateAlert("Válasszon áruházat:")
  13.     droid.dialogSetPositiveButtonText("OK")
  14.     droid.dialogSetNegativeButtonText("Mégse")
  15.     malls2 = []
  16.     for s in malls:
  17.         malls2.append(s["name"])
  18.     droid.dialogSetSingleChoiceItems(malls2)
  19.     droid.dialogShow()
  20.    
  21. def newProduct():
  22.     print "newProductfuggveny meghívása"
  23.    
  24. droid = android.Android()
  25.  
  26. droid.webViewShow('file:///sdcard/sl4a/scripts/bevmobwebview.html').result
  27.  
  28. dummy_event = threading.Event()
  29. dummy_event.wait(timeout=5)
  30.  
  31. mall = {"Kenyér":"5", "Alma":"6", "Sör":"10"}
  32. malls = [{"id":"1","name":"Helyi ABC"}, {"id":"2","name":"Metro"}, {"id":"3","name":"Biciklisbolt"}]
  33.  
  34. for key, value in mall.iteritems() :
  35.     #pprint.pprint(key, value)
  36.     droid.eventPost("newrow", key + "::" + value)
  37.  
  38. droid.addOptionsMenuItem("Áruház","one","mall","ic_media_play")
  39. droid.addOptionsMenuItem("Új termék","two","newitem","ic_media_pause")
  40. droid.addOptionsMenuItem("Kilépés","three","quit","ic_media_stop")
  41.  
  42. while True:
  43.     response = droid.eventWait(30000).result
  44.     if response == None:
  45.         break
  46.     if response["name"]=="one":
  47.         warehouseSelect()
  48.     elif response["name"] == "two":
  49.         newProduct()
  50.     elif response["name"] == "three":
  51.         sys.exit(0)
  52.        
  53. droid.clearOptionsMenu()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement