Move controlled room messages to messages.py
This commit is contained in:
parent
09df507235
commit
e3255d1b92
@ -445,8 +445,7 @@ class SyncplayClient(object):
|
|||||||
|
|
||||||
@requireMinServerVersion("1.3.0")
|
@requireMinServerVersion("1.3.0")
|
||||||
def createControlledRoom(self, roomName):
|
def createControlledRoom(self, roomName):
|
||||||
controlPassword = utils.RandomStringGenerator.generate_room_
|
controlPassword = utils.RandomStringGenerator.generate_room_password()
|
||||||
password()
|
|
||||||
self.ui.showMessage(u"Attempting to create controlled room '{}' with password '{}'...".format(roomName, controlPassword))
|
self.ui.showMessage(u"Attempting to create controlled room '{}' with password '{}'...".format(roomName, controlPassword))
|
||||||
self.lastControlPasswordAttempt = controlPassword
|
self.lastControlPasswordAttempt = controlPassword
|
||||||
self._protocol.requestControlledRoom(roomName, controlPassword)
|
self._protocol.requestControlledRoom(roomName, controlPassword)
|
||||||
@ -467,18 +466,18 @@ class SyncplayClient(object):
|
|||||||
@requireMinServerVersion("1.3.0")
|
@requireMinServerVersion("1.3.0")
|
||||||
def identifyAsController(self, controlPassword):
|
def identifyAsController(self, controlPassword):
|
||||||
controlPassword = self.stripControlPassword(controlPassword)
|
controlPassword = self.stripControlPassword(controlPassword)
|
||||||
self.ui.showMessage(u"Identifying as room controller with password '{}'...".format(controlPassword))
|
self.ui.showMessage(getMessage("identifying-as-controller-notification").format(controlPassword))
|
||||||
self.lastControlPasswordAttempt = controlPassword
|
self.lastControlPasswordAttempt = controlPassword
|
||||||
self._protocol.requestControlledRoom(self.getRoom(), controlPassword)
|
self._protocol.requestControlledRoom(self.getRoom(), controlPassword)
|
||||||
|
|
||||||
def controllerIdentificationError(self, username, room):
|
def controllerIdentificationError(self, username, room):
|
||||||
self.ui.showErrorMessage(u"<{}> failed to identify as a room controller.".format(username))
|
self.ui.showErrorMessage(getMessage("failed-to-identify-as-controller-notification").format(username))
|
||||||
|
|
||||||
def controllerIdentificationSuccess(self, username, roomname):
|
def controllerIdentificationSuccess(self, username, roomname):
|
||||||
self.userlist.setUserAsController(username)
|
self.userlist.setUserAsController(username)
|
||||||
if self.userlist.isRoomSame(roomname):
|
if self.userlist.isRoomSame(roomname):
|
||||||
hideFromOSD = not constants.SHOW_SAME_ROOM_OSD
|
hideFromOSD = not constants.SHOW_SAME_ROOM_OSD
|
||||||
self.ui.showMessage(u"<{}> authenticated as a room controller".format(username), hideFromOSD)
|
self.ui.showMessage(getMessage("authenticated-as-controller-notification").format(username), hideFromOSD)
|
||||||
if username == self.userlist.currentUser.username:
|
if username == self.userlist.currentUser.username:
|
||||||
self.storeControlPassword(roomname, self.lastControlPasswordAttempt)
|
self.storeControlPassword(roomname, self.lastControlPasswordAttempt)
|
||||||
self.ui.userListChange()
|
self.ui.userListChange()
|
||||||
|
|||||||
@ -31,8 +31,12 @@ en = {
|
|||||||
"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
|
||||||
|
|
||||||
|
"identifying-as-controller-notification" : u"Identifying as room controller with password '{}'...",
|
||||||
|
"failed-to-identify-as-controller-notification" : u"<{}> failed to identify as a room controller.",
|
||||||
|
"authenticated-as-controller-notification" : u"<{}> authenticated as a room controller",
|
||||||
|
|
||||||
"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): ", # controlPassword
|
||||||
"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",
|
||||||
|
|
||||||
@ -188,12 +192,22 @@ en = {
|
|||||||
"exit-menu-label" : "E&xit",
|
"exit-menu-label" : "E&xit",
|
||||||
"advanced-menu-label" : "&Advanced",
|
"advanced-menu-label" : "&Advanced",
|
||||||
"setoffset-menu-label" : "Set &offset",
|
"setoffset-menu-label" : "Set &offset",
|
||||||
|
"createcontrolledroom-menu-label" : "&Create controlled room",
|
||||||
|
"identifyascontroller-menu-label" : "&Identify as room controller",
|
||||||
|
|
||||||
"help-menu-label" : "&Help",
|
"help-menu-label" : "&Help",
|
||||||
"userguide-menu-label" : "Open user &guide",
|
"userguide-menu-label" : "Open user &guide",
|
||||||
|
|
||||||
"setoffset-msgbox-label" : "Set offset",
|
"setoffset-msgbox-label" : "Set offset",
|
||||||
"offsetinfo-msgbox-label" : "Offset (see http://syncplay.pl/guide/ for usage instructions):",
|
"offsetinfo-msgbox-label" : "Offset (see http://syncplay.pl/guide/ for usage instructions):",
|
||||||
|
|
||||||
|
|
||||||
|
"createcontrolledroom-msgbox-label" : "Create controlled room",
|
||||||
|
"controlledroominfo-msgbox-label" : "Enter name of controlled room\r\n(see http://syncplay.pl/guide/ for usage instructions):",
|
||||||
|
|
||||||
|
"identifyascontroller-msgbox-label" : "Identify as Room Controller",
|
||||||
|
"identifyinfo-msgbox-label" : "Enter controller password for this room\r\n(see http://syncplay.pl/guide/ for usage instructions):",
|
||||||
|
|
||||||
"megabyte-suffix" : " MB",
|
"megabyte-suffix" : " MB",
|
||||||
|
|
||||||
# Tooltips
|
# Tooltips
|
||||||
|
|||||||
@ -364,16 +364,16 @@ class MainWindow(QtGui.QMainWindow):
|
|||||||
self._syncplayClient._player.openFile(fileName)
|
self._syncplayClient._player.openFile(fileName)
|
||||||
|
|
||||||
def createControlledRoom(self):
|
def createControlledRoom(self):
|
||||||
controlroom, ok = QtGui.QInputDialog.getText(self, "Create controlled room",
|
controlroom, ok = QtGui.QInputDialog.getText(self, getMessage("createcontrolledroom-msgbox-label"),
|
||||||
"Enter name of controlled room\r\n(see http://syncplay.pl/guide/ for usage instructions):", QtGui.QLineEdit.Normal,
|
getMessage("controlledroominfo-msgbox-label"), QtGui.QLineEdit.Normal,
|
||||||
utils.stripRoomName(self._syncplayClient.getRoom()))
|
utils.stripRoomName(self._syncplayClient.getRoom()))
|
||||||
if ok and controlroom != '':
|
if ok and controlroom != '':
|
||||||
self._syncplayClient.createControlledRoom(controlroom)
|
self._syncplayClient.createControlledRoom(controlroom)
|
||||||
|
|
||||||
def identifyAsController(self):
|
def identifyAsController(self):
|
||||||
tooltip = "Enter controller password for this room\r\n(see http://syncplay.pl/guide/ for usage instructions):"
|
msgboxtitle = getMessage("identifyascontroller-msgbox-label")
|
||||||
name = "Identify as Room Controller"
|
msgboxtext = getMessage("identifyinfo-msgbox-label")
|
||||||
controlpassword, ok = QtGui.QInputDialog.getText(self, name, tooltip, QtGui.QLineEdit.Normal, "")
|
controlpassword, ok = QtGui.QInputDialog.getText(self, msgboxtitle, msgboxtext, QtGui.QLineEdit.Normal, "")
|
||||||
if ok and controlpassword != '':
|
if ok and controlpassword != '':
|
||||||
self._syncplayClient.identifyAsController(controlpassword)
|
self._syncplayClient.identifyAsController(controlpassword)
|
||||||
|
|
||||||
@ -568,10 +568,10 @@ class MainWindow(QtGui.QMainWindow):
|
|||||||
window.setoffsetAction.triggered.connect(self.setOffset)
|
window.setoffsetAction.triggered.connect(self.setOffset)
|
||||||
|
|
||||||
window.createcontrolledroomAction = window.advancedMenu.addAction(
|
window.createcontrolledroomAction = window.advancedMenu.addAction(
|
||||||
QtGui.QIcon(self.resourcespath + 'page_white_key.png'), "&Create controlled room suffix")
|
QtGui.QIcon(self.resourcespath + 'page_white_key.png'), getMessage("createcontrolledroom-menu-label"))
|
||||||
window.createcontrolledroomAction.triggered.connect(self.createControlledRoom)
|
window.createcontrolledroomAction.triggered.connect(self.createControlledRoom)
|
||||||
window.identifyascontroller = window.advancedMenu.addAction(QtGui.QIcon(self.resourcespath + 'key_go.png'),
|
window.identifyascontroller = window.advancedMenu.addAction(QtGui.QIcon(self.resourcespath + 'key_go.png'),
|
||||||
"&Identify as room controller")
|
getMessage("identifyascontroller-menu-label"))
|
||||||
window.identifyascontroller.triggered.connect(self.identifyAsController)
|
window.identifyascontroller.triggered.connect(self.identifyAsController)
|
||||||
window.menuBar.addMenu(window.advancedMenu)
|
window.menuBar.addMenu(window.advancedMenu)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user