mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-01 17:55:20 +00:00
show watchtower db size in GUI
This commit is contained in:
parent
594f13b6f7
commit
a3332dc72a
2 changed files with 8 additions and 1 deletions
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue