• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python messages.getMessage函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: displayIP

def displayIP(determineIP):
    print "---------------------------"
    displayLocalIPs()
    print "---------------------------"
    if determineIP:
        displayNetworkIP()
    else:
        print getMessage("no-ip-notification")
    print "---------------------------"
开发者ID:abhsag24,项目名称:syncplay,代码行数:9,代码来源:utils.py


示例17: clientConnectionLost

 def clientConnectionLost(self, connector, reason):
     if self._timesTried < self.retry:
         self._timesTried += 1
         self._client.ui.showMessage(getMessage("en", "reconnection-attempt-notification"))
         self.reconnecting = True
         reactor.callLater(0.1*(2**self._timesTried), connector.connect)
     else:
         message = getMessage("en", "disconnection-notification")
         self._client.ui.showErrorMessage(message)
开发者ID:jesskay,项目名称:syncplay,代码行数:9,代码来源:client.py


示例18: showUserList

 def showUserList(self, currentUser, rooms):
     self._usertreebuffer = QtGui.QStandardItemModel()
     self._usertreebuffer.setColumnCount(2)
     self._usertreebuffer.setHorizontalHeaderLabels((getMessage("roomuser-heading-label"),getMessage("fileplayed-heading-label")))
     usertreeRoot = self._usertreebuffer.invisibleRootItem()
     
     for room in rooms:
         roomitem = QtGui.QStandardItem(room)
         if room == currentUser.room:
             font = QtGui.QFont()
             font.setWeight(QtGui.QFont.Bold)
             roomitem.setFont(font)
         blankitem = QtGui.QStandardItem("")
         roomitem.setFlags(roomitem.flags()  & ~Qt.ItemIsEditable) 
         blankitem.setFlags(blankitem.flags() & ~Qt.ItemIsEditable)
         usertreeRoot.appendRow((roomitem, blankitem))
         for user in rooms[room]:
             useritem = QtGui.QStandardItem(user.username)
             fileitem = QtGui.QStandardItem("")
             if user.file:
                 fileitem = QtGui.QStandardItem(u"{} ({})".format(user.file['name'], formatTime(user.file['duration'])))
                 if currentUser.file:
                     sameName = sameFilename(user.file['name'], currentUser.file['name'])
                     sameSize = sameFilesize(user.file['size'], currentUser.file['size'])
                     sameDuration = sameFileduration(user.file['duration'], currentUser.file['duration'])
                     sameRoom = room == currentUser.room
                     differentName = not sameName
                     differentSize = not sameSize
                     differentDuration = not sameDuration
                     if sameName or sameRoom:
                         if differentSize and sameDuration:
                             fileitem = QtGui.QStandardItem(u"{} ({}) ({})".format(user.file['name'], formatTime(user.file['duration']), getMessage("differentsize-note")))
                         elif differentSize and differentDuration:
                             fileitem = QtGui.QStandardItem(u"{} ({}) ({})".format(user.file['name'], formatTime(user.file['duration']), getMessage("differentsizeandduration-note")))
                         elif differentDuration:
                             fileitem = QtGui.QStandardItem(u"{} ({}) ({})".format(user.file['name'], formatTime(user.file['duration']), getMessage("differentduration-note")))
                         if sameRoom and (differentName or differentSize or differentDuration):
                             fileitem.setForeground(QtGui.QBrush(QtGui.QColor(constants.STYLE_DIFFERENTITEM_COLOR)))
             else:
                 fileitem = QtGui.QStandardItem(getMessage("nofile-note"))
                 if room == currentUser.room:
                     fileitem.setForeground(QtGui.QBrush(QtGui.QColor(constants.STYLE_NOFILEITEM_COLOR)))
             if currentUser.username == user.username:
                 font = QtGui.QFont()
                 font.setWeight(QtGui.QFont.Bold)
                 useritem.setFont(font)
             useritem.setFlags(useritem.flags()  & ~Qt.ItemIsEditable)
             fileitem.setFlags(fileitem.flags()  & ~Qt.ItemIsEditable)
             roomitem.appendRow((useritem, fileitem))
    
     self.listTreeModel = self._usertreebuffer
     self.listTreeView.setModel(self.listTreeModel)
     self.listTreeView.setItemsExpandable(False)
     self.listTreeView.expandAll()
     self.listTreeView.resizeColumnToContents(0)
     self.listTreeView.resizeColumnToContents(1)
开发者ID:ion1,项目名称:syncplay,代码行数:56,代码来源:gui.py


示例19: displayNetworkIP

def displayNetworkIP():
    import socket
    try:
        s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        s.connect(("syncplay.pl",80))
        print getMessage("network-ip-notification")
        print(s.getsockname()[0])
        s.close()
    except:
        print getMessage("connection-error-notification")
开发者ID:abhsag24,项目名称:syncplay,代码行数:10,代码来源:utils.py


示例20: mpvErrorCheck

    def mpvErrorCheck(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()

        if constants and any(errormsg in line for errormsg in constants.MPV_ERROR_MESSAGES_TO_REPEAT):
            self._client.ui.showErrorMessage(line)
开发者ID:wiiaboo,项目名称:syncplay,代码行数:10,代码来源:mpv.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python syncthing_gtk.EditorDialog类代码示例发布时间:2022-05-27
下一篇:
Python syncdutils.Thread类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap