当前位置: 首页>>代码示例>>Python>>正文


Python messages.getMessage函数代码示例

本文整理汇总了Python中syncplay.messages.getMessage函数的典型用法代码示例。如果您正苦于以下问题:Python getMessage函数的具体用法?Python getMessage怎么用?Python getMessage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了getMessage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __showUserChangeMessage

 def __showUserChangeMessage(self, username, room, file_, oldRoom=None):
     if(room):
         if self.isRoomSame(room) or self.isRoomSame(oldRoom):
             showOnOSD = constants.SHOW_SAME_ROOM_OSD
         else:
             showOnOSD = constants.SHOW_DIFFERENT_ROOM_OSD
         hideFromOSD = not showOnOSD
     if(room and not file_):
         message = getMessage("en", "room-join-notification").format(username, room)
         self.ui.showMessage(message, hideFromOSD)
     elif (room and file_):
         duration = utils.formatTime(file_['duration'])
         message = getMessage("en", "playing-notification").format(username, file_['name'], duration)
         if(self.currentUser.room <> room or self.currentUser.username == username):
             message += getMessage("en", "playing-notification/room-addendum").format(room)
         self.ui.showMessage(message, hideFromOSD)
         if(self.currentUser.file and not self.currentUser.isFileSame(file_) and self.currentUser.room == room):
             message = getMessage("en", "file-different-notification").format(username)
             self.ui.showMessage(message, not constants.SHOW_OSD_WARNINGS)
             differences = []
             differentName = not utils.sameFilename(self.currentUser.file['name'], file_['name'])
             differentSize = not utils.sameFilesize(self.currentUser.file['size'], file_['size'])
             differentDuration = not utils.sameFileduration(self.currentUser.file['duration'], file_['duration'])
             if(differentName):
                 differences.append("filename")
             if(differentSize):
                 differences.append("size")
             if(differentDuration):
                 differences.append("duration")
             message = getMessage("en", "file-differences-notification") + ", ".join(differences)
             self.ui.showMessage(message, not constants.SHOW_OSD_WARNINGS)
开发者ID:blaenk,项目名称:syncplay,代码行数:31,代码来源:client.py

示例2: __showUserChangeMessage

 def __showUserChangeMessage(self, username, room, file_):
     if(room and not file_):
         message = getMessage("en", "room-join-notification").format(username, room)
         self.ui.showMessage(message)
     elif (room and file_):
         duration = utils.formatTime(file_['duration'])
         message = getMessage("en", "playing-notification").format(username, file_['name'], duration)
         if(self.currentUser.room <> room or self.currentUser.username == username):
             message += getMessage("en", "playing-notification/room-addendum").format(room)
         self.ui.showMessage(message)
         if(self.currentUser.file and not self.currentUser.isFileSame(file_) and self.currentUser.room == room):
             message = getMessage("en", "file-different-notification").format(username)
             self.ui.showMessage(message)
             differences = []
             differentName = not utils.sameFilename(self.currentUser.file['name'], file_['name'])
             differentSize = not utils.sameFilesize(self.currentUser.file['size'], file_['size'])
             differentDuration = not utils.sameFileduration(self.currentUser.file['duration'], file_['duration'])
             if(differentName):
                 differences.append("filename")
             if(differentSize):
                 differences.append("size")
             if(differentDuration):
                 differences.append("duration")
             message = getMessage("en", "file-differences-notification") + ", ".join(differences)
             self.ui.showMessage(message)
开发者ID:haasn,项目名称:syncplay,代码行数:25,代码来源:client.py

示例3: addMiscBox

    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.playButton.setMaximumWidth(60)
            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.pauseButton.setMaximumWidth(60)
            window.miscLayout.addWidget(window.pauseButton)
            self.playButton.setToolTip(getMessage("play-tooltip"))
            self.pauseButton.setToolTip(getMessage("pause-tooltip"))
        
        window.miscGroup.setLayout(window.miscLayout)
        window.miscGroup.setFixedSize(window.miscGroup.sizeHint())
开发者ID:ion1,项目名称:syncplay,代码行数:28,代码来源:gui.py

示例4: _prepareArgParser

 def _prepareArgParser(self):
     self._argparser = argparse.ArgumentParser(description=getMessage("en", "server-argument-description"),
                                      epilog=getMessage("en", "server-argument-epilog"))
     self._argparser.add_argument('--port', metavar='port', type=str, nargs='?', help=getMessage("en", "server-port-argument"))
     self._argparser.add_argument('--password', metavar='password', type=str, nargs='?', help=getMessage("en", "server-password-argument"))
     self._argparser.add_argument('--isolate-rooms', action='store_true', help=getMessage("en", "server-isolate-room-argument"))
     self._argparser.add_argument('--motd-file', metavar='file', type=str, nargs='?', help=getMessage("en", "server-motd-argument"))
开发者ID:DerGenaue,项目名称:syncplay,代码行数:7,代码来源:server.py

示例5: mpvVersionErrorCheck

    def mpvVersionErrorCheck(self, line):
        if "Error parsing option" in line or "Error parsing commandline option" in line:
            self.quitReason = getMessage("mpv-version-error")

        elif "Could not open pipe at '/dev/stdin'" in line:
            self.reactor.callFromThread(self._client.ui.showErrorMessage, getMessage("mpv-version-error"), True)
            self.drop()
开发者ID:SLKTH,项目名称:syncplay,代码行数:7,代码来源:mpv.py

示例6: __init__

 def __init__(self, client, playerPath, filePath, args):
     from twisted.internet import reactor
     self.reactor = reactor
     self._client = client
     self._paused = None
     self._duration = None
     self._filename = None
     self._filepath = None
     try:
         self._listener = self.__Listener(self, playerPath, filePath, args)
     except ValueError:
         self._client.ui.showMessage(getMessage("en", "mplayer-file-required-notification"))
         self._client.ui.showMessage(getMessage("en", "mplayer-file-required-notification/example"))
         self.reactor.callFromThread(self._client.stop, (True),)
         return 
     self._listener.setDaemon(True)
     self._listener.start()
     
     self._durationAsk = threading.Event()
     self._filenameAsk = threading.Event()
     self._pathAsk = threading.Event()
     
     self._positionAsk = threading.Event()
     self._pausedAsk = threading.Event()
     
     self._preparePlayer()
开发者ID:dragonix11,项目名称:syncplay,代码行数:26,代码来源:mplayer.py

示例7: __init__

    def __init__(self, client, playerPath, filePath, args):
        from twisted.internet import reactor
        self.reactor = reactor
        self._client = client
        self._paused = None
        self._duration = None
        self._filename = None
        self._filepath = None
        self._filechanged = False

        self._durationAsk = threading.Event()
        self._filenameAsk = threading.Event()
        self._pathAsk = threading.Event()
        self._positionAsk = threading.Event()
        self._pausedAsk = threading.Event()
        self._vlcready = threading.Event()
        self._vlcclosed = threading.Event()
        try:
            self._listener = self.__Listener(self, playerPath, filePath, args, self._vlcready, self._vlcclosed)
        except ValueError:
            self._client.ui.showErrorMessage(getMessage("en", "vlc-failed-connection"), True)
            self.reactor.callFromThread(self._client.stop, (True),)
            return
        self._listener.setDaemon(True)
        self._listener.start()
        if(not self._vlcready.wait(constants.VLC_OPEN_MAX_WAIT_TIME)):
            self._vlcready.set()
            self._client.ui.showErrorMessage(getMessage("en", "vlc-failed-connection"), True)
            self.reactor.callFromThread(self._client.stop, (True),)
        self.reactor.callFromThread(self._client.initPlayer, (self),)
开发者ID:DerGenaue,项目名称:syncplay,代码行数:30,代码来源:vlc.py

示例8: addPlaybackLayout

    def addPlaybackLayout(self, window):
        window.playbackFrame = QtGui.QFrame()
        window.playbackFrame.setVisible(False)
        window.playbackFrame.setContentsMargins(0,0,0,0)
        window.playbackLayout = QtGui.QHBoxLayout()
        window.playbackLayout.setAlignment(Qt.AlignLeft)
        window.playbackLayout.setContentsMargins(0,0,0,0)
        window.playbackFrame.setLayout(window.playbackLayout)
        window.seekInput = QtGui.QLineEdit()
        window.seekInput.returnPressed.connect(self.seekFromButton)
        window.seekButton = QtGui.QPushButton(QtGui.QIcon(self.resourcespath + 'clock_go.png'), "")
        window.seekButton.setToolTip(getMessage("seektime-menu-label"))
        window.seekButton.pressed.connect(self.seekFromButton)
        window.seekInput.setText("0:00")
        window.seekInput.setFixedWidth(60)
        window.playbackLayout.addWidget(window.seekInput)
        window.playbackLayout.addWidget(window.seekButton)
        window.unseekButton = QtGui.QPushButton(QtGui.QIcon(self.resourcespath + 'arrow_undo.png'), "")
        window.unseekButton.setToolTip(getMessage("undoseek-menu-label"))
        window.unseekButton.pressed.connect(self.undoSeek)

        window.miscLayout = QtGui.QHBoxLayout()
        window.playbackLayout.addWidget(window.unseekButton)
        window.playButton = QtGui.QPushButton(QtGui.QIcon(self.resourcespath + 'control_play_blue.png'), "")
        window.playButton.setToolTip(getMessage("play-menu-label"))
        window.playButton.pressed.connect(self.play)
        window.playbackLayout.addWidget(window.playButton)
        window.pauseButton = QtGui.QPushButton(QtGui.QIcon(self.resourcespath + 'control_pause_blue.png'), "")
        window.pauseButton.setToolTip(getMessage("pause-menu-label"))
        window.pauseButton.pressed.connect(self.pause)
        window.playbackLayout.addWidget(window.pauseButton)
        window.playbackFrame.setMaximumHeight(window.playbackFrame.sizeHint().height())
        window.playbackFrame.setMaximumWidth(window.playbackFrame.sizeHint().width())
        window.outputLayout.addWidget(window.playbackFrame)
开发者ID:SLKTH,项目名称:syncplay,代码行数:34,代码来源:gui.py

示例9: __init__

    def __init__(self, client, playerPath, filePath, args):
        from twisted.internet import reactor
        self.reactor = reactor
        self._client = client
        self._paused = None
        self._position = 0.0
        self._duration = None
        self._filename = None
        self._filepath = None
        self.quitReason = None
        self.lastLoadedTime = None
        self.fileLoaded = False
        self.delayedFilePath = None
        try:
            self._listener = self.__Listener(self, playerPath, filePath, args)
        except ValueError:
            self._client.ui.showMessage(getMessage("mplayer-file-required-notification"))
            self._client.ui.showMessage(getMessage("mplayer-file-required-notification/example"))
            self.drop()
            return
        self._listener.setDaemon(True)
        self._listener.start()

        self._durationAsk = threading.Event()
        self._filenameAsk = threading.Event()
        self._pathAsk = threading.Event()

        self._positionAsk = threading.Event()
        self._pausedAsk = threading.Event()

        self._preparePlayer()
开发者ID:Penacillin,项目名称:syncplay,代码行数:31,代码来源:mplayer.py

示例10: lineReceived

    def lineReceived(self, line):
        if "Error parsing option" in line:
            self.quitReason = getMessage("mpv-version-error")

        match = self.RE_ANSWER.match(line)
        if not match:
            return

        name, value =[m for m in match.groups() if m]
        name = name.lower()

        if name == self.POSITION_QUERY:
            self._position = float(value)
            self._positionAsk.set()
        elif name == "pause":
            self._paused = bool(value == 'yes')
            self._pausedAsk.set()
        elif name == "length":
            self._duration = float(value)
            self._durationAsk.set()
        elif name == "path":
            self._filepath = value
            self._pathAsk.set()
        elif name == "filename":
            self._filename = value.decode('utf-8')
            self._filenameAsk.set()
        elif name == "exiting":
            if value != 'Quit':
                if self.quitReason == None:
                    self.quitReason = getMessage("media-player-error").format(value)
                self.reactor.callFromThread(self._client.ui.showErrorMessage, self.quitReason, True)
            self.drop()
开发者ID:rstanislav,项目名称:syncplay,代码行数:32,代码来源:mplayer.py

示例11: getMotd

 def getMotd(self, userIp, username, room, clientVersion):
     oldClient = False
     if constants.WARN_OLD_CLIENTS:
         if int(clientVersion.replace(".", "")) < int(constants.RECENT_CLIENT_THRESHOLD.replace(".", "")):
             oldClient = True
     if self._motdFilePath and os.path.isfile(self._motdFilePath):
         tmpl = codecs.open(self._motdFilePath, "r", "utf-8-sig").read()
         args = dict(version=syncplay.version, userIp=userIp, username=username, room=room)
         try:
             motd = Template(tmpl).substitute(args)
             if oldClient:
                 motdwarning = getMessage("new-syncplay-available-motd-message").format(clientVersion)
                 motd = "{}\n{}".format(motdwarning, motd)
             return (
                 motd
                 if len(motd) < constants.SERVER_MAX_TEMPLATE_LENGTH
                 else getMessage("server-messed-up-motd-too-long").format(
                     constants.SERVER_MAX_TEMPLATE_LENGTH, len(motd)
                 )
             )
         except ValueError:
             return getMessage("server-messed-up-motd-unescaped-placeholders")
     elif oldClient:
         return getMessage("new-syncplay-available-motd-message").format(clientVersion)
     else:
         return ""
开发者ID:Konubinix,项目名称:syncplay,代码行数:26,代码来源:server.py

示例12: __init__

 def __init__(self, client, playerPath, filePath, args):
     self._client = client
     self._paused = None
     self._duration = None
     self._filename = None
     self._filepath = None
     self._filechanged = False
     
     self._durationAsk = threading.Event()
     self._filenameAsk = threading.Event()
     self._pathAsk = threading.Event()
     self._positionAsk = threading.Event()
     self._pausedAsk = threading.Event()
     self._vlcready = threading.Event()
     try:
         self._listener = self.__Listener(self, playerPath, filePath, args, self._vlcready)
     except ValueError:
         self._client.ui.showMessage(getMessage("en", "vlc-failed-connection"))
         self._client.stop(True)
         return 
     self._listener.setDaemon(True)
     self._listener.start()
     if(not self._vlcready.wait(constants.VLC_OPEN_MAX_WAIT_TIME)):
         self._vlcready.set()
         self._client.ui.showMessage(getMessage("en", "vlc-failed-connection"))
         self._client.stop(True)
     self._client.initPlayer(self)
开发者ID:Et0h,项目名称:syncplay,代码行数:27,代码来源:vlc.py

示例13: __init__

 def __init__(self, password='', motdFilePath=None):
     print getMessage("en", "welcome-server-notification").format(syncplay.version)
     if(password):
         password = hashlib.md5(password).hexdigest()
     self.password = password
     self._motdFilePath = motdFilePath
     self._rooms = {}
     self._roomStates = {}
     self._roomUpdate = threading.RLock()
开发者ID:DerGenaue,项目名称:syncplay,代码行数:9,代码来源:server.py

示例14: _checkPassword

 def _checkPassword(self, serverPassword):
     if self._factory.password:
         if not serverPassword:
             self.dropWithError(getMessage("password-required-server-error"))
             return False
         if serverPassword != self._factory.password:
             self.dropWithError(getMessage("wrong-password-server-error"))
             return False
     return True
开发者ID:Penacillin,项目名称:syncplay,代码行数:9,代码来源:protocols.py

示例15: _promptForMissingArguments

 def _promptForMissingArguments(self):
     if(self._config['noGui']):
         print getMessage("en", "missing-arguments-error")
         sys.exit()
     elif(GuiConfiguration):
         gc = GuiConfiguration(self._config)
         gc.setAvailablePaths(self._playerFactory.getAvailablePlayerPaths())
         gc.run()
         return gc.getProcessedConfiguration()
开发者ID:Et0h,项目名称:syncplay,代码行数:9,代码来源:ConfigurationGetter.py


注:本文中的syncplay.messages.getMessage函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。