Re-work show label/tooltip checks

This commit is contained in:
Et0h 2014-05-26 13:58:02 +01:00
parent c2610a47af
commit e257c24c03
4 changed files with 52 additions and 62 deletions

View File

@ -18,6 +18,7 @@ SHOW_DIFFERENT_ROOM_OSD = False # Show OSD notifications for events relating to
LIST_RELATIVE_CONFIGS = True # Print list of relative configs loaded
SHOW_CONTACT_INFO = True # Displays dev contact details below list in GUI
SHOW_BUTTON_LABELS = True # If disabled, only shows icons for main GUI buttons
SHOW_TOOLTIPS = True
#Changing these might be ok
REWIND_THRESHOLD = 4
@ -31,7 +32,6 @@ RECONNECT_RETRIES = 10
SERVER_STATE_INTERVAL = 1
WARNING_OSD_MESSAGES_LOOP_INTERVAL = 1
SHOW_REWIND_ON_DESYNC_CHECKBOX = False
SHOW_TOOLTIPS = True
MERGE_PLAYPAUSE_BUTTONS = False
SYNC_ON_PAUSE = True # Client seek to global position - subtitles may disappear on some media players
#Usually there's no need to adjust these

View File

@ -135,12 +135,12 @@ en = {
"contact-label" : "Have an idea, bug report or feedback? E-mail <a href=\"mailto:dev@syncplay.pl\">dev@syncplay.pl</a>, chat via the <a href=\"https://webchat.freenode.net/?channels=#syncplay\">#Syncplay IRC channel</a> on irc.freenode.net or <a href=\"https://github.com/Uriziel/syncplay/issues/new\">raise an issue via GitHub</a>. Also check out <a href=\"http://syncplay.pl/\">http://syncplay.pl/</a> for info, help and updates.",
"joinroom-label" : "Join room",
"seektime-label" : "Seek to time",
"undoseek-label" : "Undo seek",
"togglepause-label" : "Toggle pause",
"play-label" : "Play",
"pause-label" : "Play",
"joinroom-guibuttonlabel" : "Join room",
"seektime-guibuttonlabel" : "Seek to time",
"undoseek-guibuttonlabel" : "Undo seek",
"togglepause-guibuttonlabel" : "Toggle pause",
"play-guibuttonlabel" : "Play",
"pause-guibuttonlabel" : "Play",
"roomuser-heading-label" : "Room / User",
"fileplayed-heading-label" : "File being played",
@ -277,11 +277,12 @@ messages = {
"pl": pl
}
buttonlabels = ["joinroom-label", "seektime-label", "undoseek-label", "togglepause-label", "play-label", "pause-label"]
def getMessage(locale, type_):
if(constants.SHOW_BUTTON_LABELS == False):
if(type_ in buttonlabels):
if("-guibuttonlabel" in type_):
return ""
if(constants.SHOW_TOOLTIPS == False):
if("-tooltip" in type_):
return ""
if(messages.has_key(locale)):
if(messages[locale].has_key(type_)):

View File

@ -306,7 +306,6 @@ class ConfigDialog(QtGui.QDialog):
self.serverpassTextbox = QLineEdit(config['password'], self)
self.defaultroomLabel = QLabel(getMessage("en", "room-label"), self)
if (constants.SHOW_TOOLTIPS == True):
self.hostLabel.setToolTip(getMessage("en", "host-tooltip"))
self.hostTextbox.setToolTip(getMessage("en", "host-tooltip"))
self.usernameLabel.setToolTip(getMessage("en", "username-tooltip"))
@ -347,7 +346,6 @@ class ConfigDialog(QtGui.QDialog):
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"))
@ -355,7 +353,6 @@ class ConfigDialog(QtGui.QDialog):
if constants.SHOW_REWIND_ON_DESYNC_CHECKBOX == True:
self.rewindCheckbox = QCheckBox(getMessage("en", "rewind-label"))
if (constants.SHOW_TOOLTIPS == True):
self.rewindCheckbox.setToolTip(getMessage("en", "rewind-tooltip"))
self.mediaplayerSettingsLayout = QtGui.QGridLayout()
self.mediaplayerSettingsLayout.addWidget(self.executablepathLabel, 0, 0)
@ -421,7 +418,6 @@ class ConfigDialog(QtGui.QDialog):
if config['pauseOnLeave'] == True:
self.pauseonleaveCheckbox.setChecked(True)
if (constants.SHOW_TOOLTIPS == True):
self.filenameprivacyLabel.setToolTip(getMessage("en", "filename-privacy-tooltip"))
self.filenameprivacySendRawOption.setToolTip(getMessage("en", "privacy-sendraw-tooltip"))
self.filenameprivacySendHashedOption.setToolTip(getMessage("en", "privacy-sendhashed-tooltip"))
@ -480,7 +476,6 @@ class ConfigDialog(QtGui.QDialog):
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)
@ -501,7 +496,6 @@ class ConfigDialog(QtGui.QDialog):
self.topLayout = QtGui.QHBoxLayout()
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)

View File

@ -290,12 +290,11 @@ class MainWindow(QtGui.QMainWindow):
window.roomInput = QtGui.QLineEdit()
window.roomInput.returnPressed.connect(self.joinRoom)
window.roomButton = QtGui.QPushButton(QtGui.QIcon(self.resourcespath + 'door_in.png'), getMessage("en", "joinroom-label"))
window.roomButton = QtGui.QPushButton(QtGui.QIcon(self.resourcespath + 'door_in.png'), getMessage("en", "joinroom-guibuttonlabel"))
window.roomButton.pressed.connect(self.joinRoom)
window.roomLayout = QtGui.QHBoxLayout()
window.roomInput.setMaximumWidth(150)
if (constants.SHOW_TOOLTIPS == True):
self.roomButton.setToolTip(getMessage("en", "joinroom-tooltip"))
window.roomLayout.addWidget(window.roomInput)
@ -309,10 +308,9 @@ class MainWindow(QtGui.QMainWindow):
window.seekInput = QtGui.QLineEdit()
window.seekInput.returnPressed.connect(self.seekPosition)
window.seekButton = QtGui.QPushButton(QtGui.QIcon(self.resourcespath + 'clock_go.png'),getMessage("en", "seektime-label"))
window.seekButton = QtGui.QPushButton(QtGui.QIcon(self.resourcespath + 'clock_go.png'),getMessage("en", "seektime-guibuttonlabel"))
window.seekButton.pressed.connect(self.seekPosition)
if (constants.SHOW_TOOLTIPS == True):
self.seekButton.setToolTip(getMessage("en", "seektime-tooltip"))
window.seekLayout = QtGui.QHBoxLayout()
@ -328,29 +326,26 @@ class MainWindow(QtGui.QMainWindow):
def addMiscBox(self, window):
window.miscGroup = QtGui.QGroupBox(getMessage("en", "othercommands-heading-label"))
window.unseekButton = QtGui.QPushButton(QtGui.QIcon(self.resourcespath + 'arrow_undo.png'),getMessage("en", "undoseek-label"))
window.unseekButton = QtGui.QPushButton(QtGui.QIcon(self.resourcespath + 'arrow_undo.png'),getMessage("en", "undoseek-guibuttonlabel"))
window.unseekButton.pressed.connect(self.undoSeek)
if (constants.SHOW_TOOLTIPS == True):
self.unseekButton.setToolTip(getMessage("en", "undoseek-tooltip"))
window.miscLayout = QtGui.QHBoxLayout()
window.miscLayout.addWidget(window.unseekButton)
if constants.MERGE_PLAYPAUSE_BUTTONS == True:
window.playpauseButton = QtGui.QPushButton(QtGui.QIcon(self.resourcespath + 'control_pause_blue.png'),getMessage("en", "togglepause-label"))
window.playpauseButton = QtGui.QPushButton(QtGui.QIcon(self.resourcespath + 'control_pause_blue.png'),getMessage("en", "togglepause-guibuttonlabel"))
window.playpauseButton.pressed.connect(self.togglePause)
window.miscLayout.addWidget(window.playpauseButton)
if (constants.SHOW_TOOLTIPS == True):
self.playpauseButton.setToolTip(getMessage("en", "togglepause-tooltip"))
else:
window.playButton = QtGui.QPushButton(QtGui.QIcon(self.resourcespath + 'control_play_blue.png'),getMessage("en", "play-label"))
window.playButton = QtGui.QPushButton(QtGui.QIcon(self.resourcespath + 'control_play_blue.png'),getMessage("en", "play-guibuttonlabel"))
window.playButton.pressed.connect(self.play)
window.playButton.setMaximumWidth(60)
window.miscLayout.addWidget(window.playButton)
window.pauseButton = QtGui.QPushButton(QtGui.QIcon(self.resourcespath + 'control_pause_blue.png'),getMessage("en", "pause-label"))
window.pauseButton = QtGui.QPushButton(QtGui.QIcon(self.resourcespath + 'control_pause_blue.png'),getMessage("en", "pause-guibuttonlabel"))
window.pauseButton.pressed.connect(self.pause)
window.pauseButton.setMaximumWidth(60)
window.miscLayout.addWidget(window.pauseButton)
if (constants.SHOW_TOOLTIPS == True):
self.playButton.setToolTip(getMessage("en", "play-tooltip"))
self.pauseButton.setToolTip(getMessage("en", "pause-tooltip"))