Browse Source

qt console history: ensure partial writes

master
ThomasV 4 years ago
parent
commit
35a86ec5aa
  1. 2
      electrum/gui/qt/console.py
  2. 3
      electrum/gui/qt/main_window.py

2
electrum/gui/qt/console.py

@ -187,6 +187,8 @@ class Console(QtWidgets.QPlainTextEdit):
return
if command and (not self.history or self.history[-1] != command):
while len(self.history) >= 50:
self.history.remove(self.history[0])
self.history.append(command)
self.history_index = len(self.history)

3
electrum/gui/qt/main_window.py

@ -1550,7 +1550,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger, QtEventListener):
def update_console(self):
console = self.console
console.history = self.wallet.db.get("qt-console-history", [])
console.history = self.wallet.db.get_stored_item("qt-console-history", [])
console.history_index = len(console.history)
console.updateNamespace({
@ -2620,7 +2620,6 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger, QtEventListener):
g = self.geometry()
self.wallet.db.put("winpos-qt", [g.left(),g.top(),
g.width(),g.height()])
self.wallet.db.put("qt-console-history", self.console.history[-50:])
if self.qr_window:
self.qr_window.close()
self.close_wallet()

Loading…
Cancel
Save