|
|
@ -39,16 +39,18 @@ class AddressList(MyTreeWidget): |
|
|
|
self.refresh_headers() |
|
|
|
self.setSelectionMode(QAbstractItemView.ExtendedSelection) |
|
|
|
self.show_change = False |
|
|
|
self.show_used = 3 |
|
|
|
self.change_button = QToolButton(self) |
|
|
|
self.used_button = QToolButton(self) |
|
|
|
self.change_button.clicked.connect(self.toggle_change) |
|
|
|
self.used_button.clicked.connect(self.toggle_used) |
|
|
|
self.set_change_button_text() |
|
|
|
self.set_used_button_text() |
|
|
|
|
|
|
|
def get_buttons(self): |
|
|
|
return self.change_button, self.used_button |
|
|
|
self.show_used = 0 |
|
|
|
self.change_button = QComboBox(self) |
|
|
|
self.change_button.currentIndexChanged.connect(self.toggle_change) |
|
|
|
for t in [_('Change'), _('Receiving')]: |
|
|
|
self.change_button.addItem(t) |
|
|
|
self.used_button = QComboBox(self) |
|
|
|
self.used_button.currentIndexChanged.connect(self.toggle_used) |
|
|
|
for t in [_('All'), _('Unused'), _('Funded'), _('Used')]: |
|
|
|
self.used_button.addItem(t) |
|
|
|
|
|
|
|
def get_list_header(self): |
|
|
|
return QLabel(_("Filter:")), self.change_button, self.used_button |
|
|
|
|
|
|
|
def refresh_headers(self): |
|
|
|
headers = [ _('Address'), _('Label'), _('Balance')] |
|
|
@ -58,24 +60,19 @@ class AddressList(MyTreeWidget): |
|
|
|
headers.extend([_('Tx')]) |
|
|
|
self.update_headers(headers) |
|
|
|
|
|
|
|
def toggle_change(self): |
|
|
|
self.show_change = not self.show_change |
|
|
|
self.set_change_button_text() |
|
|
|
def toggle_change(self, show): |
|
|
|
show = bool(show) |
|
|
|
if show == self.show_change: |
|
|
|
return |
|
|
|
self.show_change = show |
|
|
|
self.update() |
|
|
|
|
|
|
|
def set_change_button_text(self): |
|
|
|
s = [_('Receiving'), _('Change')] |
|
|
|
self.change_button.setText(s[self.show_change]) |
|
|
|
|
|
|
|
def toggle_used(self): |
|
|
|
self.show_used = (self.show_used + 1) % 4 |
|
|
|
self.set_used_button_text() |
|
|
|
def toggle_used(self, state): |
|
|
|
if state == self.show_used: |
|
|
|
return |
|
|
|
self.show_used = state |
|
|
|
self.update() |
|
|
|
|
|
|
|
def set_used_button_text(self): |
|
|
|
s = [_('Unused'), _('Funded'), _('Used'), _('All')] |
|
|
|
self.used_button.setText(s[self.show_used]) |
|
|
|
|
|
|
|
def on_update(self): |
|
|
|
self.wallet = self.parent.wallet |
|
|
|
item = self.currentItem() |
|
|
|