wallet.get_label method
This commit is contained in:
parent
254a5d8790
commit
765201be4e
|
@ -1235,9 +1235,7 @@ class ElectrumWindow:
|
||||||
conf_icon = gtk.STOCK_EXECUTE
|
conf_icon = gtk.STOCK_EXECUTE
|
||||||
v = self.wallet.get_tx_value(tx_hash)
|
v = self.wallet.get_tx_value(tx_hash)
|
||||||
balance += v
|
balance += v
|
||||||
label = self.wallet.labels.get(tx_hash)
|
label, is_default_label = self.wallet.get_label(tx_hash)
|
||||||
is_default_label = (label == '') or (label is None)
|
|
||||||
if is_default_label: label = tx['default_label']
|
|
||||||
tooltip = tx_hash + "\n%d confirmations"%conf
|
tooltip = tx_hash + "\n%d confirmations"%conf
|
||||||
|
|
||||||
inputs = map(lambda x: x.get('address'), tx['inputs'])
|
inputs = map(lambda x: x.get('address'), tx['inputs'])
|
||||||
|
|
|
@ -440,10 +440,10 @@ class MiniWindow(QDialog):
|
||||||
def update_history(self, tx_history):
|
def update_history(self, tx_history):
|
||||||
for tx in tx_history[-10:]:
|
for tx in tx_history[-10:]:
|
||||||
tx_hash = tx['tx_hash']
|
tx_hash = tx['tx_hash']
|
||||||
address = self.actuator.wallet.get_default_label(tx_hash)
|
label = self.actuator.wallet.get_label(tx_hash)[0]
|
||||||
value = self.actuator.wallet.get_tx_value(tx_hash)
|
value = self.actuator.wallet.get_tx_value(tx_hash)
|
||||||
amount = D(value) / 10**8
|
amount = D(value) / 10**8
|
||||||
self.history_list.append(address, amount)
|
self.history_list.append(label, amount)
|
||||||
|
|
||||||
def acceptbit(self):
|
def acceptbit(self):
|
||||||
self.actuator.acceptbit(self.quote_currencies[0])
|
self.actuator.acceptbit(self.quote_currencies[0])
|
||||||
|
|
|
@ -449,10 +449,7 @@ class ElectrumWindow(QMainWindow):
|
||||||
icon = QIcon(":icons/unconfirmed.png")
|
icon = QIcon(":icons/unconfirmed.png")
|
||||||
v = self.wallet.get_tx_value(tx_hash)
|
v = self.wallet.get_tx_value(tx_hash)
|
||||||
balance += v
|
balance += v
|
||||||
label = self.wallet.labels.get(tx_hash)
|
label, is_default_label = self.wallet.get_label(tx_hash)
|
||||||
is_default_label = (label == '') or (label is None)
|
|
||||||
if is_default_label:
|
|
||||||
label = self.wallet.get_default_label(tx_hash)
|
|
||||||
|
|
||||||
item = QTreeWidgetItem( [ '', time_str, label, format_satoshis(v,True,self.wallet.num_zeros), format_satoshis(balance,False,self.wallet.num_zeros)] )
|
item = QTreeWidgetItem( [ '', time_str, label, format_satoshis(v,True,self.wallet.num_zeros), format_satoshis(balance,False,self.wallet.num_zeros)] )
|
||||||
item.setFont(2, QFont(MONOSPACE_FONT))
|
item.setFont(2, QFont(MONOSPACE_FONT))
|
||||||
|
|
|
@ -74,10 +74,7 @@ class ElectrumGui:
|
||||||
time_str = 'pending'
|
time_str = 'pending'
|
||||||
tx_hash = tx['tx_hash']
|
tx_hash = tx['tx_hash']
|
||||||
|
|
||||||
label = self.wallet.labels.get(tx_hash)
|
label, is_default_label = self.wallet.get_label(tx_hash)
|
||||||
is_default_label = (label == '') or (label is None)
|
|
||||||
if is_default_label: label = tx['default_label']
|
|
||||||
|
|
||||||
#label += ' '*(40 - len(label) )
|
#label += ' '*(40 - len(label) )
|
||||||
messages.append( format_str%( time_str, label, format_satoshis(v), format_satoshis(b) ) )
|
messages.append( format_str%( time_str, label, format_satoshis(v), format_satoshis(b) ) )
|
||||||
|
|
||||||
|
|
|
@ -572,6 +572,12 @@ class Wallet:
|
||||||
return out
|
return out
|
||||||
|
|
||||||
|
|
||||||
|
def get_label(self, tx_hash):
|
||||||
|
label = self.labels.get(tx_hash)
|
||||||
|
is_default = (label == '') or (label is None)
|
||||||
|
if is_default: label = self.get_default_label(tx_hash)
|
||||||
|
return label, is_default
|
||||||
|
|
||||||
def get_default_label(self, tx_hash):
|
def get_default_label(self, tx_hash):
|
||||||
tx = self.transactions.get(tx_hash)
|
tx = self.transactions.get(tx_hash)
|
||||||
if tx:
|
if tx:
|
||||||
|
|
Loading…
Reference in New Issue