Move playback and advanced butons into respective menus

This commit is contained in:
Et0h 2015-01-10 18:22:04 +00:00
parent b76ba71dbc
commit 098192c800
3 changed files with 99 additions and 234 deletions

View File

@ -47,7 +47,6 @@ PROTOCOL_TIMEOUT = 12.5
RECONNECT_RETRIES = 10
SERVER_STATE_INTERVAL = 1
WARNING_OSD_MESSAGES_LOOP_INTERVAL = 1
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
LAST_PAUSED_DIFF_THRESHOLD = 2
@ -121,7 +120,6 @@ STYLE_SUBLABEL = "QCheckBox, QLabel {{ margin-left: 6px; padding-left: 16px; ba
STYLE_ERRORLABEL = "QLabel { color : black; border-style: outset; border-width: 2px; border-radius: 7px; border-color: red; padding: 2px; background: #FFAAAA; }"
STYLE_SUCCESSLABEL = "QLabel { color : black; border-style: outset; border-width: 2px; border-radius: 7px; border-color: green; padding: 2px; background: #AAFFAA; }"
STYLE_READY_PUSHBUTTON = "QPushButton { text-align: left; padding: 10px 5px 10px 5px;}"
STYLE_AUTO_PLAY_PUSHBUTTON = "QPushButton { text-align: left; padding: 5px 5px 5px 5px; }"
STYLE_NOTIFICATIONBOX = "Username { color: #367AA9; font-weight:bold; }"
STYLE_CONTACT_INFO = u"<span style=\"color: grey\"><strong><small>{}</span><br /><br />" # Contact info message
STYLE_USERNAME = "color: #367AA9; font-weight:bold;"

View File

@ -123,6 +123,9 @@ en = {
"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
"invalid-seek-value" : u"Invalid seek value",
"invalid-offset-value" : u"Invalid offset value",
# 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',
@ -207,14 +210,15 @@ en = {
"contact-label" : "Feel free to e-mail <a href=\"mailto:dev@syncplay.pl\"><nobr>dev@syncplay.pl</nobr></a>, chat via the <a href=\"https://webchat.freenode.net/?channels=#syncplay\"><nobr>#Syncplay IRC channel</nobr></a> on irc.freenode.net, <a href=\"https://github.com/Uriziel/syncplay/issues/new\"><nobr>raise an issue</nobr></a> via GitHub or visit <a href=\"http://syncplay.pl/\"><nobr>http://syncplay.pl/</nobr></a>",
"joinroom-guibuttonlabel" : "Join room",
"seektime-guibuttonlabel" : "Seek to time",
"undoseek-guibuttonlabel" : "Undo seek",
"togglepause-guibuttonlabel" : "Toggle pause",
"play-guibuttonlabel" : "Play",
"pause-guibuttonlabel" : "Pause",
"joinroom-menu-label" : "Join room",
"seektime-menu-label" : "Seek to time",
"undoseek-menu-label" : "Undo seek",
"togglepause-menu-label" : "Toggle pause",
"play-menu-label" : "Play",
"pause-menu-label" : "Pause",
"autoplay-menu-label" : u"Auto-play when everyone is ready",
"ready-guipushbuttonlabel" : u"I'm ready to watch!",
"autoplay-guipushbuttonlabel" : u"Auto-play when everyone is ready",
"roomuser-heading-label" : "Room / User",
"size-heading-label" : "Size",
@ -222,9 +226,6 @@ en = {
"filename-heading-label" : "Filename",
"notifications-heading-label" : "Notifications",
"userlist-heading-label" : "List of who is playing what",
"othercommands-heading-label" : "Other commands",
"room-heading-label" : "Room",
"seek-heading-label" : "Seek",
"browseformedia-label" : "Browse for media files",
@ -237,6 +238,8 @@ en = {
"createcontrolledroom-menu-label" : "&Create controlled room",
"identifyascontroller-menu-label" : "&Identify as room controller",
"playback-menu-label" : u"&Playback",
"help-menu-label" : "&Help",
"userguide-menu-label" : "Open user &guide",
"update-menu-label" : "Check for &update",
@ -295,12 +298,8 @@ en = {
"help-tooltip" : "Opens the Syncplay.pl user guide.",
"reset-tooltip" : "Reset all settings to the default configuration.",
"togglepause-tooltip" : "Pause/unpause media.",
"play-tooltip" : "Unpause media.",
"pause-tooltip" : "Pause media.",
"undoseek-tooltip" : "Seek to where you were before the most recent seek.",
"joinroom-tooltip" : "Leave current room and joins specified room.",
"seektime-tooltip" : "Jump to specified time (in seconds / min:sec). Use +/- for relative seek.",
"seektime-msgbox-label" : "Jump to specified time (in seconds / min:sec). Use +/- for relative seek.",
# In-userlist notes (GUI)
"differentsize-note" : "Different size!",
@ -461,6 +460,9 @@ ru = {
"vlc-failed-versioncheck" : u"Данная версия VLC не поддерживается Syncplay. Пожалуйста, используйте VLC версии 2 или выше.",
"vlc-failed-other" : u"Во время загрузки скрипта интерфейса syncplay.lua в VLC произошла следующая ошибка: {}", # Syncplay Error
"invalid-seek-value" : u"Invalid seek value", # TODO: Translate into Russian
"invalid-offset-value" : u"Invalid offset value", # TODO: Translate into Russian
# Client arguments
"argument-description" : u'Решение для синхронного воспроизведения в VLC, MPlayer или MPC-HC через Интернет.',
"argument-epilog" : u'Если параметр не будет передан, то будет использоваться значение, указанное в _config.',
@ -545,14 +547,14 @@ ru = {
"contact-label" : u"Есть идея, нашли ошибку или хотите оставить отзыв? Пишите на <a href=\"mailto:dev@syncplay.pl\">dev@syncplay.pl</a>, в <a href=\"https://webchat.freenode.net/?channels=#syncplay\">IRC канал #Syncplay</a> на irc.freenode.net или <a href=\"https://github.com/Uriziel/syncplay/issues/new\">задавайте вопросы через GitHub</a>. Кроме того, заходите на <a href=\"http://syncplay.pl/\">http://syncplay.pl/</a> за инорфмацией, помощью и обновлениями!",
"joinroom-guibuttonlabel" : u"Зайти в комнату",
"seektime-guibuttonlabel" : u"Перемотать",
"undoseek-guibuttonlabel" : u"Отменить перемотку",
"togglepause-guibuttonlabel" : u"Вкл./выкл. паузу",
"play-guibuttonlabel" : u"Play",
"pause-guibuttonlabel" : u"Пауза",
"joinroom-menu-label" : u"Зайти в комнату",
"seektime-menu-label" : u"Перемотать",
"undoseek-menu-label" : u"Отменить перемотку",
"play-menu-label" : u"Play",
"pause-menu-label" : u"Пауза",
"autoplay-menu-label" : u"Auto-play when everyone is ready", # TODO: Translate into Russian
"ready-guipushbuttonlabel" : u"I'm ready to watch!", # TODO: Translate into Russian
"autoplay-guipushbuttonlabel" : u"Auto-play when everyone is ready", # TODO: Translate into Russian
"roomuser-heading-label" : u"Комната / Пользователь",
"size-heading-label" : u"Size", # TODO: Translate into Russian
@ -560,9 +562,6 @@ ru = {
"filename-heading-label" : u"Filename", # TODO: Translate into Russian
"notifications-heading-label" : u"Уведомления",
"userlist-heading-label" : u"Кто что смотрит",
"othercommands-heading-label" : u"Другие команды",
"room-heading-label" : u"Комната",
"seek-heading-label" : u"Перемотка",
"browseformedia-label" : u"Выбрать видеофайл",
@ -633,12 +632,8 @@ ru = {
"help-tooltip" : u"Открыть Руководство Пользователя на Syncplay.pl.",
"reset-tooltip" : u"Сбрасывает все настройки Syncplay в начальное состояние.",
"togglepause-tooltip" : u"Приостановить/продолжить просмотр.",
"play-tooltip" : u"Продолжить просмотр.",
"pause-tooltip" : u"Приостановить просмотр.",
"undoseek-tooltip" : u"Перейти к тому месту, которое Вы просматривали до перемотки.",
"joinroom-tooltip" : u"Покинуть комнату и зайти в другую, указанную комнату.",
"seektime-tooltip" : u"Перемотать к определенному моменту времени (указывать в секундах или мин:сек). Используйте +/-, чтобы перемотать вперед/назад относительно настоящего момента.",
"seektime-msgbox-label" : u"Перемотать к определенному моменту времени (указывать в секундах или мин:сек). Используйте +/-, чтобы перемотать вперед/назад относительно настоящего момента.",
# In-userlist notes (GUI)
"differentsize-note" : u"Размер файла не совпадает!",
@ -799,6 +794,9 @@ de = {
"vlc-failed-versioncheck": u"Diese VLC-Version wird von Syncplay nicht unterstützt. Bitte nutze VLC 2.0",
"vlc-failed-other" : u"Beim Laden des syncplay.lua Interface-Skripts durch VLC trat folgender Fehler auf: {}", # Syncplay Error
"invalid-seek-value" : u"Invalid seek value", # TODO: Translate into German
"invalid-offset-value" : u"Invalid offset value", # TODO: Translate into German
# Client arguments
"argument-description" : u'Anwendung, um mehrere MPlayer, MPC-HC und VLC-Instanzen über das Internet zu synchronisieren.',
"argument-epilog" : u'Wenn keine Optionen angegeben sind, werden die _config-Werte verwendet',
@ -881,14 +879,15 @@ de = {
"contact-label" : u"Du hast eine Idee, einen Bug gefunden oder möchtest Feedback geben? Sende eine E-Mail an <a href=\"mailto:dev@syncplay.pl\">dev@syncplay.pl</a>, chatte auf dem <a href=\"https://webchat.freenode.net/?channels=#syncplay\">#Syncplay IRC-Kanal</a> auf irc.freenode.net oder <a href=\"https://github.com/Uriziel/syncplay/issues/new\">öffne eine Fehlermeldung auf GitHub</a>. Außerdem findest du auf <a href=\"http://syncplay.pl/\">http://syncplay.pl/</a> weitere Informationen, Hilfestellungen und Updates.",
"joinroom-guibuttonlabel" : u"Raum beitreten",
"seektime-guibuttonlabel" : u"Spule zu Zeit",
"undoseek-guibuttonlabel" : u"Rückgängig",
"togglepause-guibuttonlabel" : u"Pause umschalten",
"play-guibuttonlabel" : u"Wiedergabe",
"pause-guibuttonlabel" : u"Pause",
"joinroom-menu-label" : u"Raum beitreten",
"seektime-menu-label" : u"Spule zu Zeit",
"undoseek-menu-label" : u"Rückgängig",
"togglepause-menu-label" : u"Pause umschalten",
"play-menu-label" : u"Wiedergabe",
"pause-menu-label" : u"Pause",
"autoplay-menu-label" : u"Auto-play when everyone is ready", # TODO: Translate into German
"ready-guipushbuttonlabel" : u"I'm ready to watch!", # TODO: Translate into German
"autoplay-guipushbuttonlabel" : u"Auto-play when everyone is ready", # TODO: Translate into German
"roomuser-heading-label" : u"Raum / Benutzer",
"size-heading-label" : u"Größe",
@ -896,9 +895,6 @@ de = {
"filename-heading-label" : u"Dateiname",
"notifications-heading-label" : u"Benachrichtigungen",
"userlist-heading-label" : u"Liste der gespielten Dateien",
"othercommands-heading-label" : u"Andere Befehle",
"room-heading-label" : u"Raum",
"seek-heading-label" : u"Spulen",
"browseformedia-label" : u"Nach Mediendateien durchsuchen",
@ -971,12 +967,8 @@ de = {
"help-tooltip" : u"Öffnet Hilfe auf syncplay.pl [Englisch]",
"reset-tooltip" : u"Alle Einstellungen auf Standardwerte zurücksetzen.",
"togglepause-tooltip" : u"Datei starten/pausieren",
"play-tooltip" : u"Fortsetzen",
"pause-tooltip" : u"Pausieren",
"undoseek-tooltip" : u"Den letzten Spulvorgang rückgängig machen.",
"joinroom-tooltip" : u"Den aktuellen Raum verlassen und stattdessen den angegebenen betreten.",
"seektime-tooltip" : u"Springe zur angegebenen Zeit (in Sekunden oder min:sek). Verwende +/- zum relativen Springen.",
"seektime-msgbox-label" : u"Springe zur angegebenen Zeit (in Sekunden oder min:sek). Verwende +/- zum relativen Springen.",
# In-userlist notes (GUI)
"differentsize-note" : u"Verschiedene Größe!",

View File

@ -208,10 +208,9 @@ class MainWindow(QtGui.QMainWindow):
self.updateReadyIcon()
def updateAutoPlayState(self, newState):
oldState = self.autoPlayPushButton.isChecked()
oldState = self.autoplayAction.isChecked()
if newState != oldState and newState != None:
self.autoPlayPushButton.setChecked(newState)
self.updateAutoPlayIcon()
self.autoplayAction.setChecked(newState)
def roomClicked(self, item):
while item.parent().row() != -1:
@ -250,18 +249,21 @@ class MainWindow(QtGui.QMainWindow):
self._syncplayClient.sendRoom()
def seekPosition(self):
s = re.match(constants.UI_SEEK_REGEX, self.seekInput.text())
if s:
sign = self._extractSign(s.group('sign'))
t = utils.parseTime(s.group('time'))
if t is None:
return
if sign:
t = self._syncplayClient.getGlobalPosition() + sign * t
self._syncplayClient.setPosition(t)
else:
self.showErrorMessage("Invalid seek value")
seekTime, ok = QtGui.QInputDialog.getText(self, getMessage("seektime-menu-label"),
getMessage("seektime-msgbox-label"), QtGui.QLineEdit.Normal,
"0:00")
if ok and seekTime != '':
s = re.match(constants.UI_SEEK_REGEX, seekTime)
if s:
sign = self._extractSign(s.group('sign'))
t = utils.parseTime(s.group('time'))
if t is None:
return
if sign:
t = self._syncplayClient.getGlobalPosition() + sign * t
self._syncplayClient.setPosition(t)
else:
self.showErrorMessage(getMessage("invalid-seek-value"))
def undoSeek(self):
tmp_pos = self._syncplayClient.getPlayerPosition()
@ -284,69 +286,6 @@ class MainWindow(QtGui.QMainWindow):
self.exitSyncplay()
self.saveSettings()
def setupSizes(self):
self.hideRoomSeekLabels()
self.miscThreshold = self.seekGroup.sizeHint().width()+self.roomGroup.sizeHint().width()+self.miscGroup.sizeHint().width()+30
self.hideMiscLabels()
self.setMinimumWidth(self.seekGroup.sizeHint().width()+self.roomGroup.sizeHint().width()+self.miscGroup.sizeHint().width()+30)
self.seekGroup.setMinimumWidth(self.seekGroup.sizeHint().width())
self.roomGroup.setMinimumWidth(self.roomGroup.sizeHint().width())
self.miscGroup.setMinimumWidth(self.miscGroup.sizeHint().width())
self.showRoomSeekLabels()
self.showMiscLabels()
windowMaximumWidth = self.maximumWidth()
self.seekGroup.setMaximumWidth(self.seekGroup.sizeHint().width())
self.roomGroup.setMaximumWidth(self.roomGroup.sizeHint().width())
self.miscGroup.setMaximumWidth(self.miscGroup.sizeHint().width())
self.setMaximumWidth(windowMaximumWidth)
self.roomSeekThreshold = self.mainLayout.sizeHint().width()
def hideRoomSeekLabels(self):
self.roomButton.setText("")
self.seekButton.setText("")
def hideMiscLabels(self):
self.unseekButton.setText("")
if constants.MERGE_PLAYPAUSE_BUTTONS:
self.playpauseButton.setText("")
else:
self.playButton.setText("")
self.pauseButton.setText("")
def showRoomSeekLabels(self):
if not constants.SHOW_BUTTON_LABELS:
return
self.roomButton.setText(getMessage("joinroom-guibuttonlabel"))
self.seekButton.setText(getMessage("seektime-guibuttonlabel"))
def showMiscLabels(self):
self.unseekButton.setText(getMessage("undoseek-guibuttonlabel"))
if not constants.SHOW_BUTTON_LABELS:
return
if constants.MERGE_PLAYPAUSE_BUTTONS:
self.playpauseButton.setText(getMessage("togglepause-guibuttonlabel"))
else:
self.playButton.setText(getMessage("play-guibuttonlabel"))
self.pauseButton.setText(getMessage("pause-guibuttonlabel"))
def resizeEvent(self,resizeEvent):
self.updateListGeometry()
if self.roomGroup and self.miscThreshold:
currentWidth = self.mainFrame.size().width()
if currentWidth < self.miscThreshold:
if self.unseekButton.text() != "":
self.hideMiscLabels()
else:
if self.unseekButton.text() == "":
self.showMiscLabels()
if currentWidth < self.roomSeekThreshold:
if self.roomButton.text() != "":
self.hideRoomSeekLabels()
else:
if self.roomButton.text() == "":
self.showRoomSeekLabels()
def loadMediaBrowseSettings(self):
settings = QSettings("Syncplay", "MediaBrowseDialog")
settings.beginGroup("MediaBrowseDialog")
@ -431,7 +370,7 @@ class MainWindow(QtGui.QMainWindow):
t = self._syncplayClient.getUserOffset() + sign * t
self._syncplayClient.setUserOffset(t)
else:
self.showErrorMessage("Invalid offset value")
self.showErrorMessage(getMessage("invalid-offset-value"))
def openUserGuide(self):
if sys.platform.startswith('linux'):
@ -456,6 +395,7 @@ class MainWindow(QtGui.QMainWindow):
window.outputbox.moveCursor(QtGui.QTextCursor.End)
window.outputbox.insertHtml(constants.STYLE_CONTACT_INFO.format(getMessage("contact-label")))
window.outputbox.moveCursor(QtGui.QTextCursor.End)
window.outputbox.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
window.outputlabel = QtGui.QLabel(getMessage("notifications-heading-label"))
window.outputFrame = QtGui.QFrame()
@ -476,10 +416,28 @@ class MainWindow(QtGui.QMainWindow):
window.listFrame = QtGui.QFrame()
window.listFrame.setLineWidth(0)
window.listFrame.setMidLineWidth(0)
window.listFrame.setSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
window.listLayout.setContentsMargins(0, 0, 0, 0)
window.listLayout.addWidget(window.listlabel)
window.listLayout.addWidget(window.listTreeView)
window.roomInput = QtGui.QLineEdit()
window.roomInput.returnPressed.connect(self.joinRoom)
window.roomButton = QtGui.QPushButton(QtGui.QIcon(self.resourcespath + 'door_in.png'),
getMessage("joinroom-menu-label"))
window.roomButton.pressed.connect(self.joinRoom)
window.roomLayout = QtGui.QHBoxLayout()
window.roomFrame = QtGui.QFrame()
window.roomFrame.setLayout(self.roomLayout)
window.roomFrame.setContentsMargins(0,0,0,0)
window.roomFrame.setSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum)
window.roomLayout.setContentsMargins(0,0,0,0)
self.roomButton.setToolTip(getMessage("joinroom-tooltip"))
window.roomLayout.addWidget(window.roomInput)
window.roomLayout.addWidget(window.roomButton)
window.roomFrame.setMaximumHeight(window.roomFrame.sizeHint().height())
window.listLayout.addWidget(window.roomFrame, Qt.AlignRight)
window.readyPushButton = QtGui.QPushButton()
readyFont = QtGui.QFont()
readyFont.setWeight(QtGui.QFont.Bold)
@ -491,18 +449,6 @@ class MainWindow(QtGui.QMainWindow):
window.readyPushButton.setStyleSheet(constants.STYLE_READY_PUSHBUTTON)
window.listLayout.addWidget(window.readyPushButton, Qt.AlignRight)
window.autoPlayPushButton = QtGui.QPushButton()
autoPlayFont = QtGui.QFont()
autoPlayFont.setWeight(QtGui.QFont.Bold)
window.autoPlayPushButton.setText(getMessage("autoplay-guipushbuttonlabel"))
window.autoPlayPushButton.setCheckable(True)
window.autoPlayPushButton.setAutoExclusive(False)
window.autoPlayPushButton.toggled.connect(self.changeAutoPlayState)
window.autoPlayPushButton.setFont(autoPlayFont)
window.autoPlayPushButton.setStyleSheet(constants.STYLE_AUTO_PLAY_PUSHBUTTON)
window.listLayout.addWidget(window.autoPlayPushButton, Qt.AlignRight)
self.updateAutoPlayIcon()
window.listFrame.setLayout(window.listLayout)
window.topSplit.addWidget(window.outputFrame)
@ -512,94 +458,11 @@ class MainWindow(QtGui.QMainWindow):
window.mainLayout.addWidget(window.topSplit)
window.topSplit.setSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Expanding)
def addBottomLayout(self, window):
window.bottomLayout = QtGui.QHBoxLayout()
window.addSeekBox(MainWindow)
window.addMiscBox(MainWindow)
window.addRoomBox(MainWindow)
window.bottomLayout.addWidget(window.seekGroup)
window.bottomLayout.addWidget(window.miscGroup)
window.bottomLayout.addWidget(window.roomGroup)
window.mainLayout.addLayout(window.bottomLayout, Qt.AlignLeft)
def addRoomBox(self, window):
window.roomGroup = QtGui.QGroupBox(getMessage("room-heading-label"))
window.roomInput = QtGui.QLineEdit()
window.roomInput.returnPressed.connect(self.joinRoom)
window.roomButton = QtGui.QPushButton(QtGui.QIcon(self.resourcespath + 'door_in.png'),
getMessage("joinroom-guibuttonlabel"))
window.roomButton.pressed.connect(self.joinRoom)
window.roomLayout = QtGui.QHBoxLayout()
window.roomInput.setFixedWidth(150)
self.roomButton.setToolTip(getMessage("joinroom-tooltip"))
window.roomLayout.addWidget(window.roomInput)
window.roomLayout.addWidget(window.roomButton)
window.roomGroup.setLayout(window.roomLayout)
window.roomGroup.setFixedHeight(window.roomGroup.sizeHint().height())
def addSeekBox(self, window):
window.seekGroup = QtGui.QGroupBox(getMessage("seek-heading-label"))
window.seekInput = QtGui.QLineEdit()
window.seekInput.returnPressed.connect(self.seekPosition)
window.seekButton = QtGui.QPushButton(QtGui.QIcon(self.resourcespath + 'clock_go.png'),
getMessage("seektime-guibuttonlabel"))
window.seekButton.pressed.connect(self.seekPosition)
self.seekButton.setToolTip(getMessage("seektime-tooltip"))
window.seekLayout = QtGui.QHBoxLayout()
window.seekInput.setText("0:00")
window.seekInput.setFixedWidth(60)
window.seekLayout.addWidget(window.seekInput)
window.seekLayout.addWidget(window.seekButton)
window.seekGroup.setLayout(window.seekLayout)
window.seekGroup.setFixedHeight(window.seekGroup.sizeHint().height())
def addMiscBox(self, window):
window.miscGroup = QtGui.QGroupBox(getMessage("othercommands-heading-label"))
window.unseekButton = QtGui.QPushButton(QtGui.QIcon(self.resourcespath + 'arrow_undo.png'),
getMessage("undoseek-guibuttonlabel"))
window.unseekButton.pressed.connect(self.undoSeek)
self.unseekButton.setToolTip(getMessage("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("togglepause-guibuttonlabel"))
window.playpauseButton.pressed.connect(self.togglePause)
window.miscLayout.addWidget(window.playpauseButton)
self.playpauseButton.setToolTip(getMessage("togglepause-tooltip"))
else:
window.playButton = QtGui.QPushButton(QtGui.QIcon(self.resourcespath + 'control_play_blue.png'),
getMessage("play-guibuttonlabel"))
window.playButton.pressed.connect(self.play)
window.miscLayout.addWidget(window.playButton)
window.pauseButton = QtGui.QPushButton(QtGui.QIcon(self.resourcespath + 'control_pause_blue.png'),
getMessage("pause-guibuttonlabel"))
window.pauseButton.pressed.connect(self.pause)
window.miscLayout.addWidget(window.pauseButton)
self.playButton.setToolTip(getMessage("play-tooltip"))
self.pauseButton.setToolTip(getMessage("pause-tooltip"))
window.miscGroup.setLayout(window.miscLayout)
window.miscGroup.setFixedHeight(window.miscGroup.sizeHint().height())
def addMenubar(self, window):
window.menuBar = QtGui.QMenuBar()
# File menu
window.fileMenu = QtGui.QMenu(getMessage("file-menu-label"), self)
window.openAction = window.fileMenu.addAction(QtGui.QIcon(self.resourcespath + 'folder_explore.png'),
getMessage("openmedia-menu-label"))
@ -613,6 +476,22 @@ class MainWindow(QtGui.QMainWindow):
window.exitAction.triggered.connect(self.exitSyncplay)
window.menuBar.addMenu(window.fileMenu)
# Playback menu
window.playbackMenu = QtGui.QMenu(getMessage("playback-menu-label"), self)
window.playAction = window.playbackMenu.addAction(QtGui.QIcon(self.resourcespath + 'control_play_blue.png'), getMessage("play-menu-label"))
window.playAction.triggered.connect(self.play)
window.pauseAction = window.playbackMenu.addAction(QtGui.QIcon(self.resourcespath + 'control_pause_blue.png'), getMessage("pause-menu-label"))
window.pauseAction.triggered.connect(self.pause)
window.seekAction = window.playbackMenu.addAction(QtGui.QIcon(self.resourcespath + 'clock_go.png'), getMessage("seektime-menu-label"))
window.seekAction.triggered.connect(self.seekPosition)
window.unseekAction = window.playbackMenu.addAction(QtGui.QIcon(self.resourcespath + 'arrow_undo.png'), getMessage("undoseek-menu-label"))
window.unseekAction.triggered.connect(self.undoSeek)
window.menuBar.addMenu(window.playbackMenu)
# Advanced menu
window.advancedMenu = QtGui.QMenu(getMessage("advanced-menu-label"), self)
window.setoffsetAction = window.advancedMenu.addAction(QtGui.QIcon(self.resourcespath + 'timeline_marker.png'),
getMessage("setoffset-menu-label"))
@ -626,6 +505,12 @@ class MainWindow(QtGui.QMainWindow):
window.identifyascontroller.triggered.connect(self.identifyAsController)
window.menuBar.addMenu(window.advancedMenu)
window.autoplayAction = window.advancedMenu.addAction(getMessage("autoplay-menu-label"))
window.autoplayAction.setCheckable(True)
window.autoplayAction.triggered.connect(self.changeAutoPlayState)
# Help menu
window.helpMenu = QtGui.QMenu(getMessage("help-menu-label"), self)
window.userguideAction = window.helpMenu.addAction(QtGui.QIcon(self.resourcespath + 'help.png'),
getMessage("userguide-menu-label"))
@ -664,8 +549,7 @@ class MainWindow(QtGui.QMainWindow):
self._syncplayClient.changeReadyState(self.readyPushButton.isChecked())
def changeAutoPlayState(self):
self.updateAutoPlayIcon()
self._syncplayClient.changeAutoPlayState(self.autoPlayPushButton.isChecked())
self._syncplayClient.changeAutoPlayState(self.autoplayAction.isChecked())
def updateReadyIcon(self):
ready = self.readyPushButton.isChecked()
@ -674,13 +558,6 @@ class MainWindow(QtGui.QMainWindow):
else:
self.readyPushButton.setIcon(QtGui.QIcon(self.resourcespath + 'empty_checkbox.png'))
def updateAutoPlayIcon(self):
ready = self.autoPlayPushButton.isChecked()
if ready:
self.autoPlayPushButton.setIcon(QtGui.QIcon(self.resourcespath + 'tick_checkbox.png'))
else:
self.autoPlayPushButton.setIcon(QtGui.QIcon(self.resourcespath + 'empty_checkbox.png'))
def automaticUpdateCheck(self):
currentDateTime = datetime.utcnow()
if not self.config['checkForUpdatesAutomatically']:
@ -776,10 +653,8 @@ class MainWindow(QtGui.QMainWindow):
self.setWindowTitle("Syncplay v" + version)
self.mainLayout = QtGui.QVBoxLayout()
self.addTopLayout(self)
self.addBottomLayout(self)
self.addMenubar(self)
self.addMainFrame(self)
self.setupSizes()
self.loadSettings()
self.setWindowIcon(QtGui.QIcon(self.resourcespath + "syncplay.png"))
self.setWindowFlags(self.windowFlags() & Qt.WindowCloseButtonHint & Qt.AA_DontUseNativeMenuBar & Qt.WindowMinimizeButtonHint & ~Qt.WindowContextHelpButtonHint)