Initial novacoin support
[electrum-nvc.git] / gui / qt / network_dialog.py
index f9cbe6d..c664993 100644 (file)
 # along with this program. If not, see <http://www.gnu.org/licenses/>.
 
 import sys, time, datetime, re, threading
-from electrum.i18n import _
-from electrum.util import print_error, print_msg
+from electrum_nvc.i18n import _
+from electrum_nvc.util import print_error, print_msg
 import os.path, json, ast, traceback
 
 from PyQt4.QtGui import *
 from PyQt4.QtCore import *
-from electrum import DEFAULT_SERVERS, DEFAULT_PORTS
+from electrum_nvc import DEFAULT_SERVERS, DEFAULT_PORTS
 
 from util import *
 
@@ -39,19 +39,18 @@ class NetworkDialog(QDialog):
         self.setMinimumSize(375, 20)
 
         self.network = network
-        self.interface = interface = network.interface
         self.config = config
         self.protocol = None
 
         if parent:
             n = len(network.interfaces)
             if n:
-                status = _("Blockchain") + ": " + "%d "%(network.blockchain.height) + _("blocks") +  ".\n" + _("Getting block headers from %d nodes.")%n
+                status = _("Blockchain") + ": " + "%d "%(network.blockchain.height()) + _("blocks") +  ".\n" + _("Getting block headers from %d nodes.")%n
             else:
                 status = _("Not connected")
 
             if network.is_connected():
-                status += "\n" + _("Server:") + " %s"%(interface.host) 
+                status += "\n" + _("Server") + ": %s"%(network.interface.host) 
             else:
                 status += "\n" + _("Disconnected from server")
                 
@@ -105,7 +104,7 @@ class NetworkDialog(QDialog):
         self.autocycle_cb.setChecked(self.config.get('auto_cycle', True))
         grid.addWidget(self.autocycle_cb, 0, 1)
         if not self.config.is_modifiable('auto_cycle'): self.autocycle_cb.setEnabled(False)
-        msg = _("If auto-connect is enabled, Electrum will always use a server that is on the the longest blockchain.") + " " \
+        msg = _("If auto-connect is enabled, Electrum will always use a server that is on the longest blockchain.") + " " \
             + _("If it is disabled, Electrum will warn you if your server is lagging.")
         grid.addWidget(HelpButton(msg), 0, 4)
 
@@ -121,10 +120,9 @@ class NetworkDialog(QDialog):
 
         if server:
             host, port, protocol = server.split(':')
-            self.set_protocol(protocol)
             self.change_server(host, protocol)
-        else:
-            self.set_protocol('s')
+
+        self.set_protocol(self.network.protocol)
 
         self.servers_list_widget.connect(self.servers_list_widget, 
                                          SIGNAL('currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)'),