Commented Code Cleanup

This commit is contained in:
2025-05-01 16:09:02 +02:00
parent a5be50b587
commit 51ff45bd5c
16 changed files with 714 additions and 577 deletions

View File

@@ -707,15 +707,7 @@ class MainWindow(QMainWindow):
# --- Processing Action Methods ---
def start_processing(self):
# REMOVED Check for old processing handler state
# if self.processing_handler and self.processing_handler.is_running:
# log.warning("Start clicked, but processing is already running.")
# self.statusBar().showMessage("Processing is already in progress.", 3000)
# return
# REMOVED Check for old processing handler import
# if ProcessingHandler is None:
# self.statusBar().showMessage("Error: Processing components not loaded.", 5000)
# return
# Commented-out code moved to Deprecated/Old-Code/gui_main_window_py_old_processing_state_checks_line_710.py
if not hasattr(self, 'current_asset_paths') or not self.current_asset_paths:
self.statusBar().showMessage("No assets added to process.", 3000)
return
@@ -811,35 +803,13 @@ class MainWindow(QMainWindow):
self.start_button.setText("Processing...")
self.cancel_button.setEnabled(True) # Enable cancel
# --- Old direct processing call REMOVED ---
# self.set_controls_enabled(False)
# self.cancel_button.setEnabled(True)
# self.start_button.setText("Processing...")
# self.progress_bar.setValue(0)
# self.progress_bar.setFormat("%p%")
# self.setup_threads() # Ensure threads are ready (might be redundant if setup elsewhere)
# if self.processing_thread and self.processing_handler:
# # ... (old thread starting logic removed) ...
# else:
# log.error("Failed to start processing: Thread or handler not initialized.")
# self.statusBar().showMessage("Error: Failed to initialize processing thread.", 5000)
# self.set_controls_enabled(True)
# self.cancel_button.setEnabled(False)
# self.start_button.setText("Start Processing")
# Commented-out code moved to Deprecated/Old-Code/gui_main_window_py_old_direct_processing_call_line_814.py
def cancel_processing(self):
# TODO: Implement cancellation by signaling the App/main thread to stop the QThreadPool tasks
log.warning("Cancel button clicked, but cancellation logic needs reimplementation.")
self.statusBar().showMessage("Cancellation not yet implemented.", 3000)
# if self.processing_handler and self.processing_handler.is_running:
# log.info("Cancel button clicked. Requesting cancellation.")
# self.statusBar().showMessage("Requesting cancellation...", 3000)
# self.processing_handler.request_cancel() # OLD HANDLER
# self.cancel_button.setEnabled(False)
# self.start_button.setText("Cancelling...")
# else:
# log.warning("Cancel clicked, but no processing is running.")
# self.statusBar().showMessage("Nothing to cancel.", 3000)
# Commented-out code moved to Deprecated/Old-Code/gui_main_window_py_old_cancel_processing_logic_line_834.py
def clear_queue(self):
"""Clears the current asset queue and the preview table."""
@@ -891,9 +861,7 @@ class MainWindow(QMainWindow):
# Note: Cancellation is not immediate even if it existed. The thread would stop when it next checks the flag.
# We proceed with updating the UI immediately.
# --- REMOVED Old Preview Model Mode Setting and Table Configuration ---
# The Unified View does not have a simple/detailed mode toggle.
# The Prediction Handler is triggered regardless of view settings.
# Commented-out code moved to Deprecated/Old-Code/gui_main_window_py_old_preview_model_mode_setting_line_864.py
log.debug(f"[{time.time():.4f}] ### LOG: Checking if prediction handler is running")
# --- Trigger Prediction Handler ---
@@ -949,7 +917,7 @@ class MainWindow(QMainWindow):
# Clearing is handled by model's set_data now, no need to clear table view directly
if self.prediction_thread and self.prediction_handler:
# REMOVED Placeholder SourceRule creation
# Commented-out code moved to Deprecated/Old-Code/gui_main_window_py_old_placeholder_sourcerule_creation_line_922.py
# Start the prediction thread
# The thread should already be running or started once. Don't restart it here.
@@ -975,26 +943,7 @@ class MainWindow(QMainWindow):
# --- Threading and Processing Control ---
def setup_threads(self):
# --- REMOVED Old Processing Thread Setup ---
# if ProcessingHandler and self.processing_thread is None:
# self.processing_thread = QThread(self)
# self.processing_handler = ProcessingHandler()
# self.processing_handler.moveToThread(self.processing_thread)
# self.processing_handler.progress_updated.connect(self.update_progress_bar)
# self.processing_handler.file_status_updated.connect(self.update_file_status)
# self.processing_handler.processing_finished.connect(self.on_processing_finished)
# self.processing_handler.status_message.connect(self.show_status_message)
# self.processing_handler.processing_finished.connect(self.processing_thread.quit)
# self.processing_handler.processing_finished.connect(self.processing_handler.deleteLater)
# self.processing_thread.finished.connect(self.processing_thread.deleteLater)
# self.processing_thread.finished.connect(self._reset_processing_thread_references)
# log.debug("Processing thread and handler set up.")
# elif not ProcessingHandler:
# log.error("ProcessingHandler not available. Cannot set up processing thread.")
# if hasattr(self, 'start_button'):
# self.start_button.setEnabled(False)
# self.start_button.setToolTip("Error: Backend processing components failed to load.")
# --- END REMOVED ---
# Commented-out code moved to Deprecated/Old-Code/gui_main_window_py_old_processing_thread_setup_line_978.py
# Setup Prediction Thread (Keep this)
if PredictionHandler and self.prediction_thread is None:
@@ -1009,24 +958,12 @@ class MainWindow(QMainWindow):
# Assume PredictionHandler.prediction_finished signal is changed to Signal(str) -> input_path
self.prediction_handler.prediction_finished.connect(self.on_prediction_finished) # Connect finish signal (now with input_path)
self.prediction_handler.status_message.connect(self.show_status_message)
# --- REMOVED connections causing thread/handler cleanup ---
# self.prediction_handler.prediction_finished.connect(self.prediction_thread.quit)
# self.prediction_handler.prediction_finished.connect(self.prediction_handler.deleteLater)
# self.prediction_thread.finished.connect(self.prediction_thread.deleteLater)
# self.prediction_thread.finished.connect(self._reset_prediction_thread_references)
# --- END REMOVED ---
# Commented-out code moved to Deprecated/Old-Code/gui_main_window_py_old_prediction_thread_cleanup_connections_line_1012.py
log.debug("Prediction thread and handler set up to be persistent.")
elif not PredictionHandler:
log.error("PredictionHandler not available. Cannot set up prediction thread.")
# --- REMOVED Old Processing Thread Reset ---
# @Slot()
# def _reset_processing_thread_references(self):
# # This might still be needed if processing is meant to be single-shot
# log.debug("Resetting processing thread and handler references.")
# self.processing_thread = None
# self.processing_handler = None
# --- END REMOVED ---
# Commented-out code moved to Deprecated/Old-Code/gui_main_window_py_old_reset_processing_thread_references_slot_line_1022.py
@Slot()
def _reset_prediction_thread_references(self):
@@ -1045,12 +982,7 @@ class MainWindow(QMainWindow):
self.progress_bar.setValue(0)
self.progress_bar.setFormat("0/0")
# Slot for prediction results (Updated for new format and coloring) - REMOVED
# @Slot(list)
# def on_prediction_results_ready(self, results: list):
# """Populates the preview table model with detailed prediction results."""
# # This is no longer needed as _on_rule_hierarchy_ready handles data loading for the new model.
# pass
# Commented-out code moved to Deprecated/Old-Code/gui_main_window_py_old_on_prediction_results_ready_slot_line_987.py
# Slot signature assumes prediction_finished signal is updated to emit input_path: Signal(str)
# Slot signature assumes prediction_finished signal is updated to emit input_path: Signal(str)
@@ -1617,11 +1549,7 @@ class MainWindow(QMainWindow):
event.accept() # Accept close event
# --- REMOVED Slots for Old Hierarchy and Rule Editor ---
# @Slot(QModelIndex)
# def _on_hierarchy_item_clicked(self, index: QModelIndex): ...
# @Slot(object)
# def _on_rule_updated(self, rule_object): ...
# Commented-out code moved to Deprecated/Old-Code/gui_main_window_py_old_hierarchy_and_rule_editor_slots_line_1553.py
# Slot signature assumes rule_hierarchy_ready signal is updated to emit input_path: Signal(str, list)
# Slot signature matches rule_hierarchy_ready = Signal(list)