本文整理汇总了Python中electrum.util.StoreDict.items方法的典型用法代码示例。如果您正苦于以下问题:Python StoreDict.items方法的具体用法?Python StoreDict.items怎么用?Python StoreDict.items使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类electrum.util.StoreDict
的用法示例。
在下文中一共展示了StoreDict.items方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from electrum.util import StoreDict [as 别名]
# 或者: from electrum.util.StoreDict import items [as 别名]
#.........这里部分代码省略.........
format_satoshis(balance, whitespaces=True),
)
)
def print_balance(self):
if not self.network:
msg = _("Offline")
elif self.network.is_connected():
if not self.wallet.up_to_date:
msg = _("Synchronizing...")
else:
c, u, x = self.wallet.get_balance()
msg = _("Balance") + ": %f " % (Decimal(c) / COIN)
if u:
msg += " [%f unconfirmed]" % (Decimal(u) / COIN)
if x:
msg += " [%f unmatured]" % (Decimal(x) / COIN)
else:
msg = _("Not connected")
self.stdscr.addstr(self.maxy - 1, 3, msg)
for i in range(self.num_tabs):
self.stdscr.addstr(
0,
2 + 2 * i + len("".join(self.tab_names[0:i])),
" " + self.tab_names[i] + " ",
curses.A_BOLD if self.tab == i else 0,
)
self.stdscr.addstr(self.maxy - 1, self.maxx - 30, " ".join([_("Settings"), _("Network"), _("Quit")]))
def print_contacts(self):
messages = map(lambda x: "%20s %45s " % (x[0], x[1][1]), self.contacts.items())
self.print_list(messages, "%19s %15s " % ("Key", "Value"))
def print_receive(self):
fmt = "%-35s %-30s"
messages = map(lambda addr: fmt % (addr, self.wallet.labels.get(addr, "")), self.wallet.addresses())
self.print_list(messages, fmt % ("Address", "Label"))
def print_edit_line(self, y, label, text, index, size):
text += " " * (size - len(text))
self.stdscr.addstr(y, 2, label)
self.stdscr.addstr(y, 15, text, curses.A_REVERSE if self.pos % 6 == index else curses.color_pair(1))
def print_send_tab(self):
self.stdscr.clear()
self.print_edit_line(3, _("Pay to"), self.str_recipient, 0, 40)
self.print_edit_line(5, _("Description"), self.str_description, 1, 40)
self.print_edit_line(7, _("Amount"), self.str_amount, 2, 15)
self.print_edit_line(9, _("Fee"), self.str_fee, 3, 15)
self.stdscr.addstr(12, 15, _("[Send]"), curses.A_REVERSE if self.pos % 6 == 4 else curses.color_pair(2))
self.stdscr.addstr(12, 25, _("[Clear]"), curses.A_REVERSE if self.pos % 6 == 5 else curses.color_pair(2))
def print_banner(self):
if self.network:
self.print_list(self.network.banner.split("\n"))
def print_list(self, list, firstline=None):
self.maxpos = len(list)
if not self.maxpos:
return
if firstline:
firstline += " " * (self.maxx - 2 - len(firstline))
self.stdscr.addstr(1, 1, firstline)
示例2: __init__
# 需要导入模块: from electrum.util import StoreDict [as 别名]
# 或者: from electrum.util.StoreDict import items [as 别名]
#.........这里部分代码省略.........
label = self.wallet.get_label(tx_hash)
messages.append(
format_str
% (
time_str,
label,
format_satoshis(value, whitespaces=True),
format_satoshis(balance, whitespaces=True),
)
)
self.print_list(messages[::-1], format_str % (_("Date"), _("Description"), _("Amount"), _("Balance")))
def print_balance(self):
print (self.get_balance())
def get_balance(self):
if self.wallet.network.is_connected():
if not self.wallet.up_to_date:
msg = _("Synchronizing...")
else:
c, u, x = self.wallet.get_balance()
msg = _("Balance") + ": %f " % (Decimal(c) / COIN)
if u:
msg += " [%f unconfirmed]" % (Decimal(u) / COIN)
if x:
msg += " [%f unmatured]" % (Decimal(x) / COIN)
else:
msg = _("Not connected")
return msg
def print_contacts(self):
messages = map(lambda x: "%20s %45s " % (x[0], x[1][1]), self.contacts.items())
self.print_list(messages, "%19s %25s " % ("Key", "Value"))
def print_addresses(self):
messages = map(
lambda addr: "%30s %30s " % (addr, self.wallet.labels.get(addr, "")), self.wallet.addresses()
)
self.print_list(messages, "%19s %25s " % ("Address", "Label"))
def print_order(self):
print (
"send order to "
+ self.str_recipient
+ ", amount: "
+ self.str_amount
+ "\nfee: "
+ self.str_fee
+ ", desc: "
+ self.str_description
)
def enter_order(self):
self.str_recipient = raw_input("Pay to: ")
self.str_description = raw_input("Description : ")
self.str_amount = raw_input("Amount: ")
self.str_fee = raw_input("Fee: ")
def send_order(self):
self.do_send()
def print_banner(self):
for i, x in enumerate(self.wallet.network.banner.split("\n")):
print (x)
示例3: show_message
# 需要导入模块: from electrum.util import StoreDict [as 别名]
# 或者: from electrum.util.StoreDict import items [as 别名]
#.........这里部分代码省略.........
else:
self.status_image.set_from_stock(Gtk.STOCK_NO, Gtk.IconSize.MENU)
self.network_button.set_tooltip_text("Not connected.")
text = "Not connected"
self.status_bar.pop(self.context_id)
self.status_bar.push(self.context_id, text)
if self.wallet.up_to_date and self.wallet_updated:
self.update_history_tab()
self.update_receiving_tab()
# addressbook too...
self.info.set_text( self.network.banner )
self.wallet_updated = False
def update_receiving_tab(self):
self.recv_list.clear()
for address in self.wallet.addresses(True):
Type = "R"
c = u = 0
if self.wallet.is_change(address): Type = "C"
if address in self.wallet.imported_keys.keys():
Type = "I"
c, u, x = self.wallet.get_addr_balance(address)
if address in self.wallet.frozen_addresses: Type = Type + "F"
label = self.wallet.labels.get(address)
h = self.wallet.history.get(address,[])
n = len(h)
tx = "0" if n==0 else "%d"%n
self.recv_list.append((address, label, tx, format_satoshis(c+u+x, False, self.num_zeros), Type ))
def update_sending_tab(self):
self.addressbook_list.clear()
for k, v in self.contacts.items():
t, v = v
self.addressbook_list.append((k, v, t))
def update_history_tab(self):
cursor = self.history_treeview.get_cursor()[0]
self.history_list.clear()
for item in self.wallet.get_history():
tx_hash, conf, value, timestamp, balance = item
if conf > 0:
try:
time_str = datetime.datetime.fromtimestamp( timestamp).isoformat(' ')[:-3]
except Exception:
time_str = "------"
conf_icon = Gtk.STOCK_APPLY
elif conf == -1:
time_str = 'unverified'
conf_icon = None
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.get_tx_details(tx_hash)
self.history_list.prepend( [tx_hash, conf_icon, time_str, label, is_default_label,
format_satoshis(value,True,self.num_zeros, whitespaces=True),
format_satoshis(balance,False,self.num_zeros, whitespaces=True), tooltip, details] )
if cursor: self.history_treeview.set_cursor( cursor )
示例4: __init__
# 需要导入模块: from electrum.util import StoreDict [as 别名]
# 或者: from electrum.util.StoreDict import items [as 别名]
#.........这里部分代码省略.........
label = label[0:37] + '...'
self.history.append( format_str%( time_str, label, format_satoshis(value, whitespaces=True), format_satoshis(balance, whitespaces=True) ) )
def print_balance(self):
if not self.network:
msg = _("Offline")
elif self.network.is_connected():
if not self.wallet.up_to_date:
msg = _("Synchronizing...")
else:
c, u, x = self.wallet.get_balance()
msg = _("Balance")+": %f "%(Decimal(c) / COIN)
if u:
msg += " [%f unconfirmed]"%(Decimal(u) / COIN)
if x:
msg += " [%f unmatured]"%(Decimal(x) / COIN)
else:
msg = _("Not connected")
self.stdscr.addstr( self.maxy -1, 3, msg)
for i in range(self.num_tabs):
self.stdscr.addstr( 0, 2 + 2*i + len(''.join(self.tab_names[0:i])), ' '+self.tab_names[i]+' ', curses.A_BOLD if self.tab == i else 0)
self.stdscr.addstr(self.maxy -1, self.maxx-30, ' '.join([_("Settings"), _("Network"), _("Quit")]))
def print_receive(self):
addr = self.wallet.get_unused_address(None)
self.stdscr.addstr(2, 1, "Address: "+addr)
self.print_qr(addr)
def print_contacts(self):
messages = map(lambda x: "%20s %45s "%(x[0], x[1][1]), self.contacts.items())
self.print_list(messages, "%19s %15s "%("Key", "Value"))
def print_addresses(self):
fmt = "%-35s %-30s"
messages = map(lambda addr: fmt % (addr, self.wallet.labels.get(addr,"")), self.wallet.addresses())
self.print_list(messages, fmt % ("Address", "Label"))
def print_edit_line(self, y, label, text, index, size):
text += " "*(size - len(text) )
self.stdscr.addstr( y, 2, label)
self.stdscr.addstr( y, 15, text, curses.A_REVERSE if self.pos%6==index else curses.color_pair(1))
def print_send_tab(self):
self.stdscr.clear()
self.print_edit_line(3, _("Pay to"), self.str_recipient, 0, 40)
self.print_edit_line(5, _("Description"), self.str_description, 1, 40)
self.print_edit_line(7, _("Amount"), self.str_amount, 2, 15)
self.print_edit_line(9, _("Fee"), self.str_fee, 3, 15)
self.stdscr.addstr( 12, 15, _("[Send]"), curses.A_REVERSE if self.pos%6==4 else curses.color_pair(2))
self.stdscr.addstr( 12, 25, _("[Clear]"), curses.A_REVERSE if self.pos%6==5 else curses.color_pair(2))
def print_banner(self):
if self.network:
self.print_list( self.network.banner.split('\n'))
def print_qr(self, data):
import qrcode, StringIO
s = StringIO.StringIO()
self.qr = qrcode.QRCode()
self.qr.add_data(data)
self.qr.print_ascii(out=s, invert=False)
msg = s.getvalue()