1
0

pass network to NetworkDialog and Blockchain

This commit is contained in:
thomasv
2013-09-10 18:27:32 +02:00
parent 2df129cfbf
commit 73901a001a
5 changed files with 20 additions and 13 deletions

View File

@@ -1366,7 +1366,7 @@ class ElectrumWindow(QMainWindow):
console.history = self.config.get("console-history",[])
console.history_index = len(console.history)
console.updateNamespace({'wallet' : self.wallet, 'network' : self.wallet.network, 'gui':self})
console.updateNamespace({'wallet' : self.wallet, 'network' : self.network, 'gui':self})
console.updateNamespace({'util' : util, 'bitcoin':bitcoin})
c = commands.Commands(self.wallet, self.wallet.interface, lambda: self.console.set_json(True))
@@ -2230,7 +2230,7 @@ class ElectrumWindow(QMainWindow):
self.receive_tab_set_mode(expert_cb.isChecked())
def run_network_dialog(self):
NetworkDialog(self.wallet.interface, self.config, self).do_exec()
NetworkDialog(self.wallet.network, self.config, self).do_exec()
def closeEvent(self, event):
g = self.geometry()

View File

@@ -18,8 +18,6 @@ class InstallWizard(QDialog):
QDialog.__init__(self)
self.config = config
self.network = network
self.interface = network.interface
self.blockchain = network.blockchain
self.storage = storage
@@ -217,7 +215,7 @@ class InstallWizard(QDialog):
return
if b2.isChecked():
return NetworkDialog(self.interface, self.config, None).do_exec()
return NetworkDialog(self.network, self.config, None).do_exec()
elif b1.isChecked():
self.config.set_key('auto_cycle', True, True)

View File

@@ -31,20 +31,21 @@ protocol_names = ['TCP', 'HTTP', 'SSL', 'HTTPS']
protocol_letters = 'thsg'
class NetworkDialog(QDialog):
def __init__(self, interface, config, parent):
def __init__(self, network, config, parent):
QDialog.__init__(self,parent)
self.setModal(1)
self.setWindowTitle(_('Server'))
self.setMinimumSize(375, 20)
self.interface = interface
self.network = network
self.interface = interface = network.interface
self.config = config
self.protocol = None
if parent:
if interface.is_connected:
status = _("Connected to")+" %s"%(interface.host) + "\n%d "%(parent.wallet.verifier.blockchain.height)+_("blocks")
status = _("Connected to")+" %s"%(interface.host) + "\n%d "%(network.blockchain.height)+_("blocks")
else:
status = _("Not connected")
server = interface.server
@@ -55,6 +56,7 @@ class NetworkDialog(QDialog):
self.servers = interface.get_servers()
vbox = QVBoxLayout()
vbox.setSpacing(30)