@@ -13,6 +13,7 @@ def __init__(self, config, match_functions, bv, func):
1313 super ().__init__ ()
1414 self .config = config
1515 self .match_functions = match_functions
16+ self .results = []
1617 self .selected_results = []
1718 self .bv = bv
1819 self .func = func
@@ -206,6 +207,8 @@ def init_ui(self):
206207 header .setSectionResizeMode (6 , QHeaderView .Stretch )
207208 self .results_table .setAlternatingRowColors (True )
208209 self .results_table .verticalHeader ().setVisible (False )
210+ self .results_table .setSelectionBehavior (QTableWidget .SelectRows )
211+ self .results_table .setSelectionMode (QTableWidget .SingleSelection )
209212
210213 #functions_group_layout.addLayout(search_input_layout)
211214 functions_group_layout .addWidget (filter_group )
@@ -307,15 +310,16 @@ def on_matching_finished(self, success, data):
307310
308311 def populate_results_table (self , results ):
309312 self .selected_results .clear ()
313+ self .results = results
310314
311315 self .results_table .setRowCount (0 )
312316 self .results_table .setRowCount (len (results ))
313-
317+
314318 try :
315319 self .results_table .itemChanged .disconnect ()
316320 except TypeError :
317321 pass # No connections to disconnect
318-
322+
319323 if len (results ) > 0 :
320324 self .rename_button .setEnabled (True )
321325 self .rename_button .setStyleSheet ("""
@@ -397,6 +401,8 @@ def populate_results_table(self, results):
397401 self .results_table .cellClicked .connect (self .on_checkbox_changed )
398402
399403 def on_checkbox_changed (self , item_or_row , column = None ):
404+ log_info (f"RevEng.AI | on_checkbox_changed: { item_or_row } , { column } " )
405+
400406 """Handle checkbox changes to ensure only one is selected at a time"""
401407 if isinstance (item_or_row , QTableWidgetItem ): # Called from itemChanged
402408 row = item_or_row .row ()
@@ -405,12 +411,14 @@ def on_checkbox_changed(self, item_or_row, column=None):
405411 row = item_or_row
406412 is_checkbox = column == 0
407413
414+ log_info (f"RevEng.AI | row: { row } , is_checkbox: { is_checkbox } " )
415+ log_info (f"RevEng.AI | len(self.results): { len (self .results )} " )
408416 # Get the match data for this row
409- if row < len (self .current_matches ):
410- match = self .current_matches [row ]
417+ if row < len (self .results ):
418+ match = self .results [row ]
411419 else :
412420 return
413-
421+ log_info ( f"RevEng.AI | match: { match } " )
414422 if match :
415423 checkbox_item = self .results_table .item (row , 0 )
416424 current_state = checkbox_item .checkState ()
@@ -432,11 +440,11 @@ def on_checkbox_changed(self, item_or_row, column=None):
432440 other_checkbox .setCheckState (Qt .Unchecked )
433441
434442 # Update selected result with the current match
435- self .selected_result = match
436- log_info (f"RevEng.AI | Selected function match: { match .get ('matched_name ' , 'Unknown' )} " )
443+ self .selected_results = [ match ]
444+ log_info (f"RevEng.AI | Selected function match: { match .get ('matched_function_name ' , 'Unknown' )} " )
437445 else :
438446 # If unchecked, clear selection
439- self .selected_result = {}
447+ self .selected_result = []
440448 log_info (f"RevEng.AI | Deselected function match" )
441449
442450 def start_fetching_data_types (self ):
@@ -446,14 +454,14 @@ def start_fetching_data_types(self):
446454 self .progress = create_cancellable_progress_dialog (self , "RevEng.AI Fetch Data Types" , "Fetching data types..." , self .match_functions .cancel )
447455 self .progress .show ()
448456 QCoreApplication .processEvents ()
449-
457+ """
450458 if not hasattr(self, 'selected_results') or not self.selected_results:
451459 log_error("RevEng.AI | No current matches available for data type fetching")
452460 self.progress.close()
453461 QMessageBox.warning(self,"RevEng.AI Fetch Data Types","No function matches available. Please run 'Fetch Results' first.", QMessageBox.Ok)
454462 return
455-
456- self .fetch_data_types_thread = DataThread (self .match_functions .fetch_data_types , self .bv , self .selected_results , self .match_functions .clear_cancelled )
463+ """
464+ self .fetch_data_types_thread = DataThread (self .match_functions .fetch_data_types , self .bv , self .results , self .match_functions .clear_cancelled )
457465 self .fetch_data_types_thread .finished .connect (self .on_fetching_data_types_finished )
458466 self .fetch_data_types_thread .start ()
459467
@@ -491,6 +499,7 @@ def start_renaming(self):
491499 self .progress = create_progress_dialog (self , "RevEng.AI Rename Selected Functions" , "Renaming Selected Functions..." )
492500 self .progress .show ()
493501 QCoreApplication .processEvents ()
502+ log_info (f"RevEng.AI | Selected results: { len (self .selected_results )} " )
494503
495504 self .rename_thread = DataThread (
496505 self .match_functions .rename_functions ,
0 commit comments