Seek button should use LineEdit input (not prompt)
This commit is contained in:
parent
754e000360
commit
1dbda3efad
@ -243,22 +243,28 @@ class MainWindow(QtGui.QMainWindow):
|
|||||||
self._syncplayClient.setRoom(room)
|
self._syncplayClient.setRoom(room)
|
||||||
self._syncplayClient.sendRoom()
|
self._syncplayClient.sendRoom()
|
||||||
|
|
||||||
def seekPosition(self):
|
def seekPositionDialog(self):
|
||||||
seekTime, ok = QtGui.QInputDialog.getText(self, getMessage("seektime-menu-label"),
|
seekTime, ok = QtGui.QInputDialog.getText(self, getMessage("seektime-menu-label"),
|
||||||
getMessage("seektime-msgbox-label"), QtGui.QLineEdit.Normal,
|
getMessage("seektime-msgbox-label"), QtGui.QLineEdit.Normal,
|
||||||
"0:00")
|
"0:00")
|
||||||
if ok and seekTime != '':
|
if ok and seekTime != '':
|
||||||
s = re.match(constants.UI_SEEK_REGEX, seekTime)
|
self.seekPosition(seekTime)
|
||||||
if s:
|
|
||||||
sign = self._extractSign(s.group('sign'))
|
def seekFromButton(self):
|
||||||
t = utils.parseTime(s.group('time'))
|
self.seekPosition(self.seekInput.text())
|
||||||
if t is None:
|
|
||||||
return
|
def seekPosition(self, seekTime):
|
||||||
if sign:
|
s = re.match(constants.UI_SEEK_REGEX, seekTime)
|
||||||
t = self._syncplayClient.getGlobalPosition() + sign * t
|
if s:
|
||||||
self._syncplayClient.setPosition(t)
|
sign = self._extractSign(s.group('sign'))
|
||||||
else:
|
t = utils.parseTime(s.group('time'))
|
||||||
self.showErrorMessage(getMessage("invalid-seek-value"))
|
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):
|
def undoSeek(self):
|
||||||
tmp_pos = self._syncplayClient.getPlayerPosition()
|
tmp_pos = self._syncplayClient.getPlayerPosition()
|
||||||
@ -484,10 +490,10 @@ class MainWindow(QtGui.QMainWindow):
|
|||||||
window.playbackLayout.setContentsMargins(0,0,0,0)
|
window.playbackLayout.setContentsMargins(0,0,0,0)
|
||||||
window.playbackFrame.setLayout(window.playbackLayout)
|
window.playbackFrame.setLayout(window.playbackLayout)
|
||||||
window.seekInput = QtGui.QLineEdit()
|
window.seekInput = QtGui.QLineEdit()
|
||||||
window.seekInput.returnPressed.connect(self.seekPosition)
|
window.seekInput.returnPressed.connect(self.seekFromButton)
|
||||||
window.seekButton = QtGui.QPushButton(QtGui.QIcon(self.resourcespath + 'clock_go.png'), "")
|
window.seekButton = QtGui.QPushButton(QtGui.QIcon(self.resourcespath + 'clock_go.png'), "")
|
||||||
window.seekButton.setToolTip(getMessage("seektime-menu-label"))
|
window.seekButton.setToolTip(getMessage("seektime-menu-label"))
|
||||||
window.seekButton.pressed.connect(self.seekPosition)
|
window.seekButton.pressed.connect(self.seekFromButton)
|
||||||
window.seekInput.setText("0:00")
|
window.seekInput.setText("0:00")
|
||||||
window.seekInput.setFixedWidth(60)
|
window.seekInput.setFixedWidth(60)
|
||||||
window.playbackLayout.addWidget(window.seekInput)
|
window.playbackLayout.addWidget(window.seekInput)
|
||||||
@ -536,7 +542,7 @@ class MainWindow(QtGui.QMainWindow):
|
|||||||
window.pauseAction = window.playbackMenu.addAction(QtGui.QIcon(self.resourcespath + 'control_pause_blue.png'), getMessage("pause-menu-label"))
|
window.pauseAction = window.playbackMenu.addAction(QtGui.QIcon(self.resourcespath + 'control_pause_blue.png'), getMessage("pause-menu-label"))
|
||||||
window.pauseAction.triggered.connect(self.pause)
|
window.pauseAction.triggered.connect(self.pause)
|
||||||
window.seekAction = window.playbackMenu.addAction(QtGui.QIcon(self.resourcespath + 'clock_go.png'), getMessage("seektime-menu-label"))
|
window.seekAction = window.playbackMenu.addAction(QtGui.QIcon(self.resourcespath + 'clock_go.png'), getMessage("seektime-menu-label"))
|
||||||
window.seekAction.triggered.connect(self.seekPosition)
|
window.seekAction.triggered.connect(self.seekPositionDialog)
|
||||||
window.unseekAction = window.playbackMenu.addAction(QtGui.QIcon(self.resourcespath + 'arrow_undo.png'), getMessage("undoseek-menu-label"))
|
window.unseekAction = window.playbackMenu.addAction(QtGui.QIcon(self.resourcespath + 'arrow_undo.png'), getMessage("undoseek-menu-label"))
|
||||||
window.unseekAction.triggered.connect(self.undoSeek)
|
window.unseekAction.triggered.connect(self.undoSeek)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user