MCPcopy Create free account
hub / github.com/Syncplay/syncplay / showMessage

Method showMessage

syncplay/ui/gui.py:545–563  ·  view source on GitHub ↗
(self, message, noTimestamp=False, isMotd=False)

Source from the content-addressed store, hash-verified

543 return self.sslInformation
544
545 def showMessage(self, message, noTimestamp=False, isMotd=False):
546 message = str(message)
547 username = None
548 messageWithUsername = re.match(constants.MESSAGE_WITH_USERNAME_REGEX, message, re.UNICODE)
549 if messageWithUsername:
550 username = messageWithUsername.group("username")
551 message = messageWithUsername.group("message")
552 message = message.replace("&", "&amp;").replace('"', "&quot;").replace("<", "&lt;").replace(">", "&gt;")
553 if username:
554 message = constants.STYLE_USER_MESSAGE.format(constants.STYLE_USERNAME, username, message)
555 # When showing a MOTD, escape spaces and use a monospace font to preserve the look of ASCII art.
556 if isMotd:
557 message = message.replace(" ", "&nbsp;")
558 message = "<code>{}</code>".format(message)
559 message = message.replace("\n", "<br />")
560 if noTimestamp:
561 self.newMessage("{}<br />".format(message))
562 else:
563 self.newMessage(time.strftime(constants.UI_TIME_FORMAT, time.localtime()) + message + "<br />")
564
565 @needsClient
566 def getFileSwitchState(self, filename):

Callers 5

executeCommandMethod · 0.95
checkForUpdatesMethod · 0.95
__init__Method · 0.45
_create_listenerMethod · 0.45
showMessageMethod · 0.45

Calls 1

newMessageMethod · 0.95

Tested by

no test coverage detected