@@ -971,6 +971,18 @@ def setup_ui(self):
971971 # Progress bar
972972 self .progress_bar = QProgressBar ()
973973 self .progress_bar .setVisible (False )
974+ self .progress_bar .setStyleSheet ("""
975+ QProgressBar {
976+ border: 2px solid #bbb;
977+ border-radius: 5px;
978+ text-align: center;
979+ font-weight: bold;
980+ }
981+ QProgressBar::chunk {
982+ background-color: #007acc;
983+ border-radius: 3px;
984+ }
985+ """ )
974986 toolbar_layout .addWidget (self .progress_bar )
975987
976988 main_layout .addLayout (toolbar_layout )
@@ -1027,6 +1039,9 @@ def setup_ui(self):
10271039 self .status_bar = QStatusBar ()
10281040 self .setStatusBar (self .status_bar )
10291041 self .status_bar .showMessage ("Ready - Configure SDKs to begin" )
1042+
1043+ # New added file list
1044+ self .new_files = []
10301045
10311046 def setup_drag_drop (self ):
10321047 """Setup drag and drop functionality"""
@@ -1053,16 +1068,11 @@ def dropEvent(self, event: QDropEvent):
10531068 for ext in ['*.png' , '*.jpg' , '*.jpeg' , '*.bmp' , '*.tiff' ]:
10541069 new_files .extend (Path (path ).glob (ext ))
10551070 new_files .extend (Path (path ).glob (ext .upper ()))
1056-
1071+
10571072 if new_files :
10581073 # Convert Path objects to strings
1059- new_files = [str (f ) for f in new_files ]
1060- self .add_image_files (new_files )
1061-
1062- # If a folder was dropped and we have SDKs configured, process all images
1063- # if folder_dropped and len(self.sdk_versions) >= 2:
1064- # self.process_batch_images(new_files)
1065- # Processing will be triggered automatically by selecting the last added image
1074+ self .new_files = [str (f ) for f in new_files ]
1075+ self .add_image_files (self .new_files )
10661076
10671077 def show_sdk_config (self ):
10681078 """Show SDK configuration dialog"""
@@ -1099,6 +1109,7 @@ def add_images(self):
10991109 "Image Files (*.png *.jpg *.jpeg *.bmp *.tiff);;All Files (*)"
11001110 )
11011111 if files :
1112+ self .new_files = [str (f ) for f in files ]
11021113 self .add_image_files (files )
11031114
11041115 def add_image_files (self , files : List [str ]):
@@ -1158,74 +1169,6 @@ def on_image_selected(self, current_item, previous_item):
11581169 # Clear results table
11591170 self .results_table .setRowCount (0 )
11601171
1161- def process_batch_images (self , image_files : List [str ]):
1162- """Process a batch of images from folder drop"""
1163- if not image_files or len (self .sdk_versions ) < 2 :
1164- return
1165-
1166- # Show progress
1167- self .progress_bar .setVisible (True )
1168- self .progress_bar .setRange (0 , len (image_files ) * len (self .sdk_versions ))
1169- self .progress_bar .setValue (0 )
1170-
1171- self .status_bar .showMessage (f"Processing { len (image_files )} images in batch..." )
1172-
1173- # Stop existing thread if running
1174- if self .processing_thread and self .processing_thread .isRunning ():
1175- self .processing_thread .terminate ()
1176- self .processing_thread .wait (1000 )
1177-
1178- # Start batch processing
1179- self .processing_thread = ProcessingThread (image_files , self .sdk_versions )
1180-
1181- # Connect signals for batch processing
1182- self .processing_thread .result_ready .connect (
1183- self .on_batch_result_ready , Qt .ConnectionType .QueuedConnection
1184- )
1185- self .processing_thread .processing_complete .connect (
1186- self .on_batch_processing_complete , Qt .ConnectionType .QueuedConnection
1187- )
1188-
1189- self .processing_thread .start ()
1190-
1191- def on_batch_result_ready (self , image_path : str , sdk_name : str , result : ProcessingResult ):
1192- """Handle batch processing result"""
1193- if image_path not in self .results :
1194- self .results [image_path ] = {}
1195-
1196- self .results [image_path ][sdk_name ] = result
1197-
1198- # Update progress
1199- current_value = self .progress_bar .value () + 1
1200- self .progress_bar .setValue (current_value )
1201-
1202- # Update status
1203- barcodes_found = len (result .barcodes ) if result .success else 0
1204- status_msg = f"Batch processing: { os .path .basename (image_path )} with { sdk_name } - { barcodes_found } barcodes"
1205- self .status_bar .showMessage (status_msg )
1206-
1207- # If we have results from all SDKs for this image, add to table
1208- if len (self .results [image_path ]) == len (self .sdk_versions ):
1209- self .results_table .add_or_update_result (image_path , self .results [image_path ])
1210-
1211- def on_batch_processing_complete (self ):
1212- """Handle batch processing completion"""
1213- self .progress_bar .setVisible (False )
1214-
1215- total_images = len ([img for img in self .results .keys () if len (self .results [img ]) == len (self .sdk_versions )])
1216- total_barcodes = sum (
1217- sum (len (result .barcodes ) for result in img_results .values ())
1218- for img_results in self .results .values ()
1219- if len (img_results ) == len (self .sdk_versions )
1220- )
1221-
1222- self .status_bar .showMessage (f"✅ Batch processing complete! { total_images } images, { total_barcodes } total barcodes found." )
1223-
1224- # Clean up thread
1225- if self .processing_thread :
1226- self .processing_thread .wait ()
1227- self .processing_thread = None
1228-
12291172 def process_selected_image (self , image_path : str ):
12301173 """Process a single selected image"""
12311174 if not image_path or not os .path .exists (image_path ):
@@ -1250,7 +1193,7 @@ def process_selected_image(self, image_path: str):
12501193
12511194 # Show progress
12521195 self .progress_bar .setVisible (True )
1253- self .progress_bar .setRange (0 , len (self .sdk_versions ))
1196+ self .progress_bar .setRange (0 , len (self .sdk_versions ) * len ( self . new_files ) )
12541197 self .progress_bar .setValue (0 )
12551198
12561199 self .status_bar .showMessage (f"Processing { os .path .basename (image_path )} ..." )
@@ -1261,7 +1204,7 @@ def process_selected_image(self, image_path: str):
12611204 self .processing_thread .wait (1000 )
12621205
12631206 # Start processing the selected image
1264- self .processing_thread = ProcessingThread ([ image_path ] , self .sdk_versions )
1207+ self .processing_thread = ProcessingThread (self . new_files , self .sdk_versions )
12651208
12661209 # Connect signals
12671210 self .processing_thread .result_ready .connect (
@@ -1329,15 +1272,15 @@ def update_single_image_display(self, image_path: str):
13291272
13301273 def clear_all (self ):
13311274 """Clear all data"""
1332- self .image_comparison .sdk1_results_text .clear ()
1333- self .image_comparison .sdk2_results_text .clear ()
13341275 self .image_files .clear ()
13351276 self .file_list .clear ()
13361277 self .results .clear ()
13371278 self .results_table .setRowCount (0 )
13381279 self .image_comparison .sdk1_scene .clear ()
13391280 self .image_comparison .sdk2_scene .clear ()
13401281 self .image_comparison .summary_label .setText ("Add images to begin comparison" )
1282+ self .image_comparison .sdk1_results_text .clear ()
1283+ self .image_comparison .sdk2_results_text .clear ()
13411284 self .status_bar .showMessage ("Cleared all data" )
13421285
13431286 def show_image_comparison (self , image_path : str ):
0 commit comments