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, \ from syncplay.constants import PRIVACY_SENDHASHED_MODE, PRIVACY_DONTSEND_MODE, \
PRIVACY_HIDDENFILENAME, FILENAME_STRIP_REGEX PRIVACY_HIDDENFILENAME, FILENAME_STRIP_REGEX
import collections import collections
# <MAL DISABLE>
libMal = None
'''try:
import libMal
except ImportError:
libMal = None
'''
# </MAL DISABLE>
class SyncClientFactory(ClientFactory): class SyncClientFactory(ClientFactory):
def __init__(self, client, retry=constants.RECONNECT_RETRIES): def __init__(self, client, retry=constants.RECONNECT_RETRIES):
@ -67,7 +59,6 @@ class SyncplayClient(object):
self.userlist = SyncplayUserlist(self.ui, self) self.userlist = SyncplayUserlist(self.ui, self)
self._protocol = None self._protocol = None
self._player = None self._player = None
self.givenmalprivacywarning = False
if(config['room'] == None or config['room'] == ''): if(config['room'] == None or config['room'] == ''):
config['room'] = config['name'] # ticket #58 config['room'] = config['name'] # ticket #58
self.defaultRoom = config['room'] self.defaultRoom = config['room']
@ -98,7 +89,6 @@ class SyncplayClient(object):
self._speedChanged = False self._speedChanged = False
self._warnings = self._WarningManager(self._player, self.userlist, self.ui) self._warnings = self._WarningManager(self._player, self.userlist, self.ui)
self._malUpdater = MalUpdater(config["malUsername"], config["malPassword"], self.ui)
def initProtocol(self, protocol): def initProtocol(self, protocol):
self._protocol = protocol self._protocol = protocol
@ -233,7 +223,6 @@ class SyncplayClient(object):
if(self.userlist.hasRoomStateChanged() and not paused): if(self.userlist.hasRoomStateChanged() and not paused):
self._warnings.checkWarnings() self._warnings.checkWarnings()
self.userlist.roomStateConfirmed() self.userlist.roomStateConfirmed()
self._malUpdater.playingHook(position, paused)
def updateGlobalState(self, position, paused, doSeek, setBy, messageAge): def updateGlobalState(self, position, paused, doSeek, setBy, messageAge):
if(self.__getUserlistOnLogon): if(self.__getUserlistOnLogon):
@ -309,12 +298,6 @@ class SyncplayClient(object):
filename, size = self.__executePrivacySettings(filename, size) filename, size = self.__executePrivacySettings(filename, size)
self.userlist.currentUser.setFile(filename, duration, size) self.userlist.currentUser.setFile(filename, duration, size)
self.sendFile() 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): def __executePrivacySettings(self, filename, size):
if (self._config['filenamePrivacyMode'] == PRIVACY_SENDHASHED_MODE): if (self._config['filenamePrivacyMode'] == PRIVACY_SENDHASHED_MODE):
@ -475,53 +458,6 @@ class SyncplayUser(object):
else: else:
return "{}".format(self.username) 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): class SyncplayUserlist(object):
def __init__(self, ui, client): def __init__(self, ui, client):
self.currentUser = SyncplayUser() self.currentUser = SyncplayUser()

View File

@ -1,252 +1,246 @@
#coding:utf8 # coding:utf8
en = { en = {
# Client notifications # Client notifications
"connection-attempt-notification" : "Attempting to connect to {}:{}", #Port, IP "connection-attempt-notification" : "Attempting to connect to {}:{}", # Port, IP
"reconnection-attempt-notification" : "Connection with server lost, attempting to reconnect", "reconnection-attempt-notification" : "Connection with server lost, attempting to reconnect",
"disconnection-notification" : "Disconnected from server", "disconnection-notification" : "Disconnected from server",
"connection-failed-notification" : "Connection with server failed", "connection-failed-notification" : "Connection with server failed",
"connected-successful-notification" : "Successfully connected to server", "connected-successful-notification" : "Successfully connected to server",
"retrying-notification" : "%s, Retrying in %d seconds...", #Seconds "retrying-notification" : "%s, Retrying in %d seconds...", # Seconds
"rewind-notification" : "Rewinded due to time difference with <{}>", #User "rewind-notification" : "Rewinded due to time difference with <{}>", # User
"slowdown-notification" : "Slowing down due to time difference with <{}>", #User "slowdown-notification" : "Slowing down due to time difference with <{}>", # User
"revert-notification" : "Reverting speed back to normal", "revert-notification" : "Reverting speed back to normal",
"pause-notification" : "<{}> paused", #User "pause-notification" : "<{}> paused", # User
"unpause-notification" : "<{}> unpaused", #User "unpause-notification" : "<{}> unpaused", # User
"seek-notification" : "<{}> jumped from {} to {}", #User, from time, to time "seek-notification" : "<{}> jumped from {} to {}", # User, from time, to time
"current-offset-notification" : "Current offset: {} seconds", #Offset "current-offset-notification" : "Current offset: {} seconds", # Offset
"room-join-notification" : "<{}> has joined the room: '{}'", #User "room-join-notification" : "<{}> has joined the room: '{}'", # User
"left-notification" : "<{}> has left", #User "left-notification" : "<{}> has left", # User
"playing-notification" : "<{}> is playing '{}' ({})", #User, file, duration "playing-notification" : "<{}> is playing '{}' ({})", # User, file, duration
"playing-notification/room-addendum" : " in room: '{}'", #Room "playing-notification/room-addendum" : " in room: '{}'", # Room
"file-different-notification" : "File you are playing appears to be different from <{}>'s", #User "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): ", "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", "room-files-not-same" : "Not all files played in the room are the same",
"alone-in-the-room": "You're alone in the room", "alone-in-the-room": "You're alone in the room",
"different-filesize-notification" : " (their file size is different from yours!)", "different-filesize-notification" : " (their file size is different from yours!)",
"file-played-by-notification" : "File: {} is being played by:", #File "file-played-by-notification" : "File: {} is being played by:", # File
"notplaying-notification" : "People who are not playing any file:", "notplaying-notification" : "People who are not playing any file:",
"userlist-room-notification" : "In room '{}':", #Room "userlist-room-notification" : "In room '{}':", # Room
"mplayer-file-required-notification" : "Syncplay using mplayer requires you to provide file when starting", "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", "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", "mplayer2-required" : "Syncplay is incompatible with MPlayer 1.x, please use mplayer2 or mpv",
"unrecognized-command-notification" : "Unrecognized command", "unrecognized-command-notification" : "Unrecognized command",
"commandlist-notification" : "Available commands:", "commandlist-notification" : "Available commands:",
"commandlist-notification/room" : "\tr [name] - change room", "commandlist-notification/room" : "\tr [name] - change room",
"commandlist-notification/list" : "\tl - show user list", "commandlist-notification/list" : "\tl - show user list",
"commandlist-notification/undo" : "\tu - undo last seek", "commandlist-notification/undo" : "\tu - undo last seek",
"commandlist-notification/pause" : "\tp - toggle pause", "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/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", "commandlist-notification/help" : "\th - this help",
"syncplay-version-notification" : "Syncplay version: {}", #syncplay.version "syncplay-version-notification" : "Syncplay version: {}", # syncplay.version
"more-info-notification" : "More info available at: {}", #projectURL "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.", "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-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-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-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.", "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 prompts
"enter-to-exit-prompt" : "Press enter to exit\n", # Client errors
"missing-arguments-error" : "Some necessary arguments are missing, refer to --help",
# Client errors "server-timeout-error" : "Connection with server timed out",
"missing-arguments-error" : "Some necessary arguments are missing, refer to --help", "mpc-slave-error" : "Unable to start MPC in slave mode!",
"server-timeout-error" : "Connection with server timed out", "mpc-version-insufficient-error" : "MPC version not sufficient, please use `mpc-hc` >= `{}`",
"mpc-slave-error" : "Unable to start MPC in slave mode!", "player-file-open-error" : "Player failed opening file",
"mpc-version-insufficient-error" : "MPC version not sufficient, please use `mpc-hc` >= `{}`", "player-path-error" : "Player path is not set properly",
"player-file-open-error" : "Player failed opening file", "hostname-empty-error" : "Hostname can't be empty",
"player-path-error" : "Player path is not set properly", "empty-error" : "{} can't be empty", # Configuration
"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",
"arguments-missing-error" : "Some necessary arguments are missing, refer to --help", "unable-to-start-client-error" : "Unable to start client",
"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",
"not-json-error" : "Not a json encoded string\n", "version-mismatch-error" : "Mismatch between versions of client and server\n",
"hello-arguments-error" : "Not enough Hello arguments\n", "vlc-error-echo": "VLC error: {}", # VLC error line
"version-mismatch-error" : "Mismatch between versions of client and server\n", "vlc-unicode-loadfile-error" : "Cannot load file through Syncplay because it contains non-ASCII characters. Please load the file through VLC.",
"vlc-error-echo": "VLC error: {}", # VLC error line "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-unicode-loadfile-error" : "Cannot load file through Syncplay because it contains non-ASCII characters. Please load the file through VLC.", "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-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-versioncheck": "This version of VLC is not supported by Syncplay. Please use VLC 2.",
"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-other" : "When trying to load the syncplay.lua interface script VLC has provided the following error: {}", # Syncplay Error
"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.',
# Client arguments "argument-epilog" : 'If no options supplied _config values will be used',
"argument-description" : 'Solution to synchronize playback of multiple MPlayer and MPC-HC instances over the network.', "nogui-argument" : 'show no GUI',
"argument-epilog" : 'If no options supplied _config values will be used', "host-argument" : 'server\'s address',
"nogui-argument" : 'show no GUI', "name-argument" : 'desired username',
"host-argument" : 'server\'s address', "debug-argument" : 'debug mode',
"name-argument" : 'desired username', "force-gui-prompt-argument" : 'make configuration prompt appear',
"debug-argument" : 'debug mode', "no-store-argument" : 'don\'t store values in .syncplay',
"force-gui-prompt-argument" : 'make configuration prompt appear', "room-argument" : 'default room',
"no-store-argument" : 'don\'t store values in .syncplay', "password-argument" : 'server password',
"room-argument" : 'default room', "player-path-argument" : 'path to your player executable',
"password-argument" : 'server password', "file-argument" : 'file to play',
"player-path-argument" : 'path to your player executable', "args-argument" : 'player options, if you need to pass options starting with - prepend them with single \'--\' argument',
"file-argument" : 'file to play', "clear-gui-data-argument" : 'resets path and window state GUI data stored as QSettings',
"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",
# Client labels
"config-window-title" : "Syncplay configuration", "connection-group-title" : "Connection settings",
"host-label" : "Server address: ",
"connection-group-title" : "Connection settings", "username-label" : "Username:",
"host-label" : "Server address: ", "password-label" : "Server password (if any):",
"username-label" : "Username:", "room-label" : "Default room: ",
"password-label" : "Server password (if any):",
"room-label" : "Default room: ", "media-setting-title" : "Media player settings",
"executable-path-label" : "Path to media player:",
"media-setting-title" : "Media player settings", "media-path-label" : "Path to media file:",
"executable-path-label" : "Path to media player:", "browse-label" : "Browse",
"media-path-label" : "Path to media file:",
"browse-label" : "Browse", "more-title" : "Show more settings",
"privacy-sendraw-option" : "Send raw",
"more-title" : "Show more settings", "privacy-sendhashed-option" : "Send hashed",
"mal-username-label" : "MAL username:", "privacy-dontsend-option" : "Don't send",
"mal-password-label" : "MAL password:", "filename-privacy-label" : "Filename information:",
"privacy-sendraw-option" : "Send raw", "filesize-privacy-label" : "File size information:",
"privacy-sendhashed-option" : "Send hashed", "slowdown-label" : "Slow down on desync",
"privacy-dontsend-option" : "Don't send", "pauseonleave-label" : "Pause when user leaves",
"filename-privacy-label" : "Filename information:", "rewind-label" : "Rewind on major desync (highly recommended)",
"filesize-privacy-label" : "File size information:", "alwayshow-label" : "Always show this dialog",
"slowdown-label" : "Slow down on desync", "donotstore-label" : "Do not store this configuration",
"pauseonleave-label" : "Pause when user leaves",
"rewind-label" : "Rewind on major desync (highly recommended)", "help-label" : "Help",
"alwayshow-label" : "Always show this dialog", "run-label" : "Run Syncplay",
"donotstore-label" : "Do not store this configuration", "storeandrun-label" : "Store configuration and run Syncplay",
"help-label" : "Help", "roomuser-heading-label" : "Room / User",
"run-label" : "Run Syncplay", "fileplayed-heading-label" : "File being played",
"storeandrun-label" : "Store configuration and run Syncplay",
# Tooltips
"roomuser-heading-label" : "Room / User",
"fileplayed-heading-label" : "File being played", "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.",
# Tooltips "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.",
"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.", "executable-path-tooltip" : "Location of your chosen supported media player (MPC-HC, VLC, mplayer2 or mpv).",
"password-tooltip" : "Passwords are only needed for connecting to private servers.", "media-path-tooltip" : "Location of video or stream to be opened. Necessary for mpv and mplayer2.",
"room-tooltip" : "Room to join upon connection can be almost anything, but you will only be synchronised with people in the same room.",
"more-tooltip" : "Display less frequently used settings.",
"executable-path-tooltip" : "Location of your chosen supported media player (MPC-HC, VLC, mplayer2 or mpv).", "filename-privacy-tooltip" : "Privacy mode for sending currently playing filename to server.",
"media-path-tooltip" : "Location of video or stream to be opened. Necessary for mpv and mplayer2.", "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.",
"more-tooltip" : "Display less frequently used settings.", "privacy-sendhashed-tooltip" : "Send a hashed version of the information, making it less visible to other clients.",
"mal-username-tooltip" : "Your MyAnimeList username. Note: MAL support is experimental!", "privacy-dontsend-tooltip" : "Do not send this information to the server. This provides for maximum privacy.",
"mal-password-tooltip" : "Your MyAnimeList password. Note: This is not encrypted!", "slowdown-tooltip" : "Reduce playback rate temporarily when needed to bring you back in sync with other viewers.",
"filename-privacy-tooltip" : "Privacy mode for sending currently playing filename to server.", "pauseonleave-tooltip" : "Pause playback if you get disconnected or someone leaves from your room.",
"filesize-privacy-tooltip" : "Privacy mode for sending size of currently playing file to server.", "rewind-tooltip" : "Jump back when needed to get back in sync. Recommended.",
"privacy-sendraw-tooltip" : "Send this information without obfuscation. This is the default option with most functionality.", "alwayshow-tooltip" : "Configuration dialogue is always shown, even when opening a file with Syncplay.",
"privacy-sendhashed-tooltip" : "Send a hashed version of the information, making it less visible to other clients.", "donotstore-tooltip" : "Run Syncplay with the given configuration, but do not permanently store the changes.",
"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.", "help-tooltip" : "Opens the Syncplay.pl user guide.",
"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.", # Server messages to client
"alwayshow-tooltip" : "Configuration dialogue is always shown, even when opening a file with Syncplay.", "new-syncplay-available-motd-message" : "<NOTICE> You are using Syncplay {} but a newer version is available from http://syncplay.pl </NOTICE>", # ClientVersion
"donotstore-tooltip" : "Run Syncplay with the given configuration, but do not permanently store the changes.",
# Server notifications
"help-tooltip" : "Opens the Syncplay.pl user guide.", "welcome-server-notification" : "Welcome to Syncplay server, ver. {0}", # version
"client-connected-room-server-notification" : "{0}({2}) connected to room '{1}'", # username, host, room
# Server messages to client "client-left-server-notification" : "{0} left server", # name
"new-syncplay-available-motd-message" : "<NOTICE> You are using Syncplay {} but a newer version is available from http://syncplay.pl </NOTICE>", #ClientVersion
# Server notifications # Server arguments
"welcome-server-notification" : "Welcome to Syncplay server, ver. {0}", #version "server-argument-description" : 'Solution to synchronize playback of multiple MPlayer and MPC-HC instances over the network. Server instance',
"client-connected-room-server-notification" : "{0}({2}) connected to room '{1}'", #username, host, room "server-argument-epilog" : 'If no options supplied _config values will be used',
"client-left-server-notification" : "{0} left server", #name "server-port-argument" : 'server TCP port',
"server-password-argument" : 'server password',
"server-isolate-room-argument" : 'should rooms be isolated?',
#Server arguments "server-motd-argument": "path to file from which motd will be fetched",
"server-argument-description" : 'Solution to synchronize playback of multiple MPlayer and MPC-HC instances over the network. Server instance', "server-messed-up-motd-unescaped-placeholders": "Message of the Day has unescaped placeholders. All $ signs should be doubled ($$).",
"server-argument-epilog" : 'If no options supplied _config values will be used', "server-messed-up-motd-too-long": "Message of the Day is too long - maximum of {} chars, {} given.",
"server-port-argument" : 'server TCP port', "server-http-reply-argument": "path to file from which http reply will be fetched",
"server-password-argument" : 'server password', "server-default-http-reply": "This server should not be requested with your browser, but with Syncplay software available from http://syncplay.pl",
"server-isolate-room-argument" : 'should rooms be isolated?', "server-irc-verbose": "Should server actively report changes in rooms",
"server-motd-argument": "path to file from which motd will be fetched", "server-irc-config": "Path to irc bot config files",
"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 errors
"server-http-reply-argument": "path to file from which http reply will be fetched", "unknown-command-server-error" : "Unknown command {}", # message
"server-default-http-reply": "This server should not be requested with your browser, but with Syncplay software available from http://syncplay.pl", "not-json-server-error" : "Not a json encoded string {}", # message
"server-irc-verbose": "Should server actively report changes in rooms", "not-known-server-error" : "You must be known to server before sending this command",
"server-irc-config": "Path to irc bot config files", "client-drop-server-error" : "Client drop: {} -- {}", # host, error
"password-required-server-error" : "Password required",
#Server errors "wrong-password-server-error" : "Wrong password supplied",
"unknown-command-server-error" : "Unknown command {}", #message "hello-server-error" : "Not enough Hello arguments",
"not-json-server-error" : "Not a json encoded string {}", #message "version-mismatch-server-error" : "Mismatch between versions of client and server",
"not-known-server-error" : "You must be known to server before sending this command", "wrong-password-server-error" : "Wrong password supplied"
"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", pl = {
"wrong-password-server-error" : "Wrong password supplied"
# 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",
pl = { "connection-failed-notification" : "Połączenie z serwerem zakończone fiaskiem",
# Client notifications "rewind-notification" : "Cofnięto z powodu różnicy czasu z <{}>", # User
"connection-attempt-notification" : "Próba połączenia z {}:{}", #Port, IP "slowdown-notification" : "Zwolniono z powodu różnicy czasu z <{}>", # User
"reconnection-attempt-notification" : "Połączenie z serwerem zostało przerwane, ponowne łączenie", "revert-notification" : "Przywrócono normalną prędkość odtwarzania",
"disconnection-notification" : "Odłączono od serwera",
"connection-failed-notification" : "Połączenie z serwerem zakończone fiaskiem", "pause-notification" : "<{}> zatrzymał odtwarzanie", # User
"unpause-notification" : "<{}> wznowił odtwarzanie", # User
"rewind-notification" : "Cofnięto z powodu różnicy czasu z <{}>", #User "seek-notification" : "<{}> skoczył z {} do {}", # User, from time, to time
"slowdown-notification" : "Zwolniono z powodu różnicy czasu z <{}>", #User
"revert-notification" : "Przywrócono normalną prędkość odtwarzania", "current-offset-notification" : "Obecny offset: {} seconds", # Offset
"pause-notification" : "<{}> zatrzymał odtwarzanie", #User "room-join-notification" : "<{}> dołączył do pokoju: '{}'", # User
"unpause-notification" : "<{}> wznowił odtwarzanie", #User "left-notification" : "<{}> wyszedł", # User
"seek-notification" : "<{}> skoczył z {} do {}", #User, from time, to time "playing-notification" : "<{}> odtwarza '{}' ({})", # User, file, duration
"playing-notification/room-addendum" : " w pokoju: '{}'", # Room
"current-offset-notification" : "Obecny offset: {} seconds", #Offset
"file-different-notification" : "Plik, który odtwarzasz wydaje się być różny od <{}>", # User
"room-join-notification" : "<{}> dołączył do pokoju: '{}'", #User "file-differences-notification" : "Twój plik różni się następującymi parametrami: ",
"left-notification" : "<{}> wyszedł", #User
"playing-notification" : "<{}> odtwarza '{}' ({})", #User, file, duration "different-filesize-notification" : " (inny rozmiar pliku!)",
"playing-notification/room-addendum" : " w pokoju: '{}'", #Room "file-played-by-notification" : "Plik: {} jest odtwarzany przez:", # File
"notplaying-notification" : "Osoby, które nie odtwarzają żadnych plików:",
"file-different-notification" : "Plik, który odtwarzasz wydaje się być różny od <{}>", #User "userlist-room-notification" : "W pokoju '{}':", # Room
"file-differences-notification" : "Twój plik różni się następującymi parametrami: ", # Client prompts
"enter-to-exit-prompt" : "Wciśnij Enter, aby zakończyć działanie programu\n",
"different-filesize-notification" : " (inny rozmiar pliku!)",
"file-played-by-notification" : "Plik: {} jest odtwarzany przez:", #File # Client errors
"notplaying-notification" : "Osoby, które nie odtwarzają żadnych plików:", "server-timeout-error" : "Przekroczono czas oczekiwania na odpowiedź serwera"
"userlist-room-notification" : "W pokoju '{}':", #Room }
# Client prompts
"enter-to-exit-prompt" : "Wciśnij Enter, aby zakończyć działanie programu\n", messages = {
"en": en,
# Client errors "pl": pl
"server-timeout-error" : "Przekroczono czas oczekiwania na odpowiedź serwera" }
}
def getMessage(locale, type_):
messages = { if(messages.has_key(locale)):
"en": en, if(messages[locale].has_key(type_)):
"pl": pl return unicode(messages[locale][type_])
} if(messages["en"].has_key(type_)):
return unicode(messages["en"][type_])
def getMessage(locale, type_): else:
if(messages.has_key(locale)): raise KeyError()
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.messages import getMessage
from syncplay.players.playerFactory import PlayerFactory from syncplay.players.playerFactory import PlayerFactory
import codecs import codecs
try: try:
from syncplay.ui.GuiConfiguration import GuiConfiguration from syncplay.ui.GuiConfiguration import GuiConfiguration
from PySide import QtGui #@UnresolvedImport from PySide import QtGui # @UnresolvedImport
from PySide.QtCore import QCoreApplication from PySide.QtCore import QCoreApplication
except ImportError: except ImportError:
GuiConfiguration = None GuiConfiguration = None
@ -16,7 +16,7 @@ except ImportError:
class InvalidConfigValue(Exception): class InvalidConfigValue(Exception):
def __init__(self, message): def __init__(self, message):
Exception.__init__(self, message) Exception.__init__(self, message)
class ConfigurationGetter(object): class ConfigurationGetter(object):
def __init__(self): def __init__(self):
self._config = { self._config = {
@ -33,19 +33,16 @@ class ConfigurationGetter(object):
"file": None, "file": None,
"playerArgs": [], "playerArgs": [],
"playerClass": None, "playerClass": None,
"slowOnDesync": True, "slowOnDesync": True,
"rewindOnDesync": True, "rewindOnDesync": True,
"malUsername": "",
"malPassword": "",
"malPassword": "",
"filenamePrivacyMode": constants.PRIVACY_SENDRAW_MODE, "filenamePrivacyMode": constants.PRIVACY_SENDRAW_MODE,
"filesizePrivacyMode": constants.PRIVACY_SENDRAW_MODE, "filesizePrivacyMode": constants.PRIVACY_SENDRAW_MODE,
"pauseOnLeave": False, "pauseOnLeave": False,
"clearGUIData": False "clearGUIData": False
} }
# #
#Custom validation in self._validateArguments # Custom validation in self._validateArguments
# #
self._required = [ self._required = [
"host", "host",
@ -55,7 +52,7 @@ class ConfigurationGetter(object):
"playerPath", "playerPath",
"playerClass", "playerClass",
] ]
self._boolean = [ self._boolean = [
"debug", "debug",
"forceGuiPrompt", "forceGuiPrompt",
@ -70,11 +67,10 @@ class ConfigurationGetter(object):
self._iniStructure = { self._iniStructure = {
"server_data": ["host", "port", "password"], "server_data": ["host", "port", "password"],
"client_settings": ["name", "room", "playerPath", "slowOnDesync", "rewindOnDesync", "forceGuiPrompt", "filenamePrivacyMode", "filesizePrivacyMode", "pauseOnLeave"], "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"), self._argparser = argparse.ArgumentParser(description=getMessage("en", "argument-description"),
epilog=getMessage("en", "argument-epilog")) 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('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('--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._argparser.add_argument('_args', metavar='options', type=str, nargs='*', help=getMessage("en", "args-argument"))
self._playerFactory = PlayerFactory() self._playerFactory = PlayerFactory()
def _validateArguments(self): def _validateArguments(self):
for key in self._boolean: for key in self._boolean:
if(self._config[key] == "True"): if(self._config[key] == "True"):
@ -134,7 +130,7 @@ class ConfigurationGetter(object):
if(key == "clear_gui_data"): if(key == "clear_gui_data"):
key = "clearGUIData" key = "clearGUIData"
self._config[key] = val self._config[key] = val
def _splitPortAndHost(self, host): def _splitPortAndHost(self, host):
port = constants.DEFAULT_PORT if not self._config["port"] else self._config["port"] port = constants.DEFAULT_PORT if not self._config["port"] else self._config["port"]
if(host): if(host):
@ -146,7 +142,7 @@ class ConfigurationGetter(object):
path = utils.findWorkingDir() path = utils.findWorkingDir()
for name in constants.CONFIG_NAMES: for name in constants.CONFIG_NAMES:
if(os.path.isfile(os.path.join(path, name))): if(os.path.isfile(os.path.join(path, name))):
return os.path.join(path, name) return os.path.join(path, name)
def _getConfigurationFilePath(self): def _getConfigurationFilePath(self):
configFile = self._checkForPortableFile() configFile = self._checkForPortableFile()
@ -163,10 +159,10 @@ class ConfigurationGetter(object):
configFile = os.path.join(os.getenv('HOME', '.'), constants.DEFAULT_CONFIG_NAME_LINUX) configFile = os.path.join(os.getenv('HOME', '.'), constants.DEFAULT_CONFIG_NAME_LINUX)
else: else:
configFile = os.path.join(os.getenv('APPDATA', '.'), constants.DEFAULT_CONFIG_NAME_WINDOWS) configFile = os.path.join(os.getenv('APPDATA', '.'), constants.DEFAULT_CONFIG_NAME_WINDOWS)
return configFile return configFile
def _parseConfigFile(self, iniPath, createConfig = True): def _parseConfigFile(self, iniPath, createConfig=True):
parser = SafeConfigParserUnicode() parser = SafeConfigParserUnicode()
if(not os.path.isfile(iniPath)): if(not os.path.isfile(iniPath)):
if(createConfig): if(createConfig):
@ -179,7 +175,7 @@ class ConfigurationGetter(object):
for option in options: for option in options:
if(parser.has_option(section, option)): if(parser.has_option(section, option)):
self._config[option] = parser.get(section, option) self._config[option] = parser.get(section, option)
def _checkConfig(self): def _checkConfig(self):
try: try:
self._validateArguments() self._validateArguments()
@ -191,12 +187,12 @@ class ConfigurationGetter(object):
except: except:
sys.exit() sys.exit()
def _promptForMissingArguments(self, error = None): def _promptForMissingArguments(self, error=None):
if(self._config['noGui']): if(self._config['noGui']):
print getMessage("en", "missing-arguments-error") print getMessage("en", "missing-arguments-error")
sys.exit() sys.exit()
elif(GuiConfiguration): elif(GuiConfiguration):
gc = GuiConfiguration(self._config, error = error) gc = GuiConfiguration(self._config, error=error)
gc.setAvailablePaths(self._playerFactory.getAvailablePlayerPaths()) gc.setAvailablePaths(self._playerFactory.getAvailablePlayerPaths())
gc.run() gc.run()
return gc.getProcessedConfiguration() return gc.getProcessedConfiguration()
@ -224,7 +220,7 @@ class ConfigurationGetter(object):
parser.set(section, option, unicode(self._config[option])) parser.set(section, option, unicode(self._config[option]))
if(changed): if(changed):
parser.write(codecs.open(iniPath, "wb", "utf_8_sig")) parser.write(codecs.open(iniPath, "wb", "utf_8_sig"))
def _forceGuiPrompt(self): def _forceGuiPrompt(self):
try: try:
@ -253,8 +249,8 @@ class ConfigurationGetter(object):
locations = self.__getRelativeConfigLocations() locations = self.__getRelativeConfigLocations()
for location in locations: for location in locations:
for name in constants.CONFIG_NAMES: for name in constants.CONFIG_NAMES:
path = location + os.path.sep + name path = location + os.path.sep + name
self._parseConfigFile(path, createConfig = False) self._parseConfigFile(path, createConfig=False)
self._checkConfig() self._checkConfig()
def getConfiguration(self): def getConfiguration(self):
@ -262,8 +258,8 @@ class ConfigurationGetter(object):
self._parseConfigFile(iniPath) self._parseConfigFile(iniPath)
args = self._argparser.parse_args() args = self._argparser.parse_args()
self._overrideConfigWithArgs(args) self._overrideConfigWithArgs(args)
#Arguments not validated yet - booleans are still text values # Arguments not validated yet - booleans are still text values
if(self._config['forceGuiPrompt'] == "True" or not self._config['file']): if(self._config['forceGuiPrompt'] == "True" or not self._config['file']):
self._forceGuiPrompt() self._forceGuiPrompt()
self._checkConfig() self._checkConfig()
self._saveConfig(iniPath) self._saveConfig(iniPath)
@ -275,7 +271,7 @@ class ConfigurationGetter(object):
self.app = QtGui.QApplication(sys.argv) self.app = QtGui.QApplication(sys.argv)
qt4reactor.install() qt4reactor.install()
return self._config return self._config
class SafeConfigParserUnicode(SafeConfigParser): class SafeConfigParserUnicode(SafeConfigParser):
def write(self, fp): def write(self, fp):
"""Write an .ini-format representation of the configuration state.""" """Write an .ini-format representation of the configuration state."""

View File

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