From ac267e2277e0ad14b7c079a45835ab2ad0ca0734 Mon Sep 17 00:00:00 2001 From: OpenCode Bot Date: Sun, 24 May 2026 22:51:53 +0800 Subject: [PATCH] fix: improve ui.py code quality --- temp_file_trans_client/ui.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/temp_file_trans_client/ui.py b/temp_file_trans_client/ui.py index 67f5688..dcd074a 100644 --- a/temp_file_trans_client/ui.py +++ b/temp_file_trans_client/ui.py @@ -1,10 +1,11 @@ from PySide6.QtWidgets import (QWidget, QVBoxLayout, QHBoxLayout, QLineEdit, QPushButton, QLabel, QComboBox, - QProgressBar, QTextEdit, QFrame) -from PySide6.QtCore import Qt, QRect -from PySide6.QtGui import QPixmap, QPainter, QPen, QColor, QBrush + QProgressBar, QTextEdit, QFrame, QFileDialog) +from PySide6.QtCore import Qt, Signal class DropZone(QFrame): + file_dropped = Signal(str) + def __init__(self, parent=None): super().__init__(parent) self.setAcceptDrops(True) @@ -48,14 +49,13 @@ class DropZone(QFrame): if urls: self.file_selected = urls[0].toLocalFile() event.acceptProposedAction() - self.parent().on_file_selected(self.file_selected) + self.file_dropped.emit(self.file_selected) def mousePressEvent(self, event): - from PySide6.QtWidgets import QFileDialog filepath, _ = QFileDialog.getOpenFileName(self, "选择文件") if filepath: self.file_selected = filepath - self.parent().on_file_selected(filepath) + self.file_dropped.emit(filepath) class UiCreator: @staticmethod