1
0

Merge pull request #10376 from accumulator/fix_10335

qt: don't store python tuple in a qt QVariant.
This commit is contained in:
ghost43
2025-12-18 12:54:29 +00:00
committed by GitHub

View File

@@ -44,6 +44,7 @@ from ..messages import MSG_FREEZE_ADDRESS
if TYPE_CHECKING: if TYPE_CHECKING:
from .main_window import ElectrumWindow from .main_window import ElectrumWindow
from electrum.wallet import AddressIndexGeneric
class AddressUsageStateFilter(IntEnum): class AddressUsageStateFilter(IntEnum):
@@ -219,9 +220,9 @@ class AddressList(MyTreeView):
else: else:
address_item[self.Columns.TYPE].setText(_('receiving')) address_item[self.Columns.TYPE].setText(_('receiving'))
address_item[self.Columns.TYPE].setBackground(ColorScheme.GREEN.as_color(True)) address_item[self.Columns.TYPE].setBackground(ColorScheme.GREEN.as_color(True))
address_item[0].setData(address, self.ROLE_ADDRESS_STR) address_item[self.Columns.TYPE].setData(address, self.ROLE_ADDRESS_STR)
address_path = self.wallet.get_address_index(address) address_path = self.wallet.get_address_index(address)
address_item[self.Columns.TYPE].setData(address_path, self.ROLE_SORT_ORDER) address_item[self.Columns.TYPE].setData(self.address_index_as_sortable_key(address_path), self.ROLE_SORT_ORDER)
address_path_str = self.wallet.get_address_path_str(address) address_path_str = self.wallet.get_address_path_str(address)
if address_path_str is not None: if address_path_str is not None:
address_item[self.Columns.TYPE].setToolTip(address_path_str) address_item[self.Columns.TYPE].setToolTip(address_path_str)
@@ -243,6 +244,9 @@ class AddressList(MyTreeView):
# update counter # update counter
self.num_addr_label.setText(_("{} addresses").format(num_shown)) self.num_addr_label.setText(_("{} addresses").format(num_shown))
def address_index_as_sortable_key(self, address_index: 'AddressIndexGeneric'):
return address_index if isinstance(address_index, str) else ''.join(f'{i:08x}' for i in address_index)
def refresh_row(self, key, row): def refresh_row(self, key, row):
assert row is not None assert row is not None
address = key address = key