Refresh screen when needed

This commit is contained in:
Yohann D'ANELLO 2021-01-08 19:11:46 +01:00
parent bf130f1ede
commit c136f34d9c
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
2 changed files with 15 additions and 4 deletions

View File

@ -266,6 +266,7 @@ class User(Peer):
while True: while True:
self.refresh_history() self.refresh_history()
self.refresh_input() self.refresh_input()
self.refresh_emoji_pad()
if not self.squinnondation.no_emoji: if not self.squinnondation.no_emoji:
self.refresh_emoji_pad() self.refresh_emoji_pad()
try: try:
@ -666,7 +667,6 @@ class User(Peer):
self.recent_messages.pop(key) self.recent_messages.pop(key)
def main_inundation(self) -> None: def main_inundation(self) -> None:
""" """
The main inundation function. The main inundation function.
""" """
@ -1047,6 +1047,7 @@ class Listener(Thread):
self.user.add_system_message("An error occurred while receiving a packet: {}".format(error)) self.user.add_system_message("An error occurred while receiving a packet: {}".format(error))
self.user.refresh_history() self.user.refresh_history()
self.user.refresh_input() self.user.refresh_input()
self.user.refresh_emoji_pad()
else: else:
if peer.banned: if peer.banned:
# Ignore banned peers # Ignore banned peers
@ -1056,6 +1057,7 @@ class Listener(Thread):
tlv.handle(self.user, peer) tlv.handle(self.user, peer)
self.user.refresh_history() self.user.refresh_history()
self.user.refresh_input() self.user.refresh_input()
self.user.refresh_emoji_pad()
class Multicastlistener(Thread): class Multicastlistener(Thread):
""" """
@ -1074,6 +1076,7 @@ class Multicastlistener(Thread):
self.user.add_system_message("An error occurred while receiving a packet: {}".format(error)) self.user.add_system_message("An error occurred while receiving a packet: {}".format(error))
self.user.refresh_history() self.user.refresh_history()
self.user.refresh_input() self.user.refresh_input()
self.user.refresh_emoji_pad()
else: else:
if peer.banned: if peer.banned:
# Ignore banned peers # Ignore banned peers
@ -1085,6 +1088,7 @@ class Multicastlistener(Thread):
tlv.handle(self.user, peer) tlv.handle(self.user, peer)
self.user.refresh_history() self.user.refresh_history()
self.user.refresh_input() self.user.refresh_input()
self.user.refresh_emoji_pad()
class PeerManager(Thread): class PeerManager(Thread):
@ -1134,6 +1138,10 @@ class PeerManager(Thread):
self.user.send_hello_multicast() self.user.send_hello_multicast()
self.last_multicast = time.time() self.last_multicast = time.time()
self.user.refresh_history()
self.user.refresh_input()
self.user.refresh_emoji_pad()
# Avoid infinite loops # Avoid infinite loops
time.sleep(1) time.sleep(1)
@ -1157,6 +1165,10 @@ class Inondator(Thread):
# inundate # inundate
self.user.main_inundation() self.user.main_inundation()
self.user.refresh_history()
self.user.refresh_input()
self.user.refresh_emoji_pad()
# Avoid infinite loops # Avoid infinite loops
time.sleep(1) time.sleep(1)

View File

@ -76,8 +76,7 @@ class Squinnondation:
user.refresh_history() user.refresh_history()
user.refresh_input() user.refresh_input()
if not instance.no_emoji: user.refresh_emoji_pad()
user.refresh_emoji_pad()
if instance.args.client_address and instance.args.client_port: if instance.args.client_address and instance.args.client_port:
peer = Peer(address=instance.args.client_address, port=instance.args.client_port) peer = Peer(address=instance.args.client_address, port=instance.args.client_port)