Merge branch 'main' of github.com:HuangMason320/cluster4npu

This commit is contained in:
HuangMason320 2025-07-24 19:31:55 +08:00
commit 8aafec6bfe
2 changed files with 18 additions and 12 deletions

View File

@ -289,9 +289,9 @@ class MultiDongle:
sys.exit(1)
# setting timeout of the usb communication with the device
# Note: Timeout setting removed as it causes crashes when camera is connected
print('[Set Device Timeout]')
# kp.core.set_timeout(device_group=self.device_group, milliseconds=5000)
print(' - Success')
print(' - Skipped (prevents camera connection crashes)')
# if self.upload_fw:
try:

View File

@ -32,8 +32,8 @@ from PyQt5.QtWidgets import (
QCheckBox, QGroupBox, QScrollArea, QTableWidget, QTableWidgetItem,
QHeaderView, QMessageBox, QSplitter, QFrame
)
from PyQt5.QtCore import Qt, QThread, pyqtSignal, QTimer
from PyQt5.QtGui import QFont, QColor, QPalette, QImage, QPixmap
from PyQt5.QtCore import Qt, QThread, pyqtSignal, QTimer, qRegisterMetaType
from PyQt5.QtGui import QFont, QColor, QPalette, QImage, QPixmap, QTextCursor
# Import our converter and pipeline system
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'core', 'functions'))
@ -317,6 +317,9 @@ class DeploymentDialog(QDialog):
def __init__(self, pipeline_data: Dict[str, Any], parent=None):
super().__init__(parent)
# Register QTextCursor for thread-safe signal passing
qRegisterMetaType(QTextCursor)
self.pipeline_data = pipeline_data
self.deployment_worker = None
self.pipeline_config = None
@ -877,19 +880,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}")