Browse Source

Add tab icons

2.9.x
Johann Bauer 8 years ago
parent
commit
c4979864cc
  1. 59
      gui/qt/main_window.py
  2. 7
      icons.qrc
  3. BIN
      icons/tab_addresses.png
  4. BIN
      icons/tab_coins.png
  5. BIN
      icons/tab_console.png
  6. BIN
      icons/tab_contacts.png
  7. BIN
      icons/tab_history.png
  8. BIN
      icons/tab_receive.png
  9. BIN
      icons/tab_send.png

59
gui/qt/main_window.py

@ -128,17 +128,23 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
self.utxo_tab = self.create_utxo_tab() self.utxo_tab = self.create_utxo_tab()
self.console_tab = self.create_console_tab() self.console_tab = self.create_console_tab()
self.contacts_tab = self.create_contacts_tab() self.contacts_tab = self.create_contacts_tab()
tabs.addTab(self.create_history_tab(), _('History') ) tabs.addTab(self.create_history_tab(), QIcon(":icons/tab_history.png"), _('History'))
tabs.addTab(self.send_tab, _('Send') ) tabs.addTab(self.send_tab, QIcon(":icons/tab_send.png"), _('Send'))
tabs.addTab(self.receive_tab, _('Receive') ) tabs.addTab(self.receive_tab, QIcon(":icons/tab_receive.png"), _('Receive'))
if self.config.get('show_addresses_tab', False):
tabs.addTab(self.addresses_tab, _('Addresses')) def add_optional_tab(tabs, tab, icon, description, name):
if self.config.get('show_utxo_tab', False): tab.tab_icon = icon
tabs.addTab(self.utxo_tab, _('Coins')) tab.tab_description = description
if self.config.get('show_contacts_tab', False): tab.tab_pos = len(tabs)
tabs.addTab(self.contacts_tab, _('Contacts') ) tab.tab_name = name
if self.config.get('show_console_tab', False): if self.config.get('show_{}_tab'.format(name), False):
tabs.addTab(self.console_tab, _('Console') ) 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) tabs.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
self.setCentralWidget(tabs) self.setCentralWidget(tabs)
@ -207,9 +213,9 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
self.history_list.update() self.history_list.update()
def toggle_tab(self, tab): def toggle_tab(self, tab):
show = not self.config.get('show_{}_tab'.format(tab.name), False) show = not self.config.get('show_{}_tab'.format(tab.tab_name), False)
self.config.set_key('show_{}_tab'.format(tab.name), show) self.config.set_key('show_{}_tab'.format(tab.tab_name), show)
item_text = (_("Hide") if show else _("Show")) + " " + tab.description item_text = (_("Hide") if show else _("Show")) + " " + tab.tab_description
tab.menu_action.setText(item_text) tab.menu_action.setText(item_text)
if show: if show:
# Find out where to place the tab # Find out where to place the tab
@ -221,7 +227,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
break break
except AttributeError: except AttributeError:
pass pass
self.tabs.insertTab(index, tab, tab.description) self.tabs.insertTab(index, tab, tab.tab_icon, tab.tab_description)
else: else:
i = self.tabs.indexOf(tab) i = self.tabs.indexOf(tab)
self.tabs.removeTab(i) self.tabs.removeTab(i)
@ -459,19 +465,16 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
wallet_menu.addSeparator() wallet_menu.addSeparator()
wallet_menu.addAction(_("Find"), self.toggle_search).setShortcut(QKeySequence("Ctrl+F")) 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): def add_toggle_action(view_menu, tab):
is_shown = self.config.get('show_{}_tab'.format(tab_name), False) is_shown = self.config.get('show_{}_tab'.format(tab.tab_name), False)
item_name = (_("Hide") if is_shown else _("Show")) + " " + tab_description item_name = (_("Hide") if is_shown else _("Show")) + " " + tab.tab_description
target_tab.name = tab_name tab.menu_action = view_menu.addAction(item_name, lambda: self.toggle_tab(tab))
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))
view_menu = menubar.addMenu(_("&View")) view_menu = menubar.addMenu(_("&View"))
add_toggle_action(view_menu, self.addresses_tab, "Addresses", "addresses", 1) add_toggle_action(view_menu, self.addresses_tab)
add_toggle_action(view_menu, self.utxo_tab, "Coins", "utxo", 2) add_toggle_action(view_menu, self.utxo_tab)
add_toggle_action(view_menu, self.contacts_tab, "Contacts", "contacts", 3) add_toggle_action(view_menu, self.contacts_tab)
add_toggle_action(view_menu, self.console_tab, "Console", "console", 4) add_toggle_action(view_menu, self.console_tab)
tools_menu = menubar.addMenu(_("&Tools")) tools_menu = menubar.addMenu(_("&Tools"))
@ -515,7 +518,9 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
def show_about(self): def show_about(self):
QMessageBox.about(self, "Electrum", 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): def show_report_bug(self):
msg = ' '.join([ msg = ' '.join([

7
icons.qrc

@ -31,6 +31,13 @@
<file>icons/status_waiting.png</file> <file>icons/status_waiting.png</file>
<file>icons/status_lagging.png</file> <file>icons/status_lagging.png</file>
<file>icons/seal.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/tor_logo.png</file>
<file>icons/speaker.png</file> <file>icons/speaker.png</file>
<file>icons/trezor_unpaired.png</file> <file>icons/trezor_unpaired.png</file>

BIN
icons/tab_addresses.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 886 B

BIN
icons/tab_coins.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
icons/tab_console.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 824 B

BIN
icons/tab_contacts.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
icons/tab_history.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
icons/tab_receive.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
icons/tab_send.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Loading…
Cancel
Save