Browse Source

qt: add 'notes' tab

master
ThomasV 2 years ago
parent
commit
d691aa0736
  1. BIN
      electrum/gui/icons/pen.png
  2. 13
      electrum/gui/qt/main_window.py
  3. 1
      electrum/simple_config.py

BIN
electrum/gui/icons/pen.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

13
electrum/gui/qt/main_window.py

@ -210,6 +210,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger, QtEventListener):
self.addresses_tab = self.create_addresses_tab() self.addresses_tab = self.create_addresses_tab()
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.notes_tab = self.create_notes_tab()
self.contacts_tab = self.create_contacts_tab() self.contacts_tab = self.create_contacts_tab()
self.channels_tab = self.create_channels_tab() self.channels_tab = self.create_channels_tab()
tabs.addTab(self.create_history_tab(), read_QIcon("tab_history.png"), _('History')) tabs.addTab(self.create_history_tab(), read_QIcon("tab_history.png"), _('History'))
@ -228,6 +229,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger, QtEventListener):
add_optional_tab(tabs, self.utxo_tab, read_QIcon("tab_coins.png"), _("Co&ins")) add_optional_tab(tabs, self.utxo_tab, read_QIcon("tab_coins.png"), _("Co&ins"))
add_optional_tab(tabs, self.contacts_tab, read_QIcon("tab_contacts.png"), _("Con&tacts")) add_optional_tab(tabs, self.contacts_tab, read_QIcon("tab_contacts.png"), _("Con&tacts"))
add_optional_tab(tabs, self.console_tab, read_QIcon("tab_console.png"), _("Con&sole")) add_optional_tab(tabs, self.console_tab, read_QIcon("tab_console.png"), _("Con&sole"))
add_optional_tab(tabs, self.notes_tab, read_QIcon("pen.png"), _("&Notes"))
tabs.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) tabs.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
@ -738,6 +740,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger, QtEventListener):
add_toggle_action(view_menu, self.channels_tab) add_toggle_action(view_menu, self.channels_tab)
add_toggle_action(view_menu, self.contacts_tab) add_toggle_action(view_menu, self.contacts_tab)
add_toggle_action(view_menu, self.console_tab) add_toggle_action(view_menu, self.console_tab)
add_toggle_action(view_menu, self.notes_tab)
tools_menu = menubar.addMenu(_("&Tools")) # type: QMenu tools_menu = menubar.addMenu(_("&Tools")) # type: QMenu
preferences_action = tools_menu.addAction(_("Preferences"), self.settings_dialog) # type: QAction preferences_action = tools_menu.addAction(_("Preferences"), self.settings_dialog) # type: QAction
@ -1562,6 +1565,15 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger, QtEventListener):
console.is_shown_cv = self.config.cv.GUI_QT_SHOW_TAB_CONSOLE console.is_shown_cv = self.config.cv.GUI_QT_SHOW_TAB_CONSOLE
return console return console
def create_notes_tab(self):
from PyQt5 import QtGui, QtWidgets
notes_tab = QtWidgets.QPlainTextEdit()
notes_tab.setWordWrapMode(QtGui.QTextOption.WrapAnywhere)
notes_tab.setFont(QtGui.QFont(MONOSPACE_FONT, 10, QtGui.QFont.Normal))
notes_tab.setPlainText(self.wallet.db.get('notes_text', ''))
notes_tab.is_shown_cv = self.config.cv.GUI_QT_SHOW_TAB_NOTES
return notes_tab
def update_console(self): def update_console(self):
console = self.console console = self.console
console.history = self.wallet.db.get_stored_item("qt-console-history", []) console.history = self.wallet.db.get_stored_item("qt-console-history", [])
@ -2507,6 +2519,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger, QtEventListener):
fut.cancel() fut.cancel()
self.unregister_callbacks() self.unregister_callbacks()
self.config.GUI_QT_WINDOW_IS_MAXIMIZED = self.isMaximized() self.config.GUI_QT_WINDOW_IS_MAXIMIZED = self.isMaximized()
self.wallet.db.put('notes_text', self.notes_tab.toPlainText())
if not self.isMaximized(): if not self.isMaximized():
g = self.geometry() g = self.geometry()
self.wallet.db.put("winpos-qt", [g.left(),g.top(), self.wallet.db.put("winpos-qt", [g.left(),g.top(),

1
electrum/simple_config.py

@ -1099,6 +1099,7 @@ This will result in longer routes; it might increase your fees and decrease the
GUI_QT_SHOW_TAB_UTXO = ConfigVar('show_utxo_tab', default=False, type_=bool) GUI_QT_SHOW_TAB_UTXO = ConfigVar('show_utxo_tab', default=False, type_=bool)
GUI_QT_SHOW_TAB_CONTACTS = ConfigVar('show_contacts_tab', default=False, type_=bool) GUI_QT_SHOW_TAB_CONTACTS = ConfigVar('show_contacts_tab', default=False, type_=bool)
GUI_QT_SHOW_TAB_CONSOLE = ConfigVar('show_console_tab', default=False, type_=bool) GUI_QT_SHOW_TAB_CONSOLE = ConfigVar('show_console_tab', default=False, type_=bool)
GUI_QT_SHOW_TAB_NOTES = ConfigVar('show_notes_tab', default=False, type_=bool)
GUI_QML_PREFERRED_REQUEST_TYPE = ConfigVar('preferred_request_type', default='bolt11', type_=str) GUI_QML_PREFERRED_REQUEST_TYPE = ConfigVar('preferred_request_type', default='bolt11', type_=str)
GUI_QML_USER_KNOWS_PRESS_AND_HOLD = ConfigVar('user_knows_press_and_hold', default=False, type_=bool) GUI_QML_USER_KNOWS_PRESS_AND_HOLD = ConfigVar('user_knows_press_and_hold', default=False, type_=bool)

Loading…
Cancel
Save