|
15 | 15 | import subprocess |
16 | 16 | import json |
17 | 17 | import time |
18 | | -import threading |
19 | 18 | from pathlib import Path |
20 | | -from typing import Dict, List, Optional, Tuple |
| 19 | +from typing import Dict, List, Optional |
21 | 20 | from dataclasses import dataclass |
22 | 21 | import tempfile |
23 | 22 | import shutil |
24 | | -import re |
25 | 23 |
|
26 | | -# Try to import OpenCV for image processing and EXIF handling |
| 24 | +# OpenCV for image processing and EXIF handling |
27 | 25 | import cv2 |
28 | 26 | import numpy as np |
29 | 27 |
|
30 | | -# Try to import PIL as fallback |
31 | | -try: |
32 | | - from PIL import Image, ExifTags |
33 | | - PIL_AVAILABLE = True |
34 | | -except ImportError: |
35 | | - PIL_AVAILABLE = False |
36 | | - |
37 | 28 | from PySide6.QtWidgets import ( |
38 | 29 | QApplication, QMainWindow, QWidget, QVBoxLayout, QHBoxLayout, |
39 | 30 | QPushButton, QLabel, QTextEdit, QListWidget, QFrame, QGroupBox, |
40 | 31 | QProgressBar, QFileDialog, QMessageBox, QListWidgetItem, QSplitter, |
41 | | - QTabWidget, QCheckBox, QStatusBar, QScrollArea, QLineEdit, |
42 | | - QTableWidget, QTableWidgetItem, QHeaderView, QComboBox, QSpinBox, |
43 | | - QFormLayout, QTreeWidget, QTreeWidgetItem, QGraphicsView, |
44 | | - QGraphicsScene, QGraphicsPixmapItem, QGraphicsRectItem, QGraphicsTextItem, |
45 | | - QDialog # Add QDialog import |
| 32 | + QStatusBar, QTableWidget, QTableWidgetItem, QHeaderView, |
| 33 | + QGraphicsView, QGraphicsScene, QDialog |
46 | 34 | ) |
47 | 35 | from PySide6.QtCore import Qt, QThread, Signal, QTimer, QMimeData, QUrl |
48 | 36 | from PySide6.QtGui import ( |
49 | | - QPixmap, QDragEnterEvent, QDropEvent, QFont, QPainter, QPen, |
50 | | - QBrush, QColor, QAction, QIcon, QTransform, QImage |
| 37 | + QPixmap, QDragEnterEvent, QDropEvent, QFont, QColor, QImage |
51 | 38 | ) |
52 | 39 |
|
53 | 40 | def load_image_and_draw_overlays(image_path: str, results_dict: Optional[Dict[str, 'ProcessingResult']] = None) -> Dict[str, QPixmap]: |
@@ -874,10 +861,6 @@ def show_comparison(self, image_path: str, results: Dict[str, ProcessingResult]) |
874 | 861 | # Force view updates |
875 | 862 | self.sdk1_view.update() |
876 | 863 | self.sdk2_view.update() |
877 | | - |
878 | | - # The add_barcode_overlays method is no longer needed since overlays are drawn directly |
879 | | - # onto the OpenCV Mat in the load_image_and_draw_overlays function |
880 | | - |
881 | 864 | def update_barcode_text_area(self, text_area: QTextEdit, result: ProcessingResult): |
882 | 865 | """Update barcode results text area with formatted barcode data""" |
883 | 866 | text_area.clear() |
@@ -923,7 +906,6 @@ def __init__(self): |
923 | 906 | # Data |
924 | 907 | self.sdk_versions = [] |
925 | 908 | self.image_files = [] |
926 | | - self.workers = {} |
927 | 909 | self.results = {} # {image_path: {sdk_name: ProcessingResult}} |
928 | 910 | self.processing_thread = None # Initialize to None |
929 | 911 |
|
@@ -1015,7 +997,6 @@ def setup_ui(self): |
1015 | 997 | results_layout = QVBoxLayout(results_group) |
1016 | 998 |
|
1017 | 999 | self.results_table = ResultsTableWidget() |
1018 | | - # Remove the image selection connection since we use file list selection now |
1019 | 1000 | results_layout.addWidget(self.results_table) |
1020 | 1001 |
|
1021 | 1002 | # Export button (after table creation) |
@@ -1283,11 +1264,6 @@ def clear_all(self): |
1283 | 1264 | self.image_comparison.sdk2_results_text.clear() |
1284 | 1265 | self.status_bar.showMessage("Cleared all data") |
1285 | 1266 |
|
1286 | | - def show_image_comparison(self, image_path: str): |
1287 | | - """Show image comparison for selected image""" |
1288 | | - if image_path in self.results: |
1289 | | - self.image_comparison.show_comparison(image_path, self.results[image_path]) |
1290 | | - |
1291 | 1267 | class ProcessingThread(QThread): |
1292 | 1268 | """Background thread for image processing""" |
1293 | 1269 |
|
|
0 commit comments