(self)
| 1378 | |
| 1379 | @needsClient |
| 1380 | def setOffset(self): |
| 1381 | oldoffset = str(self._syncplayClient.getUserOffset()) |
| 1382 | newoffset, ok = QtWidgets.QInputDialog.getText( |
| 1383 | self, getMessage("setoffset-msgbox-label"), |
| 1384 | getMessage("offsetinfo-msgbox-label"), QtWidgets.QLineEdit.Normal, oldoffset) |
| 1385 | if ok and newoffset != '': |
| 1386 | o = re.match(constants.UI_OFFSET_REGEX, "o " + newoffset) |
| 1387 | if o: |
| 1388 | sign = self._extractSign(o.group('sign')) |
| 1389 | t = utils.parseTime(o.group('time')) |
| 1390 | if t is None: |
| 1391 | return |
| 1392 | if o.group('sign') == "/": |
| 1393 | t = self._syncplayClient.getPlayerPosition() - t |
| 1394 | elif sign: |
| 1395 | t = self._syncplayClient.getUserOffset() + sign * t |
| 1396 | self._syncplayClient.setUserOffset(t) |
| 1397 | else: |
| 1398 | self.showErrorMessage(getMessage("invalid-offset-value")) |
| 1399 | |
| 1400 | def openUserGuide(self): |
| 1401 | if isLinux(): |
nothing calls this directly
no test coverage detected