electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 744073c2123d8fef1d35f6f08e6c8adc9b2972ab
parent 9e861b1192acbfe865705fdf19831cf22e99b90a
Author: ecdsa <ecdsa@github>
Date:   Sun,  3 Mar 2013 19:14:27 +0100

change column numbers, update pointofsale plugin

Diffstat:
Mgui/gui_classic.py | 21+++++++++------------
Mplugins/pointofsale.py | 14++++++++++----
2 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/gui/gui_classic.py b/gui/gui_classic.py @@ -260,7 +260,7 @@ def ok_cancel_buttons(dialog): default_column_widths = { "history":[40,140,350,140], "contacts":[350,330], - "receive":[[370],[370,200,130,130],[370,200,130,130]] } + "receive":[[370],[370,200,130]] } class ElectrumWindow(QMainWindow): @@ -898,7 +898,7 @@ class ElectrumWindow(QMainWindow): def create_receive_tab(self): - l,w,hbox = self.create_list_tab([ _('Address'), _('Label'), _(''), _('Balance'), _('Tx')]) + l,w,hbox = self.create_list_tab([ _('Address'), _('Label'), _('Balance'), _('Tx')]) l.setContextMenuPolicy(Qt.CustomContextMenu) l.customContextMenuRequested.connect(self.create_receive_menu) self.connect(l, SIGNAL('itemDoubleClicked(QTreeWidgetItem*, int)'), lambda a, b: self.address_label_clicked(a,b,l,0,1)) @@ -1036,6 +1036,7 @@ class ElectrumWindow(QMainWindow): def update_receive_item(self, item): + item.setFont(0, QFont(MONOSPACE_FONT)) address = str(item.data(0,0).toString()) label = self.wallet.labels.get(address,'') item.setData(1,0,label) @@ -1044,7 +1045,7 @@ class ElectrumWindow(QMainWindow): c, u = self.wallet.get_addr_balance(address) balance = format_satoshis( c + u, False, self.wallet.num_zeros ) - item.setData(3,0,balance) + item.setData(2,0,balance) if self.expert_mode: if address in self.wallet.frozen_addresses: @@ -1057,8 +1058,8 @@ class ElectrumWindow(QMainWindow): l = self.receive_list l.clear() + l.setColumnHidden(2, not self.expert_mode) l.setColumnHidden(3, not self.expert_mode) - l.setColumnHidden(4, not self.expert_mode) if not self.expert_mode: width = self.column_widths['receive'][0][0] l.setColumnWidth(0, width) @@ -1070,7 +1071,7 @@ class ElectrumWindow(QMainWindow): for k, account in self.wallet.accounts.items(): name = account.get('name',str(k)) c,u = self.wallet.get_account_balance(k) - account_item = QTreeWidgetItem( [ name, '', '', format_satoshis(c+u), ''] ) + account_item = QTreeWidgetItem( [ name, '', format_satoshis(c+u), ''] ) l.addTopLevelItem(account_item) account_item.setExpanded(True) @@ -1095,9 +1096,7 @@ class ElectrumWindow(QMainWindow): gap = 0 num_tx = '*' if h == ['*'] else "%d"%len(h) - item = QTreeWidgetItem( [ address, '', '', '', num_tx] ) - item.setFont(0, QFont(MONOSPACE_FONT)) - item.setFont(2, QFont(MONOSPACE_FONT)) + item = QTreeWidgetItem( [ address, '', '', num_tx] ) self.update_receive_item(item) if is_red: item.setBackgroundColor(1, QColor('red')) @@ -1105,13 +1104,11 @@ class ElectrumWindow(QMainWindow): if self.wallet.imported_keys: c,u = self.wallet.get_imported_balance() - account_item = QTreeWidgetItem( [ _('Imported'), '', '', format_satoshis(c+u), ''] ) + account_item = QTreeWidgetItem( [ _('Imported'), '', format_satoshis(c+u), ''] ) l.addTopLevelItem(account_item) account_item.setExpanded(True) for address in self.wallet.imported_keys.keys(): - item = QTreeWidgetItem( [ address, '', '', '', ''] ) - item.setFont(0, QFont(MONOSPACE_FONT)) - item.setFont(2, QFont(MONOSPACE_FONT)) + item = QTreeWidgetItem( [ address, '', '', ''] ) self.update_receive_item(item) account_item.addChild(item) diff --git a/plugins/pointofsale.py b/plugins/pointofsale.py @@ -20,6 +20,7 @@ elif platform.system() == 'Darwin': else: MONOSPACE_FONT = 'monospace' +column_index = 3 class QR_Window(QWidget): @@ -113,6 +114,9 @@ def toggle(gui): toggle_QR_window(gui, enabled) if enabled: + gui.expert_mode = True + gui.receive_list.setHeaderLabels([ _('Address'), _('Label'), _('Balance'), _('Request')]) + gui.set_hook('item_changed', item_changed) gui.set_hook('current_item_changed', recv_changed) gui.set_hook('receive_menu', receive_menu) @@ -120,6 +124,7 @@ def toggle(gui): gui.set_hook('timer_actions', timer_actions) gui.set_hook('close_main_window', close_main_window) else: + gui.receive_list.setHeaderLabels([ _('Address'), _('Label'), _('Balance'), _('Tx')]) gui.unset_hook('item_changed', item_changed) gui.unset_hook('current_item_changed', recv_changed) gui.unset_hook('receive_menu', receive_menu) @@ -158,7 +163,7 @@ def toggle_QR_window(self, show): def item_changed(self, item, column): - if column == 4: + if column == column_index: address = str( item.text(0) ) text = str( item.text(column) ) try: @@ -214,7 +219,7 @@ def edit_amount(self): l = self.receive_list item = l.currentItem() item.setFlags(Qt.ItemIsEditable|Qt.ItemIsSelectable | Qt.ItemIsUserCheckable | Qt.ItemIsEnabled | Qt.ItemIsDragEnabled) - l.editItem( item, 4 ) + l.editItem( item, column_index ) item.setFlags(Qt.ItemIsSelectable | Qt.ItemIsUserCheckable | Qt.ItemIsEnabled | Qt.ItemIsDragEnabled) def receive_menu(self, menu): @@ -227,9 +232,10 @@ def update_receive_item(self, address, item): except: print "cannot get requested amount", address, self.requested_amounts.get(address) amount, currency = None, None - + self.requested_amounts.pop(address) + amount_str = amount + (' ' + currency if currency else '') if amount is not None else '' - item.setData(4,0,amount_str) + item.setData(column_index,0,amount_str) def close_main_window(self):