Merge pull request #179 from albertosottile/master

Fixing some unicode and Italian translation issues
This commit is contained in:
Etoh 2018-04-07 21:18:19 +01:00 committed by GitHub
commit e80a6aab89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 4 deletions

View File

@ -1929,6 +1929,10 @@ class FileSwitchManager(object):
return False
def notifyUserIfFileNotInMediaDirectory(self, filenameToFind, path):
try:
path = path.decode('utf-8')
except UnicodeEncodeError:
pass
directoryToFind = os.path.dirname(path)
if directoryToFind in self.mediaDirectoriesNotFound:
return

View File

@ -50,7 +50,7 @@ it = {
"file-different-notification" : u"Il file che stai riproducendo sembra essere diverso da quello di {}", # User
"file-differences-notification" : u"Il tuo file mostra le seguenti differenze: {}", # Differences
"room-file-differences" : u"Differenze: {} \n", # File differences (filename, size, and/or duration)
"room-file-differences" : u"Differenze: {}", # File differences (filename, size, and/or duration)
"file-difference-filename" : u"nome",
"file-difference-filesize" : u"dimensione",
"file-difference-duration" : u"durata",

View File

@ -91,6 +91,10 @@ class ConsoleUI(threading.Thread):
def showMessage(self, message, noTimestamp=False):
message = message.encode(sys.stdout.encoding, 'replace')
try:
message = message.decode('utf-8')
except UnicodeEncodeError:
pass
if noTimestamp:
print(message)
else:

View File

@ -19,6 +19,7 @@ from twisted.internet import task
from syncplay.ui.consoleUI import ConsoleUI
if isMacOS() and IsPySide:
from Foundation import NSURL
from Cocoa import NSString, NSUTF8StringEncoding
lastCheckedForUpdates = None
class ConsoleInGUI(ConsoleUI):
@ -222,7 +223,9 @@ class MainWindow(QtWidgets.QMainWindow):
for url in urls[::-1]:
if isMacOS() and IsPySide:
dropfilepath = os.path.abspath(NSURL.URLWithString_(str(url.toString())).filePathURL().path())
macURL = NSString.alloc().initWithString_(unicode(url.toString()))
pathString = macURL.stringByAddingPercentEscapesUsingEncoding_(NSUTF8StringEncoding)
dropfilepath = os.path.abspath(NSURL.URLWithString_(pathString).filePathURL().path())
else:
dropfilepath = os.path.abspath(unicode(url.toLocalFile()))
if os.path.isfile(dropfilepath):
@ -327,7 +330,9 @@ class MainWindow(QtWidgets.QMainWindow):
indexRow = window.playlist.count()
for url in urls[::-1]:
if isMacOS() and IsPySide:
dropfilepath = os.path.abspath(NSURL.URLWithString_(str(url.toString())).filePathURL().path())
macURL = NSString.alloc().initWithString_(unicode(url.toString()))
pathString = macURL.stringByAddingPercentEscapesUsingEncoding_(NSUTF8StringEncoding)
dropfilepath = os.path.abspath(NSURL.URLWithString_(pathString).filePathURL().path())
else:
dropfilepath = os.path.abspath(unicode(url.toLocalFile()))
if os.path.isfile(dropfilepath):
@ -1609,7 +1614,9 @@ class MainWindow(QtWidgets.QMainWindow):
if urls and urls[0].scheme() == 'file':
url = event.mimeData().urls()[0]
if isMacOS() and IsPySide:
dropfilepath = os.path.abspath(NSURL.URLWithString_(str(url.toString())).filePathURL().path())
macURL = NSString.alloc().initWithString_(unicode(url.toString()))
pathString = macURL.stringByAddingPercentEscapesUsingEncoding_(NSUTF8StringEncoding)
dropfilepath = os.path.abspath(NSURL.URLWithString_(pathString).filePathURL().path())
else:
dropfilepath = os.path.abspath(unicode(url.toLocalFile()))
if rewindFile == False: