3 from PyQt4.QtCore import *
4 from PyQt4.QtGui import *
6 from decimal import Decimal as D
7 from interface import DEFAULT_SERVERS
8 from simple_config import SimpleConfig
9 from util import get_resource_path as rsrc
24 bitcoin = lambda v: v * 100000000
26 def IconButton(filename, parent=None):
27 pixmap = QPixmap(filename)
29 return QPushButton(icon, "", parent)
34 self.emit(SIGNAL('timersignal'))
37 def resize_line_edit_width(line_edit, text_input):
38 metrics = QFontMetrics(qApp.font())
39 # Create an extra character to add some space on the end
41 line_edit.setMinimumWidth(metrics.width(text_input))
43 class ElectrumGui(QObject):
45 def __init__(self, wallet):
46 super(QObject, self).__init__()
49 self.app = QApplication(sys.argv)
52 actuator = MiniActuator(self.wallet)
53 self.connect(self, SIGNAL("updateservers()"),
54 actuator.update_servers_list)
55 # Should probably not modify the current path but instead
56 # change the behaviour of rsrc(...)
57 old_path = QDir.currentPath()
60 self.mini = MiniWindow(actuator, self.expand)
61 driver = MiniDriver(self.wallet, self.mini)
63 # Reset path back to original value now that loading the GUI
65 QDir.setCurrent(old_path)
72 self.expert = gui_qt.ElectrumWindow(self.wallet)
73 self.expert.app = self.app
74 self.expert.connect_slots(timer)
75 self.expert.update_wallet()
79 def server_list_changed(self):
80 self.emit(SIGNAL("updateservers()"))
83 """Hide the lite mode window and show pro-mode."""
87 def set_url(self, url):
88 payto, amount, label, message, signature, identity, url = \
89 self.wallet.parse_url(url, self.show_message, self.show_question)
90 self.mini.set_payment_fields(payto, amount)
92 def show_message(self, message):
93 QMessageBox.information(self.mini, _("Message"), message, _("OK"))
95 def show_question(self, message):
96 choice = QMessageBox.question(self.mini, _("Message"), message,
97 QMessageBox.Yes|QMessageBox.No,
99 return choice == QMessageBox.Yes
101 def restore_or_create(self):
102 qt_gui_object = gui_qt.ElectrumGui(self.wallet, self.app)
103 return qt_gui_object.restore_or_create()
105 class MiniWindow(QDialog):
107 def __init__(self, actuator, expand_callback):
108 super(MiniWindow, self).__init__()
110 self.actuator = actuator
112 self.btc_balance = None
113 self.quote_currencies = ["EUR", "USD", "GBP"]
114 self.actuator.set_configured_currency(self.set_quote_currency)
115 self.exchanger = exchange_rate.Exchanger(self)
116 # Needed because price discovery is done in a different thread
117 # which needs to be sent back to this main one to update the GUI
118 self.connect(self, SIGNAL("refresh_balance()"), self.refresh_balance)
120 self.balance_label = BalanceLabel(self.change_quote_currency)
121 self.balance_label.setObjectName("balance_label")
123 self.receive_button = QPushButton(_("&Receive"))
124 self.receive_button.setObjectName("receive_button")
125 self.receive_button.setDefault(True)
126 self.receive_button.clicked.connect(self.copy_address)
128 # Bitcoin address code
129 self.address_input = QLineEdit()
130 self.address_input.setPlaceholderText(_("Enter a Bitcoin address..."))
131 self.address_input.setObjectName("address_input")
134 self.address_input.textEdited.connect(self.address_field_changed)
135 resize_line_edit_width(self.address_input,
136 "1BtaFUr3qVvAmwrsuDuu5zk6e4s2rxd2Gy")
138 self.address_completions = QStringListModel()
139 address_completer = QCompleter(self.address_input)
140 address_completer.setCaseSensitivity(False)
141 address_completer.setModel(self.address_completions)
142 self.address_input.setCompleter(address_completer)
144 address_layout = QHBoxLayout()
145 address_layout.addWidget(self.address_input)
147 self.amount_input = QLineEdit()
148 self.amount_input.setPlaceholderText(_("... and amount"))
149 self.amount_input.setObjectName("amount_input")
150 # This is changed according to the user's displayed balance
151 self.amount_validator = QDoubleValidator(self.amount_input)
152 self.amount_validator.setNotation(QDoubleValidator.StandardNotation)
153 self.amount_validator.setDecimals(8)
154 self.amount_input.setValidator(self.amount_validator)
156 # This removes the very ugly OSX highlighting, please leave this in :D
157 self.address_input.setAttribute(Qt.WA_MacShowFocusRect, 0)
158 self.amount_input.setAttribute(Qt.WA_MacShowFocusRect, 0)
159 self.amount_input.textChanged.connect(self.amount_input_changed)
161 self.send_button = QPushButton(_("&Send"))
162 self.send_button.setObjectName("send_button")
163 self.send_button.setDisabled(True);
164 self.send_button.clicked.connect(self.send)
166 main_layout = QGridLayout(self)
168 main_layout.addWidget(self.balance_label, 0, 0)
169 main_layout.addWidget(self.receive_button, 0, 1)
171 main_layout.addWidget(self.address_input, 1, 0, 1, -1)
173 main_layout.addWidget(self.amount_input, 2, 0)
174 main_layout.addWidget(self.send_button, 2, 1)
176 self.history_list = history_widget.HistoryWidget()
177 self.history_list.setObjectName("history")
178 self.history_list.hide()
179 self.history_list.setAlternatingRowColors(True)
180 main_layout.addWidget(self.history_list, 3, 0, 1, -1)
183 electrum_menu = menubar.addMenu(_("&Bitcoin"))
184 servers_menu = electrum_menu.addMenu(_("&Servers"))
185 servers_group = QActionGroup(self)
186 self.actuator.set_servers_gui_stuff(servers_menu, servers_group)
187 self.actuator.populate_servers_menu()
188 electrum_menu.addSeparator()
189 brain_seed = electrum_menu.addAction(_("&BrainWallet Info"))
190 brain_seed.triggered.connect(self.actuator.show_seed_dialog)
191 quit_option = electrum_menu.addAction(_("&Quit"))
192 quit_option.triggered.connect(self.close)
194 view_menu = menubar.addMenu(_("&View"))
195 expert_gui = view_menu.addAction(_("&Pro Mode"))
196 expert_gui.triggered.connect(expand_callback)
197 themes_menu = view_menu.addMenu(_("&Themes"))
198 selected_theme = self.actuator.selected_theme()
199 theme_group = QActionGroup(self)
200 for theme_name in self.actuator.theme_names():
201 theme_action = themes_menu.addAction(theme_name)
202 theme_action.setCheckable(True)
203 if selected_theme == theme_name:
204 theme_action.setChecked(True)
205 class SelectThemeFunctor:
206 def __init__(self, theme_name, toggle_theme):
207 self.theme_name = theme_name
208 self.toggle_theme = toggle_theme
209 def __call__(self, checked):
211 self.toggle_theme(self.theme_name)
212 delegate = SelectThemeFunctor(theme_name, self.toggle_theme)
213 theme_action.toggled.connect(delegate)
214 theme_group.addAction(theme_action)
215 view_menu.addSeparator()
216 show_history = view_menu.addAction(_("Show History"))
217 show_history.setCheckable(True)
218 show_history.toggled.connect(self.show_history)
220 help_menu = menubar.addMenu(_("&Help"))
221 the_website = help_menu.addAction(_("&Website"))
222 the_website.triggered.connect(self.the_website)
223 help_menu.addSeparator()
224 report_bug = help_menu.addAction(_("&Report Bug"))
225 report_bug.triggered.connect(self.show_report_bug)
226 show_about = help_menu.addAction(_("&About"))
227 show_about.triggered.connect(self.show_about)
228 main_layout.setMenuBar(menubar)
230 quit_shortcut = QShortcut(QKeySequence("Ctrl+Q"), self)
231 quit_shortcut.activated.connect(self.close)
232 close_shortcut = QShortcut(QKeySequence("Ctrl+W"), self)
233 close_shortcut.activated.connect(self.close)
236 g = cfg.config["winpos-lite"]
237 self.setGeometry(g[0], g[1], g[2], g[3])
238 show_history.setChecked(cfg.config["history"])
239 self.show_history(cfg.config["history"])
241 self.setWindowIcon(QIcon(":electrum.png"))
242 self.setWindowTitle("Electrum")
243 self.setWindowFlags(Qt.Window|Qt.MSWindowsFixedSizeDialogHint)
244 self.layout().setSizeConstraint(QLayout.SetFixedSize)
245 self.setObjectName("main_window")
248 def toggle_theme(self, theme_name):
249 old_path = QDir.currentPath()
250 self.actuator.change_theme(theme_name)
251 # Recompute style globally
252 qApp.style().unpolish(self)
253 qApp.style().polish(self)
254 QDir.setCurrent(old_path)
256 def closeEvent(self, event):
259 cfg.set_key("winpos-lite", [g.left(),g.top(),g.width(),g.height()])
260 cfg.set_key("history", self.history_list.isVisible())
263 super(MiniWindow, self).closeEvent(event)
266 def set_payment_fields(self, dest_address, amount):
267 self.address_input.setText(dest_address)
268 self.address_field_changed(dest_address)
269 self.amount_input.setText(amount)
274 def deactivate(self):
277 def set_quote_currency(self, currency):
278 """Set and display the fiat currency country."""
279 assert currency in self.quote_currencies
280 self.quote_currencies.remove(currency)
281 self.quote_currencies.insert(0, currency)
282 self.refresh_balance()
284 def change_quote_currency(self):
285 self.quote_currencies = \
286 self.quote_currencies[1:] + self.quote_currencies[0:1]
287 self.actuator.set_config_currency(self.quote_currencies[0])
288 self.refresh_balance()
290 def refresh_balance(self):
291 if self.btc_balance is None:
292 # Price has been discovered before wallet has been loaded
293 # and server connect... so bail.
295 self.set_balances(self.btc_balance)
296 self.amount_input_changed(self.amount_input.text())
298 def set_balances(self, btc_balance):
299 """Set the bitcoin balance and update the amount label accordingly."""
300 self.btc_balance = btc_balance
301 quote_text = self.create_quote_text(btc_balance)
303 quote_text = "(%s)" % quote_text
304 btc_balance = "%.2f" % (btc_balance / bitcoin(1))
305 self.balance_label.set_balance_text(btc_balance, quote_text)
306 self.setWindowTitle("Electrum - %s BTC" % btc_balance)
308 def amount_input_changed(self, amount_text):
309 """Update the number of bitcoins displayed."""
310 self.check_button_status()
313 amount = D(str(amount_text))
314 except decimal.InvalidOperation:
315 self.balance_label.show_balance()
317 quote_text = self.create_quote_text(amount * bitcoin(1))
319 self.balance_label.set_amount_text(quote_text)
320 self.balance_label.show_amount()
322 self.balance_label.show_balance()
324 def create_quote_text(self, btc_balance):
325 """Return a string copy of the amount fiat currency the
326 user has in bitcoins."""
327 quote_currency = self.quote_currencies[0]
328 quote_balance = self.exchanger.exchange(btc_balance, quote_currency)
329 if quote_balance is None:
332 quote_text = "%.2f %s" % ((quote_balance / bitcoin(1)),
337 if self.actuator.send(self.address_input.text(),
338 self.amount_input.text(), self):
339 self.address_input.setText("")
340 self.amount_input.setText("")
342 def check_button_status(self):
343 """Check that the bitcoin address is valid and that something
344 is entered in the amount before making the send button clickable."""
346 value = D(str(self.amount_input.text())) * 10**8
347 except decimal.InvalidOperation:
349 # self.address_input.property(...) returns a qVariant, not a bool.
350 # The == is needed to properly invoke a comparison.
351 if (self.address_input.property("isValid") == True and
352 value is not None and 0 < value <= self.btc_balance):
353 self.send_button.setDisabled(False)
355 self.send_button.setDisabled(True)
357 def address_field_changed(self, address):
358 if self.actuator.is_valid(address):
359 self.check_button_status()
360 self.address_input.setProperty("isValid", True)
361 self.recompute_style(self.address_input)
363 self.send_button.setDisabled(True)
364 self.address_input.setProperty("isValid", False)
365 self.recompute_style(self.address_input)
367 if len(address) == 0:
368 self.address_input.setProperty("isValid", None)
369 self.recompute_style(self.address_input)
371 def recompute_style(self, element):
372 self.style().unpolish(element)
373 self.style().polish(element)
375 def copy_address(self):
376 receive_popup = ReceivePopup(self.receive_button)
377 self.actuator.copy_address(receive_popup)
379 def update_completions(self, completions):
380 self.address_completions.setStringList(completions)
382 def update_history(self, tx_history):
383 for tx in tx_history[-10:]:
384 address = tx["default_label"]
385 amount = D(tx["value"]) / 10**8
386 self.history_list.append(address, amount)
389 self.actuator.acceptbit(self.quote_currencies[0])
391 def the_website(self):
392 webbrowser.open("http://electrum-desktop.com")
394 def show_about(self):
395 QMessageBox.about(self, "Electrum",
396 _("Electrum's focus is speed, with low resource usage and simplifying Bitcoin. You do not need to perform regular backups, because your wallet can be recovered from a secret phrase that you can memorize or write on paper. Startup times are instant because it operates in conjuction with high-performance servers that handle the most complicated parts of the Bitcoin system.\n\nSend donations to 1JwTMv4GWaPdf931N6LNPJeZBfZgZJ3zX1"))
398 def show_report_bug(self):
399 QMessageBox.information(self, "Electrum - " + _("Reporting Bugs"),
400 _("Email bug reports to %s") % "genjix" + "@" + "riseup.net")
402 def show_history(self, toggle_state):
404 self.history_list.show()
406 self.history_list.hide()
408 class BalanceLabel(QLabel):
414 def __init__(self, change_quote_currency, parent=None):
415 super(QLabel, self).__init__(_("Connecting..."), parent)
416 self.change_quote_currency = change_quote_currency
417 self.state = self.SHOW_CONNECTING
418 self.balance_text = ""
419 self.amount_text = ""
421 def mousePressEvent(self, event):
422 """Change the fiat currency selection if window background is clicked."""
423 if self.state != self.SHOW_CONNECTING:
424 self.change_quote_currency()
426 def set_balance_text(self, btc_balance, quote_text):
427 """Set the amount of bitcoins in the gui."""
428 if self.state == self.SHOW_CONNECTING:
429 self.state = self.SHOW_BALANCE
430 self.balance_text = "<span style='font-size: 18pt'>%s</span> <span style='font-size: 10pt'>BTC</span> <span style='font-size: 10pt'>%s</span>" % (btc_balance, quote_text)
431 if self.state == self.SHOW_BALANCE:
432 self.setText(self.balance_text)
434 def set_amount_text(self, quote_text):
435 self.amount_text = "<span style='font-size: 10pt'>%s</span>" % quote_text
436 if self.state == self.SHOW_AMOUNT:
437 self.setText(self.amount_text)
439 def show_balance(self):
440 if self.state == self.SHOW_AMOUNT:
441 self.state = self.SHOW_BALANCE
442 self.setText(self.balance_text)
444 def show_amount(self):
445 if self.state == self.SHOW_BALANCE:
446 self.state = self.SHOW_AMOUNT
447 self.setText(self.amount_text)
449 def ok_cancel_buttons(dialog):
450 row_layout = QHBoxLayout()
451 row_layout.addStretch(1)
452 ok_button = QPushButton(_("OK"))
453 row_layout.addWidget(ok_button)
454 ok_button.clicked.connect(dialog.accept)
455 cancel_button = QPushButton(_("Cancel"))
456 row_layout.addWidget(cancel_button)
457 cancel_button.clicked.connect(dialog.reject)
460 class PasswordDialog(QDialog):
462 def __init__(self, parent):
463 super(QDialog, self).__init__(parent)
467 self.password_input = QLineEdit()
468 self.password_input.setEchoMode(QLineEdit.Password)
470 main_layout = QVBoxLayout(self)
471 message = _('Please enter your password')
472 main_layout.addWidget(QLabel(message))
476 grid.addWidget(QLabel(_('Password')), 1, 0)
477 grid.addWidget(self.password_input, 1, 1)
478 main_layout.addLayout(grid)
480 main_layout.addLayout(ok_cancel_buttons(self))
481 self.setLayout(main_layout)
486 return unicode(self.password_input.text())
488 class ReceivePopup(QDialog):
490 def leaveEvent(self, event):
493 def setup(self, address):
494 label = QLabel(_("Copied your Bitcoin address to the clipboard!"))
495 address_display = QLineEdit(address)
496 address_display.setReadOnly(True)
497 resize_line_edit_width(address_display, address)
499 main_layout = QVBoxLayout(self)
500 main_layout.addWidget(label)
501 main_layout.addWidget(address_display)
503 self.setMouseTracking(True)
504 self.setWindowTitle("Electrum - " + _("Receive Bitcoin payment"))
505 self.setWindowFlags(Qt.Window|Qt.FramelessWindowHint|
506 Qt.MSWindowsFixedSizeDialogHint)
507 self.layout().setSizeConstraint(QLayout.SetFixedSize)
508 #self.setFrameStyle(QFrame.WinPanel|QFrame.Raised)
509 #self.setAlignment(Qt.AlignCenter)
512 parent = self.parent()
513 top_left_pos = parent.mapToGlobal(parent.rect().bottomLeft())
514 self.move(top_left_pos)
515 center_mouse_pos = self.mapToGlobal(self.rect().center())
516 QCursor.setPos(center_mouse_pos)
520 """Initialize the definitions relating to themes and
521 sending/recieving bitcoins."""
524 def __init__(self, wallet):
525 """Retrieve the gui theme used in previous session."""
527 self.theme_name = self.wallet.theme
528 self.themes = util.load_theme_paths()
530 def load_theme(self):
531 """Load theme retrieved from wallet file."""
533 theme_prefix, theme_path = self.themes[self.theme_name]
535 util.print_error("Theme not found!", self.theme_name)
537 QDir.setCurrent(os.path.join(theme_prefix, theme_path))
538 with open(rsrc("style.css")) as style_file:
539 qApp.setStyleSheet(style_file.read())
541 def theme_names(self):
543 return sorted(self.themes.keys())
545 def selected_theme(self):
547 return self.theme_name
549 def change_theme(self, theme_name):
551 self.wallet.theme = self.theme_name = theme_name
554 def set_configured_currency(self, set_quote_currency):
555 """Set the inital fiat currency conversion country (USD/EUR/GBP) in
556 the GUI to what it was set to in the wallet."""
557 currency = self.wallet.conversion_currency
558 # currency can be none when Electrum is used for the first
559 # time and no setting has been created yet.
560 if currency is not None:
561 set_quote_currency(currency)
563 def set_config_currency(self, conversion_currency):
564 """Change the wallet fiat currency country."""
565 self.wallet.conversion_currency = conversion_currency
567 def set_servers_gui_stuff(self, servers_menu, servers_group):
568 self.servers_menu = servers_menu
569 self.servers_group = servers_group
571 def populate_servers_menu(self):
572 interface = self.wallet.interface
573 if not interface.servers:
574 print "No servers loaded yet."
575 self.servers_list = []
576 for server_string in DEFAULT_SERVERS:
577 host, port, protocol = server_string.split(':')
578 transports = [(protocol,port)]
579 self.servers_list.append((host, transports))
581 print "Servers loaded."
582 self.servers_list = interface.servers
583 server_names = [details[0] for details in self.servers_list]
584 current_server = self.wallet.server.split(":")[0]
585 for server_name in server_names:
586 server_action = self.servers_menu.addAction(server_name)
587 server_action.setCheckable(True)
588 if server_name == current_server:
589 server_action.setChecked(True)
590 class SelectServerFunctor:
591 def __init__(self, server_name, server_selected):
592 self.server_name = server_name
593 self.server_selected = server_selected
594 def __call__(self, checked):
596 # call server_selected
597 self.server_selected(self.server_name)
598 delegate = SelectServerFunctor(server_name, self.server_selected)
599 server_action.toggled.connect(delegate)
600 self.servers_group.addAction(server_action)
602 def update_servers_list(self):
603 # Clear servers_group
604 for action in self.servers_group.actions():
605 self.servers_group.removeAction(action)
606 self.populate_servers_menu()
608 def server_selected(self, server_name):
609 match = [transports for (host, transports) in self.servers_list
610 if host == server_name]
611 assert len(match) == 1
613 # Default to TCP if available else use anything
614 # TODO: protocol should be selectable.
615 tcp_port = [port for (protocol, port) in match if protocol == "t"]
616 if len(tcp_port) == 0:
617 protocol = match[0][0]
622 server_line = "%s:%s:%s" % (server_name, port, protocol)
623 # Should this have exception handling?
624 self.wallet.set_server(server_line)
626 def copy_address(self, receive_popup):
627 """Copy the wallet addresses into the client."""
628 addrs = [addr for addr in self.wallet.all_addresses()
629 if not self.wallet.is_change(addr)]
630 # Select most recent addresses from gap limit
631 addrs = addrs[-self.wallet.gap_limit:]
632 copied_address = random.choice(addrs)
633 qApp.clipboard().setText(copied_address)
634 receive_popup.setup(copied_address)
635 receive_popup.popup()
637 def send(self, address, amount, parent_window):
638 """Send bitcoins to the target address."""
639 dest_address = self.fetch_destination(address)
641 if dest_address is None or not self.wallet.is_valid(dest_address):
642 QMessageBox.warning(parent_window, _('Error'),
643 _('Invalid Bitcoin Address') + ':\n' + address, _('OK'))
646 convert_amount = lambda amount: \
647 int(D(unicode(amount)) * bitcoin(1))
648 amount = convert_amount(amount)
650 if self.wallet.use_encryption:
651 password_dialog = PasswordDialog(parent_window)
652 password = password_dialog.run()
660 if amount < bitcoin(1) / 10:
662 fee = bitcoin(1) / 1000
665 tx = self.wallet.mktx(dest_address, amount, "", password, fee)
666 except BaseException as error:
667 QMessageBox.warning(parent_window, _('Error'), str(error), _('OK'))
670 status, message = self.wallet.sendtx(tx)
673 dumpf = tempfile.NamedTemporaryFile(delete=False)
676 print "Dumped error tx to", dumpf.name
677 QMessageBox.warning(parent_window, _('Error'), message, _('OK'))
680 QMessageBox.information(parent_window, '',
681 _('Payment sent.') + '\n' + message, _('OK'))
684 def fetch_destination(self, address):
685 recipient = unicode(address).strip()
688 match1 = re.match("^(|([\w\-\.]+)@)((\w[\w\-]+\.)+[\w\-]+)$",
691 # label or alias, with address in brackets
692 match2 = re.match("(.*?)\s*\<([1-9A-HJ-NP-Za-km-z]{26,})\>",
697 self.wallet.get_alias(recipient, True,
698 self.show_message, self.question)
701 return match2.group(2)
705 def is_valid(self, address):
706 """Check if bitcoin address is valid."""
707 return self.wallet.is_valid(address)
709 def acceptbit(self, currency):
710 master_pubkey = self.wallet.master_public_key.encode("hex")
711 url = "http://acceptbit.com/mpk/%s/%s" % (master_pubkey, currency)
714 def show_seed_dialog(self):
715 gui_qt.ElectrumWindow.show_seed_dialog(self.wallet)
717 class MiniDriver(QObject):
724 def __init__(self, wallet, window):
725 super(QObject, self).__init__()
730 self.wallet.register_callback(self.update_callback)
735 self.connect(self, SIGNAL("updatesignal()"), self.update)
736 self.update_callback()
738 # This is a hack to workaround that Qt does not like changing the
739 # window properties from this other thread before the runloop has
741 def update_callback(self):
742 self.emit(SIGNAL("updatesignal()"))
745 if not self.wallet.interface:
747 elif not self.wallet.interface.is_connected:
749 elif not self.wallet.blocks == -1:
751 elif not self.wallet.is_up_to_date:
756 if self.wallet.up_to_date:
757 self.update_balance()
758 self.update_completions()
759 self.update_history()
761 def initializing(self):
762 if self.state == self.INITIALIZING:
764 self.state = self.INITIALIZING
765 self.window.deactivate()
767 def connecting(self):
768 if self.state == self.CONNECTING:
770 self.state = self.CONNECTING
771 self.window.deactivate()
773 def synchronizing(self):
774 if self.state == self.SYNCHRONIZING:
776 self.state = self.SYNCHRONIZING
777 self.window.deactivate()
780 if self.state == self.READY:
782 self.state = self.READY
783 self.window.activate()
785 def update_balance(self):
786 conf_balance, unconf_balance = self.wallet.get_balance()
787 balance = D(conf_balance + unconf_balance)
788 self.window.set_balances(balance)
790 def update_completions(self):
792 for addr, label in self.wallet.labels.items():
793 if addr in self.wallet.addressbook:
794 completions.append("%s <%s>" % (label, addr))
795 completions = completions + self.wallet.aliases.keys()
796 self.window.update_completions(completions)
798 def update_history(self):
799 tx_history = self.wallet.get_tx_history()
800 self.window.update_history(tx_history)
802 if __name__ == "__main__":
803 app = QApplication(sys.argv)
804 with open(rsrc("style.css")) as style_file:
805 app.setStyleSheet(style_file.read())
807 sys.exit(app.exec_())