コード例 #1
0
    def update_history_tab(self):
        cursor = self.history_treeview.get_cursor()[0]
        self.history_list.clear()

        for item in self.wallet.get_tx_history():
            tx_hash, conf, is_mine, value, fee, balance, timestamp = item
            if conf:
                try:
                    time_str = datetime.datetime.fromtimestamp(
                        timestamp).isoformat(' ')[:-3]
                except:
                    time_str = "------"
                conf_icon = gtk.STOCK_APPLY
            else:
                time_str = 'pending'
                conf_icon = gtk.STOCK_EXECUTE

            label, is_default_label = self.wallet.get_label(tx_hash)
            tooltip = tx_hash + "\n%d confirmations" % conf if tx_hash else ''
            details = self.wallet.get_tx_details(tx_hash)

            self.history_list.prepend([
                tx_hash, conf_icon, time_str, label, is_default_label,
                format_satoshis(value, True, self.wallet.num_zeros),
                format_satoshis(balance, False, self.wallet.num_zeros),
                tooltip, details
            ])
        if cursor: self.history_treeview.set_cursor(cursor)
コード例 #2
0
    def update_status_bar(self):
        interface = self.wallet.interface
        if self.funds_error:
            text = "Not enough funds"
        elif interface and interface.is_connected:
            self.network_button.set_tooltip_text("Connected to %s:%d.\n%d blocks"%(interface.host, interface.port, self.wallet.blocks))
            if self.wallet.blocks == -1:
                self.status_image.set_from_stock(gtk.STOCK_NO, gtk.ICON_SIZE_MENU)
                text = "Connecting..."
            elif self.wallet.blocks == 0:
                self.status_image.set_from_stock(gtk.STOCK_NO, gtk.ICON_SIZE_MENU)
                text = "Server not ready"
            elif not self.wallet.up_to_date:
                self.status_image.set_from_stock(gtk.STOCK_REFRESH, gtk.ICON_SIZE_MENU)
                text = "Synchronizing..."
            else:
                self.status_image.set_from_stock(gtk.STOCK_YES, gtk.ICON_SIZE_MENU)
                self.network_button.set_tooltip_text("Connected to %s:%d.\n%d blocks"%(interface.host, interface.port, self.wallet.blocks))
                c, u = self.wallet.get_balance()
                text =  "Balance: %s "%( format_satoshis(c,False,self.wallet.num_zeros) )
                if u: text +=  "[%s unconfirmed]"%( format_satoshis(u,True,self.wallet.num_zeros).strip() )
        else:
            self.status_image.set_from_stock(gtk.STOCK_NO, gtk.ICON_SIZE_MENU)
            self.network_button.set_tooltip_text("Trying to contact %s.\n%d blocks"%(interface.server, self.wallet.blocks))
            text = "Not connected"

        self.status_bar.pop(self.context_id) 
        self.status_bar.push(self.context_id, text)

        if self.wallet.was_updated and self.wallet.up_to_date:
            self.update_history_tab()
            self.update_receiving_tab()
            # addressbook too...
            self.info.set_text( self.wallet.banner )
            self.wallet.was_updated = False
コード例 #3
0
ファイル: gui.py プロジェクト: kepppu/electrum-n900
    def update_status_bar(self):

        if self.funds_error:
            text = "Not enough funds"
        elif self.wallet.interface.is_connected:
            self.network_button.set_tooltip_text("Connected to %s.\n%d blocks\nresponse time: %f"%(self.wallet.interface.host, self.wallet.interface.blocks, self.wallet.interface.rtime))
            if self.wallet.interface.blocks == 0:
                self.status_image.set_from_stock(gtk.STOCK_NO, gtk.ICON_SIZE_MENU)
                text = "Server not ready"
            elif not self.wallet.interface.was_polled:
                self.status_image.set_from_stock(gtk.STOCK_REFRESH, gtk.ICON_SIZE_MENU)
                text = "Synchronizing..."
            else:
                self.status_image.set_from_stock(gtk.STOCK_YES, gtk.ICON_SIZE_MENU)
                self.network_button.set_tooltip_text("Connected to %s.\n%d blocks\nresponse time: %f"%(self.wallet.interface.host, self.wallet.interface.blocks, self.wallet.interface.rtime))
                c, u = self.wallet.get_balance()
                text =  "Balance: %s "%( format_satoshis(c) )
                if u: text +=  "[%s unconfirmed]"%( format_satoshis(u,True) )
        else:
            self.status_image.set_from_stock(gtk.STOCK_NO, gtk.ICON_SIZE_MENU)
            self.network_button.set_tooltip_text("Trying to contact %s.\n%d blocks"%(self.wallet.interface.host, self.wallet.interface.blocks))
            text = "Not connected"

        self.status_bar.pop(self.context_id) 
        self.status_bar.push(self.context_id, text)

        if self.wallet.interface.was_updated:
            self.update_history_tab()
            self.update_receiving_tab()
            # addressbook too...
            self.info.set_text( self.wallet.interface.message )
            self.wallet.interface.was_updated = False
コード例 #4
0
    def update_status_bar(self):
        interface = self.wallet.interface
        if self.funds_error:
            text = "Not enough funds"
        elif interface and interface.is_connected:
            self.network_button.set_tooltip_text("Connected to %s:%d.\n%d blocks"%(interface.host, interface.port, self.wallet.blocks))
            if self.wallet.blocks == -1:
                self.status_image.set_from_stock(gtk.STOCK_NO, gtk.ICON_SIZE_MENU)
                text = "Connecting..."
            elif self.wallet.blocks == 0:
                self.status_image.set_from_stock(gtk.STOCK_NO, gtk.ICON_SIZE_MENU)
                text = "Server not ready"
            elif not self.wallet.up_to_date:
                self.status_image.set_from_stock(gtk.STOCK_REFRESH, gtk.ICON_SIZE_MENU)
                text = "Synchronizing..."
            else:
                self.status_image.set_from_stock(gtk.STOCK_YES, gtk.ICON_SIZE_MENU)
                self.network_button.set_tooltip_text("Connected to %s:%d.\n%d blocks"%(interface.host, interface.port, self.wallet.blocks))
                c, u = self.wallet.get_balance()
                text =  "Balance: %s "%( format_satoshis(c,False,self.wallet.num_zeros) )
                if u: text +=  "[%s unconfirmed]"%( format_satoshis(u,True,self.wallet.num_zeros).strip() )
        else:
            self.status_image.set_from_stock(gtk.STOCK_NO, gtk.ICON_SIZE_MENU)
            self.network_button.set_tooltip_text("Trying to contact %s.\n%d blocks"%(self.wallet.server, self.wallet.blocks))
            text = "Not connected"

        self.status_bar.pop(self.context_id) 
        self.status_bar.push(self.context_id, text)

        if self.wallet.was_updated and self.wallet.up_to_date:
            self.update_history_tab()
            self.update_receiving_tab()
            # addressbook too...
            self.info.set_text( self.wallet.banner )
            self.wallet.was_updated = False
コード例 #5
0
def get_history_values(n):
    values = []
    h = wallet.get_tx_history()

    length = min(n, len(h))
    for i in range(length):
        line = h[-i - 1]
        v = line['value']
        try:
            dt = datetime.datetime.fromtimestamp(line['timestamp'])
            if dt.date() == dt.today().date():
                time_str = str(dt.time())
            else:
                time_str = str(dt.date())
            conf = 'v'

        except:
            print line['timestamp']
            time_str = 'pending'
            conf = 'o'

        tx_hash = line['tx_hash']
        label = wallet.labels.get(tx_hash)
        is_default_label = (label == '') or (label is None)
        if is_default_label: label = line['default_label']
        values.append((conf, '  ' + time_str, '  ' + format_satoshis(v, True),
                       '  ' + label))

    return values
コード例 #6
0
ファイル: electrum4a.py プロジェクト: ErebusBat/Electrum
def get_history_values(n):
    values = []
    h = wallet.get_tx_history()

    length = min(n, len(h))
    for i in range(length):
        line = h[-i-1]
        v = line['value']
        try:
            dt = datetime.datetime.fromtimestamp( line['timestamp'] )
            if dt.date() == dt.today().date():
                time_str = str( dt.time() )
            else:
                time_str = str( dt.date() )
            conf = 'v'

        except:
            print line['timestamp']
            time_str = 'pending'
            conf = 'o'

        tx_hash = line['tx_hash']
        label = wallet.labels.get(tx_hash)
        is_default_label = (label == '') or (label is None)
        if is_default_label: label = line['default_label']
        values.append((conf, '  ' + time_str, '  ' + format_satoshis(v,True), '  ' + label ))

    return values
コード例 #7
0
ファイル: gui_lite.py プロジェクト: JulianTosh/electrum
def csv_transaction(wallet):
    try:
        select_export = _('Select file to export your wallet transactions to')
        fileName = QFileDialog.getSaveFileName(QWidget(), select_export, os.path.expanduser('~/electrum-history.csv'), "*.csv")
        if fileName:
            with open(fileName, "w+") as csvfile:
                transaction = csv.writer(csvfile)
                transaction.writerow(["transaction_hash","label", "confirmations", "value", "fee", "balance", "timestamp"])
                for item in wallet.get_tx_history():
                    tx_hash, confirmations, is_mine, value, fee, balance, timestamp = item
                    if confirmations:
                        if timestamp is not None:
                            try:
                                time_string = datetime.datetime.fromtimestamp(timestamp).isoformat(' ')[:-3]
                            except [RuntimeError, TypeError, NameError] as reason:
                                time_string = "unknown"
                                pass
                        else:
                          time_string = "unknown"
                    else:
                        time_string = "pending"

                    if value is not None:
                        value_string = format_satoshis(value, True, wallet.num_zeros)
                    else:
                        value_string = '--'

                    if fee is not None:
                        fee_string = format_satoshis(fee, True, wallet.num_zeros)
                    else:
                        fee_string = '0'

                    if tx_hash:
                        label, is_default_label = wallet.get_label(tx_hash)
                    else:
                      label = ""

                    balance_string = format_satoshis(balance, False, wallet.num_zeros)
                    transaction.writerow([tx_hash, label, confirmations, value_string, fee_string, balance_string, time_string])
                QMessageBox.information(None,"CSV Export created", "Your CSV export has been successfully created.")
    except (IOError, os.error), reason:
        export_error_label = _("Electrum was unable to produce a transaction export.")
        QMessageBox.critical(None,"Unable to create csv", export_error_label + "\n" + str(reason))
コード例 #8
0
    def update_history_tab(self):
        cursor = self.history_treeview.get_cursor()[0]
        self.history_list.clear()
        balance = 0
        for tx in self.wallet.get_tx_history():
            tx_hash = tx['tx_hash']
            if tx['height']:
                conf = self.wallet.blocks - tx['height'] + 1
                time_str = datetime.datetime.fromtimestamp(
                    tx['timestamp']).isoformat(' ')[:-3]
                conf_icon = gtk.STOCK_APPLY
            else:
                conf = 0
                time_str = 'pending'
                conf_icon = gtk.STOCK_EXECUTE
            v = tx['value']
            balance += v
            label = self.wallet.labels.get(tx_hash)
            is_default_label = (label == '') or (label is None)
            if is_default_label: label = tx['default_label']
            tooltip = tx_hash + "\n%d confirmations" % conf

            # tx = self.wallet.tx_history.get(tx_hash)
            details = "Transaction Details:\n\n" \
                      + "Transaction ID:\n" + tx_hash + "\n\n" \
                      + "Status: %d confirmations\n\n"%conf  \
                      + "Date: %s\n\n"%time_str \
                      + "Inputs:\n-"+ '\n-'.join(tx['inputs']) + "\n\n" \
                      + "Outputs:\n-"+ '\n-'.join(tx['outputs'])
            r = self.wallet.receipts.get(tx_hash)
            if r:
                details += "\n_______________________________________" \
                           + '\n\nSigned URI: ' + r[2] \
                           + "\n\nSigned by: " + r[0] \
                           + '\n\nSignature: ' + r[1]

            self.history_list.prepend([
                tx_hash, conf_icon, time_str, label, is_default_label,
                format_satoshis(v, True, self.wallet.num_zeros),
                format_satoshis(balance, False, self.wallet.num_zeros),
                tooltip, details
            ])
        if cursor: self.history_treeview.set_cursor(cursor)
コード例 #9
0
ファイル: gui_lite.py プロジェクト: crazyrabbitLTC/electrum
    def update_history(self, tx_history):
        from util import format_satoshis, age

        self.history_list.empty()

        for item in tx_history[-10:]:
            tx_hash, conf, is_mine, value, fee, balance, timestamp = item
            label = self.actuator.wallet.get_label(tx_hash)[0]
            #amount = D(value) / 10**8
            v_str = format_satoshis(value, True)
            self.history_list.append(label, v_str, age(timestamp))
コード例 #10
0
ファイル: gui.py プロジェクト: kepppu/electrum-n900
    def update_history_tab(self):
        cursor = self.history_treeview.get_cursor()[0]
        self.history_list.clear()
        balance = 0 
        for tx in self.wallet.get_tx_history():
            tx_hash = tx['tx_hash']
            if tx['height']:
                conf = self.wallet.interface.blocks - tx['height'] + 1
                time_str = datetime.datetime.fromtimestamp( tx['nTime']).isoformat(' ')[:-3]
                conf_icon = gtk.STOCK_APPLY
            else:
                conf = 0
                time_str = 'pending'
                conf_icon = gtk.STOCK_EXECUTE
            v = tx['value']
            balance += v 
            label = self.wallet.labels.get(tx_hash)
            is_default_label = (label == '') or (label is None)
            if is_default_label: label = tx['default_label']
            tooltip = tx_hash + "\n%d confirmations"%conf 

            # tx = self.wallet.tx_history.get(tx_hash)
            details = "Transaction Details:\n\n" \
                      + "Transaction ID:\n" + tx_hash + "\n\n" \
                      + "Status: %d confirmations\n\n"%conf  \
                      + "Date: %s\n\n"%time_str \
                      + "Inputs:\n-"+ '\n-'.join(tx['inputs']) + "\n\n" \
                      + "Outputs:\n-"+ '\n-'.join(tx['outputs'])
            r = self.wallet.receipts.get(tx_hash)
            if r:
                details += "\n_______________________________________" \
                           + '\n\nSigned URI: ' + r[2] \
                           + "\n\nSigned by: " + r[0] \
                           + '\n\nSignature: ' + r[1]
                

            self.history_list.prepend( [tx_hash, conf_icon, time_str, label, is_default_label,
                                        format_satoshis(v,True), format_satoshis(balance), tooltip, details] )
        if cursor: self.history_treeview.set_cursor( cursor )
コード例 #11
0
def update_layout():
    global status_text
    if not wallet.interface.is_connected:
        text = "Not connected..."
    elif wallet.blocks == 0:
        text = "Server not ready"
    elif not wallet.up_to_date:
        text = "Synchronizing..."
    else:
        c, u = wallet.get_balance()
        text = "Balance:" + format_satoshis(c)
        if u: text += '   [' + format_satoshis(u, True).strip() + ']'

    # vibrate if status changed
    if text != status_text:
        if status_text and wallet.interface.is_connected and wallet.up_to_date:
            droid.vibrate()
        status_text = text

    droid.fullSetProperty("balanceTextView", "text", status_text)

    if wallet.up_to_date:
        set_history_layout(15)
コード例 #12
0
ファイル: gui.py プロジェクト: christian-oudard/electrum
    def update_history_tab(self):
        cursor = self.history_treeview.get_cursor()[0]
        self.history_list.clear()

        for item in self.wallet.get_tx_history():
            tx_hash, conf, is_mine, value, fee, balance, timestamp = item
            if conf:
                try:
                    time_str = datetime.datetime.fromtimestamp( timestamp).isoformat(' ')[:-3]
                except:
                    time_str = "------"
                conf_icon = gtk.STOCK_APPLY
            else:
                time_str = 'pending'
                conf_icon = gtk.STOCK_EXECUTE

            label, is_default_label = self.wallet.get_label(tx_hash)
            tooltip = tx_hash + "\n%d confirmations"%conf if tx_hash else ''
            details = self.wallet.get_tx_details(tx_hash)

            self.history_list.prepend( [tx_hash, conf_icon, time_str, label, is_default_label,
                                        format_satoshis(value,True,self.wallet.num_zeros),
                                        format_satoshis(balance,False,self.wallet.num_zeros), tooltip, details] )
        if cursor: self.history_treeview.set_cursor( cursor )
コード例 #13
0
ファイル: electrum4a.py プロジェクト: ErebusBat/Electrum
def update_layout():
    global status_text
    if not wallet.interface.is_connected:
        text = "Not connected..."
    elif wallet.blocks == 0:
        text = "Server not ready"
    elif not wallet.up_to_date:
        text = "Synchronizing..."
    else:
        c, u = wallet.get_balance()
        text = "Balance:"+format_satoshis(c) 
        if u : text += '   [' + format_satoshis(u,True).strip() + ']'


    # vibrate if status changed
    if text != status_text:
        if status_text and wallet.interface.is_connected and wallet.up_to_date:
            droid.vibrate()
        status_text = text

    droid.fullSetProperty("balanceTextView", "text", status_text)

    if wallet.up_to_date:
        set_history_layout(15)
コード例 #14
0
ファイル: gui.py プロジェクト: arsenische/electrum
    def update_history_tab(self):
        cursor = self.history_treeview.get_cursor()[0]
        self.history_list.clear()
        balance = 0 
        for tx in self.wallet.get_tx_history():
            tx_hash = tx['tx_hash']
            conf = self.wallet.verifier.get_confirmations(tx_hash)
            if conf:
                time_str = datetime.datetime.fromtimestamp( tx['timestamp']).isoformat(' ')[:-3]
                conf_icon = gtk.STOCK_APPLY
            else:
                time_str = 'pending'
                conf_icon = gtk.STOCK_EXECUTE
            v = self.wallet.get_tx_value(tx_hash)
            balance += v 
            label, is_default_label = self.wallet.get_label(tx_hash)
            tooltip = tx_hash + "\n%d confirmations"%conf 

            inputs = map(lambda x: x.get('address'), tx['inputs'])
            outputs = map(lambda x: x.get('address'), tx['outputs'])
            details = "Transaction Details:\n\n" \
                      + "Transaction ID:\n" + tx_hash + "\n\n" \
                      + "Status: %d confirmations\n\n"%conf  \
                      + "Date: %s\n\n"%time_str \
                      + "Inputs:\n-"+ '\n-'.join(inputs) + "\n\n" \
                      + "Outputs:\n-"+ '\n-'.join(outputs)
            r = self.wallet.receipts.get(tx_hash)
            if r:
                details += "\n_______________________________________" \
                           + '\n\nSigned URI: ' + r[2] \
                           + "\n\nSigned by: " + r[0] \
                           + '\n\nSignature: ' + r[1]
                

            self.history_list.prepend( [tx_hash, conf_icon, time_str, label, is_default_label,
                                        format_satoshis(v,True,self.wallet.num_zeros), format_satoshis(balance,False,self.wallet.num_zeros), tooltip, details] )
        if cursor: self.history_treeview.set_cursor( cursor )