| 17 | | (u'Buy',u'Buy new coins',self.buyCoins), |
| 18 | | (u'Sell',u'Sell coins',self.getDetails), |
| 19 | | (u'Details',u'See what coins you hold',self.inspect),] |
| | 17 | (u'Buy',u'Buy new coins',self.mintCoins), |
| | 18 | (u'Sell',u'Sell coins',self.redeemCoins), |
| | 19 | (u'Details',u'See what coins you hold',self.inspectCurrency),] |
| 114 | | pass |
| 115 | | |
| 116 | | |
| | 114 | cdd,amount = self.getCurrentCurrency() |
| | 115 | id = cdd.currencyId |
| | 116 | coins = self.wallet.getAllCoins(id) |
| | 117 | coinlist = [] |
| | 118 | for coin in coins: |
| | 119 | coinlist.append(u'coin: %s' % coin.denomination) |
| | 120 | self.currency_menu = appuifw.Listbox(coinlist,self.inspectCoin) |
| | 121 | self.currency_menu.bind(EKeyRightArrow,self.inspectCoin) |
| | 122 | self.currency_menu.bind(EKeyLeftArrow,self.displayActionMenu) |
| | 123 | appuifw.app.body = self.currency_menu |
| | 124 | appuifw.app.title = u'opencoin - currency\nCoins in wallet' |
| | 125 | |
| | 126 | def inspectCoin(self): |
| | 127 | cdd,amount = self.getCurrentCurrency() |
| | 128 | id = cdd.currencyId |
| | 129 | coins = self.wallet.getAllCoins(id) |
| | 130 | coin = coins[self.currency_menu.current()] |
| | 131 | details = [] |
| | 132 | details.append((unicode(coin.standardId),u'Standard Id')) |
| | 133 | details.append((unicode(coin.currencyId),u'Currency Id')) |
| | 134 | details.append((unicode(coin.denomination),u'Denomination')) |
| | 135 | self.coin_menu = appuifw.Listbox(details,self.inspectCurrency) |
| | 136 | self.coin_menu.bind(EKeyLeftArrow,self.inspectCurrency) |
| | 137 | appuifw.app.body = self.coin_menu |
| | 138 | appuifw.app.title = u'opencoin - coin\nDetails of coin' |
| | 139 | |
| 151 | | self.wallet.buyCoins(transport,amount,target) |
| 152 | | self.makeWalletMenu() |
| 153 | | self.displayWalletMenu() |
| | 174 | self.wallet.mintCoins(transport,amount,target) |
| | 175 | self.makeWalletMenu() |
| | 176 | self.displayWalletMenu() |
| | 177 | |
| | 178 | |
| | 179 | def redeemCoins(self): |
| | 180 | amount = self.getAmount() |
| | 181 | if not amount: |
| | 182 | return |
| | 183 | |
| | 184 | target = self.getTarget() |
| | 185 | if not target: |
| | 186 | return |
| | 187 | |
| | 188 | cdd,alreadythere = self.getCurrentCurrency() |
| | 189 | url = cdd.issuerServiceLocation |
| | 190 | |
| | 191 | transport = transports.HTTPTransport(url) |
| | 192 | self.wallet.redeemCoins(transport,amount,target) |
| | 193 | self.makeWalletMenu() |
| | 194 | self.displayWalletMenu() |
| | 195 | |