URI: 
       tpop up menu for invoices - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit 3305c0048a4dbbe73b5f09f6ab63654c3fc60300
   DIR parent 14dfa6f5b0dcdf1d62afd09778d3f996b106349c
  HTML Author: ThomasV <thomasv@gitorious>
       Date:   Sat,  7 Jun 2014 12:45:56 +0200
       
       pop up menu for invoices
       
       Diffstat:
         M gui/qt/main_window.py               |      28 +++++++++++++++++++++-------
       
       1 file changed, 21 insertions(+), 7 deletions(-)
       ---
   DIR diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py
       t@@ -117,6 +117,7 @@ class ElectrumWindow(QMainWindow):
        
                self.decimal_point = config.get('decimal_point', 5)
                self.num_zeros     = int(config.get('num_zeros',0))
       +        self.invoices      = {}
        
                set_language(config.get('language'))
        
       t@@ -192,6 +193,7 @@ class ElectrumWindow(QMainWindow):
                self.wallet = wallet
                self.update_wallet_format()
        
       +        self.invoices = self.wallet.storage.get('invoices', {})
                self.accounts_expanded = self.wallet.storage.get('accounts_expanded',{})
                self.current_account = self.wallet.storage.get("current_account", None)
                title = 'Electrum ' + self.wallet.electrum_version + '  -  ' + self.wallet.storage.path
       t@@ -926,9 +928,8 @@ class ElectrumWindow(QMainWindow):
                pr = self.gui_object.payment_request
                pr_id = pr.get_id()
                # save it
       -        invoices = self.wallet.storage.get('invoices', {})
       -        invoices[pr_id] = (pr.get_domain(), pr.get_amount())
       -        invoices = self.wallet.storage.put('invoices', invoices)
       +        self.invoices[pr_id] = (pr.get_domain(), pr.get_amount())
       +        self.wallet.storage.put('invoices', self.invoices)
                self.update_invoices_tab()
        
                self.payto_help.show()
       t@@ -1061,11 +1062,9 @@ class ElectrumWindow(QMainWindow):
        
        
            def create_invoices_tab(self):
       -        l,w,hbox = self.create_list_tab([_('Recipient'), _('Amount'), _('Status')])
       +        l,w,hbox = self.create_list_tab([_('Requestor'), _('Amount'), _('Status')])
                l.setContextMenuPolicy(Qt.CustomContextMenu)
       -        #l.customContextMenuRequested.connect(self.create_contact_menu)
       -        #self.connect(l, SIGNAL('itemDoubleClicked(QTreeWidgetItem*, int)'), lambda a, b: self.address_label_clicked(a,b,l,0,1))
       -        #self.connect(l, SIGNAL('itemChanged(QTreeWidgetItem*, int)'), lambda a,b: self.address_label_changed(a,b,l,0,1))
       +        l.customContextMenuRequested.connect(self.create_invoice_menu)
                self.invoices_list = l
                hbox.addStretch(1)
                return w
       t@@ -1221,6 +1220,21 @@ class ElectrumWindow(QMainWindow):
                run_hook('create_contact_menu', menu, item)
                menu.exec_(self.contacts_list.viewport().mapToGlobal(position))
        
       +    def delete_invoice(self, item):
       +        k = self.invoices_list.indexOfTopLevelItem(item)
       +        key = self.invoices.keys()[k]
       +        self.invoices.pop(key)
       +        self.wallet.storage.put('invoices', self.invoices)
       +        self.update_invoices_tab()
       +
       +    def create_invoice_menu(self, position):
       +        item = self.invoices_list.itemAt(position)
       +        if not item:
       +            return
       +        menu = QMenu()
       +        menu.addAction(_("Delete"), lambda: self.delete_invoice(item))
       +        menu.exec_(self.invoices_list.viewport().mapToGlobal(position))
       +
        
            def update_receive_item(self, item):
                item.setFont(0, QFont(MONOSPACE_FONT))