From 739c6b6116f8febea74435fabc3e01ff1b80d9ae Mon Sep 17 00:00:00 2001 From: Matthew Maxwell Date: Wed, 22 Jan 2025 09:26:54 -0800 Subject: [PATCH] fixed codestyle --- .../python/windows_gui/main.py | 43 ++++++++++++++----- size.py | 7 --- 2 files changed, 33 insertions(+), 17 deletions(-) delete mode 100644 size.py diff --git a/recipes/llm-voice-assistant/python/windows_gui/main.py b/recipes/llm-voice-assistant/python/windows_gui/main.py index f3b1296..be023de 100644 --- a/recipes/llm-voice-assistant/python/windows_gui/main.py +++ b/recipes/llm-voice-assistant/python/windows_gui/main.py @@ -524,7 +524,7 @@ def update(self, value, text=''): self.prev = current self.window.box() self.window.write(1, 2, self.title.ljust(12) + text.rjust(self.window.width - 16)) - self.window.write(2, 2, Window.color(self.color), display0) + self.window.write(2, 2, Window.color(self.color), display0) for i in range(3, self.window.height - 1): self.window.write(i, 2, Window.color(self.color), display1) @@ -577,23 +577,46 @@ def __init__(self, queue: Queue, config): self.prompt = self.screen.subwin(1, self.screen.width - 2, self.screen.height - 2, 1) if height >= 30 and width >= 120: - self.widgets['pcm_in'] = VerticalBar(self.screen.subwin(self.screen.height - 10, 20, 7, 2), 'You', [38, 2, 55, 255, 125]) - self.widgets['pcm_out'] = VerticalBar(self.screen.subwin(self.screen.height - 10, 20, 7, 23), 'AI', [38, 2, 55, 125, 255]) + self.widgets['pcm_in'] = VerticalBar( + self.screen.subwin(self.screen.height - 10, 20, 7, 2), + 'You', + [38, 2, 55, 255, 125]) + self.widgets['pcm_out'] = VerticalBar( + self.screen.subwin(self.screen.height - 10, 20, 7, 23), + 'AI', + [38, 2, 55, 125, 255]) elif height >= 17: bar_width = (width - 4) // 2 - self.widgets['pcm_in'] = VerticalBar(self.screen.subwin(self.screen.height - 10, min(20, bar_width), 7, 2), 'You', [38, 2, 55, 255, 125]) - self.widgets['pcm_out'] = VerticalBar(self.screen.subwin(self.screen.height - 10, min(20, bar_width), 7, width - bar_width - 2 if bar_width < 20 else 23), 'AI', [38, 2, 55, 125, 255]) + self.widgets['pcm_in'] = VerticalBar( + self.screen.subwin(self.screen.height - 10, min(20, bar_width), 7, 2), + 'You', + [38, 2, 55, 255, 125]) + self.widgets['pcm_out'] = VerticalBar( + self.screen.subwin(self.screen.height - 10, min(20, bar_width), 7, + width - bar_width - 2 if bar_width < 20 else 23), + 'AI', + [38, 2, 55, 125, 255]) if width >= 80: if height >= 30 and sys.platform.lower().startswith('win'): bar_height = (self.screen.height - 11) // 3 - self.widgets['CPU'] = HorizontalBar(self.screen.subwin(bar_height, self.screen.width - 47, 7, 45), 'CPU') - self.widgets['GPU'] = HorizontalBar(self.screen.subwin(bar_height, self.screen.width - 47, 8 + bar_height, 45), 'GPU') - self.widgets['RAM'] = HorizontalBar(self.screen.subwin(bar_height, self.screen.width - 47, 9 + bar_height * 2, 45), 'RAM') + self.widgets['CPU'] = HorizontalBar( + self.screen.subwin(bar_height, self.screen.width - 47, 7, 45), + 'CPU') + self.widgets['GPU'] = HorizontalBar( + self.screen.subwin(bar_height, self.screen.width - 47, 8 + bar_height, 45), + 'GPU') + self.widgets['RAM'] = HorizontalBar( + self.screen.subwin(bar_height, self.screen.width - 47, 9 + bar_height * 2, 45), + 'RAM') elif height >= 19: bar_height = (self.screen.height - 11) // 2 - self.widgets['CPU'] = HorizontalBar(self.screen.subwin(bar_height, self.screen.width - 47, 7, 45), 'CPU') - self.widgets['RAM'] = HorizontalBar(self.screen.subwin(bar_height, self.screen.width - 47, 8 + bar_height, 45), 'RAM') + self.widgets['CPU'] = HorizontalBar( + self.screen.subwin(bar_height, self.screen.width - 47, 7, 45), + 'CPU') + self.widgets['RAM'] = HorizontalBar( + self.screen.subwin(bar_height, self.screen.width - 47, 8 + bar_height, 45), + 'RAM') self.screen.box() self.render_title() diff --git a/size.py b/size.py deleted file mode 100644 index e6b63d2..0000000 --- a/size.py +++ /dev/null @@ -1,7 +0,0 @@ -import os -import time - -while True: - width, height = os.get_terminal_size() - print(f'{height, width}', end='\r', flush=True) - time.sleep(0.25) \ No newline at end of file