fix unicode path issue #2269
This commit is contained in:
@@ -174,7 +174,8 @@ class InstallWizard(QDialog, MessageBoxMixin, BaseWizard):
|
|||||||
self.name_e.setText(path)
|
self.name_e.setText(path)
|
||||||
|
|
||||||
def on_filename(filename):
|
def on_filename(filename):
|
||||||
path = os.path.join(wallet_folder, unicode(filename))
|
filename = unicode(filename)
|
||||||
|
path = os.path.join(wallet_folder, filename.encode('utf8'))
|
||||||
try:
|
try:
|
||||||
self.storage = WalletStorage(path)
|
self.storage = WalletStorage(path)
|
||||||
except IOError:
|
except IOError:
|
||||||
@@ -204,7 +205,8 @@ class InstallWizard(QDialog, MessageBoxMixin, BaseWizard):
|
|||||||
|
|
||||||
button.clicked.connect(on_choose)
|
button.clicked.connect(on_choose)
|
||||||
self.name_e.textChanged.connect(on_filename)
|
self.name_e.textChanged.connect(on_filename)
|
||||||
self.name_e.setText(os.path.basename(self.storage.path))
|
n = os.path.basename(self.storage.path)
|
||||||
|
self.name_e.setText(n.decode('utf8'))
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
if self.storage.file_exists() and not self.storage.is_encrypted():
|
if self.storage.file_exists() and not self.storage.is_encrypted():
|
||||||
|
|||||||
@@ -352,7 +352,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
|||||||
|
|
||||||
def watching_only_changed(self):
|
def watching_only_changed(self):
|
||||||
title = 'Electrum %s - %s' % (self.wallet.electrum_version,
|
title = 'Electrum %s - %s' % (self.wallet.electrum_version,
|
||||||
self.wallet.basename())
|
self.wallet.basename().decode('utf8'))
|
||||||
extra = [self.wallet.storage.get('wallet_type', '?')]
|
extra = [self.wallet.storage.get('wallet_type', '?')]
|
||||||
if self.wallet.is_watching_only():
|
if self.wallet.is_watching_only():
|
||||||
self.warn_if_watching_only()
|
self.warn_if_watching_only()
|
||||||
@@ -397,7 +397,12 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
|||||||
self.show_critical(_("Electrum was unable to copy your wallet file to the specified location.") + "\n" + str(reason), title=_("Unable to create backup"))
|
self.show_critical(_("Electrum was unable to copy your wallet file to the specified location.") + "\n" + str(reason), title=_("Unable to create backup"))
|
||||||
|
|
||||||
def update_recently_visited(self, filename):
|
def update_recently_visited(self, filename):
|
||||||
|
filename = filename.decode('utf8')
|
||||||
recent = self.config.get('recently_open', [])
|
recent = self.config.get('recently_open', [])
|
||||||
|
try:
|
||||||
|
sorted(recent)
|
||||||
|
except:
|
||||||
|
recent = []
|
||||||
if filename in recent:
|
if filename in recent:
|
||||||
recent.remove(filename)
|
recent.remove(filename)
|
||||||
recent.insert(0, filename)
|
recent.insert(0, filename)
|
||||||
@@ -407,7 +412,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
|||||||
for i, k in enumerate(sorted(recent)):
|
for i, k in enumerate(sorted(recent)):
|
||||||
b = os.path.basename(k)
|
b = os.path.basename(k)
|
||||||
def loader(k):
|
def loader(k):
|
||||||
return lambda: self.gui_object.new_window(k)
|
return lambda: self.gui_object.new_window(k.encode('utf8'))
|
||||||
self.recently_visited_menu.addAction(b, loader(k)).setShortcut(QKeySequence("Ctrl+%d"%(i+1)))
|
self.recently_visited_menu.addAction(b, loader(k)).setShortcut(QKeySequence("Ctrl+%d"%(i+1)))
|
||||||
self.recently_visited_menu.setEnabled(len(recent))
|
self.recently_visited_menu.setEnabled(len(recent))
|
||||||
|
|
||||||
@@ -693,7 +698,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
|||||||
text = _("Not connected")
|
text = _("Not connected")
|
||||||
icon = QIcon(":icons/status_disconnected.png")
|
icon = QIcon(":icons/status_disconnected.png")
|
||||||
|
|
||||||
self.tray.setToolTip("%s (%s)" % (text, self.wallet.basename()))
|
self.tray.setToolTip("%s (%s)" % (text, self.wallet.basename().decode('utf8')))
|
||||||
self.balance_label.setText(text)
|
self.balance_label.setText(text)
|
||||||
self.status_button.setIcon( icon )
|
self.status_button.setIcon( icon )
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ class BaseWizard(object):
|
|||||||
|
|
||||||
def new(self):
|
def new(self):
|
||||||
name = os.path.basename(self.storage.path)
|
name = os.path.basename(self.storage.path)
|
||||||
title = _("Create '%s'"%name)
|
title = _("Create") + ' ' + name.decode('utf8')
|
||||||
message = '\n'.join([
|
message = '\n'.join([
|
||||||
_("What kind of wallet do you want to create?")
|
_("What kind of wallet do you want to create?")
|
||||||
])
|
])
|
||||||
|
|||||||
Reference in New Issue
Block a user