commit a3332dc72a1428b8230483f1130c381958ed80e5
parent 594f13b6f73aac45a3980a172e0ad9973943a8b2
Author: ThomasV <thomasv@electrum.org>
Date: Wed, 13 May 2020 15:13:09 +0200
show watchtower db size in GUI
Diffstat:
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/electrum/gui/qt/watchtower_dialog.py b/electrum/gui/qt/watchtower_dialog.py
@@ -25,7 +25,7 @@
from PyQt5.QtGui import QStandardItemModel, QStandardItem
from PyQt5.QtCore import Qt
-from PyQt5.QtWidgets import (QDialog, QVBoxLayout, QPushButton)
+from PyQt5.QtWidgets import (QDialog, QVBoxLayout, QPushButton, QLabel)
from electrum.i18n import _
from .util import MyTreeView, Buttons
@@ -53,6 +53,8 @@ class WatcherList(MyTreeView):
status = lnwatcher.get_channel_status(outpoint)
items = [QStandardItem(e) for e in [outpoint, "%d"%n, status]]
self.model().insertRow(self.model().rowCount(), items)
+ size = lnwatcher.sweepstore.filesize()
+ self.parent.size_label.setText('Database size: %.2f Mb'%(size/1024/1024.))
class WatchtowerDialog(QDialog):
@@ -66,9 +68,11 @@ class WatchtowerDialog(QDialog):
self.lnwatcher = self.network.local_watchtower
self.setWindowTitle(_('Watchtower'))
self.setMinimumSize(600, 20)
+ self.size_label = QLabel()
self.watcher_list = WatcherList(self)
vbox = QVBoxLayout(self)
+ vbox.addWidget(self.size_label)
vbox.addWidget(self.watcher_list)
b = QPushButton(_('Close'))
b.clicked.connect(self.close)
diff --git a/electrum/sql_db.py b/electrum/sql_db.py
@@ -28,6 +28,9 @@ class SqlDB(Logger):
self.sql_thread = threading.Thread(target=self.run_sql)
self.sql_thread.start()
+ def filesize(self):
+ return os.stat(self.path).st_size
+
def run_sql(self):
self.logger.info("SQL thread started")
self.conn = sqlite3.connect(self.path)