From ca1043ffdab24a13dcec7521b09f0b73e597bb02 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Sat, 8 Dec 2018 05:52:09 +0100 Subject: [PATCH] qt history list: hide columns sooner while wallet was starting up "hidden columns" were visible --- electrum/gui/qt/address_dialog.py | 2 +- electrum/gui/qt/history_list.py | 8 +++++++- electrum/gui/qt/main_window.py | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/electrum/gui/qt/address_dialog.py b/electrum/gui/qt/address_dialog.py index d039ec42c..25d9dbf8c 100644 --- a/electrum/gui/qt/address_dialog.py +++ b/electrum/gui/qt/address_dialog.py @@ -89,7 +89,7 @@ class AddressDialog(WindowModalDialog): vbox.addWidget(QLabel(_("History"))) addr_hist_model = AddressHistoryModel(self.parent, self.address) self.hw = HistoryList(self.parent, addr_hist_model) - addr_hist_model.view = self.hw + addr_hist_model.set_view(self.hw) vbox.addWidget(self.hw) vbox.addLayout(Buttons(CloseButton(self))) diff --git a/electrum/gui/qt/history_list.py b/electrum/gui/qt/history_list.py index 5b34ce442..d11c4514c 100644 --- a/electrum/gui/qt/history_list.py +++ b/electrum/gui/qt/history_list.py @@ -76,10 +76,16 @@ class HistoryModel(QAbstractItemModel, PrintError): def __init__(self, parent): super().__init__(parent) self.parent = parent - self.view = None # type: HistoryList # set by caller! FIXME... + self.view = None # type: HistoryList self.transactions = OrderedDictWithIndex() self.tx_status_cache = {} # type: Dict[str, Tuple[int, str]] + def set_view(self, history_list: 'HistoryList'): + # FIXME HistoryModel and HistoryList mutually depend on each other. + # After constructing both, this method needs to be called. + self.view = history_list # type: HistoryList + self.set_visibility_of_columns() + def columnCount(self, parent: QModelIndex): return self.NUM_COLUMNS diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py index c33429b61..037ff1bd1 100644 --- a/electrum/gui/qt/main_window.py +++ b/electrum/gui/qt/main_window.py @@ -812,7 +812,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError): def create_history_tab(self): self.history_model = HistoryModel(self) self.history_list = l = HistoryList(self, self.history_model) - self.history_model.view = self.history_list + self.history_model.set_view(self.history_list) l.searchable_list = l toolbar = l.create_toolbar(self.config) toolbar_shown = self.config.get('show_toolbar_history', False)