Changeset 319 for trunk/sandbox/jhb/mobile/ocwallet.py
- Timestamp:
- 05/23/09 02:06:34 (3 years ago)
- Files:
-
- 1 modified
-
trunk/sandbox/jhb/mobile/ocwallet.py (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/sandbox/jhb/mobile/ocwallet.py
r318 r319 48 48 appuifw.app.title = u'opencoin wallet\nall currencies' 49 49 appuifw.app.menu = [(u'add currency',self.addCurrency), 50 (u'delete currency',self.delCurrency)] 50 (u'delete currency',self.delCurrency), 51 (u'new password',self.newPassword),] 51 52 52 53 def displayActionMenu(self): … … 426 427 self.ip = s.getsockname()[0] 427 428 429 428 430 429 431 def stopInternet(self): 430 432 pass 433 434 435 def newPassword(self): 436 password = appuifw.query(u'new password','text') 437 if password != None: 438 self.storage.setPassword(password) 439 appuifw.note(u'new password set','conf') 440 441 442 443 431 444 432 445 def filmIt(foo=None): … … 459 472 460 473 ############################### main code ############################ 474 475 #what port do we listen on? 461 476 walletport = 9091 477 478 #setting up the environment 462 479 app_lock = e32.Ao_lock() 463 480 appuifw.app.screen='normal' 481 482 #this will return normal control to the main code once the exit key is pressed 464 483 appuifw.app.exit_key_handler = app_lock.signal 484 465 485 import oc2 466 486 import sys 487 488 #finding out where we are, in order to get the icons 467 489 oc2path = oc2.__file__ 468 490 if sys.platform == 'symbian_s60': … … 474 496 #standalone app 475 497 mediapath = u'%s\\private\\%s\\' % (basedrive,appuifw.app.uid()) 498 storagepath=u'e:\\' 476 499 else: 477 500 mediapath = u'' 501 storagepath=u'' 478 502 479 503 #only for documenting it … … 481 505 #filmIt() 482 506 507 #set up the icons 483 508 names = dict(coin=0,opencoin=1,coins=2,detail=3,down=4,left=5,refresh=6, 484 509 restore=7,right=8,save=9,up=10,zoom=11) … … 487 512 startup('storage') 488 513 from oc2 import storage as oc2storage 514 515 #Try to use a password on the data file. Repeat till its sucessfully loaded 489 516 password = '' 490 517 while 1: … … 493 520 if password == None: 494 521 sys.exit() 495 startup(' encrypted data')522 startup('data...') 496 523 storage = oc2storage.CryptedStorage() 497 524 storage.setPassword(password) 498 storage.setFilename( 'wallet.bin')525 storage.setFilename(storagepath+'wallet.bin') 499 526 try: 500 527 storage.restore() 501 528 break 502 529 except: 530 appuifw.note(u'wrong password','error') 503 531 pass 504 532 505 533 #Load the rest of the libs 506 534 startup('netlib') 507 535 import httplib, urllib … … 516 544 from oc2 import transports 517 545 startup('media') 518 519 520 521 546 coinsound = audio.Sound.open(mediapath+u'coinsound.wav') 522 523 524 #appuifw.app.screen='full'525 startup('coins')526 547 startup('done') 548 549 #Ok, fire up the real wallet 527 550 w = WalletClient(storage) 528 import time 551 552 #this makes the app running till a signal (by the exit key) is given 529 553 app_lock.wait() 554 555 #Saving the data (encrypting it on the fly) 530 556 status('Shut down:saving data...',icons['save']) 531 557 storage.save() 532 558 status('Shut down:exit',icons['save']) 559 560 #give a bit of time to read the last message 561 import time 533 562 time.sleep(1)
