From 58481afda2906e3553bfcdfc49f9b353d46430aa Mon Sep 17 00:00:00 2001 From: mailchuck Date: Fri, 29 Apr 2016 11:43:40 +0200 Subject: [PATCH] Completer unicode fixes --- src/bitmessageqt/__init__.py | 8 ++++---- src/bitmessageqt/foldertree.py | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py index fdac6d7c..46b414f4 100644 --- a/src/bitmessageqt/__init__.py +++ b/src/bitmessageqt/__init__.py @@ -1895,13 +1895,13 @@ class MyForm(settingsmixin.SMainWindow): completerList = [] for address in sorted(oldRows, key = lambda x: oldRows[x][2], reverse = True): if address in newRows: - completerList.append(newRows[address][0] + " <" + address + ">") + completerList.append(unicode(newRows[address][0], encoding="UTF-8") + " <" + address + ">") newRows.pop(address) else: self.ui.tableWidgetAddressBook.removeRow(oldRows[address][2]) for address in newRows: addRow(address, newRows[address][0], newRows[address][1]) - completerList.append(newRows[address][0] + " <" + address + ">") + completerList.append(unicode(newRows[address][0], encoding="UTF-8") + " <" + address + ">") # sort self.ui.tableWidgetAddressBook.sortByColumn(0, Qt.AscendingOrder) @@ -3187,8 +3187,8 @@ class MyForm(settingsmixin.SMainWindow): if self.ui.lineEditTo.text() == '': self.ui.lineEditTo.setText(stringToAdd) else: - self.ui.lineEditTo.setText(str( - self.ui.lineEditTo.text()) + '; ' + stringToAdd) + self.ui.lineEditTo.setText(unicode( + self.ui.lineEditTo.text().toUtf8(), encoding="UTF-8") + '; ' + stringToAdd) if listOfSelectedRows == {}: self.statusBar().showMessage(_translate( "MainWindow", "No addresses selected.")) diff --git a/src/bitmessageqt/foldertree.py b/src/bitmessageqt/foldertree.py index e77ea74b..ed76eac2 100644 --- a/src/bitmessageqt/foldertree.py +++ b/src/bitmessageqt/foldertree.py @@ -491,7 +491,7 @@ class AddressBookCompleter(QtGui.QCompleter): def splitPath(self, path): stringList = [] - text = unicode(path.toUtf8()) + text = unicode(path.toUtf8(), encoding="UTF-8") splitIndex = rfind(text[0:self.widget().cursorPosition()], ";") + 1 str = text[splitIndex:self.widget().cursorPosition()] str = rstrip(lstrip(str)) @@ -499,8 +499,8 @@ class AddressBookCompleter(QtGui.QCompleter): return stringList def pathFromIndex(self, index): - autoString = unicode(index.data(QtCore.Qt.EditRole).toString()) - text = unicode(self.widget().text().toUtf8()) + autoString = unicode(index.data(QtCore.Qt.EditRole).toString().toUtf8(), encoding="UTF-8") + text = unicode(self.widget().text().toUtf8(), encoding="UTF-8") # If cursor position was saved, restore it, else save it if self.cursorPos != -1: