diff --git a/syncplay/client.py b/syncplay/client.py index edc347a..de75975 100644 --- a/syncplay/client.py +++ b/syncplay/client.py @@ -129,7 +129,7 @@ class SyncplayClient(object): if constants.DEBUG_MODE and constants.WARN_ABOUT_MISSING_STRINGS: missingStrings = getMissingStrings() if missingStrings is not None and missingStrings is not "": - self.ui.showDebugMessage("MISSING/UNUSED STRINGS DETECTED:\n{}".format(missingStrings)) + self.ui.showDebugMessage(u"MISSING/UNUSED STRINGS DETECTED:\n{}".format(missingStrings)) def initProtocol(self, protocol): self._protocol = protocol @@ -953,9 +953,9 @@ class SyncplayUser(object): def __repr__(self, *args, **kwargs): if self.file: - return "{}: {} ({}, {})".format(self.username, self.file['name'], self.file['duration'], self.file['size']) + return u"{}: {} ({}, {})".format(self.username, self.file['name'], self.file['duration'], self.file['size']) else: - return "{}".format(self.username) + return u"{}".format(self.username) def setControllerStatus(self, isController): self._controller = isController @@ -1280,7 +1280,7 @@ class UiManager(object): def showDebugMessage(self, message): if constants.DEBUG_MODE and message.rstrip(): - sys.stderr.write("{}{}\n".format(time.strftime(constants.UI_TIME_FORMAT, time.localtime()),message.rstrip())) + sys.stderr.write(u"{}{}\n".format(time.strftime(constants.UI_TIME_FORMAT, time.localtime()),message.rstrip())) def showMessage(self, message, noPlayer=False, noTimestamp=False, secondaryOSD=False): if not noPlayer: self.showOSDMessage(message, duration=constants.OSD_DURATION, secondaryOSD=secondaryOSD) @@ -1353,7 +1353,7 @@ class SyncplayPlaylist(): @wraps(f) def wrapper(self, *args, **kwds): if not self._client.sharedPlaylistIsEnabled(): - self._ui.showDebugMessage("Tried to use shared playlists when it was disabled!") + self._ui.showDebugMessage(u"Tried to use shared playlists when it was disabled!") return return f(self, *args, **kwds) return wrapper @@ -1640,14 +1640,14 @@ class FileSwitchManager(object): if dirsToSearch: # Spin up hard drives to prevent premature timeout - randomFilename = u"RandomFile"+unicode(random.randrange(10000, 99999))+".txt" + randomFilename = u"RandomFile"+unicode(random.randrange(10000, 99999))+u".txt" for directory in dirsToSearch: if not os.path.isdir(directory): self.directorySearchError = getMessage("cannot-find-directory-error").format(directory) startTime = time.time() if os.path.isfile(os.path.join(directory, randomFilename)): - randomFilename = u"RandomFile"+unicode(random.randrange(10000, 99999))+".txt" + randomFilename = u"RandomFile"+unicode(random.randrange(10000, 99999))+u".txt" if time.time() - startTime > constants.FOLDER_SEARCH_FIRST_FILE_TIMEOUT: self.folderSearchEnabled = False self.directorySearchError = getMessage("folder-search-first-file-timeout-error").format(directory) @@ -1688,11 +1688,11 @@ class FileSwitchManager(object): if highPriority and self.folderSearchEnabled: directoryList = self.mediaDirectories # Spin up hard drives to prevent premature timeout - randomFilename = u"RandomFile"+unicode(random.randrange(10000, 99999))+".txt" + randomFilename = u"RandomFile"+unicode(random.randrange(10000, 99999))+u".txt" for directory in directoryList: startTime = time.time() if os.path.isfile(os.path.join(directory, randomFilename)): - randomFilename = u"RandomFile"+unicode(random.randrange(10000, 99999))+".txt" + randomFilename = u"RandomFile"+unicode(random.randrange(10000, 99999))+u".txt" if not self.folderSearchEnabled: return if time.time() - startTime > constants.FOLDER_SEARCH_FIRST_FILE_TIMEOUT: diff --git a/syncplay/messages_en.py b/syncplay/messages_en.py index 2aafa48..e695292 100644 --- a/syncplay/messages_en.py +++ b/syncplay/messages_en.py @@ -207,7 +207,7 @@ en = { "showdifferentroomosd-label" : "Include events in other rooms", "showslowdownosd-label" :"Include slowing down / reverting notifications", "language-label" : "Language:", - "automatic-language" : "Default ({})", # Default language + "automatic-language" : u"Default ({})", # Default language "showdurationnotification-label" : "Warn about media duration mismatches", "basics-label" : "Basics", "readiness-label" : u"Play/Pause", @@ -345,7 +345,7 @@ en = { "seektime-msgbox-label" : "Jump to specified time (in seconds / min:sec). Use +/- for relative seek.", "ready-tooltip" : "Indicates whether you are ready to watch.", "autoplay-tooltip" : "Auto-play when all users who have readiness indicator are ready and minimum user threshold met.", - "switch-to-file-tooltip" : "Double click to switch to {}", # Filename + "switch-to-file-tooltip" : u"Double click to switch to {}", # Filename # In-userlist notes (GUI) "differentsize-note" : "Different size!", @@ -358,8 +358,8 @@ en = { # Server notifications "welcome-server-notification" : "Welcome to Syncplay server, ver. {0}", # version - "client-connected-room-server-notification" : "{0}({2}) connected to room '{1}'", # username, host, room - "client-left-server-notification" : "{0} left server", # name + "client-connected-room-server-notification" : u"{0}({2}) connected to room '{1}'", # username, host, room + "client-left-server-notification" : u"{0} left server", # name "no-salt-notification" : "PLEASE NOTE: To allow room operator passwords generated by this server instance to still work when the server is restarted, please add the following command line argument when running the Syncplay server in the future: --salt {}", #Salt @@ -373,13 +373,13 @@ en = { "server-disable-ready-argument" : u"disable readiness feature", "server-motd-argument": "path to file from which motd will be fetched", "server-messed-up-motd-unescaped-placeholders": "Message of the Day has unescaped placeholders. All $ signs should be doubled ($$).", - "server-messed-up-motd-too-long": "Message of the Day is too long - maximum of {} chars, {} given.", + "server-messed-up-motd-too-long": u"Message of the Day is too long - maximum of {} chars, {} given.", # Server errors - "unknown-command-server-error" : "Unknown command {}", # message + "unknown-command-server-error" : u"Unknown command {}", # message "not-json-server-error" : "Not a json encoded string {}", # message "not-known-server-error" : "You must be known to server before sending this command", - "client-drop-server-error" : "Client drop: {} -- {}", # host, error + "client-drop-server-error" : u"Client drop: {} -- {}", # host, error "password-required-server-error" : "Password required", "wrong-password-server-error" : "Wrong password supplied", "hello-server-error" : "Not enough Hello arguments", diff --git a/syncplay/players/mpv.py b/syncplay/players/mpv.py index a0b30e0..01bf160 100644 --- a/syncplay/players/mpv.py +++ b/syncplay/players/mpv.py @@ -76,7 +76,7 @@ class OldMpvPlayer(MpvPlayer): OSD_QUERY = 'show_text' def _setProperty(self, property_, value): - self._listener.sendLine("no-osd set {} {}".format(property_, value)) + self._listener.sendLine(u"no-osd set {} {}".format(property_, value)) def setPaused(self, value): if self._paused <> value: diff --git a/syncplay/ui/GuiConfiguration.py b/syncplay/ui/GuiConfiguration.py index ecb0234..fbe32d7 100644 --- a/syncplay/ui/GuiConfiguration.py +++ b/syncplay/ui/GuiConfiguration.py @@ -835,27 +835,27 @@ class ConfigDialog(QtGui.QDialog): self.showSameRoomOSDCheckbox = QCheckBox(getMessage("showsameroomosd-label")) self.showSameRoomOSDCheckbox.setObjectName("showSameRoomOSD") - self.showSameRoomOSDCheckbox.setStyleSheet(constants.STYLE_SUBCHECKBOX.format(self.posixresourcespath + "chevrons_right.png")) + self.showSameRoomOSDCheckbox.setStyleSheet(constants.STYLE_SUBCHECKBOX.format(self.posixresourcespath + u"chevrons_right.png")) self.osdSettingsLayout.addWidget(self.showSameRoomOSDCheckbox) self.showNonControllerOSDCheckbox = QCheckBox(getMessage("shownoncontrollerosd-label")) self.showNonControllerOSDCheckbox.setObjectName("showNonControllerOSD") - self.showNonControllerOSDCheckbox.setStyleSheet(constants.STYLE_SUBCHECKBOX.format(self.posixresourcespath + "chevrons_right.png")) + self.showNonControllerOSDCheckbox.setStyleSheet(constants.STYLE_SUBCHECKBOX.format(self.posixresourcespath + u"chevrons_right.png")) self.osdSettingsLayout.addWidget(self.showNonControllerOSDCheckbox) self.showDifferentRoomOSDCheckbox = QCheckBox(getMessage("showdifferentroomosd-label")) self.showDifferentRoomOSDCheckbox.setObjectName("showDifferentRoomOSD") - self.showDifferentRoomOSDCheckbox.setStyleSheet(constants.STYLE_SUBCHECKBOX.format(self.posixresourcespath + "chevrons_right.png")) + self.showDifferentRoomOSDCheckbox.setStyleSheet(constants.STYLE_SUBCHECKBOX.format(self.posixresourcespath + u"chevrons_right.png")) self.osdSettingsLayout.addWidget(self.showDifferentRoomOSDCheckbox) self.slowdownOSDCheckbox = QCheckBox(getMessage("showslowdownosd-label")) self.slowdownOSDCheckbox.setObjectName("showSlowdownOSD") - self.slowdownOSDCheckbox.setStyleSheet(constants.STYLE_SUBCHECKBOX.format(self.posixresourcespath + "chevrons_right.png")) + self.slowdownOSDCheckbox.setStyleSheet(constants.STYLE_SUBCHECKBOX.format(self.posixresourcespath + u"chevrons_right.png")) self.osdSettingsLayout.addWidget(self.slowdownOSDCheckbox) self.showOSDWarningsCheckbox = QCheckBox(getMessage("showosdwarnings-label")) self.showOSDWarningsCheckbox.setObjectName("showOSDWarnings") - self.showOSDWarningsCheckbox.setStyleSheet(constants.STYLE_SUBCHECKBOX.format(self.posixresourcespath + "chevrons_right.png")) + self.showOSDWarningsCheckbox.setStyleSheet(constants.STYLE_SUBCHECKBOX.format(self.posixresourcespath + u"chevrons_right.png")) self.osdSettingsLayout.addWidget(self.showOSDWarningsCheckbox) self.subitems['showOSD'] = ["showSameRoomOSD", "showDifferentRoomOSD", "showSlowdownOSD", "showOSDWarnings", "showNonControllerOSD"] @@ -915,20 +915,20 @@ class ConfigDialog(QtGui.QDialog): self.bottomButtonFrame = QtGui.QFrame() self.bottomButtonLayout = QtGui.QHBoxLayout() - self.helpButton = QtGui.QPushButton(QtGui.QIcon(self.resourcespath + 'help.png'), getMessage("help-label")) + self.helpButton = QtGui.QPushButton(QtGui.QIcon(self.resourcespath + u'help.png'), getMessage("help-label")) self.helpButton.setObjectName("help") self.helpButton.setMaximumSize(self.helpButton.sizeHint()) self.helpButton.pressed.connect(self.openHelp) - self.resetButton = QtGui.QPushButton(QtGui.QIcon(resourcespath + 'cog_delete.png'),getMessage("reset-label")) + self.resetButton = QtGui.QPushButton(QtGui.QIcon(resourcespath + u'cog_delete.png'),getMessage("reset-label")) self.resetButton.setMaximumSize(self.resetButton.sizeHint()) self.resetButton.setObjectName("reset") self.resetButton.pressed.connect(self.resetSettings) - self.runButton = QtGui.QPushButton(QtGui.QIcon(resourcespath + 'accept.png'), getMessage("run-label")) + self.runButton = QtGui.QPushButton(QtGui.QIcon(resourcespath + u'accept.png'), getMessage("run-label")) self.runButton.pressed.connect(self._saveDataAndLeave) self.runButton.setToolTip(getMessage("nostore-tooltip")) - self.storeAndRunButton = QtGui.QPushButton(QtGui.QIcon(resourcespath + 'accept.png'), getMessage("storeandrun-label")) + self.storeAndRunButton = QtGui.QPushButton(QtGui.QIcon(resourcespath + u'accept.png'), getMessage("storeandrun-label")) self.storeAndRunButton.pressed.connect(self._runWithoutStoringConfig) self.bottomButtonLayout.addWidget(self.helpButton) self.bottomButtonLayout.addWidget(self.resetButton) @@ -956,11 +956,11 @@ class ConfigDialog(QtGui.QDialog): self.tabListLayout = QtGui.QHBoxLayout() self.tabListFrame = QtGui.QFrame() self.tabListWidget = QtGui.QListWidget() - self.tabListWidget.addItem(QtGui.QListWidgetItem(QtGui.QIcon(self.resourcespath + "house.png"),getMessage("basics-label"))) - self.tabListWidget.addItem(QtGui.QListWidgetItem(QtGui.QIcon(self.resourcespath + "control_pause_blue.png"),getMessage("readiness-label"))) - self.tabListWidget.addItem(QtGui.QListWidgetItem(QtGui.QIcon(self.resourcespath + "film_link.png"),getMessage("sync-label"))) - self.tabListWidget.addItem(QtGui.QListWidgetItem(QtGui.QIcon(self.resourcespath + "comments.png"),getMessage("messages-label"))) - self.tabListWidget.addItem(QtGui.QListWidgetItem(QtGui.QIcon(self.resourcespath + "cog.png"),getMessage("misc-label"))) + self.tabListWidget.addItem(QtGui.QListWidgetItem(QtGui.QIcon(self.resourcespath + u"house.png"),getMessage("basics-label"))) + self.tabListWidget.addItem(QtGui.QListWidgetItem(QtGui.QIcon(self.resourcespath + u"control_pause_blue.png"),getMessage("readiness-label"))) + self.tabListWidget.addItem(QtGui.QListWidgetItem(QtGui.QIcon(self.resourcespath + u"film_link.png"),getMessage("sync-label"))) + self.tabListWidget.addItem(QtGui.QListWidgetItem(QtGui.QIcon(self.resourcespath + u"comments.png"),getMessage("messages-label"))) + self.tabListWidget.addItem(QtGui.QListWidgetItem(QtGui.QIcon(self.resourcespath + u"cog.png"),getMessage("misc-label"))) self.tabListLayout.addWidget(self.tabListWidget) self.tabListFrame.setLayout(self.tabListLayout) self.tabListFrame.setFixedWidth(self.tabListFrame.minimumSizeHint().width()) @@ -1046,15 +1046,15 @@ class ConfigDialog(QtGui.QDialog): if sys.platform.startswith('win'): resourcespath = utils.findWorkingDir() + "\\resources\\" else: - resourcespath = utils.findWorkingDir() + "/resources/" - self.posixresourcespath = utils.findWorkingDir().replace("\\","/") + "/resources/" + resourcespath = utils.findWorkingDir() + u"/resources/" + self.posixresourcespath = utils.findWorkingDir().replace(u"\\","/") + u"/resources/" self.resourcespath = resourcespath super(ConfigDialog, self).__init__() self.setWindowTitle(getMessage("config-window-title")) self.setWindowFlags(self.windowFlags() & Qt.WindowCloseButtonHint & ~Qt.WindowContextHelpButtonHint) - self.setWindowIcon(QtGui.QIcon(resourcespath + "syncplay.png")) + self.setWindowIcon(QtGui.QIcon(resourcespath + u"syncplay.png")) self.stackedLayout = QtGui.QStackedLayout() self.stackedFrame = QtGui.QFrame() diff --git a/syncplay/ui/gui.py b/syncplay/ui/gui.py index 6f017f8..6d9b127 100644 --- a/syncplay/ui/gui.py +++ b/syncplay/ui/gui.py @@ -29,12 +29,12 @@ class UserlistItemDelegate(QtGui.QStyledItemDelegate): currentQAbstractItemModel = indexQModelIndex.model() itemQModelIndex = currentQAbstractItemModel.index(indexQModelIndex.row(), constants.USERLIST_GUI_USERNAME_COLUMN, indexQModelIndex.parent()) if sys.platform.startswith('win'): - resourcespath = utils.findWorkingDir() + "\\resources\\" + resourcespath = utils.findWorkingDir() + u"\\resources\\" else: - resourcespath = utils.findWorkingDir() + "/resources/" - controlIconQPixmap = QtGui.QPixmap(resourcespath + "user_key.png") - tickIconQPixmap = QtGui.QPixmap(resourcespath + "tick.png") - crossIconQPixmap = QtGui.QPixmap(resourcespath + "cross.png") + resourcespath = utils.findWorkingDir() + u"/resources/" + controlIconQPixmap = QtGui.QPixmap(resourcespath + u"user_key.png") + tickIconQPixmap = QtGui.QPixmap(resourcespath + u"tick.png") + crossIconQPixmap = QtGui.QPixmap(resourcespath + u"cross.png") roomController = currentQAbstractItemModel.data(itemQModelIndex, Qt.UserRole + constants.USERITEM_CONTROLLER_ROLE) userReady = currentQAbstractItemModel.data(itemQModelIndex, Qt.UserRole + constants.USERITEM_READY_ROLE) @@ -60,14 +60,14 @@ class UserlistItemDelegate(QtGui.QStyledItemDelegate): optionQStyleOptionViewItem.rect.setX(optionQStyleOptionViewItem.rect.x()+constants.USERLIST_GUI_USERNAME_OFFSET) if column == constants.USERLIST_GUI_FILENAME_COLUMN: if sys.platform.startswith('win'): - resourcespath = utils.findWorkingDir() + "\\resources\\" + resourcespath = utils.findWorkingDir() + u"\\resources\\" else: - resourcespath = utils.findWorkingDir() + "/resources/" + resourcespath = utils.findWorkingDir() + u"/resources/" currentQAbstractItemModel = indexQModelIndex.model() itemQModelIndex = currentQAbstractItemModel.index(indexQModelIndex.row(), constants.USERLIST_GUI_FILENAME_COLUMN, indexQModelIndex.parent()) fileSwitchRole = currentQAbstractItemModel.data(itemQModelIndex, Qt.UserRole + constants.FILEITEM_SWITCH_ROLE) if fileSwitchRole == constants.FILEITEM_SWITCH_FILE_SWITCH: - fileSwitchIconQPixmap = QtGui.QPixmap(resourcespath + "film_go.png") + fileSwitchIconQPixmap = QtGui.QPixmap(resourcespath + u"film_go.png") itemQPainter.drawPixmap ( (optionQStyleOptionViewItem.rect.x()), optionQStyleOptionViewItem.rect.y(), @@ -75,7 +75,7 @@ class UserlistItemDelegate(QtGui.QStyledItemDelegate): optionQStyleOptionViewItem.rect.setX(optionQStyleOptionViewItem.rect.x()+16) elif fileSwitchRole == constants.FILEITEM_SWITCH_STREAM_SWITCH: - streamSwitchIconQPixmap = QtGui.QPixmap(resourcespath + "world_go.png") + streamSwitchIconQPixmap = QtGui.QPixmap(resourcespath + u"world_go.png") itemQPainter.drawPixmap ( (optionQStyleOptionViewItem.rect.x()), optionQStyleOptionViewItem.rect.y(), @@ -102,11 +102,11 @@ class MainWindow(QtGui.QMainWindow): currentQAbstractItemModel = indexQModelIndex.model() currentlyPlayingFile = currentQAbstractItemModel.data(indexQModelIndex, Qt.UserRole + constants.PLAYLISTITEM_CURRENTLYPLAYING_ROLE) if sys.platform.startswith('win'): - resourcespath = utils.findWorkingDir() + "\\resources\\" + resourcespath = utils.findWorkingDir() + u"\\resources\\" else: - resourcespath = utils.findWorkingDir() + "/resources/" + resourcespath = utils.findWorkingDir() + u"/resources/" if currentlyPlayingFile: - currentlyplayingIconQPixmap = QtGui.QPixmap(resourcespath + "bullet_right_grey.png") + currentlyplayingIconQPixmap = QtGui.QPixmap(resourcespath + u"bullet_right_grey.png") itemQPainter.drawPixmap ( (optionQStyleOptionViewItem.rect.x()+4), optionQStyleOptionViewItem.rect.y(), @@ -324,14 +324,14 @@ class MainWindow(QtGui.QMainWindow): def showMessage(self, message, noTimestamp=False): message = unicode(message) - message = message.replace("&", "&").replace('"', """).replace("<", "<").replace(">", ">") - message = message.replace("<", "<".format(constants.STYLE_USERNAME)) - message = message.replace(">", ">") - message = message.replace("\n", "
") + message = message.replace(u"&", u"&").replace(u'"', u""").replace(u"<", u"<").replace(">", u">") + message = message.replace(u"<", u"<".format(constants.STYLE_USERNAME)) + message = message.replace(u">", u">") + message = message.replace(u"\n", u"
") if noTimestamp: self.newMessage(u"{}
".format(message)) else: - self.newMessage(time.strftime(constants.UI_TIME_FORMAT, time.localtime()) + message + "
") + self.newMessage(time.strftime(constants.UI_TIME_FORMAT, time.localtime()) + message + u"
") @needsClient def getFileSwitchState(self, filename): @@ -404,7 +404,7 @@ class MainWindow(QtGui.QMainWindow): useritem.setData(isReadyWithFile, Qt.UserRole + constants.USERITEM_READY_ROLE) if user.file: filesizeitem = QtGui.QStandardItem(formatSize(user.file['size'])) - filedurationitem = QtGui.QStandardItem("({})".format(formatTime(user.file['duration']))) + filedurationitem = QtGui.QStandardItem(u"({})".format(formatTime(user.file['duration']))) filename = user.file['name'] if isURL(filename): filename = urllib.unquote(filename) @@ -473,9 +473,9 @@ class MainWindow(QtGui.QMainWindow): def openPlaylistMenu(self, position): indexes = self.playlist.selectedIndexes() if sys.platform.startswith('win'): - resourcespath = utils.findWorkingDir() + "\\resources\\" + resourcespath = utils.findWorkingDir() + u"\\resources\\" else: - resourcespath = utils.findWorkingDir() + "/resources/" + resourcespath = utils.findWorkingDir() + u"/resources/" if len(indexes) > 0: item = self.playlist.selectedIndexes()[0] else: @@ -486,19 +486,19 @@ class MainWindow(QtGui.QMainWindow): firstFile = item.sibling(item.row(), 0).data() if self._syncplayClient.userlist.currentUser.file is None or firstFile <> self._syncplayClient.userlist.currentUser.file["name"]: if isURL(firstFile): - menu.addAction(QtGui.QPixmap(resourcespath + "world_go.png"), getMessage("openstreamurl-menu-label"), lambda: self.openFile(firstFile)) + menu.addAction(QtGui.QPixmap(resourcespath + u"world_go.png"), getMessage("openstreamurl-menu-label"), lambda: self.openFile(firstFile)) else: pathFound = self._syncplayClient.fileSwitch.findFilepath(firstFile) if pathFound: - menu.addAction(QtGui.QPixmap(resourcespath + "film_go.png"), getMessage("openmedia-menu-label"), lambda: self.openFile(pathFound)) - menu.addAction(QtGui.QPixmap(resourcespath + "delete.png"), getMessage("removefromplaylist-menu-label"), lambda: self.deleteSelectedPlaylistItems()) + menu.addAction(QtGui.QPixmap(resourcespath + u"film_go.png"), getMessage("openmedia-menu-label"), lambda: self.openFile(pathFound)) + menu.addAction(QtGui.QPixmap(resourcespath + u"delete.png"), getMessage("removefromplaylist-menu-label"), lambda: self.deleteSelectedPlaylistItems()) menu.addSeparator() - menu.addAction(QtGui.QPixmap(resourcespath + "arrow_switch.png"), getMessage("shuffleplaylist-menuu-label"), lambda: self.shufflePlaylist()) - menu.addAction(QtGui.QPixmap(resourcespath + "arrow_undo.png"), getMessage("undoplaylist-menu-label"), lambda: self.undoPlaylistChange()) - menu.addAction(QtGui.QPixmap(resourcespath + "film_add.png"),getMessage("addfilestoplaylist-menu-label"), lambda: self.OpenAddFilesToPlaylistDialog()) - menu.addAction(QtGui.QPixmap(resourcespath + "world_add.png"), getMessage("addurlstoplaylist-menu-label"), lambda: self.OpenAddURIsToPlaylistDialog()) + menu.addAction(QtGui.QPixmap(resourcespath + u"arrow_switch.png"), getMessage("shuffleplaylist-menuu-label"), lambda: self.shufflePlaylist()) + menu.addAction(QtGui.QPixmap(resourcespath + u"arrow_undo.png"), getMessage("undoplaylist-menu-label"), lambda: self.undoPlaylistChange()) + menu.addAction(QtGui.QPixmap(resourcespath + u"film_add.png"),getMessage("addfilestoplaylist-menu-label"), lambda: self.OpenAddFilesToPlaylistDialog()) + menu.addAction(QtGui.QPixmap(resourcespath + u"world_add.png"), getMessage("addurlstoplaylist-menu-label"), lambda: self.OpenAddURIsToPlaylistDialog()) menu.addSeparator() - menu.addAction(QtGui.QPixmap(resourcespath + "film_folder_edit.png"), getMessage("setmediadirectories-menu-label"), lambda: self.openSetMediaDirectoriesDialog()) + menu.addAction(QtGui.QPixmap(resourcespath + u"film_folder_edit.png"), getMessage("setmediadirectories-menu-label"), lambda: self.openSetMediaDirectoriesDialog()) menu.exec_(self.playlist.viewport().mapToGlobal(position)) @@ -506,9 +506,9 @@ class MainWindow(QtGui.QMainWindow): # TODO: Deselect items after right click indexes = self.listTreeView.selectedIndexes() if sys.platform.startswith('win'): - resourcespath = utils.findWorkingDir() + "\\resources\\" + resourcespath = utils.findWorkingDir() + u"\\resources\\" else: - resourcespath = utils.findWorkingDir() + "/resources/" + resourcespath = utils.findWorkingDir() + u"/resources/" if len(indexes) > 0: item = self.listTreeView.selectedIndexes()[0] else: @@ -532,17 +532,17 @@ class MainWindow(QtGui.QMainWindow): elif username and filename and filename <> getMessage("nofile-note"): if self.config['sharedPlaylistEnabled'] and not self.isItemInPlaylist(filename): if isURL(filename): - menu.addAction(QtGui.QPixmap(resourcespath + "world_add.png"),getMessage("addusersstreamstoplaylist-menu-label").format(shortUsername), lambda: self.addStreamToPlaylist(filename)) + menu.addAction(QtGui.QPixmap(resourcespath + u"world_add.png"),getMessage("addusersstreamstoplaylist-menu-label").format(shortUsername), lambda: self.addStreamToPlaylist(filename)) else: - menu.addAction(QtGui.QPixmap(resourcespath + "film_add.png"), getMessage("addusersfiletoplaylist-menu-label").format(shortUsername), lambda: self.addStreamToPlaylist(filename)) + menu.addAction(QtGui.QPixmap(resourcespath + u"film_add.png"), getMessage("addusersfiletoplaylist-menu-label").format(shortUsername), lambda: self.addStreamToPlaylist(filename)) if self._syncplayClient.userlist.currentUser.file is None or filename <> self._syncplayClient.userlist.currentUser.file["name"]: if isURL(filename): - menu.addAction(QtGui.QPixmap(resourcespath + "world_go.png"), getMessage("openusersstream-menu-label").format(shortUsername), lambda: self.openFile(filename)) + menu.addAction(QtGui.QPixmap(resourcespath + u"world_go.png"), getMessage("openusersstream-menu-label").format(shortUsername), lambda: self.openFile(filename)) else: pathFound = self._syncplayClient.fileSwitch.findFilepath(filename) if pathFound: - menu.addAction(QtGui.QPixmap(resourcespath + "film_go.png"), getMessage("openusersfile-menu-label").format(shortUsername), lambda: self.openFile(pathFound)) + menu.addAction(QtGui.QPixmap(resourcespath + u"film_go.png"), getMessage("openusersfile-menu-label").format(shortUsername), lambda: self.openFile(pathFound)) else: return menu.exec_(self.listTreeView.viewport().mapToGlobal(position)) @@ -627,10 +627,10 @@ class MainWindow(QtGui.QMainWindow): message = unicode(message) if criticalerror: QtGui.QMessageBox.critical(self, "Syncplay", message) - message = message.replace("&", "&").replace('"', """).replace("<", "<").replace(">", ">") - message = message.replace("\n", "
") - message = "".format(constants.STYLE_ERRORNOTIFICATION) + message + "" - self.newMessage(time.strftime(constants.UI_TIME_FORMAT, time.localtime()) + message + "
") + message = message.replace(u"&", u"&").replace(u'"', u""").replace(u"<", u"<").replace(u">", u">") + message = message.replace(u"\n", u"
") + message = u"".format(constants.STYLE_ERRORNOTIFICATION) + message + u"" + self.newMessage(time.strftime(constants.UI_TIME_FORMAT, time.localtime()) + message + u"
") @needsClient def joinRoom(self, room=None): @@ -649,7 +649,7 @@ class MainWindow(QtGui.QMainWindow): def seekPositionDialog(self): seekTime, ok = QtGui.QInputDialog.getText(self, getMessage("seektime-menu-label"), getMessage("seektime-msgbox-label"), QtGui.QLineEdit.Normal, - "0:00") + u"0:00") if ok and seekTime != '': self.seekPosition(seekTime) @@ -1103,20 +1103,20 @@ class MainWindow(QtGui.QMainWindow): window.playbackFrame.setLayout(window.playbackLayout) window.seekInput = QtGui.QLineEdit() window.seekInput.returnPressed.connect(self.seekFromButton) - window.seekButton = QtGui.QPushButton(QtGui.QIcon(self.resourcespath + 'clock_go.png'), "") + window.seekButton = QtGui.QPushButton(QtGui.QIcon(self.resourcespath + u'clock_go.png'), "") window.seekButton.setToolTip(getMessage("seektime-menu-label")) window.seekButton.pressed.connect(self.seekFromButton) window.seekInput.setText("0:00") window.seekInput.setFixedWidth(60) window.playbackLayout.addWidget(window.seekInput) window.playbackLayout.addWidget(window.seekButton) - window.unseekButton = QtGui.QPushButton(QtGui.QIcon(self.resourcespath + 'arrow_undo.png'), "") + window.unseekButton = QtGui.QPushButton(QtGui.QIcon(self.resourcespath + u'arrow_undo.png'), "") window.unseekButton.setToolTip(getMessage("undoseek-menu-label")) window.unseekButton.pressed.connect(self.undoSeek) window.miscLayout = QtGui.QHBoxLayout() window.playbackLayout.addWidget(window.unseekButton) - window.playButton = QtGui.QPushButton(QtGui.QIcon(self.resourcespath + 'control_play_blue.png'), "") + window.playButton = QtGui.QPushButton(QtGui.QIcon(self.resourcespath + u'control_play_blue.png'), "") window.playButton.setToolTip(getMessage("play-menu-label")) window.playButton.pressed.connect(self.play) window.playbackLayout.addWidget(window.playButton) @@ -1347,7 +1347,7 @@ class MainWindow(QtGui.QMainWindow): def setPlaylist(self, newPlaylist, newIndexFilename=None): if self.updatingPlaylist: - self.ui.showDebugMessage("Trying to set playlist while it is already being updated") + self.ui.showDebugMessage(u"Trying to set playlist while it is already being updated") if newPlaylist == self.playlistState: if newIndexFilename: self.playlist.setPlaylistIndexFilename(newIndexFilename) @@ -1470,9 +1470,9 @@ class MainWindow(QtGui.QMainWindow): self.folderSearchEnabled = True self.QtGui = QtGui if sys.platform.startswith('win'): - self.resourcespath = utils.findWorkingDir() + "\\resources\\" + self.resourcespath = utils.findWorkingDir() + u"\\resources\\" else: - self.resourcespath = utils.findWorkingDir() + "/resources/" + self.resourcespath = utils.findWorkingDir() + u"/resources/" self.setWindowFlags(self.windowFlags() & Qt.AA_DontUseNativeMenuBar) self.setWindowTitle("Syncplay v" + version) self.mainLayout = QtGui.QVBoxLayout() @@ -1481,7 +1481,7 @@ class MainWindow(QtGui.QMainWindow): self.addMenubar(self) self.addMainFrame(self) self.loadSettings() - self.setWindowIcon(QtGui.QIcon(self.resourcespath + "syncplay.png")) + self.setWindowIcon(QtGui.QIcon(self.resourcespath + u"syncplay.png")) self.setWindowFlags(self.windowFlags() & Qt.WindowCloseButtonHint & Qt.AA_DontUseNativeMenuBar & Qt.WindowMinimizeButtonHint & ~Qt.WindowContextHelpButtonHint) self.show() self.setAcceptDrops(True)