import json import subprocess import openpyxl import os import psutil from PyQt6 import * from PyQt6.QtCore import * class LogProcessor(QObject): def __init__(self): super().__init__() @pyqtSlot(str, result=list) def get_txt_files(self, directory): if not os.path.isdir(directory): return [] txt_files = [] for entry in os.listdir(directory): full_path = os.path.join(directory, entry) if os.path.isfile(full_path) and entry.lower().endswith('.txt'): txt_files.append(full_path) return txt_files @pyqtSlot(str,result=str) def read_file(self, file_path): try: with open(file_path, 'r', encoding='utf-8') as file: return file.read() except Exception as e: print(f"Error reading file {file_path}: {e}") return f"Error reading file {file_path}: {e}" log_processor = LogProcessor()