misc: small fix or general refactoring i did not bother commenting

This commit is contained in:
Simone Margaritelli 2019-10-23 19:53:23 +02:00
parent 84616827ad
commit d636c2b1f2
No known key found for this signature in database
GPG Key ID: 82E42E7F3B34C97E
2 changed files with 8 additions and 4 deletions

View File

@ -67,6 +67,7 @@ def is_excluded(what):
def on_ui_update(ui): def on_ui_update(ui):
if UNREAD_MESSAGES > 0: if UNREAD_MESSAGES > 0:
logging.debug("[grid] unread:%d total:%d" % (UNREAD_MESSAGES, TOTAL_MESSAGES))
ui.on_unread_messages(UNREAD_MESSAGES, TOTAL_MESSAGES) ui.on_unread_messages(UNREAD_MESSAGES, TOTAL_MESSAGES)

View File

@ -70,8 +70,11 @@ class Voice:
self._('My crime is that of curiosity ...')]) self._('My crime is that of curiosity ...')])
def on_new_peer(self, peer): def on_new_peer(self, peer):
if peer.first_encounter():
return random.choice([
self._('Hello {name}! Nice to meet you.').format(name=peer.name())])
else:
return random.choice([ return random.choice([
self._('Hello {name}! Nice to meet you.').format(name=peer.name()),
self._('Unit {name} is nearby!').format(name=peer.name())]) self._('Unit {name} is nearby!').format(name=peer.name())])
def on_lost_peer(self, peer): def on_lost_peer(self, peer):