commit 61b8e23fad55aa47d77cc853e57a30636f43ad88
parent f98a5617d684be97626a7d5ad5ab4e1ec6895ece
Author: ThomasV <thomasv@electrum.org>
Date: Thu, 13 Jul 2017 09:44:31 +0200
Merge pull request #2582 from bauerj/tab-icons
Add tab icons
Diffstat:
9 files changed, 39 insertions(+), 27 deletions(-)
diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py
@@ -127,17 +127,23 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
self.utxo_tab = self.create_utxo_tab()
self.console_tab = self.create_console_tab()
self.contacts_tab = self.create_contacts_tab()
- tabs.addTab(self.create_history_tab(), _('History') )
- tabs.addTab(self.send_tab, _('Send') )
- tabs.addTab(self.receive_tab, _('Receive') )
- if self.config.get('show_addresses_tab', False):
- tabs.addTab(self.addresses_tab, _('Addresses'))
- if self.config.get('show_utxo_tab', False):
- tabs.addTab(self.utxo_tab, _('Coins'))
- if self.config.get('show_contacts_tab', False):
- tabs.addTab(self.contacts_tab, _('Contacts') )
- if self.config.get('show_console_tab', False):
- tabs.addTab(self.console_tab, _('Console') )
+ tabs.addTab(self.create_history_tab(), QIcon(":icons/tab_history.png"), _('History'))
+ tabs.addTab(self.send_tab, QIcon(":icons/tab_send.png"), _('Send'))
+ tabs.addTab(self.receive_tab, QIcon(":icons/tab_receive.png"), _('Receive'))
+
+ def add_optional_tab(tabs, tab, icon, description, name):
+ tab.tab_icon = icon
+ tab.tab_description = description
+ tab.tab_pos = len(tabs)
+ tab.tab_name = name
+ if self.config.get('show_{}_tab'.format(name), False):
+ tabs.addTab(tab, icon, description)
+
+ add_optional_tab(tabs, self.addresses_tab, QIcon(":icons/tab_addresses.png"), _("Addresses"), "addresses")
+ add_optional_tab(tabs, self.utxo_tab, QIcon(":icons/tab_coins.png"), _("Coins"), "utxo")
+ add_optional_tab(tabs, self.contacts_tab, QIcon(":icons/tab_contacts.png"), _("Contacts"), "contacts")
+ add_optional_tab(tabs, self.console_tab, QIcon(":icons/tab_console.png"), _("Console"), "console")
+
tabs.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
self.setCentralWidget(tabs)
@@ -206,9 +212,9 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
self.history_list.update()
def toggle_tab(self, tab):
- show = not self.config.get('show_{}_tab'.format(tab.name), False)
- self.config.set_key('show_{}_tab'.format(tab.name), show)
- item_text = (_("Hide") if show else _("Show")) + " " + tab.description
+ show = not self.config.get('show_{}_tab'.format(tab.tab_name), False)
+ self.config.set_key('show_{}_tab'.format(tab.tab_name), show)
+ item_text = (_("Hide") if show else _("Show")) + " " + tab.tab_description
tab.menu_action.setText(item_text)
if show:
# Find out where to place the tab
@@ -220,7 +226,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
break
except AttributeError:
pass
- self.tabs.insertTab(index, tab, tab.description)
+ self.tabs.insertTab(index, tab, tab.tab_icon, tab.tab_description)
else:
i = self.tabs.indexOf(tab)
self.tabs.removeTab(i)
@@ -460,19 +466,16 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
wallet_menu.addSeparator()
wallet_menu.addAction(_("Find"), self.toggle_search).setShortcut(QKeySequence("Ctrl+F"))
- def add_toggle_action(view_menu, target_tab, tab_description, tab_name, tab_pos):
- is_shown = self.config.get('show_{}_tab'.format(tab_name), False)
- item_name = (_("Hide") if is_shown else _("Show")) + " " + tab_description
- target_tab.name = tab_name
- target_tab.description = tab_description
- target_tab.tab_pos = tab_pos
- target_tab.menu_action = view_menu.addAction(item_name, lambda: self.toggle_tab(target_tab))
+ def add_toggle_action(view_menu, tab):
+ is_shown = self.config.get('show_{}_tab'.format(tab.tab_name), False)
+ item_name = (_("Hide") if is_shown else _("Show")) + " " + tab.tab_description
+ tab.menu_action = view_menu.addAction(item_name, lambda: self.toggle_tab(tab))
view_menu = menubar.addMenu(_("&View"))
- add_toggle_action(view_menu, self.addresses_tab, "Addresses", "addresses", 1)
- add_toggle_action(view_menu, self.utxo_tab, "Coins", "utxo", 2)
- add_toggle_action(view_menu, self.contacts_tab, "Contacts", "contacts", 3)
- add_toggle_action(view_menu, self.console_tab, "Console", "console", 4)
+ add_toggle_action(view_menu, self.addresses_tab)
+ add_toggle_action(view_menu, self.utxo_tab)
+ add_toggle_action(view_menu, self.contacts_tab)
+ add_toggle_action(view_menu, self.console_tab)
tools_menu = menubar.addMenu(_("&Tools"))
@@ -516,7 +519,9 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
def show_about(self):
QMessageBox.about(self, "Electrum",
- _("Version")+" %s" % (self.wallet.electrum_version) + "\n\n" + _("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 conjunction with high-performance servers that handle the most complicated parts of the Bitcoin system."))
+ _("Version")+" %s" % (self.wallet.electrum_version) + "\n\n" +
+ _("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 conjunction with high-performance servers that handle the most complicated parts of the Bitcoin system." + "\n\n" +
+ _("Uses icons from the Icons8 icon pack (icons8.com).")))
def show_report_bug(self):
msg = ' '.join([
diff --git a/icons.qrc b/icons.qrc
@@ -31,6 +31,13 @@
<file>icons/status_waiting.png</file>
<file>icons/status_lagging.png</file>
<file>icons/seal.png</file>
+ <file>icons/tab_addresses.png</file>
+ <file>icons/tab_coins.png</file>
+ <file>icons/tab_console.png</file>
+ <file>icons/tab_contacts.png</file>
+ <file>icons/tab_history.png</file>
+ <file>icons/tab_receive.png</file>
+ <file>icons/tab_send.png</file>
<file>icons/tor_logo.png</file>
<file>icons/speaker.png</file>
<file>icons/trezor_unpaired.png</file>
diff --git a/icons/tab_addresses.png b/icons/tab_addresses.png
Binary files differ.
diff --git a/icons/tab_coins.png b/icons/tab_coins.png
Binary files differ.
diff --git a/icons/tab_console.png b/icons/tab_console.png
Binary files differ.
diff --git a/icons/tab_contacts.png b/icons/tab_contacts.png
Binary files differ.
diff --git a/icons/tab_history.png b/icons/tab_history.png
Binary files differ.
diff --git a/icons/tab_receive.png b/icons/tab_receive.png
Binary files differ.
diff --git a/icons/tab_send.png b/icons/tab_send.png
Binary files differ.