- Timestamp:
- 06/02/09 17:38:02 (3 years ago)
- Files:
-
- 1 modified
-
trunk/sandbox/jhb/mobile/ocwallet.py (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/sandbox/jhb/mobile/ocwallet.py
r322 r323 1 import appuifw,e32,os,sys 1 import appuifw,e32,os,sys,time 2 2 3 3 def error_catched(f): … … 49 49 50 50 def feedback(self,text,cb=None): 51 self.setOptions(True) 51 52 status(unicode(text),callback=cb) 52 53 53 54 def setOptions(self,clear=False): 55 menu = [] 56 if clear: 57 appuifw.app.menu=[(u'Please wait...',lambda:None)] 58 return 59 if appuifw.app.body != self.wallet_menu: 60 menu.append((u'Main menu',self.displayWalletMenu)) 61 hascurrencies = self.wallet.listCurrencies() 62 if hascurrencies: 63 menu.extend([(u'Pay',self.spendCoins), 64 (u'Receive',self.receiveCoins), 65 (u'Get change',self.freshenUp), 66 (u'Widthdraw',self.mintCoins), 67 (u'Exchange back',self.redeemCoins)]) 68 if not hasattr(self,'currency_menu') or appuifw.app.body != self.currency_menu: 69 menu.append((u'Inspect currency',self.inspectCurrency)) 70 menu.append((u'--------',lambda:None)) 71 menu.append((u'add currency',self.addCurrency)) 72 if hascurrencies: 73 menu.append((u'delete currency',self.delCurrency)) 74 menu.append((u'new password',self.newPassword)) 75 appuifw.app.menu = menu 76 77 54 78 def displayWalletMenu(self): 55 79 self.makeWalletMenu() 56 80 appuifw.app.body = self.wallet_menu 57 81 appuifw.app.title = u'opencoin wallet\nall currencies' 58 appuifw.app.menu = [(u'add currency',self.addCurrency), 59 (u'delete currency',self.delCurrency), 60 (u'new password',self.newPassword),] 82 self.setOptions() 61 83 62 84 def displayActionMenu(self): … … 69 91 cdd,amount = self.getCurrentCurrency() 70 92 appuifw.app.title = u'%ss\nactions' % cdd.currencyId 93 self.setOptions() 71 94 #print 'displayActionMenu' 72 95 … … 120 143 appuifw.app.body = self.currency_menu 121 144 appuifw.app.title = u'%ss\ncoin list' % id 122 145 self.setOptions() 146 123 147 def inspectCoin(self): 124 148 cdd,amount = self.getCurrentCurrency() … … 136 160 appuifw.app.body = self.coin_menu 137 161 appuifw.app.title = u'%ss\ncoin details' % id 162 self.setOptions() 138 163 139 164 def addCurrency(self): … … 447 472 import socket 448 473 if sys.platform == 'symbian_s60': 449 self.feedback(u'Prepare internet: search access')474 self.feedback(u'Prepare internet:please wait...') 450 475 aps = [ap['name'] for ap in socket.access_points()] 451 476 aps.sort() 452 apid = appuifw.popup_menu(aps,u'select access') 477 time_taken=0 478 while time_taken < 1: 479 started = time.time() 480 apid = appuifw.popup_menu(aps,u'select access point') 481 time_taken = time.time() - started 453 482 if apid == None: 454 483 return None 455 self.feedback(u'Prepare interne :set access')484 self.feedback(u'Prepare internet:set access point') 456 485 457 486 socket.set_default_access_point(aps[apid]) … … 615 644 616 645 #give a bit of time to read the last message 617 import time618 646 time.sleep(1)
