fix: pass selected cache path to conversion worker
- Worker now accepts cache_path parameter - _start_conversion passes the selected path to worker - Fixes 'Cache folder not found' error during conversion
This commit is contained in:
parent
681b07688c
commit
46e84b39e3
|
|
@ -29,17 +29,22 @@ class TGAConvertWorker(QThread):
|
|||
conversion_complete = pyqtSignal(int, int) # success_count, total_count
|
||||
conversion_error = pyqtSignal(str)
|
||||
|
||||
def __init__(self, converter: TGAConverter):
|
||||
def __init__(self, converter: TGAConverter, cache_path: Optional[Path] = None):
|
||||
super().__init__()
|
||||
self.converter = converter
|
||||
self.cache_path = cache_path
|
||||
self._is_running = True
|
||||
|
||||
def run(self):
|
||||
"""Run the conversion."""
|
||||
try:
|
||||
# Find cache folder
|
||||
self.progress_update.emit("Finding cache folder...")
|
||||
cache_path = self.converter.find_cache_folder()
|
||||
# Use provided cache path or find it
|
||||
if self.cache_path and self.cache_path.exists():
|
||||
cache_path = self.cache_path
|
||||
self.progress_update.emit(f"Using cache folder: {cache_path}")
|
||||
else:
|
||||
self.progress_update.emit("Finding cache folder...")
|
||||
cache_path = self.converter.find_cache_folder()
|
||||
|
||||
if not cache_path:
|
||||
self.conversion_error.emit("Cache folder not found")
|
||||
|
|
@ -281,8 +286,9 @@ class TGAConverterDialog(QDialog):
|
|||
self.results_list.clear()
|
||||
self.converted_files = []
|
||||
|
||||
# Start worker
|
||||
self.convert_worker = TGAConvertWorker(self.converter)
|
||||
# Start worker with the selected cache path
|
||||
cache_path = self.converter._cache_path if self.converter._cache_path else None
|
||||
self.convert_worker = TGAConvertWorker(self.converter, cache_path)
|
||||
self.convert_worker.progress_update.connect(self._on_progress)
|
||||
self.convert_worker.file_converted.connect(self._on_file_converted)
|
||||
self.convert_worker.conversion_complete.connect(self._on_conversion_complete)
|
||||
|
|
|
|||
Loading…
Reference in New Issue