diff --git a/cluster4npu_ui/core/functions/Multidongle.py b/cluster4npu_ui/core/functions/Multidongle.py index 6e1c88b..8700f27 100644 --- a/cluster4npu_ui/core/functions/Multidongle.py +++ b/cluster4npu_ui/core/functions/Multidongle.py @@ -290,7 +290,7 @@ class MultiDongle: # setting timeout of the usb communication with the device print('[Set Device Timeout]') - # kp.core.set_timeout(device_group=self.device_group, milliseconds=5000) + kp.core.set_timeout(device_group=self.device_group, milliseconds=5000) print(' - Success') # if self.upload_fw: diff --git a/cluster4npu_ui/ui/dialogs/deployment.py b/cluster4npu_ui/ui/dialogs/deployment.py index abc20b3..e327bc7 100644 --- a/cluster4npu_ui/ui/dialogs/deployment.py +++ b/cluster4npu_ui/ui/dialogs/deployment.py @@ -877,19 +877,22 @@ Stage Configurations: def update_terminal_output(self, terminal_text: str): """Update the terminal output display with new text.""" try: - # Append to terminal display (keep last 200 lines) - current_text = self.terminal_output_display.toPlainText() - lines = current_text.split('\n') - if len(lines) > 200: - lines = lines[-100:] # Keep last 100 lines - current_text = '\n'.join(lines) - - self.terminal_output_display.setPlainText(current_text + terminal_text) + # Use append() instead of setPlainText() for better performance and no truncation + self.terminal_output_display.append(terminal_text.rstrip('\n')) # Auto-scroll to bottom scrollbar = self.terminal_output_display.verticalScrollBar() scrollbar.setValue(scrollbar.maximum()) + # Optional: Limit total lines to prevent excessive memory usage + # Only trim if we have way too many lines (e.g., > 1000) + document = self.terminal_output_display.document() + if document.lineCount() > 1000: + cursor = self.terminal_output_display.textCursor() + cursor.movePosition(cursor.Start) + cursor.movePosition(cursor.Down, cursor.KeepAnchor, 200) # Select first 200 lines + cursor.removeSelectedText() + except Exception as e: print(f"Error updating terminal output: {e}")