|
|
@ -1498,7 +1498,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError): |
|
|
|
return w |
|
|
|
|
|
|
|
def create_addresses_tab(self): |
|
|
|
l = MyTreeWidget(self, self.create_receive_menu, [ _('Address'), _('Label'), _('Balance'), _('Tx')], 1) |
|
|
|
l = MyTreeWidget(self, self.create_address_menu, [ _('Address'), _('Label'), _('Balance'), _('Tx')], 1) |
|
|
|
l.setSelectionMode(QAbstractItemView.ExtendedSelection) |
|
|
|
l.on_update = self.update_address_tab |
|
|
|
self.address_list = l |
|
|
@ -1560,7 +1560,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError): |
|
|
|
menu.addAction(_("View details"), lambda: self.show_account_details(k)) |
|
|
|
menu.exec_(self.address_list.viewport().mapToGlobal(position)) |
|
|
|
|
|
|
|
def create_receive_menu(self, position): |
|
|
|
def create_address_menu(self, position): |
|
|
|
selected = self.address_list.selectedItems() |
|
|
|
multi_select = len(selected) > 1 |
|
|
|
addrs = [unicode(item.text(0)) for item in selected] |
|
|
@ -1576,7 +1576,6 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError): |
|
|
|
else: |
|
|
|
item.setExpanded(not item.isExpanded()) |
|
|
|
return |
|
|
|
|
|
|
|
menu = QMenu() |
|
|
|
if not multi_select: |
|
|
|
menu.addAction(_("Copy to clipboard"), lambda: self.app.clipboard().setText(addr)) |
|
|
@ -1799,23 +1798,32 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError): |
|
|
|
label = self.wallet.labels.get(address,'') |
|
|
|
c, u, x = self.wallet.get_addr_balance(address) |
|
|
|
balance = self.format_amount(c + u + x) |
|
|
|
item = QTreeWidgetItem([address, label, balance, "%d"%num]) |
|
|
|
item.setFont(0, QFont(MONOSPACE_FONT)) |
|
|
|
item.setData(0, Qt.UserRole, address) |
|
|
|
item.setData(0, Qt.UserRole+1, True) # label can be edited |
|
|
|
address_item = QTreeWidgetItem([address, label, balance, "%d"%num]) |
|
|
|
address_item.setFont(0, QFont(MONOSPACE_FONT)) |
|
|
|
address_item.setData(0, Qt.UserRole, address) |
|
|
|
address_item.setData(0, Qt.UserRole+1, True) # label can be edited |
|
|
|
if self.wallet.is_frozen(address): |
|
|
|
item.setBackgroundColor(0, QColor('lightblue')) |
|
|
|
address_item.setBackgroundColor(0, QColor('lightblue')) |
|
|
|
if self.wallet.is_beyond_limit(address, account, is_change): |
|
|
|
item.setBackgroundColor(0, QColor('red')) |
|
|
|
address_item.setBackgroundColor(0, QColor('red')) |
|
|
|
if is_used: |
|
|
|
if not used_flag: |
|
|
|
seq_item.insertChild(0, used_item) |
|
|
|
used_flag = True |
|
|
|
used_item.addChild(item) |
|
|
|
used_item.addChild(address_item) |
|
|
|
else: |
|
|
|
seq_item.addChild(item) |
|
|
|
seq_item.addChild(address_item) |
|
|
|
if address == current_address: |
|
|
|
l.setCurrentItem(item) |
|
|
|
l.setCurrentItem(address_item) |
|
|
|
# add utxos |
|
|
|
utxos = self.wallet.get_addr_utxo(address) |
|
|
|
for x in utxos: |
|
|
|
h = x.get('prevout_hash') |
|
|
|
s = h + ":%d"%x.get('prevout_n') |
|
|
|
label = self.wallet.get_label(h) |
|
|
|
utxo_item = QTreeWidgetItem([s, label, self.format_amount(x['value'])]) |
|
|
|
utxo_item.setFont(0, QFont(MONOSPACE_FONT)) |
|
|
|
address_item.addChild(utxo_item) |
|
|
|
|
|
|
|
|
|
|
|
def update_contacts_tab(self): |
|
|
|