Removed libMal reffeences (and little formating)

This commit is contained in:
Uriziel 2014-03-27 00:01:50 +01:00
parent 6c4e2fa402
commit da17982866
4 changed files with 351 additions and 452 deletions

View File

@ -11,14 +11,6 @@ import threading
from syncplay.constants import PRIVACY_SENDHASHED_MODE, PRIVACY_DONTSEND_MODE, \
PRIVACY_HIDDENFILENAME, FILENAME_STRIP_REGEX
import collections
# <MAL DISABLE>
libMal = None
'''try:
import libMal
except ImportError:
libMal = None
'''
# </MAL DISABLE>
class SyncClientFactory(ClientFactory):
def __init__(self, client, retry=constants.RECONNECT_RETRIES):
@ -67,7 +59,6 @@ class SyncplayClient(object):
self.userlist = SyncplayUserlist(self.ui, self)
self._protocol = None
self._player = None
self.givenmalprivacywarning = False
if(config['room'] == None or config['room'] == ''):
config['room'] = config['name'] # ticket #58
self.defaultRoom = config['room']
@ -98,7 +89,6 @@ class SyncplayClient(object):
self._speedChanged = False
self._warnings = self._WarningManager(self._player, self.userlist, self.ui)
self._malUpdater = MalUpdater(config["malUsername"], config["malPassword"], self.ui)
def initProtocol(self, protocol):
self._protocol = protocol
@ -233,7 +223,6 @@ class SyncplayClient(object):
if(self.userlist.hasRoomStateChanged() and not paused):
self._warnings.checkWarnings()
self.userlist.roomStateConfirmed()
self._malUpdater.playingHook(position, paused)
def updateGlobalState(self, position, paused, doSeek, setBy, messageAge):
if(self.__getUserlistOnLogon):
@ -309,12 +298,6 @@ class SyncplayClient(object):
filename, size = self.__executePrivacySettings(filename, size)
self.userlist.currentUser.setFile(filename, duration, size)
self.sendFile()
self._malUpdater.fileChangeHook(rawfilename, duration)
if libMal and filename <> rawfilename and self.givenmalprivacywarning == False:
message = getMessage("en", "mal-noprivacy-notification")
self.ui.showErrorMessage(message)
self.givenmalprivacywarning = True
def __executePrivacySettings(self, filename, size):
if (self._config['filenamePrivacyMode'] == PRIVACY_SENDHASHED_MODE):
@ -475,53 +458,6 @@ class SyncplayUser(object):
else:
return "{}".format(self.username)
class MalUpdater(object):
def __init__(self, username, password, ui):
self._filePlayingFor = 0.0
self._lastHookUpdate = None
self._fileDuration = 0
self._filename = ""
self.__username = username
self.__password = password
self._ui = ui
def _updatePlayingTime(self, paused):
if (not self._lastHookUpdate):
self._lastHookUpdate = time.time()
if (not paused):
self._filePlayingFor += time.time() - self._lastHookUpdate
self._lastHookUpdate = time.time()
def playingHook(self, position, paused):
if(self._fileDuration == 0):
return
self._updatePlayingTime(paused)
pastMark = position / self._fileDuration > 0.4
if self._filePlayingFor > 30 and pastMark:
threading.Thread(target=self._updateMal).start()
def fileChangeHook(self, filename, duration):
self._fileDuration = duration
self._filename = filename
self._filePlayingFor = 0.0
self._lastHookUpdate = None
def _updateMal(self):
try:
self._fileDuration = 0 # Disable playingHook
if(libMal and self._filename and self.__username and self.__password):
manager = libMal.Manager(self.__username, self.__password)
results = manager.findEntriesOnMal(self._filename)
if(len(results) > 0):
result = results[0]
message = "Updating MAL with: \"{}\", episode: {}".format(result.mainTitle, result.episodeBeingWatched)
reactor.callFromThread(self._ui.showMessage, (message),)
options = {"tags": ["syncplay"]}
manager.updateEntryOnMal(result, options)
self._filename = "" # Make sure no updates will be performed until switch
except:
reactor.callFromThread(self._ui.showMessage, ("MAL Update failure"),)
class SyncplayUserlist(object):
def __init__(self, ui, client):
self.currentUser = SyncplayUser()

View File

@ -1,252 +1,246 @@
#coding:utf8
en = {
# Client notifications
"connection-attempt-notification" : "Attempting to connect to {}:{}", #Port, IP
"reconnection-attempt-notification" : "Connection with server lost, attempting to reconnect",
"disconnection-notification" : "Disconnected from server",
"connection-failed-notification" : "Connection with server failed",
"connected-successful-notification" : "Successfully connected to server",
"retrying-notification" : "%s, Retrying in %d seconds...", #Seconds
"rewind-notification" : "Rewinded due to time difference with <{}>", #User
"slowdown-notification" : "Slowing down due to time difference with <{}>", #User
"revert-notification" : "Reverting speed back to normal",
"pause-notification" : "<{}> paused", #User
"unpause-notification" : "<{}> unpaused", #User
"seek-notification" : "<{}> jumped from {} to {}", #User, from time, to time
"current-offset-notification" : "Current offset: {} seconds", #Offset
"room-join-notification" : "<{}> has joined the room: '{}'", #User
"left-notification" : "<{}> has left", #User
"playing-notification" : "<{}> is playing '{}' ({})", #User, file, duration
"playing-notification/room-addendum" : " in room: '{}'", #Room
"file-different-notification" : "File you are playing appears to be different from <{}>'s", #User
"file-differences-notification" : "Your file differs in the following way(s): ",
"room-files-not-same" : "Not all files played in the room are the same",
"alone-in-the-room": "You're alone in the room",
"different-filesize-notification" : " (their file size is different from yours!)",
"file-played-by-notification" : "File: {} is being played by:", #File
"notplaying-notification" : "People who are not playing any file:",
"userlist-room-notification" : "In room '{}':", #Room
"mplayer-file-required-notification" : "Syncplay using mplayer requires you to provide file when starting",
"mplayer-file-required-notification/example" : "Usage example: syncplay [options] [url|path/]filename",
"mplayer2-required" : "Syncplay is incompatible with MPlayer 1.x, please use mplayer2 or mpv",
"unrecognized-command-notification" : "Unrecognized command",
"commandlist-notification" : "Available commands:",
"commandlist-notification/room" : "\tr [name] - change room",
"commandlist-notification/list" : "\tl - show user list",
"commandlist-notification/undo" : "\tu - undo last seek",
"commandlist-notification/pause" : "\tp - toggle pause",
"commandlist-notification/seek" : "\t[s][+-]time - seek to the given value of time, if + or - is not specified it's absolute time in seconds or min:sec",
"commandlist-notification/help" : "\th - this help",
"syncplay-version-notification" : "Syncplay version: {}", #syncplay.version
"more-info-notification" : "More info available at: {}", #projectURL
"gui-data-cleared-notification" : "Syncplay has cleared the path and window state data used by the GUI.",
"vlc-version-mismatch": "Warning: You are running VLC version {}, but Syncplay is designed to run on VLC {} and above.", # VLC version, VLC min version
"vlc-interface-version-mismatch": "Warning: You are running version {} of the Syncplay interface module for VLC, but Syncplay is designed to run with version {} and above.", # VLC interface version, VLC interface min version
"vlc-interface-oldversion-ignored": "Warning: Syncplay detected that an old version version of the Syncplay interface module for VLC was installed in the VLC directory. As such, if you are running VLC 2.0 then it will be ignored in favour of the syncplay.lua module contained within the Syncplay directory, but this will mean that other custom interface scripts and extensions will not work. Please refer to the Syncplay User Guide at http://syncplay.pl/guide/ for instructions on how to install syncplay.lua.",
"vlc-interface-not-installed": "Warning: The Syncplay interface module for VLC was not found in the VLC directory. As such, if you are running VLC 2.0 then VLC will use the syncplay.lua module contained within the Syncplay directory, but this will mean that other custom interface scripts and extensions will not work. Please refer to the Syncplay User Guide at http://syncplay.pl/guide/ for instructions on how to install syncplay.lua.",
"mal-noprivacy-notification": "Warning: The MyAnimeList updater does not support Syncplay's filename privacy settings. Filename information sent to Google.com, MAL-API.com and MyAnimeList.net will not be encrypted, masked or hashed. See http://syncplay.pl/tech/ for more details on MyAnimeList/libMal behaviour.",
# Client prompts
"enter-to-exit-prompt" : "Press enter to exit\n",
# Client errors
"missing-arguments-error" : "Some necessary arguments are missing, refer to --help",
"server-timeout-error" : "Connection with server timed out",
"mpc-slave-error" : "Unable to start MPC in slave mode!",
"mpc-version-insufficient-error" : "MPC version not sufficient, please use `mpc-hc` >= `{}`",
"player-file-open-error" : "Player failed opening file",
"player-path-error" : "Player path is not set properly",
"hostname-empty-error" : "Hostname can't be empty",
"empty-error" : "{} can't be empty", #Configuration
"arguments-missing-error" : "Some necessary arguments are missing, refer to --help",
"unable-to-start-client-error" : "Unable to start client",
"not-json-error" : "Not a json encoded string\n",
"hello-arguments-error" : "Not enough Hello arguments\n",
"version-mismatch-error" : "Mismatch between versions of client and server\n",
"vlc-error-echo": "VLC error: {}", # VLC error line
"vlc-unicode-loadfile-error" : "Cannot load file through Syncplay because it contains non-ASCII characters. Please load the file through VLC.",
"vlc-failed-connection": "Failed to connect to VLC. If you have not installed syncplay.lua then please refer to http://syncplay.pl/LUA/ for instructions.",
"vlc-failed-noscript": "VLC has reported that the syncplay.lua interface script has not been installed. Please refer to http://syncplay.pl/LUA/ for instructions.",
"vlc-failed-versioncheck": "This version of VLC is not supported by Syncplay. Please use VLC 2.",
"vlc-failed-other" : "When trying to load the syncplay.lua interface script VLC has provided the following error: {}", #Syncplay Error
# Client arguments
"argument-description" : 'Solution to synchronize playback of multiple MPlayer and MPC-HC instances over the network.',
"argument-epilog" : 'If no options supplied _config values will be used',
"nogui-argument" : 'show no GUI',
"host-argument" : 'server\'s address',
"name-argument" : 'desired username',
"debug-argument" : 'debug mode',
"force-gui-prompt-argument" : 'make configuration prompt appear',
"no-store-argument" : 'don\'t store values in .syncplay',
"room-argument" : 'default room',
"password-argument" : 'server password',
"player-path-argument" : 'path to your player executable',
"file-argument" : 'file to play',
"args-argument" : 'player options, if you need to pass options starting with - prepend them with single \'--\' argument',
"clear-gui-data-argument" : 'resets path and window state GUI data stored as QSettings',
# Client labels
"config-window-title" : "Syncplay configuration",
"connection-group-title" : "Connection settings",
"host-label" : "Server address: ",
"username-label" : "Username:",
"password-label" : "Server password (if any):",
"room-label" : "Default room: ",
"media-setting-title" : "Media player settings",
"executable-path-label" : "Path to media player:",
"media-path-label" : "Path to media file:",
"browse-label" : "Browse",
"more-title" : "Show more settings",
"mal-username-label" : "MAL username:",
"mal-password-label" : "MAL password:",
"privacy-sendraw-option" : "Send raw",
"privacy-sendhashed-option" : "Send hashed",
"privacy-dontsend-option" : "Don't send",
"filename-privacy-label" : "Filename information:",
"filesize-privacy-label" : "File size information:",
"slowdown-label" : "Slow down on desync",
"pauseonleave-label" : "Pause when user leaves",
"rewind-label" : "Rewind on major desync (highly recommended)",
"alwayshow-label" : "Always show this dialog",
"donotstore-label" : "Do not store this configuration",
"help-label" : "Help",
"run-label" : "Run Syncplay",
"storeandrun-label" : "Store configuration and run Syncplay",
"roomuser-heading-label" : "Room / User",
"fileplayed-heading-label" : "File being played",
# Tooltips
"host-tooltip" : "Hostname or IP to connect to, optionally including port (e.g. syncplay.pl:8999). Only synchronised with people on same server/port.",
"username-tooltip" : "Nickname you will be known by. There is no registration, so you can change this later.",
"password-tooltip" : "Passwords are only needed for connecting to private servers.",
"room-tooltip" : "Room to join upon connection can be almost anything, but you will only be synchronised with people in the same room.",
"executable-path-tooltip" : "Location of your chosen supported media player (MPC-HC, VLC, mplayer2 or mpv).",
"media-path-tooltip" : "Location of video or stream to be opened. Necessary for mpv and mplayer2.",
"more-tooltip" : "Display less frequently used settings.",
"mal-username-tooltip" : "Your MyAnimeList username. Note: MAL support is experimental!",
"mal-password-tooltip" : "Your MyAnimeList password. Note: This is not encrypted!",
"filename-privacy-tooltip" : "Privacy mode for sending currently playing filename to server.",
"filesize-privacy-tooltip" : "Privacy mode for sending size of currently playing file to server.",
"privacy-sendraw-tooltip" : "Send this information without obfuscation. This is the default option with most functionality.",
"privacy-sendhashed-tooltip" : "Send a hashed version of the information, making it less visible to other clients.",
"privacy-dontsend-tooltip" : "Do not send this information to the server. This provides for maximum privacy.",
"slowdown-tooltip" : "Reduce playback rate temporarily when needed to bring you back in sync with other viewers.",
"pauseonleave-tooltip" : "Pause playback if you get disconnected or someone leaves from your room.",
"rewind-tooltip" : "Jump back when needed to get back in sync. Recommended.",
"alwayshow-tooltip" : "Configuration dialogue is always shown, even when opening a file with Syncplay.",
"donotstore-tooltip" : "Run Syncplay with the given configuration, but do not permanently store the changes.",
"help-tooltip" : "Opens the Syncplay.pl user guide.",
# Server messages to client
"new-syncplay-available-motd-message" : "<NOTICE> You are using Syncplay {} but a newer version is available from http://syncplay.pl </NOTICE>", #ClientVersion
# 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
#Server arguments
"server-argument-description" : 'Solution to synchronize playback of multiple MPlayer and MPC-HC instances over the network. Server instance',
"server-argument-epilog" : 'If no options supplied _config values will be used',
"server-port-argument" : 'server TCP port',
"server-password-argument" : 'server password',
"server-isolate-room-argument" : 'should rooms be isolated?',
"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-http-reply-argument": "path to file from which http reply will be fetched",
"server-default-http-reply": "This server should not be requested with your browser, but with Syncplay software available from http://syncplay.pl",
"server-irc-verbose": "Should server actively report changes in rooms",
"server-irc-config": "Path to irc bot config files",
#Server errors
"unknown-command-server-error" : "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
"password-required-server-error" : "Password required",
"wrong-password-server-error" : "Wrong password supplied",
"hello-server-error" : "Not enough Hello arguments",
"version-mismatch-server-error" : "Mismatch between versions of client and server",
"wrong-password-server-error" : "Wrong password supplied"
}
pl = {
# Client notifications
"connection-attempt-notification" : "Próba połączenia z {}:{}", #Port, IP
"reconnection-attempt-notification" : "Połączenie z serwerem zostało przerwane, ponowne łączenie",
"disconnection-notification" : "Odłączono od serwera",
"connection-failed-notification" : "Połączenie z serwerem zakończone fiaskiem",
"rewind-notification" : "Cofnięto z powodu różnicy czasu z <{}>", #User
"slowdown-notification" : "Zwolniono z powodu różnicy czasu z <{}>", #User
"revert-notification" : "Przywrócono normalną prędkość odtwarzania",
"pause-notification" : "<{}> zatrzymał odtwarzanie", #User
"unpause-notification" : "<{}> wznowił odtwarzanie", #User
"seek-notification" : "<{}> skoczył z {} do {}", #User, from time, to time
"current-offset-notification" : "Obecny offset: {} seconds", #Offset
"room-join-notification" : "<{}> dołączył do pokoju: '{}'", #User
"left-notification" : "<{}> wyszedł", #User
"playing-notification" : "<{}> odtwarza '{}' ({})", #User, file, duration
"playing-notification/room-addendum" : " w pokoju: '{}'", #Room
"file-different-notification" : "Plik, który odtwarzasz wydaje się być różny od <{}>", #User
"file-differences-notification" : "Twój plik różni się następującymi parametrami: ",
"different-filesize-notification" : " (inny rozmiar pliku!)",
"file-played-by-notification" : "Plik: {} jest odtwarzany przez:", #File
"notplaying-notification" : "Osoby, które nie odtwarzają żadnych plików:",
"userlist-room-notification" : "W pokoju '{}':", #Room
# Client prompts
"enter-to-exit-prompt" : "Wciśnij Enter, aby zakończyć działanie programu\n",
# Client errors
"server-timeout-error" : "Przekroczono czas oczekiwania na odpowiedź serwera"
}
messages = {
"en": en,
"pl": pl
}
def getMessage(locale, type_):
if(messages.has_key(locale)):
if(messages[locale].has_key(type_)):
return unicode(messages[locale][type_])
if(messages["en"].has_key(type_)):
return unicode(messages["en"][type_])
else:
raise KeyError()
# coding:utf8
en = {
# Client notifications
"connection-attempt-notification" : "Attempting to connect to {}:{}", # Port, IP
"reconnection-attempt-notification" : "Connection with server lost, attempting to reconnect",
"disconnection-notification" : "Disconnected from server",
"connection-failed-notification" : "Connection with server failed",
"connected-successful-notification" : "Successfully connected to server",
"retrying-notification" : "%s, Retrying in %d seconds...", # Seconds
"rewind-notification" : "Rewinded due to time difference with <{}>", # User
"slowdown-notification" : "Slowing down due to time difference with <{}>", # User
"revert-notification" : "Reverting speed back to normal",
"pause-notification" : "<{}> paused", # User
"unpause-notification" : "<{}> unpaused", # User
"seek-notification" : "<{}> jumped from {} to {}", # User, from time, to time
"current-offset-notification" : "Current offset: {} seconds", # Offset
"room-join-notification" : "<{}> has joined the room: '{}'", # User
"left-notification" : "<{}> has left", # User
"playing-notification" : "<{}> is playing '{}' ({})", # User, file, duration
"playing-notification/room-addendum" : " in room: '{}'", # Room
"file-different-notification" : "File you are playing appears to be different from <{}>'s", # User
"file-differences-notification" : "Your file differs in the following way(s): ",
"room-files-not-same" : "Not all files played in the room are the same",
"alone-in-the-room": "You're alone in the room",
"different-filesize-notification" : " (their file size is different from yours!)",
"file-played-by-notification" : "File: {} is being played by:", # File
"notplaying-notification" : "People who are not playing any file:",
"userlist-room-notification" : "In room '{}':", # Room
"mplayer-file-required-notification" : "Syncplay using mplayer requires you to provide file when starting",
"mplayer-file-required-notification/example" : "Usage example: syncplay [options] [url|path/]filename",
"mplayer2-required" : "Syncplay is incompatible with MPlayer 1.x, please use mplayer2 or mpv",
"unrecognized-command-notification" : "Unrecognized command",
"commandlist-notification" : "Available commands:",
"commandlist-notification/room" : "\tr [name] - change room",
"commandlist-notification/list" : "\tl - show user list",
"commandlist-notification/undo" : "\tu - undo last seek",
"commandlist-notification/pause" : "\tp - toggle pause",
"commandlist-notification/seek" : "\t[s][+-]time - seek to the given value of time, if + or - is not specified it's absolute time in seconds or min:sec",
"commandlist-notification/help" : "\th - this help",
"syncplay-version-notification" : "Syncplay version: {}", # syncplay.version
"more-info-notification" : "More info available at: {}", # projectURL
"gui-data-cleared-notification" : "Syncplay has cleared the path and window state data used by the GUI.",
"vlc-version-mismatch": "Warning: You are running VLC version {}, but Syncplay is designed to run on VLC {} and above.", # VLC version, VLC min version
"vlc-interface-version-mismatch": "Warning: You are running version {} of the Syncplay interface module for VLC, but Syncplay is designed to run with version {} and above.", # VLC interface version, VLC interface min version
"vlc-interface-oldversion-ignored": "Warning: Syncplay detected that an old version version of the Syncplay interface module for VLC was installed in the VLC directory. As such, if you are running VLC 2.0 then it will be ignored in favour of the syncplay.lua module contained within the Syncplay directory, but this will mean that other custom interface scripts and extensions will not work. Please refer to the Syncplay User Guide at http://syncplay.pl/guide/ for instructions on how to install syncplay.lua.",
"vlc-interface-not-installed": "Warning: The Syncplay interface module for VLC was not found in the VLC directory. As such, if you are running VLC 2.0 then VLC will use the syncplay.lua module contained within the Syncplay directory, but this will mean that other custom interface scripts and extensions will not work. Please refer to the Syncplay User Guide at http://syncplay.pl/guide/ for instructions on how to install syncplay.lua.",
# Client prompts
"enter-to-exit-prompt" : "Press enter to exit\n",
# Client errors
"missing-arguments-error" : "Some necessary arguments are missing, refer to --help",
"server-timeout-error" : "Connection with server timed out",
"mpc-slave-error" : "Unable to start MPC in slave mode!",
"mpc-version-insufficient-error" : "MPC version not sufficient, please use `mpc-hc` >= `{}`",
"player-file-open-error" : "Player failed opening file",
"player-path-error" : "Player path is not set properly",
"hostname-empty-error" : "Hostname can't be empty",
"empty-error" : "{} can't be empty", # Configuration
"arguments-missing-error" : "Some necessary arguments are missing, refer to --help",
"unable-to-start-client-error" : "Unable to start client",
"not-json-error" : "Not a json encoded string\n",
"hello-arguments-error" : "Not enough Hello arguments\n",
"version-mismatch-error" : "Mismatch between versions of client and server\n",
"vlc-error-echo": "VLC error: {}", # VLC error line
"vlc-unicode-loadfile-error" : "Cannot load file through Syncplay because it contains non-ASCII characters. Please load the file through VLC.",
"vlc-failed-connection": "Failed to connect to VLC. If you have not installed syncplay.lua then please refer to http://syncplay.pl/LUA/ for instructions.",
"vlc-failed-noscript": "VLC has reported that the syncplay.lua interface script has not been installed. Please refer to http://syncplay.pl/LUA/ for instructions.",
"vlc-failed-versioncheck": "This version of VLC is not supported by Syncplay. Please use VLC 2.",
"vlc-failed-other" : "When trying to load the syncplay.lua interface script VLC has provided the following error: {}", # Syncplay Error
# Client arguments
"argument-description" : 'Solution to synchronize playback of multiple MPlayer and MPC-HC instances over the network.',
"argument-epilog" : 'If no options supplied _config values will be used',
"nogui-argument" : 'show no GUI',
"host-argument" : 'server\'s address',
"name-argument" : 'desired username',
"debug-argument" : 'debug mode',
"force-gui-prompt-argument" : 'make configuration prompt appear',
"no-store-argument" : 'don\'t store values in .syncplay',
"room-argument" : 'default room',
"password-argument" : 'server password',
"player-path-argument" : 'path to your player executable',
"file-argument" : 'file to play',
"args-argument" : 'player options, if you need to pass options starting with - prepend them with single \'--\' argument',
"clear-gui-data-argument" : 'resets path and window state GUI data stored as QSettings',
# Client labels
"config-window-title" : "Syncplay configuration",
"connection-group-title" : "Connection settings",
"host-label" : "Server address: ",
"username-label" : "Username:",
"password-label" : "Server password (if any):",
"room-label" : "Default room: ",
"media-setting-title" : "Media player settings",
"executable-path-label" : "Path to media player:",
"media-path-label" : "Path to media file:",
"browse-label" : "Browse",
"more-title" : "Show more settings",
"privacy-sendraw-option" : "Send raw",
"privacy-sendhashed-option" : "Send hashed",
"privacy-dontsend-option" : "Don't send",
"filename-privacy-label" : "Filename information:",
"filesize-privacy-label" : "File size information:",
"slowdown-label" : "Slow down on desync",
"pauseonleave-label" : "Pause when user leaves",
"rewind-label" : "Rewind on major desync (highly recommended)",
"alwayshow-label" : "Always show this dialog",
"donotstore-label" : "Do not store this configuration",
"help-label" : "Help",
"run-label" : "Run Syncplay",
"storeandrun-label" : "Store configuration and run Syncplay",
"roomuser-heading-label" : "Room / User",
"fileplayed-heading-label" : "File being played",
# Tooltips
"host-tooltip" : "Hostname or IP to connect to, optionally including port (e.g. syncplay.pl:8999). Only synchronised with people on same server/port.",
"username-tooltip" : "Nickname you will be known by. There is no registration, so you can change this later.",
"password-tooltip" : "Passwords are only needed for connecting to private servers.",
"room-tooltip" : "Room to join upon connection can be almost anything, but you will only be synchronised with people in the same room.",
"executable-path-tooltip" : "Location of your chosen supported media player (MPC-HC, VLC, mplayer2 or mpv).",
"media-path-tooltip" : "Location of video or stream to be opened. Necessary for mpv and mplayer2.",
"more-tooltip" : "Display less frequently used settings.",
"filename-privacy-tooltip" : "Privacy mode for sending currently playing filename to server.",
"filesize-privacy-tooltip" : "Privacy mode for sending size of currently playing file to server.",
"privacy-sendraw-tooltip" : "Send this information without obfuscation. This is the default option with most functionality.",
"privacy-sendhashed-tooltip" : "Send a hashed version of the information, making it less visible to other clients.",
"privacy-dontsend-tooltip" : "Do not send this information to the server. This provides for maximum privacy.",
"slowdown-tooltip" : "Reduce playback rate temporarily when needed to bring you back in sync with other viewers.",
"pauseonleave-tooltip" : "Pause playback if you get disconnected or someone leaves from your room.",
"rewind-tooltip" : "Jump back when needed to get back in sync. Recommended.",
"alwayshow-tooltip" : "Configuration dialogue is always shown, even when opening a file with Syncplay.",
"donotstore-tooltip" : "Run Syncplay with the given configuration, but do not permanently store the changes.",
"help-tooltip" : "Opens the Syncplay.pl user guide.",
# Server messages to client
"new-syncplay-available-motd-message" : "<NOTICE> You are using Syncplay {} but a newer version is available from http://syncplay.pl </NOTICE>", # ClientVersion
# 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
# Server arguments
"server-argument-description" : 'Solution to synchronize playback of multiple MPlayer and MPC-HC instances over the network. Server instance',
"server-argument-epilog" : 'If no options supplied _config values will be used',
"server-port-argument" : 'server TCP port',
"server-password-argument" : 'server password',
"server-isolate-room-argument" : 'should rooms be isolated?',
"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-http-reply-argument": "path to file from which http reply will be fetched",
"server-default-http-reply": "This server should not be requested with your browser, but with Syncplay software available from http://syncplay.pl",
"server-irc-verbose": "Should server actively report changes in rooms",
"server-irc-config": "Path to irc bot config files",
# Server errors
"unknown-command-server-error" : "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
"password-required-server-error" : "Password required",
"wrong-password-server-error" : "Wrong password supplied",
"hello-server-error" : "Not enough Hello arguments",
"version-mismatch-server-error" : "Mismatch between versions of client and server",
"wrong-password-server-error" : "Wrong password supplied"
}
pl = {
# Client notifications
"connection-attempt-notification" : "Próba połączenia z {}:{}", # Port, IP
"reconnection-attempt-notification" : "Połączenie z serwerem zostało przerwane, ponowne łączenie",
"disconnection-notification" : "Odłączono od serwera",
"connection-failed-notification" : "Połączenie z serwerem zakończone fiaskiem",
"rewind-notification" : "Cofnięto z powodu różnicy czasu z <{}>", # User
"slowdown-notification" : "Zwolniono z powodu różnicy czasu z <{}>", # User
"revert-notification" : "Przywrócono normalną prędkość odtwarzania",
"pause-notification" : "<{}> zatrzymał odtwarzanie", # User
"unpause-notification" : "<{}> wznowił odtwarzanie", # User
"seek-notification" : "<{}> skoczył z {} do {}", # User, from time, to time
"current-offset-notification" : "Obecny offset: {} seconds", # Offset
"room-join-notification" : "<{}> dołączył do pokoju: '{}'", # User
"left-notification" : "<{}> wyszedł", # User
"playing-notification" : "<{}> odtwarza '{}' ({})", # User, file, duration
"playing-notification/room-addendum" : " w pokoju: '{}'", # Room
"file-different-notification" : "Plik, który odtwarzasz wydaje się być różny od <{}>", # User
"file-differences-notification" : "Twój plik różni się następującymi parametrami: ",
"different-filesize-notification" : " (inny rozmiar pliku!)",
"file-played-by-notification" : "Plik: {} jest odtwarzany przez:", # File
"notplaying-notification" : "Osoby, które nie odtwarzają żadnych plików:",
"userlist-room-notification" : "W pokoju '{}':", # Room
# Client prompts
"enter-to-exit-prompt" : "Wciśnij Enter, aby zakończyć działanie programu\n",
# Client errors
"server-timeout-error" : "Przekroczono czas oczekiwania na odpowiedź serwera"
}
messages = {
"en": en,
"pl": pl
}
def getMessage(locale, type_):
if(messages.has_key(locale)):
if(messages[locale].has_key(type_)):
return unicode(messages[locale][type_])
if(messages["en"].has_key(type_)):
return unicode(messages["en"][type_])
else:
raise KeyError()

View File

@ -6,9 +6,9 @@ from syncplay import constants, utils
from syncplay.messages import getMessage
from syncplay.players.playerFactory import PlayerFactory
import codecs
try:
try:
from syncplay.ui.GuiConfiguration import GuiConfiguration
from PySide import QtGui #@UnresolvedImport
from PySide import QtGui # @UnresolvedImport
from PySide.QtCore import QCoreApplication
except ImportError:
GuiConfiguration = None
@ -16,7 +16,7 @@ except ImportError:
class InvalidConfigValue(Exception):
def __init__(self, message):
Exception.__init__(self, message)
class ConfigurationGetter(object):
def __init__(self):
self._config = {
@ -33,19 +33,16 @@ class ConfigurationGetter(object):
"file": None,
"playerArgs": [],
"playerClass": None,
"slowOnDesync": True,
"slowOnDesync": True,
"rewindOnDesync": True,
"malUsername": "",
"malPassword": "",
"malPassword": "",
"filenamePrivacyMode": constants.PRIVACY_SENDRAW_MODE,
"filesizePrivacyMode": constants.PRIVACY_SENDRAW_MODE,
"pauseOnLeave": False,
"clearGUIData": False
}
#
#Custom validation in self._validateArguments
# Custom validation in self._validateArguments
#
self._required = [
"host",
@ -55,7 +52,7 @@ class ConfigurationGetter(object):
"playerPath",
"playerClass",
]
self._boolean = [
"debug",
"forceGuiPrompt",
@ -70,11 +67,10 @@ class ConfigurationGetter(object):
self._iniStructure = {
"server_data": ["host", "port", "password"],
"client_settings": ["name", "room", "playerPath", "slowOnDesync", "rewindOnDesync", "forceGuiPrompt", "filenamePrivacyMode", "filesizePrivacyMode", "pauseOnLeave"],
"mal": ["malPassword", "malUsername"]
}
#
#Watch out for the method self._overrideConfigWithArgs when you're adding custom multi-word command line arguments
# Watch out for the method self._overrideConfigWithArgs when you're adding custom multi-word command line arguments
#
self._argparser = argparse.ArgumentParser(description=getMessage("en", "argument-description"),
epilog=getMessage("en", "argument-epilog"))
@ -90,9 +86,9 @@ class ConfigurationGetter(object):
self._argparser.add_argument('file', metavar='file', type=str, nargs='?', help=getMessage("en", "file-argument"))
self._argparser.add_argument('--clear-gui-data', action='store_true', help=getMessage("en", "clear-gui-data-argument"))
self._argparser.add_argument('_args', metavar='options', type=str, nargs='*', help=getMessage("en", "args-argument"))
self._playerFactory = PlayerFactory()
def _validateArguments(self):
for key in self._boolean:
if(self._config[key] == "True"):
@ -134,7 +130,7 @@ class ConfigurationGetter(object):
if(key == "clear_gui_data"):
key = "clearGUIData"
self._config[key] = val
def _splitPortAndHost(self, host):
port = constants.DEFAULT_PORT if not self._config["port"] else self._config["port"]
if(host):
@ -146,7 +142,7 @@ class ConfigurationGetter(object):
path = utils.findWorkingDir()
for name in constants.CONFIG_NAMES:
if(os.path.isfile(os.path.join(path, name))):
return os.path.join(path, name)
return os.path.join(path, name)
def _getConfigurationFilePath(self):
configFile = self._checkForPortableFile()
@ -163,10 +159,10 @@ class ConfigurationGetter(object):
configFile = os.path.join(os.getenv('HOME', '.'), constants.DEFAULT_CONFIG_NAME_LINUX)
else:
configFile = os.path.join(os.getenv('APPDATA', '.'), constants.DEFAULT_CONFIG_NAME_WINDOWS)
return configFile
def _parseConfigFile(self, iniPath, createConfig = True):
def _parseConfigFile(self, iniPath, createConfig=True):
parser = SafeConfigParserUnicode()
if(not os.path.isfile(iniPath)):
if(createConfig):
@ -179,7 +175,7 @@ class ConfigurationGetter(object):
for option in options:
if(parser.has_option(section, option)):
self._config[option] = parser.get(section, option)
def _checkConfig(self):
try:
self._validateArguments()
@ -191,12 +187,12 @@ class ConfigurationGetter(object):
except:
sys.exit()
def _promptForMissingArguments(self, error = None):
def _promptForMissingArguments(self, error=None):
if(self._config['noGui']):
print getMessage("en", "missing-arguments-error")
sys.exit()
elif(GuiConfiguration):
gc = GuiConfiguration(self._config, error = error)
gc = GuiConfiguration(self._config, error=error)
gc.setAvailablePaths(self._playerFactory.getAvailablePlayerPaths())
gc.run()
return gc.getProcessedConfiguration()
@ -224,7 +220,7 @@ class ConfigurationGetter(object):
parser.set(section, option, unicode(self._config[option]))
if(changed):
parser.write(codecs.open(iniPath, "wb", "utf_8_sig"))
def _forceGuiPrompt(self):
try:
@ -253,8 +249,8 @@ class ConfigurationGetter(object):
locations = self.__getRelativeConfigLocations()
for location in locations:
for name in constants.CONFIG_NAMES:
path = location + os.path.sep + name
self._parseConfigFile(path, createConfig = False)
path = location + os.path.sep + name
self._parseConfigFile(path, createConfig=False)
self._checkConfig()
def getConfiguration(self):
@ -262,8 +258,8 @@ class ConfigurationGetter(object):
self._parseConfigFile(iniPath)
args = self._argparser.parse_args()
self._overrideConfigWithArgs(args)
#Arguments not validated yet - booleans are still text values
if(self._config['forceGuiPrompt'] == "True" or not self._config['file']):
# Arguments not validated yet - booleans are still text values
if(self._config['forceGuiPrompt'] == "True" or not self._config['file']):
self._forceGuiPrompt()
self._checkConfig()
self._saveConfig(iniPath)
@ -275,7 +271,7 @@ class ConfigurationGetter(object):
self.app = QtGui.QApplication(sys.argv)
qt4reactor.install()
return self._config
class SafeConfigParserUnicode(SafeConfigParser):
def write(self, fp):
"""Write an .ini-format representation of the configuration state."""

View File

@ -9,12 +9,12 @@ from syncplay.messages import getMessage
from syncplay import constants
class GuiConfiguration:
def __init__(self, config, error = None):
def __init__(self, config, error=None):
self.config = config
self._availablePlayerPaths = []
self.error = error
def run(self):
if QCoreApplication.instance() is None:
self.app = QtGui.QApplication(sys.argv)
@ -26,19 +26,19 @@ class GuiConfiguration:
def getProcessedConfiguration(self):
return self.config
class WindowClosed(Exception):
pass
pass
class ConfigDialog(QtGui.QDialog):
pressedclosebutton = False
moreToggling = False
def moreToggled(self):
if self.moreToggling == False:
self.moreToggling = True
if self.showmoreCheckbox.isChecked() and self.showmoreCheckbox.isVisible():
self.showmoreCheckbox.setChecked(False)
self.moreSettingsGroup.setChecked(True)
@ -50,17 +50,17 @@ class ConfigDialog(QtGui.QDialog):
self.moreSettingsGroup.hide()
self.showmoreCheckbox.show()
self.saveMoreState(False)
self.moreToggling = False
self.adjustSize()
self.setFixedSize(self.sizeHint())
def runButtonTextUpdate(self):
if (self.donotstoreCheckbox.isChecked()):
self.runButton.setText(getMessage("en", "run-label"))
else:
self.runButton.setText(getMessage("en", "storeandrun-label"))
def openHelp(self):
self.QtGui.QDesktopServices.openUrl("http://syncplay.pl/guide/client/")
@ -93,10 +93,10 @@ class ConfigDialog(QtGui.QDialog):
if foundpath != "":
settings.beginGroup("PlayerList")
playerpathlist.append(os.path.normcase(os.path.normpath(foundpath)))
settings.setValue("PlayerList", list(set(os.path.normcase(os.path.normpath(path)) for path in set(playerpathlist))))
settings.setValue("PlayerList", list(set(os.path.normcase(os.path.normpath(path)) for path in set(playerpathlist))))
settings.endGroup()
return(foundpath)
def updateExecutableIcon(self):
currentplayerpath = unicode(self.executablepathCombobox.currentText())
iconpath = PlayerFactory().getPlayerIconByPath(currentplayerpath)
@ -105,16 +105,16 @@ class ConfigDialog(QtGui.QDialog):
self.executableiconLabel.setPixmap(QtGui.QPixmap.fromImage(self.executableiconImage))
else:
self.executableiconLabel.setPixmap(QtGui.QPixmap.fromImage(QtGui.QImage()))
def browsePlayerpath(self):
options = QtGui.QFileDialog.Options()
defaultdirectory = ""
browserfilter = "All files (*)"
if os.name == 'nt':
browserfilter = "Executable files (*.exe);;All files (*)"
if "PROGRAMFILES(X86)" in os.environ:
browserfilter = "Executable files (*.exe);;All files (*)"
if "PROGRAMFILES(X86)" in os.environ:
defaultdirectory = os.environ["ProgramFiles(x86)"]
elif "PROGRAMFILES" in os.environ:
defaultdirectory = os.environ["ProgramFiles"]
@ -122,26 +122,26 @@ class ConfigDialog(QtGui.QDialog):
defaultdirectory = os.environ["ProgramW6432"]
elif sys.platform.startswith('linux'):
defaultdirectory = "/usr/bin"
fileName, filtr = QtGui.QFileDialog.getOpenFileName(self,
"Browse for media player executable",
defaultdirectory,
browserfilter, "", options)
if fileName:
self.executablepathCombobox.setEditText(os.path.normpath(fileName))
def loadMediaBrowseSettings(self):
settings = QSettings("Syncplay", "MediaBrowseDialog")
settings.beginGroup("MediaBrowseDialog")
self.mediadirectory = settings.value("mediadir", "")
settings.endGroup()
def saveMediaBrowseSettings(self):
settings = QSettings("Syncplay", "MediaBrowseDialog")
settings.beginGroup("MediaBrowseDialog")
settings.setValue("mediadir", self.mediadirectory)
settings.endGroup()
def getMoreState(self):
settings = QSettings("Syncplay", "MoreSettings")
settings.beginGroup("MoreSettings")
@ -151,13 +151,13 @@ class ConfigDialog(QtGui.QDialog):
return(True)
else:
return(False)
def saveMoreState(self, morestate):
settings = QSettings("Syncplay", "MoreSettings")
settings.beginGroup("MoreSettings")
settings.setValue("ShowMoreSettings", morestate)
settings.endGroup()
def browseMediapath(self):
self.loadMediaBrowseSettings()
options = QtGui.QFileDialog.Options()
@ -169,16 +169,16 @@ class ConfigDialog(QtGui.QDialog):
defaultdirectory = QDesktopServices.storageLocation(QDesktopServices.HomeLocation)
else:
defaultdirectory = ""
browserfilter = "All files (*)"
fileName, filtr = QtGui.QFileDialog.getOpenFileName(self,"Browse for media files",defaultdirectory,
browserfilter = "All files (*)"
fileName, filtr = QtGui.QFileDialog.getOpenFileName(self, "Browse for media files", defaultdirectory,
browserfilter, "", options)
if fileName:
self.mediapathTextbox.setText(os.path.normpath(fileName))
self.mediadirectory = os.path.dirname(fileName)
self.saveMediaBrowseSettings()
def _saveDataAndLeave(self):
self.config['host'] = self.hostTextbox.text() if ":" in self.hostTextbox.text() else self.hostTextbox.text() + ":" + unicode(constants.DEFAULT_PORT)
self.config['host'] = self.hostTextbox.text() if ":" in self.hostTextbox.text() else self.hostTextbox.text() + ":" + unicode(constants.DEFAULT_PORT)
self.config['name'] = self.usernameTextbox.text()
self.config['room'] = self.defaultroomTextbox.text()
self.config['password'] = self.serverpassTextbox.text()
@ -188,7 +188,7 @@ class ConfigDialog(QtGui.QDialog):
elif os.path.isfile(os.path.abspath(self.mediapathTextbox.text())):
self.config['file'] = os.path.abspath(self.mediapathTextbox.text())
else:
self.config['file'] = unicode(self.mediapathTextbox.text())
self.config['file'] = unicode(self.mediapathTextbox.text())
if self.alwaysshowCheckbox.isChecked() == True:
self.config['forceGuiPrompt'] = True
else:
@ -212,9 +212,7 @@ class ConfigDialog(QtGui.QDialog):
self.config['rewindOnDesync'] = True
else:
self.config['rewindOnDesync'] = False
self.config['malUsername'] = self.malusernameTextbox.text()
self.config['malPassword'] = self.malpasswordTextbox.text()
if self.filenameprivacySendRawOption.isChecked() == True:
self.config['filenamePrivacyMode'] = constants.PRIVACY_SENDRAW_MODE
elif self.filenameprivacySendHashedOption.isChecked() == True:
@ -232,7 +230,7 @@ class ConfigDialog(QtGui.QDialog):
self.pressedclosebutton = True
self.close()
return
def closeEvent(self, event):
if self.pressedclosebutton == False:
sys.exit()
@ -244,7 +242,7 @@ class ConfigDialog(QtGui.QDialog):
urls = data.urls()
if (urls and urls[0].scheme() == 'file'):
event.acceptProposedAction()
def dropEvent(self, event):
data = event.mimeData()
urls = data.urls()
@ -252,25 +250,25 @@ class ConfigDialog(QtGui.QDialog):
if sys.platform.startswith('linux'):
dropfilepath = unicode(urls[0].path())
else:
dropfilepath = unicode(urls[0].path())[1:] # Removes starting slash
dropfilepath = unicode(urls[0].path())[1:] # Removes starting slash
if dropfilepath[-4:].lower() == ".exe":
self.executablepathCombobox.setEditText(dropfilepath)
else:
self.mediapathTextbox.setText(dropfilepath)
def __init__(self, config, playerpaths, error):
from syncplay import utils
self.config = config
self.datacleared = False
if config['clearGUIData'] == True:
settings = QSettings("Syncplay","PlayerList")
settings = QSettings("Syncplay", "PlayerList")
settings.clear()
settings = QSettings("Syncplay","MediaBrowseDialog")
settings = QSettings("Syncplay", "MediaBrowseDialog")
settings.clear()
settings = QSettings("Syncplay","MainWindow")
settings = QSettings("Syncplay", "MainWindow")
settings.clear()
settings = QSettings("Syncplay","MoreSettings")
settings = QSettings("Syncplay", "MoreSettings")
settings.clear()
self.datacleared = True
self.QtGui = QtGui
@ -282,26 +280,26 @@ class ConfigDialog(QtGui.QDialog):
self.resourcespath = resourcespath
super(ConfigDialog, self).__init__()
self.setWindowTitle(getMessage("en", "config-window-title"))
self.setWindowFlags(self.windowFlags() & Qt.WindowCloseButtonHint & ~Qt.WindowContextHelpButtonHint)
self.setWindowIcon(QtGui.QIcon(resourcespath + "syncplay.png"))
if(config['host'] == None):
host = ""
elif(":" in config['host']):
host = config['host']
else:
host = config['host']+":"+str(config['port'])
host = config['host'] + ":" + str(config['port'])
self.connectionSettingsGroup = QtGui.QGroupBox(getMessage("en", "connection-group-title"))
self.hostTextbox = QLineEdit(host, self)
self.hostLabel = QLabel(getMessage("en", "host-label"), self)
self.usernameTextbox = QLineEdit(config['name'],self)
self.usernameTextbox = QLineEdit(config['name'], self)
self.serverpassLabel = QLabel(getMessage("en", "password-label"), self)
self.defaultroomTextbox = QLineEdit(config['room'],self)
self.defaultroomTextbox = QLineEdit(config['room'], self)
self.usernameLabel = QLabel(getMessage("en", "username-label"), self)
self.serverpassTextbox = QLineEdit(config['password'],self)
self.serverpassTextbox = QLineEdit(config['password'], self)
self.defaultroomLabel = QLabel(getMessage("en", "room-label"), self)
if (constants.SHOW_TOOLTIPS == True):
@ -313,7 +311,7 @@ class ConfigDialog(QtGui.QDialog):
self.serverpassTextbox.setToolTip(getMessage("en", "password-tooltip"))
self.defaultroomLabel.setToolTip(getMessage("en", "room-tooltip"))
self.defaultroomTextbox.setToolTip(getMessage("en", "room-tooltip"))
self.connectionSettingsLayout = QtGui.QGridLayout()
self.connectionSettingsLayout.addWidget(self.hostLabel, 0, 0)
self.connectionSettingsLayout.addWidget(self.hostTextbox, 0, 1)
@ -324,7 +322,7 @@ class ConfigDialog(QtGui.QDialog):
self.connectionSettingsLayout.addWidget(self.defaultroomLabel, 3, 0)
self.connectionSettingsLayout.addWidget(self.defaultroomTextbox, 3, 1)
self.connectionSettingsGroup.setLayout(self.connectionSettingsLayout)
self.mediaplayerSettingsGroup = QtGui.QGroupBox(getMessage("en", "media-setting-title"))
self.executableiconImage = QtGui.QImage()
self.executableiconLabel = QLabel(self)
@ -336,21 +334,21 @@ class ConfigDialog(QtGui.QDialog):
self.executablepathCombobox.setMinimumWidth(200)
self.executablepathCombobox.setMaximumWidth(200)
self.executablepathCombobox.editTextChanged.connect(self.updateExecutableIcon)
self.executablepathLabel = QLabel(getMessage("en", "executable-path-label"), self)
self.executablebrowseButton = QtGui.QPushButton(QtGui.QIcon(resourcespath + 'folder_explore.png'),getMessage("en", "browse-label"))
self.executablebrowseButton = QtGui.QPushButton(QtGui.QIcon(resourcespath + 'folder_explore.png'), getMessage("en", "browse-label"))
self.executablebrowseButton.clicked.connect(self.browsePlayerpath)
self.mediapathTextbox = QLineEdit(config['file'], self)
self.mediapathLabel = QLabel(getMessage("en", "media-path-label"), self)
self.mediabrowseButton = QtGui.QPushButton(QtGui.QIcon(resourcespath + 'folder_explore.png'),getMessage("en", "browse-label"))
self.mediabrowseButton = QtGui.QPushButton(QtGui.QIcon(resourcespath + 'folder_explore.png'), getMessage("en", "browse-label"))
self.mediabrowseButton.clicked.connect(self.browseMediapath)
if (constants.SHOW_TOOLTIPS == True):
self.executablepathLabel.setToolTip(getMessage("en", "executable-path-tooltip"))
self.executablepathCombobox.setToolTip(getMessage("en", "executable-path-tooltip"))
self.mediapathLabel.setToolTip(getMessage("en", "media-path-tooltip"))
self.mediapathTextbox.setToolTip(getMessage("en", "media-path-tooltip"))
if constants.SHOW_REWIND_ON_DESYNC_CHECKBOX == True:
self.rewindCheckbox = QCheckBox(getMessage("en", "rewind-label"))
if (constants.SHOW_TOOLTIPS == True):
@ -368,22 +366,7 @@ class ConfigDialog(QtGui.QDialog):
self.moreSettingsGroup = QtGui.QGroupBox(getMessage("en", "more-title"))
self.moreSettingsGroup.setCheckable(True)
self.malSettingsSplit = QtGui.QSplitter(self)
self.malusernameTextbox = QLineEdit(config['malUsername'],self)
self.malusernameTextbox.setMaximumWidth(115)
self.malusernameLabel = QLabel(getMessage("en", "mal-username-label"), self)
self.malpasswordTextbox = QLineEdit(config['malPassword'],self)
self.malpasswordTextbox.setEchoMode(QtGui.QLineEdit.Password)
self.malpasswordLabel = QLabel(getMessage("en", "mal-password-label"), self)
### <MAL DISABLE>
self.malpasswordTextbox.hide()
self.malpasswordLabel.hide()
self.malusernameTextbox.hide()
self.malusernameLabel.hide()
### </MAL DISABLE>
self.filenameprivacyLabel = QLabel(getMessage("en", "filename-privacy-label"), self)
self.filenameprivacyButtonGroup = QButtonGroup()
self.filenameprivacySendRawOption = QRadioButton(getMessage("en", "privacy-sendraw-option"))
@ -392,7 +375,7 @@ class ConfigDialog(QtGui.QDialog):
self.filenameprivacyButtonGroup.addButton(self.filenameprivacySendRawOption)
self.filenameprivacyButtonGroup.addButton(self.filenameprivacySendHashedOption)
self.filenameprivacyButtonGroup.addButton(self.filenameprivacyDontSendOption)
self.filesizeprivacyLabel = QLabel(getMessage("en", "filesize-privacy-label"), self)
self.filesizeprivacyButtonGroup = QButtonGroup()
self.filesizeprivacySendRawOption = QRadioButton(getMessage("en", "privacy-sendraw-option"))
@ -401,12 +384,12 @@ class ConfigDialog(QtGui.QDialog):
self.filesizeprivacyButtonGroup.addButton(self.filesizeprivacySendRawOption)
self.filesizeprivacyButtonGroup.addButton(self.filesizeprivacySendHashedOption)
self.filesizeprivacyButtonGroup.addButton(self.filesizeprivacyDontSendOption)
self.slowdownCheckbox = QCheckBox(getMessage("en", "slowdown-label"))
self.pauseonleaveCheckbox = QCheckBox(getMessage("en", "pauseonleave-label"))
self.alwaysshowCheckbox = QCheckBox(getMessage("en", "alwayshow-label"))
self.donotstoreCheckbox = QCheckBox(getMessage("en", "donotstore-label"))
filenamePrivacyMode = config['filenamePrivacyMode']
if filenamePrivacyMode == constants.PRIVACY_DONTSEND_MODE:
self.filenameprivacyDontSendOption.setChecked(True)
@ -414,7 +397,7 @@ class ConfigDialog(QtGui.QDialog):
self.filenameprivacySendHashedOption.setChecked(True)
else:
self.filenameprivacySendRawOption.setChecked(True)
filesizePrivacyMode = config['filesizePrivacyMode']
if filesizePrivacyMode == constants.PRIVACY_DONTSEND_MODE:
self.filesizeprivacyDontSendOption.setChecked(True)
@ -422,20 +405,15 @@ class ConfigDialog(QtGui.QDialog):
self.filesizeprivacySendHashedOption.setChecked(True)
else:
self.filesizeprivacySendRawOption.setChecked(True)
if config['slowOnDesync'] == True:
self.slowdownCheckbox.setChecked(True)
if constants.SHOW_REWIND_ON_DESYNC_CHECKBOX == True and config['rewindOnDesync'] == True:
self.rewindCheckbox.setChecked(True)
if config['pauseOnLeave'] == True:
self.pauseonleaveCheckbox.setChecked(True)
if (constants.SHOW_TOOLTIPS == True):
self.malusernameLabel.setToolTip(getMessage("en", "mal-username-tooltip"))
self.malusernameTextbox.setToolTip(getMessage("en", "mal-username-tooltip"))
self.malpasswordLabel.setToolTip(getMessage("en", "mal-password-tooltip"))
self.malpasswordTextbox.setToolTip(getMessage("en", "mal-password-tooltip"))
self.filenameprivacyLabel.setToolTip(getMessage("en", "filename-privacy-tooltip"))
self.filenameprivacySendRawOption.setToolTip(getMessage("en", "privacy-sendraw-tooltip"))
self.filenameprivacySendHashedOption.setToolTip(getMessage("en", "privacy-sendhashed-tooltip"))
@ -444,64 +422,59 @@ class ConfigDialog(QtGui.QDialog):
self.filesizeprivacySendRawOption.setToolTip(getMessage("en", "privacy-sendraw-tooltip"))
self.filesizeprivacySendHashedOption.setToolTip(getMessage("en", "privacy-sendhashed-tooltip"))
self.filesizeprivacyDontSendOption.setToolTip(getMessage("en", "privacy-dontsend-tooltip"))
self.slowdownCheckbox.setToolTip(getMessage("en", "slowdown-tooltip"))
self.pauseonleaveCheckbox.setToolTip(getMessage("en", "pauseonleave-tooltip"))
self.alwaysshowCheckbox.setToolTip(getMessage("en", "alwayshow-tooltip"))
self.donotstoreCheckbox.setToolTip(getMessage("en", "donotstore-tooltip"))
self.slowdownCheckbox.setToolTip(getMessage("en", "slowdown-tooltip"))
self.moreSettingsLayout = QtGui.QGridLayout()
self.privacySettingsLayout = QtGui.QGridLayout()
self.privacyFrame = QtGui.QFrame()
self.privacyFrame.setLineWidth(0)
self.privacyFrame.setMidLineWidth(0)
self.privacySettingsLayout.setContentsMargins(0,0,0,0)
self.privacySettingsLayout.setContentsMargins(0, 0, 0, 0)
self.privacySettingsLayout.addWidget(self.filenameprivacyLabel, 0, 0)
self.privacySettingsLayout.addWidget(self.filenameprivacySendRawOption, 0, 1, Qt.AlignRight)
self.privacySettingsLayout.addWidget(self.filenameprivacySendHashedOption, 0,2, Qt.AlignRight)
self.privacySettingsLayout.addWidget(self.filenameprivacySendRawOption, 0, 1, Qt.AlignRight)
self.privacySettingsLayout.addWidget(self.filenameprivacySendHashedOption, 0, 2, Qt.AlignRight)
self.privacySettingsLayout.addWidget(self.filenameprivacyDontSendOption, 0, 3, Qt.AlignRight)
self.privacySettingsLayout.addWidget(self.filesizeprivacyLabel, 1, 0)
self.privacySettingsLayout.addWidget(self.filesizeprivacySendRawOption, 1, 1, Qt.AlignRight)
self.privacySettingsLayout.addWidget(self.filesizeprivacySendHashedOption, 1, 2, Qt.AlignRight)
self.privacySettingsLayout.addWidget(self.filesizeprivacyDontSendOption, 1, 3, Qt.AlignRight)
self.privacyFrame.setLayout(self.privacySettingsLayout)
self.moreSettingsLayout.addWidget(self.privacyFrame, 0, 0, 1, 4)
self.moreSettingsLayout.addWidget(self.malusernameLabel , 1, 0)
self.moreSettingsLayout.addWidget(self.malusernameTextbox, 1, 1)
self.moreSettingsLayout.addWidget(self.malpasswordLabel , 1, 2)
self.moreSettingsLayout.addWidget(self.malpasswordTextbox, 1, 3)
self.moreSettingsLayout.addWidget(self.slowdownCheckbox, 2, 0,1,4)
self.moreSettingsLayout.addWidget(self.slowdownCheckbox, 2, 0, 1, 4)
if constants.SHOW_REWIND_ON_DESYNC_CHECKBOX == True:
self.moreSettingsLayout.addWidget(self.rewindCheckbox, 3, 0, 1, 4)
self.moreSettingsLayout.addWidget(self.pauseonleaveCheckbox, 4, 0, 1, 4)
self.moreSettingsLayout.addWidget(self.pauseonleaveCheckbox, 4, 0, 1, 4)
self.moreSettingsLayout.addWidget(self.alwaysshowCheckbox, 5, 0, 1, 4)
self.moreSettingsLayout.addWidget(self.donotstoreCheckbox, 6, 0, 1, 4)
self.moreSettingsGroup.setLayout(self.moreSettingsLayout)
self.showmoreCheckbox = QCheckBox(getMessage("en", "more-title"))
if self.getMoreState() == False:
self.showmoreCheckbox.setChecked(False)
self.moreSettingsGroup.hide()
else:
self.showmoreCheckbox.hide()
self.showmoreCheckbox.toggled.connect(self.moreToggled)
self.showmoreCheckbox.toggled.connect(self.moreToggled)
self.moreSettingsGroup.toggled.connect(self.moreToggled)
if config['forceGuiPrompt'] == True:
self.alwaysshowCheckbox.setChecked(True)
if (constants.SHOW_TOOLTIPS == True):
self.showmoreCheckbox.setToolTip(getMessage("en", "more-tooltip"))
self.donotstoreCheckbox.toggled.connect(self.runButtonTextUpdate)
self.mainLayout = QtGui.QVBoxLayout()
if error:
self.errorLabel = QLabel(error, self)
@ -515,14 +488,14 @@ class ConfigDialog(QtGui.QDialog):
self.mainLayout.addWidget(self.showmoreCheckbox)
self.mainLayout.addWidget(self.moreSettingsGroup)
self.mainLayout.addSpacing(12)
self.topLayout = QtGui.QHBoxLayout()
self.helpButton = QtGui.QPushButton(QtGui.QIcon(resourcespath + 'help.png'),getMessage("en", "help-label"))
self.helpButton = QtGui.QPushButton(QtGui.QIcon(resourcespath + 'help.png'), getMessage("en", "help-label"))
if (constants.SHOW_TOOLTIPS == True):
self.helpButton.setToolTip(getMessage("en", "help-tooltip"))
self.helpButton.setMaximumSize(self.helpButton.sizeHint())
self.helpButton.pressed.connect(self.openHelp)
self.runButton = QtGui.QPushButton(QtGui.QIcon(resourcespath + 'accept.png'),getMessage("en", "storeandrun-label"))
self.runButton = QtGui.QPushButton(QtGui.QIcon(resourcespath + 'accept.png'), getMessage("en", "storeandrun-label"))
self.runButton.pressed.connect(self._saveDataAndLeave)
if config['noStore'] == True:
self.donotstoreCheckbox.setChecked(True)
@ -530,12 +503,12 @@ class ConfigDialog(QtGui.QDialog):
self.topLayout.addWidget(self.helpButton, Qt.AlignLeft)
self.topLayout.addWidget(self.runButton, Qt.AlignRight)
self.mainLayout.addLayout(self.topLayout)
self.mainLayout.addStretch(1)
self.setLayout(self.mainLayout)
self.runButton.setFocus()
self.runButton.setFocus()
self.setFixedSize(self.sizeHint())
self.setAcceptDrops(True)
if self.datacleared == True:
QtGui.QMessageBox.information(self,"Syncplay", getMessage("en", "gui-data-cleared-notification"))
QtGui.QMessageBox.information(self, "Syncplay", getMessage("en", "gui-data-cleared-notification"))