本文整理汇总了Python中armoryengine.BDM.TheBDM.getState方法的典型用法代码示例。如果您正苦于以下问题:Python TheBDM.getState方法的具体用法?Python TheBDM.getState怎么用?Python TheBDM.getState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类armoryengine.BDM.TheBDM
的用法示例。
在下文中一共展示了TheBDM.getState方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setupTheBDM
# 需要导入模块: from armoryengine.BDM import TheBDM [as 别名]
# 或者: from armoryengine.BDM.TheBDM import getState [as 别名]
def setupTheBDM():
TheBDM.setBlocking(True)
if not TheBDM.getState()==BDM_BLOCKCHAIN_READY:
masterWallet.registerWallet()
TheBDM.setOnlineMode(True)
# Only executed on the first call if blockchain not loaded yet.
LOGINFO('Blockchain loading')
while not TheBDM.getState()==BDM_BLOCKCHAIN_READY:
LOGINFO('Blockchain Not Ready Yet %s' % TheBDM.getState())
time.sleep(2)
示例2: setUpClass
# 需要导入模块: from armoryengine.BDM import TheBDM [as 别名]
# 或者: from armoryengine.BDM.TheBDM import getState [as 别名]
def setUpClass(self):
global doneShuttingDownBDM
doneShuttingDownBDM = False
# Handle both calling the this test from the context of the test directory
# and calling this test from the context of the main directory.
# The latter happens if you run all of the tests in the directory
if os.path.exists(TIAB_ZIPFILE_NAME):
tiabZipPath = TIAB_ZIPFILE_NAME
elif os.path.exists(os.path.join('pytest',TIAB_ZIPFILE_NAME)):
tiabZipPath = (os.path.join('pytest',TIAB_ZIPFILE_NAME))
else:
self.fail(NEED_TIAB_MSG)
self.tiab = TiabSession(tiabZipPath=tiabZipPath)
newTheBDM()
self.armoryHomeDir = os.path.join(self.tiab.tiabDirectory,'tiab','armory')
TheBDM.setSatoshiDir(os.path.join(self.tiab.tiabDirectory,'tiab','1','testnet3'))
TheBDM.setArmoryDBDir(os.path.join(self.tiab.tiabDirectory,'tiab','armory','databases'))
TheBDM.goOnline(armoryDBDir=self.armoryHomeDir)
i = 0
while not TheBDM.getState()==BDM_BLOCKCHAIN_READY:
time.sleep(2)
i += 1
if i >= 60:
raise RuntimeError("Timeout waiting for TheBDM to get into BlockchainReady state.")
示例3: __init__
# 需要导入模块: from armoryengine.BDM import TheBDM [as 别名]
# 或者: from armoryengine.BDM.TheBDM import getState [as 别名]
def __init__(self, parent, main):
super(WalletWizard, self).__init__(parent, main)
self.newWallet = None
self.isBackupCreated = False
self.setWindowTitle(tr("Wallet Creation Wizard"))
self.setOption(QWizard.HaveFinishButtonOnEarlyPages, on=True)
self.setOption(QWizard.IgnoreSubTitles, on=True)
# Page 1: Create Wallet
self.walletCreationPage = WalletCreationPage(self)
self.addPage(self.walletCreationPage)
# Page 2: Set Passphrase
self.setPassphrasePage = SetPassphrasePage(self)
self.addPage(self.setPassphrasePage)
# Page 3: Verify Passphrase
self.verifyPassphrasePage = VerifyPassphrasePage(self)
self.addPage(self.verifyPassphrasePage)
# Page 4: Create Paper Backup
self.walletBackupPage = WalletBackupPage(self)
self.addPage(self.walletBackupPage)
# Page 5: Create Watching Only Wallet -- but only if expert, or offline
self.hasCWOWPage = False
if self.main.usermode == USERMODE.Expert or TheBDM.getState() == BDM_OFFLINE:
self.hasCWOWPage = True
self.createWOWPage = CreateWatchingOnlyWalletPage(self)
self.addPage(self.createWOWPage)
self.setButtonLayout([QWizard.BackButton, QWizard.Stretch, QWizard.NextButton, QWizard.FinishButton])
示例4: updateOnCoinControl
# 需要导入模块: from armoryengine.BDM import TheBDM [as 别名]
# 或者: from armoryengine.BDM.TheBDM import getState [as 别名]
def updateOnCoinControl(self):
useAllAddr = (self.altBalance == None)
wlt = self.main.walletMap[self.getSelectedWltID()]
fullBal = wlt.getBalance('Spendable')
if useAllAddr:
self.dispID.setText(wlt.uniqueIDB58)
self.dispName.setText(wlt.labelName)
self.dispDescr.setText(wlt.labelDescr)
if fullBal == 0:
self.dispBal.setText('0.0', color='TextRed', bold=True)
else:
self.dispBal.setValueText(fullBal, wBold=True)
else:
self.dispID.setText(wlt.uniqueIDB58 + '*')
self.dispName.setText(wlt.labelName + '*')
self.dispDescr.setText('*Coin Control Subset*', color='TextBlue', bold=True)
self.dispBal.setText(coin2str(self.altBalance, maxZeros=0), color='TextBlue')
rawValTxt = str(self.dispBal.text())
self.dispBal.setText(rawValTxt + ' <font color="%s">(of %s)</font>' % \
(htmlColor('DisableFG'), coin2str(fullBal, maxZeros=0)))
if not TheBDM.getState() == BDM_BLOCKCHAIN_READY:
self.dispBal.setText('(available when online)', color='DisableFG')
self.repaint()
if self.coinControlCallback:
self.coinControlCallback(self.sourceAddrList, self.altBalance)
示例5: updateOnWalletChange
# 需要导入模块: from armoryengine.BDM import TheBDM [as 别名]
# 或者: from armoryengine.BDM.TheBDM import getState [as 别名]
def updateOnWalletChange(self, ignoredInt=None):
"""
"ignoredInt" is because the signals should call this function with the
selected index of the relevant container, but we grab it again anyway
using getSelectedWltID()
"""
wltID = self.getSelectedWltID()
if len(wltID) > 0:
wlt = self.main.walletMap[wltID]
self.dispID.setText(wltID)
self.dispName.setText(wlt.labelName)
self.dispDescr.setText(wlt.labelDescr)
self.selectedID = wltID
if not TheBDM.getState() == BDM_BLOCKCHAIN_READY:
self.dispBal.setText('-' * 12)
else:
bal = wlt.getBalance('Spendable')
balStr = coin2str(wlt.getBalance('Spendable'), maxZeros=1)
if bal <= self.balAtLeast:
self.dispBal.setText('<font color="red"><b>%s</b></font>' % balStr)
else:
self.dispBal.setText('<b>' + balStr + '</b>')
if self.selectWltCallback:
self.selectWltCallback(wlt)
self.repaint()
# Reset the coin control variables after a new wallet is selected
if self.coinControlCallback:
self.altBalance = None
self.sourceAddrList = None
self.btnCoinCtrl.setEnabled(wlt.getBalance('Spendable')>0)
self.lblCoinCtrl.setText('Source: All addresses' if wlt.getBalance('Spendable')>0 else\
'Source: 0 addresses' )
self.updateOnCoinControl()
示例6: updateWalletTable
# 需要导入模块: from armoryengine.BDM import TheBDM [as 别名]
# 或者: from armoryengine.BDM.TheBDM import getState [as 别名]
def updateWalletTable(self):
numWallets = len(self.main.walletMap)
self.wltTable.setRowCount(numWallets)
self.wltTable.setColumnCount(4)
row = 0
for wltID, wltObj in self.main.walletMap.iteritems():
wltValueBTC = "(...)"
wltValueUSD = "(...)"
if TheBDM.getState() == BDM_BLOCKCHAIN_READY:
convertVal = float(self.lastSellStr.replace(",", ""))
wltBal = wltObj.getBalance("Total")
wltValueBTC = coin2str(wltBal, maxZeros=2)
wltValueUSD = "$" + self.addCommasToPrice("%0.2f" % (wltBal * convertVal / 1e8))
rowItems = []
rowItems.append(QTableWidgetItem(wltID))
rowItems.append(QTableWidgetItem(wltObj.labelName))
rowItems.append(QTableWidgetItem(wltValueBTC))
rowItems.append(QTableWidgetItem(wltValueUSD))
rowItems[-2].setTextAlignment(Qt.AlignRight)
rowItems[-1].setTextAlignment(Qt.AlignRight)
rowItems[-2].setFont(GETFONT("Fixed", 10))
rowItems[-1].setFont(GETFONT("Fixed", 10))
for i, item in enumerate(rowItems):
self.wltTable.setItem(row, i, item)
item.setFlags(Qt.NoItemFlags)
self.wltTable.setHorizontalHeaderItem(0, QTableWidgetItem(tr("Wallet ID")))
self.wltTable.setHorizontalHeaderItem(1, QTableWidgetItem(tr("Wallet Name")))
self.wltTable.setHorizontalHeaderItem(2, QTableWidgetItem(tr("BTC Balance")))
self.wltTable.setHorizontalHeaderItem(3, QTableWidgetItem(tr("USD ($) Value")))
self.wltTable.verticalHeader().hide()
row += 1
示例7: RightNow
# 需要导入模块: from armoryengine.BDM import TheBDM [as 别名]
# 或者: from armoryengine.BDM.TheBDM import getState [as 别名]
if run_LoadBlockchain_Async:
"""
By setting blocking=False, most calls to TheBDM will return immediately,
after queuing the BDM to execute the operation in the background. You have
to check back later to see when it's done. However, even when blocking is
false, any functions that return data must block so the data can be
returned. If you are in asynchronous mode, and don't want to ever wait
for anything, always check TheBDM.getState()==BDM_BLOCKCHAIN_READY before
requesting data that will force blocking.
"""
start = RightNow()
TheBDM.setBlocking(False)
TheBDM.setOnlineMode(True)
sleep(2)
print 'Waiting for blockchain loading to finish',
while not TheBDM.getState()==BDM_BLOCKCHAIN_READY:
print '.',
sys.stdout.flush()
sleep(2)
print 'Loading blockchain took %0.1f sec' % (RightNow() - start)
topBlock = TheBDM.getTopBlockHeight()
print '\n\nCurrent Top Block is:', topBlock
TheBDM.blockchain().top().pprint()
################################################################################
if run_LoadBlockchain_Block:
start = RightNow()
TheBDM.setBlocking(True)
TheBDM.setOnlineMode(True)
# The setOnlineMode should block until blockchain loading is complete