Qt: call create_toolbar in create_list_tab
This commit is contained in:
@@ -108,6 +108,9 @@ class AddressList(MyTreeView):
|
|||||||
self.update()
|
self.update()
|
||||||
self.sortByColumn(self.Columns.TYPE, Qt.AscendingOrder)
|
self.sortByColumn(self.Columns.TYPE, Qt.AscendingOrder)
|
||||||
|
|
||||||
|
def create_toolbar(self, config):
|
||||||
|
return self.create_toolbar_with_buttons(config)
|
||||||
|
|
||||||
def get_toolbar_buttons(self):
|
def get_toolbar_buttons(self):
|
||||||
return QLabel(_("Filter:")), self.change_button, self.used_button
|
return QLabel(_("Filter:")), self.change_button, self.used_button
|
||||||
|
|
||||||
|
|||||||
@@ -353,7 +353,7 @@ class ChannelsList(MyTreeView):
|
|||||||
else:
|
else:
|
||||||
self.swap_button.setEnabled(False)
|
self.swap_button.setEnabled(False)
|
||||||
|
|
||||||
def get_toolbar(self):
|
def create_toolbar(self, config):
|
||||||
h = QHBoxLayout()
|
h = QHBoxLayout()
|
||||||
self.can_send_label = QLabel('')
|
self.can_send_label = QLabel('')
|
||||||
h.addWidget(self.can_send_label)
|
h.addWidget(self.can_send_label)
|
||||||
|
|||||||
@@ -519,6 +519,9 @@ class HistoryList(MyTreeView, AcceptFileDragDrop):
|
|||||||
self.end_button.setText(_('To') + ' ' + self.format_date(self.end_date))
|
self.end_button.setText(_('To') + ' ' + self.format_date(self.end_date))
|
||||||
self.hide_rows()
|
self.hide_rows()
|
||||||
|
|
||||||
|
def create_toolbar(self, config):
|
||||||
|
return self.create_toolbar_with_buttons(config)
|
||||||
|
|
||||||
def create_toolbar_buttons(self):
|
def create_toolbar_buttons(self):
|
||||||
self.period_combo = QComboBox()
|
self.period_combo = QComboBox()
|
||||||
self.start_button = QPushButton('-')
|
self.start_button = QPushButton('-')
|
||||||
|
|||||||
@@ -1040,16 +1040,14 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger, QtEventListener):
|
|||||||
|
|
||||||
def create_channels_tab(self):
|
def create_channels_tab(self):
|
||||||
self.channels_list = ChannelsList(self)
|
self.channels_list = ChannelsList(self)
|
||||||
t = self.channels_list.get_toolbar()
|
return self.create_list_tab(self.channels_list)
|
||||||
return self.create_list_tab(self.channels_list, t)
|
|
||||||
|
|
||||||
def create_history_tab(self):
|
def create_history_tab(self):
|
||||||
self.history_model = HistoryModel(self)
|
self.history_model = HistoryModel(self)
|
||||||
self.history_list = l = HistoryList(self, self.history_model)
|
self.history_list = l = HistoryList(self, self.history_model)
|
||||||
self.history_model.set_view(self.history_list)
|
self.history_model.set_view(self.history_list)
|
||||||
l.searchable_list = l
|
l.searchable_list = l
|
||||||
toolbar = l.create_toolbar(self.config)
|
tab = self.create_list_tab(self.history_list)
|
||||||
tab = self.create_list_tab(l, toolbar)
|
|
||||||
toolbar_shown = bool(self.config.get('show_toolbar_history', False))
|
toolbar_shown = bool(self.config.get('show_toolbar_history', False))
|
||||||
l.show_toolbar(toolbar_shown)
|
l.show_toolbar(toolbar_shown)
|
||||||
return tab
|
return tab
|
||||||
@@ -1332,13 +1330,14 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger, QtEventListener):
|
|||||||
self.utxo_list.refresh_all()
|
self.utxo_list.refresh_all()
|
||||||
self.utxo_list.selectionModel().clearSelection()
|
self.utxo_list.selectionModel().clearSelection()
|
||||||
|
|
||||||
def create_list_tab(self, l, toolbar=None):
|
def create_list_tab(self, l):
|
||||||
w = QWidget()
|
w = QWidget()
|
||||||
w.searchable_list = l
|
w.searchable_list = l
|
||||||
vbox = QVBoxLayout()
|
vbox = QVBoxLayout()
|
||||||
w.setLayout(vbox)
|
w.setLayout(vbox)
|
||||||
#vbox.setContentsMargins(0, 0, 0, 0)
|
#vbox.setContentsMargins(0, 0, 0, 0)
|
||||||
#vbox.setSpacing(0)
|
#vbox.setSpacing(0)
|
||||||
|
toolbar = l.create_toolbar(self.config)
|
||||||
if toolbar:
|
if toolbar:
|
||||||
vbox.addLayout(toolbar)
|
vbox.addLayout(toolbar)
|
||||||
vbox.addWidget(l)
|
vbox.addWidget(l)
|
||||||
@@ -1346,11 +1345,10 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger, QtEventListener):
|
|||||||
|
|
||||||
def create_addresses_tab(self):
|
def create_addresses_tab(self):
|
||||||
from .address_list import AddressList
|
from .address_list import AddressList
|
||||||
self.address_list = l = AddressList(self)
|
self.address_list = AddressList(self)
|
||||||
toolbar = l.create_toolbar(self.config)
|
tab = self.create_list_tab(self.address_list)
|
||||||
tab = self.create_list_tab(l, toolbar)
|
|
||||||
toolbar_shown = bool(self.config.get('show_toolbar_addresses', False))
|
toolbar_shown = bool(self.config.get('show_toolbar_addresses', False))
|
||||||
l.show_toolbar(toolbar_shown)
|
self.address_list.show_toolbar(toolbar_shown)
|
||||||
return tab
|
return tab
|
||||||
|
|
||||||
def create_utxo_tab(self):
|
def create_utxo_tab(self):
|
||||||
|
|||||||
@@ -742,7 +742,10 @@ class MyTreeView(QTreeView):
|
|||||||
for row in range(self.model().rowCount()):
|
for row in range(self.model().rowCount()):
|
||||||
self.hide_row(row)
|
self.hide_row(row)
|
||||||
|
|
||||||
def create_toolbar(self, config=None):
|
def create_toolbar(self, config):
|
||||||
|
return
|
||||||
|
|
||||||
|
def create_toolbar_with_buttons(self, config=None):
|
||||||
hbox = QHBoxLayout()
|
hbox = QHBoxLayout()
|
||||||
buttons = self.get_toolbar_buttons()
|
buttons = self.get_toolbar_buttons()
|
||||||
for b in buttons:
|
for b in buttons:
|
||||||
|
|||||||
Reference in New Issue
Block a user