Browse Source

python3: remove calls to unicode function

master
ThomasV 8 years ago
parent
commit
15642ec8de
  1. 4
      gui/kivy/uix/dialogs/installwizard.py
  2. 6
      gui/qt/installwizard.py
  3. 3
      lib/mnemonic.py
  4. 6
      lib/storage.py
  5. 2
      lib/websockets.py

4
gui/kivy/uix/dialogs/installwizard.py

@ -704,7 +704,7 @@ class AddXpubDialog(WizardDialog):
def get_text(self): def get_text(self):
ti = self.ids.text_input ti = self.ids.text_input
return unicode(ti.text).strip() return ti.text.strip()
def get_params(self, button): def get_params(self, button):
return (self.get_text(),) return (self.get_text(),)
@ -715,7 +715,7 @@ class AddXpubDialog(WizardDialog):
self.app.scan_qr(on_complete) self.app.scan_qr(on_complete)
def do_paste(self): def do_paste(self):
self.ids.text_input.text = test_xpub if is_test else unicode(self.app._clipboard.paste()) self.ids.text_input.text = test_xpub if is_test else self.app._clipboard.paste()
def do_clear(self): def do_clear(self):
self.ids.text_input.text = '' self.ids.text_input.text = ''

6
gui/qt/installwizard.py

@ -176,7 +176,7 @@ class InstallWizard(QDialog, MessageBoxMixin, BaseWizard):
wallet_folder = os.path.dirname(self.storage.path) wallet_folder = os.path.dirname(self.storage.path)
def on_choose(): def on_choose():
path = unicode(QFileDialog.getOpenFileName(self, "Select your wallet file", wallet_folder)) path = QFileDialog.getOpenFileName(self, "Select your wallet file", wallet_folder)
if path: if path:
self.name_e.setText(path) self.name_e.setText(path)
@ -222,7 +222,7 @@ class InstallWizard(QDialog, MessageBoxMixin, BaseWizard):
if not self.storage.file_exists(): if not self.storage.file_exists():
break break
if self.storage.file_exists() and self.storage.is_encrypted(): if self.storage.file_exists() and self.storage.is_encrypted():
password = unicode(self.pw_e.text()) password = self.pw_e.text()
try: try:
self.storage.decrypt(password) self.storage.decrypt(password)
break break
@ -467,7 +467,7 @@ class InstallWizard(QDialog, MessageBoxMixin, BaseWizard):
line = QLineEdit() line = QLineEdit()
line.setText(default) line.setText(default)
def f(text): def f(text):
self.next_button.setEnabled(test(unicode(text))) self.next_button.setEnabled(test(text))
line.textEdited.connect(f) line.textEdited.connect(f)
vbox.addWidget(line) vbox.addWidget(line)
vbox.addWidget(WWLabel(warning)) vbox.addWidget(WWLabel(warning))

3
lib/mnemonic.py

@ -86,9 +86,6 @@ def is_CJK(c):
def normalize_text(seed): def normalize_text(seed):
# normalize # normalize
if six.PY2:
seed = unicodedata.normalize('NFKD', unicode(seed))
else:
seed = unicodedata.normalize('NFKD', str(seed)) seed = unicodedata.normalize('NFKD', str(seed))
# lower # lower
seed = seed.lower() seed = seed.lower()

6
lib/storage.py

@ -85,12 +85,6 @@ class WalletStorage(PrintError):
except Exception as e: except Exception as e:
raise IOError("Cannot read wallet file '%s'" % self.path) raise IOError("Cannot read wallet file '%s'" % self.path)
self.data = {} self.data = {}
# In old versions of Electrum labels were latin1 encoded, this fixes breakage.
for i, label in labels.items():
try:
unicode(label)
except UnicodeDecodeError:
d['labels'][i] = unicode(label.decode('latin1'))
for key, value in d.items(): for key, value in d.items():
try: try:
json.dumps(key) json.dumps(key)

2
lib/websockets.py

@ -114,7 +114,7 @@ class WsClientThread(util.DaemonThread):
for ws, amount in l: for ws, amount in l:
if not ws.closed: if not ws.closed:
if sum(result.values()) >=amount: if sum(result.values()) >=amount:
ws.sendMessage(unicode('paid')) ws.sendMessage('paid')

Loading…
Cancel
Save