Merge a82cfded8c07753be125f69d2c600904c4da278a into 0e8cefa534540a8b9092f279821aac816955dd72

This commit is contained in:
gospodin55 2024-11-06 08:53:14 +02:00 committed by GitHub
commit 54ff6cb90b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4,6 +4,10 @@ import sys
import threading
import time
import os
try:
import readline
except ImportError:
pass
import syncplay
from syncplay import constants
@ -14,6 +18,7 @@ from syncplay.utils import formatTime, isURL
class ConsoleUI(threading.Thread):
def __init__(self):
self.isWindows = sys.platform.startswith(constants.OS_WINDOWS)
self.promptMode = threading.Event()
self.PromptResult = ""
self.promptMode.set()
@ -105,10 +110,17 @@ class ConsoleUI(threading.Thread):
message = message.decode('utf-8')
except UnicodeEncodeError:
pass
if not self.isWindows:
sys.stdout.write('\33[2K\r')
if noTimestamp:
print(message)
else:
print(time.strftime(constants.UI_TIME_FORMAT, time.localtime()) + message)
if not self.isWindows:
line = readline.get_line_buffer()
if line != '':
print(line, end='')
sys.stdout.flush()
def showDebugMessage(self, message):
print(message)